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 serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Describes an autoscaling policy for Dataproc cluster autoscaler.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct AutoscalingPolicy {
43    /// Required. The policy id.
44    ///
45    /// The id must contain only letters (a-z, A-Z), numbers (0-9),
46    /// underscores (_), and hyphens (-). Cannot begin or end with underscore
47    /// or hyphen. Must consist of between 3 and 50 characters.
48    pub id: std::string::String,
49
50    /// Output only. The "resource name" of the autoscaling policy, as described
51    /// in <https://cloud.google.com/apis/design/resource_names>.
52    ///
53    /// * For `projects.regions.autoscalingPolicies`, the resource name of the
54    ///   policy has the following format:
55    ///   `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
56    ///
57    /// * For `projects.locations.autoscalingPolicies`, the resource name of the
58    ///   policy has the following format:
59    ///   `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
60    ///
61    pub name: std::string::String,
62
63    /// Required. Describes how the autoscaler will operate for primary workers.
64    pub worker_config: std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
65
66    /// Optional. Describes how the autoscaler will operate for secondary workers.
67    pub secondary_worker_config:
68        std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
69
70    /// Optional. The labels to associate with this autoscaling policy.
71    /// Label **keys** must contain 1 to 63 characters, and must conform to
72    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
73    /// Label **values** may be empty, but, if present, must contain 1 to 63
74    /// characters, and must conform to [RFC
75    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
76    /// associated with an autoscaling policy.
77    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
78
79    /// Optional. The type of the clusters for which this autoscaling policy is to
80    /// be configured.
81    pub cluster_type: crate::model::autoscaling_policy::ClusterType,
82
83    /// Autoscaling algorithm for policy.
84    pub algorithm: std::option::Option<crate::model::autoscaling_policy::Algorithm>,
85
86    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl AutoscalingPolicy {
90    /// Creates a new default instance.
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://googleapis.github.io/google-cloud-rust/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        #[allow(missing_docs)]
438        BasicAlgorithm(std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>),
439    }
440}
441
442/// Basic algorithm for autoscaling.
443#[derive(Clone, Default, PartialEq)]
444#[non_exhaustive]
445pub struct BasicAutoscalingAlgorithm {
446    /// Optional. Duration between scaling events. A scaling period starts after
447    /// the update operation from the previous event has completed.
448    ///
449    /// Bounds: [2m, 1d]. Default: 2m.
450    pub cooldown_period: std::option::Option<wkt::Duration>,
451
452    #[allow(missing_docs)]
453    pub config: std::option::Option<crate::model::basic_autoscaling_algorithm::Config>,
454
455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
456}
457
458impl BasicAutoscalingAlgorithm {
459    /// Creates a new default instance.
460    pub fn new() -> Self {
461        std::default::Default::default()
462    }
463
464    /// Sets the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
465    ///
466    /// # Example
467    /// ```ignore,no_run
468    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
469    /// use wkt::Duration;
470    /// let x = BasicAutoscalingAlgorithm::new().set_cooldown_period(Duration::default()/* use setters */);
471    /// ```
472    pub fn set_cooldown_period<T>(mut self, v: T) -> Self
473    where
474        T: std::convert::Into<wkt::Duration>,
475    {
476        self.cooldown_period = std::option::Option::Some(v.into());
477        self
478    }
479
480    /// Sets or clears the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
481    ///
482    /// # Example
483    /// ```ignore,no_run
484    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
485    /// use wkt::Duration;
486    /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(Some(Duration::default()/* use setters */));
487    /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(None::<Duration>);
488    /// ```
489    pub fn set_or_clear_cooldown_period<T>(mut self, v: std::option::Option<T>) -> Self
490    where
491        T: std::convert::Into<wkt::Duration>,
492    {
493        self.cooldown_period = v.map(|x| x.into());
494        self
495    }
496
497    /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config].
498    ///
499    /// Note that all the setters affecting `config` are mutually
500    /// exclusive.
501    ///
502    /// # Example
503    /// ```ignore,no_run
504    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
505    /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
506    /// let x = BasicAutoscalingAlgorithm::new().set_config(Some(
507    ///     google_cloud_dataproc_v1::model::basic_autoscaling_algorithm::Config::YarnConfig(BasicYarnAutoscalingConfig::default().into())));
508    /// ```
509    pub fn set_config<
510        T: std::convert::Into<std::option::Option<crate::model::basic_autoscaling_algorithm::Config>>,
511    >(
512        mut self,
513        v: T,
514    ) -> Self {
515        self.config = v.into();
516        self
517    }
518
519    /// The value of [config][crate::model::BasicAutoscalingAlgorithm::config]
520    /// if it holds a `YarnConfig`, `None` if the field is not set or
521    /// holds a different branch.
522    pub fn yarn_config(
523        &self,
524    ) -> std::option::Option<&std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>> {
525        #[allow(unreachable_patterns)]
526        self.config.as_ref().and_then(|v| match v {
527            crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v) => {
528                std::option::Option::Some(v)
529            }
530            _ => std::option::Option::None,
531        })
532    }
533
534    /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config]
535    /// to hold a `YarnConfig`.
536    ///
537    /// Note that all the setters affecting `config` are
538    /// mutually exclusive.
539    ///
540    /// # Example
541    /// ```ignore,no_run
542    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
543    /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
544    /// let x = BasicAutoscalingAlgorithm::new().set_yarn_config(BasicYarnAutoscalingConfig::default()/* use setters */);
545    /// assert!(x.yarn_config().is_some());
546    /// ```
547    pub fn set_yarn_config<
548        T: std::convert::Into<std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>>,
549    >(
550        mut self,
551        v: T,
552    ) -> Self {
553        self.config = std::option::Option::Some(
554            crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v.into()),
555        );
556        self
557    }
558}
559
560impl wkt::message::Message for BasicAutoscalingAlgorithm {
561    fn typename() -> &'static str {
562        "type.googleapis.com/google.cloud.dataproc.v1.BasicAutoscalingAlgorithm"
563    }
564}
565
566/// Defines additional types related to [BasicAutoscalingAlgorithm].
567pub mod basic_autoscaling_algorithm {
568    #[allow(unused_imports)]
569    use super::*;
570
571    #[allow(missing_docs)]
572    #[derive(Clone, Debug, PartialEq)]
573    #[non_exhaustive]
574    pub enum Config {
575        /// Required. YARN autoscaling configuration.
576        YarnConfig(std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>),
577    }
578}
579
580/// Basic autoscaling configurations for YARN.
581#[derive(Clone, Default, PartialEq)]
582#[non_exhaustive]
583pub struct BasicYarnAutoscalingConfig {
584    /// Required. Timeout for YARN graceful decommissioning of Node Managers.
585    /// Specifies the duration to wait for jobs to complete before forcefully
586    /// removing workers (and potentially interrupting jobs). Only applicable to
587    /// downscaling operations.
588    ///
589    /// Bounds: [0s, 1d].
590    pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
591
592    /// Required. Fraction of average YARN pending memory in the last cooldown
593    /// period for which to add workers. A scale-up factor of 1.0 will result in
594    /// scaling up so that there is no pending memory remaining after the update
595    /// (more aggressive scaling). A scale-up factor closer to 0 will result in a
596    /// smaller magnitude of scaling up (less aggressive scaling). See [How
597    /// autoscaling
598    /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
599    /// for more information.
600    ///
601    /// Bounds: [0.0, 1.0].
602    pub scale_up_factor: f64,
603
604    /// Required. Fraction of average YARN pending memory in the last cooldown
605    /// period for which to remove workers. A scale-down factor of 1 will result in
606    /// scaling down so that there is no available memory remaining after the
607    /// update (more aggressive scaling). A scale-down factor of 0 disables
608    /// removing workers, which can be beneficial for autoscaling a single job.
609    /// See [How autoscaling
610    /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
611    /// for more information.
612    ///
613    /// Bounds: [0.0, 1.0].
614    pub scale_down_factor: f64,
615
616    /// Optional. Minimum scale-up threshold as a fraction of total cluster size
617    /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
618    /// 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
619    /// the cluster to scale. A threshold of 0 means the autoscaler will scale up
620    /// on any recommended change.
621    ///
622    /// Bounds: [0.0, 1.0]. Default: 0.0.
623    pub scale_up_min_worker_fraction: f64,
624
625    /// Optional. Minimum scale-down threshold as a fraction of total cluster size
626    /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
627    /// 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
628    /// the cluster to scale. A threshold of 0 means the autoscaler will scale down
629    /// on any recommended change.
630    ///
631    /// Bounds: [0.0, 1.0]. Default: 0.0.
632    pub scale_down_min_worker_fraction: f64,
633
634    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
635}
636
637impl BasicYarnAutoscalingConfig {
638    /// Creates a new default instance.
639    pub fn new() -> Self {
640        std::default::Default::default()
641    }
642
643    /// Sets the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
644    ///
645    /// # Example
646    /// ```ignore,no_run
647    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
648    /// use wkt::Duration;
649    /// let x = BasicYarnAutoscalingConfig::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
650    /// ```
651    pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
652    where
653        T: std::convert::Into<wkt::Duration>,
654    {
655        self.graceful_decommission_timeout = std::option::Option::Some(v.into());
656        self
657    }
658
659    /// Sets or clears the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
660    ///
661    /// # Example
662    /// ```ignore,no_run
663    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
664    /// use wkt::Duration;
665    /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
666    /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
667    /// ```
668    pub fn set_or_clear_graceful_decommission_timeout<T>(
669        mut self,
670        v: std::option::Option<T>,
671    ) -> Self
672    where
673        T: std::convert::Into<wkt::Duration>,
674    {
675        self.graceful_decommission_timeout = v.map(|x| x.into());
676        self
677    }
678
679    /// Sets the value of [scale_up_factor][crate::model::BasicYarnAutoscalingConfig::scale_up_factor].
680    ///
681    /// # Example
682    /// ```ignore,no_run
683    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
684    /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_factor(42.0);
685    /// ```
686    pub fn set_scale_up_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
687        self.scale_up_factor = v.into();
688        self
689    }
690
691    /// Sets the value of [scale_down_factor][crate::model::BasicYarnAutoscalingConfig::scale_down_factor].
692    ///
693    /// # Example
694    /// ```ignore,no_run
695    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
696    /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_factor(42.0);
697    /// ```
698    pub fn set_scale_down_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
699        self.scale_down_factor = v.into();
700        self
701    }
702
703    /// Sets the value of [scale_up_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_up_min_worker_fraction].
704    ///
705    /// # Example
706    /// ```ignore,no_run
707    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
708    /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_min_worker_fraction(42.0);
709    /// ```
710    pub fn set_scale_up_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
711        self.scale_up_min_worker_fraction = v.into();
712        self
713    }
714
715    /// Sets the value of [scale_down_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_down_min_worker_fraction].
716    ///
717    /// # Example
718    /// ```ignore,no_run
719    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
720    /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_min_worker_fraction(42.0);
721    /// ```
722    pub fn set_scale_down_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
723        self.scale_down_min_worker_fraction = v.into();
724        self
725    }
726}
727
728impl wkt::message::Message for BasicYarnAutoscalingConfig {
729    fn typename() -> &'static str {
730        "type.googleapis.com/google.cloud.dataproc.v1.BasicYarnAutoscalingConfig"
731    }
732}
733
734/// Configuration for the size bounds of an instance group, including its
735/// proportional size to other groups.
736#[derive(Clone, Default, PartialEq)]
737#[non_exhaustive]
738pub struct InstanceGroupAutoscalingPolicyConfig {
739    /// Optional. Minimum number of instances for this group.
740    ///
741    /// Primary workers - Bounds: [2, max_instances]. Default: 2.
742    /// Secondary workers - Bounds: [0, max_instances]. Default: 0.
743    pub min_instances: i32,
744
745    /// Required. Maximum number of instances for this group. Required for primary
746    /// workers. Note that by default, clusters will not use secondary workers.
747    /// Required for secondary workers if the minimum secondary instances is set.
748    ///
749    /// Primary workers - Bounds: [min_instances, ).
750    /// Secondary workers - Bounds: [min_instances, ). Default: 0.
751    pub max_instances: i32,
752
753    /// Optional. Weight for the instance group, which is used to determine the
754    /// fraction of total workers in the cluster from this instance group.
755    /// For example, if primary workers have weight 2, and secondary workers have
756    /// weight 1, the cluster will have approximately 2 primary workers for each
757    /// secondary worker.
758    ///
759    /// The cluster may not reach the specified balance if constrained
760    /// by min/max bounds or other autoscaling settings. For example, if
761    /// `max_instances` for secondary workers is 0, then only primary workers will
762    /// be added. The cluster can also be out of balance when created.
763    ///
764    /// If weight is not set on any instance group, the cluster will default to
765    /// equal weight for all groups: the cluster will attempt to maintain an equal
766    /// number of workers in each group within the configured size bounds for each
767    /// group. If weight is set for one group only, the cluster will default to
768    /// zero weight on the unset group. For example if weight is set only on
769    /// primary workers, the cluster will use primary workers only and no
770    /// secondary workers.
771    pub weight: i32,
772
773    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
774}
775
776impl InstanceGroupAutoscalingPolicyConfig {
777    /// Creates a new default instance.
778    pub fn new() -> Self {
779        std::default::Default::default()
780    }
781
782    /// Sets the value of [min_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::min_instances].
783    ///
784    /// # Example
785    /// ```ignore,no_run
786    /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
787    /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_min_instances(42);
788    /// ```
789    pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
790        self.min_instances = v.into();
791        self
792    }
793
794    /// Sets the value of [max_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::max_instances].
795    ///
796    /// # Example
797    /// ```ignore,no_run
798    /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
799    /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_max_instances(42);
800    /// ```
801    pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
802        self.max_instances = v.into();
803        self
804    }
805
806    /// Sets the value of [weight][crate::model::InstanceGroupAutoscalingPolicyConfig::weight].
807    ///
808    /// # Example
809    /// ```ignore,no_run
810    /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
811    /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_weight(42);
812    /// ```
813    pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
814        self.weight = v.into();
815        self
816    }
817}
818
819impl wkt::message::Message for InstanceGroupAutoscalingPolicyConfig {
820    fn typename() -> &'static str {
821        "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig"
822    }
823}
824
825/// A request to create an autoscaling policy.
826#[derive(Clone, Default, PartialEq)]
827#[non_exhaustive]
828pub struct CreateAutoscalingPolicyRequest {
829    /// Required. The "resource name" of the region or location, as described
830    /// in <https://cloud.google.com/apis/design/resource_names>.
831    ///
832    /// * For `projects.regions.autoscalingPolicies.create`, the resource name
833    ///   of the region has the following format:
834    ///   `projects/{project_id}/regions/{region}`
835    ///
836    /// * For `projects.locations.autoscalingPolicies.create`, the resource name
837    ///   of the location has the following format:
838    ///   `projects/{project_id}/locations/{location}`
839    ///
840    pub parent: std::string::String,
841
842    /// Required. The autoscaling policy to create.
843    pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
844
845    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
846}
847
848impl CreateAutoscalingPolicyRequest {
849    /// Creates a new default instance.
850    pub fn new() -> Self {
851        std::default::Default::default()
852    }
853
854    /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
855    ///
856    /// # Example
857    /// ```ignore,no_run
858    /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
859    /// let x = CreateAutoscalingPolicyRequest::new().set_parent("example");
860    /// ```
861    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
862        self.parent = v.into();
863        self
864    }
865
866    /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
867    ///
868    /// # Example
869    /// ```ignore,no_run
870    /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
871    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
872    /// let x = CreateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
873    /// ```
874    pub fn set_policy<T>(mut self, v: T) -> Self
875    where
876        T: std::convert::Into<crate::model::AutoscalingPolicy>,
877    {
878        self.policy = std::option::Option::Some(v.into());
879        self
880    }
881
882    /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
883    ///
884    /// # Example
885    /// ```ignore,no_run
886    /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
887    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
888    /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
889    /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
890    /// ```
891    pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
892    where
893        T: std::convert::Into<crate::model::AutoscalingPolicy>,
894    {
895        self.policy = v.map(|x| x.into());
896        self
897    }
898}
899
900impl wkt::message::Message for CreateAutoscalingPolicyRequest {
901    fn typename() -> &'static str {
902        "type.googleapis.com/google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest"
903    }
904}
905
906/// A request to fetch an autoscaling policy.
907#[derive(Clone, Default, PartialEq)]
908#[non_exhaustive]
909pub struct GetAutoscalingPolicyRequest {
910    /// Required. The "resource name" of the autoscaling policy, as described
911    /// in <https://cloud.google.com/apis/design/resource_names>.
912    ///
913    /// * For `projects.regions.autoscalingPolicies.get`, the resource name
914    ///   of the policy has the following format:
915    ///   `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
916    ///
917    /// * For `projects.locations.autoscalingPolicies.get`, the resource name
918    ///   of the policy has the following format:
919    ///   `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
920    ///
921    pub name: std::string::String,
922
923    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
924}
925
926impl GetAutoscalingPolicyRequest {
927    /// Creates a new default instance.
928    pub fn new() -> Self {
929        std::default::Default::default()
930    }
931
932    /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
933    ///
934    /// # Example
935    /// ```ignore,no_run
936    /// # use google_cloud_dataproc_v1::model::GetAutoscalingPolicyRequest;
937    /// let x = GetAutoscalingPolicyRequest::new().set_name("example");
938    /// ```
939    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
940        self.name = v.into();
941        self
942    }
943}
944
945impl wkt::message::Message for GetAutoscalingPolicyRequest {
946    fn typename() -> &'static str {
947        "type.googleapis.com/google.cloud.dataproc.v1.GetAutoscalingPolicyRequest"
948    }
949}
950
951/// A request to update an autoscaling policy.
952#[derive(Clone, Default, PartialEq)]
953#[non_exhaustive]
954pub struct UpdateAutoscalingPolicyRequest {
955    /// Required. The updated autoscaling policy.
956    pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
957
958    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
959}
960
961impl UpdateAutoscalingPolicyRequest {
962    /// Creates a new default instance.
963    pub fn new() -> Self {
964        std::default::Default::default()
965    }
966
967    /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
968    ///
969    /// # Example
970    /// ```ignore,no_run
971    /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
972    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
973    /// let x = UpdateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
974    /// ```
975    pub fn set_policy<T>(mut self, v: T) -> Self
976    where
977        T: std::convert::Into<crate::model::AutoscalingPolicy>,
978    {
979        self.policy = std::option::Option::Some(v.into());
980        self
981    }
982
983    /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
984    ///
985    /// # Example
986    /// ```ignore,no_run
987    /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
988    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
989    /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
990    /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
991    /// ```
992    pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
993    where
994        T: std::convert::Into<crate::model::AutoscalingPolicy>,
995    {
996        self.policy = v.map(|x| x.into());
997        self
998    }
999}
1000
1001impl wkt::message::Message for UpdateAutoscalingPolicyRequest {
1002    fn typename() -> &'static str {
1003        "type.googleapis.com/google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest"
1004    }
1005}
1006
1007/// A request to delete an autoscaling policy.
1008///
1009/// Autoscaling policies in use by one or more clusters will not be deleted.
1010#[derive(Clone, Default, PartialEq)]
1011#[non_exhaustive]
1012pub struct DeleteAutoscalingPolicyRequest {
1013    /// Required. The "resource name" of the autoscaling policy, as described
1014    /// in <https://cloud.google.com/apis/design/resource_names>.
1015    ///
1016    /// * For `projects.regions.autoscalingPolicies.delete`, the resource name
1017    ///   of the policy has the following format:
1018    ///   `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
1019    ///
1020    /// * For `projects.locations.autoscalingPolicies.delete`, the resource name
1021    ///   of the policy has the following format:
1022    ///   `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
1023    ///
1024    pub name: std::string::String,
1025
1026    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1027}
1028
1029impl DeleteAutoscalingPolicyRequest {
1030    /// Creates a new default instance.
1031    pub fn new() -> Self {
1032        std::default::Default::default()
1033    }
1034
1035    /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
1036    ///
1037    /// # Example
1038    /// ```ignore,no_run
1039    /// # use google_cloud_dataproc_v1::model::DeleteAutoscalingPolicyRequest;
1040    /// let x = DeleteAutoscalingPolicyRequest::new().set_name("example");
1041    /// ```
1042    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1043        self.name = v.into();
1044        self
1045    }
1046}
1047
1048impl wkt::message::Message for DeleteAutoscalingPolicyRequest {
1049    fn typename() -> &'static str {
1050        "type.googleapis.com/google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest"
1051    }
1052}
1053
1054/// A request to list autoscaling policies in a project.
1055#[derive(Clone, Default, PartialEq)]
1056#[non_exhaustive]
1057pub struct ListAutoscalingPoliciesRequest {
1058    /// Required. The "resource name" of the region or location, as described
1059    /// in <https://cloud.google.com/apis/design/resource_names>.
1060    ///
1061    /// * For `projects.regions.autoscalingPolicies.list`, the resource name
1062    ///   of the region has the following format:
1063    ///   `projects/{project_id}/regions/{region}`
1064    ///
1065    /// * For `projects.locations.autoscalingPolicies.list`, the resource name
1066    ///   of the location has the following format:
1067    ///   `projects/{project_id}/locations/{location}`
1068    ///
1069    pub parent: std::string::String,
1070
1071    /// Optional. The maximum number of results to return in each response.
1072    /// Must be less than or equal to 1000. Defaults to 100.
1073    pub page_size: i32,
1074
1075    /// Optional. The page token, returned by a previous call, to request the
1076    /// next page of results.
1077    pub page_token: std::string::String,
1078
1079    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1080}
1081
1082impl ListAutoscalingPoliciesRequest {
1083    /// Creates a new default instance.
1084    pub fn new() -> Self {
1085        std::default::Default::default()
1086    }
1087
1088    /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
1089    ///
1090    /// # Example
1091    /// ```ignore,no_run
1092    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1093    /// let x = ListAutoscalingPoliciesRequest::new().set_parent("example");
1094    /// ```
1095    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1096        self.parent = v.into();
1097        self
1098    }
1099
1100    /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
1101    ///
1102    /// # Example
1103    /// ```ignore,no_run
1104    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1105    /// let x = ListAutoscalingPoliciesRequest::new().set_page_size(42);
1106    /// ```
1107    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1108        self.page_size = v.into();
1109        self
1110    }
1111
1112    /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
1113    ///
1114    /// # Example
1115    /// ```ignore,no_run
1116    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1117    /// let x = ListAutoscalingPoliciesRequest::new().set_page_token("example");
1118    /// ```
1119    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1120        self.page_token = v.into();
1121        self
1122    }
1123}
1124
1125impl wkt::message::Message for ListAutoscalingPoliciesRequest {
1126    fn typename() -> &'static str {
1127        "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest"
1128    }
1129}
1130
1131/// A response to a request to list autoscaling policies in a project.
1132#[derive(Clone, Default, PartialEq)]
1133#[non_exhaustive]
1134pub struct ListAutoscalingPoliciesResponse {
1135    /// Output only. Autoscaling policies list.
1136    pub policies: std::vec::Vec<crate::model::AutoscalingPolicy>,
1137
1138    /// Output only. This token is included in the response if there are more
1139    /// results to fetch.
1140    pub next_page_token: std::string::String,
1141
1142    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1143}
1144
1145impl ListAutoscalingPoliciesResponse {
1146    /// Creates a new default instance.
1147    pub fn new() -> Self {
1148        std::default::Default::default()
1149    }
1150
1151    /// Sets the value of [policies][crate::model::ListAutoscalingPoliciesResponse::policies].
1152    ///
1153    /// # Example
1154    /// ```ignore,no_run
1155    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1156    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
1157    /// let x = ListAutoscalingPoliciesResponse::new()
1158    ///     .set_policies([
1159    ///         AutoscalingPolicy::default()/* use setters */,
1160    ///         AutoscalingPolicy::default()/* use (different) setters */,
1161    ///     ]);
1162    /// ```
1163    pub fn set_policies<T, V>(mut self, v: T) -> Self
1164    where
1165        T: std::iter::IntoIterator<Item = V>,
1166        V: std::convert::Into<crate::model::AutoscalingPolicy>,
1167    {
1168        use std::iter::Iterator;
1169        self.policies = v.into_iter().map(|i| i.into()).collect();
1170        self
1171    }
1172
1173    /// Sets the value of [next_page_token][crate::model::ListAutoscalingPoliciesResponse::next_page_token].
1174    ///
1175    /// # Example
1176    /// ```ignore,no_run
1177    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1178    /// let x = ListAutoscalingPoliciesResponse::new().set_next_page_token("example");
1179    /// ```
1180    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1181        self.next_page_token = v.into();
1182        self
1183    }
1184}
1185
1186impl wkt::message::Message for ListAutoscalingPoliciesResponse {
1187    fn typename() -> &'static str {
1188        "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse"
1189    }
1190}
1191
1192#[doc(hidden)]
1193impl google_cloud_gax::paginator::internal::PageableResponse for ListAutoscalingPoliciesResponse {
1194    type PageItem = crate::model::AutoscalingPolicy;
1195
1196    fn items(self) -> std::vec::Vec<Self::PageItem> {
1197        self.policies
1198    }
1199
1200    fn next_page_token(&self) -> std::string::String {
1201        use std::clone::Clone;
1202        self.next_page_token.clone()
1203    }
1204}
1205
1206/// A request to create a batch workload.
1207#[derive(Clone, Default, PartialEq)]
1208#[non_exhaustive]
1209pub struct CreateBatchRequest {
1210    /// Required. The parent resource where this batch will be created.
1211    pub parent: std::string::String,
1212
1213    /// Required. The batch to create.
1214    pub batch: std::option::Option<crate::model::Batch>,
1215
1216    /// Optional. The ID to use for the batch, which will become the final
1217    /// component of the batch's resource name.
1218    ///
1219    /// This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
1220    pub batch_id: std::string::String,
1221
1222    /// Optional. A unique ID used to identify the request. If the service
1223    /// receives two
1224    /// [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
1225    /// with the same request_id, the second request is ignored and the
1226    /// Operation that corresponds to the first Batch created and stored
1227    /// in the backend is returned.
1228    ///
1229    /// Recommendation: Set this value to a
1230    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
1231    ///
1232    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
1233    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
1234    pub request_id: std::string::String,
1235
1236    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1237}
1238
1239impl CreateBatchRequest {
1240    /// Creates a new default instance.
1241    pub fn new() -> Self {
1242        std::default::Default::default()
1243    }
1244
1245    /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1246    ///
1247    /// # Example
1248    /// ```ignore,no_run
1249    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1250    /// let x = CreateBatchRequest::new().set_parent("example");
1251    /// ```
1252    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1253        self.parent = v.into();
1254        self
1255    }
1256
1257    /// Sets the value of [batch][crate::model::CreateBatchRequest::batch].
1258    ///
1259    /// # Example
1260    /// ```ignore,no_run
1261    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1262    /// use google_cloud_dataproc_v1::model::Batch;
1263    /// let x = CreateBatchRequest::new().set_batch(Batch::default()/* use setters */);
1264    /// ```
1265    pub fn set_batch<T>(mut self, v: T) -> Self
1266    where
1267        T: std::convert::Into<crate::model::Batch>,
1268    {
1269        self.batch = std::option::Option::Some(v.into());
1270        self
1271    }
1272
1273    /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1274    ///
1275    /// # Example
1276    /// ```ignore,no_run
1277    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1278    /// use google_cloud_dataproc_v1::model::Batch;
1279    /// let x = CreateBatchRequest::new().set_or_clear_batch(Some(Batch::default()/* use setters */));
1280    /// let x = CreateBatchRequest::new().set_or_clear_batch(None::<Batch>);
1281    /// ```
1282    pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1283    where
1284        T: std::convert::Into<crate::model::Batch>,
1285    {
1286        self.batch = v.map(|x| x.into());
1287        self
1288    }
1289
1290    /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1291    ///
1292    /// # Example
1293    /// ```ignore,no_run
1294    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1295    /// let x = CreateBatchRequest::new().set_batch_id("example");
1296    /// ```
1297    pub fn set_batch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1298        self.batch_id = v.into();
1299        self
1300    }
1301
1302    /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1303    ///
1304    /// # Example
1305    /// ```ignore,no_run
1306    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1307    /// let x = CreateBatchRequest::new().set_request_id("example");
1308    /// ```
1309    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1310        self.request_id = v.into();
1311        self
1312    }
1313}
1314
1315impl wkt::message::Message for CreateBatchRequest {
1316    fn typename() -> &'static str {
1317        "type.googleapis.com/google.cloud.dataproc.v1.CreateBatchRequest"
1318    }
1319}
1320
1321/// A request to get the resource representation for a batch workload.
1322#[derive(Clone, Default, PartialEq)]
1323#[non_exhaustive]
1324pub struct GetBatchRequest {
1325    /// Required. The fully qualified name of the batch to retrieve
1326    /// in the format
1327    /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1328    pub name: std::string::String,
1329
1330    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1331}
1332
1333impl GetBatchRequest {
1334    /// Creates a new default instance.
1335    pub fn new() -> Self {
1336        std::default::Default::default()
1337    }
1338
1339    /// Sets the value of [name][crate::model::GetBatchRequest::name].
1340    ///
1341    /// # Example
1342    /// ```ignore,no_run
1343    /// # use google_cloud_dataproc_v1::model::GetBatchRequest;
1344    /// let x = GetBatchRequest::new().set_name("example");
1345    /// ```
1346    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1347        self.name = v.into();
1348        self
1349    }
1350}
1351
1352impl wkt::message::Message for GetBatchRequest {
1353    fn typename() -> &'static str {
1354        "type.googleapis.com/google.cloud.dataproc.v1.GetBatchRequest"
1355    }
1356}
1357
1358/// A request to list batch workloads in a project.
1359#[derive(Clone, Default, PartialEq)]
1360#[non_exhaustive]
1361pub struct ListBatchesRequest {
1362    /// Required. The parent, which owns this collection of batches.
1363    pub parent: std::string::String,
1364
1365    /// Optional. The maximum number of batches to return in each response.
1366    /// The service may return fewer than this value.
1367    /// The default page size is 20; the maximum page size is 1000.
1368    pub page_size: i32,
1369
1370    /// Optional. A page token received from a previous `ListBatches` call.
1371    /// Provide this token to retrieve the subsequent page.
1372    pub page_token: std::string::String,
1373
1374    /// Optional. A filter for the batches to return in the response.
1375    ///
1376    /// A filter is a logical expression constraining the values of various fields
1377    /// in each batch resource. Filters are case sensitive, and may contain
1378    /// multiple clauses combined with logical operators (AND/OR).
1379    /// Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`.
1380    ///
1381    /// e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"`
1382    /// filters for batches in state RUNNING that were created before 2023-01-01
1383    ///
1384    /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
1385    /// description of the filter syntax and a list of supported comparisons.
1386    pub filter: std::string::String,
1387
1388    /// Optional. Field(s) on which to sort the list of batches.
1389    ///
1390    /// Currently the only supported sort orders are unspecified (empty) and
1391    /// `create_time desc` to sort by most recently created batches first.
1392    ///
1393    /// See <https://google.aip.dev/132#ordering> for more details.
1394    pub order_by: std::string::String,
1395
1396    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1397}
1398
1399impl ListBatchesRequest {
1400    /// Creates a new default instance.
1401    pub fn new() -> Self {
1402        std::default::Default::default()
1403    }
1404
1405    /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1406    ///
1407    /// # Example
1408    /// ```ignore,no_run
1409    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1410    /// let x = ListBatchesRequest::new().set_parent("example");
1411    /// ```
1412    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1413        self.parent = v.into();
1414        self
1415    }
1416
1417    /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1418    ///
1419    /// # Example
1420    /// ```ignore,no_run
1421    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1422    /// let x = ListBatchesRequest::new().set_page_size(42);
1423    /// ```
1424    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1425        self.page_size = v.into();
1426        self
1427    }
1428
1429    /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1430    ///
1431    /// # Example
1432    /// ```ignore,no_run
1433    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1434    /// let x = ListBatchesRequest::new().set_page_token("example");
1435    /// ```
1436    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1437        self.page_token = v.into();
1438        self
1439    }
1440
1441    /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1442    ///
1443    /// # Example
1444    /// ```ignore,no_run
1445    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1446    /// let x = ListBatchesRequest::new().set_filter("example");
1447    /// ```
1448    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1449        self.filter = v.into();
1450        self
1451    }
1452
1453    /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1454    ///
1455    /// # Example
1456    /// ```ignore,no_run
1457    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1458    /// let x = ListBatchesRequest::new().set_order_by("example");
1459    /// ```
1460    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1461        self.order_by = v.into();
1462        self
1463    }
1464}
1465
1466impl wkt::message::Message for ListBatchesRequest {
1467    fn typename() -> &'static str {
1468        "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesRequest"
1469    }
1470}
1471
1472/// A list of batch workloads.
1473#[derive(Clone, Default, PartialEq)]
1474#[non_exhaustive]
1475pub struct ListBatchesResponse {
1476    /// The batches from the specified collection.
1477    pub batches: std::vec::Vec<crate::model::Batch>,
1478
1479    /// A token, which can be sent as `page_token` to retrieve the next page.
1480    /// If this field is omitted, there are no subsequent pages.
1481    pub next_page_token: std::string::String,
1482
1483    /// Output only. List of Batches that could not be included in the response.
1484    /// Attempting to get one of these resources may indicate why it was not
1485    /// included in the list response.
1486    pub unreachable: std::vec::Vec<std::string::String>,
1487
1488    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1489}
1490
1491impl ListBatchesResponse {
1492    /// Creates a new default instance.
1493    pub fn new() -> Self {
1494        std::default::Default::default()
1495    }
1496
1497    /// Sets the value of [batches][crate::model::ListBatchesResponse::batches].
1498    ///
1499    /// # Example
1500    /// ```ignore,no_run
1501    /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1502    /// use google_cloud_dataproc_v1::model::Batch;
1503    /// let x = ListBatchesResponse::new()
1504    ///     .set_batches([
1505    ///         Batch::default()/* use setters */,
1506    ///         Batch::default()/* use (different) setters */,
1507    ///     ]);
1508    /// ```
1509    pub fn set_batches<T, V>(mut self, v: T) -> Self
1510    where
1511        T: std::iter::IntoIterator<Item = V>,
1512        V: std::convert::Into<crate::model::Batch>,
1513    {
1514        use std::iter::Iterator;
1515        self.batches = v.into_iter().map(|i| i.into()).collect();
1516        self
1517    }
1518
1519    /// Sets the value of [next_page_token][crate::model::ListBatchesResponse::next_page_token].
1520    ///
1521    /// # Example
1522    /// ```ignore,no_run
1523    /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1524    /// let x = ListBatchesResponse::new().set_next_page_token("example");
1525    /// ```
1526    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1527        self.next_page_token = v.into();
1528        self
1529    }
1530
1531    /// Sets the value of [unreachable][crate::model::ListBatchesResponse::unreachable].
1532    ///
1533    /// # Example
1534    /// ```ignore,no_run
1535    /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1536    /// let x = ListBatchesResponse::new().set_unreachable(["a", "b", "c"]);
1537    /// ```
1538    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1539    where
1540        T: std::iter::IntoIterator<Item = V>,
1541        V: std::convert::Into<std::string::String>,
1542    {
1543        use std::iter::Iterator;
1544        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1545        self
1546    }
1547}
1548
1549impl wkt::message::Message for ListBatchesResponse {
1550    fn typename() -> &'static str {
1551        "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesResponse"
1552    }
1553}
1554
1555#[doc(hidden)]
1556impl google_cloud_gax::paginator::internal::PageableResponse for ListBatchesResponse {
1557    type PageItem = crate::model::Batch;
1558
1559    fn items(self) -> std::vec::Vec<Self::PageItem> {
1560        self.batches
1561    }
1562
1563    fn next_page_token(&self) -> std::string::String {
1564        use std::clone::Clone;
1565        self.next_page_token.clone()
1566    }
1567}
1568
1569/// A request to delete a batch workload.
1570#[derive(Clone, Default, PartialEq)]
1571#[non_exhaustive]
1572pub struct DeleteBatchRequest {
1573    /// Required. The fully qualified name of the batch to retrieve
1574    /// in the format
1575    /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1576    pub name: std::string::String,
1577
1578    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1579}
1580
1581impl DeleteBatchRequest {
1582    /// Creates a new default instance.
1583    pub fn new() -> Self {
1584        std::default::Default::default()
1585    }
1586
1587    /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1588    ///
1589    /// # Example
1590    /// ```ignore,no_run
1591    /// # use google_cloud_dataproc_v1::model::DeleteBatchRequest;
1592    /// let x = DeleteBatchRequest::new().set_name("example");
1593    /// ```
1594    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1595        self.name = v.into();
1596        self
1597    }
1598}
1599
1600impl wkt::message::Message for DeleteBatchRequest {
1601    fn typename() -> &'static str {
1602        "type.googleapis.com/google.cloud.dataproc.v1.DeleteBatchRequest"
1603    }
1604}
1605
1606/// A representation of a batch workload in the service.
1607#[derive(Clone, Default, PartialEq)]
1608#[non_exhaustive]
1609pub struct Batch {
1610    /// Output only. The resource name of the batch.
1611    pub name: std::string::String,
1612
1613    /// Output only. A batch UUID (Unique Universal Identifier). The service
1614    /// generates this value when it creates the batch.
1615    pub uuid: std::string::String,
1616
1617    /// Output only. The time when the batch was created.
1618    pub create_time: std::option::Option<wkt::Timestamp>,
1619
1620    /// Output only. Runtime information about batch execution.
1621    pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
1622
1623    /// Output only. The state of the batch.
1624    pub state: crate::model::batch::State,
1625
1626    /// Output only. Batch state details, such as a failure
1627    /// description if the state is `FAILED`.
1628    pub state_message: std::string::String,
1629
1630    /// Output only. The time when the batch entered a current state.
1631    pub state_time: std::option::Option<wkt::Timestamp>,
1632
1633    /// Output only. The email address of the user who created the batch.
1634    pub creator: std::string::String,
1635
1636    /// Optional. The labels to associate with this batch.
1637    /// Label **keys** must contain 1 to 63 characters, and must conform to
1638    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
1639    /// Label **values** may be empty, but, if present, must contain 1 to 63
1640    /// characters, and must conform to [RFC
1641    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
1642    /// associated with a batch.
1643    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1644
1645    /// Optional. Runtime configuration for the batch execution.
1646    pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
1647
1648    /// Optional. Environment configuration for the batch execution.
1649    pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
1650
1651    /// Output only. The resource name of the operation associated with this batch.
1652    pub operation: std::string::String,
1653
1654    /// Output only. Historical state information for the batch.
1655    pub state_history: std::vec::Vec<crate::model::batch::StateHistory>,
1656
1657    /// The application/framework-specific portion of the batch configuration.
1658    pub batch_config: std::option::Option<crate::model::batch::BatchConfig>,
1659
1660    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1661}
1662
1663impl Batch {
1664    /// Creates a new default instance.
1665    pub fn new() -> Self {
1666        std::default::Default::default()
1667    }
1668
1669    /// Sets the value of [name][crate::model::Batch::name].
1670    ///
1671    /// # Example
1672    /// ```ignore,no_run
1673    /// # use google_cloud_dataproc_v1::model::Batch;
1674    /// let x = Batch::new().set_name("example");
1675    /// ```
1676    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1677        self.name = v.into();
1678        self
1679    }
1680
1681    /// Sets the value of [uuid][crate::model::Batch::uuid].
1682    ///
1683    /// # Example
1684    /// ```ignore,no_run
1685    /// # use google_cloud_dataproc_v1::model::Batch;
1686    /// let x = Batch::new().set_uuid("example");
1687    /// ```
1688    pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1689        self.uuid = v.into();
1690        self
1691    }
1692
1693    /// Sets the value of [create_time][crate::model::Batch::create_time].
1694    ///
1695    /// # Example
1696    /// ```ignore,no_run
1697    /// # use google_cloud_dataproc_v1::model::Batch;
1698    /// use wkt::Timestamp;
1699    /// let x = Batch::new().set_create_time(Timestamp::default()/* use setters */);
1700    /// ```
1701    pub fn set_create_time<T>(mut self, v: T) -> Self
1702    where
1703        T: std::convert::Into<wkt::Timestamp>,
1704    {
1705        self.create_time = std::option::Option::Some(v.into());
1706        self
1707    }
1708
1709    /// Sets or clears the value of [create_time][crate::model::Batch::create_time].
1710    ///
1711    /// # Example
1712    /// ```ignore,no_run
1713    /// # use google_cloud_dataproc_v1::model::Batch;
1714    /// use wkt::Timestamp;
1715    /// let x = Batch::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1716    /// let x = Batch::new().set_or_clear_create_time(None::<Timestamp>);
1717    /// ```
1718    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1719    where
1720        T: std::convert::Into<wkt::Timestamp>,
1721    {
1722        self.create_time = v.map(|x| x.into());
1723        self
1724    }
1725
1726    /// Sets the value of [runtime_info][crate::model::Batch::runtime_info].
1727    ///
1728    /// # Example
1729    /// ```ignore,no_run
1730    /// # use google_cloud_dataproc_v1::model::Batch;
1731    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1732    /// let x = Batch::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
1733    /// ```
1734    pub fn set_runtime_info<T>(mut self, v: T) -> Self
1735    where
1736        T: std::convert::Into<crate::model::RuntimeInfo>,
1737    {
1738        self.runtime_info = std::option::Option::Some(v.into());
1739        self
1740    }
1741
1742    /// Sets or clears the value of [runtime_info][crate::model::Batch::runtime_info].
1743    ///
1744    /// # Example
1745    /// ```ignore,no_run
1746    /// # use google_cloud_dataproc_v1::model::Batch;
1747    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1748    /// let x = Batch::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
1749    /// let x = Batch::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
1750    /// ```
1751    pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
1752    where
1753        T: std::convert::Into<crate::model::RuntimeInfo>,
1754    {
1755        self.runtime_info = v.map(|x| x.into());
1756        self
1757    }
1758
1759    /// Sets the value of [state][crate::model::Batch::state].
1760    ///
1761    /// # Example
1762    /// ```ignore,no_run
1763    /// # use google_cloud_dataproc_v1::model::Batch;
1764    /// use google_cloud_dataproc_v1::model::batch::State;
1765    /// let x0 = Batch::new().set_state(State::Pending);
1766    /// let x1 = Batch::new().set_state(State::Running);
1767    /// let x2 = Batch::new().set_state(State::Cancelling);
1768    /// ```
1769    pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(mut self, v: T) -> Self {
1770        self.state = v.into();
1771        self
1772    }
1773
1774    /// Sets the value of [state_message][crate::model::Batch::state_message].
1775    ///
1776    /// # Example
1777    /// ```ignore,no_run
1778    /// # use google_cloud_dataproc_v1::model::Batch;
1779    /// let x = Batch::new().set_state_message("example");
1780    /// ```
1781    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1782        self.state_message = v.into();
1783        self
1784    }
1785
1786    /// Sets the value of [state_time][crate::model::Batch::state_time].
1787    ///
1788    /// # Example
1789    /// ```ignore,no_run
1790    /// # use google_cloud_dataproc_v1::model::Batch;
1791    /// use wkt::Timestamp;
1792    /// let x = Batch::new().set_state_time(Timestamp::default()/* use setters */);
1793    /// ```
1794    pub fn set_state_time<T>(mut self, v: T) -> Self
1795    where
1796        T: std::convert::Into<wkt::Timestamp>,
1797    {
1798        self.state_time = std::option::Option::Some(v.into());
1799        self
1800    }
1801
1802    /// Sets or clears the value of [state_time][crate::model::Batch::state_time].
1803    ///
1804    /// # Example
1805    /// ```ignore,no_run
1806    /// # use google_cloud_dataproc_v1::model::Batch;
1807    /// use wkt::Timestamp;
1808    /// let x = Batch::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
1809    /// let x = Batch::new().set_or_clear_state_time(None::<Timestamp>);
1810    /// ```
1811    pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
1812    where
1813        T: std::convert::Into<wkt::Timestamp>,
1814    {
1815        self.state_time = v.map(|x| x.into());
1816        self
1817    }
1818
1819    /// Sets the value of [creator][crate::model::Batch::creator].
1820    ///
1821    /// # Example
1822    /// ```ignore,no_run
1823    /// # use google_cloud_dataproc_v1::model::Batch;
1824    /// let x = Batch::new().set_creator("example");
1825    /// ```
1826    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1827        self.creator = v.into();
1828        self
1829    }
1830
1831    /// Sets the value of [labels][crate::model::Batch::labels].
1832    ///
1833    /// # Example
1834    /// ```ignore,no_run
1835    /// # use google_cloud_dataproc_v1::model::Batch;
1836    /// let x = Batch::new().set_labels([
1837    ///     ("key0", "abc"),
1838    ///     ("key1", "xyz"),
1839    /// ]);
1840    /// ```
1841    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1842    where
1843        T: std::iter::IntoIterator<Item = (K, V)>,
1844        K: std::convert::Into<std::string::String>,
1845        V: std::convert::Into<std::string::String>,
1846    {
1847        use std::iter::Iterator;
1848        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1849        self
1850    }
1851
1852    /// Sets the value of [runtime_config][crate::model::Batch::runtime_config].
1853    ///
1854    /// # Example
1855    /// ```ignore,no_run
1856    /// # use google_cloud_dataproc_v1::model::Batch;
1857    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1858    /// let x = Batch::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
1859    /// ```
1860    pub fn set_runtime_config<T>(mut self, v: T) -> Self
1861    where
1862        T: std::convert::Into<crate::model::RuntimeConfig>,
1863    {
1864        self.runtime_config = std::option::Option::Some(v.into());
1865        self
1866    }
1867
1868    /// Sets or clears the value of [runtime_config][crate::model::Batch::runtime_config].
1869    ///
1870    /// # Example
1871    /// ```ignore,no_run
1872    /// # use google_cloud_dataproc_v1::model::Batch;
1873    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1874    /// let x = Batch::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
1875    /// let x = Batch::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
1876    /// ```
1877    pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
1878    where
1879        T: std::convert::Into<crate::model::RuntimeConfig>,
1880    {
1881        self.runtime_config = v.map(|x| x.into());
1882        self
1883    }
1884
1885    /// Sets the value of [environment_config][crate::model::Batch::environment_config].
1886    ///
1887    /// # Example
1888    /// ```ignore,no_run
1889    /// # use google_cloud_dataproc_v1::model::Batch;
1890    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1891    /// let x = Batch::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
1892    /// ```
1893    pub fn set_environment_config<T>(mut self, v: T) -> Self
1894    where
1895        T: std::convert::Into<crate::model::EnvironmentConfig>,
1896    {
1897        self.environment_config = std::option::Option::Some(v.into());
1898        self
1899    }
1900
1901    /// Sets or clears the value of [environment_config][crate::model::Batch::environment_config].
1902    ///
1903    /// # Example
1904    /// ```ignore,no_run
1905    /// # use google_cloud_dataproc_v1::model::Batch;
1906    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1907    /// let x = Batch::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
1908    /// let x = Batch::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
1909    /// ```
1910    pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
1911    where
1912        T: std::convert::Into<crate::model::EnvironmentConfig>,
1913    {
1914        self.environment_config = v.map(|x| x.into());
1915        self
1916    }
1917
1918    /// Sets the value of [operation][crate::model::Batch::operation].
1919    ///
1920    /// # Example
1921    /// ```ignore,no_run
1922    /// # use google_cloud_dataproc_v1::model::Batch;
1923    /// let x = Batch::new().set_operation("example");
1924    /// ```
1925    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1926        self.operation = v.into();
1927        self
1928    }
1929
1930    /// Sets the value of [state_history][crate::model::Batch::state_history].
1931    ///
1932    /// # Example
1933    /// ```ignore,no_run
1934    /// # use google_cloud_dataproc_v1::model::Batch;
1935    /// use google_cloud_dataproc_v1::model::batch::StateHistory;
1936    /// let x = Batch::new()
1937    ///     .set_state_history([
1938    ///         StateHistory::default()/* use setters */,
1939    ///         StateHistory::default()/* use (different) setters */,
1940    ///     ]);
1941    /// ```
1942    pub fn set_state_history<T, V>(mut self, v: T) -> Self
1943    where
1944        T: std::iter::IntoIterator<Item = V>,
1945        V: std::convert::Into<crate::model::batch::StateHistory>,
1946    {
1947        use std::iter::Iterator;
1948        self.state_history = v.into_iter().map(|i| i.into()).collect();
1949        self
1950    }
1951
1952    /// Sets the value of [batch_config][crate::model::Batch::batch_config].
1953    ///
1954    /// Note that all the setters affecting `batch_config` are mutually
1955    /// exclusive.
1956    ///
1957    /// # Example
1958    /// ```ignore,no_run
1959    /// # use google_cloud_dataproc_v1::model::Batch;
1960    /// use google_cloud_dataproc_v1::model::PySparkBatch;
1961    /// let x = Batch::new().set_batch_config(Some(
1962    ///     google_cloud_dataproc_v1::model::batch::BatchConfig::PysparkBatch(PySparkBatch::default().into())));
1963    /// ```
1964    pub fn set_batch_config<
1965        T: std::convert::Into<std::option::Option<crate::model::batch::BatchConfig>>,
1966    >(
1967        mut self,
1968        v: T,
1969    ) -> Self {
1970        self.batch_config = v.into();
1971        self
1972    }
1973
1974    /// The value of [batch_config][crate::model::Batch::batch_config]
1975    /// if it holds a `PysparkBatch`, `None` if the field is not set or
1976    /// holds a different branch.
1977    pub fn pyspark_batch(
1978        &self,
1979    ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkBatch>> {
1980        #[allow(unreachable_patterns)]
1981        self.batch_config.as_ref().and_then(|v| match v {
1982            crate::model::batch::BatchConfig::PysparkBatch(v) => std::option::Option::Some(v),
1983            _ => std::option::Option::None,
1984        })
1985    }
1986
1987    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1988    /// to hold a `PysparkBatch`.
1989    ///
1990    /// Note that all the setters affecting `batch_config` are
1991    /// mutually exclusive.
1992    ///
1993    /// # Example
1994    /// ```ignore,no_run
1995    /// # use google_cloud_dataproc_v1::model::Batch;
1996    /// use google_cloud_dataproc_v1::model::PySparkBatch;
1997    /// let x = Batch::new().set_pyspark_batch(PySparkBatch::default()/* use setters */);
1998    /// assert!(x.pyspark_batch().is_some());
1999    /// assert!(x.spark_batch().is_none());
2000    /// assert!(x.spark_r_batch().is_none());
2001    /// assert!(x.spark_sql_batch().is_none());
2002    /// ```
2003    pub fn set_pyspark_batch<T: std::convert::Into<std::boxed::Box<crate::model::PySparkBatch>>>(
2004        mut self,
2005        v: T,
2006    ) -> Self {
2007        self.batch_config =
2008            std::option::Option::Some(crate::model::batch::BatchConfig::PysparkBatch(v.into()));
2009        self
2010    }
2011
2012    /// The value of [batch_config][crate::model::Batch::batch_config]
2013    /// if it holds a `SparkBatch`, `None` if the field is not set or
2014    /// holds a different branch.
2015    pub fn spark_batch(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkBatch>> {
2016        #[allow(unreachable_patterns)]
2017        self.batch_config.as_ref().and_then(|v| match v {
2018            crate::model::batch::BatchConfig::SparkBatch(v) => std::option::Option::Some(v),
2019            _ => std::option::Option::None,
2020        })
2021    }
2022
2023    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2024    /// to hold a `SparkBatch`.
2025    ///
2026    /// Note that all the setters affecting `batch_config` are
2027    /// mutually exclusive.
2028    ///
2029    /// # Example
2030    /// ```ignore,no_run
2031    /// # use google_cloud_dataproc_v1::model::Batch;
2032    /// use google_cloud_dataproc_v1::model::SparkBatch;
2033    /// let x = Batch::new().set_spark_batch(SparkBatch::default()/* use setters */);
2034    /// assert!(x.spark_batch().is_some());
2035    /// assert!(x.pyspark_batch().is_none());
2036    /// assert!(x.spark_r_batch().is_none());
2037    /// assert!(x.spark_sql_batch().is_none());
2038    /// ```
2039    pub fn set_spark_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkBatch>>>(
2040        mut self,
2041        v: T,
2042    ) -> Self {
2043        self.batch_config =
2044            std::option::Option::Some(crate::model::batch::BatchConfig::SparkBatch(v.into()));
2045        self
2046    }
2047
2048    /// The value of [batch_config][crate::model::Batch::batch_config]
2049    /// if it holds a `SparkRBatch`, `None` if the field is not set or
2050    /// holds a different branch.
2051    pub fn spark_r_batch(
2052        &self,
2053    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkRBatch>> {
2054        #[allow(unreachable_patterns)]
2055        self.batch_config.as_ref().and_then(|v| match v {
2056            crate::model::batch::BatchConfig::SparkRBatch(v) => std::option::Option::Some(v),
2057            _ => std::option::Option::None,
2058        })
2059    }
2060
2061    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2062    /// to hold a `SparkRBatch`.
2063    ///
2064    /// Note that all the setters affecting `batch_config` are
2065    /// mutually exclusive.
2066    ///
2067    /// # Example
2068    /// ```ignore,no_run
2069    /// # use google_cloud_dataproc_v1::model::Batch;
2070    /// use google_cloud_dataproc_v1::model::SparkRBatch;
2071    /// let x = Batch::new().set_spark_r_batch(SparkRBatch::default()/* use setters */);
2072    /// assert!(x.spark_r_batch().is_some());
2073    /// assert!(x.pyspark_batch().is_none());
2074    /// assert!(x.spark_batch().is_none());
2075    /// assert!(x.spark_sql_batch().is_none());
2076    /// ```
2077    pub fn set_spark_r_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkRBatch>>>(
2078        mut self,
2079        v: T,
2080    ) -> Self {
2081        self.batch_config =
2082            std::option::Option::Some(crate::model::batch::BatchConfig::SparkRBatch(v.into()));
2083        self
2084    }
2085
2086    /// The value of [batch_config][crate::model::Batch::batch_config]
2087    /// if it holds a `SparkSqlBatch`, `None` if the field is not set or
2088    /// holds a different branch.
2089    pub fn spark_sql_batch(
2090        &self,
2091    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlBatch>> {
2092        #[allow(unreachable_patterns)]
2093        self.batch_config.as_ref().and_then(|v| match v {
2094            crate::model::batch::BatchConfig::SparkSqlBatch(v) => std::option::Option::Some(v),
2095            _ => std::option::Option::None,
2096        })
2097    }
2098
2099    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2100    /// to hold a `SparkSqlBatch`.
2101    ///
2102    /// Note that all the setters affecting `batch_config` are
2103    /// mutually exclusive.
2104    ///
2105    /// # Example
2106    /// ```ignore,no_run
2107    /// # use google_cloud_dataproc_v1::model::Batch;
2108    /// use google_cloud_dataproc_v1::model::SparkSqlBatch;
2109    /// let x = Batch::new().set_spark_sql_batch(SparkSqlBatch::default()/* use setters */);
2110    /// assert!(x.spark_sql_batch().is_some());
2111    /// assert!(x.pyspark_batch().is_none());
2112    /// assert!(x.spark_batch().is_none());
2113    /// assert!(x.spark_r_batch().is_none());
2114    /// ```
2115    pub fn set_spark_sql_batch<
2116        T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlBatch>>,
2117    >(
2118        mut self,
2119        v: T,
2120    ) -> Self {
2121        self.batch_config =
2122            std::option::Option::Some(crate::model::batch::BatchConfig::SparkSqlBatch(v.into()));
2123        self
2124    }
2125}
2126
2127impl wkt::message::Message for Batch {
2128    fn typename() -> &'static str {
2129        "type.googleapis.com/google.cloud.dataproc.v1.Batch"
2130    }
2131}
2132
2133/// Defines additional types related to [Batch].
2134pub mod batch {
2135    #[allow(unused_imports)]
2136    use super::*;
2137
2138    /// Historical state information.
2139    #[derive(Clone, Default, PartialEq)]
2140    #[non_exhaustive]
2141    pub struct StateHistory {
2142        /// Output only. The state of the batch at this point in history.
2143        pub state: crate::model::batch::State,
2144
2145        /// Output only. Details about the state at this point in history.
2146        pub state_message: std::string::String,
2147
2148        /// Output only. The time when the batch entered the historical state.
2149        pub state_start_time: std::option::Option<wkt::Timestamp>,
2150
2151        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2152    }
2153
2154    impl StateHistory {
2155        /// Creates a new default instance.
2156        pub fn new() -> Self {
2157            std::default::Default::default()
2158        }
2159
2160        /// Sets the value of [state][crate::model::batch::StateHistory::state].
2161        ///
2162        /// # Example
2163        /// ```ignore,no_run
2164        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2165        /// use google_cloud_dataproc_v1::model::batch::State;
2166        /// let x0 = StateHistory::new().set_state(State::Pending);
2167        /// let x1 = StateHistory::new().set_state(State::Running);
2168        /// let x2 = StateHistory::new().set_state(State::Cancelling);
2169        /// ```
2170        pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(
2171            mut self,
2172            v: T,
2173        ) -> Self {
2174            self.state = v.into();
2175            self
2176        }
2177
2178        /// Sets the value of [state_message][crate::model::batch::StateHistory::state_message].
2179        ///
2180        /// # Example
2181        /// ```ignore,no_run
2182        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2183        /// let x = StateHistory::new().set_state_message("example");
2184        /// ```
2185        pub fn set_state_message<T: std::convert::Into<std::string::String>>(
2186            mut self,
2187            v: T,
2188        ) -> Self {
2189            self.state_message = v.into();
2190            self
2191        }
2192
2193        /// Sets the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2194        ///
2195        /// # Example
2196        /// ```ignore,no_run
2197        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2198        /// use wkt::Timestamp;
2199        /// let x = StateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
2200        /// ```
2201        pub fn set_state_start_time<T>(mut self, v: T) -> Self
2202        where
2203            T: std::convert::Into<wkt::Timestamp>,
2204        {
2205            self.state_start_time = std::option::Option::Some(v.into());
2206            self
2207        }
2208
2209        /// Sets or clears the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2210        ///
2211        /// # Example
2212        /// ```ignore,no_run
2213        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2214        /// use wkt::Timestamp;
2215        /// let x = StateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
2216        /// let x = StateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
2217        /// ```
2218        pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2219        where
2220            T: std::convert::Into<wkt::Timestamp>,
2221        {
2222            self.state_start_time = v.map(|x| x.into());
2223            self
2224        }
2225    }
2226
2227    impl wkt::message::Message for StateHistory {
2228        fn typename() -> &'static str {
2229            "type.googleapis.com/google.cloud.dataproc.v1.Batch.StateHistory"
2230        }
2231    }
2232
2233    /// The batch state.
2234    ///
2235    /// # Working with unknown values
2236    ///
2237    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2238    /// additional enum variants at any time. Adding new variants is not considered
2239    /// a breaking change. Applications should write their code in anticipation of:
2240    ///
2241    /// - New values appearing in future releases of the client library, **and**
2242    /// - New values received dynamically, without application changes.
2243    ///
2244    /// Please consult the [Working with enums] section in the user guide for some
2245    /// guidelines.
2246    ///
2247    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2248    #[derive(Clone, Debug, PartialEq)]
2249    #[non_exhaustive]
2250    pub enum State {
2251        /// The batch state is unknown.
2252        Unspecified,
2253        /// The batch is created before running.
2254        Pending,
2255        /// The batch is running.
2256        Running,
2257        /// The batch is cancelling.
2258        Cancelling,
2259        /// The batch cancellation was successful.
2260        Cancelled,
2261        /// The batch completed successfully.
2262        Succeeded,
2263        /// The batch is no longer running due to an error.
2264        Failed,
2265        /// If set, the enum was initialized with an unknown value.
2266        ///
2267        /// Applications can examine the value using [State::value] or
2268        /// [State::name].
2269        UnknownValue(state::UnknownValue),
2270    }
2271
2272    #[doc(hidden)]
2273    pub mod state {
2274        #[allow(unused_imports)]
2275        use super::*;
2276        #[derive(Clone, Debug, PartialEq)]
2277        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2278    }
2279
2280    impl State {
2281        /// Gets the enum value.
2282        ///
2283        /// Returns `None` if the enum contains an unknown value deserialized from
2284        /// the string representation of enums.
2285        pub fn value(&self) -> std::option::Option<i32> {
2286            match self {
2287                Self::Unspecified => std::option::Option::Some(0),
2288                Self::Pending => std::option::Option::Some(1),
2289                Self::Running => std::option::Option::Some(2),
2290                Self::Cancelling => std::option::Option::Some(3),
2291                Self::Cancelled => std::option::Option::Some(4),
2292                Self::Succeeded => std::option::Option::Some(5),
2293                Self::Failed => std::option::Option::Some(6),
2294                Self::UnknownValue(u) => u.0.value(),
2295            }
2296        }
2297
2298        /// Gets the enum value as a string.
2299        ///
2300        /// Returns `None` if the enum contains an unknown value deserialized from
2301        /// the integer representation of enums.
2302        pub fn name(&self) -> std::option::Option<&str> {
2303            match self {
2304                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2305                Self::Pending => std::option::Option::Some("PENDING"),
2306                Self::Running => std::option::Option::Some("RUNNING"),
2307                Self::Cancelling => std::option::Option::Some("CANCELLING"),
2308                Self::Cancelled => std::option::Option::Some("CANCELLED"),
2309                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2310                Self::Failed => std::option::Option::Some("FAILED"),
2311                Self::UnknownValue(u) => u.0.name(),
2312            }
2313        }
2314    }
2315
2316    impl std::default::Default for State {
2317        fn default() -> Self {
2318            use std::convert::From;
2319            Self::from(0)
2320        }
2321    }
2322
2323    impl std::fmt::Display for State {
2324        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2325            wkt::internal::display_enum(f, self.name(), self.value())
2326        }
2327    }
2328
2329    impl std::convert::From<i32> for State {
2330        fn from(value: i32) -> Self {
2331            match value {
2332                0 => Self::Unspecified,
2333                1 => Self::Pending,
2334                2 => Self::Running,
2335                3 => Self::Cancelling,
2336                4 => Self::Cancelled,
2337                5 => Self::Succeeded,
2338                6 => Self::Failed,
2339                _ => Self::UnknownValue(state::UnknownValue(
2340                    wkt::internal::UnknownEnumValue::Integer(value),
2341                )),
2342            }
2343        }
2344    }
2345
2346    impl std::convert::From<&str> for State {
2347        fn from(value: &str) -> Self {
2348            use std::string::ToString;
2349            match value {
2350                "STATE_UNSPECIFIED" => Self::Unspecified,
2351                "PENDING" => Self::Pending,
2352                "RUNNING" => Self::Running,
2353                "CANCELLING" => Self::Cancelling,
2354                "CANCELLED" => Self::Cancelled,
2355                "SUCCEEDED" => Self::Succeeded,
2356                "FAILED" => Self::Failed,
2357                _ => Self::UnknownValue(state::UnknownValue(
2358                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2359                )),
2360            }
2361        }
2362    }
2363
2364    impl serde::ser::Serialize for State {
2365        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2366        where
2367            S: serde::Serializer,
2368        {
2369            match self {
2370                Self::Unspecified => serializer.serialize_i32(0),
2371                Self::Pending => serializer.serialize_i32(1),
2372                Self::Running => serializer.serialize_i32(2),
2373                Self::Cancelling => serializer.serialize_i32(3),
2374                Self::Cancelled => serializer.serialize_i32(4),
2375                Self::Succeeded => serializer.serialize_i32(5),
2376                Self::Failed => serializer.serialize_i32(6),
2377                Self::UnknownValue(u) => u.0.serialize(serializer),
2378            }
2379        }
2380    }
2381
2382    impl<'de> serde::de::Deserialize<'de> for State {
2383        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2384        where
2385            D: serde::Deserializer<'de>,
2386        {
2387            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2388                ".google.cloud.dataproc.v1.Batch.State",
2389            ))
2390        }
2391    }
2392
2393    /// The application/framework-specific portion of the batch configuration.
2394    #[derive(Clone, Debug, PartialEq)]
2395    #[non_exhaustive]
2396    pub enum BatchConfig {
2397        /// Optional. PySpark batch config.
2398        PysparkBatch(std::boxed::Box<crate::model::PySparkBatch>),
2399        /// Optional. Spark batch config.
2400        SparkBatch(std::boxed::Box<crate::model::SparkBatch>),
2401        /// Optional. SparkR batch config.
2402        SparkRBatch(std::boxed::Box<crate::model::SparkRBatch>),
2403        /// Optional. SparkSql batch config.
2404        SparkSqlBatch(std::boxed::Box<crate::model::SparkSqlBatch>),
2405    }
2406}
2407
2408/// A configuration for running an
2409/// [Apache
2410/// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html)
2411/// batch workload.
2412#[derive(Clone, Default, PartialEq)]
2413#[non_exhaustive]
2414pub struct PySparkBatch {
2415    /// Required. The HCFS URI of the main Python file to use as the Spark driver.
2416    /// Must be a .py file.
2417    pub main_python_file_uri: std::string::String,
2418
2419    /// Optional. The arguments to pass to the driver. Do not include arguments
2420    /// that can be set as batch properties, such as `--conf`, since a collision
2421    /// can occur that causes an incorrect batch submission.
2422    pub args: std::vec::Vec<std::string::String>,
2423
2424    /// Optional. HCFS file URIs of Python files to pass to the PySpark
2425    /// framework. Supported file types: `.py`, `.egg`, and `.zip`.
2426    pub python_file_uris: std::vec::Vec<std::string::String>,
2427
2428    /// Optional. HCFS URIs of jar files to add to the classpath of the
2429    /// Spark driver and tasks.
2430    pub jar_file_uris: std::vec::Vec<std::string::String>,
2431
2432    /// Optional. HCFS URIs of files to be placed in the working directory of
2433    /// each executor.
2434    pub file_uris: std::vec::Vec<std::string::String>,
2435
2436    /// Optional. HCFS URIs of archives to be extracted into the working directory
2437    /// of each executor. Supported file types:
2438    /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2439    pub archive_uris: std::vec::Vec<std::string::String>,
2440
2441    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2442}
2443
2444impl PySparkBatch {
2445    /// Creates a new default instance.
2446    pub fn new() -> Self {
2447        std::default::Default::default()
2448    }
2449
2450    /// Sets the value of [main_python_file_uri][crate::model::PySparkBatch::main_python_file_uri].
2451    ///
2452    /// # Example
2453    /// ```ignore,no_run
2454    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2455    /// let x = PySparkBatch::new().set_main_python_file_uri("example");
2456    /// ```
2457    pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
2458        mut self,
2459        v: T,
2460    ) -> Self {
2461        self.main_python_file_uri = v.into();
2462        self
2463    }
2464
2465    /// Sets the value of [args][crate::model::PySparkBatch::args].
2466    ///
2467    /// # Example
2468    /// ```ignore,no_run
2469    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2470    /// let x = PySparkBatch::new().set_args(["a", "b", "c"]);
2471    /// ```
2472    pub fn set_args<T, V>(mut self, v: T) -> Self
2473    where
2474        T: std::iter::IntoIterator<Item = V>,
2475        V: std::convert::Into<std::string::String>,
2476    {
2477        use std::iter::Iterator;
2478        self.args = v.into_iter().map(|i| i.into()).collect();
2479        self
2480    }
2481
2482    /// Sets the value of [python_file_uris][crate::model::PySparkBatch::python_file_uris].
2483    ///
2484    /// # Example
2485    /// ```ignore,no_run
2486    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2487    /// let x = PySparkBatch::new().set_python_file_uris(["a", "b", "c"]);
2488    /// ```
2489    pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
2490    where
2491        T: std::iter::IntoIterator<Item = V>,
2492        V: std::convert::Into<std::string::String>,
2493    {
2494        use std::iter::Iterator;
2495        self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
2496        self
2497    }
2498
2499    /// Sets the value of [jar_file_uris][crate::model::PySparkBatch::jar_file_uris].
2500    ///
2501    /// # Example
2502    /// ```ignore,no_run
2503    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2504    /// let x = PySparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2505    /// ```
2506    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2507    where
2508        T: std::iter::IntoIterator<Item = V>,
2509        V: std::convert::Into<std::string::String>,
2510    {
2511        use std::iter::Iterator;
2512        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2513        self
2514    }
2515
2516    /// Sets the value of [file_uris][crate::model::PySparkBatch::file_uris].
2517    ///
2518    /// # Example
2519    /// ```ignore,no_run
2520    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2521    /// let x = PySparkBatch::new().set_file_uris(["a", "b", "c"]);
2522    /// ```
2523    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2524    where
2525        T: std::iter::IntoIterator<Item = V>,
2526        V: std::convert::Into<std::string::String>,
2527    {
2528        use std::iter::Iterator;
2529        self.file_uris = v.into_iter().map(|i| i.into()).collect();
2530        self
2531    }
2532
2533    /// Sets the value of [archive_uris][crate::model::PySparkBatch::archive_uris].
2534    ///
2535    /// # Example
2536    /// ```ignore,no_run
2537    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2538    /// let x = PySparkBatch::new().set_archive_uris(["a", "b", "c"]);
2539    /// ```
2540    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2541    where
2542        T: std::iter::IntoIterator<Item = V>,
2543        V: std::convert::Into<std::string::String>,
2544    {
2545        use std::iter::Iterator;
2546        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2547        self
2548    }
2549}
2550
2551impl wkt::message::Message for PySparkBatch {
2552    fn typename() -> &'static str {
2553        "type.googleapis.com/google.cloud.dataproc.v1.PySparkBatch"
2554    }
2555}
2556
2557/// A configuration for running an [Apache Spark](https://spark.apache.org/)
2558/// batch workload.
2559#[derive(Clone, Default, PartialEq)]
2560#[non_exhaustive]
2561pub struct SparkBatch {
2562    /// Optional. The arguments to pass to the driver. Do not include arguments
2563    /// that can be set as batch properties, such as `--conf`, since a collision
2564    /// can occur that causes an incorrect batch submission.
2565    pub args: std::vec::Vec<std::string::String>,
2566
2567    /// Optional. HCFS URIs of jar files to add to the classpath of the
2568    /// Spark driver and tasks.
2569    pub jar_file_uris: std::vec::Vec<std::string::String>,
2570
2571    /// Optional. HCFS URIs of files to be placed in the working directory of
2572    /// each executor.
2573    pub file_uris: std::vec::Vec<std::string::String>,
2574
2575    /// Optional. HCFS URIs of archives to be extracted into the working directory
2576    /// of each executor. Supported file types:
2577    /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2578    pub archive_uris: std::vec::Vec<std::string::String>,
2579
2580    /// The specification of the main method to call to drive the Spark
2581    /// workload. Specify either the jar file that contains the main class or the
2582    /// main class name. To pass both a main jar and a main class in that jar, add
2583    /// the jar to `jar_file_uris`, and then specify the main class
2584    /// name in `main_class`.
2585    pub driver: std::option::Option<crate::model::spark_batch::Driver>,
2586
2587    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2588}
2589
2590impl SparkBatch {
2591    /// Creates a new default instance.
2592    pub fn new() -> Self {
2593        std::default::Default::default()
2594    }
2595
2596    /// Sets the value of [args][crate::model::SparkBatch::args].
2597    ///
2598    /// # Example
2599    /// ```ignore,no_run
2600    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2601    /// let x = SparkBatch::new().set_args(["a", "b", "c"]);
2602    /// ```
2603    pub fn set_args<T, V>(mut self, v: T) -> Self
2604    where
2605        T: std::iter::IntoIterator<Item = V>,
2606        V: std::convert::Into<std::string::String>,
2607    {
2608        use std::iter::Iterator;
2609        self.args = v.into_iter().map(|i| i.into()).collect();
2610        self
2611    }
2612
2613    /// Sets the value of [jar_file_uris][crate::model::SparkBatch::jar_file_uris].
2614    ///
2615    /// # Example
2616    /// ```ignore,no_run
2617    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2618    /// let x = SparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2619    /// ```
2620    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2621    where
2622        T: std::iter::IntoIterator<Item = V>,
2623        V: std::convert::Into<std::string::String>,
2624    {
2625        use std::iter::Iterator;
2626        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2627        self
2628    }
2629
2630    /// Sets the value of [file_uris][crate::model::SparkBatch::file_uris].
2631    ///
2632    /// # Example
2633    /// ```ignore,no_run
2634    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2635    /// let x = SparkBatch::new().set_file_uris(["a", "b", "c"]);
2636    /// ```
2637    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2638    where
2639        T: std::iter::IntoIterator<Item = V>,
2640        V: std::convert::Into<std::string::String>,
2641    {
2642        use std::iter::Iterator;
2643        self.file_uris = v.into_iter().map(|i| i.into()).collect();
2644        self
2645    }
2646
2647    /// Sets the value of [archive_uris][crate::model::SparkBatch::archive_uris].
2648    ///
2649    /// # Example
2650    /// ```ignore,no_run
2651    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2652    /// let x = SparkBatch::new().set_archive_uris(["a", "b", "c"]);
2653    /// ```
2654    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2655    where
2656        T: std::iter::IntoIterator<Item = V>,
2657        V: std::convert::Into<std::string::String>,
2658    {
2659        use std::iter::Iterator;
2660        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2661        self
2662    }
2663
2664    /// Sets the value of [driver][crate::model::SparkBatch::driver].
2665    ///
2666    /// Note that all the setters affecting `driver` are mutually
2667    /// exclusive.
2668    ///
2669    /// # Example
2670    /// ```ignore,no_run
2671    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2672    /// use google_cloud_dataproc_v1::model::spark_batch::Driver;
2673    /// let x = SparkBatch::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
2674    /// ```
2675    pub fn set_driver<
2676        T: std::convert::Into<std::option::Option<crate::model::spark_batch::Driver>>,
2677    >(
2678        mut self,
2679        v: T,
2680    ) -> Self {
2681        self.driver = v.into();
2682        self
2683    }
2684
2685    /// The value of [driver][crate::model::SparkBatch::driver]
2686    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
2687    /// holds a different branch.
2688    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
2689        #[allow(unreachable_patterns)]
2690        self.driver.as_ref().and_then(|v| match v {
2691            crate::model::spark_batch::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
2692            _ => std::option::Option::None,
2693        })
2694    }
2695
2696    /// Sets the value of [driver][crate::model::SparkBatch::driver]
2697    /// to hold a `MainJarFileUri`.
2698    ///
2699    /// Note that all the setters affecting `driver` are
2700    /// mutually exclusive.
2701    ///
2702    /// # Example
2703    /// ```ignore,no_run
2704    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2705    /// let x = SparkBatch::new().set_main_jar_file_uri("example");
2706    /// assert!(x.main_jar_file_uri().is_some());
2707    /// assert!(x.main_class().is_none());
2708    /// ```
2709    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
2710        mut self,
2711        v: T,
2712    ) -> Self {
2713        self.driver =
2714            std::option::Option::Some(crate::model::spark_batch::Driver::MainJarFileUri(v.into()));
2715        self
2716    }
2717
2718    /// The value of [driver][crate::model::SparkBatch::driver]
2719    /// if it holds a `MainClass`, `None` if the field is not set or
2720    /// holds a different branch.
2721    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
2722        #[allow(unreachable_patterns)]
2723        self.driver.as_ref().and_then(|v| match v {
2724            crate::model::spark_batch::Driver::MainClass(v) => std::option::Option::Some(v),
2725            _ => std::option::Option::None,
2726        })
2727    }
2728
2729    /// Sets the value of [driver][crate::model::SparkBatch::driver]
2730    /// to hold a `MainClass`.
2731    ///
2732    /// Note that all the setters affecting `driver` are
2733    /// mutually exclusive.
2734    ///
2735    /// # Example
2736    /// ```ignore,no_run
2737    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2738    /// let x = SparkBatch::new().set_main_class("example");
2739    /// assert!(x.main_class().is_some());
2740    /// assert!(x.main_jar_file_uri().is_none());
2741    /// ```
2742    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2743        self.driver =
2744            std::option::Option::Some(crate::model::spark_batch::Driver::MainClass(v.into()));
2745        self
2746    }
2747}
2748
2749impl wkt::message::Message for SparkBatch {
2750    fn typename() -> &'static str {
2751        "type.googleapis.com/google.cloud.dataproc.v1.SparkBatch"
2752    }
2753}
2754
2755/// Defines additional types related to [SparkBatch].
2756pub mod spark_batch {
2757    #[allow(unused_imports)]
2758    use super::*;
2759
2760    /// The specification of the main method to call to drive the Spark
2761    /// workload. Specify either the jar file that contains the main class or the
2762    /// main class name. To pass both a main jar and a main class in that jar, add
2763    /// the jar to `jar_file_uris`, and then specify the main class
2764    /// name in `main_class`.
2765    #[derive(Clone, Debug, PartialEq)]
2766    #[non_exhaustive]
2767    pub enum Driver {
2768        /// Optional. The HCFS URI of the jar file that contains the main class.
2769        MainJarFileUri(std::string::String),
2770        /// Optional. The name of the driver main class. The jar file that contains
2771        /// the class must be in the classpath or specified in `jar_file_uris`.
2772        MainClass(std::string::String),
2773    }
2774}
2775
2776/// A configuration for running an
2777/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
2778/// batch workload.
2779#[derive(Clone, Default, PartialEq)]
2780#[non_exhaustive]
2781pub struct SparkRBatch {
2782    /// Required. The HCFS URI of the main R file to use as the driver.
2783    /// Must be a `.R` or `.r` file.
2784    pub main_r_file_uri: std::string::String,
2785
2786    /// Optional. The arguments to pass to the Spark driver. Do not include
2787    /// arguments that can be set as batch properties, such as `--conf`, since a
2788    /// collision can occur that causes an incorrect batch submission.
2789    pub args: std::vec::Vec<std::string::String>,
2790
2791    /// Optional. HCFS URIs of files to be placed in the working directory of
2792    /// each executor.
2793    pub file_uris: std::vec::Vec<std::string::String>,
2794
2795    /// Optional. HCFS URIs of archives to be extracted into the working directory
2796    /// of each executor. Supported file types:
2797    /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2798    pub archive_uris: std::vec::Vec<std::string::String>,
2799
2800    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2801}
2802
2803impl SparkRBatch {
2804    /// Creates a new default instance.
2805    pub fn new() -> Self {
2806        std::default::Default::default()
2807    }
2808
2809    /// Sets the value of [main_r_file_uri][crate::model::SparkRBatch::main_r_file_uri].
2810    ///
2811    /// # Example
2812    /// ```ignore,no_run
2813    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2814    /// let x = SparkRBatch::new().set_main_r_file_uri("example");
2815    /// ```
2816    pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2817        self.main_r_file_uri = v.into();
2818        self
2819    }
2820
2821    /// Sets the value of [args][crate::model::SparkRBatch::args].
2822    ///
2823    /// # Example
2824    /// ```ignore,no_run
2825    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2826    /// let x = SparkRBatch::new().set_args(["a", "b", "c"]);
2827    /// ```
2828    pub fn set_args<T, V>(mut self, v: T) -> Self
2829    where
2830        T: std::iter::IntoIterator<Item = V>,
2831        V: std::convert::Into<std::string::String>,
2832    {
2833        use std::iter::Iterator;
2834        self.args = v.into_iter().map(|i| i.into()).collect();
2835        self
2836    }
2837
2838    /// Sets the value of [file_uris][crate::model::SparkRBatch::file_uris].
2839    ///
2840    /// # Example
2841    /// ```ignore,no_run
2842    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2843    /// let x = SparkRBatch::new().set_file_uris(["a", "b", "c"]);
2844    /// ```
2845    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2846    where
2847        T: std::iter::IntoIterator<Item = V>,
2848        V: std::convert::Into<std::string::String>,
2849    {
2850        use std::iter::Iterator;
2851        self.file_uris = v.into_iter().map(|i| i.into()).collect();
2852        self
2853    }
2854
2855    /// Sets the value of [archive_uris][crate::model::SparkRBatch::archive_uris].
2856    ///
2857    /// # Example
2858    /// ```ignore,no_run
2859    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2860    /// let x = SparkRBatch::new().set_archive_uris(["a", "b", "c"]);
2861    /// ```
2862    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2863    where
2864        T: std::iter::IntoIterator<Item = V>,
2865        V: std::convert::Into<std::string::String>,
2866    {
2867        use std::iter::Iterator;
2868        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2869        self
2870    }
2871}
2872
2873impl wkt::message::Message for SparkRBatch {
2874    fn typename() -> &'static str {
2875        "type.googleapis.com/google.cloud.dataproc.v1.SparkRBatch"
2876    }
2877}
2878
2879/// A configuration for running
2880/// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch
2881/// workload.
2882#[derive(Clone, Default, PartialEq)]
2883#[non_exhaustive]
2884pub struct SparkSqlBatch {
2885    /// Required. The HCFS URI of the script that contains Spark SQL queries to
2886    /// execute.
2887    pub query_file_uri: std::string::String,
2888
2889    /// Optional. Mapping of query variable names to values (equivalent to the
2890    /// Spark SQL command: `SET name="value";`).
2891    pub query_variables: std::collections::HashMap<std::string::String, std::string::String>,
2892
2893    /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2894    pub jar_file_uris: std::vec::Vec<std::string::String>,
2895
2896    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2897}
2898
2899impl SparkSqlBatch {
2900    /// Creates a new default instance.
2901    pub fn new() -> Self {
2902        std::default::Default::default()
2903    }
2904
2905    /// Sets the value of [query_file_uri][crate::model::SparkSqlBatch::query_file_uri].
2906    ///
2907    /// # Example
2908    /// ```ignore,no_run
2909    /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2910    /// let x = SparkSqlBatch::new().set_query_file_uri("example");
2911    /// ```
2912    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2913        self.query_file_uri = v.into();
2914        self
2915    }
2916
2917    /// Sets the value of [query_variables][crate::model::SparkSqlBatch::query_variables].
2918    ///
2919    /// # Example
2920    /// ```ignore,no_run
2921    /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2922    /// let x = SparkSqlBatch::new().set_query_variables([
2923    ///     ("key0", "abc"),
2924    ///     ("key1", "xyz"),
2925    /// ]);
2926    /// ```
2927    pub fn set_query_variables<T, K, V>(mut self, v: T) -> Self
2928    where
2929        T: std::iter::IntoIterator<Item = (K, V)>,
2930        K: std::convert::Into<std::string::String>,
2931        V: std::convert::Into<std::string::String>,
2932    {
2933        use std::iter::Iterator;
2934        self.query_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2935        self
2936    }
2937
2938    /// Sets the value of [jar_file_uris][crate::model::SparkSqlBatch::jar_file_uris].
2939    ///
2940    /// # Example
2941    /// ```ignore,no_run
2942    /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2943    /// let x = SparkSqlBatch::new().set_jar_file_uris(["a", "b", "c"]);
2944    /// ```
2945    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2946    where
2947        T: std::iter::IntoIterator<Item = V>,
2948        V: std::convert::Into<std::string::String>,
2949    {
2950        use std::iter::Iterator;
2951        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2952        self
2953    }
2954}
2955
2956impl wkt::message::Message for SparkSqlBatch {
2957    fn typename() -> &'static str {
2958        "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlBatch"
2959    }
2960}
2961
2962/// Describes the identifying information, config, and status of
2963/// a Dataproc cluster
2964#[derive(Clone, Default, PartialEq)]
2965#[non_exhaustive]
2966pub struct Cluster {
2967    /// Required. The Google Cloud Platform project ID that the cluster belongs to.
2968    pub project_id: std::string::String,
2969
2970    /// Required. The cluster name, which must be unique within a project.
2971    /// The name must start with a lowercase letter, and can contain
2972    /// up to 51 lowercase letters, numbers, and hyphens. It cannot end
2973    /// with a hyphen. The name of a deleted cluster can be reused.
2974    pub cluster_name: std::string::String,
2975
2976    /// Optional. The cluster config for a cluster of Compute Engine Instances.
2977    /// Note that Dataproc may set default values, and values may change
2978    /// when clusters are updated.
2979    ///
2980    /// Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
2981    pub config: std::option::Option<crate::model::ClusterConfig>,
2982
2983    /// Optional. The virtual cluster config is used when creating a Dataproc
2984    /// cluster that does not directly control the underlying compute resources,
2985    /// for example, when creating a [Dataproc-on-GKE
2986    /// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
2987    /// Dataproc may set default values, and values may change when
2988    /// clusters are updated. Exactly one of
2989    /// [config][google.cloud.dataproc.v1.Cluster.config] or
2990    /// [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config]
2991    /// must be specified.
2992    ///
2993    /// [google.cloud.dataproc.v1.Cluster.config]: crate::model::Cluster::config
2994    /// [google.cloud.dataproc.v1.Cluster.virtual_cluster_config]: crate::model::Cluster::virtual_cluster_config
2995    pub virtual_cluster_config: std::option::Option<crate::model::VirtualClusterConfig>,
2996
2997    /// Optional. The labels to associate with this cluster.
2998    /// Label **keys** must contain 1 to 63 characters, and must conform to
2999    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
3000    /// Label **values** may be empty, but, if present, must contain 1 to 63
3001    /// characters, and must conform to [RFC
3002    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
3003    /// associated with a cluster.
3004    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3005
3006    /// Output only. Cluster status.
3007    pub status: std::option::Option<crate::model::ClusterStatus>,
3008
3009    /// Output only. The previous cluster status.
3010    pub status_history: std::vec::Vec<crate::model::ClusterStatus>,
3011
3012    /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc
3013    /// generates this value when it creates the cluster.
3014    pub cluster_uuid: std::string::String,
3015
3016    /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.
3017    ///
3018    /// **Beta Feature**: This report is available for testing purposes only. It
3019    /// may be changed before final release.
3020    pub metrics: std::option::Option<crate::model::ClusterMetrics>,
3021
3022    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3023}
3024
3025impl Cluster {
3026    /// Creates a new default instance.
3027    pub fn new() -> Self {
3028        std::default::Default::default()
3029    }
3030
3031    /// Sets the value of [project_id][crate::model::Cluster::project_id].
3032    ///
3033    /// # Example
3034    /// ```ignore,no_run
3035    /// # use google_cloud_dataproc_v1::model::Cluster;
3036    /// let x = Cluster::new().set_project_id("example");
3037    /// ```
3038    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3039        self.project_id = v.into();
3040        self
3041    }
3042
3043    /// Sets the value of [cluster_name][crate::model::Cluster::cluster_name].
3044    ///
3045    /// # Example
3046    /// ```ignore,no_run
3047    /// # use google_cloud_dataproc_v1::model::Cluster;
3048    /// let x = Cluster::new().set_cluster_name("example");
3049    /// ```
3050    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3051        self.cluster_name = v.into();
3052        self
3053    }
3054
3055    /// Sets the value of [config][crate::model::Cluster::config].
3056    ///
3057    /// # Example
3058    /// ```ignore,no_run
3059    /// # use google_cloud_dataproc_v1::model::Cluster;
3060    /// use google_cloud_dataproc_v1::model::ClusterConfig;
3061    /// let x = Cluster::new().set_config(ClusterConfig::default()/* use setters */);
3062    /// ```
3063    pub fn set_config<T>(mut self, v: T) -> Self
3064    where
3065        T: std::convert::Into<crate::model::ClusterConfig>,
3066    {
3067        self.config = std::option::Option::Some(v.into());
3068        self
3069    }
3070
3071    /// Sets or clears the value of [config][crate::model::Cluster::config].
3072    ///
3073    /// # Example
3074    /// ```ignore,no_run
3075    /// # use google_cloud_dataproc_v1::model::Cluster;
3076    /// use google_cloud_dataproc_v1::model::ClusterConfig;
3077    /// let x = Cluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
3078    /// let x = Cluster::new().set_or_clear_config(None::<ClusterConfig>);
3079    /// ```
3080    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
3081    where
3082        T: std::convert::Into<crate::model::ClusterConfig>,
3083    {
3084        self.config = v.map(|x| x.into());
3085        self
3086    }
3087
3088    /// Sets the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3089    ///
3090    /// # Example
3091    /// ```ignore,no_run
3092    /// # use google_cloud_dataproc_v1::model::Cluster;
3093    /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3094    /// let x = Cluster::new().set_virtual_cluster_config(VirtualClusterConfig::default()/* use setters */);
3095    /// ```
3096    pub fn set_virtual_cluster_config<T>(mut self, v: T) -> Self
3097    where
3098        T: std::convert::Into<crate::model::VirtualClusterConfig>,
3099    {
3100        self.virtual_cluster_config = std::option::Option::Some(v.into());
3101        self
3102    }
3103
3104    /// Sets or clears the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3105    ///
3106    /// # Example
3107    /// ```ignore,no_run
3108    /// # use google_cloud_dataproc_v1::model::Cluster;
3109    /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3110    /// let x = Cluster::new().set_or_clear_virtual_cluster_config(Some(VirtualClusterConfig::default()/* use setters */));
3111    /// let x = Cluster::new().set_or_clear_virtual_cluster_config(None::<VirtualClusterConfig>);
3112    /// ```
3113    pub fn set_or_clear_virtual_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3114    where
3115        T: std::convert::Into<crate::model::VirtualClusterConfig>,
3116    {
3117        self.virtual_cluster_config = v.map(|x| x.into());
3118        self
3119    }
3120
3121    /// Sets the value of [labels][crate::model::Cluster::labels].
3122    ///
3123    /// # Example
3124    /// ```ignore,no_run
3125    /// # use google_cloud_dataproc_v1::model::Cluster;
3126    /// let x = Cluster::new().set_labels([
3127    ///     ("key0", "abc"),
3128    ///     ("key1", "xyz"),
3129    /// ]);
3130    /// ```
3131    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3132    where
3133        T: std::iter::IntoIterator<Item = (K, V)>,
3134        K: std::convert::Into<std::string::String>,
3135        V: std::convert::Into<std::string::String>,
3136    {
3137        use std::iter::Iterator;
3138        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3139        self
3140    }
3141
3142    /// Sets the value of [status][crate::model::Cluster::status].
3143    ///
3144    /// # Example
3145    /// ```ignore,no_run
3146    /// # use google_cloud_dataproc_v1::model::Cluster;
3147    /// use google_cloud_dataproc_v1::model::ClusterStatus;
3148    /// let x = Cluster::new().set_status(ClusterStatus::default()/* use setters */);
3149    /// ```
3150    pub fn set_status<T>(mut self, v: T) -> Self
3151    where
3152        T: std::convert::Into<crate::model::ClusterStatus>,
3153    {
3154        self.status = std::option::Option::Some(v.into());
3155        self
3156    }
3157
3158    /// Sets or clears the value of [status][crate::model::Cluster::status].
3159    ///
3160    /// # Example
3161    /// ```ignore,no_run
3162    /// # use google_cloud_dataproc_v1::model::Cluster;
3163    /// use google_cloud_dataproc_v1::model::ClusterStatus;
3164    /// let x = Cluster::new().set_or_clear_status(Some(ClusterStatus::default()/* use setters */));
3165    /// let x = Cluster::new().set_or_clear_status(None::<ClusterStatus>);
3166    /// ```
3167    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
3168    where
3169        T: std::convert::Into<crate::model::ClusterStatus>,
3170    {
3171        self.status = v.map(|x| x.into());
3172        self
3173    }
3174
3175    /// Sets the value of [status_history][crate::model::Cluster::status_history].
3176    ///
3177    /// # Example
3178    /// ```ignore,no_run
3179    /// # use google_cloud_dataproc_v1::model::Cluster;
3180    /// use google_cloud_dataproc_v1::model::ClusterStatus;
3181    /// let x = Cluster::new()
3182    ///     .set_status_history([
3183    ///         ClusterStatus::default()/* use setters */,
3184    ///         ClusterStatus::default()/* use (different) setters */,
3185    ///     ]);
3186    /// ```
3187    pub fn set_status_history<T, V>(mut self, v: T) -> Self
3188    where
3189        T: std::iter::IntoIterator<Item = V>,
3190        V: std::convert::Into<crate::model::ClusterStatus>,
3191    {
3192        use std::iter::Iterator;
3193        self.status_history = v.into_iter().map(|i| i.into()).collect();
3194        self
3195    }
3196
3197    /// Sets the value of [cluster_uuid][crate::model::Cluster::cluster_uuid].
3198    ///
3199    /// # Example
3200    /// ```ignore,no_run
3201    /// # use google_cloud_dataproc_v1::model::Cluster;
3202    /// let x = Cluster::new().set_cluster_uuid("example");
3203    /// ```
3204    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3205        self.cluster_uuid = v.into();
3206        self
3207    }
3208
3209    /// Sets the value of [metrics][crate::model::Cluster::metrics].
3210    ///
3211    /// # Example
3212    /// ```ignore,no_run
3213    /// # use google_cloud_dataproc_v1::model::Cluster;
3214    /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3215    /// let x = Cluster::new().set_metrics(ClusterMetrics::default()/* use setters */);
3216    /// ```
3217    pub fn set_metrics<T>(mut self, v: T) -> Self
3218    where
3219        T: std::convert::Into<crate::model::ClusterMetrics>,
3220    {
3221        self.metrics = std::option::Option::Some(v.into());
3222        self
3223    }
3224
3225    /// Sets or clears the value of [metrics][crate::model::Cluster::metrics].
3226    ///
3227    /// # Example
3228    /// ```ignore,no_run
3229    /// # use google_cloud_dataproc_v1::model::Cluster;
3230    /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3231    /// let x = Cluster::new().set_or_clear_metrics(Some(ClusterMetrics::default()/* use setters */));
3232    /// let x = Cluster::new().set_or_clear_metrics(None::<ClusterMetrics>);
3233    /// ```
3234    pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
3235    where
3236        T: std::convert::Into<crate::model::ClusterMetrics>,
3237    {
3238        self.metrics = v.map(|x| x.into());
3239        self
3240    }
3241}
3242
3243impl wkt::message::Message for Cluster {
3244    fn typename() -> &'static str {
3245        "type.googleapis.com/google.cloud.dataproc.v1.Cluster"
3246    }
3247}
3248
3249/// The cluster config.
3250#[derive(Clone, Default, PartialEq)]
3251#[non_exhaustive]
3252pub struct ClusterConfig {
3253    /// Optional. The type of the cluster.
3254    pub cluster_type: crate::model::cluster_config::ClusterType,
3255
3256    /// Optional. The cluster tier.
3257    pub cluster_tier: crate::model::cluster_config::ClusterTier,
3258
3259    /// Optional. The cluster engine.
3260    pub engine: crate::model::cluster_config::Engine,
3261
3262    /// Optional. A Cloud Storage bucket used to stage job
3263    /// dependencies, config files, and job driver console output.
3264    /// If you do not specify a staging bucket, Cloud
3265    /// Dataproc will determine a Cloud Storage location (US,
3266    /// ASIA, or EU) for your cluster's staging bucket according to the
3267    /// Compute Engine zone where your cluster is deployed, and then create
3268    /// and manage this project-level, per-location bucket (see
3269    /// [Dataproc staging and temp
3270    /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3271    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3272    /// a Cloud Storage bucket.**
3273    pub config_bucket: std::string::String,
3274
3275    /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs
3276    /// data, such as Spark and MapReduce history files. If you do not specify a
3277    /// temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or
3278    /// EU) for your cluster's temp bucket according to the Compute Engine zone
3279    /// where your cluster is deployed, and then create and manage this
3280    /// project-level, per-location bucket. The default bucket has a TTL of 90
3281    /// days, but you can use any TTL (or none) if you specify a bucket (see
3282    /// [Dataproc staging and temp
3283    /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3284    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3285    /// a Cloud Storage bucket.**
3286    pub temp_bucket: std::string::String,
3287
3288    /// Optional. The shared Compute Engine config settings for
3289    /// all instances in a cluster.
3290    pub gce_cluster_config: std::option::Option<crate::model::GceClusterConfig>,
3291
3292    /// Optional. The Compute Engine config settings for
3293    /// the cluster's master instance.
3294    pub master_config: std::option::Option<crate::model::InstanceGroupConfig>,
3295
3296    /// Optional. The Compute Engine config settings for
3297    /// the cluster's worker instances.
3298    pub worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3299
3300    /// Optional. The Compute Engine config settings for
3301    /// a cluster's secondary worker instances
3302    pub secondary_worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3303
3304    /// Optional. The config settings for cluster software.
3305    pub software_config: std::option::Option<crate::model::SoftwareConfig>,
3306
3307    /// Optional. Commands to execute on each node after config is
3308    /// completed. By default, executables are run on master and all worker nodes.
3309    /// You can test a node's `role` metadata to run an executable on
3310    /// a master or worker node, as shown below using `curl` (you can also use
3311    /// `wget`):
3312    ///
3313    /// ```norust
3314    /// ROLE=$(curl -H Metadata-Flavor:Google
3315    /// http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
3316    /// if [[ "${ROLE}" == 'Master' ]]; then
3317    ///   ... master specific actions ...
3318    /// else
3319    ///   ... worker specific actions ...
3320    /// fi
3321    /// ```
3322    pub initialization_actions: std::vec::Vec<crate::model::NodeInitializationAction>,
3323
3324    /// Optional. Encryption settings for the cluster.
3325    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
3326
3327    /// Optional. Autoscaling config for the policy associated with the cluster.
3328    /// Cluster does not autoscale if this field is unset.
3329    pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
3330
3331    /// Optional. Security settings for the cluster.
3332    pub security_config: std::option::Option<crate::model::SecurityConfig>,
3333
3334    /// Optional. Lifecycle setting for the cluster.
3335    pub lifecycle_config: std::option::Option<crate::model::LifecycleConfig>,
3336
3337    /// Optional. Port/endpoint configuration for this cluster
3338    pub endpoint_config: std::option::Option<crate::model::EndpointConfig>,
3339
3340    /// Optional. Metastore configuration.
3341    pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3342
3343    /// Optional. The config for Dataproc metrics.
3344    pub dataproc_metric_config: std::option::Option<crate::model::DataprocMetricConfig>,
3345
3346    /// Optional. The node group settings.
3347    pub auxiliary_node_groups: std::vec::Vec<crate::model::AuxiliaryNodeGroup>,
3348
3349    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3350}
3351
3352impl ClusterConfig {
3353    /// Creates a new default instance.
3354    pub fn new() -> Self {
3355        std::default::Default::default()
3356    }
3357
3358    /// Sets the value of [cluster_type][crate::model::ClusterConfig::cluster_type].
3359    ///
3360    /// # Example
3361    /// ```ignore,no_run
3362    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3363    /// use google_cloud_dataproc_v1::model::cluster_config::ClusterType;
3364    /// let x0 = ClusterConfig::new().set_cluster_type(ClusterType::Standard);
3365    /// let x1 = ClusterConfig::new().set_cluster_type(ClusterType::SingleNode);
3366    /// let x2 = ClusterConfig::new().set_cluster_type(ClusterType::ZeroScale);
3367    /// ```
3368    pub fn set_cluster_type<T: std::convert::Into<crate::model::cluster_config::ClusterType>>(
3369        mut self,
3370        v: T,
3371    ) -> Self {
3372        self.cluster_type = v.into();
3373        self
3374    }
3375
3376    /// Sets the value of [cluster_tier][crate::model::ClusterConfig::cluster_tier].
3377    ///
3378    /// # Example
3379    /// ```ignore,no_run
3380    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3381    /// use google_cloud_dataproc_v1::model::cluster_config::ClusterTier;
3382    /// let x0 = ClusterConfig::new().set_cluster_tier(ClusterTier::Standard);
3383    /// let x1 = ClusterConfig::new().set_cluster_tier(ClusterTier::Premium);
3384    /// ```
3385    pub fn set_cluster_tier<T: std::convert::Into<crate::model::cluster_config::ClusterTier>>(
3386        mut self,
3387        v: T,
3388    ) -> Self {
3389        self.cluster_tier = v.into();
3390        self
3391    }
3392
3393    /// Sets the value of [engine][crate::model::ClusterConfig::engine].
3394    ///
3395    /// # Example
3396    /// ```ignore,no_run
3397    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3398    /// use google_cloud_dataproc_v1::model::cluster_config::Engine;
3399    /// let x0 = ClusterConfig::new().set_engine(Engine::Default);
3400    /// let x1 = ClusterConfig::new().set_engine(Engine::Lightning);
3401    /// ```
3402    pub fn set_engine<T: std::convert::Into<crate::model::cluster_config::Engine>>(
3403        mut self,
3404        v: T,
3405    ) -> Self {
3406        self.engine = v.into();
3407        self
3408    }
3409
3410    /// Sets the value of [config_bucket][crate::model::ClusterConfig::config_bucket].
3411    ///
3412    /// # Example
3413    /// ```ignore,no_run
3414    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3415    /// let x = ClusterConfig::new().set_config_bucket("example");
3416    /// ```
3417    pub fn set_config_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3418        self.config_bucket = v.into();
3419        self
3420    }
3421
3422    /// Sets the value of [temp_bucket][crate::model::ClusterConfig::temp_bucket].
3423    ///
3424    /// # Example
3425    /// ```ignore,no_run
3426    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3427    /// let x = ClusterConfig::new().set_temp_bucket("example");
3428    /// ```
3429    pub fn set_temp_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3430        self.temp_bucket = v.into();
3431        self
3432    }
3433
3434    /// Sets the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3435    ///
3436    /// # Example
3437    /// ```ignore,no_run
3438    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3439    /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3440    /// let x = ClusterConfig::new().set_gce_cluster_config(GceClusterConfig::default()/* use setters */);
3441    /// ```
3442    pub fn set_gce_cluster_config<T>(mut self, v: T) -> Self
3443    where
3444        T: std::convert::Into<crate::model::GceClusterConfig>,
3445    {
3446        self.gce_cluster_config = std::option::Option::Some(v.into());
3447        self
3448    }
3449
3450    /// Sets or clears the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3451    ///
3452    /// # Example
3453    /// ```ignore,no_run
3454    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3455    /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3456    /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(Some(GceClusterConfig::default()/* use setters */));
3457    /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(None::<GceClusterConfig>);
3458    /// ```
3459    pub fn set_or_clear_gce_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3460    where
3461        T: std::convert::Into<crate::model::GceClusterConfig>,
3462    {
3463        self.gce_cluster_config = v.map(|x| x.into());
3464        self
3465    }
3466
3467    /// Sets the value of [master_config][crate::model::ClusterConfig::master_config].
3468    ///
3469    /// # Example
3470    /// ```ignore,no_run
3471    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3472    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3473    /// let x = ClusterConfig::new().set_master_config(InstanceGroupConfig::default()/* use setters */);
3474    /// ```
3475    pub fn set_master_config<T>(mut self, v: T) -> Self
3476    where
3477        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3478    {
3479        self.master_config = std::option::Option::Some(v.into());
3480        self
3481    }
3482
3483    /// Sets or clears the value of [master_config][crate::model::ClusterConfig::master_config].
3484    ///
3485    /// # Example
3486    /// ```ignore,no_run
3487    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3488    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3489    /// let x = ClusterConfig::new().set_or_clear_master_config(Some(InstanceGroupConfig::default()/* use setters */));
3490    /// let x = ClusterConfig::new().set_or_clear_master_config(None::<InstanceGroupConfig>);
3491    /// ```
3492    pub fn set_or_clear_master_config<T>(mut self, v: std::option::Option<T>) -> Self
3493    where
3494        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3495    {
3496        self.master_config = v.map(|x| x.into());
3497        self
3498    }
3499
3500    /// Sets the value of [worker_config][crate::model::ClusterConfig::worker_config].
3501    ///
3502    /// # Example
3503    /// ```ignore,no_run
3504    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3505    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3506    /// let x = ClusterConfig::new().set_worker_config(InstanceGroupConfig::default()/* use setters */);
3507    /// ```
3508    pub fn set_worker_config<T>(mut self, v: T) -> Self
3509    where
3510        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3511    {
3512        self.worker_config = std::option::Option::Some(v.into());
3513        self
3514    }
3515
3516    /// Sets or clears the value of [worker_config][crate::model::ClusterConfig::worker_config].
3517    ///
3518    /// # Example
3519    /// ```ignore,no_run
3520    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3521    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3522    /// let x = ClusterConfig::new().set_or_clear_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3523    /// let x = ClusterConfig::new().set_or_clear_worker_config(None::<InstanceGroupConfig>);
3524    /// ```
3525    pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3526    where
3527        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3528    {
3529        self.worker_config = v.map(|x| x.into());
3530        self
3531    }
3532
3533    /// Sets the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3534    ///
3535    /// # Example
3536    /// ```ignore,no_run
3537    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3538    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3539    /// let x = ClusterConfig::new().set_secondary_worker_config(InstanceGroupConfig::default()/* use setters */);
3540    /// ```
3541    pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
3542    where
3543        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3544    {
3545        self.secondary_worker_config = std::option::Option::Some(v.into());
3546        self
3547    }
3548
3549    /// Sets or clears the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3550    ///
3551    /// # Example
3552    /// ```ignore,no_run
3553    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3554    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3555    /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3556    /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(None::<InstanceGroupConfig>);
3557    /// ```
3558    pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3559    where
3560        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3561    {
3562        self.secondary_worker_config = v.map(|x| x.into());
3563        self
3564    }
3565
3566    /// Sets the value of [software_config][crate::model::ClusterConfig::software_config].
3567    ///
3568    /// # Example
3569    /// ```ignore,no_run
3570    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3571    /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3572    /// let x = ClusterConfig::new().set_software_config(SoftwareConfig::default()/* use setters */);
3573    /// ```
3574    pub fn set_software_config<T>(mut self, v: T) -> Self
3575    where
3576        T: std::convert::Into<crate::model::SoftwareConfig>,
3577    {
3578        self.software_config = std::option::Option::Some(v.into());
3579        self
3580    }
3581
3582    /// Sets or clears the value of [software_config][crate::model::ClusterConfig::software_config].
3583    ///
3584    /// # Example
3585    /// ```ignore,no_run
3586    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3587    /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3588    /// let x = ClusterConfig::new().set_or_clear_software_config(Some(SoftwareConfig::default()/* use setters */));
3589    /// let x = ClusterConfig::new().set_or_clear_software_config(None::<SoftwareConfig>);
3590    /// ```
3591    pub fn set_or_clear_software_config<T>(mut self, v: std::option::Option<T>) -> Self
3592    where
3593        T: std::convert::Into<crate::model::SoftwareConfig>,
3594    {
3595        self.software_config = v.map(|x| x.into());
3596        self
3597    }
3598
3599    /// Sets the value of [initialization_actions][crate::model::ClusterConfig::initialization_actions].
3600    ///
3601    /// # Example
3602    /// ```ignore,no_run
3603    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3604    /// use google_cloud_dataproc_v1::model::NodeInitializationAction;
3605    /// let x = ClusterConfig::new()
3606    ///     .set_initialization_actions([
3607    ///         NodeInitializationAction::default()/* use setters */,
3608    ///         NodeInitializationAction::default()/* use (different) setters */,
3609    ///     ]);
3610    /// ```
3611    pub fn set_initialization_actions<T, V>(mut self, v: T) -> Self
3612    where
3613        T: std::iter::IntoIterator<Item = V>,
3614        V: std::convert::Into<crate::model::NodeInitializationAction>,
3615    {
3616        use std::iter::Iterator;
3617        self.initialization_actions = v.into_iter().map(|i| i.into()).collect();
3618        self
3619    }
3620
3621    /// Sets the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3622    ///
3623    /// # Example
3624    /// ```ignore,no_run
3625    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3626    /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3627    /// let x = ClusterConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3628    /// ```
3629    pub fn set_encryption_config<T>(mut self, v: T) -> Self
3630    where
3631        T: std::convert::Into<crate::model::EncryptionConfig>,
3632    {
3633        self.encryption_config = std::option::Option::Some(v.into());
3634        self
3635    }
3636
3637    /// Sets or clears the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3638    ///
3639    /// # Example
3640    /// ```ignore,no_run
3641    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3642    /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3643    /// let x = ClusterConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3644    /// let x = ClusterConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3645    /// ```
3646    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3647    where
3648        T: std::convert::Into<crate::model::EncryptionConfig>,
3649    {
3650        self.encryption_config = v.map(|x| x.into());
3651        self
3652    }
3653
3654    /// Sets the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3655    ///
3656    /// # Example
3657    /// ```ignore,no_run
3658    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3659    /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3660    /// let x = ClusterConfig::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
3661    /// ```
3662    pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
3663    where
3664        T: std::convert::Into<crate::model::AutoscalingConfig>,
3665    {
3666        self.autoscaling_config = std::option::Option::Some(v.into());
3667        self
3668    }
3669
3670    /// Sets or clears the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3671    ///
3672    /// # Example
3673    /// ```ignore,no_run
3674    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3675    /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3676    /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
3677    /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
3678    /// ```
3679    pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
3680    where
3681        T: std::convert::Into<crate::model::AutoscalingConfig>,
3682    {
3683        self.autoscaling_config = v.map(|x| x.into());
3684        self
3685    }
3686
3687    /// Sets the value of [security_config][crate::model::ClusterConfig::security_config].
3688    ///
3689    /// # Example
3690    /// ```ignore,no_run
3691    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3692    /// use google_cloud_dataproc_v1::model::SecurityConfig;
3693    /// let x = ClusterConfig::new().set_security_config(SecurityConfig::default()/* use setters */);
3694    /// ```
3695    pub fn set_security_config<T>(mut self, v: T) -> Self
3696    where
3697        T: std::convert::Into<crate::model::SecurityConfig>,
3698    {
3699        self.security_config = std::option::Option::Some(v.into());
3700        self
3701    }
3702
3703    /// Sets or clears the value of [security_config][crate::model::ClusterConfig::security_config].
3704    ///
3705    /// # Example
3706    /// ```ignore,no_run
3707    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3708    /// use google_cloud_dataproc_v1::model::SecurityConfig;
3709    /// let x = ClusterConfig::new().set_or_clear_security_config(Some(SecurityConfig::default()/* use setters */));
3710    /// let x = ClusterConfig::new().set_or_clear_security_config(None::<SecurityConfig>);
3711    /// ```
3712    pub fn set_or_clear_security_config<T>(mut self, v: std::option::Option<T>) -> Self
3713    where
3714        T: std::convert::Into<crate::model::SecurityConfig>,
3715    {
3716        self.security_config = v.map(|x| x.into());
3717        self
3718    }
3719
3720    /// Sets the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3721    ///
3722    /// # Example
3723    /// ```ignore,no_run
3724    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3725    /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3726    /// let x = ClusterConfig::new().set_lifecycle_config(LifecycleConfig::default()/* use setters */);
3727    /// ```
3728    pub fn set_lifecycle_config<T>(mut self, v: T) -> Self
3729    where
3730        T: std::convert::Into<crate::model::LifecycleConfig>,
3731    {
3732        self.lifecycle_config = std::option::Option::Some(v.into());
3733        self
3734    }
3735
3736    /// Sets or clears the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3737    ///
3738    /// # Example
3739    /// ```ignore,no_run
3740    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3741    /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3742    /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(Some(LifecycleConfig::default()/* use setters */));
3743    /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(None::<LifecycleConfig>);
3744    /// ```
3745    pub fn set_or_clear_lifecycle_config<T>(mut self, v: std::option::Option<T>) -> Self
3746    where
3747        T: std::convert::Into<crate::model::LifecycleConfig>,
3748    {
3749        self.lifecycle_config = v.map(|x| x.into());
3750        self
3751    }
3752
3753    /// Sets the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3754    ///
3755    /// # Example
3756    /// ```ignore,no_run
3757    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3758    /// use google_cloud_dataproc_v1::model::EndpointConfig;
3759    /// let x = ClusterConfig::new().set_endpoint_config(EndpointConfig::default()/* use setters */);
3760    /// ```
3761    pub fn set_endpoint_config<T>(mut self, v: T) -> Self
3762    where
3763        T: std::convert::Into<crate::model::EndpointConfig>,
3764    {
3765        self.endpoint_config = std::option::Option::Some(v.into());
3766        self
3767    }
3768
3769    /// Sets or clears the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3770    ///
3771    /// # Example
3772    /// ```ignore,no_run
3773    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3774    /// use google_cloud_dataproc_v1::model::EndpointConfig;
3775    /// let x = ClusterConfig::new().set_or_clear_endpoint_config(Some(EndpointConfig::default()/* use setters */));
3776    /// let x = ClusterConfig::new().set_or_clear_endpoint_config(None::<EndpointConfig>);
3777    /// ```
3778    pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
3779    where
3780        T: std::convert::Into<crate::model::EndpointConfig>,
3781    {
3782        self.endpoint_config = v.map(|x| x.into());
3783        self
3784    }
3785
3786    /// Sets the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3787    ///
3788    /// # Example
3789    /// ```ignore,no_run
3790    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3791    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3792    /// let x = ClusterConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
3793    /// ```
3794    pub fn set_metastore_config<T>(mut self, v: T) -> Self
3795    where
3796        T: std::convert::Into<crate::model::MetastoreConfig>,
3797    {
3798        self.metastore_config = std::option::Option::Some(v.into());
3799        self
3800    }
3801
3802    /// Sets or clears the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3803    ///
3804    /// # Example
3805    /// ```ignore,no_run
3806    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3807    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3808    /// let x = ClusterConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
3809    /// let x = ClusterConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
3810    /// ```
3811    pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
3812    where
3813        T: std::convert::Into<crate::model::MetastoreConfig>,
3814    {
3815        self.metastore_config = v.map(|x| x.into());
3816        self
3817    }
3818
3819    /// Sets the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3820    ///
3821    /// # Example
3822    /// ```ignore,no_run
3823    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3824    /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3825    /// let x = ClusterConfig::new().set_dataproc_metric_config(DataprocMetricConfig::default()/* use setters */);
3826    /// ```
3827    pub fn set_dataproc_metric_config<T>(mut self, v: T) -> Self
3828    where
3829        T: std::convert::Into<crate::model::DataprocMetricConfig>,
3830    {
3831        self.dataproc_metric_config = std::option::Option::Some(v.into());
3832        self
3833    }
3834
3835    /// Sets or clears the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3836    ///
3837    /// # Example
3838    /// ```ignore,no_run
3839    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3840    /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3841    /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(Some(DataprocMetricConfig::default()/* use setters */));
3842    /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(None::<DataprocMetricConfig>);
3843    /// ```
3844    pub fn set_or_clear_dataproc_metric_config<T>(mut self, v: std::option::Option<T>) -> Self
3845    where
3846        T: std::convert::Into<crate::model::DataprocMetricConfig>,
3847    {
3848        self.dataproc_metric_config = v.map(|x| x.into());
3849        self
3850    }
3851
3852    /// Sets the value of [auxiliary_node_groups][crate::model::ClusterConfig::auxiliary_node_groups].
3853    ///
3854    /// # Example
3855    /// ```ignore,no_run
3856    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3857    /// use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
3858    /// let x = ClusterConfig::new()
3859    ///     .set_auxiliary_node_groups([
3860    ///         AuxiliaryNodeGroup::default()/* use setters */,
3861    ///         AuxiliaryNodeGroup::default()/* use (different) setters */,
3862    ///     ]);
3863    /// ```
3864    pub fn set_auxiliary_node_groups<T, V>(mut self, v: T) -> Self
3865    where
3866        T: std::iter::IntoIterator<Item = V>,
3867        V: std::convert::Into<crate::model::AuxiliaryNodeGroup>,
3868    {
3869        use std::iter::Iterator;
3870        self.auxiliary_node_groups = v.into_iter().map(|i| i.into()).collect();
3871        self
3872    }
3873}
3874
3875impl wkt::message::Message for ClusterConfig {
3876    fn typename() -> &'static str {
3877        "type.googleapis.com/google.cloud.dataproc.v1.ClusterConfig"
3878    }
3879}
3880
3881/// Defines additional types related to [ClusterConfig].
3882pub mod cluster_config {
3883    #[allow(unused_imports)]
3884    use super::*;
3885
3886    /// The type of the cluster.
3887    ///
3888    /// # Working with unknown values
3889    ///
3890    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3891    /// additional enum variants at any time. Adding new variants is not considered
3892    /// a breaking change. Applications should write their code in anticipation of:
3893    ///
3894    /// - New values appearing in future releases of the client library, **and**
3895    /// - New values received dynamically, without application changes.
3896    ///
3897    /// Please consult the [Working with enums] section in the user guide for some
3898    /// guidelines.
3899    ///
3900    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3901    #[derive(Clone, Debug, PartialEq)]
3902    #[non_exhaustive]
3903    pub enum ClusterType {
3904        /// Not set.
3905        Unspecified,
3906        /// Standard dataproc cluster with a minimum of two primary workers.
3907        Standard,
3908        /// <https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/single-node-clusters>
3909        SingleNode,
3910        /// Clusters that can use only secondary workers and be scaled down to zero
3911        /// secondary worker nodes.
3912        ZeroScale,
3913        /// If set, the enum was initialized with an unknown value.
3914        ///
3915        /// Applications can examine the value using [ClusterType::value] or
3916        /// [ClusterType::name].
3917        UnknownValue(cluster_type::UnknownValue),
3918    }
3919
3920    #[doc(hidden)]
3921    pub mod cluster_type {
3922        #[allow(unused_imports)]
3923        use super::*;
3924        #[derive(Clone, Debug, PartialEq)]
3925        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3926    }
3927
3928    impl ClusterType {
3929        /// Gets the enum value.
3930        ///
3931        /// Returns `None` if the enum contains an unknown value deserialized from
3932        /// the string representation of enums.
3933        pub fn value(&self) -> std::option::Option<i32> {
3934            match self {
3935                Self::Unspecified => std::option::Option::Some(0),
3936                Self::Standard => std::option::Option::Some(1),
3937                Self::SingleNode => std::option::Option::Some(2),
3938                Self::ZeroScale => std::option::Option::Some(3),
3939                Self::UnknownValue(u) => u.0.value(),
3940            }
3941        }
3942
3943        /// Gets the enum value as a string.
3944        ///
3945        /// Returns `None` if the enum contains an unknown value deserialized from
3946        /// the integer representation of enums.
3947        pub fn name(&self) -> std::option::Option<&str> {
3948            match self {
3949                Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
3950                Self::Standard => std::option::Option::Some("STANDARD"),
3951                Self::SingleNode => std::option::Option::Some("SINGLE_NODE"),
3952                Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
3953                Self::UnknownValue(u) => u.0.name(),
3954            }
3955        }
3956    }
3957
3958    impl std::default::Default for ClusterType {
3959        fn default() -> Self {
3960            use std::convert::From;
3961            Self::from(0)
3962        }
3963    }
3964
3965    impl std::fmt::Display for ClusterType {
3966        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3967            wkt::internal::display_enum(f, self.name(), self.value())
3968        }
3969    }
3970
3971    impl std::convert::From<i32> for ClusterType {
3972        fn from(value: i32) -> Self {
3973            match value {
3974                0 => Self::Unspecified,
3975                1 => Self::Standard,
3976                2 => Self::SingleNode,
3977                3 => Self::ZeroScale,
3978                _ => Self::UnknownValue(cluster_type::UnknownValue(
3979                    wkt::internal::UnknownEnumValue::Integer(value),
3980                )),
3981            }
3982        }
3983    }
3984
3985    impl std::convert::From<&str> for ClusterType {
3986        fn from(value: &str) -> Self {
3987            use std::string::ToString;
3988            match value {
3989                "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
3990                "STANDARD" => Self::Standard,
3991                "SINGLE_NODE" => Self::SingleNode,
3992                "ZERO_SCALE" => Self::ZeroScale,
3993                _ => Self::UnknownValue(cluster_type::UnknownValue(
3994                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3995                )),
3996            }
3997        }
3998    }
3999
4000    impl serde::ser::Serialize for ClusterType {
4001        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4002        where
4003            S: serde::Serializer,
4004        {
4005            match self {
4006                Self::Unspecified => serializer.serialize_i32(0),
4007                Self::Standard => serializer.serialize_i32(1),
4008                Self::SingleNode => serializer.serialize_i32(2),
4009                Self::ZeroScale => serializer.serialize_i32(3),
4010                Self::UnknownValue(u) => u.0.serialize(serializer),
4011            }
4012        }
4013    }
4014
4015    impl<'de> serde::de::Deserialize<'de> for ClusterType {
4016        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4017        where
4018            D: serde::Deserializer<'de>,
4019        {
4020            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
4021                ".google.cloud.dataproc.v1.ClusterConfig.ClusterType",
4022            ))
4023        }
4024    }
4025
4026    /// The cluster tier.
4027    ///
4028    /// # Working with unknown values
4029    ///
4030    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4031    /// additional enum variants at any time. Adding new variants is not considered
4032    /// a breaking change. Applications should write their code in anticipation of:
4033    ///
4034    /// - New values appearing in future releases of the client library, **and**
4035    /// - New values received dynamically, without application changes.
4036    ///
4037    /// Please consult the [Working with enums] section in the user guide for some
4038    /// guidelines.
4039    ///
4040    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4041    #[derive(Clone, Debug, PartialEq)]
4042    #[non_exhaustive]
4043    pub enum ClusterTier {
4044        /// Not set. Works the same as CLUSTER_TIER_STANDARD.
4045        Unspecified,
4046        /// Standard Dataproc cluster.
4047        Standard,
4048        /// Premium Dataproc cluster.
4049        Premium,
4050        /// If set, the enum was initialized with an unknown value.
4051        ///
4052        /// Applications can examine the value using [ClusterTier::value] or
4053        /// [ClusterTier::name].
4054        UnknownValue(cluster_tier::UnknownValue),
4055    }
4056
4057    #[doc(hidden)]
4058    pub mod cluster_tier {
4059        #[allow(unused_imports)]
4060        use super::*;
4061        #[derive(Clone, Debug, PartialEq)]
4062        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4063    }
4064
4065    impl ClusterTier {
4066        /// Gets the enum value.
4067        ///
4068        /// Returns `None` if the enum contains an unknown value deserialized from
4069        /// the string representation of enums.
4070        pub fn value(&self) -> std::option::Option<i32> {
4071            match self {
4072                Self::Unspecified => std::option::Option::Some(0),
4073                Self::Standard => std::option::Option::Some(1),
4074                Self::Premium => std::option::Option::Some(2),
4075                Self::UnknownValue(u) => u.0.value(),
4076            }
4077        }
4078
4079        /// Gets the enum value as a string.
4080        ///
4081        /// Returns `None` if the enum contains an unknown value deserialized from
4082        /// the integer representation of enums.
4083        pub fn name(&self) -> std::option::Option<&str> {
4084            match self {
4085                Self::Unspecified => std::option::Option::Some("CLUSTER_TIER_UNSPECIFIED"),
4086                Self::Standard => std::option::Option::Some("CLUSTER_TIER_STANDARD"),
4087                Self::Premium => std::option::Option::Some("CLUSTER_TIER_PREMIUM"),
4088                Self::UnknownValue(u) => u.0.name(),
4089            }
4090        }
4091    }
4092
4093    impl std::default::Default for ClusterTier {
4094        fn default() -> Self {
4095            use std::convert::From;
4096            Self::from(0)
4097        }
4098    }
4099
4100    impl std::fmt::Display for ClusterTier {
4101        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4102            wkt::internal::display_enum(f, self.name(), self.value())
4103        }
4104    }
4105
4106    impl std::convert::From<i32> for ClusterTier {
4107        fn from(value: i32) -> Self {
4108            match value {
4109                0 => Self::Unspecified,
4110                1 => Self::Standard,
4111                2 => Self::Premium,
4112                _ => Self::UnknownValue(cluster_tier::UnknownValue(
4113                    wkt::internal::UnknownEnumValue::Integer(value),
4114                )),
4115            }
4116        }
4117    }
4118
4119    impl std::convert::From<&str> for ClusterTier {
4120        fn from(value: &str) -> Self {
4121            use std::string::ToString;
4122            match value {
4123                "CLUSTER_TIER_UNSPECIFIED" => Self::Unspecified,
4124                "CLUSTER_TIER_STANDARD" => Self::Standard,
4125                "CLUSTER_TIER_PREMIUM" => Self::Premium,
4126                _ => Self::UnknownValue(cluster_tier::UnknownValue(
4127                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4128                )),
4129            }
4130        }
4131    }
4132
4133    impl serde::ser::Serialize for ClusterTier {
4134        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4135        where
4136            S: serde::Serializer,
4137        {
4138            match self {
4139                Self::Unspecified => serializer.serialize_i32(0),
4140                Self::Standard => serializer.serialize_i32(1),
4141                Self::Premium => serializer.serialize_i32(2),
4142                Self::UnknownValue(u) => u.0.serialize(serializer),
4143            }
4144        }
4145    }
4146
4147    impl<'de> serde::de::Deserialize<'de> for ClusterTier {
4148        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4149        where
4150            D: serde::Deserializer<'de>,
4151        {
4152            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterTier>::new(
4153                ".google.cloud.dataproc.v1.ClusterConfig.ClusterTier",
4154            ))
4155        }
4156    }
4157
4158    /// The cluster engine.
4159    ///
4160    /// # Working with unknown values
4161    ///
4162    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4163    /// additional enum variants at any time. Adding new variants is not considered
4164    /// a breaking change. Applications should write their code in anticipation of:
4165    ///
4166    /// - New values appearing in future releases of the client library, **and**
4167    /// - New values received dynamically, without application changes.
4168    ///
4169    /// Please consult the [Working with enums] section in the user guide for some
4170    /// guidelines.
4171    ///
4172    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4173    #[derive(Clone, Debug, PartialEq)]
4174    #[non_exhaustive]
4175    pub enum Engine {
4176        /// The engine is not specified. Works the same as ENGINE_DEFAULT.
4177        Unspecified,
4178        /// The cluster is a default engine cluster.
4179        Default,
4180        /// The cluster is a lightning engine cluster.
4181        Lightning,
4182        /// If set, the enum was initialized with an unknown value.
4183        ///
4184        /// Applications can examine the value using [Engine::value] or
4185        /// [Engine::name].
4186        UnknownValue(engine::UnknownValue),
4187    }
4188
4189    #[doc(hidden)]
4190    pub mod engine {
4191        #[allow(unused_imports)]
4192        use super::*;
4193        #[derive(Clone, Debug, PartialEq)]
4194        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4195    }
4196
4197    impl Engine {
4198        /// Gets the enum value.
4199        ///
4200        /// Returns `None` if the enum contains an unknown value deserialized from
4201        /// the string representation of enums.
4202        pub fn value(&self) -> std::option::Option<i32> {
4203            match self {
4204                Self::Unspecified => std::option::Option::Some(0),
4205                Self::Default => std::option::Option::Some(1),
4206                Self::Lightning => std::option::Option::Some(2),
4207                Self::UnknownValue(u) => u.0.value(),
4208            }
4209        }
4210
4211        /// Gets the enum value as a string.
4212        ///
4213        /// Returns `None` if the enum contains an unknown value deserialized from
4214        /// the integer representation of enums.
4215        pub fn name(&self) -> std::option::Option<&str> {
4216            match self {
4217                Self::Unspecified => std::option::Option::Some("ENGINE_UNSPECIFIED"),
4218                Self::Default => std::option::Option::Some("DEFAULT"),
4219                Self::Lightning => std::option::Option::Some("LIGHTNING"),
4220                Self::UnknownValue(u) => u.0.name(),
4221            }
4222        }
4223    }
4224
4225    impl std::default::Default for Engine {
4226        fn default() -> Self {
4227            use std::convert::From;
4228            Self::from(0)
4229        }
4230    }
4231
4232    impl std::fmt::Display for Engine {
4233        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4234            wkt::internal::display_enum(f, self.name(), self.value())
4235        }
4236    }
4237
4238    impl std::convert::From<i32> for Engine {
4239        fn from(value: i32) -> Self {
4240            match value {
4241                0 => Self::Unspecified,
4242                1 => Self::Default,
4243                2 => Self::Lightning,
4244                _ => Self::UnknownValue(engine::UnknownValue(
4245                    wkt::internal::UnknownEnumValue::Integer(value),
4246                )),
4247            }
4248        }
4249    }
4250
4251    impl std::convert::From<&str> for Engine {
4252        fn from(value: &str) -> Self {
4253            use std::string::ToString;
4254            match value {
4255                "ENGINE_UNSPECIFIED" => Self::Unspecified,
4256                "DEFAULT" => Self::Default,
4257                "LIGHTNING" => Self::Lightning,
4258                _ => Self::UnknownValue(engine::UnknownValue(
4259                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4260                )),
4261            }
4262        }
4263    }
4264
4265    impl serde::ser::Serialize for Engine {
4266        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4267        where
4268            S: serde::Serializer,
4269        {
4270            match self {
4271                Self::Unspecified => serializer.serialize_i32(0),
4272                Self::Default => serializer.serialize_i32(1),
4273                Self::Lightning => serializer.serialize_i32(2),
4274                Self::UnknownValue(u) => u.0.serialize(serializer),
4275            }
4276        }
4277    }
4278
4279    impl<'de> serde::de::Deserialize<'de> for Engine {
4280        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4281        where
4282            D: serde::Deserializer<'de>,
4283        {
4284            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Engine>::new(
4285                ".google.cloud.dataproc.v1.ClusterConfig.Engine",
4286            ))
4287        }
4288    }
4289}
4290
4291/// The Dataproc cluster config for a cluster that does not directly control the
4292/// underlying compute resources, such as a [Dataproc-on-GKE
4293/// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
4294#[derive(Clone, Default, PartialEq)]
4295#[non_exhaustive]
4296pub struct VirtualClusterConfig {
4297    /// Optional. A Cloud Storage bucket used to stage job
4298    /// dependencies, config files, and job driver console output.
4299    /// If you do not specify a staging bucket, Cloud
4300    /// Dataproc will determine a Cloud Storage location (US,
4301    /// ASIA, or EU) for your cluster's staging bucket according to the
4302    /// Compute Engine zone where your cluster is deployed, and then create
4303    /// and manage this project-level, per-location bucket (see
4304    /// [Dataproc staging and temp
4305    /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
4306    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
4307    /// a Cloud Storage bucket.**
4308    pub staging_bucket: std::string::String,
4309
4310    /// Optional. Configuration of auxiliary services used by this cluster.
4311    pub auxiliary_services_config: std::option::Option<crate::model::AuxiliaryServicesConfig>,
4312
4313    #[allow(missing_docs)]
4314    pub infrastructure_config:
4315        std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4316
4317    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4318}
4319
4320impl VirtualClusterConfig {
4321    /// Creates a new default instance.
4322    pub fn new() -> Self {
4323        std::default::Default::default()
4324    }
4325
4326    /// Sets the value of [staging_bucket][crate::model::VirtualClusterConfig::staging_bucket].
4327    ///
4328    /// # Example
4329    /// ```ignore,no_run
4330    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4331    /// let x = VirtualClusterConfig::new().set_staging_bucket("example");
4332    /// ```
4333    pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4334        self.staging_bucket = v.into();
4335        self
4336    }
4337
4338    /// Sets the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4339    ///
4340    /// # Example
4341    /// ```ignore,no_run
4342    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4343    /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4344    /// let x = VirtualClusterConfig::new().set_auxiliary_services_config(AuxiliaryServicesConfig::default()/* use setters */);
4345    /// ```
4346    pub fn set_auxiliary_services_config<T>(mut self, v: T) -> Self
4347    where
4348        T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4349    {
4350        self.auxiliary_services_config = std::option::Option::Some(v.into());
4351        self
4352    }
4353
4354    /// Sets or clears the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4355    ///
4356    /// # Example
4357    /// ```ignore,no_run
4358    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4359    /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4360    /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(Some(AuxiliaryServicesConfig::default()/* use setters */));
4361    /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(None::<AuxiliaryServicesConfig>);
4362    /// ```
4363    pub fn set_or_clear_auxiliary_services_config<T>(mut self, v: std::option::Option<T>) -> Self
4364    where
4365        T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4366    {
4367        self.auxiliary_services_config = v.map(|x| x.into());
4368        self
4369    }
4370
4371    /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config].
4372    ///
4373    /// Note that all the setters affecting `infrastructure_config` are mutually
4374    /// exclusive.
4375    ///
4376    /// # Example
4377    /// ```ignore,no_run
4378    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4379    /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4380    /// let x = VirtualClusterConfig::new().set_infrastructure_config(Some(
4381    ///     google_cloud_dataproc_v1::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(KubernetesClusterConfig::default().into())));
4382    /// ```
4383    pub fn set_infrastructure_config<
4384        T: std::convert::Into<
4385                std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4386            >,
4387    >(
4388        mut self,
4389        v: T,
4390    ) -> Self {
4391        self.infrastructure_config = v.into();
4392        self
4393    }
4394
4395    /// The value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4396    /// if it holds a `KubernetesClusterConfig`, `None` if the field is not set or
4397    /// holds a different branch.
4398    pub fn kubernetes_cluster_config(
4399        &self,
4400    ) -> std::option::Option<&std::boxed::Box<crate::model::KubernetesClusterConfig>> {
4401        #[allow(unreachable_patterns)]
4402        self.infrastructure_config.as_ref().and_then(|v| match v {
4403            crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4404                v,
4405            ) => std::option::Option::Some(v),
4406            _ => std::option::Option::None,
4407        })
4408    }
4409
4410    /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4411    /// to hold a `KubernetesClusterConfig`.
4412    ///
4413    /// Note that all the setters affecting `infrastructure_config` are
4414    /// mutually exclusive.
4415    ///
4416    /// # Example
4417    /// ```ignore,no_run
4418    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4419    /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4420    /// let x = VirtualClusterConfig::new().set_kubernetes_cluster_config(KubernetesClusterConfig::default()/* use setters */);
4421    /// assert!(x.kubernetes_cluster_config().is_some());
4422    /// ```
4423    pub fn set_kubernetes_cluster_config<
4424        T: std::convert::Into<std::boxed::Box<crate::model::KubernetesClusterConfig>>,
4425    >(
4426        mut self,
4427        v: T,
4428    ) -> Self {
4429        self.infrastructure_config = std::option::Option::Some(
4430            crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4431                v.into(),
4432            ),
4433        );
4434        self
4435    }
4436}
4437
4438impl wkt::message::Message for VirtualClusterConfig {
4439    fn typename() -> &'static str {
4440        "type.googleapis.com/google.cloud.dataproc.v1.VirtualClusterConfig"
4441    }
4442}
4443
4444/// Defines additional types related to [VirtualClusterConfig].
4445pub mod virtual_cluster_config {
4446    #[allow(unused_imports)]
4447    use super::*;
4448
4449    #[allow(missing_docs)]
4450    #[derive(Clone, Debug, PartialEq)]
4451    #[non_exhaustive]
4452    pub enum InfrastructureConfig {
4453        /// Required. The configuration for running the Dataproc cluster on
4454        /// Kubernetes.
4455        KubernetesClusterConfig(std::boxed::Box<crate::model::KubernetesClusterConfig>),
4456    }
4457}
4458
4459/// Auxiliary services configuration for a Cluster.
4460#[derive(Clone, Default, PartialEq)]
4461#[non_exhaustive]
4462pub struct AuxiliaryServicesConfig {
4463    /// Optional. The Hive Metastore configuration for this workload.
4464    pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
4465
4466    /// Optional. The Spark History Server configuration for the workload.
4467    pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
4468
4469    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4470}
4471
4472impl AuxiliaryServicesConfig {
4473    /// Creates a new default instance.
4474    pub fn new() -> Self {
4475        std::default::Default::default()
4476    }
4477
4478    /// Sets the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4479    ///
4480    /// # Example
4481    /// ```ignore,no_run
4482    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4483    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4484    /// let x = AuxiliaryServicesConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
4485    /// ```
4486    pub fn set_metastore_config<T>(mut self, v: T) -> Self
4487    where
4488        T: std::convert::Into<crate::model::MetastoreConfig>,
4489    {
4490        self.metastore_config = std::option::Option::Some(v.into());
4491        self
4492    }
4493
4494    /// Sets or clears the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4495    ///
4496    /// # Example
4497    /// ```ignore,no_run
4498    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4499    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4500    /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4501    /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4502    /// ```
4503    pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4504    where
4505        T: std::convert::Into<crate::model::MetastoreConfig>,
4506    {
4507        self.metastore_config = v.map(|x| x.into());
4508        self
4509    }
4510
4511    /// Sets the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4512    ///
4513    /// # Example
4514    /// ```ignore,no_run
4515    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4516    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4517    /// let x = AuxiliaryServicesConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
4518    /// ```
4519    pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
4520    where
4521        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4522    {
4523        self.spark_history_server_config = std::option::Option::Some(v.into());
4524        self
4525    }
4526
4527    /// Sets or clears the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4528    ///
4529    /// # Example
4530    /// ```ignore,no_run
4531    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4532    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4533    /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
4534    /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
4535    /// ```
4536    pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
4537    where
4538        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4539    {
4540        self.spark_history_server_config = v.map(|x| x.into());
4541        self
4542    }
4543}
4544
4545impl wkt::message::Message for AuxiliaryServicesConfig {
4546    fn typename() -> &'static str {
4547        "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryServicesConfig"
4548    }
4549}
4550
4551/// Endpoint config for this cluster
4552#[derive(Clone, Default, PartialEq)]
4553#[non_exhaustive]
4554pub struct EndpointConfig {
4555    /// Output only. The map of port descriptions to URLs. Will only be populated
4556    /// if enable_http_port_access is true.
4557    pub http_ports: std::collections::HashMap<std::string::String, std::string::String>,
4558
4559    /// Optional. If true, enable http access to specific ports on the cluster
4560    /// from external sources. Defaults to false.
4561    pub enable_http_port_access: bool,
4562
4563    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4564}
4565
4566impl EndpointConfig {
4567    /// Creates a new default instance.
4568    pub fn new() -> Self {
4569        std::default::Default::default()
4570    }
4571
4572    /// Sets the value of [http_ports][crate::model::EndpointConfig::http_ports].
4573    ///
4574    /// # Example
4575    /// ```ignore,no_run
4576    /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4577    /// let x = EndpointConfig::new().set_http_ports([
4578    ///     ("key0", "abc"),
4579    ///     ("key1", "xyz"),
4580    /// ]);
4581    /// ```
4582    pub fn set_http_ports<T, K, V>(mut self, v: T) -> Self
4583    where
4584        T: std::iter::IntoIterator<Item = (K, V)>,
4585        K: std::convert::Into<std::string::String>,
4586        V: std::convert::Into<std::string::String>,
4587    {
4588        use std::iter::Iterator;
4589        self.http_ports = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4590        self
4591    }
4592
4593    /// Sets the value of [enable_http_port_access][crate::model::EndpointConfig::enable_http_port_access].
4594    ///
4595    /// # Example
4596    /// ```ignore,no_run
4597    /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4598    /// let x = EndpointConfig::new().set_enable_http_port_access(true);
4599    /// ```
4600    pub fn set_enable_http_port_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4601        self.enable_http_port_access = v.into();
4602        self
4603    }
4604}
4605
4606impl wkt::message::Message for EndpointConfig {
4607    fn typename() -> &'static str {
4608        "type.googleapis.com/google.cloud.dataproc.v1.EndpointConfig"
4609    }
4610}
4611
4612/// Autoscaling Policy config associated with the cluster.
4613#[derive(Clone, Default, PartialEq)]
4614#[non_exhaustive]
4615pub struct AutoscalingConfig {
4616    /// Optional. The autoscaling policy used by the cluster.
4617    ///
4618    /// Only resource names including projectid and location (region) are valid.
4619    /// Examples:
4620    ///
4621    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4622    /// * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4623    ///
4624    /// Note that the policy must be in the same project and Dataproc region.
4625    pub policy_uri: std::string::String,
4626
4627    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4628}
4629
4630impl AutoscalingConfig {
4631    /// Creates a new default instance.
4632    pub fn new() -> Self {
4633        std::default::Default::default()
4634    }
4635
4636    /// Sets the value of [policy_uri][crate::model::AutoscalingConfig::policy_uri].
4637    ///
4638    /// # Example
4639    /// ```ignore,no_run
4640    /// # use google_cloud_dataproc_v1::model::AutoscalingConfig;
4641    /// let x = AutoscalingConfig::new().set_policy_uri("example");
4642    /// ```
4643    pub fn set_policy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4644        self.policy_uri = v.into();
4645        self
4646    }
4647}
4648
4649impl wkt::message::Message for AutoscalingConfig {
4650    fn typename() -> &'static str {
4651        "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingConfig"
4652    }
4653}
4654
4655/// Encryption settings for the cluster.
4656#[derive(Clone, Default, PartialEq)]
4657#[non_exhaustive]
4658pub struct EncryptionConfig {
4659    /// Optional. The Cloud KMS key resource name to use for persistent disk
4660    /// encryption for all instances in the cluster. See [Use CMEK with cluster
4661    /// data]
4662    /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4663    /// for more information.
4664    pub gce_pd_kms_key_name: std::string::String,
4665
4666    /// Optional. The Cloud KMS key resource name to use for cluster persistent
4667    /// disk and job argument encryption. See [Use CMEK with cluster data]
4668    /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4669    /// for more information.
4670    ///
4671    /// When this key resource name is provided, the following job arguments of
4672    /// the following job types submitted to the cluster are encrypted using CMEK:
4673    ///
4674    /// * [FlinkJob
4675    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
4676    /// * [HadoopJob
4677    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
4678    /// * [SparkJob
4679    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
4680    /// * [SparkRJob
4681    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
4682    /// * [PySparkJob
4683    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
4684    /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
4685    ///   scriptVariables and queryList.queries
4686    /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
4687    ///   scriptVariables and queryList.queries
4688    /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
4689    ///   scriptVariables and queryList.queries
4690    /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
4691    ///   scriptVariables and queryList.queries
4692    pub kms_key: std::string::String,
4693
4694    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4695}
4696
4697impl EncryptionConfig {
4698    /// Creates a new default instance.
4699    pub fn new() -> Self {
4700        std::default::Default::default()
4701    }
4702
4703    /// Sets the value of [gce_pd_kms_key_name][crate::model::EncryptionConfig::gce_pd_kms_key_name].
4704    ///
4705    /// # Example
4706    /// ```ignore,no_run
4707    /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4708    /// let x = EncryptionConfig::new().set_gce_pd_kms_key_name("example");
4709    /// ```
4710    pub fn set_gce_pd_kms_key_name<T: std::convert::Into<std::string::String>>(
4711        mut self,
4712        v: T,
4713    ) -> Self {
4714        self.gce_pd_kms_key_name = v.into();
4715        self
4716    }
4717
4718    /// Sets the value of [kms_key][crate::model::EncryptionConfig::kms_key].
4719    ///
4720    /// # Example
4721    /// ```ignore,no_run
4722    /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4723    /// let x = EncryptionConfig::new().set_kms_key("example");
4724    /// ```
4725    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4726        self.kms_key = v.into();
4727        self
4728    }
4729}
4730
4731impl wkt::message::Message for EncryptionConfig {
4732    fn typename() -> &'static str {
4733        "type.googleapis.com/google.cloud.dataproc.v1.EncryptionConfig"
4734    }
4735}
4736
4737/// Common config settings for resources of Compute Engine cluster
4738/// instances, applicable to all instances in the cluster.
4739#[derive(Clone, Default, PartialEq)]
4740#[non_exhaustive]
4741pub struct GceClusterConfig {
4742    /// Optional. The Compute Engine zone where the Dataproc cluster will be
4743    /// located. If omitted, the service will pick a zone in the cluster's Compute
4744    /// Engine region. On a get request, zone will always be present.
4745    ///
4746    /// A full URL, partial URI, or short name are valid. Examples:
4747    ///
4748    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]`
4749    /// * `projects/[project_id]/zones/[zone]`
4750    /// * `[zone]`
4751    pub zone_uri: std::string::String,
4752
4753    /// Optional. The Compute Engine network to be used for machine
4754    /// communications. Cannot be specified with subnetwork_uri. If neither
4755    /// `network_uri` nor `subnetwork_uri` is specified, the "default" network of
4756    /// the project is used, if it exists. Cannot be a "Custom Subnet Network" (see
4757    /// [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for
4758    /// more information).
4759    ///
4760    /// A full URL, partial URI, or short name are valid. Examples:
4761    ///
4762    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/networks/default`
4763    /// * `projects/[project_id]/global/networks/default`
4764    /// * `default`
4765    pub network_uri: std::string::String,
4766
4767    /// Optional. The Compute Engine subnetwork to be used for machine
4768    /// communications. Cannot be specified with network_uri.
4769    ///
4770    /// A full URL, partial URI, or short name are valid. Examples:
4771    ///
4772    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/regions/[region]/subnetworks/sub0`
4773    /// * `projects/[project_id]/regions/[region]/subnetworks/sub0`
4774    /// * `sub0`
4775    pub subnetwork_uri: std::string::String,
4776
4777    /// Optional. This setting applies to subnetwork-enabled networks. It is set to
4778    /// `true` by default in clusters created with image versions 2.2.x.
4779    ///
4780    /// When set to `true`:
4781    ///
4782    /// * All cluster VMs have internal IP addresses.
4783    /// * [Google Private Access]
4784    ///   (<https://cloud.google.com/vpc/docs/private-google-access>)
4785    ///   must be enabled to access Dataproc and other Google Cloud APIs.
4786    /// * Off-cluster dependencies must be configured to be accessible
4787    ///   without external IP addresses.
4788    ///
4789    /// When set to `false`:
4790    ///
4791    /// * Cluster VMs are not restricted to internal IP addresses.
4792    /// * Ephemeral external IP addresses are assigned to each cluster VM.
4793    pub internal_ip_only: std::option::Option<bool>,
4794
4795    /// Optional. The type of IPv6 access for a cluster.
4796    pub private_ipv6_google_access: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess,
4797
4798    /// Optional. The [Dataproc service
4799    /// account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc)
4800    /// (also see [VM Data Plane
4801    /// identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity))
4802    /// used by Dataproc cluster VM instances to access Google Cloud Platform
4803    /// services.
4804    ///
4805    /// If not specified, the
4806    /// [Compute Engine default service
4807    /// account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
4808    /// is used.
4809    pub service_account: std::string::String,
4810
4811    /// Optional. The URIs of service account scopes to be included in
4812    /// Compute Engine instances. The following base set of scopes is always
4813    /// included:
4814    ///
4815    /// * <https://www.googleapis.com/auth/cloud.useraccounts.readonly>
4816    /// * <https://www.googleapis.com/auth/devstorage.read_write>
4817    /// * <https://www.googleapis.com/auth/logging.write>
4818    ///
4819    /// If no scopes are specified, the following defaults are also provided:
4820    ///
4821    /// * <https://www.googleapis.com/auth/bigquery>
4822    /// * <https://www.googleapis.com/auth/bigtable.admin.table>
4823    /// * <https://www.googleapis.com/auth/bigtable.data>
4824    /// * <https://www.googleapis.com/auth/devstorage.full_control>
4825    pub service_account_scopes: std::vec::Vec<std::string::String>,
4826
4827    /// The Compute Engine network tags to add to all instances (see [Tagging
4828    /// instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
4829    pub tags: std::vec::Vec<std::string::String>,
4830
4831    /// Optional. The Compute Engine metadata entries to add to all instances (see
4832    /// [Project and instance
4833    /// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
4834    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
4835
4836    /// Optional. Reservation Affinity for consuming Zonal reservation.
4837    pub reservation_affinity: std::option::Option<crate::model::ReservationAffinity>,
4838
4839    /// Optional. Node Group Affinity for sole-tenant clusters.
4840    pub node_group_affinity: std::option::Option<crate::model::NodeGroupAffinity>,
4841
4842    /// Optional. Shielded Instance Config for clusters using [Compute Engine
4843    /// Shielded
4844    /// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
4845    pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
4846
4847    /// Optional. Confidential Instance Config for clusters using [Confidential
4848    /// VMs](https://cloud.google.com/compute/confidential-vm/docs).
4849    pub confidential_instance_config: std::option::Option<crate::model::ConfidentialInstanceConfig>,
4850
4851    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4852}
4853
4854impl GceClusterConfig {
4855    /// Creates a new default instance.
4856    pub fn new() -> Self {
4857        std::default::Default::default()
4858    }
4859
4860    /// Sets the value of [zone_uri][crate::model::GceClusterConfig::zone_uri].
4861    ///
4862    /// # Example
4863    /// ```ignore,no_run
4864    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4865    /// let x = GceClusterConfig::new().set_zone_uri("example");
4866    /// ```
4867    pub fn set_zone_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4868        self.zone_uri = v.into();
4869        self
4870    }
4871
4872    /// Sets the value of [network_uri][crate::model::GceClusterConfig::network_uri].
4873    ///
4874    /// # Example
4875    /// ```ignore,no_run
4876    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4877    /// let x = GceClusterConfig::new().set_network_uri("example");
4878    /// ```
4879    pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4880        self.network_uri = v.into();
4881        self
4882    }
4883
4884    /// Sets the value of [subnetwork_uri][crate::model::GceClusterConfig::subnetwork_uri].
4885    ///
4886    /// # Example
4887    /// ```ignore,no_run
4888    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4889    /// let x = GceClusterConfig::new().set_subnetwork_uri("example");
4890    /// ```
4891    pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4892        self.subnetwork_uri = v.into();
4893        self
4894    }
4895
4896    /// Sets the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4897    ///
4898    /// # Example
4899    /// ```ignore,no_run
4900    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4901    /// let x = GceClusterConfig::new().set_internal_ip_only(true);
4902    /// ```
4903    pub fn set_internal_ip_only<T>(mut self, v: T) -> Self
4904    where
4905        T: std::convert::Into<bool>,
4906    {
4907        self.internal_ip_only = std::option::Option::Some(v.into());
4908        self
4909    }
4910
4911    /// Sets or clears the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4912    ///
4913    /// # Example
4914    /// ```ignore,no_run
4915    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4916    /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(Some(false));
4917    /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(None::<bool>);
4918    /// ```
4919    pub fn set_or_clear_internal_ip_only<T>(mut self, v: std::option::Option<T>) -> Self
4920    where
4921        T: std::convert::Into<bool>,
4922    {
4923        self.internal_ip_only = v.map(|x| x.into());
4924        self
4925    }
4926
4927    /// Sets the value of [private_ipv6_google_access][crate::model::GceClusterConfig::private_ipv6_google_access].
4928    ///
4929    /// # Example
4930    /// ```ignore,no_run
4931    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4932    /// use google_cloud_dataproc_v1::model::gce_cluster_config::PrivateIpv6GoogleAccess;
4933    /// let x0 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::InheritFromSubnetwork);
4934    /// let x1 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Outbound);
4935    /// let x2 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Bidirectional);
4936    /// ```
4937    pub fn set_private_ipv6_google_access<
4938        T: std::convert::Into<crate::model::gce_cluster_config::PrivateIpv6GoogleAccess>,
4939    >(
4940        mut self,
4941        v: T,
4942    ) -> Self {
4943        self.private_ipv6_google_access = v.into();
4944        self
4945    }
4946
4947    /// Sets the value of [service_account][crate::model::GceClusterConfig::service_account].
4948    ///
4949    /// # Example
4950    /// ```ignore,no_run
4951    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4952    /// let x = GceClusterConfig::new().set_service_account("example");
4953    /// ```
4954    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4955        self.service_account = v.into();
4956        self
4957    }
4958
4959    /// Sets the value of [service_account_scopes][crate::model::GceClusterConfig::service_account_scopes].
4960    ///
4961    /// # Example
4962    /// ```ignore,no_run
4963    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4964    /// let x = GceClusterConfig::new().set_service_account_scopes(["a", "b", "c"]);
4965    /// ```
4966    pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
4967    where
4968        T: std::iter::IntoIterator<Item = V>,
4969        V: std::convert::Into<std::string::String>,
4970    {
4971        use std::iter::Iterator;
4972        self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
4973        self
4974    }
4975
4976    /// Sets the value of [tags][crate::model::GceClusterConfig::tags].
4977    ///
4978    /// # Example
4979    /// ```ignore,no_run
4980    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4981    /// let x = GceClusterConfig::new().set_tags(["a", "b", "c"]);
4982    /// ```
4983    pub fn set_tags<T, V>(mut self, v: T) -> Self
4984    where
4985        T: std::iter::IntoIterator<Item = V>,
4986        V: std::convert::Into<std::string::String>,
4987    {
4988        use std::iter::Iterator;
4989        self.tags = v.into_iter().map(|i| i.into()).collect();
4990        self
4991    }
4992
4993    /// Sets the value of [metadata][crate::model::GceClusterConfig::metadata].
4994    ///
4995    /// # Example
4996    /// ```ignore,no_run
4997    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4998    /// let x = GceClusterConfig::new().set_metadata([
4999    ///     ("key0", "abc"),
5000    ///     ("key1", "xyz"),
5001    /// ]);
5002    /// ```
5003    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
5004    where
5005        T: std::iter::IntoIterator<Item = (K, V)>,
5006        K: std::convert::Into<std::string::String>,
5007        V: std::convert::Into<std::string::String>,
5008    {
5009        use std::iter::Iterator;
5010        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5011        self
5012    }
5013
5014    /// Sets the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
5015    ///
5016    /// # Example
5017    /// ```ignore,no_run
5018    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5019    /// use google_cloud_dataproc_v1::model::ReservationAffinity;
5020    /// let x = GceClusterConfig::new().set_reservation_affinity(ReservationAffinity::default()/* use setters */);
5021    /// ```
5022    pub fn set_reservation_affinity<T>(mut self, v: T) -> Self
5023    where
5024        T: std::convert::Into<crate::model::ReservationAffinity>,
5025    {
5026        self.reservation_affinity = std::option::Option::Some(v.into());
5027        self
5028    }
5029
5030    /// Sets or clears the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
5031    ///
5032    /// # Example
5033    /// ```ignore,no_run
5034    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5035    /// use google_cloud_dataproc_v1::model::ReservationAffinity;
5036    /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(Some(ReservationAffinity::default()/* use setters */));
5037    /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(None::<ReservationAffinity>);
5038    /// ```
5039    pub fn set_or_clear_reservation_affinity<T>(mut self, v: std::option::Option<T>) -> Self
5040    where
5041        T: std::convert::Into<crate::model::ReservationAffinity>,
5042    {
5043        self.reservation_affinity = v.map(|x| x.into());
5044        self
5045    }
5046
5047    /// Sets the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
5048    ///
5049    /// # Example
5050    /// ```ignore,no_run
5051    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5052    /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5053    /// let x = GceClusterConfig::new().set_node_group_affinity(NodeGroupAffinity::default()/* use setters */);
5054    /// ```
5055    pub fn set_node_group_affinity<T>(mut self, v: T) -> Self
5056    where
5057        T: std::convert::Into<crate::model::NodeGroupAffinity>,
5058    {
5059        self.node_group_affinity = std::option::Option::Some(v.into());
5060        self
5061    }
5062
5063    /// Sets or clears the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
5064    ///
5065    /// # Example
5066    /// ```ignore,no_run
5067    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5068    /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5069    /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(Some(NodeGroupAffinity::default()/* use setters */));
5070    /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(None::<NodeGroupAffinity>);
5071    /// ```
5072    pub fn set_or_clear_node_group_affinity<T>(mut self, v: std::option::Option<T>) -> Self
5073    where
5074        T: std::convert::Into<crate::model::NodeGroupAffinity>,
5075    {
5076        self.node_group_affinity = v.map(|x| x.into());
5077        self
5078    }
5079
5080    /// Sets the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
5081    ///
5082    /// # Example
5083    /// ```ignore,no_run
5084    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5085    /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5086    /// let x = GceClusterConfig::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
5087    /// ```
5088    pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
5089    where
5090        T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
5091    {
5092        self.shielded_instance_config = std::option::Option::Some(v.into());
5093        self
5094    }
5095
5096    /// Sets or clears the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
5097    ///
5098    /// # Example
5099    /// ```ignore,no_run
5100    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5101    /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5102    /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
5103    /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
5104    /// ```
5105    pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5106    where
5107        T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
5108    {
5109        self.shielded_instance_config = v.map(|x| x.into());
5110        self
5111    }
5112
5113    /// Sets the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
5114    ///
5115    /// # Example
5116    /// ```ignore,no_run
5117    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5118    /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5119    /// let x = GceClusterConfig::new().set_confidential_instance_config(ConfidentialInstanceConfig::default()/* use setters */);
5120    /// ```
5121    pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
5122    where
5123        T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
5124    {
5125        self.confidential_instance_config = std::option::Option::Some(v.into());
5126        self
5127    }
5128
5129    /// Sets or clears the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
5130    ///
5131    /// # Example
5132    /// ```ignore,no_run
5133    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5134    /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5135    /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(Some(ConfidentialInstanceConfig::default()/* use setters */));
5136    /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(None::<ConfidentialInstanceConfig>);
5137    /// ```
5138    pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5139    where
5140        T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
5141    {
5142        self.confidential_instance_config = v.map(|x| x.into());
5143        self
5144    }
5145}
5146
5147impl wkt::message::Message for GceClusterConfig {
5148    fn typename() -> &'static str {
5149        "type.googleapis.com/google.cloud.dataproc.v1.GceClusterConfig"
5150    }
5151}
5152
5153/// Defines additional types related to [GceClusterConfig].
5154pub mod gce_cluster_config {
5155    #[allow(unused_imports)]
5156    use super::*;
5157
5158    /// `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes
5159    /// can communicate with Google Services through gRPC over IPv6.
5160    /// These values are directly mapped to corresponding values in the
5161    /// [Compute Engine Instance
5162    /// fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
5163    ///
5164    /// # Working with unknown values
5165    ///
5166    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5167    /// additional enum variants at any time. Adding new variants is not considered
5168    /// a breaking change. Applications should write their code in anticipation of:
5169    ///
5170    /// - New values appearing in future releases of the client library, **and**
5171    /// - New values received dynamically, without application changes.
5172    ///
5173    /// Please consult the [Working with enums] section in the user guide for some
5174    /// guidelines.
5175    ///
5176    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5177    #[derive(Clone, Debug, PartialEq)]
5178    #[non_exhaustive]
5179    pub enum PrivateIpv6GoogleAccess {
5180        /// If unspecified, Compute Engine default behavior will apply, which
5181        /// is the same as
5182        /// [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK].
5183        ///
5184        /// [google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess::InheritFromSubnetwork
5185        Unspecified,
5186        /// Private access to and from Google Services configuration
5187        /// inherited from the subnetwork configuration. This is the
5188        /// default Compute Engine behavior.
5189        InheritFromSubnetwork,
5190        /// Enables outbound private IPv6 access to Google Services from the Dataproc
5191        /// cluster.
5192        Outbound,
5193        /// Enables bidirectional private IPv6 access between Google Services and the
5194        /// Dataproc cluster.
5195        Bidirectional,
5196        /// If set, the enum was initialized with an unknown value.
5197        ///
5198        /// Applications can examine the value using [PrivateIpv6GoogleAccess::value] or
5199        /// [PrivateIpv6GoogleAccess::name].
5200        UnknownValue(private_ipv_6_google_access::UnknownValue),
5201    }
5202
5203    #[doc(hidden)]
5204    pub mod private_ipv_6_google_access {
5205        #[allow(unused_imports)]
5206        use super::*;
5207        #[derive(Clone, Debug, PartialEq)]
5208        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5209    }
5210
5211    impl PrivateIpv6GoogleAccess {
5212        /// Gets the enum value.
5213        ///
5214        /// Returns `None` if the enum contains an unknown value deserialized from
5215        /// the string representation of enums.
5216        pub fn value(&self) -> std::option::Option<i32> {
5217            match self {
5218                Self::Unspecified => std::option::Option::Some(0),
5219                Self::InheritFromSubnetwork => std::option::Option::Some(1),
5220                Self::Outbound => std::option::Option::Some(2),
5221                Self::Bidirectional => std::option::Option::Some(3),
5222                Self::UnknownValue(u) => u.0.value(),
5223            }
5224        }
5225
5226        /// Gets the enum value as a string.
5227        ///
5228        /// Returns `None` if the enum contains an unknown value deserialized from
5229        /// the integer representation of enums.
5230        pub fn name(&self) -> std::option::Option<&str> {
5231            match self {
5232                Self::Unspecified => {
5233                    std::option::Option::Some("PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED")
5234                }
5235                Self::InheritFromSubnetwork => std::option::Option::Some("INHERIT_FROM_SUBNETWORK"),
5236                Self::Outbound => std::option::Option::Some("OUTBOUND"),
5237                Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
5238                Self::UnknownValue(u) => u.0.name(),
5239            }
5240        }
5241    }
5242
5243    impl std::default::Default for PrivateIpv6GoogleAccess {
5244        fn default() -> Self {
5245            use std::convert::From;
5246            Self::from(0)
5247        }
5248    }
5249
5250    impl std::fmt::Display for PrivateIpv6GoogleAccess {
5251        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5252            wkt::internal::display_enum(f, self.name(), self.value())
5253        }
5254    }
5255
5256    impl std::convert::From<i32> for PrivateIpv6GoogleAccess {
5257        fn from(value: i32) -> Self {
5258            match value {
5259                0 => Self::Unspecified,
5260                1 => Self::InheritFromSubnetwork,
5261                2 => Self::Outbound,
5262                3 => Self::Bidirectional,
5263                _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5264                    wkt::internal::UnknownEnumValue::Integer(value),
5265                )),
5266            }
5267        }
5268    }
5269
5270    impl std::convert::From<&str> for PrivateIpv6GoogleAccess {
5271        fn from(value: &str) -> Self {
5272            use std::string::ToString;
5273            match value {
5274                "PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED" => Self::Unspecified,
5275                "INHERIT_FROM_SUBNETWORK" => Self::InheritFromSubnetwork,
5276                "OUTBOUND" => Self::Outbound,
5277                "BIDIRECTIONAL" => Self::Bidirectional,
5278                _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5279                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5280                )),
5281            }
5282        }
5283    }
5284
5285    impl serde::ser::Serialize for PrivateIpv6GoogleAccess {
5286        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5287        where
5288            S: serde::Serializer,
5289        {
5290            match self {
5291                Self::Unspecified => serializer.serialize_i32(0),
5292                Self::InheritFromSubnetwork => serializer.serialize_i32(1),
5293                Self::Outbound => serializer.serialize_i32(2),
5294                Self::Bidirectional => serializer.serialize_i32(3),
5295                Self::UnknownValue(u) => u.0.serialize(serializer),
5296            }
5297        }
5298    }
5299
5300    impl<'de> serde::de::Deserialize<'de> for PrivateIpv6GoogleAccess {
5301        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5302        where
5303            D: serde::Deserializer<'de>,
5304        {
5305            deserializer.deserialize_any(
5306                wkt::internal::EnumVisitor::<PrivateIpv6GoogleAccess>::new(
5307                    ".google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess",
5308                ),
5309            )
5310        }
5311    }
5312}
5313
5314/// Node Group Affinity for clusters using sole-tenant node groups.
5315/// **The Dataproc `NodeGroupAffinity` resource is not related to the
5316/// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.**
5317///
5318/// [google.cloud.dataproc.v1.NodeGroup]: crate::model::NodeGroup
5319#[derive(Clone, Default, PartialEq)]
5320#[non_exhaustive]
5321pub struct NodeGroupAffinity {
5322    /// Required. The URI of a
5323    /// sole-tenant [node group
5324    /// resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups)
5325    /// that the cluster will be created on.
5326    ///
5327    /// A full URL, partial URI, or node group name are valid. Examples:
5328    ///
5329    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/nodeGroups/node-group-1`
5330    /// * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1`
5331    /// * `node-group-1`
5332    pub node_group_uri: std::string::String,
5333
5334    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5335}
5336
5337impl NodeGroupAffinity {
5338    /// Creates a new default instance.
5339    pub fn new() -> Self {
5340        std::default::Default::default()
5341    }
5342
5343    /// Sets the value of [node_group_uri][crate::model::NodeGroupAffinity::node_group_uri].
5344    ///
5345    /// # Example
5346    /// ```ignore,no_run
5347    /// # use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5348    /// let x = NodeGroupAffinity::new().set_node_group_uri("example");
5349    /// ```
5350    pub fn set_node_group_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5351        self.node_group_uri = v.into();
5352        self
5353    }
5354}
5355
5356impl wkt::message::Message for NodeGroupAffinity {
5357    fn typename() -> &'static str {
5358        "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupAffinity"
5359    }
5360}
5361
5362/// Shielded Instance Config for clusters using [Compute Engine Shielded
5363/// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
5364#[derive(Clone, Default, PartialEq)]
5365#[non_exhaustive]
5366pub struct ShieldedInstanceConfig {
5367    /// Optional. Defines whether instances have Secure Boot enabled.
5368    pub enable_secure_boot: std::option::Option<bool>,
5369
5370    /// Optional. Defines whether instances have the vTPM enabled.
5371    pub enable_vtpm: std::option::Option<bool>,
5372
5373    /// Optional. Defines whether instances have integrity monitoring enabled.
5374    pub enable_integrity_monitoring: std::option::Option<bool>,
5375
5376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5377}
5378
5379impl ShieldedInstanceConfig {
5380    /// Creates a new default instance.
5381    pub fn new() -> Self {
5382        std::default::Default::default()
5383    }
5384
5385    /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5386    ///
5387    /// # Example
5388    /// ```ignore,no_run
5389    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5390    /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
5391    /// ```
5392    pub fn set_enable_secure_boot<T>(mut self, v: T) -> Self
5393    where
5394        T: std::convert::Into<bool>,
5395    {
5396        self.enable_secure_boot = std::option::Option::Some(v.into());
5397        self
5398    }
5399
5400    /// Sets or clears the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5401    ///
5402    /// # Example
5403    /// ```ignore,no_run
5404    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5405    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(Some(false));
5406    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(None::<bool>);
5407    /// ```
5408    pub fn set_or_clear_enable_secure_boot<T>(mut self, v: std::option::Option<T>) -> Self
5409    where
5410        T: std::convert::Into<bool>,
5411    {
5412        self.enable_secure_boot = v.map(|x| x.into());
5413        self
5414    }
5415
5416    /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5417    ///
5418    /// # Example
5419    /// ```ignore,no_run
5420    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5421    /// let x = ShieldedInstanceConfig::new().set_enable_vtpm(true);
5422    /// ```
5423    pub fn set_enable_vtpm<T>(mut self, v: T) -> Self
5424    where
5425        T: std::convert::Into<bool>,
5426    {
5427        self.enable_vtpm = std::option::Option::Some(v.into());
5428        self
5429    }
5430
5431    /// Sets or clears the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5432    ///
5433    /// # Example
5434    /// ```ignore,no_run
5435    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5436    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(Some(false));
5437    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(None::<bool>);
5438    /// ```
5439    pub fn set_or_clear_enable_vtpm<T>(mut self, v: std::option::Option<T>) -> Self
5440    where
5441        T: std::convert::Into<bool>,
5442    {
5443        self.enable_vtpm = v.map(|x| x.into());
5444        self
5445    }
5446
5447    /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5448    ///
5449    /// # Example
5450    /// ```ignore,no_run
5451    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5452    /// let x = ShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
5453    /// ```
5454    pub fn set_enable_integrity_monitoring<T>(mut self, v: T) -> Self
5455    where
5456        T: std::convert::Into<bool>,
5457    {
5458        self.enable_integrity_monitoring = std::option::Option::Some(v.into());
5459        self
5460    }
5461
5462    /// Sets or clears the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5463    ///
5464    /// # Example
5465    /// ```ignore,no_run
5466    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5467    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(Some(false));
5468    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(None::<bool>);
5469    /// ```
5470    pub fn set_or_clear_enable_integrity_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
5471    where
5472        T: std::convert::Into<bool>,
5473    {
5474        self.enable_integrity_monitoring = v.map(|x| x.into());
5475        self
5476    }
5477}
5478
5479impl wkt::message::Message for ShieldedInstanceConfig {
5480    fn typename() -> &'static str {
5481        "type.googleapis.com/google.cloud.dataproc.v1.ShieldedInstanceConfig"
5482    }
5483}
5484
5485/// Confidential Instance Config for clusters using [Confidential
5486/// VMs](https://cloud.google.com/compute/confidential-vm/docs)
5487#[derive(Clone, Default, PartialEq)]
5488#[non_exhaustive]
5489pub struct ConfidentialInstanceConfig {
5490    /// Optional. Defines whether the instance should have confidential compute
5491    /// enabled.
5492    pub enable_confidential_compute: bool,
5493
5494    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5495}
5496
5497impl ConfidentialInstanceConfig {
5498    /// Creates a new default instance.
5499    pub fn new() -> Self {
5500        std::default::Default::default()
5501    }
5502
5503    /// Sets the value of [enable_confidential_compute][crate::model::ConfidentialInstanceConfig::enable_confidential_compute].
5504    ///
5505    /// # Example
5506    /// ```ignore,no_run
5507    /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5508    /// let x = ConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
5509    /// ```
5510    pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5511        self.enable_confidential_compute = v.into();
5512        self
5513    }
5514}
5515
5516impl wkt::message::Message for ConfidentialInstanceConfig {
5517    fn typename() -> &'static str {
5518        "type.googleapis.com/google.cloud.dataproc.v1.ConfidentialInstanceConfig"
5519    }
5520}
5521
5522/// The config settings for Compute Engine resources in
5523/// an instance group, such as a master or worker group.
5524#[derive(Clone, Default, PartialEq)]
5525#[non_exhaustive]
5526pub struct InstanceGroupConfig {
5527    /// Optional. The number of VM instances in the instance group.
5528    /// For [HA
5529    /// cluster](/dataproc/docs/concepts/configuring-clusters/high-availability)
5530    /// [master_config](#FIELDS.master_config) groups, **must be set to 3**.
5531    /// For standard cluster [master_config](#FIELDS.master_config) groups,
5532    /// **must be set to 1**.
5533    pub num_instances: i32,
5534
5535    /// Output only. The list of instance names. Dataproc derives the names
5536    /// from `cluster_name`, `num_instances`, and the instance group.
5537    pub instance_names: std::vec::Vec<std::string::String>,
5538
5539    /// Output only. List of references to Compute Engine instances.
5540    pub instance_references: std::vec::Vec<crate::model::InstanceReference>,
5541
5542    /// Optional. The Compute Engine image resource used for cluster instances.
5543    ///
5544    /// The URI can represent an image or image family.
5545    ///
5546    /// Image examples:
5547    ///
5548    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/[image-id]`
5549    /// * `projects/[project_id]/global/images/[image-id]`
5550    /// * `image-id`
5551    ///
5552    /// Image family examples. Dataproc will use the most recent
5553    /// image from the family:
5554    ///
5555    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/family/[custom-image-family-name]`
5556    /// * `projects/[project_id]/global/images/family/[custom-image-family-name]`
5557    ///
5558    /// If the URI is unspecified, it will be inferred from
5559    /// `SoftwareConfig.image_version` or the system default.
5560    pub image_uri: std::string::String,
5561
5562    /// Optional. The Compute Engine machine type used for cluster instances.
5563    ///
5564    /// A full URL, partial URI, or short name are valid. Examples:
5565    ///
5566    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5567    /// * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5568    /// * `n1-standard-2`
5569    ///
5570    /// **Auto Zone Exception**: If you are using the Dataproc
5571    /// [Auto Zone
5572    /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
5573    /// feature, you must use the short name of the machine type
5574    /// resource, for example, `n1-standard-2`.
5575    pub machine_type_uri: std::string::String,
5576
5577    /// Optional. Disk option config settings.
5578    pub disk_config: std::option::Option<crate::model::DiskConfig>,
5579
5580    /// Output only. Specifies that this instance group contains preemptible
5581    /// instances.
5582    pub is_preemptible: bool,
5583
5584    /// Optional. Specifies the preemptibility of the instance group.
5585    ///
5586    /// The default value for master and worker groups is
5587    /// `NON_PREEMPTIBLE`. This default cannot be changed.
5588    ///
5589    /// The default value for secondary instances is
5590    /// `PREEMPTIBLE`.
5591    pub preemptibility: crate::model::instance_group_config::Preemptibility,
5592
5593    /// Output only. The config for Compute Engine Instance Group
5594    /// Manager that manages this group.
5595    /// This is only used for preemptible instance groups.
5596    pub managed_group_config: std::option::Option<crate::model::ManagedGroupConfig>,
5597
5598    /// Optional. The Compute Engine accelerator configuration for these
5599    /// instances.
5600    pub accelerators: std::vec::Vec<crate::model::AcceleratorConfig>,
5601
5602    /// Optional. Specifies the minimum cpu platform for the Instance Group.
5603    /// See [Dataproc -> Minimum CPU
5604    /// Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
5605    pub min_cpu_platform: std::string::String,
5606
5607    /// Optional. The minimum number of primary worker instances to create.
5608    /// If `min_num_instances` is set, cluster creation will succeed if
5609    /// the number of primary workers created is at least equal to the
5610    /// `min_num_instances` number.
5611    ///
5612    /// Example: Cluster creation request with `num_instances` = `5` and
5613    /// `min_num_instances` = `3`:
5614    ///
5615    /// * If 4 VMs are created and 1 instance fails,
5616    ///   the failed VM is deleted. The cluster is
5617    ///   resized to 4 instances and placed in a `RUNNING` state.
5618    /// * If 2 instances are created and 3 instances fail,
5619    ///   the cluster in placed in an `ERROR` state. The failed VMs
5620    ///   are not deleted.
5621    pub min_num_instances: i32,
5622
5623    /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and
5624    /// provisioning models.
5625    pub instance_flexibility_policy: std::option::Option<crate::model::InstanceFlexibilityPolicy>,
5626
5627    /// Optional. Configuration to handle the startup of instances during cluster
5628    /// create and update process.
5629    pub startup_config: std::option::Option<crate::model::StartupConfig>,
5630
5631    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5632}
5633
5634impl InstanceGroupConfig {
5635    /// Creates a new default instance.
5636    pub fn new() -> Self {
5637        std::default::Default::default()
5638    }
5639
5640    /// Sets the value of [num_instances][crate::model::InstanceGroupConfig::num_instances].
5641    ///
5642    /// # Example
5643    /// ```ignore,no_run
5644    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5645    /// let x = InstanceGroupConfig::new().set_num_instances(42);
5646    /// ```
5647    pub fn set_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5648        self.num_instances = v.into();
5649        self
5650    }
5651
5652    /// Sets the value of [instance_names][crate::model::InstanceGroupConfig::instance_names].
5653    ///
5654    /// # Example
5655    /// ```ignore,no_run
5656    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5657    /// let x = InstanceGroupConfig::new().set_instance_names(["a", "b", "c"]);
5658    /// ```
5659    pub fn set_instance_names<T, V>(mut self, v: T) -> Self
5660    where
5661        T: std::iter::IntoIterator<Item = V>,
5662        V: std::convert::Into<std::string::String>,
5663    {
5664        use std::iter::Iterator;
5665        self.instance_names = v.into_iter().map(|i| i.into()).collect();
5666        self
5667    }
5668
5669    /// Sets the value of [instance_references][crate::model::InstanceGroupConfig::instance_references].
5670    ///
5671    /// # Example
5672    /// ```ignore,no_run
5673    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5674    /// use google_cloud_dataproc_v1::model::InstanceReference;
5675    /// let x = InstanceGroupConfig::new()
5676    ///     .set_instance_references([
5677    ///         InstanceReference::default()/* use setters */,
5678    ///         InstanceReference::default()/* use (different) setters */,
5679    ///     ]);
5680    /// ```
5681    pub fn set_instance_references<T, V>(mut self, v: T) -> Self
5682    where
5683        T: std::iter::IntoIterator<Item = V>,
5684        V: std::convert::Into<crate::model::InstanceReference>,
5685    {
5686        use std::iter::Iterator;
5687        self.instance_references = v.into_iter().map(|i| i.into()).collect();
5688        self
5689    }
5690
5691    /// Sets the value of [image_uri][crate::model::InstanceGroupConfig::image_uri].
5692    ///
5693    /// # Example
5694    /// ```ignore,no_run
5695    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5696    /// let x = InstanceGroupConfig::new().set_image_uri("example");
5697    /// ```
5698    pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5699        self.image_uri = v.into();
5700        self
5701    }
5702
5703    /// Sets the value of [machine_type_uri][crate::model::InstanceGroupConfig::machine_type_uri].
5704    ///
5705    /// # Example
5706    /// ```ignore,no_run
5707    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5708    /// let x = InstanceGroupConfig::new().set_machine_type_uri("example");
5709    /// ```
5710    pub fn set_machine_type_uri<T: std::convert::Into<std::string::String>>(
5711        mut self,
5712        v: T,
5713    ) -> Self {
5714        self.machine_type_uri = v.into();
5715        self
5716    }
5717
5718    /// Sets the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5719    ///
5720    /// # Example
5721    /// ```ignore,no_run
5722    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5723    /// use google_cloud_dataproc_v1::model::DiskConfig;
5724    /// let x = InstanceGroupConfig::new().set_disk_config(DiskConfig::default()/* use setters */);
5725    /// ```
5726    pub fn set_disk_config<T>(mut self, v: T) -> Self
5727    where
5728        T: std::convert::Into<crate::model::DiskConfig>,
5729    {
5730        self.disk_config = std::option::Option::Some(v.into());
5731        self
5732    }
5733
5734    /// Sets or clears the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5735    ///
5736    /// # Example
5737    /// ```ignore,no_run
5738    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5739    /// use google_cloud_dataproc_v1::model::DiskConfig;
5740    /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
5741    /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(None::<DiskConfig>);
5742    /// ```
5743    pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
5744    where
5745        T: std::convert::Into<crate::model::DiskConfig>,
5746    {
5747        self.disk_config = v.map(|x| x.into());
5748        self
5749    }
5750
5751    /// Sets the value of [is_preemptible][crate::model::InstanceGroupConfig::is_preemptible].
5752    ///
5753    /// # Example
5754    /// ```ignore,no_run
5755    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5756    /// let x = InstanceGroupConfig::new().set_is_preemptible(true);
5757    /// ```
5758    pub fn set_is_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5759        self.is_preemptible = v.into();
5760        self
5761    }
5762
5763    /// Sets the value of [preemptibility][crate::model::InstanceGroupConfig::preemptibility].
5764    ///
5765    /// # Example
5766    /// ```ignore,no_run
5767    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5768    /// use google_cloud_dataproc_v1::model::instance_group_config::Preemptibility;
5769    /// let x0 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::NonPreemptible);
5770    /// let x1 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Preemptible);
5771    /// let x2 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Spot);
5772    /// ```
5773    pub fn set_preemptibility<
5774        T: std::convert::Into<crate::model::instance_group_config::Preemptibility>,
5775    >(
5776        mut self,
5777        v: T,
5778    ) -> Self {
5779        self.preemptibility = v.into();
5780        self
5781    }
5782
5783    /// Sets the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5784    ///
5785    /// # Example
5786    /// ```ignore,no_run
5787    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5788    /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5789    /// let x = InstanceGroupConfig::new().set_managed_group_config(ManagedGroupConfig::default()/* use setters */);
5790    /// ```
5791    pub fn set_managed_group_config<T>(mut self, v: T) -> Self
5792    where
5793        T: std::convert::Into<crate::model::ManagedGroupConfig>,
5794    {
5795        self.managed_group_config = std::option::Option::Some(v.into());
5796        self
5797    }
5798
5799    /// Sets or clears the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5800    ///
5801    /// # Example
5802    /// ```ignore,no_run
5803    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5804    /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5805    /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(Some(ManagedGroupConfig::default()/* use setters */));
5806    /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(None::<ManagedGroupConfig>);
5807    /// ```
5808    pub fn set_or_clear_managed_group_config<T>(mut self, v: std::option::Option<T>) -> Self
5809    where
5810        T: std::convert::Into<crate::model::ManagedGroupConfig>,
5811    {
5812        self.managed_group_config = v.map(|x| x.into());
5813        self
5814    }
5815
5816    /// Sets the value of [accelerators][crate::model::InstanceGroupConfig::accelerators].
5817    ///
5818    /// # Example
5819    /// ```ignore,no_run
5820    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5821    /// use google_cloud_dataproc_v1::model::AcceleratorConfig;
5822    /// let x = InstanceGroupConfig::new()
5823    ///     .set_accelerators([
5824    ///         AcceleratorConfig::default()/* use setters */,
5825    ///         AcceleratorConfig::default()/* use (different) setters */,
5826    ///     ]);
5827    /// ```
5828    pub fn set_accelerators<T, V>(mut self, v: T) -> Self
5829    where
5830        T: std::iter::IntoIterator<Item = V>,
5831        V: std::convert::Into<crate::model::AcceleratorConfig>,
5832    {
5833        use std::iter::Iterator;
5834        self.accelerators = v.into_iter().map(|i| i.into()).collect();
5835        self
5836    }
5837
5838    /// Sets the value of [min_cpu_platform][crate::model::InstanceGroupConfig::min_cpu_platform].
5839    ///
5840    /// # Example
5841    /// ```ignore,no_run
5842    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5843    /// let x = InstanceGroupConfig::new().set_min_cpu_platform("example");
5844    /// ```
5845    pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
5846        mut self,
5847        v: T,
5848    ) -> Self {
5849        self.min_cpu_platform = v.into();
5850        self
5851    }
5852
5853    /// Sets the value of [min_num_instances][crate::model::InstanceGroupConfig::min_num_instances].
5854    ///
5855    /// # Example
5856    /// ```ignore,no_run
5857    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5858    /// let x = InstanceGroupConfig::new().set_min_num_instances(42);
5859    /// ```
5860    pub fn set_min_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5861        self.min_num_instances = v.into();
5862        self
5863    }
5864
5865    /// Sets the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5866    ///
5867    /// # Example
5868    /// ```ignore,no_run
5869    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5870    /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5871    /// let x = InstanceGroupConfig::new().set_instance_flexibility_policy(InstanceFlexibilityPolicy::default()/* use setters */);
5872    /// ```
5873    pub fn set_instance_flexibility_policy<T>(mut self, v: T) -> Self
5874    where
5875        T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5876    {
5877        self.instance_flexibility_policy = std::option::Option::Some(v.into());
5878        self
5879    }
5880
5881    /// Sets or clears the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5882    ///
5883    /// # Example
5884    /// ```ignore,no_run
5885    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5886    /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5887    /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(Some(InstanceFlexibilityPolicy::default()/* use setters */));
5888    /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(None::<InstanceFlexibilityPolicy>);
5889    /// ```
5890    pub fn set_or_clear_instance_flexibility_policy<T>(mut self, v: std::option::Option<T>) -> Self
5891    where
5892        T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5893    {
5894        self.instance_flexibility_policy = v.map(|x| x.into());
5895        self
5896    }
5897
5898    /// Sets the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5899    ///
5900    /// # Example
5901    /// ```ignore,no_run
5902    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5903    /// use google_cloud_dataproc_v1::model::StartupConfig;
5904    /// let x = InstanceGroupConfig::new().set_startup_config(StartupConfig::default()/* use setters */);
5905    /// ```
5906    pub fn set_startup_config<T>(mut self, v: T) -> Self
5907    where
5908        T: std::convert::Into<crate::model::StartupConfig>,
5909    {
5910        self.startup_config = std::option::Option::Some(v.into());
5911        self
5912    }
5913
5914    /// Sets or clears the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5915    ///
5916    /// # Example
5917    /// ```ignore,no_run
5918    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5919    /// use google_cloud_dataproc_v1::model::StartupConfig;
5920    /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(Some(StartupConfig::default()/* use setters */));
5921    /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(None::<StartupConfig>);
5922    /// ```
5923    pub fn set_or_clear_startup_config<T>(mut self, v: std::option::Option<T>) -> Self
5924    where
5925        T: std::convert::Into<crate::model::StartupConfig>,
5926    {
5927        self.startup_config = v.map(|x| x.into());
5928        self
5929    }
5930}
5931
5932impl wkt::message::Message for InstanceGroupConfig {
5933    fn typename() -> &'static str {
5934        "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupConfig"
5935    }
5936}
5937
5938/// Defines additional types related to [InstanceGroupConfig].
5939pub mod instance_group_config {
5940    #[allow(unused_imports)]
5941    use super::*;
5942
5943    /// Controls the use of preemptible instances within the group.
5944    ///
5945    /// # Working with unknown values
5946    ///
5947    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5948    /// additional enum variants at any time. Adding new variants is not considered
5949    /// a breaking change. Applications should write their code in anticipation of:
5950    ///
5951    /// - New values appearing in future releases of the client library, **and**
5952    /// - New values received dynamically, without application changes.
5953    ///
5954    /// Please consult the [Working with enums] section in the user guide for some
5955    /// guidelines.
5956    ///
5957    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5958    #[derive(Clone, Debug, PartialEq)]
5959    #[non_exhaustive]
5960    pub enum Preemptibility {
5961        /// Preemptibility is unspecified, the system will choose the
5962        /// appropriate setting for each instance group.
5963        Unspecified,
5964        /// Instances are non-preemptible.
5965        ///
5966        /// This option is allowed for all instance groups and is the only valid
5967        /// value for Master and Worker instance groups.
5968        NonPreemptible,
5969        /// Instances are [preemptible]
5970        /// (<https://cloud.google.com/compute/docs/instances/preemptible>).
5971        ///
5972        /// This option is allowed only for [secondary worker]
5973        /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5974        /// groups.
5975        Preemptible,
5976        /// Instances are [Spot VMs]
5977        /// (<https://cloud.google.com/compute/docs/instances/spot>).
5978        ///
5979        /// This option is allowed only for [secondary worker]
5980        /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5981        /// groups. Spot VMs are the latest version of [preemptible VMs]
5982        /// (<https://cloud.google.com/compute/docs/instances/preemptible>), and
5983        /// provide additional features.
5984        Spot,
5985        /// If set, the enum was initialized with an unknown value.
5986        ///
5987        /// Applications can examine the value using [Preemptibility::value] or
5988        /// [Preemptibility::name].
5989        UnknownValue(preemptibility::UnknownValue),
5990    }
5991
5992    #[doc(hidden)]
5993    pub mod preemptibility {
5994        #[allow(unused_imports)]
5995        use super::*;
5996        #[derive(Clone, Debug, PartialEq)]
5997        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5998    }
5999
6000    impl Preemptibility {
6001        /// Gets the enum value.
6002        ///
6003        /// Returns `None` if the enum contains an unknown value deserialized from
6004        /// the string representation of enums.
6005        pub fn value(&self) -> std::option::Option<i32> {
6006            match self {
6007                Self::Unspecified => std::option::Option::Some(0),
6008                Self::NonPreemptible => std::option::Option::Some(1),
6009                Self::Preemptible => std::option::Option::Some(2),
6010                Self::Spot => std::option::Option::Some(3),
6011                Self::UnknownValue(u) => u.0.value(),
6012            }
6013        }
6014
6015        /// Gets the enum value as a string.
6016        ///
6017        /// Returns `None` if the enum contains an unknown value deserialized from
6018        /// the integer representation of enums.
6019        pub fn name(&self) -> std::option::Option<&str> {
6020            match self {
6021                Self::Unspecified => std::option::Option::Some("PREEMPTIBILITY_UNSPECIFIED"),
6022                Self::NonPreemptible => std::option::Option::Some("NON_PREEMPTIBLE"),
6023                Self::Preemptible => std::option::Option::Some("PREEMPTIBLE"),
6024                Self::Spot => std::option::Option::Some("SPOT"),
6025                Self::UnknownValue(u) => u.0.name(),
6026            }
6027        }
6028    }
6029
6030    impl std::default::Default for Preemptibility {
6031        fn default() -> Self {
6032            use std::convert::From;
6033            Self::from(0)
6034        }
6035    }
6036
6037    impl std::fmt::Display for Preemptibility {
6038        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6039            wkt::internal::display_enum(f, self.name(), self.value())
6040        }
6041    }
6042
6043    impl std::convert::From<i32> for Preemptibility {
6044        fn from(value: i32) -> Self {
6045            match value {
6046                0 => Self::Unspecified,
6047                1 => Self::NonPreemptible,
6048                2 => Self::Preemptible,
6049                3 => Self::Spot,
6050                _ => Self::UnknownValue(preemptibility::UnknownValue(
6051                    wkt::internal::UnknownEnumValue::Integer(value),
6052                )),
6053            }
6054        }
6055    }
6056
6057    impl std::convert::From<&str> for Preemptibility {
6058        fn from(value: &str) -> Self {
6059            use std::string::ToString;
6060            match value {
6061                "PREEMPTIBILITY_UNSPECIFIED" => Self::Unspecified,
6062                "NON_PREEMPTIBLE" => Self::NonPreemptible,
6063                "PREEMPTIBLE" => Self::Preemptible,
6064                "SPOT" => Self::Spot,
6065                _ => Self::UnknownValue(preemptibility::UnknownValue(
6066                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6067                )),
6068            }
6069        }
6070    }
6071
6072    impl serde::ser::Serialize for Preemptibility {
6073        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6074        where
6075            S: serde::Serializer,
6076        {
6077            match self {
6078                Self::Unspecified => serializer.serialize_i32(0),
6079                Self::NonPreemptible => serializer.serialize_i32(1),
6080                Self::Preemptible => serializer.serialize_i32(2),
6081                Self::Spot => serializer.serialize_i32(3),
6082                Self::UnknownValue(u) => u.0.serialize(serializer),
6083            }
6084        }
6085    }
6086
6087    impl<'de> serde::de::Deserialize<'de> for Preemptibility {
6088        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6089        where
6090            D: serde::Deserializer<'de>,
6091        {
6092            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Preemptibility>::new(
6093                ".google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility",
6094            ))
6095        }
6096    }
6097}
6098
6099/// Configuration to handle the startup of instances during cluster create and
6100/// update process.
6101#[derive(Clone, Default, PartialEq)]
6102#[non_exhaustive]
6103pub struct StartupConfig {
6104    /// Optional. The config setting to enable cluster creation/ updation to be
6105    /// successful only after required_registration_fraction of instances are up
6106    /// and running. This configuration is applicable to only secondary workers for
6107    /// now. The cluster will fail if required_registration_fraction of instances
6108    /// are not available. This will include instance creation, agent registration,
6109    /// and service registration (if enabled).
6110    pub required_registration_fraction: std::option::Option<f64>,
6111
6112    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6113}
6114
6115impl StartupConfig {
6116    /// Creates a new default instance.
6117    pub fn new() -> Self {
6118        std::default::Default::default()
6119    }
6120
6121    /// Sets the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
6122    ///
6123    /// # Example
6124    /// ```ignore,no_run
6125    /// # use google_cloud_dataproc_v1::model::StartupConfig;
6126    /// let x = StartupConfig::new().set_required_registration_fraction(42.0);
6127    /// ```
6128    pub fn set_required_registration_fraction<T>(mut self, v: T) -> Self
6129    where
6130        T: std::convert::Into<f64>,
6131    {
6132        self.required_registration_fraction = std::option::Option::Some(v.into());
6133        self
6134    }
6135
6136    /// Sets or clears the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
6137    ///
6138    /// # Example
6139    /// ```ignore,no_run
6140    /// # use google_cloud_dataproc_v1::model::StartupConfig;
6141    /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(Some(42.0));
6142    /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(None::<f32>);
6143    /// ```
6144    pub fn set_or_clear_required_registration_fraction<T>(
6145        mut self,
6146        v: std::option::Option<T>,
6147    ) -> Self
6148    where
6149        T: std::convert::Into<f64>,
6150    {
6151        self.required_registration_fraction = v.map(|x| x.into());
6152        self
6153    }
6154}
6155
6156impl wkt::message::Message for StartupConfig {
6157    fn typename() -> &'static str {
6158        "type.googleapis.com/google.cloud.dataproc.v1.StartupConfig"
6159    }
6160}
6161
6162/// A reference to a Compute Engine instance.
6163#[derive(Clone, Default, PartialEq)]
6164#[non_exhaustive]
6165pub struct InstanceReference {
6166    /// The user-friendly name of the Compute Engine instance.
6167    pub instance_name: std::string::String,
6168
6169    /// The unique identifier of the Compute Engine instance.
6170    pub instance_id: std::string::String,
6171
6172    /// The public RSA key used for sharing data with this instance.
6173    pub public_key: std::string::String,
6174
6175    /// The public ECIES key used for sharing data with this instance.
6176    pub public_ecies_key: std::string::String,
6177
6178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6179}
6180
6181impl InstanceReference {
6182    /// Creates a new default instance.
6183    pub fn new() -> Self {
6184        std::default::Default::default()
6185    }
6186
6187    /// Sets the value of [instance_name][crate::model::InstanceReference::instance_name].
6188    ///
6189    /// # Example
6190    /// ```ignore,no_run
6191    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6192    /// let x = InstanceReference::new().set_instance_name("example");
6193    /// ```
6194    pub fn set_instance_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6195        self.instance_name = v.into();
6196        self
6197    }
6198
6199    /// Sets the value of [instance_id][crate::model::InstanceReference::instance_id].
6200    ///
6201    /// # Example
6202    /// ```ignore,no_run
6203    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6204    /// let x = InstanceReference::new().set_instance_id("example");
6205    /// ```
6206    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6207        self.instance_id = v.into();
6208        self
6209    }
6210
6211    /// Sets the value of [public_key][crate::model::InstanceReference::public_key].
6212    ///
6213    /// # Example
6214    /// ```ignore,no_run
6215    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6216    /// let x = InstanceReference::new().set_public_key("example");
6217    /// ```
6218    pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6219        self.public_key = v.into();
6220        self
6221    }
6222
6223    /// Sets the value of [public_ecies_key][crate::model::InstanceReference::public_ecies_key].
6224    ///
6225    /// # Example
6226    /// ```ignore,no_run
6227    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6228    /// let x = InstanceReference::new().set_public_ecies_key("example");
6229    /// ```
6230    pub fn set_public_ecies_key<T: std::convert::Into<std::string::String>>(
6231        mut self,
6232        v: T,
6233    ) -> Self {
6234        self.public_ecies_key = v.into();
6235        self
6236    }
6237}
6238
6239impl wkt::message::Message for InstanceReference {
6240    fn typename() -> &'static str {
6241        "type.googleapis.com/google.cloud.dataproc.v1.InstanceReference"
6242    }
6243}
6244
6245/// Specifies the resources used to actively manage an instance group.
6246#[derive(Clone, Default, PartialEq)]
6247#[non_exhaustive]
6248pub struct ManagedGroupConfig {
6249    /// Output only. The name of the Instance Template used for the Managed
6250    /// Instance Group.
6251    pub instance_template_name: std::string::String,
6252
6253    /// Output only. The name of the Instance Group Manager for this group.
6254    pub instance_group_manager_name: std::string::String,
6255
6256    /// Output only. The partial URI to the instance group manager for this group.
6257    /// E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
6258    pub instance_group_manager_uri: std::string::String,
6259
6260    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6261}
6262
6263impl ManagedGroupConfig {
6264    /// Creates a new default instance.
6265    pub fn new() -> Self {
6266        std::default::Default::default()
6267    }
6268
6269    /// Sets the value of [instance_template_name][crate::model::ManagedGroupConfig::instance_template_name].
6270    ///
6271    /// # Example
6272    /// ```ignore,no_run
6273    /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6274    /// let x = ManagedGroupConfig::new().set_instance_template_name("example");
6275    /// ```
6276    pub fn set_instance_template_name<T: std::convert::Into<std::string::String>>(
6277        mut self,
6278        v: T,
6279    ) -> Self {
6280        self.instance_template_name = v.into();
6281        self
6282    }
6283
6284    /// Sets the value of [instance_group_manager_name][crate::model::ManagedGroupConfig::instance_group_manager_name].
6285    ///
6286    /// # Example
6287    /// ```ignore,no_run
6288    /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6289    /// let x = ManagedGroupConfig::new().set_instance_group_manager_name("example");
6290    /// ```
6291    pub fn set_instance_group_manager_name<T: std::convert::Into<std::string::String>>(
6292        mut self,
6293        v: T,
6294    ) -> Self {
6295        self.instance_group_manager_name = v.into();
6296        self
6297    }
6298
6299    /// Sets the value of [instance_group_manager_uri][crate::model::ManagedGroupConfig::instance_group_manager_uri].
6300    ///
6301    /// # Example
6302    /// ```ignore,no_run
6303    /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6304    /// let x = ManagedGroupConfig::new().set_instance_group_manager_uri("example");
6305    /// ```
6306    pub fn set_instance_group_manager_uri<T: std::convert::Into<std::string::String>>(
6307        mut self,
6308        v: T,
6309    ) -> Self {
6310        self.instance_group_manager_uri = v.into();
6311        self
6312    }
6313}
6314
6315impl wkt::message::Message for ManagedGroupConfig {
6316    fn typename() -> &'static str {
6317        "type.googleapis.com/google.cloud.dataproc.v1.ManagedGroupConfig"
6318    }
6319}
6320
6321/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning
6322/// models.
6323#[derive(Clone, Default, PartialEq)]
6324#[non_exhaustive]
6325pub struct InstanceFlexibilityPolicy {
6326    /// Optional. Defines how the Group selects the provisioning model to ensure
6327    /// required reliability.
6328    pub provisioning_model_mix:
6329        std::option::Option<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6330
6331    /// Optional. List of instance selection options that the group will use when
6332    /// creating new VMs.
6333    pub instance_selection_list:
6334        std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelection>,
6335
6336    /// Output only. A list of instance selection results in the group.
6337    pub instance_selection_results:
6338        std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6339
6340    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6341}
6342
6343impl InstanceFlexibilityPolicy {
6344    /// Creates a new default instance.
6345    pub fn new() -> Self {
6346        std::default::Default::default()
6347    }
6348
6349    /// Sets the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6350    ///
6351    /// # Example
6352    /// ```ignore,no_run
6353    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6354    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6355    /// let x = InstanceFlexibilityPolicy::new().set_provisioning_model_mix(ProvisioningModelMix::default()/* use setters */);
6356    /// ```
6357    pub fn set_provisioning_model_mix<T>(mut self, v: T) -> Self
6358    where
6359        T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6360    {
6361        self.provisioning_model_mix = std::option::Option::Some(v.into());
6362        self
6363    }
6364
6365    /// Sets or clears the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6366    ///
6367    /// # Example
6368    /// ```ignore,no_run
6369    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6370    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6371    /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(Some(ProvisioningModelMix::default()/* use setters */));
6372    /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(None::<ProvisioningModelMix>);
6373    /// ```
6374    pub fn set_or_clear_provisioning_model_mix<T>(mut self, v: std::option::Option<T>) -> Self
6375    where
6376        T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6377    {
6378        self.provisioning_model_mix = v.map(|x| x.into());
6379        self
6380    }
6381
6382    /// Sets the value of [instance_selection_list][crate::model::InstanceFlexibilityPolicy::instance_selection_list].
6383    ///
6384    /// # Example
6385    /// ```ignore,no_run
6386    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6387    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6388    /// let x = InstanceFlexibilityPolicy::new()
6389    ///     .set_instance_selection_list([
6390    ///         InstanceSelection::default()/* use setters */,
6391    ///         InstanceSelection::default()/* use (different) setters */,
6392    ///     ]);
6393    /// ```
6394    pub fn set_instance_selection_list<T, V>(mut self, v: T) -> Self
6395    where
6396        T: std::iter::IntoIterator<Item = V>,
6397        V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelection>,
6398    {
6399        use std::iter::Iterator;
6400        self.instance_selection_list = v.into_iter().map(|i| i.into()).collect();
6401        self
6402    }
6403
6404    /// Sets the value of [instance_selection_results][crate::model::InstanceFlexibilityPolicy::instance_selection_results].
6405    ///
6406    /// # Example
6407    /// ```ignore,no_run
6408    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6409    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6410    /// let x = InstanceFlexibilityPolicy::new()
6411    ///     .set_instance_selection_results([
6412    ///         InstanceSelectionResult::default()/* use setters */,
6413    ///         InstanceSelectionResult::default()/* use (different) setters */,
6414    ///     ]);
6415    /// ```
6416    pub fn set_instance_selection_results<T, V>(mut self, v: T) -> Self
6417    where
6418        T: std::iter::IntoIterator<Item = V>,
6419        V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6420    {
6421        use std::iter::Iterator;
6422        self.instance_selection_results = v.into_iter().map(|i| i.into()).collect();
6423        self
6424    }
6425}
6426
6427impl wkt::message::Message for InstanceFlexibilityPolicy {
6428    fn typename() -> &'static str {
6429        "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy"
6430    }
6431}
6432
6433/// Defines additional types related to [InstanceFlexibilityPolicy].
6434pub mod instance_flexibility_policy {
6435    #[allow(unused_imports)]
6436    use super::*;
6437
6438    /// Defines how Dataproc should create VMs with a mixture of provisioning
6439    /// models.
6440    #[derive(Clone, Default, PartialEq)]
6441    #[non_exhaustive]
6442    pub struct ProvisioningModelMix {
6443        /// Optional. The base capacity that will always use Standard VMs to avoid
6444        /// risk of more preemption than the minimum capacity you need. Dataproc will
6445        /// create only standard VMs until it reaches standard_capacity_base, then it
6446        /// will start using standard_capacity_percent_above_base to mix Spot with
6447        /// Standard VMs. eg. If 15 instances are requested and
6448        /// standard_capacity_base is 5, Dataproc will create 5 standard VMs and then
6449        /// start mixing spot and standard VMs for remaining 10 instances.
6450        pub standard_capacity_base: std::option::Option<i32>,
6451
6452        /// Optional. The percentage of target capacity that should use Standard VM.
6453        /// The remaining percentage will use Spot VMs. The percentage applies only
6454        /// to the capacity above standard_capacity_base. eg. If 15 instances are
6455        /// requested and standard_capacity_base is 5 and
6456        /// standard_capacity_percent_above_base is 30, Dataproc will create 5
6457        /// standard VMs and then start mixing spot and standard VMs for remaining 10
6458        /// instances. The mix will be 30% standard and 70% spot.
6459        pub standard_capacity_percent_above_base: std::option::Option<i32>,
6460
6461        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6462    }
6463
6464    impl ProvisioningModelMix {
6465        /// Creates a new default instance.
6466        pub fn new() -> Self {
6467            std::default::Default::default()
6468        }
6469
6470        /// Sets the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6471        ///
6472        /// # Example
6473        /// ```ignore,no_run
6474        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6475        /// let x = ProvisioningModelMix::new().set_standard_capacity_base(42);
6476        /// ```
6477        pub fn set_standard_capacity_base<T>(mut self, v: T) -> Self
6478        where
6479            T: std::convert::Into<i32>,
6480        {
6481            self.standard_capacity_base = std::option::Option::Some(v.into());
6482            self
6483        }
6484
6485        /// Sets or clears the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6486        ///
6487        /// # Example
6488        /// ```ignore,no_run
6489        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6490        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(Some(42));
6491        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(None::<i32>);
6492        /// ```
6493        pub fn set_or_clear_standard_capacity_base<T>(mut self, v: std::option::Option<T>) -> Self
6494        where
6495            T: std::convert::Into<i32>,
6496        {
6497            self.standard_capacity_base = v.map(|x| x.into());
6498            self
6499        }
6500
6501        /// Sets the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6502        ///
6503        /// # Example
6504        /// ```ignore,no_run
6505        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6506        /// let x = ProvisioningModelMix::new().set_standard_capacity_percent_above_base(42);
6507        /// ```
6508        pub fn set_standard_capacity_percent_above_base<T>(mut self, v: T) -> Self
6509        where
6510            T: std::convert::Into<i32>,
6511        {
6512            self.standard_capacity_percent_above_base = std::option::Option::Some(v.into());
6513            self
6514        }
6515
6516        /// Sets or clears the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6517        ///
6518        /// # Example
6519        /// ```ignore,no_run
6520        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6521        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(Some(42));
6522        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(None::<i32>);
6523        /// ```
6524        pub fn set_or_clear_standard_capacity_percent_above_base<T>(
6525            mut self,
6526            v: std::option::Option<T>,
6527        ) -> Self
6528        where
6529            T: std::convert::Into<i32>,
6530        {
6531            self.standard_capacity_percent_above_base = v.map(|x| x.into());
6532            self
6533        }
6534    }
6535
6536    impl wkt::message::Message for ProvisioningModelMix {
6537        fn typename() -> &'static str {
6538            "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.ProvisioningModelMix"
6539        }
6540    }
6541
6542    /// Defines machines types and a rank to which the machines types belong.
6543    #[derive(Clone, Default, PartialEq)]
6544    #[non_exhaustive]
6545    pub struct InstanceSelection {
6546        /// Optional. Full machine-type names, e.g. "n1-standard-16".
6547        pub machine_types: std::vec::Vec<std::string::String>,
6548
6549        /// Optional. Preference of this instance selection. Lower number means
6550        /// higher preference. Dataproc will first try to create a VM based on the
6551        /// machine-type with priority rank and fallback to next rank based on
6552        /// availability. Machine types and instance selections with the same
6553        /// priority have the same preference.
6554        pub rank: i32,
6555
6556        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6557    }
6558
6559    impl InstanceSelection {
6560        /// Creates a new default instance.
6561        pub fn new() -> Self {
6562            std::default::Default::default()
6563        }
6564
6565        /// Sets the value of [machine_types][crate::model::instance_flexibility_policy::InstanceSelection::machine_types].
6566        ///
6567        /// # Example
6568        /// ```ignore,no_run
6569        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6570        /// let x = InstanceSelection::new().set_machine_types(["a", "b", "c"]);
6571        /// ```
6572        pub fn set_machine_types<T, V>(mut self, v: T) -> Self
6573        where
6574            T: std::iter::IntoIterator<Item = V>,
6575            V: std::convert::Into<std::string::String>,
6576        {
6577            use std::iter::Iterator;
6578            self.machine_types = v.into_iter().map(|i| i.into()).collect();
6579            self
6580        }
6581
6582        /// Sets the value of [rank][crate::model::instance_flexibility_policy::InstanceSelection::rank].
6583        ///
6584        /// # Example
6585        /// ```ignore,no_run
6586        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6587        /// let x = InstanceSelection::new().set_rank(42);
6588        /// ```
6589        pub fn set_rank<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6590            self.rank = v.into();
6591            self
6592        }
6593    }
6594
6595    impl wkt::message::Message for InstanceSelection {
6596        fn typename() -> &'static str {
6597            "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelection"
6598        }
6599    }
6600
6601    /// Defines a mapping from machine types to the number of VMs that are created
6602    /// with each machine type.
6603    #[derive(Clone, Default, PartialEq)]
6604    #[non_exhaustive]
6605    pub struct InstanceSelectionResult {
6606        /// Output only. Full machine-type names, e.g. "n1-standard-16".
6607        pub machine_type: std::option::Option<std::string::String>,
6608
6609        /// Output only. Number of VM provisioned with the machine_type.
6610        pub vm_count: std::option::Option<i32>,
6611
6612        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6613    }
6614
6615    impl InstanceSelectionResult {
6616        /// Creates a new default instance.
6617        pub fn new() -> Self {
6618            std::default::Default::default()
6619        }
6620
6621        /// Sets the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6622        ///
6623        /// # Example
6624        /// ```ignore,no_run
6625        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6626        /// let x = InstanceSelectionResult::new().set_machine_type("example");
6627        /// ```
6628        pub fn set_machine_type<T>(mut self, v: T) -> Self
6629        where
6630            T: std::convert::Into<std::string::String>,
6631        {
6632            self.machine_type = std::option::Option::Some(v.into());
6633            self
6634        }
6635
6636        /// Sets or clears the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6637        ///
6638        /// # Example
6639        /// ```ignore,no_run
6640        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6641        /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(Some("example"));
6642        /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(None::<String>);
6643        /// ```
6644        pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
6645        where
6646            T: std::convert::Into<std::string::String>,
6647        {
6648            self.machine_type = v.map(|x| x.into());
6649            self
6650        }
6651
6652        /// Sets the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6653        ///
6654        /// # Example
6655        /// ```ignore,no_run
6656        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6657        /// let x = InstanceSelectionResult::new().set_vm_count(42);
6658        /// ```
6659        pub fn set_vm_count<T>(mut self, v: T) -> Self
6660        where
6661            T: std::convert::Into<i32>,
6662        {
6663            self.vm_count = std::option::Option::Some(v.into());
6664            self
6665        }
6666
6667        /// Sets or clears the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6668        ///
6669        /// # Example
6670        /// ```ignore,no_run
6671        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6672        /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(Some(42));
6673        /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(None::<i32>);
6674        /// ```
6675        pub fn set_or_clear_vm_count<T>(mut self, v: std::option::Option<T>) -> Self
6676        where
6677            T: std::convert::Into<i32>,
6678        {
6679            self.vm_count = v.map(|x| x.into());
6680            self
6681        }
6682    }
6683
6684    impl wkt::message::Message for InstanceSelectionResult {
6685        fn typename() -> &'static str {
6686            "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelectionResult"
6687        }
6688    }
6689}
6690
6691/// Specifies the type and number of accelerator cards attached to the instances
6692/// of an instance. See [GPUs on Compute
6693/// Engine](https://cloud.google.com/compute/docs/gpus/).
6694#[derive(Clone, Default, PartialEq)]
6695#[non_exhaustive]
6696pub struct AcceleratorConfig {
6697    /// Full URL, partial URI, or short name of the accelerator type resource to
6698    /// expose to this instance. See
6699    /// [Compute Engine
6700    /// AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).
6701    ///
6702    /// Examples:
6703    ///
6704    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6705    /// * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6706    /// * `nvidia-tesla-t4`
6707    ///
6708    /// **Auto Zone Exception**: If you are using the Dataproc
6709    /// [Auto Zone
6710    /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
6711    /// feature, you must use the short name of the accelerator type
6712    /// resource, for example, `nvidia-tesla-t4`.
6713    pub accelerator_type_uri: std::string::String,
6714
6715    /// The number of the accelerator cards of this type exposed to this instance.
6716    pub accelerator_count: i32,
6717
6718    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6719}
6720
6721impl AcceleratorConfig {
6722    /// Creates a new default instance.
6723    pub fn new() -> Self {
6724        std::default::Default::default()
6725    }
6726
6727    /// Sets the value of [accelerator_type_uri][crate::model::AcceleratorConfig::accelerator_type_uri].
6728    ///
6729    /// # Example
6730    /// ```ignore,no_run
6731    /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6732    /// let x = AcceleratorConfig::new().set_accelerator_type_uri("example");
6733    /// ```
6734    pub fn set_accelerator_type_uri<T: std::convert::Into<std::string::String>>(
6735        mut self,
6736        v: T,
6737    ) -> Self {
6738        self.accelerator_type_uri = v.into();
6739        self
6740    }
6741
6742    /// Sets the value of [accelerator_count][crate::model::AcceleratorConfig::accelerator_count].
6743    ///
6744    /// # Example
6745    /// ```ignore,no_run
6746    /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6747    /// let x = AcceleratorConfig::new().set_accelerator_count(42);
6748    /// ```
6749    pub fn set_accelerator_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6750        self.accelerator_count = v.into();
6751        self
6752    }
6753}
6754
6755impl wkt::message::Message for AcceleratorConfig {
6756    fn typename() -> &'static str {
6757        "type.googleapis.com/google.cloud.dataproc.v1.AcceleratorConfig"
6758    }
6759}
6760
6761/// Specifies the config of disk options for a group of VM instances.
6762#[derive(Clone, Default, PartialEq)]
6763#[non_exhaustive]
6764pub struct DiskConfig {
6765    /// Optional. Type of the boot disk (default is "pd-standard").
6766    /// Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive),
6767    /// "pd-ssd" (Persistent Disk Solid State Drive),
6768    /// or "pd-standard" (Persistent Disk Hard Disk Drive).
6769    /// See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types).
6770    pub boot_disk_type: std::string::String,
6771
6772    /// Optional. Size in GB of the boot disk (default is 500GB).
6773    pub boot_disk_size_gb: i32,
6774
6775    /// Optional. Number of attached SSDs, from 0 to 8 (default is 0).
6776    /// If SSDs are not attached, the boot disk is used to store runtime logs and
6777    /// [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data.
6778    /// If one or more SSDs are attached, this runtime bulk
6779    /// data is spread across them, and the boot disk contains only basic
6780    /// config and installed binaries.
6781    ///
6782    /// Note: Local SSD options may vary by machine type and number of vCPUs
6783    /// selected.
6784    pub num_local_ssds: i32,
6785
6786    /// Optional. Interface type of local SSDs (default is "scsi").
6787    /// Valid values: "scsi" (Small Computer System Interface),
6788    /// "nvme" (Non-Volatile Memory Express).
6789    /// See [local SSD
6790    /// performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance).
6791    pub local_ssd_interface: std::string::String,
6792
6793    /// Optional. Indicates how many IOPS to provision for the disk. This sets the
6794    /// number of I/O operations per second that the disk can handle. Note: This
6795    /// field is only supported if boot_disk_type is hyperdisk-balanced.
6796    pub boot_disk_provisioned_iops: std::option::Option<i64>,
6797
6798    /// Optional. Indicates how much throughput to provision for the disk. This
6799    /// sets the number of throughput mb per second that the disk can handle.
6800    /// Values must be greater than or equal to 1. Note: This field is only
6801    /// supported if boot_disk_type is hyperdisk-balanced.
6802    pub boot_disk_provisioned_throughput: std::option::Option<i64>,
6803
6804    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6805}
6806
6807impl DiskConfig {
6808    /// Creates a new default instance.
6809    pub fn new() -> Self {
6810        std::default::Default::default()
6811    }
6812
6813    /// Sets the value of [boot_disk_type][crate::model::DiskConfig::boot_disk_type].
6814    ///
6815    /// # Example
6816    /// ```ignore,no_run
6817    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6818    /// let x = DiskConfig::new().set_boot_disk_type("example");
6819    /// ```
6820    pub fn set_boot_disk_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6821        self.boot_disk_type = v.into();
6822        self
6823    }
6824
6825    /// Sets the value of [boot_disk_size_gb][crate::model::DiskConfig::boot_disk_size_gb].
6826    ///
6827    /// # Example
6828    /// ```ignore,no_run
6829    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6830    /// let x = DiskConfig::new().set_boot_disk_size_gb(42);
6831    /// ```
6832    pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6833        self.boot_disk_size_gb = v.into();
6834        self
6835    }
6836
6837    /// Sets the value of [num_local_ssds][crate::model::DiskConfig::num_local_ssds].
6838    ///
6839    /// # Example
6840    /// ```ignore,no_run
6841    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6842    /// let x = DiskConfig::new().set_num_local_ssds(42);
6843    /// ```
6844    pub fn set_num_local_ssds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6845        self.num_local_ssds = v.into();
6846        self
6847    }
6848
6849    /// Sets the value of [local_ssd_interface][crate::model::DiskConfig::local_ssd_interface].
6850    ///
6851    /// # Example
6852    /// ```ignore,no_run
6853    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6854    /// let x = DiskConfig::new().set_local_ssd_interface("example");
6855    /// ```
6856    pub fn set_local_ssd_interface<T: std::convert::Into<std::string::String>>(
6857        mut self,
6858        v: T,
6859    ) -> Self {
6860        self.local_ssd_interface = v.into();
6861        self
6862    }
6863
6864    /// Sets the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6865    ///
6866    /// # Example
6867    /// ```ignore,no_run
6868    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6869    /// let x = DiskConfig::new().set_boot_disk_provisioned_iops(42);
6870    /// ```
6871    pub fn set_boot_disk_provisioned_iops<T>(mut self, v: T) -> Self
6872    where
6873        T: std::convert::Into<i64>,
6874    {
6875        self.boot_disk_provisioned_iops = std::option::Option::Some(v.into());
6876        self
6877    }
6878
6879    /// Sets or clears the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6880    ///
6881    /// # Example
6882    /// ```ignore,no_run
6883    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6884    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(Some(42));
6885    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(None::<i32>);
6886    /// ```
6887    pub fn set_or_clear_boot_disk_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
6888    where
6889        T: std::convert::Into<i64>,
6890    {
6891        self.boot_disk_provisioned_iops = v.map(|x| x.into());
6892        self
6893    }
6894
6895    /// Sets the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6896    ///
6897    /// # Example
6898    /// ```ignore,no_run
6899    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6900    /// let x = DiskConfig::new().set_boot_disk_provisioned_throughput(42);
6901    /// ```
6902    pub fn set_boot_disk_provisioned_throughput<T>(mut self, v: T) -> Self
6903    where
6904        T: std::convert::Into<i64>,
6905    {
6906        self.boot_disk_provisioned_throughput = std::option::Option::Some(v.into());
6907        self
6908    }
6909
6910    /// Sets or clears the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6911    ///
6912    /// # Example
6913    /// ```ignore,no_run
6914    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6915    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(Some(42));
6916    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(None::<i32>);
6917    /// ```
6918    pub fn set_or_clear_boot_disk_provisioned_throughput<T>(
6919        mut self,
6920        v: std::option::Option<T>,
6921    ) -> Self
6922    where
6923        T: std::convert::Into<i64>,
6924    {
6925        self.boot_disk_provisioned_throughput = v.map(|x| x.into());
6926        self
6927    }
6928}
6929
6930impl wkt::message::Message for DiskConfig {
6931    fn typename() -> &'static str {
6932        "type.googleapis.com/google.cloud.dataproc.v1.DiskConfig"
6933    }
6934}
6935
6936/// Node group identification and configuration information.
6937#[derive(Clone, Default, PartialEq)]
6938#[non_exhaustive]
6939pub struct AuxiliaryNodeGroup {
6940    /// Required. Node group configuration.
6941    pub node_group: std::option::Option<crate::model::NodeGroup>,
6942
6943    /// Optional. A node group ID. Generated if not specified.
6944    ///
6945    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
6946    /// underscores (_), and hyphens (-). Cannot begin or end with underscore
6947    /// or hyphen. Must consist of from 3 to 33 characters.
6948    pub node_group_id: std::string::String,
6949
6950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6951}
6952
6953impl AuxiliaryNodeGroup {
6954    /// Creates a new default instance.
6955    pub fn new() -> Self {
6956        std::default::Default::default()
6957    }
6958
6959    /// Sets the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6960    ///
6961    /// # Example
6962    /// ```ignore,no_run
6963    /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6964    /// use google_cloud_dataproc_v1::model::NodeGroup;
6965    /// let x = AuxiliaryNodeGroup::new().set_node_group(NodeGroup::default()/* use setters */);
6966    /// ```
6967    pub fn set_node_group<T>(mut self, v: T) -> Self
6968    where
6969        T: std::convert::Into<crate::model::NodeGroup>,
6970    {
6971        self.node_group = std::option::Option::Some(v.into());
6972        self
6973    }
6974
6975    /// Sets or clears the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6976    ///
6977    /// # Example
6978    /// ```ignore,no_run
6979    /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6980    /// use google_cloud_dataproc_v1::model::NodeGroup;
6981    /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
6982    /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(None::<NodeGroup>);
6983    /// ```
6984    pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
6985    where
6986        T: std::convert::Into<crate::model::NodeGroup>,
6987    {
6988        self.node_group = v.map(|x| x.into());
6989        self
6990    }
6991
6992    /// Sets the value of [node_group_id][crate::model::AuxiliaryNodeGroup::node_group_id].
6993    ///
6994    /// # Example
6995    /// ```ignore,no_run
6996    /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6997    /// let x = AuxiliaryNodeGroup::new().set_node_group_id("example");
6998    /// ```
6999    pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7000        self.node_group_id = v.into();
7001        self
7002    }
7003}
7004
7005impl wkt::message::Message for AuxiliaryNodeGroup {
7006    fn typename() -> &'static str {
7007        "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryNodeGroup"
7008    }
7009}
7010
7011/// Dataproc Node Group.
7012/// **The Dataproc `NodeGroup` resource is not related to the
7013/// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity]
7014/// resource.**
7015///
7016/// [google.cloud.dataproc.v1.NodeGroupAffinity]: crate::model::NodeGroupAffinity
7017#[derive(Clone, Default, PartialEq)]
7018#[non_exhaustive]
7019pub struct NodeGroup {
7020    /// The Node group [resource name](https://aip.dev/122).
7021    pub name: std::string::String,
7022
7023    /// Required. Node group roles.
7024    pub roles: std::vec::Vec<crate::model::node_group::Role>,
7025
7026    /// Optional. The node group instance group configuration.
7027    pub node_group_config: std::option::Option<crate::model::InstanceGroupConfig>,
7028
7029    /// Optional. Node group labels.
7030    ///
7031    /// * Label **keys** must consist of from 1 to 63 characters and conform to
7032    ///   [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
7033    /// * Label **values** can be empty. If specified, they must consist of from
7034    ///   1 to 63 characters and conform to [RFC 1035]
7035    ///   (<https://www.ietf.org/rfc/rfc1035.txt>).
7036    /// * The node group must have no more than 32 labels.
7037    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7038
7039    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7040}
7041
7042impl NodeGroup {
7043    /// Creates a new default instance.
7044    pub fn new() -> Self {
7045        std::default::Default::default()
7046    }
7047
7048    /// Sets the value of [name][crate::model::NodeGroup::name].
7049    ///
7050    /// # Example
7051    /// ```ignore,no_run
7052    /// # use google_cloud_dataproc_v1::model::NodeGroup;
7053    /// let x = NodeGroup::new().set_name("example");
7054    /// ```
7055    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7056        self.name = v.into();
7057        self
7058    }
7059
7060    /// Sets the value of [roles][crate::model::NodeGroup::roles].
7061    ///
7062    /// # Example
7063    /// ```ignore,no_run
7064    /// # use google_cloud_dataproc_v1::model::NodeGroup;
7065    /// use google_cloud_dataproc_v1::model::node_group::Role;
7066    /// let x = NodeGroup::new().set_roles([
7067    ///     Role::Driver,
7068    /// ]);
7069    /// ```
7070    pub fn set_roles<T, V>(mut self, v: T) -> Self
7071    where
7072        T: std::iter::IntoIterator<Item = V>,
7073        V: std::convert::Into<crate::model::node_group::Role>,
7074    {
7075        use std::iter::Iterator;
7076        self.roles = v.into_iter().map(|i| i.into()).collect();
7077        self
7078    }
7079
7080    /// Sets the value of [node_group_config][crate::model::NodeGroup::node_group_config].
7081    ///
7082    /// # Example
7083    /// ```ignore,no_run
7084    /// # use google_cloud_dataproc_v1::model::NodeGroup;
7085    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
7086    /// let x = NodeGroup::new().set_node_group_config(InstanceGroupConfig::default()/* use setters */);
7087    /// ```
7088    pub fn set_node_group_config<T>(mut self, v: T) -> Self
7089    where
7090        T: std::convert::Into<crate::model::InstanceGroupConfig>,
7091    {
7092        self.node_group_config = std::option::Option::Some(v.into());
7093        self
7094    }
7095
7096    /// Sets or clears the value of [node_group_config][crate::model::NodeGroup::node_group_config].
7097    ///
7098    /// # Example
7099    /// ```ignore,no_run
7100    /// # use google_cloud_dataproc_v1::model::NodeGroup;
7101    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
7102    /// let x = NodeGroup::new().set_or_clear_node_group_config(Some(InstanceGroupConfig::default()/* use setters */));
7103    /// let x = NodeGroup::new().set_or_clear_node_group_config(None::<InstanceGroupConfig>);
7104    /// ```
7105    pub fn set_or_clear_node_group_config<T>(mut self, v: std::option::Option<T>) -> Self
7106    where
7107        T: std::convert::Into<crate::model::InstanceGroupConfig>,
7108    {
7109        self.node_group_config = v.map(|x| x.into());
7110        self
7111    }
7112
7113    /// Sets the value of [labels][crate::model::NodeGroup::labels].
7114    ///
7115    /// # Example
7116    /// ```ignore,no_run
7117    /// # use google_cloud_dataproc_v1::model::NodeGroup;
7118    /// let x = NodeGroup::new().set_labels([
7119    ///     ("key0", "abc"),
7120    ///     ("key1", "xyz"),
7121    /// ]);
7122    /// ```
7123    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7124    where
7125        T: std::iter::IntoIterator<Item = (K, V)>,
7126        K: std::convert::Into<std::string::String>,
7127        V: std::convert::Into<std::string::String>,
7128    {
7129        use std::iter::Iterator;
7130        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7131        self
7132    }
7133}
7134
7135impl wkt::message::Message for NodeGroup {
7136    fn typename() -> &'static str {
7137        "type.googleapis.com/google.cloud.dataproc.v1.NodeGroup"
7138    }
7139}
7140
7141/// Defines additional types related to [NodeGroup].
7142pub mod node_group {
7143    #[allow(unused_imports)]
7144    use super::*;
7145
7146    /// Node pool roles.
7147    ///
7148    /// # Working with unknown values
7149    ///
7150    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7151    /// additional enum variants at any time. Adding new variants is not considered
7152    /// a breaking change. Applications should write their code in anticipation of:
7153    ///
7154    /// - New values appearing in future releases of the client library, **and**
7155    /// - New values received dynamically, without application changes.
7156    ///
7157    /// Please consult the [Working with enums] section in the user guide for some
7158    /// guidelines.
7159    ///
7160    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7161    #[derive(Clone, Debug, PartialEq)]
7162    #[non_exhaustive]
7163    pub enum Role {
7164        /// Required unspecified role.
7165        Unspecified,
7166        /// Job drivers run on the node pool.
7167        Driver,
7168        /// If set, the enum was initialized with an unknown value.
7169        ///
7170        /// Applications can examine the value using [Role::value] or
7171        /// [Role::name].
7172        UnknownValue(role::UnknownValue),
7173    }
7174
7175    #[doc(hidden)]
7176    pub mod role {
7177        #[allow(unused_imports)]
7178        use super::*;
7179        #[derive(Clone, Debug, PartialEq)]
7180        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7181    }
7182
7183    impl Role {
7184        /// Gets the enum value.
7185        ///
7186        /// Returns `None` if the enum contains an unknown value deserialized from
7187        /// the string representation of enums.
7188        pub fn value(&self) -> std::option::Option<i32> {
7189            match self {
7190                Self::Unspecified => std::option::Option::Some(0),
7191                Self::Driver => std::option::Option::Some(1),
7192                Self::UnknownValue(u) => u.0.value(),
7193            }
7194        }
7195
7196        /// Gets the enum value as a string.
7197        ///
7198        /// Returns `None` if the enum contains an unknown value deserialized from
7199        /// the integer representation of enums.
7200        pub fn name(&self) -> std::option::Option<&str> {
7201            match self {
7202                Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
7203                Self::Driver => std::option::Option::Some("DRIVER"),
7204                Self::UnknownValue(u) => u.0.name(),
7205            }
7206        }
7207    }
7208
7209    impl std::default::Default for Role {
7210        fn default() -> Self {
7211            use std::convert::From;
7212            Self::from(0)
7213        }
7214    }
7215
7216    impl std::fmt::Display for Role {
7217        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7218            wkt::internal::display_enum(f, self.name(), self.value())
7219        }
7220    }
7221
7222    impl std::convert::From<i32> for Role {
7223        fn from(value: i32) -> Self {
7224            match value {
7225                0 => Self::Unspecified,
7226                1 => Self::Driver,
7227                _ => Self::UnknownValue(role::UnknownValue(
7228                    wkt::internal::UnknownEnumValue::Integer(value),
7229                )),
7230            }
7231        }
7232    }
7233
7234    impl std::convert::From<&str> for Role {
7235        fn from(value: &str) -> Self {
7236            use std::string::ToString;
7237            match value {
7238                "ROLE_UNSPECIFIED" => Self::Unspecified,
7239                "DRIVER" => Self::Driver,
7240                _ => Self::UnknownValue(role::UnknownValue(
7241                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7242                )),
7243            }
7244        }
7245    }
7246
7247    impl serde::ser::Serialize for Role {
7248        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7249        where
7250            S: serde::Serializer,
7251        {
7252            match self {
7253                Self::Unspecified => serializer.serialize_i32(0),
7254                Self::Driver => serializer.serialize_i32(1),
7255                Self::UnknownValue(u) => u.0.serialize(serializer),
7256            }
7257        }
7258    }
7259
7260    impl<'de> serde::de::Deserialize<'de> for Role {
7261        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7262        where
7263            D: serde::Deserializer<'de>,
7264        {
7265            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
7266                ".google.cloud.dataproc.v1.NodeGroup.Role",
7267            ))
7268        }
7269    }
7270}
7271
7272/// Specifies an executable to run on a fully configured node and a
7273/// timeout period for executable completion.
7274#[derive(Clone, Default, PartialEq)]
7275#[non_exhaustive]
7276pub struct NodeInitializationAction {
7277    /// Required. Cloud Storage URI of executable file.
7278    pub executable_file: std::string::String,
7279
7280    /// Optional. Amount of time executable has to complete. Default is
7281    /// 10 minutes (see JSON representation of
7282    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7283    ///
7284    /// Cluster creation fails with an explanatory error message (the
7285    /// name of the executable that caused the error and the exceeded timeout
7286    /// period) if the executable is not completed at end of the timeout period.
7287    pub execution_timeout: std::option::Option<wkt::Duration>,
7288
7289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7290}
7291
7292impl NodeInitializationAction {
7293    /// Creates a new default instance.
7294    pub fn new() -> Self {
7295        std::default::Default::default()
7296    }
7297
7298    /// Sets the value of [executable_file][crate::model::NodeInitializationAction::executable_file].
7299    ///
7300    /// # Example
7301    /// ```ignore,no_run
7302    /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7303    /// let x = NodeInitializationAction::new().set_executable_file("example");
7304    /// ```
7305    pub fn set_executable_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7306        self.executable_file = v.into();
7307        self
7308    }
7309
7310    /// Sets the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7311    ///
7312    /// # Example
7313    /// ```ignore,no_run
7314    /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7315    /// use wkt::Duration;
7316    /// let x = NodeInitializationAction::new().set_execution_timeout(Duration::default()/* use setters */);
7317    /// ```
7318    pub fn set_execution_timeout<T>(mut self, v: T) -> Self
7319    where
7320        T: std::convert::Into<wkt::Duration>,
7321    {
7322        self.execution_timeout = std::option::Option::Some(v.into());
7323        self
7324    }
7325
7326    /// Sets or clears the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7327    ///
7328    /// # Example
7329    /// ```ignore,no_run
7330    /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7331    /// use wkt::Duration;
7332    /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
7333    /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(None::<Duration>);
7334    /// ```
7335    pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7336    where
7337        T: std::convert::Into<wkt::Duration>,
7338    {
7339        self.execution_timeout = v.map(|x| x.into());
7340        self
7341    }
7342}
7343
7344impl wkt::message::Message for NodeInitializationAction {
7345    fn typename() -> &'static str {
7346        "type.googleapis.com/google.cloud.dataproc.v1.NodeInitializationAction"
7347    }
7348}
7349
7350/// The status of a cluster and its instances.
7351#[derive(Clone, Default, PartialEq)]
7352#[non_exhaustive]
7353pub struct ClusterStatus {
7354    /// Output only. The cluster's state.
7355    pub state: crate::model::cluster_status::State,
7356
7357    /// Optional. Output only. Details of cluster's state.
7358    pub detail: std::string::String,
7359
7360    /// Output only. Time when this state was entered (see JSON representation of
7361    /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7362    pub state_start_time: std::option::Option<wkt::Timestamp>,
7363
7364    /// Output only. Additional state information that includes
7365    /// status reported by the agent.
7366    pub substate: crate::model::cluster_status::Substate,
7367
7368    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7369}
7370
7371impl ClusterStatus {
7372    /// Creates a new default instance.
7373    pub fn new() -> Self {
7374        std::default::Default::default()
7375    }
7376
7377    /// Sets the value of [state][crate::model::ClusterStatus::state].
7378    ///
7379    /// # Example
7380    /// ```ignore,no_run
7381    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7382    /// use google_cloud_dataproc_v1::model::cluster_status::State;
7383    /// let x0 = ClusterStatus::new().set_state(State::Creating);
7384    /// let x1 = ClusterStatus::new().set_state(State::Running);
7385    /// let x2 = ClusterStatus::new().set_state(State::Error);
7386    /// ```
7387    pub fn set_state<T: std::convert::Into<crate::model::cluster_status::State>>(
7388        mut self,
7389        v: T,
7390    ) -> Self {
7391        self.state = v.into();
7392        self
7393    }
7394
7395    /// Sets the value of [detail][crate::model::ClusterStatus::detail].
7396    ///
7397    /// # Example
7398    /// ```ignore,no_run
7399    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7400    /// let x = ClusterStatus::new().set_detail("example");
7401    /// ```
7402    pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7403        self.detail = v.into();
7404        self
7405    }
7406
7407    /// Sets the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7408    ///
7409    /// # Example
7410    /// ```ignore,no_run
7411    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7412    /// use wkt::Timestamp;
7413    /// let x = ClusterStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
7414    /// ```
7415    pub fn set_state_start_time<T>(mut self, v: T) -> Self
7416    where
7417        T: std::convert::Into<wkt::Timestamp>,
7418    {
7419        self.state_start_time = std::option::Option::Some(v.into());
7420        self
7421    }
7422
7423    /// Sets or clears the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7424    ///
7425    /// # Example
7426    /// ```ignore,no_run
7427    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7428    /// use wkt::Timestamp;
7429    /// let x = ClusterStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
7430    /// let x = ClusterStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
7431    /// ```
7432    pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7433    where
7434        T: std::convert::Into<wkt::Timestamp>,
7435    {
7436        self.state_start_time = v.map(|x| x.into());
7437        self
7438    }
7439
7440    /// Sets the value of [substate][crate::model::ClusterStatus::substate].
7441    ///
7442    /// # Example
7443    /// ```ignore,no_run
7444    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7445    /// use google_cloud_dataproc_v1::model::cluster_status::Substate;
7446    /// let x0 = ClusterStatus::new().set_substate(Substate::Unhealthy);
7447    /// let x1 = ClusterStatus::new().set_substate(Substate::StaleStatus);
7448    /// ```
7449    pub fn set_substate<T: std::convert::Into<crate::model::cluster_status::Substate>>(
7450        mut self,
7451        v: T,
7452    ) -> Self {
7453        self.substate = v.into();
7454        self
7455    }
7456}
7457
7458impl wkt::message::Message for ClusterStatus {
7459    fn typename() -> &'static str {
7460        "type.googleapis.com/google.cloud.dataproc.v1.ClusterStatus"
7461    }
7462}
7463
7464/// Defines additional types related to [ClusterStatus].
7465pub mod cluster_status {
7466    #[allow(unused_imports)]
7467    use super::*;
7468
7469    /// The cluster state.
7470    ///
7471    /// # Working with unknown values
7472    ///
7473    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7474    /// additional enum variants at any time. Adding new variants is not considered
7475    /// a breaking change. Applications should write their code in anticipation of:
7476    ///
7477    /// - New values appearing in future releases of the client library, **and**
7478    /// - New values received dynamically, without application changes.
7479    ///
7480    /// Please consult the [Working with enums] section in the user guide for some
7481    /// guidelines.
7482    ///
7483    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7484    #[derive(Clone, Debug, PartialEq)]
7485    #[non_exhaustive]
7486    pub enum State {
7487        /// The cluster state is unknown.
7488        Unknown,
7489        /// The cluster is being created and set up. It is not ready for use.
7490        Creating,
7491        /// The cluster is currently running and healthy. It is ready for use.
7492        ///
7493        /// **Note:** The cluster state changes from "creating" to "running" status
7494        /// after the master node(s), first two primary worker nodes (and the last
7495        /// primary worker node if primary workers > 2) are running.
7496        Running,
7497        /// The cluster encountered an error. It is not ready for use.
7498        Error,
7499        /// The cluster has encountered an error while being updated. Jobs can
7500        /// be submitted to the cluster, but the cluster cannot be updated.
7501        ErrorDueToUpdate,
7502        /// The cluster is being deleted. It cannot be used.
7503        Deleting,
7504        /// The cluster is being updated. It continues to accept and process jobs.
7505        Updating,
7506        /// The cluster is being stopped. It cannot be used.
7507        Stopping,
7508        /// The cluster is currently stopped. It is not ready for use.
7509        Stopped,
7510        /// The cluster is being started. It is not ready for use.
7511        Starting,
7512        /// The cluster is being repaired. It is not ready for use.
7513        Repairing,
7514        /// If set, the enum was initialized with an unknown value.
7515        ///
7516        /// Applications can examine the value using [State::value] or
7517        /// [State::name].
7518        UnknownValue(state::UnknownValue),
7519    }
7520
7521    #[doc(hidden)]
7522    pub mod state {
7523        #[allow(unused_imports)]
7524        use super::*;
7525        #[derive(Clone, Debug, PartialEq)]
7526        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7527    }
7528
7529    impl State {
7530        /// Gets the enum value.
7531        ///
7532        /// Returns `None` if the enum contains an unknown value deserialized from
7533        /// the string representation of enums.
7534        pub fn value(&self) -> std::option::Option<i32> {
7535            match self {
7536                Self::Unknown => std::option::Option::Some(0),
7537                Self::Creating => std::option::Option::Some(1),
7538                Self::Running => std::option::Option::Some(2),
7539                Self::Error => std::option::Option::Some(3),
7540                Self::ErrorDueToUpdate => std::option::Option::Some(9),
7541                Self::Deleting => std::option::Option::Some(4),
7542                Self::Updating => std::option::Option::Some(5),
7543                Self::Stopping => std::option::Option::Some(6),
7544                Self::Stopped => std::option::Option::Some(7),
7545                Self::Starting => std::option::Option::Some(8),
7546                Self::Repairing => std::option::Option::Some(10),
7547                Self::UnknownValue(u) => u.0.value(),
7548            }
7549        }
7550
7551        /// Gets the enum value as a string.
7552        ///
7553        /// Returns `None` if the enum contains an unknown value deserialized from
7554        /// the integer representation of enums.
7555        pub fn name(&self) -> std::option::Option<&str> {
7556            match self {
7557                Self::Unknown => std::option::Option::Some("UNKNOWN"),
7558                Self::Creating => std::option::Option::Some("CREATING"),
7559                Self::Running => std::option::Option::Some("RUNNING"),
7560                Self::Error => std::option::Option::Some("ERROR"),
7561                Self::ErrorDueToUpdate => std::option::Option::Some("ERROR_DUE_TO_UPDATE"),
7562                Self::Deleting => std::option::Option::Some("DELETING"),
7563                Self::Updating => std::option::Option::Some("UPDATING"),
7564                Self::Stopping => std::option::Option::Some("STOPPING"),
7565                Self::Stopped => std::option::Option::Some("STOPPED"),
7566                Self::Starting => std::option::Option::Some("STARTING"),
7567                Self::Repairing => std::option::Option::Some("REPAIRING"),
7568                Self::UnknownValue(u) => u.0.name(),
7569            }
7570        }
7571    }
7572
7573    impl std::default::Default for State {
7574        fn default() -> Self {
7575            use std::convert::From;
7576            Self::from(0)
7577        }
7578    }
7579
7580    impl std::fmt::Display for State {
7581        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7582            wkt::internal::display_enum(f, self.name(), self.value())
7583        }
7584    }
7585
7586    impl std::convert::From<i32> for State {
7587        fn from(value: i32) -> Self {
7588            match value {
7589                0 => Self::Unknown,
7590                1 => Self::Creating,
7591                2 => Self::Running,
7592                3 => Self::Error,
7593                4 => Self::Deleting,
7594                5 => Self::Updating,
7595                6 => Self::Stopping,
7596                7 => Self::Stopped,
7597                8 => Self::Starting,
7598                9 => Self::ErrorDueToUpdate,
7599                10 => Self::Repairing,
7600                _ => Self::UnknownValue(state::UnknownValue(
7601                    wkt::internal::UnknownEnumValue::Integer(value),
7602                )),
7603            }
7604        }
7605    }
7606
7607    impl std::convert::From<&str> for State {
7608        fn from(value: &str) -> Self {
7609            use std::string::ToString;
7610            match value {
7611                "UNKNOWN" => Self::Unknown,
7612                "CREATING" => Self::Creating,
7613                "RUNNING" => Self::Running,
7614                "ERROR" => Self::Error,
7615                "ERROR_DUE_TO_UPDATE" => Self::ErrorDueToUpdate,
7616                "DELETING" => Self::Deleting,
7617                "UPDATING" => Self::Updating,
7618                "STOPPING" => Self::Stopping,
7619                "STOPPED" => Self::Stopped,
7620                "STARTING" => Self::Starting,
7621                "REPAIRING" => Self::Repairing,
7622                _ => Self::UnknownValue(state::UnknownValue(
7623                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7624                )),
7625            }
7626        }
7627    }
7628
7629    impl serde::ser::Serialize for State {
7630        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7631        where
7632            S: serde::Serializer,
7633        {
7634            match self {
7635                Self::Unknown => serializer.serialize_i32(0),
7636                Self::Creating => serializer.serialize_i32(1),
7637                Self::Running => serializer.serialize_i32(2),
7638                Self::Error => serializer.serialize_i32(3),
7639                Self::ErrorDueToUpdate => serializer.serialize_i32(9),
7640                Self::Deleting => serializer.serialize_i32(4),
7641                Self::Updating => serializer.serialize_i32(5),
7642                Self::Stopping => serializer.serialize_i32(6),
7643                Self::Stopped => serializer.serialize_i32(7),
7644                Self::Starting => serializer.serialize_i32(8),
7645                Self::Repairing => serializer.serialize_i32(10),
7646                Self::UnknownValue(u) => u.0.serialize(serializer),
7647            }
7648        }
7649    }
7650
7651    impl<'de> serde::de::Deserialize<'de> for State {
7652        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7653        where
7654            D: serde::Deserializer<'de>,
7655        {
7656            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7657                ".google.cloud.dataproc.v1.ClusterStatus.State",
7658            ))
7659        }
7660    }
7661
7662    /// The cluster substate.
7663    ///
7664    /// # Working with unknown values
7665    ///
7666    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7667    /// additional enum variants at any time. Adding new variants is not considered
7668    /// a breaking change. Applications should write their code in anticipation of:
7669    ///
7670    /// - New values appearing in future releases of the client library, **and**
7671    /// - New values received dynamically, without application changes.
7672    ///
7673    /// Please consult the [Working with enums] section in the user guide for some
7674    /// guidelines.
7675    ///
7676    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7677    #[derive(Clone, Debug, PartialEq)]
7678    #[non_exhaustive]
7679    pub enum Substate {
7680        /// The cluster substate is unknown.
7681        Unspecified,
7682        /// The cluster is known to be in an unhealthy state
7683        /// (for example, critical daemons are not running or HDFS capacity is
7684        /// exhausted).
7685        ///
7686        /// Applies to RUNNING state.
7687        Unhealthy,
7688        /// The agent-reported status is out of date (may occur if
7689        /// Dataproc loses communication with Agent).
7690        ///
7691        /// Applies to RUNNING state.
7692        StaleStatus,
7693        /// If set, the enum was initialized with an unknown value.
7694        ///
7695        /// Applications can examine the value using [Substate::value] or
7696        /// [Substate::name].
7697        UnknownValue(substate::UnknownValue),
7698    }
7699
7700    #[doc(hidden)]
7701    pub mod substate {
7702        #[allow(unused_imports)]
7703        use super::*;
7704        #[derive(Clone, Debug, PartialEq)]
7705        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7706    }
7707
7708    impl Substate {
7709        /// Gets the enum value.
7710        ///
7711        /// Returns `None` if the enum contains an unknown value deserialized from
7712        /// the string representation of enums.
7713        pub fn value(&self) -> std::option::Option<i32> {
7714            match self {
7715                Self::Unspecified => std::option::Option::Some(0),
7716                Self::Unhealthy => std::option::Option::Some(1),
7717                Self::StaleStatus => std::option::Option::Some(2),
7718                Self::UnknownValue(u) => u.0.value(),
7719            }
7720        }
7721
7722        /// Gets the enum value as a string.
7723        ///
7724        /// Returns `None` if the enum contains an unknown value deserialized from
7725        /// the integer representation of enums.
7726        pub fn name(&self) -> std::option::Option<&str> {
7727            match self {
7728                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
7729                Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
7730                Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
7731                Self::UnknownValue(u) => u.0.name(),
7732            }
7733        }
7734    }
7735
7736    impl std::default::Default for Substate {
7737        fn default() -> Self {
7738            use std::convert::From;
7739            Self::from(0)
7740        }
7741    }
7742
7743    impl std::fmt::Display for Substate {
7744        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7745            wkt::internal::display_enum(f, self.name(), self.value())
7746        }
7747    }
7748
7749    impl std::convert::From<i32> for Substate {
7750        fn from(value: i32) -> Self {
7751            match value {
7752                0 => Self::Unspecified,
7753                1 => Self::Unhealthy,
7754                2 => Self::StaleStatus,
7755                _ => Self::UnknownValue(substate::UnknownValue(
7756                    wkt::internal::UnknownEnumValue::Integer(value),
7757                )),
7758            }
7759        }
7760    }
7761
7762    impl std::convert::From<&str> for Substate {
7763        fn from(value: &str) -> Self {
7764            use std::string::ToString;
7765            match value {
7766                "UNSPECIFIED" => Self::Unspecified,
7767                "UNHEALTHY" => Self::Unhealthy,
7768                "STALE_STATUS" => Self::StaleStatus,
7769                _ => Self::UnknownValue(substate::UnknownValue(
7770                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7771                )),
7772            }
7773        }
7774    }
7775
7776    impl serde::ser::Serialize for Substate {
7777        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7778        where
7779            S: serde::Serializer,
7780        {
7781            match self {
7782                Self::Unspecified => serializer.serialize_i32(0),
7783                Self::Unhealthy => serializer.serialize_i32(1),
7784                Self::StaleStatus => serializer.serialize_i32(2),
7785                Self::UnknownValue(u) => u.0.serialize(serializer),
7786            }
7787        }
7788    }
7789
7790    impl<'de> serde::de::Deserialize<'de> for Substate {
7791        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7792        where
7793            D: serde::Deserializer<'de>,
7794        {
7795            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
7796                ".google.cloud.dataproc.v1.ClusterStatus.Substate",
7797            ))
7798        }
7799    }
7800}
7801
7802/// Security related configuration, including encryption, Kerberos, etc.
7803#[derive(Clone, Default, PartialEq)]
7804#[non_exhaustive]
7805pub struct SecurityConfig {
7806    /// Optional. Kerberos related configuration.
7807    pub kerberos_config: std::option::Option<crate::model::KerberosConfig>,
7808
7809    /// Optional. Identity related configuration, including service account based
7810    /// secure multi-tenancy user mappings.
7811    pub identity_config: std::option::Option<crate::model::IdentityConfig>,
7812
7813    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7814}
7815
7816impl SecurityConfig {
7817    /// Creates a new default instance.
7818    pub fn new() -> Self {
7819        std::default::Default::default()
7820    }
7821
7822    /// Sets the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7823    ///
7824    /// # Example
7825    /// ```ignore,no_run
7826    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7827    /// use google_cloud_dataproc_v1::model::KerberosConfig;
7828    /// let x = SecurityConfig::new().set_kerberos_config(KerberosConfig::default()/* use setters */);
7829    /// ```
7830    pub fn set_kerberos_config<T>(mut self, v: T) -> Self
7831    where
7832        T: std::convert::Into<crate::model::KerberosConfig>,
7833    {
7834        self.kerberos_config = std::option::Option::Some(v.into());
7835        self
7836    }
7837
7838    /// Sets or clears the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7839    ///
7840    /// # Example
7841    /// ```ignore,no_run
7842    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7843    /// use google_cloud_dataproc_v1::model::KerberosConfig;
7844    /// let x = SecurityConfig::new().set_or_clear_kerberos_config(Some(KerberosConfig::default()/* use setters */));
7845    /// let x = SecurityConfig::new().set_or_clear_kerberos_config(None::<KerberosConfig>);
7846    /// ```
7847    pub fn set_or_clear_kerberos_config<T>(mut self, v: std::option::Option<T>) -> Self
7848    where
7849        T: std::convert::Into<crate::model::KerberosConfig>,
7850    {
7851        self.kerberos_config = v.map(|x| x.into());
7852        self
7853    }
7854
7855    /// Sets the value of [identity_config][crate::model::SecurityConfig::identity_config].
7856    ///
7857    /// # Example
7858    /// ```ignore,no_run
7859    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7860    /// use google_cloud_dataproc_v1::model::IdentityConfig;
7861    /// let x = SecurityConfig::new().set_identity_config(IdentityConfig::default()/* use setters */);
7862    /// ```
7863    pub fn set_identity_config<T>(mut self, v: T) -> Self
7864    where
7865        T: std::convert::Into<crate::model::IdentityConfig>,
7866    {
7867        self.identity_config = std::option::Option::Some(v.into());
7868        self
7869    }
7870
7871    /// Sets or clears the value of [identity_config][crate::model::SecurityConfig::identity_config].
7872    ///
7873    /// # Example
7874    /// ```ignore,no_run
7875    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7876    /// use google_cloud_dataproc_v1::model::IdentityConfig;
7877    /// let x = SecurityConfig::new().set_or_clear_identity_config(Some(IdentityConfig::default()/* use setters */));
7878    /// let x = SecurityConfig::new().set_or_clear_identity_config(None::<IdentityConfig>);
7879    /// ```
7880    pub fn set_or_clear_identity_config<T>(mut self, v: std::option::Option<T>) -> Self
7881    where
7882        T: std::convert::Into<crate::model::IdentityConfig>,
7883    {
7884        self.identity_config = v.map(|x| x.into());
7885        self
7886    }
7887}
7888
7889impl wkt::message::Message for SecurityConfig {
7890    fn typename() -> &'static str {
7891        "type.googleapis.com/google.cloud.dataproc.v1.SecurityConfig"
7892    }
7893}
7894
7895/// Specifies Kerberos related configuration.
7896#[derive(Clone, Default, PartialEq)]
7897#[non_exhaustive]
7898pub struct KerberosConfig {
7899    /// Optional. Flag to indicate whether to Kerberize the cluster (default:
7900    /// false). Set this field to true to enable Kerberos on a cluster.
7901    pub enable_kerberos: bool,
7902
7903    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root
7904    /// principal password.
7905    pub root_principal_password_uri: std::string::String,
7906
7907    /// Optional. The URI of the KMS key used to encrypt sensitive
7908    /// files.
7909    pub kms_key_uri: std::string::String,
7910
7911    /// Optional. The Cloud Storage URI of the keystore file used for SSL
7912    /// encryption. If not provided, Dataproc will provide a self-signed
7913    /// certificate.
7914    pub keystore_uri: std::string::String,
7915
7916    /// Optional. The Cloud Storage URI of the truststore file used for SSL
7917    /// encryption. If not provided, Dataproc will provide a self-signed
7918    /// certificate.
7919    pub truststore_uri: std::string::String,
7920
7921    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7922    /// password to the user provided keystore. For the self-signed certificate,
7923    /// this password is generated by Dataproc.
7924    pub keystore_password_uri: std::string::String,
7925
7926    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7927    /// password to the user provided key. For the self-signed certificate, this
7928    /// password is generated by Dataproc.
7929    pub key_password_uri: std::string::String,
7930
7931    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7932    /// password to the user provided truststore. For the self-signed certificate,
7933    /// this password is generated by Dataproc.
7934    pub truststore_password_uri: std::string::String,
7935
7936    /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should
7937    /// the user enable cross realm trust.
7938    pub cross_realm_trust_realm: std::string::String,
7939
7940    /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross
7941    /// realm trust relationship.
7942    pub cross_realm_trust_kdc: std::string::String,
7943
7944    /// Optional. The admin server (IP or hostname) for the remote trusted realm in
7945    /// a cross realm trust relationship.
7946    pub cross_realm_trust_admin_server: std::string::String,
7947
7948    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7949    /// shared password between the on-cluster Kerberos realm and the remote
7950    /// trusted realm, in a cross realm trust relationship.
7951    pub cross_realm_trust_shared_password_uri: std::string::String,
7952
7953    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7954    /// master key of the KDC database.
7955    pub kdc_db_key_uri: std::string::String,
7956
7957    /// Optional. The lifetime of the ticket granting ticket, in hours.
7958    /// If not specified, or user specifies 0, then default value 10
7959    /// will be used.
7960    pub tgt_lifetime_hours: i32,
7961
7962    /// Optional. The name of the on-cluster Kerberos realm.
7963    /// If not specified, the uppercased domain of hostnames will be the realm.
7964    pub realm: std::string::String,
7965
7966    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7967}
7968
7969impl KerberosConfig {
7970    /// Creates a new default instance.
7971    pub fn new() -> Self {
7972        std::default::Default::default()
7973    }
7974
7975    /// Sets the value of [enable_kerberos][crate::model::KerberosConfig::enable_kerberos].
7976    ///
7977    /// # Example
7978    /// ```ignore,no_run
7979    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7980    /// let x = KerberosConfig::new().set_enable_kerberos(true);
7981    /// ```
7982    pub fn set_enable_kerberos<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7983        self.enable_kerberos = v.into();
7984        self
7985    }
7986
7987    /// Sets the value of [root_principal_password_uri][crate::model::KerberosConfig::root_principal_password_uri].
7988    ///
7989    /// # Example
7990    /// ```ignore,no_run
7991    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7992    /// let x = KerberosConfig::new().set_root_principal_password_uri("example");
7993    /// ```
7994    pub fn set_root_principal_password_uri<T: std::convert::Into<std::string::String>>(
7995        mut self,
7996        v: T,
7997    ) -> Self {
7998        self.root_principal_password_uri = v.into();
7999        self
8000    }
8001
8002    /// Sets the value of [kms_key_uri][crate::model::KerberosConfig::kms_key_uri].
8003    ///
8004    /// # Example
8005    /// ```ignore,no_run
8006    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8007    /// let x = KerberosConfig::new().set_kms_key_uri("example");
8008    /// ```
8009    pub fn set_kms_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8010        self.kms_key_uri = v.into();
8011        self
8012    }
8013
8014    /// Sets the value of [keystore_uri][crate::model::KerberosConfig::keystore_uri].
8015    ///
8016    /// # Example
8017    /// ```ignore,no_run
8018    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8019    /// let x = KerberosConfig::new().set_keystore_uri("example");
8020    /// ```
8021    pub fn set_keystore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8022        self.keystore_uri = v.into();
8023        self
8024    }
8025
8026    /// Sets the value of [truststore_uri][crate::model::KerberosConfig::truststore_uri].
8027    ///
8028    /// # Example
8029    /// ```ignore,no_run
8030    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8031    /// let x = KerberosConfig::new().set_truststore_uri("example");
8032    /// ```
8033    pub fn set_truststore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8034        self.truststore_uri = v.into();
8035        self
8036    }
8037
8038    /// Sets the value of [keystore_password_uri][crate::model::KerberosConfig::keystore_password_uri].
8039    ///
8040    /// # Example
8041    /// ```ignore,no_run
8042    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8043    /// let x = KerberosConfig::new().set_keystore_password_uri("example");
8044    /// ```
8045    pub fn set_keystore_password_uri<T: std::convert::Into<std::string::String>>(
8046        mut self,
8047        v: T,
8048    ) -> Self {
8049        self.keystore_password_uri = v.into();
8050        self
8051    }
8052
8053    /// Sets the value of [key_password_uri][crate::model::KerberosConfig::key_password_uri].
8054    ///
8055    /// # Example
8056    /// ```ignore,no_run
8057    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8058    /// let x = KerberosConfig::new().set_key_password_uri("example");
8059    /// ```
8060    pub fn set_key_password_uri<T: std::convert::Into<std::string::String>>(
8061        mut self,
8062        v: T,
8063    ) -> Self {
8064        self.key_password_uri = v.into();
8065        self
8066    }
8067
8068    /// Sets the value of [truststore_password_uri][crate::model::KerberosConfig::truststore_password_uri].
8069    ///
8070    /// # Example
8071    /// ```ignore,no_run
8072    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8073    /// let x = KerberosConfig::new().set_truststore_password_uri("example");
8074    /// ```
8075    pub fn set_truststore_password_uri<T: std::convert::Into<std::string::String>>(
8076        mut self,
8077        v: T,
8078    ) -> Self {
8079        self.truststore_password_uri = v.into();
8080        self
8081    }
8082
8083    /// Sets the value of [cross_realm_trust_realm][crate::model::KerberosConfig::cross_realm_trust_realm].
8084    ///
8085    /// # Example
8086    /// ```ignore,no_run
8087    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8088    /// let x = KerberosConfig::new().set_cross_realm_trust_realm("example");
8089    /// ```
8090    pub fn set_cross_realm_trust_realm<T: std::convert::Into<std::string::String>>(
8091        mut self,
8092        v: T,
8093    ) -> Self {
8094        self.cross_realm_trust_realm = v.into();
8095        self
8096    }
8097
8098    /// Sets the value of [cross_realm_trust_kdc][crate::model::KerberosConfig::cross_realm_trust_kdc].
8099    ///
8100    /// # Example
8101    /// ```ignore,no_run
8102    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8103    /// let x = KerberosConfig::new().set_cross_realm_trust_kdc("example");
8104    /// ```
8105    pub fn set_cross_realm_trust_kdc<T: std::convert::Into<std::string::String>>(
8106        mut self,
8107        v: T,
8108    ) -> Self {
8109        self.cross_realm_trust_kdc = v.into();
8110        self
8111    }
8112
8113    /// Sets the value of [cross_realm_trust_admin_server][crate::model::KerberosConfig::cross_realm_trust_admin_server].
8114    ///
8115    /// # Example
8116    /// ```ignore,no_run
8117    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8118    /// let x = KerberosConfig::new().set_cross_realm_trust_admin_server("example");
8119    /// ```
8120    pub fn set_cross_realm_trust_admin_server<T: std::convert::Into<std::string::String>>(
8121        mut self,
8122        v: T,
8123    ) -> Self {
8124        self.cross_realm_trust_admin_server = v.into();
8125        self
8126    }
8127
8128    /// Sets the value of [cross_realm_trust_shared_password_uri][crate::model::KerberosConfig::cross_realm_trust_shared_password_uri].
8129    ///
8130    /// # Example
8131    /// ```ignore,no_run
8132    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8133    /// let x = KerberosConfig::new().set_cross_realm_trust_shared_password_uri("example");
8134    /// ```
8135    pub fn set_cross_realm_trust_shared_password_uri<T: std::convert::Into<std::string::String>>(
8136        mut self,
8137        v: T,
8138    ) -> Self {
8139        self.cross_realm_trust_shared_password_uri = v.into();
8140        self
8141    }
8142
8143    /// Sets the value of [kdc_db_key_uri][crate::model::KerberosConfig::kdc_db_key_uri].
8144    ///
8145    /// # Example
8146    /// ```ignore,no_run
8147    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8148    /// let x = KerberosConfig::new().set_kdc_db_key_uri("example");
8149    /// ```
8150    pub fn set_kdc_db_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8151        self.kdc_db_key_uri = v.into();
8152        self
8153    }
8154
8155    /// Sets the value of [tgt_lifetime_hours][crate::model::KerberosConfig::tgt_lifetime_hours].
8156    ///
8157    /// # Example
8158    /// ```ignore,no_run
8159    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8160    /// let x = KerberosConfig::new().set_tgt_lifetime_hours(42);
8161    /// ```
8162    pub fn set_tgt_lifetime_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8163        self.tgt_lifetime_hours = v.into();
8164        self
8165    }
8166
8167    /// Sets the value of [realm][crate::model::KerberosConfig::realm].
8168    ///
8169    /// # Example
8170    /// ```ignore,no_run
8171    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8172    /// let x = KerberosConfig::new().set_realm("example");
8173    /// ```
8174    pub fn set_realm<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8175        self.realm = v.into();
8176        self
8177    }
8178}
8179
8180impl wkt::message::Message for KerberosConfig {
8181    fn typename() -> &'static str {
8182        "type.googleapis.com/google.cloud.dataproc.v1.KerberosConfig"
8183    }
8184}
8185
8186/// Identity related configuration, including service account based
8187/// secure multi-tenancy user mappings.
8188#[derive(Clone, Default, PartialEq)]
8189#[non_exhaustive]
8190pub struct IdentityConfig {
8191    /// Required. Map of user to service account.
8192    pub user_service_account_mapping:
8193        std::collections::HashMap<std::string::String, std::string::String>,
8194
8195    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8196}
8197
8198impl IdentityConfig {
8199    /// Creates a new default instance.
8200    pub fn new() -> Self {
8201        std::default::Default::default()
8202    }
8203
8204    /// Sets the value of [user_service_account_mapping][crate::model::IdentityConfig::user_service_account_mapping].
8205    ///
8206    /// # Example
8207    /// ```ignore,no_run
8208    /// # use google_cloud_dataproc_v1::model::IdentityConfig;
8209    /// let x = IdentityConfig::new().set_user_service_account_mapping([
8210    ///     ("key0", "abc"),
8211    ///     ("key1", "xyz"),
8212    /// ]);
8213    /// ```
8214    pub fn set_user_service_account_mapping<T, K, V>(mut self, v: T) -> Self
8215    where
8216        T: std::iter::IntoIterator<Item = (K, V)>,
8217        K: std::convert::Into<std::string::String>,
8218        V: std::convert::Into<std::string::String>,
8219    {
8220        use std::iter::Iterator;
8221        self.user_service_account_mapping =
8222            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8223        self
8224    }
8225}
8226
8227impl wkt::message::Message for IdentityConfig {
8228    fn typename() -> &'static str {
8229        "type.googleapis.com/google.cloud.dataproc.v1.IdentityConfig"
8230    }
8231}
8232
8233/// Specifies the selection and config of software inside the cluster.
8234#[derive(Clone, Default, PartialEq)]
8235#[non_exhaustive]
8236pub struct SoftwareConfig {
8237    /// Optional. The version of software inside the cluster. It must be one of the
8238    /// supported [Dataproc
8239    /// Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported-dataproc-image-versions),
8240    /// such as "1.2" (including a subminor version, such as "1.2.29"), or the
8241    /// ["preview"
8242    /// version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
8243    /// If unspecified, it defaults to the latest Debian version.
8244    pub image_version: std::string::String,
8245
8246    /// Optional. The properties to set on daemon config files.
8247    ///
8248    /// Property keys are specified in `prefix:property` format, for example
8249    /// `core:hadoop.tmp.dir`. The following are supported prefixes
8250    /// and their mappings:
8251    ///
8252    /// * capacity-scheduler: `capacity-scheduler.xml`
8253    /// * core:   `core-site.xml`
8254    /// * distcp: `distcp-default.xml`
8255    /// * hdfs:   `hdfs-site.xml`
8256    /// * hive:   `hive-site.xml`
8257    /// * mapred: `mapred-site.xml`
8258    /// * pig:    `pig.properties`
8259    /// * spark:  `spark-defaults.conf`
8260    /// * yarn:   `yarn-site.xml`
8261    ///
8262    /// For more information, see [Cluster
8263    /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
8264    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
8265
8266    /// Optional. The set of components to activate on the cluster.
8267    pub optional_components: std::vec::Vec<crate::model::Component>,
8268
8269    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8270}
8271
8272impl SoftwareConfig {
8273    /// Creates a new default instance.
8274    pub fn new() -> Self {
8275        std::default::Default::default()
8276    }
8277
8278    /// Sets the value of [image_version][crate::model::SoftwareConfig::image_version].
8279    ///
8280    /// # Example
8281    /// ```ignore,no_run
8282    /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8283    /// let x = SoftwareConfig::new().set_image_version("example");
8284    /// ```
8285    pub fn set_image_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8286        self.image_version = v.into();
8287        self
8288    }
8289
8290    /// Sets the value of [properties][crate::model::SoftwareConfig::properties].
8291    ///
8292    /// # Example
8293    /// ```ignore,no_run
8294    /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8295    /// let x = SoftwareConfig::new().set_properties([
8296    ///     ("key0", "abc"),
8297    ///     ("key1", "xyz"),
8298    /// ]);
8299    /// ```
8300    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
8301    where
8302        T: std::iter::IntoIterator<Item = (K, V)>,
8303        K: std::convert::Into<std::string::String>,
8304        V: std::convert::Into<std::string::String>,
8305    {
8306        use std::iter::Iterator;
8307        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8308        self
8309    }
8310
8311    /// Sets the value of [optional_components][crate::model::SoftwareConfig::optional_components].
8312    ///
8313    /// # Example
8314    /// ```ignore,no_run
8315    /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8316    /// use google_cloud_dataproc_v1::model::Component;
8317    /// let x = SoftwareConfig::new().set_optional_components([
8318    ///     Component::Anaconda,
8319    ///     Component::Delta,
8320    ///     Component::Docker,
8321    /// ]);
8322    /// ```
8323    pub fn set_optional_components<T, V>(mut self, v: T) -> Self
8324    where
8325        T: std::iter::IntoIterator<Item = V>,
8326        V: std::convert::Into<crate::model::Component>,
8327    {
8328        use std::iter::Iterator;
8329        self.optional_components = v.into_iter().map(|i| i.into()).collect();
8330        self
8331    }
8332}
8333
8334impl wkt::message::Message for SoftwareConfig {
8335    fn typename() -> &'static str {
8336        "type.googleapis.com/google.cloud.dataproc.v1.SoftwareConfig"
8337    }
8338}
8339
8340/// Specifies the cluster auto-delete schedule configuration.
8341#[derive(Clone, Default, PartialEq)]
8342#[non_exhaustive]
8343pub struct LifecycleConfig {
8344    /// Optional. The duration to keep the cluster alive while idling (when no jobs
8345    /// are running). Passing this threshold will cause the cluster to be
8346    /// deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON
8347    /// representation of
8348    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8349    pub idle_delete_ttl: std::option::Option<wkt::Duration>,
8350
8351    /// Optional. The duration to keep the cluster started while idling (when no
8352    /// jobs are running). Passing this threshold will cause the cluster to be
8353    /// stopped. Minimum value is 5 minutes; maximum value is 14 days (see JSON
8354    /// representation of
8355    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8356    pub idle_stop_ttl: std::option::Option<wkt::Duration>,
8357
8358    /// Output only. The time when cluster became idle (most recent job finished)
8359    /// and became eligible for deletion due to idleness (see JSON representation
8360    /// of
8361    /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8362    pub idle_start_time: std::option::Option<wkt::Timestamp>,
8363
8364    /// Either the exact time the cluster should be deleted at or
8365    /// the cluster maximum age.
8366    pub ttl: std::option::Option<crate::model::lifecycle_config::Ttl>,
8367
8368    /// Either the exact time the cluster should be stopped at or
8369    /// the cluster maximum age.
8370    pub stop_ttl: std::option::Option<crate::model::lifecycle_config::StopTtl>,
8371
8372    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8373}
8374
8375impl LifecycleConfig {
8376    /// Creates a new default instance.
8377    pub fn new() -> Self {
8378        std::default::Default::default()
8379    }
8380
8381    /// Sets the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8382    ///
8383    /// # Example
8384    /// ```ignore,no_run
8385    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8386    /// use wkt::Duration;
8387    /// let x = LifecycleConfig::new().set_idle_delete_ttl(Duration::default()/* use setters */);
8388    /// ```
8389    pub fn set_idle_delete_ttl<T>(mut self, v: T) -> Self
8390    where
8391        T: std::convert::Into<wkt::Duration>,
8392    {
8393        self.idle_delete_ttl = std::option::Option::Some(v.into());
8394        self
8395    }
8396
8397    /// Sets or clears the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8398    ///
8399    /// # Example
8400    /// ```ignore,no_run
8401    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8402    /// use wkt::Duration;
8403    /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(Some(Duration::default()/* use setters */));
8404    /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(None::<Duration>);
8405    /// ```
8406    pub fn set_or_clear_idle_delete_ttl<T>(mut self, v: std::option::Option<T>) -> Self
8407    where
8408        T: std::convert::Into<wkt::Duration>,
8409    {
8410        self.idle_delete_ttl = v.map(|x| x.into());
8411        self
8412    }
8413
8414    /// Sets the value of [idle_stop_ttl][crate::model::LifecycleConfig::idle_stop_ttl].
8415    ///
8416    /// # Example
8417    /// ```ignore,no_run
8418    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8419    /// use wkt::Duration;
8420    /// let x = LifecycleConfig::new().set_idle_stop_ttl(Duration::default()/* use setters */);
8421    /// ```
8422    pub fn set_idle_stop_ttl<T>(mut self, v: T) -> Self
8423    where
8424        T: std::convert::Into<wkt::Duration>,
8425    {
8426        self.idle_stop_ttl = std::option::Option::Some(v.into());
8427        self
8428    }
8429
8430    /// Sets or clears the value of [idle_stop_ttl][crate::model::LifecycleConfig::idle_stop_ttl].
8431    ///
8432    /// # Example
8433    /// ```ignore,no_run
8434    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8435    /// use wkt::Duration;
8436    /// let x = LifecycleConfig::new().set_or_clear_idle_stop_ttl(Some(Duration::default()/* use setters */));
8437    /// let x = LifecycleConfig::new().set_or_clear_idle_stop_ttl(None::<Duration>);
8438    /// ```
8439    pub fn set_or_clear_idle_stop_ttl<T>(mut self, v: std::option::Option<T>) -> Self
8440    where
8441        T: std::convert::Into<wkt::Duration>,
8442    {
8443        self.idle_stop_ttl = v.map(|x| x.into());
8444        self
8445    }
8446
8447    /// Sets the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8448    ///
8449    /// # Example
8450    /// ```ignore,no_run
8451    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8452    /// use wkt::Timestamp;
8453    /// let x = LifecycleConfig::new().set_idle_start_time(Timestamp::default()/* use setters */);
8454    /// ```
8455    pub fn set_idle_start_time<T>(mut self, v: T) -> Self
8456    where
8457        T: std::convert::Into<wkt::Timestamp>,
8458    {
8459        self.idle_start_time = std::option::Option::Some(v.into());
8460        self
8461    }
8462
8463    /// Sets or clears the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8464    ///
8465    /// # Example
8466    /// ```ignore,no_run
8467    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8468    /// use wkt::Timestamp;
8469    /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(Some(Timestamp::default()/* use setters */));
8470    /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(None::<Timestamp>);
8471    /// ```
8472    pub fn set_or_clear_idle_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8473    where
8474        T: std::convert::Into<wkt::Timestamp>,
8475    {
8476        self.idle_start_time = v.map(|x| x.into());
8477        self
8478    }
8479
8480    /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl].
8481    ///
8482    /// Note that all the setters affecting `ttl` are mutually
8483    /// exclusive.
8484    ///
8485    /// # Example
8486    /// ```ignore,no_run
8487    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8488    /// use wkt::Timestamp;
8489    /// let x = LifecycleConfig::new().set_ttl(Some(
8490    ///     google_cloud_dataproc_v1::model::lifecycle_config::Ttl::AutoDeleteTime(Timestamp::default().into())));
8491    /// ```
8492    pub fn set_ttl<
8493        T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::Ttl>>,
8494    >(
8495        mut self,
8496        v: T,
8497    ) -> Self {
8498        self.ttl = v.into();
8499        self
8500    }
8501
8502    /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8503    /// if it holds a `AutoDeleteTime`, `None` if the field is not set or
8504    /// holds a different branch.
8505    pub fn auto_delete_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
8506        #[allow(unreachable_patterns)]
8507        self.ttl.as_ref().and_then(|v| match v {
8508            crate::model::lifecycle_config::Ttl::AutoDeleteTime(v) => std::option::Option::Some(v),
8509            _ => std::option::Option::None,
8510        })
8511    }
8512
8513    /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8514    /// to hold a `AutoDeleteTime`.
8515    ///
8516    /// Note that all the setters affecting `ttl` are
8517    /// mutually exclusive.
8518    ///
8519    /// # Example
8520    /// ```ignore,no_run
8521    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8522    /// use wkt::Timestamp;
8523    /// let x = LifecycleConfig::new().set_auto_delete_time(Timestamp::default()/* use setters */);
8524    /// assert!(x.auto_delete_time().is_some());
8525    /// assert!(x.auto_delete_ttl().is_none());
8526    /// ```
8527    pub fn set_auto_delete_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
8528        mut self,
8529        v: T,
8530    ) -> Self {
8531        self.ttl = std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTime(
8532            v.into(),
8533        ));
8534        self
8535    }
8536
8537    /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8538    /// if it holds a `AutoDeleteTtl`, `None` if the field is not set or
8539    /// holds a different branch.
8540    pub fn auto_delete_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
8541        #[allow(unreachable_patterns)]
8542        self.ttl.as_ref().and_then(|v| match v {
8543            crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v) => std::option::Option::Some(v),
8544            _ => std::option::Option::None,
8545        })
8546    }
8547
8548    /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8549    /// to hold a `AutoDeleteTtl`.
8550    ///
8551    /// Note that all the setters affecting `ttl` are
8552    /// mutually exclusive.
8553    ///
8554    /// # Example
8555    /// ```ignore,no_run
8556    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8557    /// use wkt::Duration;
8558    /// let x = LifecycleConfig::new().set_auto_delete_ttl(Duration::default()/* use setters */);
8559    /// assert!(x.auto_delete_ttl().is_some());
8560    /// assert!(x.auto_delete_time().is_none());
8561    /// ```
8562    pub fn set_auto_delete_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
8563        mut self,
8564        v: T,
8565    ) -> Self {
8566        self.ttl =
8567            std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v.into()));
8568        self
8569    }
8570
8571    /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl].
8572    ///
8573    /// Note that all the setters affecting `stop_ttl` are mutually
8574    /// exclusive.
8575    ///
8576    /// # Example
8577    /// ```ignore,no_run
8578    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8579    /// use wkt::Timestamp;
8580    /// let x = LifecycleConfig::new().set_stop_ttl(Some(
8581    ///     google_cloud_dataproc_v1::model::lifecycle_config::StopTtl::AutoStopTime(Timestamp::default().into())));
8582    /// ```
8583    pub fn set_stop_ttl<
8584        T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::StopTtl>>,
8585    >(
8586        mut self,
8587        v: T,
8588    ) -> Self {
8589        self.stop_ttl = v.into();
8590        self
8591    }
8592
8593    /// The value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8594    /// if it holds a `AutoStopTime`, `None` if the field is not set or
8595    /// holds a different branch.
8596    pub fn auto_stop_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
8597        #[allow(unreachable_patterns)]
8598        self.stop_ttl.as_ref().and_then(|v| match v {
8599            crate::model::lifecycle_config::StopTtl::AutoStopTime(v) => {
8600                std::option::Option::Some(v)
8601            }
8602            _ => std::option::Option::None,
8603        })
8604    }
8605
8606    /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8607    /// to hold a `AutoStopTime`.
8608    ///
8609    /// Note that all the setters affecting `stop_ttl` are
8610    /// mutually exclusive.
8611    ///
8612    /// # Example
8613    /// ```ignore,no_run
8614    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8615    /// use wkt::Timestamp;
8616    /// let x = LifecycleConfig::new().set_auto_stop_time(Timestamp::default()/* use setters */);
8617    /// assert!(x.auto_stop_time().is_some());
8618    /// assert!(x.auto_stop_ttl().is_none());
8619    /// ```
8620    pub fn set_auto_stop_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
8621        mut self,
8622        v: T,
8623    ) -> Self {
8624        self.stop_ttl = std::option::Option::Some(
8625            crate::model::lifecycle_config::StopTtl::AutoStopTime(v.into()),
8626        );
8627        self
8628    }
8629
8630    /// The value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8631    /// if it holds a `AutoStopTtl`, `None` if the field is not set or
8632    /// holds a different branch.
8633    pub fn auto_stop_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
8634        #[allow(unreachable_patterns)]
8635        self.stop_ttl.as_ref().and_then(|v| match v {
8636            crate::model::lifecycle_config::StopTtl::AutoStopTtl(v) => std::option::Option::Some(v),
8637            _ => std::option::Option::None,
8638        })
8639    }
8640
8641    /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8642    /// to hold a `AutoStopTtl`.
8643    ///
8644    /// Note that all the setters affecting `stop_ttl` are
8645    /// mutually exclusive.
8646    ///
8647    /// # Example
8648    /// ```ignore,no_run
8649    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8650    /// use wkt::Duration;
8651    /// let x = LifecycleConfig::new().set_auto_stop_ttl(Duration::default()/* use setters */);
8652    /// assert!(x.auto_stop_ttl().is_some());
8653    /// assert!(x.auto_stop_time().is_none());
8654    /// ```
8655    pub fn set_auto_stop_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
8656        mut self,
8657        v: T,
8658    ) -> Self {
8659        self.stop_ttl = std::option::Option::Some(
8660            crate::model::lifecycle_config::StopTtl::AutoStopTtl(v.into()),
8661        );
8662        self
8663    }
8664}
8665
8666impl wkt::message::Message for LifecycleConfig {
8667    fn typename() -> &'static str {
8668        "type.googleapis.com/google.cloud.dataproc.v1.LifecycleConfig"
8669    }
8670}
8671
8672/// Defines additional types related to [LifecycleConfig].
8673pub mod lifecycle_config {
8674    #[allow(unused_imports)]
8675    use super::*;
8676
8677    /// Either the exact time the cluster should be deleted at or
8678    /// the cluster maximum age.
8679    #[derive(Clone, Debug, PartialEq)]
8680    #[non_exhaustive]
8681    pub enum Ttl {
8682        /// Optional. The time when cluster will be auto-deleted (see JSON
8683        /// representation of
8684        /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8685        AutoDeleteTime(std::boxed::Box<wkt::Timestamp>),
8686        /// Optional. The lifetime duration of cluster. The cluster will be
8687        /// auto-deleted at the end of this period. Minimum value is 10 minutes;
8688        /// maximum value is 14 days (see JSON representation of
8689        /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8690        AutoDeleteTtl(std::boxed::Box<wkt::Duration>),
8691    }
8692
8693    /// Either the exact time the cluster should be stopped at or
8694    /// the cluster maximum age.
8695    #[derive(Clone, Debug, PartialEq)]
8696    #[non_exhaustive]
8697    pub enum StopTtl {
8698        /// Optional. The time when cluster will be auto-stopped (see JSON
8699        /// representation of
8700        /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8701        AutoStopTime(std::boxed::Box<wkt::Timestamp>),
8702        /// Optional. The lifetime duration of the cluster. The cluster will be
8703        /// auto-stopped at the end of this period, calculated from the time of
8704        /// submission of the create or update cluster request. Minimum value is 10
8705        /// minutes; maximum value is 14 days (see JSON representation of
8706        /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8707        AutoStopTtl(std::boxed::Box<wkt::Duration>),
8708    }
8709}
8710
8711/// Specifies a Metastore configuration.
8712#[derive(Clone, Default, PartialEq)]
8713#[non_exhaustive]
8714pub struct MetastoreConfig {
8715    /// Required. Resource name of an existing Dataproc Metastore service.
8716    ///
8717    /// Example:
8718    ///
8719    /// * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]`
8720    pub dataproc_metastore_service: std::string::String,
8721
8722    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8723}
8724
8725impl MetastoreConfig {
8726    /// Creates a new default instance.
8727    pub fn new() -> Self {
8728        std::default::Default::default()
8729    }
8730
8731    /// Sets the value of [dataproc_metastore_service][crate::model::MetastoreConfig::dataproc_metastore_service].
8732    ///
8733    /// # Example
8734    /// ```ignore,no_run
8735    /// # use google_cloud_dataproc_v1::model::MetastoreConfig;
8736    /// let x = MetastoreConfig::new().set_dataproc_metastore_service("example");
8737    /// ```
8738    pub fn set_dataproc_metastore_service<T: std::convert::Into<std::string::String>>(
8739        mut self,
8740        v: T,
8741    ) -> Self {
8742        self.dataproc_metastore_service = v.into();
8743        self
8744    }
8745}
8746
8747impl wkt::message::Message for MetastoreConfig {
8748    fn typename() -> &'static str {
8749        "type.googleapis.com/google.cloud.dataproc.v1.MetastoreConfig"
8750    }
8751}
8752
8753/// Contains cluster daemon metrics, such as HDFS and YARN stats.
8754///
8755/// **Beta Feature**: This report is available for testing purposes only. It may
8756/// be changed before final release.
8757#[derive(Clone, Default, PartialEq)]
8758#[non_exhaustive]
8759pub struct ClusterMetrics {
8760    /// The HDFS metrics.
8761    pub hdfs_metrics: std::collections::HashMap<std::string::String, i64>,
8762
8763    /// YARN metrics.
8764    pub yarn_metrics: std::collections::HashMap<std::string::String, i64>,
8765
8766    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8767}
8768
8769impl ClusterMetrics {
8770    /// Creates a new default instance.
8771    pub fn new() -> Self {
8772        std::default::Default::default()
8773    }
8774
8775    /// Sets the value of [hdfs_metrics][crate::model::ClusterMetrics::hdfs_metrics].
8776    ///
8777    /// # Example
8778    /// ```ignore,no_run
8779    /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8780    /// let x = ClusterMetrics::new().set_hdfs_metrics([
8781    ///     ("key0", 123),
8782    ///     ("key1", 456),
8783    /// ]);
8784    /// ```
8785    pub fn set_hdfs_metrics<T, K, V>(mut self, v: T) -> Self
8786    where
8787        T: std::iter::IntoIterator<Item = (K, V)>,
8788        K: std::convert::Into<std::string::String>,
8789        V: std::convert::Into<i64>,
8790    {
8791        use std::iter::Iterator;
8792        self.hdfs_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8793        self
8794    }
8795
8796    /// Sets the value of [yarn_metrics][crate::model::ClusterMetrics::yarn_metrics].
8797    ///
8798    /// # Example
8799    /// ```ignore,no_run
8800    /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8801    /// let x = ClusterMetrics::new().set_yarn_metrics([
8802    ///     ("key0", 123),
8803    ///     ("key1", 456),
8804    /// ]);
8805    /// ```
8806    pub fn set_yarn_metrics<T, K, V>(mut self, v: T) -> Self
8807    where
8808        T: std::iter::IntoIterator<Item = (K, V)>,
8809        K: std::convert::Into<std::string::String>,
8810        V: std::convert::Into<i64>,
8811    {
8812        use std::iter::Iterator;
8813        self.yarn_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8814        self
8815    }
8816}
8817
8818impl wkt::message::Message for ClusterMetrics {
8819    fn typename() -> &'static str {
8820        "type.googleapis.com/google.cloud.dataproc.v1.ClusterMetrics"
8821    }
8822}
8823
8824/// Dataproc metric config.
8825#[derive(Clone, Default, PartialEq)]
8826#[non_exhaustive]
8827pub struct DataprocMetricConfig {
8828    /// Required. Metrics sources to enable.
8829    pub metrics: std::vec::Vec<crate::model::dataproc_metric_config::Metric>,
8830
8831    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8832}
8833
8834impl DataprocMetricConfig {
8835    /// Creates a new default instance.
8836    pub fn new() -> Self {
8837        std::default::Default::default()
8838    }
8839
8840    /// Sets the value of [metrics][crate::model::DataprocMetricConfig::metrics].
8841    ///
8842    /// # Example
8843    /// ```ignore,no_run
8844    /// # use google_cloud_dataproc_v1::model::DataprocMetricConfig;
8845    /// use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8846    /// let x = DataprocMetricConfig::new()
8847    ///     .set_metrics([
8848    ///         Metric::default()/* use setters */,
8849    ///         Metric::default()/* use (different) setters */,
8850    ///     ]);
8851    /// ```
8852    pub fn set_metrics<T, V>(mut self, v: T) -> Self
8853    where
8854        T: std::iter::IntoIterator<Item = V>,
8855        V: std::convert::Into<crate::model::dataproc_metric_config::Metric>,
8856    {
8857        use std::iter::Iterator;
8858        self.metrics = v.into_iter().map(|i| i.into()).collect();
8859        self
8860    }
8861}
8862
8863impl wkt::message::Message for DataprocMetricConfig {
8864    fn typename() -> &'static str {
8865        "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig"
8866    }
8867}
8868
8869/// Defines additional types related to [DataprocMetricConfig].
8870pub mod dataproc_metric_config {
8871    #[allow(unused_imports)]
8872    use super::*;
8873
8874    /// A Dataproc custom metric.
8875    #[derive(Clone, Default, PartialEq)]
8876    #[non_exhaustive]
8877    pub struct Metric {
8878        /// Required. A standard set of metrics is collected unless `metricOverrides`
8879        /// are specified for the metric source (see [Custom metrics]
8880        /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8881        /// for more information).
8882        pub metric_source: crate::model::dataproc_metric_config::MetricSource,
8883
8884        /// Optional. Specify one or more [Custom metrics]
8885        /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8886        /// to collect for the metric course (for the `SPARK` metric source (any
8887        /// [Spark metric]
8888        /// (<https://spark.apache.org/docs/latest/monitoring.html#metrics>) can be
8889        /// specified).
8890        ///
8891        /// Provide metrics in the following format:
8892        /// \<code\>\<var\>METRIC_SOURCE\</var\>:\<var\>INSTANCE\</var\>:\<var\>GROUP\</var\>:\<var\>METRIC\</var\>\</code\>
8893        /// Use camelcase as appropriate.
8894        ///
8895        /// Examples:
8896        ///
8897        /// ```norust
8898        /// yarn:ResourceManager:QueueMetrics:AppsCompleted
8899        /// spark:driver:DAGScheduler:job.allJobs
8900        /// sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed
8901        /// hiveserver2:JVM:Memory:NonHeapMemoryUsage.used
8902        /// ```
8903        ///
8904        /// Notes:
8905        ///
8906        /// * Only the specified overridden metrics are collected for the
8907        ///   metric source. For example, if one or more `spark:executive` metrics
8908        ///   are listed as metric overrides, other `SPARK` metrics are not
8909        ///   collected. The collection of the metrics for other enabled custom
8910        ///   metric sources is unaffected. For example, if both `SPARK` andd `YARN`
8911        ///   metric sources are enabled, and overrides are provided for Spark
8912        ///   metrics only, all YARN metrics are collected.
8913        pub metric_overrides: std::vec::Vec<std::string::String>,
8914
8915        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8916    }
8917
8918    impl Metric {
8919        /// Creates a new default instance.
8920        pub fn new() -> Self {
8921            std::default::Default::default()
8922        }
8923
8924        /// Sets the value of [metric_source][crate::model::dataproc_metric_config::Metric::metric_source].
8925        ///
8926        /// # Example
8927        /// ```ignore,no_run
8928        /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8929        /// use google_cloud_dataproc_v1::model::dataproc_metric_config::MetricSource;
8930        /// let x0 = Metric::new().set_metric_source(MetricSource::MonitoringAgentDefaults);
8931        /// let x1 = Metric::new().set_metric_source(MetricSource::Hdfs);
8932        /// let x2 = Metric::new().set_metric_source(MetricSource::Spark);
8933        /// ```
8934        pub fn set_metric_source<
8935            T: std::convert::Into<crate::model::dataproc_metric_config::MetricSource>,
8936        >(
8937            mut self,
8938            v: T,
8939        ) -> Self {
8940            self.metric_source = v.into();
8941            self
8942        }
8943
8944        /// Sets the value of [metric_overrides][crate::model::dataproc_metric_config::Metric::metric_overrides].
8945        ///
8946        /// # Example
8947        /// ```ignore,no_run
8948        /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8949        /// let x = Metric::new().set_metric_overrides(["a", "b", "c"]);
8950        /// ```
8951        pub fn set_metric_overrides<T, V>(mut self, v: T) -> Self
8952        where
8953            T: std::iter::IntoIterator<Item = V>,
8954            V: std::convert::Into<std::string::String>,
8955        {
8956            use std::iter::Iterator;
8957            self.metric_overrides = v.into_iter().map(|i| i.into()).collect();
8958            self
8959        }
8960    }
8961
8962    impl wkt::message::Message for Metric {
8963        fn typename() -> &'static str {
8964            "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig.Metric"
8965        }
8966    }
8967
8968    /// A source for the collection of Dataproc custom metrics (see [Custom
8969    /// metrics]
8970    /// (<https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics>)).
8971    ///
8972    /// # Working with unknown values
8973    ///
8974    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8975    /// additional enum variants at any time. Adding new variants is not considered
8976    /// a breaking change. Applications should write their code in anticipation of:
8977    ///
8978    /// - New values appearing in future releases of the client library, **and**
8979    /// - New values received dynamically, without application changes.
8980    ///
8981    /// Please consult the [Working with enums] section in the user guide for some
8982    /// guidelines.
8983    ///
8984    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8985    #[derive(Clone, Debug, PartialEq)]
8986    #[non_exhaustive]
8987    pub enum MetricSource {
8988        /// Required unspecified metric source.
8989        Unspecified,
8990        /// Monitoring agent metrics. If this source is enabled,
8991        /// Dataproc enables the monitoring agent in Compute Engine,
8992        /// and collects monitoring agent metrics, which are published
8993        /// with an `agent.googleapis.com` prefix.
8994        MonitoringAgentDefaults,
8995        /// HDFS metric source.
8996        Hdfs,
8997        /// Spark metric source.
8998        Spark,
8999        /// YARN metric source.
9000        Yarn,
9001        /// Spark History Server metric source.
9002        SparkHistoryServer,
9003        /// Hiveserver2 metric source.
9004        Hiveserver2,
9005        /// hivemetastore metric source
9006        Hivemetastore,
9007        /// flink metric source
9008        Flink,
9009        /// If set, the enum was initialized with an unknown value.
9010        ///
9011        /// Applications can examine the value using [MetricSource::value] or
9012        /// [MetricSource::name].
9013        UnknownValue(metric_source::UnknownValue),
9014    }
9015
9016    #[doc(hidden)]
9017    pub mod metric_source {
9018        #[allow(unused_imports)]
9019        use super::*;
9020        #[derive(Clone, Debug, PartialEq)]
9021        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9022    }
9023
9024    impl MetricSource {
9025        /// Gets the enum value.
9026        ///
9027        /// Returns `None` if the enum contains an unknown value deserialized from
9028        /// the string representation of enums.
9029        pub fn value(&self) -> std::option::Option<i32> {
9030            match self {
9031                Self::Unspecified => std::option::Option::Some(0),
9032                Self::MonitoringAgentDefaults => std::option::Option::Some(1),
9033                Self::Hdfs => std::option::Option::Some(2),
9034                Self::Spark => std::option::Option::Some(3),
9035                Self::Yarn => std::option::Option::Some(4),
9036                Self::SparkHistoryServer => std::option::Option::Some(5),
9037                Self::Hiveserver2 => std::option::Option::Some(6),
9038                Self::Hivemetastore => std::option::Option::Some(7),
9039                Self::Flink => std::option::Option::Some(8),
9040                Self::UnknownValue(u) => u.0.value(),
9041            }
9042        }
9043
9044        /// Gets the enum value as a string.
9045        ///
9046        /// Returns `None` if the enum contains an unknown value deserialized from
9047        /// the integer representation of enums.
9048        pub fn name(&self) -> std::option::Option<&str> {
9049            match self {
9050                Self::Unspecified => std::option::Option::Some("METRIC_SOURCE_UNSPECIFIED"),
9051                Self::MonitoringAgentDefaults => {
9052                    std::option::Option::Some("MONITORING_AGENT_DEFAULTS")
9053                }
9054                Self::Hdfs => std::option::Option::Some("HDFS"),
9055                Self::Spark => std::option::Option::Some("SPARK"),
9056                Self::Yarn => std::option::Option::Some("YARN"),
9057                Self::SparkHistoryServer => std::option::Option::Some("SPARK_HISTORY_SERVER"),
9058                Self::Hiveserver2 => std::option::Option::Some("HIVESERVER2"),
9059                Self::Hivemetastore => std::option::Option::Some("HIVEMETASTORE"),
9060                Self::Flink => std::option::Option::Some("FLINK"),
9061                Self::UnknownValue(u) => u.0.name(),
9062            }
9063        }
9064    }
9065
9066    impl std::default::Default for MetricSource {
9067        fn default() -> Self {
9068            use std::convert::From;
9069            Self::from(0)
9070        }
9071    }
9072
9073    impl std::fmt::Display for MetricSource {
9074        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9075            wkt::internal::display_enum(f, self.name(), self.value())
9076        }
9077    }
9078
9079    impl std::convert::From<i32> for MetricSource {
9080        fn from(value: i32) -> Self {
9081            match value {
9082                0 => Self::Unspecified,
9083                1 => Self::MonitoringAgentDefaults,
9084                2 => Self::Hdfs,
9085                3 => Self::Spark,
9086                4 => Self::Yarn,
9087                5 => Self::SparkHistoryServer,
9088                6 => Self::Hiveserver2,
9089                7 => Self::Hivemetastore,
9090                8 => Self::Flink,
9091                _ => Self::UnknownValue(metric_source::UnknownValue(
9092                    wkt::internal::UnknownEnumValue::Integer(value),
9093                )),
9094            }
9095        }
9096    }
9097
9098    impl std::convert::From<&str> for MetricSource {
9099        fn from(value: &str) -> Self {
9100            use std::string::ToString;
9101            match value {
9102                "METRIC_SOURCE_UNSPECIFIED" => Self::Unspecified,
9103                "MONITORING_AGENT_DEFAULTS" => Self::MonitoringAgentDefaults,
9104                "HDFS" => Self::Hdfs,
9105                "SPARK" => Self::Spark,
9106                "YARN" => Self::Yarn,
9107                "SPARK_HISTORY_SERVER" => Self::SparkHistoryServer,
9108                "HIVESERVER2" => Self::Hiveserver2,
9109                "HIVEMETASTORE" => Self::Hivemetastore,
9110                "FLINK" => Self::Flink,
9111                _ => Self::UnknownValue(metric_source::UnknownValue(
9112                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9113                )),
9114            }
9115        }
9116    }
9117
9118    impl serde::ser::Serialize for MetricSource {
9119        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9120        where
9121            S: serde::Serializer,
9122        {
9123            match self {
9124                Self::Unspecified => serializer.serialize_i32(0),
9125                Self::MonitoringAgentDefaults => serializer.serialize_i32(1),
9126                Self::Hdfs => serializer.serialize_i32(2),
9127                Self::Spark => serializer.serialize_i32(3),
9128                Self::Yarn => serializer.serialize_i32(4),
9129                Self::SparkHistoryServer => serializer.serialize_i32(5),
9130                Self::Hiveserver2 => serializer.serialize_i32(6),
9131                Self::Hivemetastore => serializer.serialize_i32(7),
9132                Self::Flink => serializer.serialize_i32(8),
9133                Self::UnknownValue(u) => u.0.serialize(serializer),
9134            }
9135        }
9136    }
9137
9138    impl<'de> serde::de::Deserialize<'de> for MetricSource {
9139        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9140        where
9141            D: serde::Deserializer<'de>,
9142        {
9143            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricSource>::new(
9144                ".google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource",
9145            ))
9146        }
9147    }
9148}
9149
9150/// A request to create a cluster.
9151#[derive(Clone, Default, PartialEq)]
9152#[non_exhaustive]
9153pub struct CreateClusterRequest {
9154    /// Required. The ID of the Google Cloud Platform project that the cluster
9155    /// belongs to.
9156    pub project_id: std::string::String,
9157
9158    /// Required. The Dataproc region in which to handle the request.
9159    pub region: std::string::String,
9160
9161    /// Required. The cluster to create.
9162    pub cluster: std::option::Option<crate::model::Cluster>,
9163
9164    /// Optional. A unique ID used to identify the request. If the server receives
9165    /// two
9166    /// [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
9167    /// with the same id, then the second request will be ignored and the
9168    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9169    /// and stored in the backend is returned.
9170    ///
9171    /// It is recommended to always set this value to a
9172    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9173    ///
9174    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9175    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9176    ///
9177    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9178    pub request_id: std::string::String,
9179
9180    /// Optional. Failure action when primary worker creation fails.
9181    pub action_on_failed_primary_workers: crate::model::FailureAction,
9182
9183    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9184}
9185
9186impl CreateClusterRequest {
9187    /// Creates a new default instance.
9188    pub fn new() -> Self {
9189        std::default::Default::default()
9190    }
9191
9192    /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
9193    ///
9194    /// # Example
9195    /// ```ignore,no_run
9196    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9197    /// let x = CreateClusterRequest::new().set_project_id("example");
9198    /// ```
9199    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9200        self.project_id = v.into();
9201        self
9202    }
9203
9204    /// Sets the value of [region][crate::model::CreateClusterRequest::region].
9205    ///
9206    /// # Example
9207    /// ```ignore,no_run
9208    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9209    /// let x = CreateClusterRequest::new().set_region("example");
9210    /// ```
9211    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9212        self.region = v.into();
9213        self
9214    }
9215
9216    /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
9217    ///
9218    /// # Example
9219    /// ```ignore,no_run
9220    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9221    /// use google_cloud_dataproc_v1::model::Cluster;
9222    /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9223    /// ```
9224    pub fn set_cluster<T>(mut self, v: T) -> Self
9225    where
9226        T: std::convert::Into<crate::model::Cluster>,
9227    {
9228        self.cluster = std::option::Option::Some(v.into());
9229        self
9230    }
9231
9232    /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
9233    ///
9234    /// # Example
9235    /// ```ignore,no_run
9236    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9237    /// use google_cloud_dataproc_v1::model::Cluster;
9238    /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9239    /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9240    /// ```
9241    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9242    where
9243        T: std::convert::Into<crate::model::Cluster>,
9244    {
9245        self.cluster = v.map(|x| x.into());
9246        self
9247    }
9248
9249    /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
9250    ///
9251    /// # Example
9252    /// ```ignore,no_run
9253    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9254    /// let x = CreateClusterRequest::new().set_request_id("example");
9255    /// ```
9256    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9257        self.request_id = v.into();
9258        self
9259    }
9260
9261    /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
9262    ///
9263    /// # Example
9264    /// ```ignore,no_run
9265    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9266    /// use google_cloud_dataproc_v1::model::FailureAction;
9267    /// let x0 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::NoAction);
9268    /// let x1 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::Delete);
9269    /// ```
9270    pub fn set_action_on_failed_primary_workers<
9271        T: std::convert::Into<crate::model::FailureAction>,
9272    >(
9273        mut self,
9274        v: T,
9275    ) -> Self {
9276        self.action_on_failed_primary_workers = v.into();
9277        self
9278    }
9279}
9280
9281impl wkt::message::Message for CreateClusterRequest {
9282    fn typename() -> &'static str {
9283        "type.googleapis.com/google.cloud.dataproc.v1.CreateClusterRequest"
9284    }
9285}
9286
9287/// A request to update a cluster.
9288#[derive(Clone, Default, PartialEq)]
9289#[non_exhaustive]
9290pub struct UpdateClusterRequest {
9291    /// Required. The ID of the Google Cloud Platform project the
9292    /// cluster belongs to.
9293    pub project_id: std::string::String,
9294
9295    /// Required. The Dataproc region in which to handle the request.
9296    pub region: std::string::String,
9297
9298    /// Required. The cluster name.
9299    pub cluster_name: std::string::String,
9300
9301    /// Required. The changes to the cluster.
9302    pub cluster: std::option::Option<crate::model::Cluster>,
9303
9304    /// Optional. Timeout for graceful YARN decommissioning. Graceful
9305    /// decommissioning allows removing nodes from the cluster without
9306    /// interrupting jobs in progress. Timeout specifies how long to wait for jobs
9307    /// in progress to finish before forcefully removing nodes (and potentially
9308    /// interrupting jobs). Default timeout is 0 (for forceful decommission), and
9309    /// the maximum allowed timeout is 1 day. (see JSON representation of
9310    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9311    ///
9312    /// Only supported on Dataproc image versions 1.2 and higher.
9313    pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
9314
9315    /// Required. Specifies the path, relative to `Cluster`, of
9316    /// the field to update. For example, to change the number of workers
9317    /// in a cluster to 5, the `update_mask` parameter would be
9318    /// specified as `config.worker_config.num_instances`,
9319    /// and the `PATCH` request body would specify the new value, as follows:
9320    ///
9321    /// ```norust
9322    /// {
9323    ///   "config":{
9324    ///     "workerConfig":{
9325    ///       "numInstances":"5"
9326    ///     }
9327    ///   }
9328    /// }
9329    /// ```
9330    ///
9331    /// Similarly, to change the number of preemptible workers in a cluster to 5,
9332    /// the `update_mask` parameter would be
9333    /// `config.secondary_worker_config.num_instances`, and the `PATCH` request
9334    /// body would be set as follows:
9335    ///
9336    /// ```norust
9337    /// {
9338    ///   "config":{
9339    ///     "secondaryWorkerConfig":{
9340    ///       "numInstances":"5"
9341    ///     }
9342    ///   }
9343    /// }
9344    /// ```
9345    ///
9346    /// \<strong\>Note:\</strong\> Currently, only the following fields can be updated:
9347    pub update_mask: std::option::Option<wkt::FieldMask>,
9348
9349    /// Optional. A unique ID used to identify the request. If the server
9350    /// receives two
9351    /// [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
9352    /// with the same id, then the second request will be ignored and the
9353    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9354    /// and stored in the backend is returned.
9355    ///
9356    /// It is recommended to always set this value to a
9357    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9358    ///
9359    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9360    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9361    ///
9362    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9363    pub request_id: std::string::String,
9364
9365    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9366}
9367
9368impl UpdateClusterRequest {
9369    /// Creates a new default instance.
9370    pub fn new() -> Self {
9371        std::default::Default::default()
9372    }
9373
9374    /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
9375    ///
9376    /// # Example
9377    /// ```ignore,no_run
9378    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9379    /// let x = UpdateClusterRequest::new().set_project_id("example");
9380    /// ```
9381    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9382        self.project_id = v.into();
9383        self
9384    }
9385
9386    /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
9387    ///
9388    /// # Example
9389    /// ```ignore,no_run
9390    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9391    /// let x = UpdateClusterRequest::new().set_region("example");
9392    /// ```
9393    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9394        self.region = v.into();
9395        self
9396    }
9397
9398    /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
9399    ///
9400    /// # Example
9401    /// ```ignore,no_run
9402    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9403    /// let x = UpdateClusterRequest::new().set_cluster_name("example");
9404    /// ```
9405    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9406        self.cluster_name = v.into();
9407        self
9408    }
9409
9410    /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9411    ///
9412    /// # Example
9413    /// ```ignore,no_run
9414    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9415    /// use google_cloud_dataproc_v1::model::Cluster;
9416    /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9417    /// ```
9418    pub fn set_cluster<T>(mut self, v: T) -> Self
9419    where
9420        T: std::convert::Into<crate::model::Cluster>,
9421    {
9422        self.cluster = std::option::Option::Some(v.into());
9423        self
9424    }
9425
9426    /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9427    ///
9428    /// # Example
9429    /// ```ignore,no_run
9430    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9431    /// use google_cloud_dataproc_v1::model::Cluster;
9432    /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9433    /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9434    /// ```
9435    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9436    where
9437        T: std::convert::Into<crate::model::Cluster>,
9438    {
9439        self.cluster = v.map(|x| x.into());
9440        self
9441    }
9442
9443    /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9444    ///
9445    /// # Example
9446    /// ```ignore,no_run
9447    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9448    /// use wkt::Duration;
9449    /// let x = UpdateClusterRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
9450    /// ```
9451    pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
9452    where
9453        T: std::convert::Into<wkt::Duration>,
9454    {
9455        self.graceful_decommission_timeout = std::option::Option::Some(v.into());
9456        self
9457    }
9458
9459    /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9460    ///
9461    /// # Example
9462    /// ```ignore,no_run
9463    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9464    /// use wkt::Duration;
9465    /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
9466    /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
9467    /// ```
9468    pub fn set_or_clear_graceful_decommission_timeout<T>(
9469        mut self,
9470        v: std::option::Option<T>,
9471    ) -> Self
9472    where
9473        T: std::convert::Into<wkt::Duration>,
9474    {
9475        self.graceful_decommission_timeout = v.map(|x| x.into());
9476        self
9477    }
9478
9479    /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9480    ///
9481    /// # Example
9482    /// ```ignore,no_run
9483    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9484    /// use wkt::FieldMask;
9485    /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9486    /// ```
9487    pub fn set_update_mask<T>(mut self, v: T) -> Self
9488    where
9489        T: std::convert::Into<wkt::FieldMask>,
9490    {
9491        self.update_mask = std::option::Option::Some(v.into());
9492        self
9493    }
9494
9495    /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9496    ///
9497    /// # Example
9498    /// ```ignore,no_run
9499    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9500    /// use wkt::FieldMask;
9501    /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9502    /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9503    /// ```
9504    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9505    where
9506        T: std::convert::Into<wkt::FieldMask>,
9507    {
9508        self.update_mask = v.map(|x| x.into());
9509        self
9510    }
9511
9512    /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
9513    ///
9514    /// # Example
9515    /// ```ignore,no_run
9516    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9517    /// let x = UpdateClusterRequest::new().set_request_id("example");
9518    /// ```
9519    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9520        self.request_id = v.into();
9521        self
9522    }
9523}
9524
9525impl wkt::message::Message for UpdateClusterRequest {
9526    fn typename() -> &'static str {
9527        "type.googleapis.com/google.cloud.dataproc.v1.UpdateClusterRequest"
9528    }
9529}
9530
9531/// A request to stop a cluster.
9532#[derive(Clone, Default, PartialEq)]
9533#[non_exhaustive]
9534pub struct StopClusterRequest {
9535    /// Required. The ID of the Google Cloud Platform project the
9536    /// cluster belongs to.
9537    pub project_id: std::string::String,
9538
9539    /// Required. The Dataproc region in which to handle the request.
9540    pub region: std::string::String,
9541
9542    /// Required. The cluster name.
9543    pub cluster_name: std::string::String,
9544
9545    /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9546    /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9547    pub cluster_uuid: std::string::String,
9548
9549    /// Optional. A unique ID used to identify the request. If the server
9550    /// receives two
9551    /// [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
9552    /// with the same id, then the second request will be ignored and the
9553    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9554    /// and stored in the backend is returned.
9555    ///
9556    /// Recommendation: Set this value to a
9557    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9558    ///
9559    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9560    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9561    ///
9562    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9563    pub request_id: std::string::String,
9564
9565    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9566}
9567
9568impl StopClusterRequest {
9569    /// Creates a new default instance.
9570    pub fn new() -> Self {
9571        std::default::Default::default()
9572    }
9573
9574    /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
9575    ///
9576    /// # Example
9577    /// ```ignore,no_run
9578    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9579    /// let x = StopClusterRequest::new().set_project_id("example");
9580    /// ```
9581    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9582        self.project_id = v.into();
9583        self
9584    }
9585
9586    /// Sets the value of [region][crate::model::StopClusterRequest::region].
9587    ///
9588    /// # Example
9589    /// ```ignore,no_run
9590    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9591    /// let x = StopClusterRequest::new().set_region("example");
9592    /// ```
9593    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9594        self.region = v.into();
9595        self
9596    }
9597
9598    /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
9599    ///
9600    /// # Example
9601    /// ```ignore,no_run
9602    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9603    /// let x = StopClusterRequest::new().set_cluster_name("example");
9604    /// ```
9605    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9606        self.cluster_name = v.into();
9607        self
9608    }
9609
9610    /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
9611    ///
9612    /// # Example
9613    /// ```ignore,no_run
9614    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9615    /// let x = StopClusterRequest::new().set_cluster_uuid("example");
9616    /// ```
9617    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9618        self.cluster_uuid = v.into();
9619        self
9620    }
9621
9622    /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
9623    ///
9624    /// # Example
9625    /// ```ignore,no_run
9626    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9627    /// let x = StopClusterRequest::new().set_request_id("example");
9628    /// ```
9629    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9630        self.request_id = v.into();
9631        self
9632    }
9633}
9634
9635impl wkt::message::Message for StopClusterRequest {
9636    fn typename() -> &'static str {
9637        "type.googleapis.com/google.cloud.dataproc.v1.StopClusterRequest"
9638    }
9639}
9640
9641/// A request to start a cluster.
9642#[derive(Clone, Default, PartialEq)]
9643#[non_exhaustive]
9644pub struct StartClusterRequest {
9645    /// Required. The ID of the Google Cloud Platform project the
9646    /// cluster belongs to.
9647    pub project_id: std::string::String,
9648
9649    /// Required. The Dataproc region in which to handle the request.
9650    pub region: std::string::String,
9651
9652    /// Required. The cluster name.
9653    pub cluster_name: std::string::String,
9654
9655    /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9656    /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9657    pub cluster_uuid: std::string::String,
9658
9659    /// Optional. A unique ID used to identify the request. If the server
9660    /// receives two
9661    /// [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
9662    /// with the same id, then the second request will be ignored and the
9663    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9664    /// and stored in the backend is returned.
9665    ///
9666    /// Recommendation: Set this value to a
9667    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9668    ///
9669    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9670    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9671    ///
9672    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9673    pub request_id: std::string::String,
9674
9675    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9676}
9677
9678impl StartClusterRequest {
9679    /// Creates a new default instance.
9680    pub fn new() -> Self {
9681        std::default::Default::default()
9682    }
9683
9684    /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
9685    ///
9686    /// # Example
9687    /// ```ignore,no_run
9688    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9689    /// let x = StartClusterRequest::new().set_project_id("example");
9690    /// ```
9691    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9692        self.project_id = v.into();
9693        self
9694    }
9695
9696    /// Sets the value of [region][crate::model::StartClusterRequest::region].
9697    ///
9698    /// # Example
9699    /// ```ignore,no_run
9700    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9701    /// let x = StartClusterRequest::new().set_region("example");
9702    /// ```
9703    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9704        self.region = v.into();
9705        self
9706    }
9707
9708    /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
9709    ///
9710    /// # Example
9711    /// ```ignore,no_run
9712    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9713    /// let x = StartClusterRequest::new().set_cluster_name("example");
9714    /// ```
9715    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9716        self.cluster_name = v.into();
9717        self
9718    }
9719
9720    /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
9721    ///
9722    /// # Example
9723    /// ```ignore,no_run
9724    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9725    /// let x = StartClusterRequest::new().set_cluster_uuid("example");
9726    /// ```
9727    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9728        self.cluster_uuid = v.into();
9729        self
9730    }
9731
9732    /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
9733    ///
9734    /// # Example
9735    /// ```ignore,no_run
9736    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9737    /// let x = StartClusterRequest::new().set_request_id("example");
9738    /// ```
9739    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9740        self.request_id = v.into();
9741        self
9742    }
9743}
9744
9745impl wkt::message::Message for StartClusterRequest {
9746    fn typename() -> &'static str {
9747        "type.googleapis.com/google.cloud.dataproc.v1.StartClusterRequest"
9748    }
9749}
9750
9751/// A request to delete a cluster.
9752#[derive(Clone, Default, PartialEq)]
9753#[non_exhaustive]
9754pub struct DeleteClusterRequest {
9755    /// Required. The ID of the Google Cloud Platform project that the cluster
9756    /// belongs to.
9757    pub project_id: std::string::String,
9758
9759    /// Required. The Dataproc region in which to handle the request.
9760    pub region: std::string::String,
9761
9762    /// Required. The cluster name.
9763    pub cluster_name: std::string::String,
9764
9765    /// Optional. Specifying the `cluster_uuid` means the RPC should fail
9766    /// (with error NOT_FOUND) if cluster with specified UUID does not exist.
9767    pub cluster_uuid: std::string::String,
9768
9769    /// Optional. A unique ID used to identify the request. If the server
9770    /// receives two
9771    /// [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
9772    /// with the same id, then the second request will be ignored and the
9773    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9774    /// and stored in the backend is returned.
9775    ///
9776    /// It is recommended to always set this value to a
9777    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9778    ///
9779    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9780    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9781    ///
9782    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9783    pub request_id: std::string::String,
9784
9785    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9786}
9787
9788impl DeleteClusterRequest {
9789    /// Creates a new default instance.
9790    pub fn new() -> Self {
9791        std::default::Default::default()
9792    }
9793
9794    /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
9795    ///
9796    /// # Example
9797    /// ```ignore,no_run
9798    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9799    /// let x = DeleteClusterRequest::new().set_project_id("example");
9800    /// ```
9801    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9802        self.project_id = v.into();
9803        self
9804    }
9805
9806    /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
9807    ///
9808    /// # Example
9809    /// ```ignore,no_run
9810    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9811    /// let x = DeleteClusterRequest::new().set_region("example");
9812    /// ```
9813    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9814        self.region = v.into();
9815        self
9816    }
9817
9818    /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
9819    ///
9820    /// # Example
9821    /// ```ignore,no_run
9822    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9823    /// let x = DeleteClusterRequest::new().set_cluster_name("example");
9824    /// ```
9825    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9826        self.cluster_name = v.into();
9827        self
9828    }
9829
9830    /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
9831    ///
9832    /// # Example
9833    /// ```ignore,no_run
9834    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9835    /// let x = DeleteClusterRequest::new().set_cluster_uuid("example");
9836    /// ```
9837    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9838        self.cluster_uuid = v.into();
9839        self
9840    }
9841
9842    /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
9843    ///
9844    /// # Example
9845    /// ```ignore,no_run
9846    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9847    /// let x = DeleteClusterRequest::new().set_request_id("example");
9848    /// ```
9849    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9850        self.request_id = v.into();
9851        self
9852    }
9853}
9854
9855impl wkt::message::Message for DeleteClusterRequest {
9856    fn typename() -> &'static str {
9857        "type.googleapis.com/google.cloud.dataproc.v1.DeleteClusterRequest"
9858    }
9859}
9860
9861/// Request to get the resource representation for a cluster in a project.
9862#[derive(Clone, Default, PartialEq)]
9863#[non_exhaustive]
9864pub struct GetClusterRequest {
9865    /// Required. The ID of the Google Cloud Platform project that the cluster
9866    /// belongs to.
9867    pub project_id: std::string::String,
9868
9869    /// Required. The Dataproc region in which to handle the request.
9870    pub region: std::string::String,
9871
9872    /// Required. The cluster name.
9873    pub cluster_name: std::string::String,
9874
9875    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9876}
9877
9878impl GetClusterRequest {
9879    /// Creates a new default instance.
9880    pub fn new() -> Self {
9881        std::default::Default::default()
9882    }
9883
9884    /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
9885    ///
9886    /// # Example
9887    /// ```ignore,no_run
9888    /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9889    /// let x = GetClusterRequest::new().set_project_id("example");
9890    /// ```
9891    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9892        self.project_id = v.into();
9893        self
9894    }
9895
9896    /// Sets the value of [region][crate::model::GetClusterRequest::region].
9897    ///
9898    /// # Example
9899    /// ```ignore,no_run
9900    /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9901    /// let x = GetClusterRequest::new().set_region("example");
9902    /// ```
9903    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9904        self.region = v.into();
9905        self
9906    }
9907
9908    /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
9909    ///
9910    /// # Example
9911    /// ```ignore,no_run
9912    /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9913    /// let x = GetClusterRequest::new().set_cluster_name("example");
9914    /// ```
9915    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9916        self.cluster_name = v.into();
9917        self
9918    }
9919}
9920
9921impl wkt::message::Message for GetClusterRequest {
9922    fn typename() -> &'static str {
9923        "type.googleapis.com/google.cloud.dataproc.v1.GetClusterRequest"
9924    }
9925}
9926
9927/// A request to list the clusters in a project.
9928#[derive(Clone, Default, PartialEq)]
9929#[non_exhaustive]
9930pub struct ListClustersRequest {
9931    /// Required. The ID of the Google Cloud Platform project that the cluster
9932    /// belongs to.
9933    pub project_id: std::string::String,
9934
9935    /// Required. The Dataproc region in which to handle the request.
9936    pub region: std::string::String,
9937
9938    /// Optional. A filter constraining the clusters to list. Filters are
9939    /// case-sensitive and have the following syntax:
9940    ///
9941    /// field = value [AND [field = value]] ...
9942    ///
9943    /// where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
9944    /// and `[KEY]` is a label key. **value** can be `*` to match all values.
9945    /// `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
9946    /// `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
9947    /// `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
9948    /// states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
9949    /// `STOPPED` states. `clusterName` is the name of the cluster provided at
9950    /// creation time. Only the logical `AND` operator is supported;
9951    /// space-separated items are treated as having an implicit `AND` operator.
9952    ///
9953    /// Example filter:
9954    ///
9955    /// status.state = ACTIVE AND clusterName = mycluster
9956    /// AND labels.env = staging AND labels.starred = *
9957    pub filter: std::string::String,
9958
9959    /// Optional. The standard List page size.
9960    pub page_size: i32,
9961
9962    /// Optional. The standard List page token.
9963    pub page_token: std::string::String,
9964
9965    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9966}
9967
9968impl ListClustersRequest {
9969    /// Creates a new default instance.
9970    pub fn new() -> Self {
9971        std::default::Default::default()
9972    }
9973
9974    /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
9975    ///
9976    /// # Example
9977    /// ```ignore,no_run
9978    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9979    /// let x = ListClustersRequest::new().set_project_id("example");
9980    /// ```
9981    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9982        self.project_id = v.into();
9983        self
9984    }
9985
9986    /// Sets the value of [region][crate::model::ListClustersRequest::region].
9987    ///
9988    /// # Example
9989    /// ```ignore,no_run
9990    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9991    /// let x = ListClustersRequest::new().set_region("example");
9992    /// ```
9993    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9994        self.region = v.into();
9995        self
9996    }
9997
9998    /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
9999    ///
10000    /// # Example
10001    /// ```ignore,no_run
10002    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10003    /// let x = ListClustersRequest::new().set_filter("example");
10004    /// ```
10005    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10006        self.filter = v.into();
10007        self
10008    }
10009
10010    /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
10011    ///
10012    /// # Example
10013    /// ```ignore,no_run
10014    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10015    /// let x = ListClustersRequest::new().set_page_size(42);
10016    /// ```
10017    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10018        self.page_size = v.into();
10019        self
10020    }
10021
10022    /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
10023    ///
10024    /// # Example
10025    /// ```ignore,no_run
10026    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10027    /// let x = ListClustersRequest::new().set_page_token("example");
10028    /// ```
10029    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10030        self.page_token = v.into();
10031        self
10032    }
10033}
10034
10035impl wkt::message::Message for ListClustersRequest {
10036    fn typename() -> &'static str {
10037        "type.googleapis.com/google.cloud.dataproc.v1.ListClustersRequest"
10038    }
10039}
10040
10041/// The list of all clusters in a project.
10042#[derive(Clone, Default, PartialEq)]
10043#[non_exhaustive]
10044pub struct ListClustersResponse {
10045    /// Output only. The clusters in the project.
10046    pub clusters: std::vec::Vec<crate::model::Cluster>,
10047
10048    /// Output only. This token is included in the response if there are more
10049    /// results to fetch. To fetch additional results, provide this value as the
10050    /// `page_token` in a subsequent `ListClustersRequest`.
10051    pub next_page_token: std::string::String,
10052
10053    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10054}
10055
10056impl ListClustersResponse {
10057    /// Creates a new default instance.
10058    pub fn new() -> Self {
10059        std::default::Default::default()
10060    }
10061
10062    /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
10063    ///
10064    /// # Example
10065    /// ```ignore,no_run
10066    /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
10067    /// use google_cloud_dataproc_v1::model::Cluster;
10068    /// let x = ListClustersResponse::new()
10069    ///     .set_clusters([
10070    ///         Cluster::default()/* use setters */,
10071    ///         Cluster::default()/* use (different) setters */,
10072    ///     ]);
10073    /// ```
10074    pub fn set_clusters<T, V>(mut self, v: T) -> Self
10075    where
10076        T: std::iter::IntoIterator<Item = V>,
10077        V: std::convert::Into<crate::model::Cluster>,
10078    {
10079        use std::iter::Iterator;
10080        self.clusters = v.into_iter().map(|i| i.into()).collect();
10081        self
10082    }
10083
10084    /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
10085    ///
10086    /// # Example
10087    /// ```ignore,no_run
10088    /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
10089    /// let x = ListClustersResponse::new().set_next_page_token("example");
10090    /// ```
10091    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10092        self.next_page_token = v.into();
10093        self
10094    }
10095}
10096
10097impl wkt::message::Message for ListClustersResponse {
10098    fn typename() -> &'static str {
10099        "type.googleapis.com/google.cloud.dataproc.v1.ListClustersResponse"
10100    }
10101}
10102
10103#[doc(hidden)]
10104impl google_cloud_gax::paginator::internal::PageableResponse for ListClustersResponse {
10105    type PageItem = crate::model::Cluster;
10106
10107    fn items(self) -> std::vec::Vec<Self::PageItem> {
10108        self.clusters
10109    }
10110
10111    fn next_page_token(&self) -> std::string::String {
10112        use std::clone::Clone;
10113        self.next_page_token.clone()
10114    }
10115}
10116
10117/// A request to collect cluster diagnostic information.
10118#[derive(Clone, Default, PartialEq)]
10119#[non_exhaustive]
10120pub struct DiagnoseClusterRequest {
10121    /// Required. The ID of the Google Cloud Platform project that the cluster
10122    /// belongs to.
10123    pub project_id: std::string::String,
10124
10125    /// Required. The Dataproc region in which to handle the request.
10126    pub region: std::string::String,
10127
10128    /// Required. The cluster name.
10129    pub cluster_name: std::string::String,
10130
10131    /// Optional. (Optional) The output Cloud Storage directory for the diagnostic
10132    /// tarball. If not specified, a task-specific directory in the cluster's
10133    /// staging bucket will be used.
10134    pub tarball_gcs_dir: std::string::String,
10135
10136    /// Optional. (Optional) The access type to the diagnostic tarball. If not
10137    /// specified, falls back to default access of the bucket
10138    pub tarball_access: crate::model::diagnose_cluster_request::TarballAccess,
10139
10140    /// Optional. Time interval in which diagnosis should be carried out on the
10141    /// cluster.
10142    pub diagnosis_interval: std::option::Option<google_cloud_type::model::Interval>,
10143
10144    /// Optional. Specifies a list of jobs on which diagnosis is to be performed.
10145    /// Format: projects/{project}/regions/{region}/jobs/{job}
10146    pub jobs: std::vec::Vec<std::string::String>,
10147
10148    /// Optional. Specifies a list of yarn applications on which diagnosis is to be
10149    /// performed.
10150    pub yarn_application_ids: std::vec::Vec<std::string::String>,
10151
10152    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10153}
10154
10155impl DiagnoseClusterRequest {
10156    /// Creates a new default instance.
10157    pub fn new() -> Self {
10158        std::default::Default::default()
10159    }
10160
10161    /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
10162    ///
10163    /// # Example
10164    /// ```ignore,no_run
10165    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10166    /// let x = DiagnoseClusterRequest::new().set_project_id("example");
10167    /// ```
10168    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10169        self.project_id = v.into();
10170        self
10171    }
10172
10173    /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
10174    ///
10175    /// # Example
10176    /// ```ignore,no_run
10177    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10178    /// let x = DiagnoseClusterRequest::new().set_region("example");
10179    /// ```
10180    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10181        self.region = v.into();
10182        self
10183    }
10184
10185    /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
10186    ///
10187    /// # Example
10188    /// ```ignore,no_run
10189    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10190    /// let x = DiagnoseClusterRequest::new().set_cluster_name("example");
10191    /// ```
10192    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10193        self.cluster_name = v.into();
10194        self
10195    }
10196
10197    /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
10198    ///
10199    /// # Example
10200    /// ```ignore,no_run
10201    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10202    /// let x = DiagnoseClusterRequest::new().set_tarball_gcs_dir("example");
10203    /// ```
10204    pub fn set_tarball_gcs_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10205        self.tarball_gcs_dir = v.into();
10206        self
10207    }
10208
10209    /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
10210    ///
10211    /// # Example
10212    /// ```ignore,no_run
10213    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10214    /// use google_cloud_dataproc_v1::model::diagnose_cluster_request::TarballAccess;
10215    /// let x0 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleCloudSupport);
10216    /// let x1 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleDataprocDiagnose);
10217    /// ```
10218    pub fn set_tarball_access<
10219        T: std::convert::Into<crate::model::diagnose_cluster_request::TarballAccess>,
10220    >(
10221        mut self,
10222        v: T,
10223    ) -> Self {
10224        self.tarball_access = v.into();
10225        self
10226    }
10227
10228    /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
10229    ///
10230    /// # Example
10231    /// ```ignore,no_run
10232    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10233    /// use google_cloud_type::model::Interval;
10234    /// let x = DiagnoseClusterRequest::new().set_diagnosis_interval(Interval::default()/* use setters */);
10235    /// ```
10236    pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
10237    where
10238        T: std::convert::Into<google_cloud_type::model::Interval>,
10239    {
10240        self.diagnosis_interval = std::option::Option::Some(v.into());
10241        self
10242    }
10243
10244    /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
10245    ///
10246    /// # Example
10247    /// ```ignore,no_run
10248    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10249    /// use google_cloud_type::model::Interval;
10250    /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(Some(Interval::default()/* use setters */));
10251    /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(None::<Interval>);
10252    /// ```
10253    pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
10254    where
10255        T: std::convert::Into<google_cloud_type::model::Interval>,
10256    {
10257        self.diagnosis_interval = v.map(|x| x.into());
10258        self
10259    }
10260
10261    /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
10262    ///
10263    /// # Example
10264    /// ```ignore,no_run
10265    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10266    /// let x = DiagnoseClusterRequest::new().set_jobs(["a", "b", "c"]);
10267    /// ```
10268    pub fn set_jobs<T, V>(mut self, v: T) -> Self
10269    where
10270        T: std::iter::IntoIterator<Item = V>,
10271        V: std::convert::Into<std::string::String>,
10272    {
10273        use std::iter::Iterator;
10274        self.jobs = v.into_iter().map(|i| i.into()).collect();
10275        self
10276    }
10277
10278    /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
10279    ///
10280    /// # Example
10281    /// ```ignore,no_run
10282    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10283    /// let x = DiagnoseClusterRequest::new().set_yarn_application_ids(["a", "b", "c"]);
10284    /// ```
10285    pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
10286    where
10287        T: std::iter::IntoIterator<Item = V>,
10288        V: std::convert::Into<std::string::String>,
10289    {
10290        use std::iter::Iterator;
10291        self.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
10292        self
10293    }
10294}
10295
10296impl wkt::message::Message for DiagnoseClusterRequest {
10297    fn typename() -> &'static str {
10298        "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterRequest"
10299    }
10300}
10301
10302/// Defines additional types related to [DiagnoseClusterRequest].
10303pub mod diagnose_cluster_request {
10304    #[allow(unused_imports)]
10305    use super::*;
10306
10307    /// Defines who has access to the diagnostic tarball
10308    ///
10309    /// # Working with unknown values
10310    ///
10311    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10312    /// additional enum variants at any time. Adding new variants is not considered
10313    /// a breaking change. Applications should write their code in anticipation of:
10314    ///
10315    /// - New values appearing in future releases of the client library, **and**
10316    /// - New values received dynamically, without application changes.
10317    ///
10318    /// Please consult the [Working with enums] section in the user guide for some
10319    /// guidelines.
10320    ///
10321    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10322    #[derive(Clone, Debug, PartialEq)]
10323    #[non_exhaustive]
10324    pub enum TarballAccess {
10325        /// Tarball Access unspecified. Falls back to default access of the bucket
10326        Unspecified,
10327        /// Google Cloud Support group has read access to the
10328        /// diagnostic tarball
10329        GoogleCloudSupport,
10330        /// Google Cloud Dataproc Diagnose service account has read access to the
10331        /// diagnostic tarball
10332        GoogleDataprocDiagnose,
10333        /// If set, the enum was initialized with an unknown value.
10334        ///
10335        /// Applications can examine the value using [TarballAccess::value] or
10336        /// [TarballAccess::name].
10337        UnknownValue(tarball_access::UnknownValue),
10338    }
10339
10340    #[doc(hidden)]
10341    pub mod tarball_access {
10342        #[allow(unused_imports)]
10343        use super::*;
10344        #[derive(Clone, Debug, PartialEq)]
10345        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10346    }
10347
10348    impl TarballAccess {
10349        /// Gets the enum value.
10350        ///
10351        /// Returns `None` if the enum contains an unknown value deserialized from
10352        /// the string representation of enums.
10353        pub fn value(&self) -> std::option::Option<i32> {
10354            match self {
10355                Self::Unspecified => std::option::Option::Some(0),
10356                Self::GoogleCloudSupport => std::option::Option::Some(1),
10357                Self::GoogleDataprocDiagnose => std::option::Option::Some(2),
10358                Self::UnknownValue(u) => u.0.value(),
10359            }
10360        }
10361
10362        /// Gets the enum value as a string.
10363        ///
10364        /// Returns `None` if the enum contains an unknown value deserialized from
10365        /// the integer representation of enums.
10366        pub fn name(&self) -> std::option::Option<&str> {
10367            match self {
10368                Self::Unspecified => std::option::Option::Some("TARBALL_ACCESS_UNSPECIFIED"),
10369                Self::GoogleCloudSupport => std::option::Option::Some("GOOGLE_CLOUD_SUPPORT"),
10370                Self::GoogleDataprocDiagnose => {
10371                    std::option::Option::Some("GOOGLE_DATAPROC_DIAGNOSE")
10372                }
10373                Self::UnknownValue(u) => u.0.name(),
10374            }
10375        }
10376    }
10377
10378    impl std::default::Default for TarballAccess {
10379        fn default() -> Self {
10380            use std::convert::From;
10381            Self::from(0)
10382        }
10383    }
10384
10385    impl std::fmt::Display for TarballAccess {
10386        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10387            wkt::internal::display_enum(f, self.name(), self.value())
10388        }
10389    }
10390
10391    impl std::convert::From<i32> for TarballAccess {
10392        fn from(value: i32) -> Self {
10393            match value {
10394                0 => Self::Unspecified,
10395                1 => Self::GoogleCloudSupport,
10396                2 => Self::GoogleDataprocDiagnose,
10397                _ => Self::UnknownValue(tarball_access::UnknownValue(
10398                    wkt::internal::UnknownEnumValue::Integer(value),
10399                )),
10400            }
10401        }
10402    }
10403
10404    impl std::convert::From<&str> for TarballAccess {
10405        fn from(value: &str) -> Self {
10406            use std::string::ToString;
10407            match value {
10408                "TARBALL_ACCESS_UNSPECIFIED" => Self::Unspecified,
10409                "GOOGLE_CLOUD_SUPPORT" => Self::GoogleCloudSupport,
10410                "GOOGLE_DATAPROC_DIAGNOSE" => Self::GoogleDataprocDiagnose,
10411                _ => Self::UnknownValue(tarball_access::UnknownValue(
10412                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10413                )),
10414            }
10415        }
10416    }
10417
10418    impl serde::ser::Serialize for TarballAccess {
10419        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10420        where
10421            S: serde::Serializer,
10422        {
10423            match self {
10424                Self::Unspecified => serializer.serialize_i32(0),
10425                Self::GoogleCloudSupport => serializer.serialize_i32(1),
10426                Self::GoogleDataprocDiagnose => serializer.serialize_i32(2),
10427                Self::UnknownValue(u) => u.0.serialize(serializer),
10428            }
10429        }
10430    }
10431
10432    impl<'de> serde::de::Deserialize<'de> for TarballAccess {
10433        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10434        where
10435            D: serde::Deserializer<'de>,
10436        {
10437            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TarballAccess>::new(
10438                ".google.cloud.dataproc.v1.DiagnoseClusterRequest.TarballAccess",
10439            ))
10440        }
10441    }
10442}
10443
10444/// The location of diagnostic output.
10445#[derive(Clone, Default, PartialEq)]
10446#[non_exhaustive]
10447pub struct DiagnoseClusterResults {
10448    /// Output only. The Cloud Storage URI of the diagnostic output.
10449    /// The output report is a plain text file with a summary of collected
10450    /// diagnostics.
10451    pub output_uri: std::string::String,
10452
10453    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10454}
10455
10456impl DiagnoseClusterResults {
10457    /// Creates a new default instance.
10458    pub fn new() -> Self {
10459        std::default::Default::default()
10460    }
10461
10462    /// Sets the value of [output_uri][crate::model::DiagnoseClusterResults::output_uri].
10463    ///
10464    /// # Example
10465    /// ```ignore,no_run
10466    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterResults;
10467    /// let x = DiagnoseClusterResults::new().set_output_uri("example");
10468    /// ```
10469    pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10470        self.output_uri = v.into();
10471        self
10472    }
10473}
10474
10475impl wkt::message::Message for DiagnoseClusterResults {
10476    fn typename() -> &'static str {
10477        "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterResults"
10478    }
10479}
10480
10481/// Reservation Affinity for consuming Zonal reservation.
10482#[derive(Clone, Default, PartialEq)]
10483#[non_exhaustive]
10484pub struct ReservationAffinity {
10485    /// Optional. Type of reservation to consume
10486    pub consume_reservation_type: crate::model::reservation_affinity::Type,
10487
10488    /// Optional. Corresponds to the label key of reservation resource.
10489    pub key: std::string::String,
10490
10491    /// Optional. Corresponds to the label values of reservation resource.
10492    pub values: std::vec::Vec<std::string::String>,
10493
10494    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10495}
10496
10497impl ReservationAffinity {
10498    /// Creates a new default instance.
10499    pub fn new() -> Self {
10500        std::default::Default::default()
10501    }
10502
10503    /// Sets the value of [consume_reservation_type][crate::model::ReservationAffinity::consume_reservation_type].
10504    ///
10505    /// # Example
10506    /// ```ignore,no_run
10507    /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10508    /// use google_cloud_dataproc_v1::model::reservation_affinity::Type;
10509    /// let x0 = ReservationAffinity::new().set_consume_reservation_type(Type::NoReservation);
10510    /// let x1 = ReservationAffinity::new().set_consume_reservation_type(Type::AnyReservation);
10511    /// let x2 = ReservationAffinity::new().set_consume_reservation_type(Type::SpecificReservation);
10512    /// ```
10513    pub fn set_consume_reservation_type<
10514        T: std::convert::Into<crate::model::reservation_affinity::Type>,
10515    >(
10516        mut self,
10517        v: T,
10518    ) -> Self {
10519        self.consume_reservation_type = v.into();
10520        self
10521    }
10522
10523    /// Sets the value of [key][crate::model::ReservationAffinity::key].
10524    ///
10525    /// # Example
10526    /// ```ignore,no_run
10527    /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10528    /// let x = ReservationAffinity::new().set_key("example");
10529    /// ```
10530    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10531        self.key = v.into();
10532        self
10533    }
10534
10535    /// Sets the value of [values][crate::model::ReservationAffinity::values].
10536    ///
10537    /// # Example
10538    /// ```ignore,no_run
10539    /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10540    /// let x = ReservationAffinity::new().set_values(["a", "b", "c"]);
10541    /// ```
10542    pub fn set_values<T, V>(mut self, v: T) -> Self
10543    where
10544        T: std::iter::IntoIterator<Item = V>,
10545        V: std::convert::Into<std::string::String>,
10546    {
10547        use std::iter::Iterator;
10548        self.values = v.into_iter().map(|i| i.into()).collect();
10549        self
10550    }
10551}
10552
10553impl wkt::message::Message for ReservationAffinity {
10554    fn typename() -> &'static str {
10555        "type.googleapis.com/google.cloud.dataproc.v1.ReservationAffinity"
10556    }
10557}
10558
10559/// Defines additional types related to [ReservationAffinity].
10560pub mod reservation_affinity {
10561    #[allow(unused_imports)]
10562    use super::*;
10563
10564    /// Indicates whether to consume capacity from an reservation or not.
10565    ///
10566    /// # Working with unknown values
10567    ///
10568    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10569    /// additional enum variants at any time. Adding new variants is not considered
10570    /// a breaking change. Applications should write their code in anticipation of:
10571    ///
10572    /// - New values appearing in future releases of the client library, **and**
10573    /// - New values received dynamically, without application changes.
10574    ///
10575    /// Please consult the [Working with enums] section in the user guide for some
10576    /// guidelines.
10577    ///
10578    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10579    #[derive(Clone, Debug, PartialEq)]
10580    #[non_exhaustive]
10581    pub enum Type {
10582        #[allow(missing_docs)]
10583        Unspecified,
10584        /// Do not consume from any allocated capacity.
10585        NoReservation,
10586        /// Consume any reservation available.
10587        AnyReservation,
10588        /// Must consume from a specific reservation. Must specify key value fields
10589        /// for specifying the reservations.
10590        SpecificReservation,
10591        /// If set, the enum was initialized with an unknown value.
10592        ///
10593        /// Applications can examine the value using [Type::value] or
10594        /// [Type::name].
10595        UnknownValue(r#type::UnknownValue),
10596    }
10597
10598    #[doc(hidden)]
10599    pub mod r#type {
10600        #[allow(unused_imports)]
10601        use super::*;
10602        #[derive(Clone, Debug, PartialEq)]
10603        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10604    }
10605
10606    impl Type {
10607        /// Gets the enum value.
10608        ///
10609        /// Returns `None` if the enum contains an unknown value deserialized from
10610        /// the string representation of enums.
10611        pub fn value(&self) -> std::option::Option<i32> {
10612            match self {
10613                Self::Unspecified => std::option::Option::Some(0),
10614                Self::NoReservation => std::option::Option::Some(1),
10615                Self::AnyReservation => std::option::Option::Some(2),
10616                Self::SpecificReservation => std::option::Option::Some(3),
10617                Self::UnknownValue(u) => u.0.value(),
10618            }
10619        }
10620
10621        /// Gets the enum value as a string.
10622        ///
10623        /// Returns `None` if the enum contains an unknown value deserialized from
10624        /// the integer representation of enums.
10625        pub fn name(&self) -> std::option::Option<&str> {
10626            match self {
10627                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
10628                Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
10629                Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
10630                Self::SpecificReservation => std::option::Option::Some("SPECIFIC_RESERVATION"),
10631                Self::UnknownValue(u) => u.0.name(),
10632            }
10633        }
10634    }
10635
10636    impl std::default::Default for Type {
10637        fn default() -> Self {
10638            use std::convert::From;
10639            Self::from(0)
10640        }
10641    }
10642
10643    impl std::fmt::Display for Type {
10644        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10645            wkt::internal::display_enum(f, self.name(), self.value())
10646        }
10647    }
10648
10649    impl std::convert::From<i32> for Type {
10650        fn from(value: i32) -> Self {
10651            match value {
10652                0 => Self::Unspecified,
10653                1 => Self::NoReservation,
10654                2 => Self::AnyReservation,
10655                3 => Self::SpecificReservation,
10656                _ => Self::UnknownValue(r#type::UnknownValue(
10657                    wkt::internal::UnknownEnumValue::Integer(value),
10658                )),
10659            }
10660        }
10661    }
10662
10663    impl std::convert::From<&str> for Type {
10664        fn from(value: &str) -> Self {
10665            use std::string::ToString;
10666            match value {
10667                "TYPE_UNSPECIFIED" => Self::Unspecified,
10668                "NO_RESERVATION" => Self::NoReservation,
10669                "ANY_RESERVATION" => Self::AnyReservation,
10670                "SPECIFIC_RESERVATION" => Self::SpecificReservation,
10671                _ => Self::UnknownValue(r#type::UnknownValue(
10672                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10673                )),
10674            }
10675        }
10676    }
10677
10678    impl serde::ser::Serialize for Type {
10679        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10680        where
10681            S: serde::Serializer,
10682        {
10683            match self {
10684                Self::Unspecified => serializer.serialize_i32(0),
10685                Self::NoReservation => serializer.serialize_i32(1),
10686                Self::AnyReservation => serializer.serialize_i32(2),
10687                Self::SpecificReservation => serializer.serialize_i32(3),
10688                Self::UnknownValue(u) => u.0.serialize(serializer),
10689            }
10690        }
10691    }
10692
10693    impl<'de> serde::de::Deserialize<'de> for Type {
10694        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10695        where
10696            D: serde::Deserializer<'de>,
10697        {
10698            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
10699                ".google.cloud.dataproc.v1.ReservationAffinity.Type",
10700            ))
10701        }
10702    }
10703}
10704
10705/// The runtime logging config of the job.
10706#[derive(Clone, Default, PartialEq)]
10707#[non_exhaustive]
10708pub struct LoggingConfig {
10709    /// The per-package log levels for the driver. This can include
10710    /// "root" package name to configure rootLogger.
10711    /// Examples:
10712    ///
10713    /// - 'com.google = FATAL'
10714    /// - 'root = INFO'
10715    /// - 'org.apache = DEBUG'
10716    pub driver_log_levels:
10717        std::collections::HashMap<std::string::String, crate::model::logging_config::Level>,
10718
10719    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10720}
10721
10722impl LoggingConfig {
10723    /// Creates a new default instance.
10724    pub fn new() -> Self {
10725        std::default::Default::default()
10726    }
10727
10728    /// Sets the value of [driver_log_levels][crate::model::LoggingConfig::driver_log_levels].
10729    ///
10730    /// # Example
10731    /// ```ignore,no_run
10732    /// # use google_cloud_dataproc_v1::model::LoggingConfig;
10733    /// use google_cloud_dataproc_v1::model::logging_config::Level;
10734    /// let x = LoggingConfig::new().set_driver_log_levels([
10735    ///     ("key0", Level::All),
10736    ///     ("key1", Level::Trace),
10737    ///     ("key2", Level::Debug),
10738    /// ]);
10739    /// ```
10740    pub fn set_driver_log_levels<T, K, V>(mut self, v: T) -> Self
10741    where
10742        T: std::iter::IntoIterator<Item = (K, V)>,
10743        K: std::convert::Into<std::string::String>,
10744        V: std::convert::Into<crate::model::logging_config::Level>,
10745    {
10746        use std::iter::Iterator;
10747        self.driver_log_levels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10748        self
10749    }
10750}
10751
10752impl wkt::message::Message for LoggingConfig {
10753    fn typename() -> &'static str {
10754        "type.googleapis.com/google.cloud.dataproc.v1.LoggingConfig"
10755    }
10756}
10757
10758/// Defines additional types related to [LoggingConfig].
10759pub mod logging_config {
10760    #[allow(unused_imports)]
10761    use super::*;
10762
10763    /// The Log4j level for job execution. When running an
10764    /// [Apache Hive](https://hive.apache.org/) job, Cloud
10765    /// Dataproc configures the Hive client to an equivalent verbosity level.
10766    ///
10767    /// # Working with unknown values
10768    ///
10769    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10770    /// additional enum variants at any time. Adding new variants is not considered
10771    /// a breaking change. Applications should write their code in anticipation of:
10772    ///
10773    /// - New values appearing in future releases of the client library, **and**
10774    /// - New values received dynamically, without application changes.
10775    ///
10776    /// Please consult the [Working with enums] section in the user guide for some
10777    /// guidelines.
10778    ///
10779    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10780    #[derive(Clone, Debug, PartialEq)]
10781    #[non_exhaustive]
10782    pub enum Level {
10783        /// Level is unspecified. Use default level for log4j.
10784        Unspecified,
10785        /// Use ALL level for log4j.
10786        All,
10787        /// Use TRACE level for log4j.
10788        Trace,
10789        /// Use DEBUG level for log4j.
10790        Debug,
10791        /// Use INFO level for log4j.
10792        Info,
10793        /// Use WARN level for log4j.
10794        Warn,
10795        /// Use ERROR level for log4j.
10796        Error,
10797        /// Use FATAL level for log4j.
10798        Fatal,
10799        /// Turn off log4j.
10800        Off,
10801        /// If set, the enum was initialized with an unknown value.
10802        ///
10803        /// Applications can examine the value using [Level::value] or
10804        /// [Level::name].
10805        UnknownValue(level::UnknownValue),
10806    }
10807
10808    #[doc(hidden)]
10809    pub mod level {
10810        #[allow(unused_imports)]
10811        use super::*;
10812        #[derive(Clone, Debug, PartialEq)]
10813        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10814    }
10815
10816    impl Level {
10817        /// Gets the enum value.
10818        ///
10819        /// Returns `None` if the enum contains an unknown value deserialized from
10820        /// the string representation of enums.
10821        pub fn value(&self) -> std::option::Option<i32> {
10822            match self {
10823                Self::Unspecified => std::option::Option::Some(0),
10824                Self::All => std::option::Option::Some(1),
10825                Self::Trace => std::option::Option::Some(2),
10826                Self::Debug => std::option::Option::Some(3),
10827                Self::Info => std::option::Option::Some(4),
10828                Self::Warn => std::option::Option::Some(5),
10829                Self::Error => std::option::Option::Some(6),
10830                Self::Fatal => std::option::Option::Some(7),
10831                Self::Off => std::option::Option::Some(8),
10832                Self::UnknownValue(u) => u.0.value(),
10833            }
10834        }
10835
10836        /// Gets the enum value as a string.
10837        ///
10838        /// Returns `None` if the enum contains an unknown value deserialized from
10839        /// the integer representation of enums.
10840        pub fn name(&self) -> std::option::Option<&str> {
10841            match self {
10842                Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
10843                Self::All => std::option::Option::Some("ALL"),
10844                Self::Trace => std::option::Option::Some("TRACE"),
10845                Self::Debug => std::option::Option::Some("DEBUG"),
10846                Self::Info => std::option::Option::Some("INFO"),
10847                Self::Warn => std::option::Option::Some("WARN"),
10848                Self::Error => std::option::Option::Some("ERROR"),
10849                Self::Fatal => std::option::Option::Some("FATAL"),
10850                Self::Off => std::option::Option::Some("OFF"),
10851                Self::UnknownValue(u) => u.0.name(),
10852            }
10853        }
10854    }
10855
10856    impl std::default::Default for Level {
10857        fn default() -> Self {
10858            use std::convert::From;
10859            Self::from(0)
10860        }
10861    }
10862
10863    impl std::fmt::Display for Level {
10864        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10865            wkt::internal::display_enum(f, self.name(), self.value())
10866        }
10867    }
10868
10869    impl std::convert::From<i32> for Level {
10870        fn from(value: i32) -> Self {
10871            match value {
10872                0 => Self::Unspecified,
10873                1 => Self::All,
10874                2 => Self::Trace,
10875                3 => Self::Debug,
10876                4 => Self::Info,
10877                5 => Self::Warn,
10878                6 => Self::Error,
10879                7 => Self::Fatal,
10880                8 => Self::Off,
10881                _ => Self::UnknownValue(level::UnknownValue(
10882                    wkt::internal::UnknownEnumValue::Integer(value),
10883                )),
10884            }
10885        }
10886    }
10887
10888    impl std::convert::From<&str> for Level {
10889        fn from(value: &str) -> Self {
10890            use std::string::ToString;
10891            match value {
10892                "LEVEL_UNSPECIFIED" => Self::Unspecified,
10893                "ALL" => Self::All,
10894                "TRACE" => Self::Trace,
10895                "DEBUG" => Self::Debug,
10896                "INFO" => Self::Info,
10897                "WARN" => Self::Warn,
10898                "ERROR" => Self::Error,
10899                "FATAL" => Self::Fatal,
10900                "OFF" => Self::Off,
10901                _ => Self::UnknownValue(level::UnknownValue(
10902                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10903                )),
10904            }
10905        }
10906    }
10907
10908    impl serde::ser::Serialize for Level {
10909        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10910        where
10911            S: serde::Serializer,
10912        {
10913            match self {
10914                Self::Unspecified => serializer.serialize_i32(0),
10915                Self::All => serializer.serialize_i32(1),
10916                Self::Trace => serializer.serialize_i32(2),
10917                Self::Debug => serializer.serialize_i32(3),
10918                Self::Info => serializer.serialize_i32(4),
10919                Self::Warn => serializer.serialize_i32(5),
10920                Self::Error => serializer.serialize_i32(6),
10921                Self::Fatal => serializer.serialize_i32(7),
10922                Self::Off => serializer.serialize_i32(8),
10923                Self::UnknownValue(u) => u.0.serialize(serializer),
10924            }
10925        }
10926    }
10927
10928    impl<'de> serde::de::Deserialize<'de> for Level {
10929        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10930        where
10931            D: serde::Deserializer<'de>,
10932        {
10933            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
10934                ".google.cloud.dataproc.v1.LoggingConfig.Level",
10935            ))
10936        }
10937    }
10938}
10939
10940/// A Dataproc job for running
10941/// [Apache Hadoop
10942/// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html)
10943/// jobs on [Apache Hadoop
10944/// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
10945#[derive(Clone, Default, PartialEq)]
10946#[non_exhaustive]
10947pub struct HadoopJob {
10948    /// Optional. The arguments to pass to the driver. Do not
10949    /// include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
10950    /// job properties, since a collision might occur that causes an incorrect job
10951    /// submission.
10952    pub args: std::vec::Vec<std::string::String>,
10953
10954    /// Optional. Jar file URIs to add to the CLASSPATHs of the
10955    /// Hadoop driver and tasks.
10956    pub jar_file_uris: std::vec::Vec<std::string::String>,
10957
10958    /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied
10959    /// to the working directory of Hadoop drivers and distributed tasks. Useful
10960    /// for naively parallel tasks.
10961    pub file_uris: std::vec::Vec<std::string::String>,
10962
10963    /// Optional. HCFS URIs of archives to be extracted in the working directory of
10964    /// Hadoop drivers and tasks. Supported file types:
10965    /// .jar, .tar, .tar.gz, .tgz, or .zip.
10966    pub archive_uris: std::vec::Vec<std::string::String>,
10967
10968    /// Optional. A mapping of property names to values, used to configure Hadoop.
10969    /// Properties that conflict with values set by the Dataproc API might be
10970    /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and
10971    /// classes in user code.
10972    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10973
10974    /// Optional. The runtime log config for job execution.
10975    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10976
10977    /// Required. Indicates the location of the driver's main class. Specify
10978    /// either the jar file that contains the main class or the main class name.
10979    /// To specify both, add the jar file to `jar_file_uris`, and then specify
10980    /// the main class name in this property.
10981    pub driver: std::option::Option<crate::model::hadoop_job::Driver>,
10982
10983    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10984}
10985
10986impl HadoopJob {
10987    /// Creates a new default instance.
10988    pub fn new() -> Self {
10989        std::default::Default::default()
10990    }
10991
10992    /// Sets the value of [args][crate::model::HadoopJob::args].
10993    ///
10994    /// # Example
10995    /// ```ignore,no_run
10996    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10997    /// let x = HadoopJob::new().set_args(["a", "b", "c"]);
10998    /// ```
10999    pub fn set_args<T, V>(mut self, v: T) -> Self
11000    where
11001        T: std::iter::IntoIterator<Item = V>,
11002        V: std::convert::Into<std::string::String>,
11003    {
11004        use std::iter::Iterator;
11005        self.args = v.into_iter().map(|i| i.into()).collect();
11006        self
11007    }
11008
11009    /// Sets the value of [jar_file_uris][crate::model::HadoopJob::jar_file_uris].
11010    ///
11011    /// # Example
11012    /// ```ignore,no_run
11013    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11014    /// let x = HadoopJob::new().set_jar_file_uris(["a", "b", "c"]);
11015    /// ```
11016    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11017    where
11018        T: std::iter::IntoIterator<Item = V>,
11019        V: std::convert::Into<std::string::String>,
11020    {
11021        use std::iter::Iterator;
11022        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11023        self
11024    }
11025
11026    /// Sets the value of [file_uris][crate::model::HadoopJob::file_uris].
11027    ///
11028    /// # Example
11029    /// ```ignore,no_run
11030    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11031    /// let x = HadoopJob::new().set_file_uris(["a", "b", "c"]);
11032    /// ```
11033    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11034    where
11035        T: std::iter::IntoIterator<Item = V>,
11036        V: std::convert::Into<std::string::String>,
11037    {
11038        use std::iter::Iterator;
11039        self.file_uris = v.into_iter().map(|i| i.into()).collect();
11040        self
11041    }
11042
11043    /// Sets the value of [archive_uris][crate::model::HadoopJob::archive_uris].
11044    ///
11045    /// # Example
11046    /// ```ignore,no_run
11047    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11048    /// let x = HadoopJob::new().set_archive_uris(["a", "b", "c"]);
11049    /// ```
11050    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11051    where
11052        T: std::iter::IntoIterator<Item = V>,
11053        V: std::convert::Into<std::string::String>,
11054    {
11055        use std::iter::Iterator;
11056        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11057        self
11058    }
11059
11060    /// Sets the value of [properties][crate::model::HadoopJob::properties].
11061    ///
11062    /// # Example
11063    /// ```ignore,no_run
11064    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11065    /// let x = HadoopJob::new().set_properties([
11066    ///     ("key0", "abc"),
11067    ///     ("key1", "xyz"),
11068    /// ]);
11069    /// ```
11070    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11071    where
11072        T: std::iter::IntoIterator<Item = (K, V)>,
11073        K: std::convert::Into<std::string::String>,
11074        V: std::convert::Into<std::string::String>,
11075    {
11076        use std::iter::Iterator;
11077        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11078        self
11079    }
11080
11081    /// Sets the value of [logging_config][crate::model::HadoopJob::logging_config].
11082    ///
11083    /// # Example
11084    /// ```ignore,no_run
11085    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11086    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11087    /// let x = HadoopJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11088    /// ```
11089    pub fn set_logging_config<T>(mut self, v: T) -> Self
11090    where
11091        T: std::convert::Into<crate::model::LoggingConfig>,
11092    {
11093        self.logging_config = std::option::Option::Some(v.into());
11094        self
11095    }
11096
11097    /// Sets or clears the value of [logging_config][crate::model::HadoopJob::logging_config].
11098    ///
11099    /// # Example
11100    /// ```ignore,no_run
11101    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11102    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11103    /// let x = HadoopJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11104    /// let x = HadoopJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11105    /// ```
11106    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11107    where
11108        T: std::convert::Into<crate::model::LoggingConfig>,
11109    {
11110        self.logging_config = v.map(|x| x.into());
11111        self
11112    }
11113
11114    /// Sets the value of [driver][crate::model::HadoopJob::driver].
11115    ///
11116    /// Note that all the setters affecting `driver` are mutually
11117    /// exclusive.
11118    ///
11119    /// # Example
11120    /// ```ignore,no_run
11121    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11122    /// use google_cloud_dataproc_v1::model::hadoop_job::Driver;
11123    /// let x = HadoopJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
11124    /// ```
11125    pub fn set_driver<
11126        T: std::convert::Into<std::option::Option<crate::model::hadoop_job::Driver>>,
11127    >(
11128        mut self,
11129        v: T,
11130    ) -> Self {
11131        self.driver = v.into();
11132        self
11133    }
11134
11135    /// The value of [driver][crate::model::HadoopJob::driver]
11136    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
11137    /// holds a different branch.
11138    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
11139        #[allow(unreachable_patterns)]
11140        self.driver.as_ref().and_then(|v| match v {
11141            crate::model::hadoop_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
11142            _ => std::option::Option::None,
11143        })
11144    }
11145
11146    /// Sets the value of [driver][crate::model::HadoopJob::driver]
11147    /// to hold a `MainJarFileUri`.
11148    ///
11149    /// Note that all the setters affecting `driver` are
11150    /// mutually exclusive.
11151    ///
11152    /// # Example
11153    /// ```ignore,no_run
11154    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11155    /// let x = HadoopJob::new().set_main_jar_file_uri("example");
11156    /// assert!(x.main_jar_file_uri().is_some());
11157    /// assert!(x.main_class().is_none());
11158    /// ```
11159    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
11160        mut self,
11161        v: T,
11162    ) -> Self {
11163        self.driver =
11164            std::option::Option::Some(crate::model::hadoop_job::Driver::MainJarFileUri(v.into()));
11165        self
11166    }
11167
11168    /// The value of [driver][crate::model::HadoopJob::driver]
11169    /// if it holds a `MainClass`, `None` if the field is not set or
11170    /// holds a different branch.
11171    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
11172        #[allow(unreachable_patterns)]
11173        self.driver.as_ref().and_then(|v| match v {
11174            crate::model::hadoop_job::Driver::MainClass(v) => std::option::Option::Some(v),
11175            _ => std::option::Option::None,
11176        })
11177    }
11178
11179    /// Sets the value of [driver][crate::model::HadoopJob::driver]
11180    /// to hold a `MainClass`.
11181    ///
11182    /// Note that all the setters affecting `driver` are
11183    /// mutually exclusive.
11184    ///
11185    /// # Example
11186    /// ```ignore,no_run
11187    /// # use google_cloud_dataproc_v1::model::HadoopJob;
11188    /// let x = HadoopJob::new().set_main_class("example");
11189    /// assert!(x.main_class().is_some());
11190    /// assert!(x.main_jar_file_uri().is_none());
11191    /// ```
11192    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11193        self.driver =
11194            std::option::Option::Some(crate::model::hadoop_job::Driver::MainClass(v.into()));
11195        self
11196    }
11197}
11198
11199impl wkt::message::Message for HadoopJob {
11200    fn typename() -> &'static str {
11201        "type.googleapis.com/google.cloud.dataproc.v1.HadoopJob"
11202    }
11203}
11204
11205/// Defines additional types related to [HadoopJob].
11206pub mod hadoop_job {
11207    #[allow(unused_imports)]
11208    use super::*;
11209
11210    /// Required. Indicates the location of the driver's main class. Specify
11211    /// either the jar file that contains the main class or the main class name.
11212    /// To specify both, add the jar file to `jar_file_uris`, and then specify
11213    /// the main class name in this property.
11214    #[derive(Clone, Debug, PartialEq)]
11215    #[non_exhaustive]
11216    pub enum Driver {
11217        /// The HCFS URI of the jar file containing the main class.
11218        /// Examples:
11219        /// 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar'
11220        /// 'hdfs:/tmp/test-samples/custom-wordcount.jar'
11221        /// 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
11222        MainJarFileUri(std::string::String),
11223        /// The name of the driver's main class. The jar file containing the class
11224        /// must be in the default CLASSPATH or specified in `jar_file_uris`.
11225        MainClass(std::string::String),
11226    }
11227}
11228
11229/// A Dataproc job for running [Apache Spark](https://spark.apache.org/)
11230/// applications on YARN.
11231#[derive(Clone, Default, PartialEq)]
11232#[non_exhaustive]
11233pub struct SparkJob {
11234    /// Optional. The arguments to pass to the driver. Do not include arguments,
11235    /// such as `--conf`, that can be set as job properties, since a collision may
11236    /// occur that causes an incorrect job submission.
11237    pub args: std::vec::Vec<std::string::String>,
11238
11239    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
11240    /// Spark driver and tasks.
11241    pub jar_file_uris: std::vec::Vec<std::string::String>,
11242
11243    /// Optional. HCFS URIs of files to be placed in the working directory of
11244    /// each executor. Useful for naively parallel tasks.
11245    pub file_uris: std::vec::Vec<std::string::String>,
11246
11247    /// Optional. HCFS URIs of archives to be extracted into the working directory
11248    /// of each executor. Supported file types:
11249    /// .jar, .tar, .tar.gz, .tgz, and .zip.
11250    pub archive_uris: std::vec::Vec<std::string::String>,
11251
11252    /// Optional. A mapping of property names to values, used to configure Spark.
11253    /// Properties that conflict with values set by the Dataproc API might be
11254    /// overwritten. Can include properties set in
11255    /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11256    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11257
11258    /// Optional. The runtime log config for job execution.
11259    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11260
11261    /// Required. The specification of the main method to call to drive the job.
11262    /// Specify either the jar file that contains the main class or the main class
11263    /// name. To pass both a main jar and a main class in that jar, add the jar to
11264    /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
11265    /// specify the main class name in
11266    /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
11267    ///
11268    /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
11269    /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
11270    pub driver: std::option::Option<crate::model::spark_job::Driver>,
11271
11272    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11273}
11274
11275impl SparkJob {
11276    /// Creates a new default instance.
11277    pub fn new() -> Self {
11278        std::default::Default::default()
11279    }
11280
11281    /// Sets the value of [args][crate::model::SparkJob::args].
11282    ///
11283    /// # Example
11284    /// ```ignore,no_run
11285    /// # use google_cloud_dataproc_v1::model::SparkJob;
11286    /// let x = SparkJob::new().set_args(["a", "b", "c"]);
11287    /// ```
11288    pub fn set_args<T, V>(mut self, v: T) -> Self
11289    where
11290        T: std::iter::IntoIterator<Item = V>,
11291        V: std::convert::Into<std::string::String>,
11292    {
11293        use std::iter::Iterator;
11294        self.args = v.into_iter().map(|i| i.into()).collect();
11295        self
11296    }
11297
11298    /// Sets the value of [jar_file_uris][crate::model::SparkJob::jar_file_uris].
11299    ///
11300    /// # Example
11301    /// ```ignore,no_run
11302    /// # use google_cloud_dataproc_v1::model::SparkJob;
11303    /// let x = SparkJob::new().set_jar_file_uris(["a", "b", "c"]);
11304    /// ```
11305    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11306    where
11307        T: std::iter::IntoIterator<Item = V>,
11308        V: std::convert::Into<std::string::String>,
11309    {
11310        use std::iter::Iterator;
11311        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11312        self
11313    }
11314
11315    /// Sets the value of [file_uris][crate::model::SparkJob::file_uris].
11316    ///
11317    /// # Example
11318    /// ```ignore,no_run
11319    /// # use google_cloud_dataproc_v1::model::SparkJob;
11320    /// let x = SparkJob::new().set_file_uris(["a", "b", "c"]);
11321    /// ```
11322    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11323    where
11324        T: std::iter::IntoIterator<Item = V>,
11325        V: std::convert::Into<std::string::String>,
11326    {
11327        use std::iter::Iterator;
11328        self.file_uris = v.into_iter().map(|i| i.into()).collect();
11329        self
11330    }
11331
11332    /// Sets the value of [archive_uris][crate::model::SparkJob::archive_uris].
11333    ///
11334    /// # Example
11335    /// ```ignore,no_run
11336    /// # use google_cloud_dataproc_v1::model::SparkJob;
11337    /// let x = SparkJob::new().set_archive_uris(["a", "b", "c"]);
11338    /// ```
11339    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11340    where
11341        T: std::iter::IntoIterator<Item = V>,
11342        V: std::convert::Into<std::string::String>,
11343    {
11344        use std::iter::Iterator;
11345        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11346        self
11347    }
11348
11349    /// Sets the value of [properties][crate::model::SparkJob::properties].
11350    ///
11351    /// # Example
11352    /// ```ignore,no_run
11353    /// # use google_cloud_dataproc_v1::model::SparkJob;
11354    /// let x = SparkJob::new().set_properties([
11355    ///     ("key0", "abc"),
11356    ///     ("key1", "xyz"),
11357    /// ]);
11358    /// ```
11359    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11360    where
11361        T: std::iter::IntoIterator<Item = (K, V)>,
11362        K: std::convert::Into<std::string::String>,
11363        V: std::convert::Into<std::string::String>,
11364    {
11365        use std::iter::Iterator;
11366        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11367        self
11368    }
11369
11370    /// Sets the value of [logging_config][crate::model::SparkJob::logging_config].
11371    ///
11372    /// # Example
11373    /// ```ignore,no_run
11374    /// # use google_cloud_dataproc_v1::model::SparkJob;
11375    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11376    /// let x = SparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11377    /// ```
11378    pub fn set_logging_config<T>(mut self, v: T) -> Self
11379    where
11380        T: std::convert::Into<crate::model::LoggingConfig>,
11381    {
11382        self.logging_config = std::option::Option::Some(v.into());
11383        self
11384    }
11385
11386    /// Sets or clears the value of [logging_config][crate::model::SparkJob::logging_config].
11387    ///
11388    /// # Example
11389    /// ```ignore,no_run
11390    /// # use google_cloud_dataproc_v1::model::SparkJob;
11391    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11392    /// let x = SparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11393    /// let x = SparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11394    /// ```
11395    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11396    where
11397        T: std::convert::Into<crate::model::LoggingConfig>,
11398    {
11399        self.logging_config = v.map(|x| x.into());
11400        self
11401    }
11402
11403    /// Sets the value of [driver][crate::model::SparkJob::driver].
11404    ///
11405    /// Note that all the setters affecting `driver` are mutually
11406    /// exclusive.
11407    ///
11408    /// # Example
11409    /// ```ignore,no_run
11410    /// # use google_cloud_dataproc_v1::model::SparkJob;
11411    /// use google_cloud_dataproc_v1::model::spark_job::Driver;
11412    /// let x = SparkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
11413    /// ```
11414    pub fn set_driver<
11415        T: std::convert::Into<std::option::Option<crate::model::spark_job::Driver>>,
11416    >(
11417        mut self,
11418        v: T,
11419    ) -> Self {
11420        self.driver = v.into();
11421        self
11422    }
11423
11424    /// The value of [driver][crate::model::SparkJob::driver]
11425    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
11426    /// holds a different branch.
11427    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
11428        #[allow(unreachable_patterns)]
11429        self.driver.as_ref().and_then(|v| match v {
11430            crate::model::spark_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
11431            _ => std::option::Option::None,
11432        })
11433    }
11434
11435    /// Sets the value of [driver][crate::model::SparkJob::driver]
11436    /// to hold a `MainJarFileUri`.
11437    ///
11438    /// Note that all the setters affecting `driver` are
11439    /// mutually exclusive.
11440    ///
11441    /// # Example
11442    /// ```ignore,no_run
11443    /// # use google_cloud_dataproc_v1::model::SparkJob;
11444    /// let x = SparkJob::new().set_main_jar_file_uri("example");
11445    /// assert!(x.main_jar_file_uri().is_some());
11446    /// assert!(x.main_class().is_none());
11447    /// ```
11448    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
11449        mut self,
11450        v: T,
11451    ) -> Self {
11452        self.driver =
11453            std::option::Option::Some(crate::model::spark_job::Driver::MainJarFileUri(v.into()));
11454        self
11455    }
11456
11457    /// The value of [driver][crate::model::SparkJob::driver]
11458    /// if it holds a `MainClass`, `None` if the field is not set or
11459    /// holds a different branch.
11460    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
11461        #[allow(unreachable_patterns)]
11462        self.driver.as_ref().and_then(|v| match v {
11463            crate::model::spark_job::Driver::MainClass(v) => std::option::Option::Some(v),
11464            _ => std::option::Option::None,
11465        })
11466    }
11467
11468    /// Sets the value of [driver][crate::model::SparkJob::driver]
11469    /// to hold a `MainClass`.
11470    ///
11471    /// Note that all the setters affecting `driver` are
11472    /// mutually exclusive.
11473    ///
11474    /// # Example
11475    /// ```ignore,no_run
11476    /// # use google_cloud_dataproc_v1::model::SparkJob;
11477    /// let x = SparkJob::new().set_main_class("example");
11478    /// assert!(x.main_class().is_some());
11479    /// assert!(x.main_jar_file_uri().is_none());
11480    /// ```
11481    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11482        self.driver =
11483            std::option::Option::Some(crate::model::spark_job::Driver::MainClass(v.into()));
11484        self
11485    }
11486}
11487
11488impl wkt::message::Message for SparkJob {
11489    fn typename() -> &'static str {
11490        "type.googleapis.com/google.cloud.dataproc.v1.SparkJob"
11491    }
11492}
11493
11494/// Defines additional types related to [SparkJob].
11495pub mod spark_job {
11496    #[allow(unused_imports)]
11497    use super::*;
11498
11499    /// Required. The specification of the main method to call to drive the job.
11500    /// Specify either the jar file that contains the main class or the main class
11501    /// name. To pass both a main jar and a main class in that jar, add the jar to
11502    /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
11503    /// specify the main class name in
11504    /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
11505    ///
11506    /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
11507    /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
11508    #[derive(Clone, Debug, PartialEq)]
11509    #[non_exhaustive]
11510    pub enum Driver {
11511        /// The HCFS URI of the jar file that contains the main class.
11512        MainJarFileUri(std::string::String),
11513        /// The name of the driver's main class. The jar file that contains the class
11514        /// must be in the default CLASSPATH or specified in
11515        /// SparkJob.jar_file_uris.
11516        MainClass(std::string::String),
11517    }
11518}
11519
11520/// A Dataproc job for running
11521/// [Apache
11522/// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html)
11523/// applications on YARN.
11524#[derive(Clone, Default, PartialEq)]
11525#[non_exhaustive]
11526pub struct PySparkJob {
11527    /// Required. The HCFS URI of the main Python file to use as the driver. Must
11528    /// be a .py file.
11529    pub main_python_file_uri: std::string::String,
11530
11531    /// Optional. The arguments to pass to the driver.  Do not include arguments,
11532    /// such as `--conf`, that can be set as job properties, since a collision may
11533    /// occur that causes an incorrect job submission.
11534    pub args: std::vec::Vec<std::string::String>,
11535
11536    /// Optional. HCFS file URIs of Python files to pass to the PySpark
11537    /// framework. Supported file types: .py, .egg, and .zip.
11538    pub python_file_uris: std::vec::Vec<std::string::String>,
11539
11540    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
11541    /// Python driver and tasks.
11542    pub jar_file_uris: std::vec::Vec<std::string::String>,
11543
11544    /// Optional. HCFS URIs of files to be placed in the working directory of
11545    /// each executor. Useful for naively parallel tasks.
11546    pub file_uris: std::vec::Vec<std::string::String>,
11547
11548    /// Optional. HCFS URIs of archives to be extracted into the working directory
11549    /// of each executor. Supported file types:
11550    /// .jar, .tar, .tar.gz, .tgz, and .zip.
11551    pub archive_uris: std::vec::Vec<std::string::String>,
11552
11553    /// Optional. A mapping of property names to values, used to configure PySpark.
11554    /// Properties that conflict with values set by the Dataproc API might be
11555    /// overwritten. Can include properties set in
11556    /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11557    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11558
11559    /// Optional. The runtime log config for job execution.
11560    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11561
11562    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11563}
11564
11565impl PySparkJob {
11566    /// Creates a new default instance.
11567    pub fn new() -> Self {
11568        std::default::Default::default()
11569    }
11570
11571    /// Sets the value of [main_python_file_uri][crate::model::PySparkJob::main_python_file_uri].
11572    ///
11573    /// # Example
11574    /// ```ignore,no_run
11575    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11576    /// let x = PySparkJob::new().set_main_python_file_uri("example");
11577    /// ```
11578    pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
11579        mut self,
11580        v: T,
11581    ) -> Self {
11582        self.main_python_file_uri = v.into();
11583        self
11584    }
11585
11586    /// Sets the value of [args][crate::model::PySparkJob::args].
11587    ///
11588    /// # Example
11589    /// ```ignore,no_run
11590    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11591    /// let x = PySparkJob::new().set_args(["a", "b", "c"]);
11592    /// ```
11593    pub fn set_args<T, V>(mut self, v: T) -> Self
11594    where
11595        T: std::iter::IntoIterator<Item = V>,
11596        V: std::convert::Into<std::string::String>,
11597    {
11598        use std::iter::Iterator;
11599        self.args = v.into_iter().map(|i| i.into()).collect();
11600        self
11601    }
11602
11603    /// Sets the value of [python_file_uris][crate::model::PySparkJob::python_file_uris].
11604    ///
11605    /// # Example
11606    /// ```ignore,no_run
11607    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11608    /// let x = PySparkJob::new().set_python_file_uris(["a", "b", "c"]);
11609    /// ```
11610    pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
11611    where
11612        T: std::iter::IntoIterator<Item = V>,
11613        V: std::convert::Into<std::string::String>,
11614    {
11615        use std::iter::Iterator;
11616        self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
11617        self
11618    }
11619
11620    /// Sets the value of [jar_file_uris][crate::model::PySparkJob::jar_file_uris].
11621    ///
11622    /// # Example
11623    /// ```ignore,no_run
11624    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11625    /// let x = PySparkJob::new().set_jar_file_uris(["a", "b", "c"]);
11626    /// ```
11627    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11628    where
11629        T: std::iter::IntoIterator<Item = V>,
11630        V: std::convert::Into<std::string::String>,
11631    {
11632        use std::iter::Iterator;
11633        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11634        self
11635    }
11636
11637    /// Sets the value of [file_uris][crate::model::PySparkJob::file_uris].
11638    ///
11639    /// # Example
11640    /// ```ignore,no_run
11641    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11642    /// let x = PySparkJob::new().set_file_uris(["a", "b", "c"]);
11643    /// ```
11644    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11645    where
11646        T: std::iter::IntoIterator<Item = V>,
11647        V: std::convert::Into<std::string::String>,
11648    {
11649        use std::iter::Iterator;
11650        self.file_uris = v.into_iter().map(|i| i.into()).collect();
11651        self
11652    }
11653
11654    /// Sets the value of [archive_uris][crate::model::PySparkJob::archive_uris].
11655    ///
11656    /// # Example
11657    /// ```ignore,no_run
11658    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11659    /// let x = PySparkJob::new().set_archive_uris(["a", "b", "c"]);
11660    /// ```
11661    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11662    where
11663        T: std::iter::IntoIterator<Item = V>,
11664        V: std::convert::Into<std::string::String>,
11665    {
11666        use std::iter::Iterator;
11667        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11668        self
11669    }
11670
11671    /// Sets the value of [properties][crate::model::PySparkJob::properties].
11672    ///
11673    /// # Example
11674    /// ```ignore,no_run
11675    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11676    /// let x = PySparkJob::new().set_properties([
11677    ///     ("key0", "abc"),
11678    ///     ("key1", "xyz"),
11679    /// ]);
11680    /// ```
11681    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11682    where
11683        T: std::iter::IntoIterator<Item = (K, V)>,
11684        K: std::convert::Into<std::string::String>,
11685        V: std::convert::Into<std::string::String>,
11686    {
11687        use std::iter::Iterator;
11688        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11689        self
11690    }
11691
11692    /// Sets the value of [logging_config][crate::model::PySparkJob::logging_config].
11693    ///
11694    /// # Example
11695    /// ```ignore,no_run
11696    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11697    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11698    /// let x = PySparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11699    /// ```
11700    pub fn set_logging_config<T>(mut self, v: T) -> Self
11701    where
11702        T: std::convert::Into<crate::model::LoggingConfig>,
11703    {
11704        self.logging_config = std::option::Option::Some(v.into());
11705        self
11706    }
11707
11708    /// Sets or clears the value of [logging_config][crate::model::PySparkJob::logging_config].
11709    ///
11710    /// # Example
11711    /// ```ignore,no_run
11712    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11713    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11714    /// let x = PySparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11715    /// let x = PySparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11716    /// ```
11717    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11718    where
11719        T: std::convert::Into<crate::model::LoggingConfig>,
11720    {
11721        self.logging_config = v.map(|x| x.into());
11722        self
11723    }
11724}
11725
11726impl wkt::message::Message for PySparkJob {
11727    fn typename() -> &'static str {
11728        "type.googleapis.com/google.cloud.dataproc.v1.PySparkJob"
11729    }
11730}
11731
11732/// A list of queries to run on a cluster.
11733#[derive(Clone, Default, PartialEq)]
11734#[non_exhaustive]
11735pub struct QueryList {
11736    /// Required. The queries to execute. You do not need to end a query expression
11737    /// with a semicolon. Multiple queries can be specified in one
11738    /// string by separating each with a semicolon. Here is an example of a
11739    /// Dataproc API snippet that uses a QueryList to specify a HiveJob:
11740    ///
11741    /// ```norust
11742    /// "hiveJob": {
11743    ///   "queryList": {
11744    ///     "queries": [
11745    ///       "query1",
11746    ///       "query2",
11747    ///       "query3;query4",
11748    ///     ]
11749    ///   }
11750    /// }
11751    /// ```
11752    pub queries: std::vec::Vec<std::string::String>,
11753
11754    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11755}
11756
11757impl QueryList {
11758    /// Creates a new default instance.
11759    pub fn new() -> Self {
11760        std::default::Default::default()
11761    }
11762
11763    /// Sets the value of [queries][crate::model::QueryList::queries].
11764    ///
11765    /// # Example
11766    /// ```ignore,no_run
11767    /// # use google_cloud_dataproc_v1::model::QueryList;
11768    /// let x = QueryList::new().set_queries(["a", "b", "c"]);
11769    /// ```
11770    pub fn set_queries<T, V>(mut self, v: T) -> Self
11771    where
11772        T: std::iter::IntoIterator<Item = V>,
11773        V: std::convert::Into<std::string::String>,
11774    {
11775        use std::iter::Iterator;
11776        self.queries = v.into_iter().map(|i| i.into()).collect();
11777        self
11778    }
11779}
11780
11781impl wkt::message::Message for QueryList {
11782    fn typename() -> &'static str {
11783        "type.googleapis.com/google.cloud.dataproc.v1.QueryList"
11784    }
11785}
11786
11787/// A Dataproc job for running [Apache Hive](https://hive.apache.org/)
11788/// queries on YARN.
11789#[derive(Clone, Default, PartialEq)]
11790#[non_exhaustive]
11791pub struct HiveJob {
11792    /// Optional. Whether to continue executing queries if a query fails.
11793    /// The default value is `false`. Setting to `true` can be useful when
11794    /// executing independent parallel queries.
11795    pub continue_on_failure: bool,
11796
11797    /// Optional. Mapping of query variable names to values (equivalent to the
11798    /// Hive command: `SET name="value";`).
11799    pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11800
11801    /// Optional. A mapping of property names and values, used to configure Hive.
11802    /// Properties that conflict with values set by the Dataproc API might be
11803    /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11804    /// /etc/hive/conf/hive-site.xml, and classes in user code.
11805    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11806
11807    /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the
11808    /// Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes
11809    /// and UDFs.
11810    pub jar_file_uris: std::vec::Vec<std::string::String>,
11811
11812    /// Required. The sequence of Hive queries to execute, specified as either
11813    /// an HCFS file URI or a list of queries.
11814    pub queries: std::option::Option<crate::model::hive_job::Queries>,
11815
11816    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11817}
11818
11819impl HiveJob {
11820    /// Creates a new default instance.
11821    pub fn new() -> Self {
11822        std::default::Default::default()
11823    }
11824
11825    /// Sets the value of [continue_on_failure][crate::model::HiveJob::continue_on_failure].
11826    ///
11827    /// # Example
11828    /// ```ignore,no_run
11829    /// # use google_cloud_dataproc_v1::model::HiveJob;
11830    /// let x = HiveJob::new().set_continue_on_failure(true);
11831    /// ```
11832    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11833        self.continue_on_failure = v.into();
11834        self
11835    }
11836
11837    /// Sets the value of [script_variables][crate::model::HiveJob::script_variables].
11838    ///
11839    /// # Example
11840    /// ```ignore,no_run
11841    /// # use google_cloud_dataproc_v1::model::HiveJob;
11842    /// let x = HiveJob::new().set_script_variables([
11843    ///     ("key0", "abc"),
11844    ///     ("key1", "xyz"),
11845    /// ]);
11846    /// ```
11847    pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11848    where
11849        T: std::iter::IntoIterator<Item = (K, V)>,
11850        K: std::convert::Into<std::string::String>,
11851        V: std::convert::Into<std::string::String>,
11852    {
11853        use std::iter::Iterator;
11854        self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11855        self
11856    }
11857
11858    /// Sets the value of [properties][crate::model::HiveJob::properties].
11859    ///
11860    /// # Example
11861    /// ```ignore,no_run
11862    /// # use google_cloud_dataproc_v1::model::HiveJob;
11863    /// let x = HiveJob::new().set_properties([
11864    ///     ("key0", "abc"),
11865    ///     ("key1", "xyz"),
11866    /// ]);
11867    /// ```
11868    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11869    where
11870        T: std::iter::IntoIterator<Item = (K, V)>,
11871        K: std::convert::Into<std::string::String>,
11872        V: std::convert::Into<std::string::String>,
11873    {
11874        use std::iter::Iterator;
11875        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11876        self
11877    }
11878
11879    /// Sets the value of [jar_file_uris][crate::model::HiveJob::jar_file_uris].
11880    ///
11881    /// # Example
11882    /// ```ignore,no_run
11883    /// # use google_cloud_dataproc_v1::model::HiveJob;
11884    /// let x = HiveJob::new().set_jar_file_uris(["a", "b", "c"]);
11885    /// ```
11886    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11887    where
11888        T: std::iter::IntoIterator<Item = V>,
11889        V: std::convert::Into<std::string::String>,
11890    {
11891        use std::iter::Iterator;
11892        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11893        self
11894    }
11895
11896    /// Sets the value of [queries][crate::model::HiveJob::queries].
11897    ///
11898    /// Note that all the setters affecting `queries` are mutually
11899    /// exclusive.
11900    ///
11901    /// # Example
11902    /// ```ignore,no_run
11903    /// # use google_cloud_dataproc_v1::model::HiveJob;
11904    /// use google_cloud_dataproc_v1::model::hive_job::Queries;
11905    /// let x = HiveJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11906    /// ```
11907    pub fn set_queries<
11908        T: std::convert::Into<std::option::Option<crate::model::hive_job::Queries>>,
11909    >(
11910        mut self,
11911        v: T,
11912    ) -> Self {
11913        self.queries = v.into();
11914        self
11915    }
11916
11917    /// The value of [queries][crate::model::HiveJob::queries]
11918    /// if it holds a `QueryFileUri`, `None` if the field is not set or
11919    /// holds a different branch.
11920    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11921        #[allow(unreachable_patterns)]
11922        self.queries.as_ref().and_then(|v| match v {
11923            crate::model::hive_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11924            _ => std::option::Option::None,
11925        })
11926    }
11927
11928    /// Sets the value of [queries][crate::model::HiveJob::queries]
11929    /// to hold a `QueryFileUri`.
11930    ///
11931    /// Note that all the setters affecting `queries` are
11932    /// mutually exclusive.
11933    ///
11934    /// # Example
11935    /// ```ignore,no_run
11936    /// # use google_cloud_dataproc_v1::model::HiveJob;
11937    /// let x = HiveJob::new().set_query_file_uri("example");
11938    /// assert!(x.query_file_uri().is_some());
11939    /// assert!(x.query_list().is_none());
11940    /// ```
11941    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11942        self.queries =
11943            std::option::Option::Some(crate::model::hive_job::Queries::QueryFileUri(v.into()));
11944        self
11945    }
11946
11947    /// The value of [queries][crate::model::HiveJob::queries]
11948    /// if it holds a `QueryList`, `None` if the field is not set or
11949    /// holds a different branch.
11950    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11951        #[allow(unreachable_patterns)]
11952        self.queries.as_ref().and_then(|v| match v {
11953            crate::model::hive_job::Queries::QueryList(v) => std::option::Option::Some(v),
11954            _ => std::option::Option::None,
11955        })
11956    }
11957
11958    /// Sets the value of [queries][crate::model::HiveJob::queries]
11959    /// to hold a `QueryList`.
11960    ///
11961    /// Note that all the setters affecting `queries` are
11962    /// mutually exclusive.
11963    ///
11964    /// # Example
11965    /// ```ignore,no_run
11966    /// # use google_cloud_dataproc_v1::model::HiveJob;
11967    /// use google_cloud_dataproc_v1::model::QueryList;
11968    /// let x = HiveJob::new().set_query_list(QueryList::default()/* use setters */);
11969    /// assert!(x.query_list().is_some());
11970    /// assert!(x.query_file_uri().is_none());
11971    /// ```
11972    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11973        mut self,
11974        v: T,
11975    ) -> Self {
11976        self.queries =
11977            std::option::Option::Some(crate::model::hive_job::Queries::QueryList(v.into()));
11978        self
11979    }
11980}
11981
11982impl wkt::message::Message for HiveJob {
11983    fn typename() -> &'static str {
11984        "type.googleapis.com/google.cloud.dataproc.v1.HiveJob"
11985    }
11986}
11987
11988/// Defines additional types related to [HiveJob].
11989pub mod hive_job {
11990    #[allow(unused_imports)]
11991    use super::*;
11992
11993    /// Required. The sequence of Hive queries to execute, specified as either
11994    /// an HCFS file URI or a list of queries.
11995    #[derive(Clone, Debug, PartialEq)]
11996    #[non_exhaustive]
11997    pub enum Queries {
11998        /// The HCFS URI of the script that contains Hive queries.
11999        QueryFileUri(std::string::String),
12000        /// A list of queries.
12001        QueryList(std::boxed::Box<crate::model::QueryList>),
12002    }
12003}
12004
12005/// A Dataproc job for running [Apache Spark
12006/// SQL](https://spark.apache.org/sql/) queries.
12007#[derive(Clone, Default, PartialEq)]
12008#[non_exhaustive]
12009pub struct SparkSqlJob {
12010    /// Optional. Mapping of query variable names to values (equivalent to the
12011    /// Spark SQL command: SET `name="value";`).
12012    pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
12013
12014    /// Optional. A mapping of property names to values, used to configure
12015    /// Spark SQL's SparkConf. Properties that conflict with values set by the
12016    /// Dataproc API might be overwritten.
12017    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12018
12019    /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
12020    pub jar_file_uris: std::vec::Vec<std::string::String>,
12021
12022    /// Optional. The runtime log config for job execution.
12023    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12024
12025    /// Required. The sequence of Spark SQL queries to execute, specified as
12026    /// either an HCFS file URI or as a list of queries.
12027    pub queries: std::option::Option<crate::model::spark_sql_job::Queries>,
12028
12029    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12030}
12031
12032impl SparkSqlJob {
12033    /// Creates a new default instance.
12034    pub fn new() -> Self {
12035        std::default::Default::default()
12036    }
12037
12038    /// Sets the value of [script_variables][crate::model::SparkSqlJob::script_variables].
12039    ///
12040    /// # Example
12041    /// ```ignore,no_run
12042    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12043    /// let x = SparkSqlJob::new().set_script_variables([
12044    ///     ("key0", "abc"),
12045    ///     ("key1", "xyz"),
12046    /// ]);
12047    /// ```
12048    pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
12049    where
12050        T: std::iter::IntoIterator<Item = (K, V)>,
12051        K: std::convert::Into<std::string::String>,
12052        V: std::convert::Into<std::string::String>,
12053    {
12054        use std::iter::Iterator;
12055        self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12056        self
12057    }
12058
12059    /// Sets the value of [properties][crate::model::SparkSqlJob::properties].
12060    ///
12061    /// # Example
12062    /// ```ignore,no_run
12063    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12064    /// let x = SparkSqlJob::new().set_properties([
12065    ///     ("key0", "abc"),
12066    ///     ("key1", "xyz"),
12067    /// ]);
12068    /// ```
12069    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12070    where
12071        T: std::iter::IntoIterator<Item = (K, V)>,
12072        K: std::convert::Into<std::string::String>,
12073        V: std::convert::Into<std::string::String>,
12074    {
12075        use std::iter::Iterator;
12076        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12077        self
12078    }
12079
12080    /// Sets the value of [jar_file_uris][crate::model::SparkSqlJob::jar_file_uris].
12081    ///
12082    /// # Example
12083    /// ```ignore,no_run
12084    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12085    /// let x = SparkSqlJob::new().set_jar_file_uris(["a", "b", "c"]);
12086    /// ```
12087    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12088    where
12089        T: std::iter::IntoIterator<Item = V>,
12090        V: std::convert::Into<std::string::String>,
12091    {
12092        use std::iter::Iterator;
12093        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12094        self
12095    }
12096
12097    /// Sets the value of [logging_config][crate::model::SparkSqlJob::logging_config].
12098    ///
12099    /// # Example
12100    /// ```ignore,no_run
12101    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12102    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12103    /// let x = SparkSqlJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12104    /// ```
12105    pub fn set_logging_config<T>(mut self, v: T) -> Self
12106    where
12107        T: std::convert::Into<crate::model::LoggingConfig>,
12108    {
12109        self.logging_config = std::option::Option::Some(v.into());
12110        self
12111    }
12112
12113    /// Sets or clears the value of [logging_config][crate::model::SparkSqlJob::logging_config].
12114    ///
12115    /// # Example
12116    /// ```ignore,no_run
12117    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12118    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12119    /// let x = SparkSqlJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12120    /// let x = SparkSqlJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12121    /// ```
12122    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12123    where
12124        T: std::convert::Into<crate::model::LoggingConfig>,
12125    {
12126        self.logging_config = v.map(|x| x.into());
12127        self
12128    }
12129
12130    /// Sets the value of [queries][crate::model::SparkSqlJob::queries].
12131    ///
12132    /// Note that all the setters affecting `queries` are mutually
12133    /// exclusive.
12134    ///
12135    /// # Example
12136    /// ```ignore,no_run
12137    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12138    /// use google_cloud_dataproc_v1::model::spark_sql_job::Queries;
12139    /// let x = SparkSqlJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12140    /// ```
12141    pub fn set_queries<
12142        T: std::convert::Into<std::option::Option<crate::model::spark_sql_job::Queries>>,
12143    >(
12144        mut self,
12145        v: T,
12146    ) -> Self {
12147        self.queries = v.into();
12148        self
12149    }
12150
12151    /// The value of [queries][crate::model::SparkSqlJob::queries]
12152    /// if it holds a `QueryFileUri`, `None` if the field is not set or
12153    /// holds a different branch.
12154    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12155        #[allow(unreachable_patterns)]
12156        self.queries.as_ref().and_then(|v| match v {
12157            crate::model::spark_sql_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12158            _ => std::option::Option::None,
12159        })
12160    }
12161
12162    /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
12163    /// to hold a `QueryFileUri`.
12164    ///
12165    /// Note that all the setters affecting `queries` are
12166    /// mutually exclusive.
12167    ///
12168    /// # Example
12169    /// ```ignore,no_run
12170    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12171    /// let x = SparkSqlJob::new().set_query_file_uri("example");
12172    /// assert!(x.query_file_uri().is_some());
12173    /// assert!(x.query_list().is_none());
12174    /// ```
12175    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12176        self.queries =
12177            std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryFileUri(v.into()));
12178        self
12179    }
12180
12181    /// The value of [queries][crate::model::SparkSqlJob::queries]
12182    /// if it holds a `QueryList`, `None` if the field is not set or
12183    /// holds a different branch.
12184    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12185        #[allow(unreachable_patterns)]
12186        self.queries.as_ref().and_then(|v| match v {
12187            crate::model::spark_sql_job::Queries::QueryList(v) => std::option::Option::Some(v),
12188            _ => std::option::Option::None,
12189        })
12190    }
12191
12192    /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
12193    /// to hold a `QueryList`.
12194    ///
12195    /// Note that all the setters affecting `queries` are
12196    /// mutually exclusive.
12197    ///
12198    /// # Example
12199    /// ```ignore,no_run
12200    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12201    /// use google_cloud_dataproc_v1::model::QueryList;
12202    /// let x = SparkSqlJob::new().set_query_list(QueryList::default()/* use setters */);
12203    /// assert!(x.query_list().is_some());
12204    /// assert!(x.query_file_uri().is_none());
12205    /// ```
12206    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12207        mut self,
12208        v: T,
12209    ) -> Self {
12210        self.queries =
12211            std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryList(v.into()));
12212        self
12213    }
12214}
12215
12216impl wkt::message::Message for SparkSqlJob {
12217    fn typename() -> &'static str {
12218        "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlJob"
12219    }
12220}
12221
12222/// Defines additional types related to [SparkSqlJob].
12223pub mod spark_sql_job {
12224    #[allow(unused_imports)]
12225    use super::*;
12226
12227    /// Required. The sequence of Spark SQL queries to execute, specified as
12228    /// either an HCFS file URI or as a list of queries.
12229    #[derive(Clone, Debug, PartialEq)]
12230    #[non_exhaustive]
12231    pub enum Queries {
12232        /// The HCFS URI of the script that contains SQL queries.
12233        QueryFileUri(std::string::String),
12234        /// A list of queries.
12235        QueryList(std::boxed::Box<crate::model::QueryList>),
12236    }
12237}
12238
12239/// A Dataproc job for running [Apache Pig](https://pig.apache.org/)
12240/// queries on YARN.
12241#[derive(Clone, Default, PartialEq)]
12242#[non_exhaustive]
12243pub struct PigJob {
12244    /// Optional. Whether to continue executing queries if a query fails.
12245    /// The default value is `false`. Setting to `true` can be useful when
12246    /// executing independent parallel queries.
12247    pub continue_on_failure: bool,
12248
12249    /// Optional. Mapping of query variable names to values (equivalent to the Pig
12250    /// command: `name=[value]`).
12251    pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
12252
12253    /// Optional. A mapping of property names to values, used to configure Pig.
12254    /// Properties that conflict with values set by the Dataproc API might be
12255    /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
12256    /// /etc/pig/conf/pig.properties, and classes in user code.
12257    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12258
12259    /// Optional. HCFS URIs of jar files to add to the CLASSPATH of
12260    /// the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
12261    pub jar_file_uris: std::vec::Vec<std::string::String>,
12262
12263    /// Optional. The runtime log config for job execution.
12264    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12265
12266    /// Required. The sequence of Pig queries to execute, specified as an HCFS
12267    /// file URI or a list of queries.
12268    pub queries: std::option::Option<crate::model::pig_job::Queries>,
12269
12270    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12271}
12272
12273impl PigJob {
12274    /// Creates a new default instance.
12275    pub fn new() -> Self {
12276        std::default::Default::default()
12277    }
12278
12279    /// Sets the value of [continue_on_failure][crate::model::PigJob::continue_on_failure].
12280    ///
12281    /// # Example
12282    /// ```ignore,no_run
12283    /// # use google_cloud_dataproc_v1::model::PigJob;
12284    /// let x = PigJob::new().set_continue_on_failure(true);
12285    /// ```
12286    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12287        self.continue_on_failure = v.into();
12288        self
12289    }
12290
12291    /// Sets the value of [script_variables][crate::model::PigJob::script_variables].
12292    ///
12293    /// # Example
12294    /// ```ignore,no_run
12295    /// # use google_cloud_dataproc_v1::model::PigJob;
12296    /// let x = PigJob::new().set_script_variables([
12297    ///     ("key0", "abc"),
12298    ///     ("key1", "xyz"),
12299    /// ]);
12300    /// ```
12301    pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
12302    where
12303        T: std::iter::IntoIterator<Item = (K, V)>,
12304        K: std::convert::Into<std::string::String>,
12305        V: std::convert::Into<std::string::String>,
12306    {
12307        use std::iter::Iterator;
12308        self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12309        self
12310    }
12311
12312    /// Sets the value of [properties][crate::model::PigJob::properties].
12313    ///
12314    /// # Example
12315    /// ```ignore,no_run
12316    /// # use google_cloud_dataproc_v1::model::PigJob;
12317    /// let x = PigJob::new().set_properties([
12318    ///     ("key0", "abc"),
12319    ///     ("key1", "xyz"),
12320    /// ]);
12321    /// ```
12322    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12323    where
12324        T: std::iter::IntoIterator<Item = (K, V)>,
12325        K: std::convert::Into<std::string::String>,
12326        V: std::convert::Into<std::string::String>,
12327    {
12328        use std::iter::Iterator;
12329        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12330        self
12331    }
12332
12333    /// Sets the value of [jar_file_uris][crate::model::PigJob::jar_file_uris].
12334    ///
12335    /// # Example
12336    /// ```ignore,no_run
12337    /// # use google_cloud_dataproc_v1::model::PigJob;
12338    /// let x = PigJob::new().set_jar_file_uris(["a", "b", "c"]);
12339    /// ```
12340    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12341    where
12342        T: std::iter::IntoIterator<Item = V>,
12343        V: std::convert::Into<std::string::String>,
12344    {
12345        use std::iter::Iterator;
12346        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12347        self
12348    }
12349
12350    /// Sets the value of [logging_config][crate::model::PigJob::logging_config].
12351    ///
12352    /// # Example
12353    /// ```ignore,no_run
12354    /// # use google_cloud_dataproc_v1::model::PigJob;
12355    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12356    /// let x = PigJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12357    /// ```
12358    pub fn set_logging_config<T>(mut self, v: T) -> Self
12359    where
12360        T: std::convert::Into<crate::model::LoggingConfig>,
12361    {
12362        self.logging_config = std::option::Option::Some(v.into());
12363        self
12364    }
12365
12366    /// Sets or clears the value of [logging_config][crate::model::PigJob::logging_config].
12367    ///
12368    /// # Example
12369    /// ```ignore,no_run
12370    /// # use google_cloud_dataproc_v1::model::PigJob;
12371    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12372    /// let x = PigJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12373    /// let x = PigJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12374    /// ```
12375    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12376    where
12377        T: std::convert::Into<crate::model::LoggingConfig>,
12378    {
12379        self.logging_config = v.map(|x| x.into());
12380        self
12381    }
12382
12383    /// Sets the value of [queries][crate::model::PigJob::queries].
12384    ///
12385    /// Note that all the setters affecting `queries` are mutually
12386    /// exclusive.
12387    ///
12388    /// # Example
12389    /// ```ignore,no_run
12390    /// # use google_cloud_dataproc_v1::model::PigJob;
12391    /// use google_cloud_dataproc_v1::model::pig_job::Queries;
12392    /// let x = PigJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12393    /// ```
12394    pub fn set_queries<
12395        T: std::convert::Into<std::option::Option<crate::model::pig_job::Queries>>,
12396    >(
12397        mut self,
12398        v: T,
12399    ) -> Self {
12400        self.queries = v.into();
12401        self
12402    }
12403
12404    /// The value of [queries][crate::model::PigJob::queries]
12405    /// if it holds a `QueryFileUri`, `None` if the field is not set or
12406    /// holds a different branch.
12407    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12408        #[allow(unreachable_patterns)]
12409        self.queries.as_ref().and_then(|v| match v {
12410            crate::model::pig_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12411            _ => std::option::Option::None,
12412        })
12413    }
12414
12415    /// Sets the value of [queries][crate::model::PigJob::queries]
12416    /// to hold a `QueryFileUri`.
12417    ///
12418    /// Note that all the setters affecting `queries` are
12419    /// mutually exclusive.
12420    ///
12421    /// # Example
12422    /// ```ignore,no_run
12423    /// # use google_cloud_dataproc_v1::model::PigJob;
12424    /// let x = PigJob::new().set_query_file_uri("example");
12425    /// assert!(x.query_file_uri().is_some());
12426    /// assert!(x.query_list().is_none());
12427    /// ```
12428    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12429        self.queries =
12430            std::option::Option::Some(crate::model::pig_job::Queries::QueryFileUri(v.into()));
12431        self
12432    }
12433
12434    /// The value of [queries][crate::model::PigJob::queries]
12435    /// if it holds a `QueryList`, `None` if the field is not set or
12436    /// holds a different branch.
12437    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12438        #[allow(unreachable_patterns)]
12439        self.queries.as_ref().and_then(|v| match v {
12440            crate::model::pig_job::Queries::QueryList(v) => std::option::Option::Some(v),
12441            _ => std::option::Option::None,
12442        })
12443    }
12444
12445    /// Sets the value of [queries][crate::model::PigJob::queries]
12446    /// to hold a `QueryList`.
12447    ///
12448    /// Note that all the setters affecting `queries` are
12449    /// mutually exclusive.
12450    ///
12451    /// # Example
12452    /// ```ignore,no_run
12453    /// # use google_cloud_dataproc_v1::model::PigJob;
12454    /// use google_cloud_dataproc_v1::model::QueryList;
12455    /// let x = PigJob::new().set_query_list(QueryList::default()/* use setters */);
12456    /// assert!(x.query_list().is_some());
12457    /// assert!(x.query_file_uri().is_none());
12458    /// ```
12459    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12460        mut self,
12461        v: T,
12462    ) -> Self {
12463        self.queries =
12464            std::option::Option::Some(crate::model::pig_job::Queries::QueryList(v.into()));
12465        self
12466    }
12467}
12468
12469impl wkt::message::Message for PigJob {
12470    fn typename() -> &'static str {
12471        "type.googleapis.com/google.cloud.dataproc.v1.PigJob"
12472    }
12473}
12474
12475/// Defines additional types related to [PigJob].
12476pub mod pig_job {
12477    #[allow(unused_imports)]
12478    use super::*;
12479
12480    /// Required. The sequence of Pig queries to execute, specified as an HCFS
12481    /// file URI or a list of queries.
12482    #[derive(Clone, Debug, PartialEq)]
12483    #[non_exhaustive]
12484    pub enum Queries {
12485        /// The HCFS URI of the script that contains the Pig queries.
12486        QueryFileUri(std::string::String),
12487        /// A list of queries.
12488        QueryList(std::boxed::Box<crate::model::QueryList>),
12489    }
12490}
12491
12492/// A Dataproc job for running
12493/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
12494/// applications on YARN.
12495#[derive(Clone, Default, PartialEq)]
12496#[non_exhaustive]
12497pub struct SparkRJob {
12498    /// Required. The HCFS URI of the main R file to use as the driver.
12499    /// Must be a .R file.
12500    pub main_r_file_uri: std::string::String,
12501
12502    /// Optional. The arguments to pass to the driver.  Do not include arguments,
12503    /// such as `--conf`, that can be set as job properties, since a collision may
12504    /// occur that causes an incorrect job submission.
12505    pub args: std::vec::Vec<std::string::String>,
12506
12507    /// Optional. HCFS URIs of files to be placed in the working directory of
12508    /// each executor. Useful for naively parallel tasks.
12509    pub file_uris: std::vec::Vec<std::string::String>,
12510
12511    /// Optional. HCFS URIs of archives to be extracted into the working directory
12512    /// of each executor. Supported file types:
12513    /// .jar, .tar, .tar.gz, .tgz, and .zip.
12514    pub archive_uris: std::vec::Vec<std::string::String>,
12515
12516    /// Optional. A mapping of property names to values, used to configure SparkR.
12517    /// Properties that conflict with values set by the Dataproc API might be
12518    /// overwritten. Can include properties set in
12519    /// /etc/spark/conf/spark-defaults.conf and classes in user code.
12520    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12521
12522    /// Optional. The runtime log config for job execution.
12523    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12524
12525    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12526}
12527
12528impl SparkRJob {
12529    /// Creates a new default instance.
12530    pub fn new() -> Self {
12531        std::default::Default::default()
12532    }
12533
12534    /// Sets the value of [main_r_file_uri][crate::model::SparkRJob::main_r_file_uri].
12535    ///
12536    /// # Example
12537    /// ```ignore,no_run
12538    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12539    /// let x = SparkRJob::new().set_main_r_file_uri("example");
12540    /// ```
12541    pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12542        self.main_r_file_uri = v.into();
12543        self
12544    }
12545
12546    /// Sets the value of [args][crate::model::SparkRJob::args].
12547    ///
12548    /// # Example
12549    /// ```ignore,no_run
12550    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12551    /// let x = SparkRJob::new().set_args(["a", "b", "c"]);
12552    /// ```
12553    pub fn set_args<T, V>(mut self, v: T) -> Self
12554    where
12555        T: std::iter::IntoIterator<Item = V>,
12556        V: std::convert::Into<std::string::String>,
12557    {
12558        use std::iter::Iterator;
12559        self.args = v.into_iter().map(|i| i.into()).collect();
12560        self
12561    }
12562
12563    /// Sets the value of [file_uris][crate::model::SparkRJob::file_uris].
12564    ///
12565    /// # Example
12566    /// ```ignore,no_run
12567    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12568    /// let x = SparkRJob::new().set_file_uris(["a", "b", "c"]);
12569    /// ```
12570    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
12571    where
12572        T: std::iter::IntoIterator<Item = V>,
12573        V: std::convert::Into<std::string::String>,
12574    {
12575        use std::iter::Iterator;
12576        self.file_uris = v.into_iter().map(|i| i.into()).collect();
12577        self
12578    }
12579
12580    /// Sets the value of [archive_uris][crate::model::SparkRJob::archive_uris].
12581    ///
12582    /// # Example
12583    /// ```ignore,no_run
12584    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12585    /// let x = SparkRJob::new().set_archive_uris(["a", "b", "c"]);
12586    /// ```
12587    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
12588    where
12589        T: std::iter::IntoIterator<Item = V>,
12590        V: std::convert::Into<std::string::String>,
12591    {
12592        use std::iter::Iterator;
12593        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
12594        self
12595    }
12596
12597    /// Sets the value of [properties][crate::model::SparkRJob::properties].
12598    ///
12599    /// # Example
12600    /// ```ignore,no_run
12601    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12602    /// let x = SparkRJob::new().set_properties([
12603    ///     ("key0", "abc"),
12604    ///     ("key1", "xyz"),
12605    /// ]);
12606    /// ```
12607    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12608    where
12609        T: std::iter::IntoIterator<Item = (K, V)>,
12610        K: std::convert::Into<std::string::String>,
12611        V: std::convert::Into<std::string::String>,
12612    {
12613        use std::iter::Iterator;
12614        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12615        self
12616    }
12617
12618    /// Sets the value of [logging_config][crate::model::SparkRJob::logging_config].
12619    ///
12620    /// # Example
12621    /// ```ignore,no_run
12622    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12623    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12624    /// let x = SparkRJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12625    /// ```
12626    pub fn set_logging_config<T>(mut self, v: T) -> Self
12627    where
12628        T: std::convert::Into<crate::model::LoggingConfig>,
12629    {
12630        self.logging_config = std::option::Option::Some(v.into());
12631        self
12632    }
12633
12634    /// Sets or clears the value of [logging_config][crate::model::SparkRJob::logging_config].
12635    ///
12636    /// # Example
12637    /// ```ignore,no_run
12638    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12639    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12640    /// let x = SparkRJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12641    /// let x = SparkRJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12642    /// ```
12643    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12644    where
12645        T: std::convert::Into<crate::model::LoggingConfig>,
12646    {
12647        self.logging_config = v.map(|x| x.into());
12648        self
12649    }
12650}
12651
12652impl wkt::message::Message for SparkRJob {
12653    fn typename() -> &'static str {
12654        "type.googleapis.com/google.cloud.dataproc.v1.SparkRJob"
12655    }
12656}
12657
12658/// A Dataproc job for running [Presto](https://prestosql.io/) queries.
12659/// **IMPORTANT**: The [Dataproc Presto Optional
12660/// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto)
12661/// must be enabled when the cluster is created to submit a Presto job to the
12662/// cluster.
12663#[derive(Clone, Default, PartialEq)]
12664#[non_exhaustive]
12665pub struct PrestoJob {
12666    /// Optional. Whether to continue executing queries if a query fails.
12667    /// The default value is `false`. Setting to `true` can be useful when
12668    /// executing independent parallel queries.
12669    pub continue_on_failure: bool,
12670
12671    /// Optional. The format in which query output will be displayed. See the
12672    /// Presto documentation for supported output formats
12673    pub output_format: std::string::String,
12674
12675    /// Optional. Presto client tags to attach to this query
12676    pub client_tags: std::vec::Vec<std::string::String>,
12677
12678    /// Optional. A mapping of property names to values. Used to set Presto
12679    /// [session properties](https://prestodb.io/docs/current/sql/set-session.html)
12680    /// Equivalent to using the --session flag in the Presto CLI
12681    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12682
12683    /// Optional. The runtime log config for job execution.
12684    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12685
12686    /// Required. The sequence of Presto queries to execute, specified as
12687    /// either an HCFS file URI or as a list of queries.
12688    pub queries: std::option::Option<crate::model::presto_job::Queries>,
12689
12690    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12691}
12692
12693impl PrestoJob {
12694    /// Creates a new default instance.
12695    pub fn new() -> Self {
12696        std::default::Default::default()
12697    }
12698
12699    /// Sets the value of [continue_on_failure][crate::model::PrestoJob::continue_on_failure].
12700    ///
12701    /// # Example
12702    /// ```ignore,no_run
12703    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12704    /// let x = PrestoJob::new().set_continue_on_failure(true);
12705    /// ```
12706    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12707        self.continue_on_failure = v.into();
12708        self
12709    }
12710
12711    /// Sets the value of [output_format][crate::model::PrestoJob::output_format].
12712    ///
12713    /// # Example
12714    /// ```ignore,no_run
12715    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12716    /// let x = PrestoJob::new().set_output_format("example");
12717    /// ```
12718    pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12719        self.output_format = v.into();
12720        self
12721    }
12722
12723    /// Sets the value of [client_tags][crate::model::PrestoJob::client_tags].
12724    ///
12725    /// # Example
12726    /// ```ignore,no_run
12727    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12728    /// let x = PrestoJob::new().set_client_tags(["a", "b", "c"]);
12729    /// ```
12730    pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12731    where
12732        T: std::iter::IntoIterator<Item = V>,
12733        V: std::convert::Into<std::string::String>,
12734    {
12735        use std::iter::Iterator;
12736        self.client_tags = v.into_iter().map(|i| i.into()).collect();
12737        self
12738    }
12739
12740    /// Sets the value of [properties][crate::model::PrestoJob::properties].
12741    ///
12742    /// # Example
12743    /// ```ignore,no_run
12744    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12745    /// let x = PrestoJob::new().set_properties([
12746    ///     ("key0", "abc"),
12747    ///     ("key1", "xyz"),
12748    /// ]);
12749    /// ```
12750    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12751    where
12752        T: std::iter::IntoIterator<Item = (K, V)>,
12753        K: std::convert::Into<std::string::String>,
12754        V: std::convert::Into<std::string::String>,
12755    {
12756        use std::iter::Iterator;
12757        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12758        self
12759    }
12760
12761    /// Sets the value of [logging_config][crate::model::PrestoJob::logging_config].
12762    ///
12763    /// # Example
12764    /// ```ignore,no_run
12765    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12766    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12767    /// let x = PrestoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12768    /// ```
12769    pub fn set_logging_config<T>(mut self, v: T) -> Self
12770    where
12771        T: std::convert::Into<crate::model::LoggingConfig>,
12772    {
12773        self.logging_config = std::option::Option::Some(v.into());
12774        self
12775    }
12776
12777    /// Sets or clears the value of [logging_config][crate::model::PrestoJob::logging_config].
12778    ///
12779    /// # Example
12780    /// ```ignore,no_run
12781    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12782    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12783    /// let x = PrestoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12784    /// let x = PrestoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12785    /// ```
12786    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12787    where
12788        T: std::convert::Into<crate::model::LoggingConfig>,
12789    {
12790        self.logging_config = v.map(|x| x.into());
12791        self
12792    }
12793
12794    /// Sets the value of [queries][crate::model::PrestoJob::queries].
12795    ///
12796    /// Note that all the setters affecting `queries` are mutually
12797    /// exclusive.
12798    ///
12799    /// # Example
12800    /// ```ignore,no_run
12801    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12802    /// use google_cloud_dataproc_v1::model::presto_job::Queries;
12803    /// let x = PrestoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12804    /// ```
12805    pub fn set_queries<
12806        T: std::convert::Into<std::option::Option<crate::model::presto_job::Queries>>,
12807    >(
12808        mut self,
12809        v: T,
12810    ) -> Self {
12811        self.queries = v.into();
12812        self
12813    }
12814
12815    /// The value of [queries][crate::model::PrestoJob::queries]
12816    /// if it holds a `QueryFileUri`, `None` if the field is not set or
12817    /// holds a different branch.
12818    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12819        #[allow(unreachable_patterns)]
12820        self.queries.as_ref().and_then(|v| match v {
12821            crate::model::presto_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12822            _ => std::option::Option::None,
12823        })
12824    }
12825
12826    /// Sets the value of [queries][crate::model::PrestoJob::queries]
12827    /// to hold a `QueryFileUri`.
12828    ///
12829    /// Note that all the setters affecting `queries` are
12830    /// mutually exclusive.
12831    ///
12832    /// # Example
12833    /// ```ignore,no_run
12834    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12835    /// let x = PrestoJob::new().set_query_file_uri("example");
12836    /// assert!(x.query_file_uri().is_some());
12837    /// assert!(x.query_list().is_none());
12838    /// ```
12839    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12840        self.queries =
12841            std::option::Option::Some(crate::model::presto_job::Queries::QueryFileUri(v.into()));
12842        self
12843    }
12844
12845    /// The value of [queries][crate::model::PrestoJob::queries]
12846    /// if it holds a `QueryList`, `None` if the field is not set or
12847    /// holds a different branch.
12848    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12849        #[allow(unreachable_patterns)]
12850        self.queries.as_ref().and_then(|v| match v {
12851            crate::model::presto_job::Queries::QueryList(v) => std::option::Option::Some(v),
12852            _ => std::option::Option::None,
12853        })
12854    }
12855
12856    /// Sets the value of [queries][crate::model::PrestoJob::queries]
12857    /// to hold a `QueryList`.
12858    ///
12859    /// Note that all the setters affecting `queries` are
12860    /// mutually exclusive.
12861    ///
12862    /// # Example
12863    /// ```ignore,no_run
12864    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12865    /// use google_cloud_dataproc_v1::model::QueryList;
12866    /// let x = PrestoJob::new().set_query_list(QueryList::default()/* use setters */);
12867    /// assert!(x.query_list().is_some());
12868    /// assert!(x.query_file_uri().is_none());
12869    /// ```
12870    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12871        mut self,
12872        v: T,
12873    ) -> Self {
12874        self.queries =
12875            std::option::Option::Some(crate::model::presto_job::Queries::QueryList(v.into()));
12876        self
12877    }
12878}
12879
12880impl wkt::message::Message for PrestoJob {
12881    fn typename() -> &'static str {
12882        "type.googleapis.com/google.cloud.dataproc.v1.PrestoJob"
12883    }
12884}
12885
12886/// Defines additional types related to [PrestoJob].
12887pub mod presto_job {
12888    #[allow(unused_imports)]
12889    use super::*;
12890
12891    /// Required. The sequence of Presto queries to execute, specified as
12892    /// either an HCFS file URI or as a list of queries.
12893    #[derive(Clone, Debug, PartialEq)]
12894    #[non_exhaustive]
12895    pub enum Queries {
12896        /// The HCFS URI of the script that contains SQL queries.
12897        QueryFileUri(std::string::String),
12898        /// A list of queries.
12899        QueryList(std::boxed::Box<crate::model::QueryList>),
12900    }
12901}
12902
12903/// A Dataproc job for running [Trino](https://trino.io/) queries.
12904/// **IMPORTANT**: The [Dataproc Trino Optional
12905/// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino)
12906/// must be enabled when the cluster is created to submit a Trino job to the
12907/// cluster.
12908#[derive(Clone, Default, PartialEq)]
12909#[non_exhaustive]
12910pub struct TrinoJob {
12911    /// Optional. Whether to continue executing queries if a query fails.
12912    /// The default value is `false`. Setting to `true` can be useful when
12913    /// executing independent parallel queries.
12914    pub continue_on_failure: bool,
12915
12916    /// Optional. The format in which query output will be displayed. See the
12917    /// Trino documentation for supported output formats
12918    pub output_format: std::string::String,
12919
12920    /// Optional. Trino client tags to attach to this query
12921    pub client_tags: std::vec::Vec<std::string::String>,
12922
12923    /// Optional. A mapping of property names to values. Used to set Trino
12924    /// [session properties](https://trino.io/docs/current/sql/set-session.html)
12925    /// Equivalent to using the --session flag in the Trino CLI
12926    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12927
12928    /// Optional. The runtime log config for job execution.
12929    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12930
12931    /// Required. The sequence of Trino queries to execute, specified as
12932    /// either an HCFS file URI or as a list of queries.
12933    pub queries: std::option::Option<crate::model::trino_job::Queries>,
12934
12935    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12936}
12937
12938impl TrinoJob {
12939    /// Creates a new default instance.
12940    pub fn new() -> Self {
12941        std::default::Default::default()
12942    }
12943
12944    /// Sets the value of [continue_on_failure][crate::model::TrinoJob::continue_on_failure].
12945    ///
12946    /// # Example
12947    /// ```ignore,no_run
12948    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12949    /// let x = TrinoJob::new().set_continue_on_failure(true);
12950    /// ```
12951    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12952        self.continue_on_failure = v.into();
12953        self
12954    }
12955
12956    /// Sets the value of [output_format][crate::model::TrinoJob::output_format].
12957    ///
12958    /// # Example
12959    /// ```ignore,no_run
12960    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12961    /// let x = TrinoJob::new().set_output_format("example");
12962    /// ```
12963    pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12964        self.output_format = v.into();
12965        self
12966    }
12967
12968    /// Sets the value of [client_tags][crate::model::TrinoJob::client_tags].
12969    ///
12970    /// # Example
12971    /// ```ignore,no_run
12972    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12973    /// let x = TrinoJob::new().set_client_tags(["a", "b", "c"]);
12974    /// ```
12975    pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12976    where
12977        T: std::iter::IntoIterator<Item = V>,
12978        V: std::convert::Into<std::string::String>,
12979    {
12980        use std::iter::Iterator;
12981        self.client_tags = v.into_iter().map(|i| i.into()).collect();
12982        self
12983    }
12984
12985    /// Sets the value of [properties][crate::model::TrinoJob::properties].
12986    ///
12987    /// # Example
12988    /// ```ignore,no_run
12989    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12990    /// let x = TrinoJob::new().set_properties([
12991    ///     ("key0", "abc"),
12992    ///     ("key1", "xyz"),
12993    /// ]);
12994    /// ```
12995    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12996    where
12997        T: std::iter::IntoIterator<Item = (K, V)>,
12998        K: std::convert::Into<std::string::String>,
12999        V: std::convert::Into<std::string::String>,
13000    {
13001        use std::iter::Iterator;
13002        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13003        self
13004    }
13005
13006    /// Sets the value of [logging_config][crate::model::TrinoJob::logging_config].
13007    ///
13008    /// # Example
13009    /// ```ignore,no_run
13010    /// # use google_cloud_dataproc_v1::model::TrinoJob;
13011    /// use google_cloud_dataproc_v1::model::LoggingConfig;
13012    /// let x = TrinoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13013    /// ```
13014    pub fn set_logging_config<T>(mut self, v: T) -> Self
13015    where
13016        T: std::convert::Into<crate::model::LoggingConfig>,
13017    {
13018        self.logging_config = std::option::Option::Some(v.into());
13019        self
13020    }
13021
13022    /// Sets or clears the value of [logging_config][crate::model::TrinoJob::logging_config].
13023    ///
13024    /// # Example
13025    /// ```ignore,no_run
13026    /// # use google_cloud_dataproc_v1::model::TrinoJob;
13027    /// use google_cloud_dataproc_v1::model::LoggingConfig;
13028    /// let x = TrinoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13029    /// let x = TrinoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13030    /// ```
13031    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13032    where
13033        T: std::convert::Into<crate::model::LoggingConfig>,
13034    {
13035        self.logging_config = v.map(|x| x.into());
13036        self
13037    }
13038
13039    /// Sets the value of [queries][crate::model::TrinoJob::queries].
13040    ///
13041    /// Note that all the setters affecting `queries` are mutually
13042    /// exclusive.
13043    ///
13044    /// # Example
13045    /// ```ignore,no_run
13046    /// # use google_cloud_dataproc_v1::model::TrinoJob;
13047    /// use google_cloud_dataproc_v1::model::trino_job::Queries;
13048    /// let x = TrinoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
13049    /// ```
13050    pub fn set_queries<
13051        T: std::convert::Into<std::option::Option<crate::model::trino_job::Queries>>,
13052    >(
13053        mut self,
13054        v: T,
13055    ) -> Self {
13056        self.queries = v.into();
13057        self
13058    }
13059
13060    /// The value of [queries][crate::model::TrinoJob::queries]
13061    /// if it holds a `QueryFileUri`, `None` if the field is not set or
13062    /// holds a different branch.
13063    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
13064        #[allow(unreachable_patterns)]
13065        self.queries.as_ref().and_then(|v| match v {
13066            crate::model::trino_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
13067            _ => std::option::Option::None,
13068        })
13069    }
13070
13071    /// Sets the value of [queries][crate::model::TrinoJob::queries]
13072    /// to hold a `QueryFileUri`.
13073    ///
13074    /// Note that all the setters affecting `queries` are
13075    /// mutually exclusive.
13076    ///
13077    /// # Example
13078    /// ```ignore,no_run
13079    /// # use google_cloud_dataproc_v1::model::TrinoJob;
13080    /// let x = TrinoJob::new().set_query_file_uri("example");
13081    /// assert!(x.query_file_uri().is_some());
13082    /// assert!(x.query_list().is_none());
13083    /// ```
13084    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13085        self.queries =
13086            std::option::Option::Some(crate::model::trino_job::Queries::QueryFileUri(v.into()));
13087        self
13088    }
13089
13090    /// The value of [queries][crate::model::TrinoJob::queries]
13091    /// if it holds a `QueryList`, `None` if the field is not set or
13092    /// holds a different branch.
13093    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
13094        #[allow(unreachable_patterns)]
13095        self.queries.as_ref().and_then(|v| match v {
13096            crate::model::trino_job::Queries::QueryList(v) => std::option::Option::Some(v),
13097            _ => std::option::Option::None,
13098        })
13099    }
13100
13101    /// Sets the value of [queries][crate::model::TrinoJob::queries]
13102    /// to hold a `QueryList`.
13103    ///
13104    /// Note that all the setters affecting `queries` are
13105    /// mutually exclusive.
13106    ///
13107    /// # Example
13108    /// ```ignore,no_run
13109    /// # use google_cloud_dataproc_v1::model::TrinoJob;
13110    /// use google_cloud_dataproc_v1::model::QueryList;
13111    /// let x = TrinoJob::new().set_query_list(QueryList::default()/* use setters */);
13112    /// assert!(x.query_list().is_some());
13113    /// assert!(x.query_file_uri().is_none());
13114    /// ```
13115    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
13116        mut self,
13117        v: T,
13118    ) -> Self {
13119        self.queries =
13120            std::option::Option::Some(crate::model::trino_job::Queries::QueryList(v.into()));
13121        self
13122    }
13123}
13124
13125impl wkt::message::Message for TrinoJob {
13126    fn typename() -> &'static str {
13127        "type.googleapis.com/google.cloud.dataproc.v1.TrinoJob"
13128    }
13129}
13130
13131/// Defines additional types related to [TrinoJob].
13132pub mod trino_job {
13133    #[allow(unused_imports)]
13134    use super::*;
13135
13136    /// Required. The sequence of Trino queries to execute, specified as
13137    /// either an HCFS file URI or as a list of queries.
13138    #[derive(Clone, Debug, PartialEq)]
13139    #[non_exhaustive]
13140    pub enum Queries {
13141        /// The HCFS URI of the script that contains SQL queries.
13142        QueryFileUri(std::string::String),
13143        /// A list of queries.
13144        QueryList(std::boxed::Box<crate::model::QueryList>),
13145    }
13146}
13147
13148/// A Dataproc job for running Apache Flink applications on YARN.
13149#[derive(Clone, Default, PartialEq)]
13150#[non_exhaustive]
13151pub struct FlinkJob {
13152    /// Optional. The arguments to pass to the driver. Do not include arguments,
13153    /// such as `--conf`, that can be set as job properties, since a collision
13154    /// might occur that causes an incorrect job submission.
13155    pub args: std::vec::Vec<std::string::String>,
13156
13157    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
13158    /// Flink driver and tasks.
13159    pub jar_file_uris: std::vec::Vec<std::string::String>,
13160
13161    /// Optional. HCFS URI of the savepoint, which contains the last saved progress
13162    /// for starting the current job.
13163    pub savepoint_uri: std::string::String,
13164
13165    /// Optional. A mapping of property names to values, used to configure Flink.
13166    /// Properties that conflict with values set by the Dataproc API might be
13167    /// overwritten. Can include properties set in
13168    /// `/etc/flink/conf/flink-defaults.conf` and classes in user code.
13169    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13170
13171    /// Optional. The runtime log config for job execution.
13172    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13173
13174    /// Required. The specification of the main method to call to drive the job.
13175    /// Specify either the jar file that contains the main class or the main class
13176    /// name. To pass both a main jar and a main class in the jar, add the jar to
13177    /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
13178    /// specify the main class name in
13179    /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
13180    ///
13181    /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13182    /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
13183    pub driver: std::option::Option<crate::model::flink_job::Driver>,
13184
13185    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13186}
13187
13188impl FlinkJob {
13189    /// Creates a new default instance.
13190    pub fn new() -> Self {
13191        std::default::Default::default()
13192    }
13193
13194    /// Sets the value of [args][crate::model::FlinkJob::args].
13195    ///
13196    /// # Example
13197    /// ```ignore,no_run
13198    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13199    /// let x = FlinkJob::new().set_args(["a", "b", "c"]);
13200    /// ```
13201    pub fn set_args<T, V>(mut self, v: T) -> Self
13202    where
13203        T: std::iter::IntoIterator<Item = V>,
13204        V: std::convert::Into<std::string::String>,
13205    {
13206        use std::iter::Iterator;
13207        self.args = v.into_iter().map(|i| i.into()).collect();
13208        self
13209    }
13210
13211    /// Sets the value of [jar_file_uris][crate::model::FlinkJob::jar_file_uris].
13212    ///
13213    /// # Example
13214    /// ```ignore,no_run
13215    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13216    /// let x = FlinkJob::new().set_jar_file_uris(["a", "b", "c"]);
13217    /// ```
13218    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
13219    where
13220        T: std::iter::IntoIterator<Item = V>,
13221        V: std::convert::Into<std::string::String>,
13222    {
13223        use std::iter::Iterator;
13224        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
13225        self
13226    }
13227
13228    /// Sets the value of [savepoint_uri][crate::model::FlinkJob::savepoint_uri].
13229    ///
13230    /// # Example
13231    /// ```ignore,no_run
13232    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13233    /// let x = FlinkJob::new().set_savepoint_uri("example");
13234    /// ```
13235    pub fn set_savepoint_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13236        self.savepoint_uri = v.into();
13237        self
13238    }
13239
13240    /// Sets the value of [properties][crate::model::FlinkJob::properties].
13241    ///
13242    /// # Example
13243    /// ```ignore,no_run
13244    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13245    /// let x = FlinkJob::new().set_properties([
13246    ///     ("key0", "abc"),
13247    ///     ("key1", "xyz"),
13248    /// ]);
13249    /// ```
13250    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
13251    where
13252        T: std::iter::IntoIterator<Item = (K, V)>,
13253        K: std::convert::Into<std::string::String>,
13254        V: std::convert::Into<std::string::String>,
13255    {
13256        use std::iter::Iterator;
13257        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13258        self
13259    }
13260
13261    /// Sets the value of [logging_config][crate::model::FlinkJob::logging_config].
13262    ///
13263    /// # Example
13264    /// ```ignore,no_run
13265    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13266    /// use google_cloud_dataproc_v1::model::LoggingConfig;
13267    /// let x = FlinkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13268    /// ```
13269    pub fn set_logging_config<T>(mut self, v: T) -> Self
13270    where
13271        T: std::convert::Into<crate::model::LoggingConfig>,
13272    {
13273        self.logging_config = std::option::Option::Some(v.into());
13274        self
13275    }
13276
13277    /// Sets or clears the value of [logging_config][crate::model::FlinkJob::logging_config].
13278    ///
13279    /// # Example
13280    /// ```ignore,no_run
13281    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13282    /// use google_cloud_dataproc_v1::model::LoggingConfig;
13283    /// let x = FlinkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13284    /// let x = FlinkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13285    /// ```
13286    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13287    where
13288        T: std::convert::Into<crate::model::LoggingConfig>,
13289    {
13290        self.logging_config = v.map(|x| x.into());
13291        self
13292    }
13293
13294    /// Sets the value of [driver][crate::model::FlinkJob::driver].
13295    ///
13296    /// Note that all the setters affecting `driver` are mutually
13297    /// exclusive.
13298    ///
13299    /// # Example
13300    /// ```ignore,no_run
13301    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13302    /// use google_cloud_dataproc_v1::model::flink_job::Driver;
13303    /// let x = FlinkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
13304    /// ```
13305    pub fn set_driver<
13306        T: std::convert::Into<std::option::Option<crate::model::flink_job::Driver>>,
13307    >(
13308        mut self,
13309        v: T,
13310    ) -> Self {
13311        self.driver = v.into();
13312        self
13313    }
13314
13315    /// The value of [driver][crate::model::FlinkJob::driver]
13316    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
13317    /// holds a different branch.
13318    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
13319        #[allow(unreachable_patterns)]
13320        self.driver.as_ref().and_then(|v| match v {
13321            crate::model::flink_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
13322            _ => std::option::Option::None,
13323        })
13324    }
13325
13326    /// Sets the value of [driver][crate::model::FlinkJob::driver]
13327    /// to hold a `MainJarFileUri`.
13328    ///
13329    /// Note that all the setters affecting `driver` are
13330    /// mutually exclusive.
13331    ///
13332    /// # Example
13333    /// ```ignore,no_run
13334    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13335    /// let x = FlinkJob::new().set_main_jar_file_uri("example");
13336    /// assert!(x.main_jar_file_uri().is_some());
13337    /// assert!(x.main_class().is_none());
13338    /// ```
13339    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
13340        mut self,
13341        v: T,
13342    ) -> Self {
13343        self.driver =
13344            std::option::Option::Some(crate::model::flink_job::Driver::MainJarFileUri(v.into()));
13345        self
13346    }
13347
13348    /// The value of [driver][crate::model::FlinkJob::driver]
13349    /// if it holds a `MainClass`, `None` if the field is not set or
13350    /// holds a different branch.
13351    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
13352        #[allow(unreachable_patterns)]
13353        self.driver.as_ref().and_then(|v| match v {
13354            crate::model::flink_job::Driver::MainClass(v) => std::option::Option::Some(v),
13355            _ => std::option::Option::None,
13356        })
13357    }
13358
13359    /// Sets the value of [driver][crate::model::FlinkJob::driver]
13360    /// to hold a `MainClass`.
13361    ///
13362    /// Note that all the setters affecting `driver` are
13363    /// mutually exclusive.
13364    ///
13365    /// # Example
13366    /// ```ignore,no_run
13367    /// # use google_cloud_dataproc_v1::model::FlinkJob;
13368    /// let x = FlinkJob::new().set_main_class("example");
13369    /// assert!(x.main_class().is_some());
13370    /// assert!(x.main_jar_file_uri().is_none());
13371    /// ```
13372    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13373        self.driver =
13374            std::option::Option::Some(crate::model::flink_job::Driver::MainClass(v.into()));
13375        self
13376    }
13377}
13378
13379impl wkt::message::Message for FlinkJob {
13380    fn typename() -> &'static str {
13381        "type.googleapis.com/google.cloud.dataproc.v1.FlinkJob"
13382    }
13383}
13384
13385/// Defines additional types related to [FlinkJob].
13386pub mod flink_job {
13387    #[allow(unused_imports)]
13388    use super::*;
13389
13390    /// Required. The specification of the main method to call to drive the job.
13391    /// Specify either the jar file that contains the main class or the main class
13392    /// name. To pass both a main jar and a main class in the jar, add the jar to
13393    /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
13394    /// specify the main class name in
13395    /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
13396    ///
13397    /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13398    /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
13399    #[derive(Clone, Debug, PartialEq)]
13400    #[non_exhaustive]
13401    pub enum Driver {
13402        /// The HCFS URI of the jar file that contains the main class.
13403        MainJarFileUri(std::string::String),
13404        /// The name of the driver's main class. The jar file that contains the class
13405        /// must be in the default CLASSPATH or specified in
13406        /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris].
13407        ///
13408        /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13409        MainClass(std::string::String),
13410    }
13411}
13412
13413/// Dataproc job config.
13414#[derive(Clone, Default, PartialEq)]
13415#[non_exhaustive]
13416pub struct JobPlacement {
13417    /// Required. The name of the cluster where the job will be submitted.
13418    pub cluster_name: std::string::String,
13419
13420    /// Output only. A cluster UUID generated by the Dataproc service when
13421    /// the job is submitted.
13422    pub cluster_uuid: std::string::String,
13423
13424    /// Optional. Cluster labels to identify a cluster where the job will be
13425    /// submitted.
13426    pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
13427
13428    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13429}
13430
13431impl JobPlacement {
13432    /// Creates a new default instance.
13433    pub fn new() -> Self {
13434        std::default::Default::default()
13435    }
13436
13437    /// Sets the value of [cluster_name][crate::model::JobPlacement::cluster_name].
13438    ///
13439    /// # Example
13440    /// ```ignore,no_run
13441    /// # use google_cloud_dataproc_v1::model::JobPlacement;
13442    /// let x = JobPlacement::new().set_cluster_name("example");
13443    /// ```
13444    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13445        self.cluster_name = v.into();
13446        self
13447    }
13448
13449    /// Sets the value of [cluster_uuid][crate::model::JobPlacement::cluster_uuid].
13450    ///
13451    /// # Example
13452    /// ```ignore,no_run
13453    /// # use google_cloud_dataproc_v1::model::JobPlacement;
13454    /// let x = JobPlacement::new().set_cluster_uuid("example");
13455    /// ```
13456    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13457        self.cluster_uuid = v.into();
13458        self
13459    }
13460
13461    /// Sets the value of [cluster_labels][crate::model::JobPlacement::cluster_labels].
13462    ///
13463    /// # Example
13464    /// ```ignore,no_run
13465    /// # use google_cloud_dataproc_v1::model::JobPlacement;
13466    /// let x = JobPlacement::new().set_cluster_labels([
13467    ///     ("key0", "abc"),
13468    ///     ("key1", "xyz"),
13469    /// ]);
13470    /// ```
13471    pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
13472    where
13473        T: std::iter::IntoIterator<Item = (K, V)>,
13474        K: std::convert::Into<std::string::String>,
13475        V: std::convert::Into<std::string::String>,
13476    {
13477        use std::iter::Iterator;
13478        self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13479        self
13480    }
13481}
13482
13483impl wkt::message::Message for JobPlacement {
13484    fn typename() -> &'static str {
13485        "type.googleapis.com/google.cloud.dataproc.v1.JobPlacement"
13486    }
13487}
13488
13489/// Dataproc job status.
13490#[derive(Clone, Default, PartialEq)]
13491#[non_exhaustive]
13492pub struct JobStatus {
13493    /// Output only. A state message specifying the overall job state.
13494    pub state: crate::model::job_status::State,
13495
13496    /// Optional. Output only. Job state details, such as an error
13497    /// description if the state is `ERROR`.
13498    pub details: std::string::String,
13499
13500    /// Output only. The time when this state was entered.
13501    pub state_start_time: std::option::Option<wkt::Timestamp>,
13502
13503    /// Output only. Additional state information, which includes
13504    /// status reported by the agent.
13505    pub substate: crate::model::job_status::Substate,
13506
13507    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13508}
13509
13510impl JobStatus {
13511    /// Creates a new default instance.
13512    pub fn new() -> Self {
13513        std::default::Default::default()
13514    }
13515
13516    /// Sets the value of [state][crate::model::JobStatus::state].
13517    ///
13518    /// # Example
13519    /// ```ignore,no_run
13520    /// # use google_cloud_dataproc_v1::model::JobStatus;
13521    /// use google_cloud_dataproc_v1::model::job_status::State;
13522    /// let x0 = JobStatus::new().set_state(State::Pending);
13523    /// let x1 = JobStatus::new().set_state(State::SetupDone);
13524    /// let x2 = JobStatus::new().set_state(State::Running);
13525    /// ```
13526    pub fn set_state<T: std::convert::Into<crate::model::job_status::State>>(
13527        mut self,
13528        v: T,
13529    ) -> Self {
13530        self.state = v.into();
13531        self
13532    }
13533
13534    /// Sets the value of [details][crate::model::JobStatus::details].
13535    ///
13536    /// # Example
13537    /// ```ignore,no_run
13538    /// # use google_cloud_dataproc_v1::model::JobStatus;
13539    /// let x = JobStatus::new().set_details("example");
13540    /// ```
13541    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13542        self.details = v.into();
13543        self
13544    }
13545
13546    /// Sets the value of [state_start_time][crate::model::JobStatus::state_start_time].
13547    ///
13548    /// # Example
13549    /// ```ignore,no_run
13550    /// # use google_cloud_dataproc_v1::model::JobStatus;
13551    /// use wkt::Timestamp;
13552    /// let x = JobStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
13553    /// ```
13554    pub fn set_state_start_time<T>(mut self, v: T) -> Self
13555    where
13556        T: std::convert::Into<wkt::Timestamp>,
13557    {
13558        self.state_start_time = std::option::Option::Some(v.into());
13559        self
13560    }
13561
13562    /// Sets or clears the value of [state_start_time][crate::model::JobStatus::state_start_time].
13563    ///
13564    /// # Example
13565    /// ```ignore,no_run
13566    /// # use google_cloud_dataproc_v1::model::JobStatus;
13567    /// use wkt::Timestamp;
13568    /// let x = JobStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
13569    /// let x = JobStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
13570    /// ```
13571    pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
13572    where
13573        T: std::convert::Into<wkt::Timestamp>,
13574    {
13575        self.state_start_time = v.map(|x| x.into());
13576        self
13577    }
13578
13579    /// Sets the value of [substate][crate::model::JobStatus::substate].
13580    ///
13581    /// # Example
13582    /// ```ignore,no_run
13583    /// # use google_cloud_dataproc_v1::model::JobStatus;
13584    /// use google_cloud_dataproc_v1::model::job_status::Substate;
13585    /// let x0 = JobStatus::new().set_substate(Substate::Submitted);
13586    /// let x1 = JobStatus::new().set_substate(Substate::Queued);
13587    /// let x2 = JobStatus::new().set_substate(Substate::StaleStatus);
13588    /// ```
13589    pub fn set_substate<T: std::convert::Into<crate::model::job_status::Substate>>(
13590        mut self,
13591        v: T,
13592    ) -> Self {
13593        self.substate = v.into();
13594        self
13595    }
13596}
13597
13598impl wkt::message::Message for JobStatus {
13599    fn typename() -> &'static str {
13600        "type.googleapis.com/google.cloud.dataproc.v1.JobStatus"
13601    }
13602}
13603
13604/// Defines additional types related to [JobStatus].
13605pub mod job_status {
13606    #[allow(unused_imports)]
13607    use super::*;
13608
13609    /// The job state.
13610    ///
13611    /// # Working with unknown values
13612    ///
13613    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13614    /// additional enum variants at any time. Adding new variants is not considered
13615    /// a breaking change. Applications should write their code in anticipation of:
13616    ///
13617    /// - New values appearing in future releases of the client library, **and**
13618    /// - New values received dynamically, without application changes.
13619    ///
13620    /// Please consult the [Working with enums] section in the user guide for some
13621    /// guidelines.
13622    ///
13623    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13624    #[derive(Clone, Debug, PartialEq)]
13625    #[non_exhaustive]
13626    pub enum State {
13627        /// The job state is unknown.
13628        Unspecified,
13629        /// The job is pending; it has been submitted, but is not yet running.
13630        Pending,
13631        /// Job has been received by the service and completed initial setup;
13632        /// it will soon be submitted to the cluster.
13633        SetupDone,
13634        /// The job is running on the cluster.
13635        Running,
13636        /// A CancelJob request has been received, but is pending.
13637        CancelPending,
13638        /// Transient in-flight resources have been canceled, and the request to
13639        /// cancel the running job has been issued to the cluster.
13640        CancelStarted,
13641        /// The job cancellation was successful.
13642        Cancelled,
13643        /// The job has completed successfully.
13644        Done,
13645        /// The job has completed, but encountered an error.
13646        Error,
13647        /// Job attempt has failed. The detail field contains failure details for
13648        /// this attempt.
13649        ///
13650        /// Applies to restartable jobs only.
13651        AttemptFailure,
13652        /// If set, the enum was initialized with an unknown value.
13653        ///
13654        /// Applications can examine the value using [State::value] or
13655        /// [State::name].
13656        UnknownValue(state::UnknownValue),
13657    }
13658
13659    #[doc(hidden)]
13660    pub mod state {
13661        #[allow(unused_imports)]
13662        use super::*;
13663        #[derive(Clone, Debug, PartialEq)]
13664        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13665    }
13666
13667    impl State {
13668        /// Gets the enum value.
13669        ///
13670        /// Returns `None` if the enum contains an unknown value deserialized from
13671        /// the string representation of enums.
13672        pub fn value(&self) -> std::option::Option<i32> {
13673            match self {
13674                Self::Unspecified => std::option::Option::Some(0),
13675                Self::Pending => std::option::Option::Some(1),
13676                Self::SetupDone => std::option::Option::Some(8),
13677                Self::Running => std::option::Option::Some(2),
13678                Self::CancelPending => std::option::Option::Some(3),
13679                Self::CancelStarted => std::option::Option::Some(7),
13680                Self::Cancelled => std::option::Option::Some(4),
13681                Self::Done => std::option::Option::Some(5),
13682                Self::Error => std::option::Option::Some(6),
13683                Self::AttemptFailure => std::option::Option::Some(9),
13684                Self::UnknownValue(u) => u.0.value(),
13685            }
13686        }
13687
13688        /// Gets the enum value as a string.
13689        ///
13690        /// Returns `None` if the enum contains an unknown value deserialized from
13691        /// the integer representation of enums.
13692        pub fn name(&self) -> std::option::Option<&str> {
13693            match self {
13694                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13695                Self::Pending => std::option::Option::Some("PENDING"),
13696                Self::SetupDone => std::option::Option::Some("SETUP_DONE"),
13697                Self::Running => std::option::Option::Some("RUNNING"),
13698                Self::CancelPending => std::option::Option::Some("CANCEL_PENDING"),
13699                Self::CancelStarted => std::option::Option::Some("CANCEL_STARTED"),
13700                Self::Cancelled => std::option::Option::Some("CANCELLED"),
13701                Self::Done => std::option::Option::Some("DONE"),
13702                Self::Error => std::option::Option::Some("ERROR"),
13703                Self::AttemptFailure => std::option::Option::Some("ATTEMPT_FAILURE"),
13704                Self::UnknownValue(u) => u.0.name(),
13705            }
13706        }
13707    }
13708
13709    impl std::default::Default for State {
13710        fn default() -> Self {
13711            use std::convert::From;
13712            Self::from(0)
13713        }
13714    }
13715
13716    impl std::fmt::Display for State {
13717        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13718            wkt::internal::display_enum(f, self.name(), self.value())
13719        }
13720    }
13721
13722    impl std::convert::From<i32> for State {
13723        fn from(value: i32) -> Self {
13724            match value {
13725                0 => Self::Unspecified,
13726                1 => Self::Pending,
13727                2 => Self::Running,
13728                3 => Self::CancelPending,
13729                4 => Self::Cancelled,
13730                5 => Self::Done,
13731                6 => Self::Error,
13732                7 => Self::CancelStarted,
13733                8 => Self::SetupDone,
13734                9 => Self::AttemptFailure,
13735                _ => Self::UnknownValue(state::UnknownValue(
13736                    wkt::internal::UnknownEnumValue::Integer(value),
13737                )),
13738            }
13739        }
13740    }
13741
13742    impl std::convert::From<&str> for State {
13743        fn from(value: &str) -> Self {
13744            use std::string::ToString;
13745            match value {
13746                "STATE_UNSPECIFIED" => Self::Unspecified,
13747                "PENDING" => Self::Pending,
13748                "SETUP_DONE" => Self::SetupDone,
13749                "RUNNING" => Self::Running,
13750                "CANCEL_PENDING" => Self::CancelPending,
13751                "CANCEL_STARTED" => Self::CancelStarted,
13752                "CANCELLED" => Self::Cancelled,
13753                "DONE" => Self::Done,
13754                "ERROR" => Self::Error,
13755                "ATTEMPT_FAILURE" => Self::AttemptFailure,
13756                _ => Self::UnknownValue(state::UnknownValue(
13757                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13758                )),
13759            }
13760        }
13761    }
13762
13763    impl serde::ser::Serialize for State {
13764        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13765        where
13766            S: serde::Serializer,
13767        {
13768            match self {
13769                Self::Unspecified => serializer.serialize_i32(0),
13770                Self::Pending => serializer.serialize_i32(1),
13771                Self::SetupDone => serializer.serialize_i32(8),
13772                Self::Running => serializer.serialize_i32(2),
13773                Self::CancelPending => serializer.serialize_i32(3),
13774                Self::CancelStarted => serializer.serialize_i32(7),
13775                Self::Cancelled => serializer.serialize_i32(4),
13776                Self::Done => serializer.serialize_i32(5),
13777                Self::Error => serializer.serialize_i32(6),
13778                Self::AttemptFailure => serializer.serialize_i32(9),
13779                Self::UnknownValue(u) => u.0.serialize(serializer),
13780            }
13781        }
13782    }
13783
13784    impl<'de> serde::de::Deserialize<'de> for State {
13785        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13786        where
13787            D: serde::Deserializer<'de>,
13788        {
13789            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13790                ".google.cloud.dataproc.v1.JobStatus.State",
13791            ))
13792        }
13793    }
13794
13795    /// The job substate.
13796    ///
13797    /// # Working with unknown values
13798    ///
13799    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13800    /// additional enum variants at any time. Adding new variants is not considered
13801    /// a breaking change. Applications should write their code in anticipation of:
13802    ///
13803    /// - New values appearing in future releases of the client library, **and**
13804    /// - New values received dynamically, without application changes.
13805    ///
13806    /// Please consult the [Working with enums] section in the user guide for some
13807    /// guidelines.
13808    ///
13809    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13810    #[derive(Clone, Debug, PartialEq)]
13811    #[non_exhaustive]
13812    pub enum Substate {
13813        /// The job substate is unknown.
13814        Unspecified,
13815        /// The Job is submitted to the agent.
13816        ///
13817        /// Applies to RUNNING state.
13818        Submitted,
13819        /// The Job has been received and is awaiting execution (it might be waiting
13820        /// for a condition to be met). See the "details" field for the reason for
13821        /// the delay.
13822        ///
13823        /// Applies to RUNNING state.
13824        Queued,
13825        /// The agent-reported status is out of date, which can be caused by a
13826        /// loss of communication between the agent and Dataproc. If the
13827        /// agent does not send a timely update, the job will fail.
13828        ///
13829        /// Applies to RUNNING state.
13830        StaleStatus,
13831        /// If set, the enum was initialized with an unknown value.
13832        ///
13833        /// Applications can examine the value using [Substate::value] or
13834        /// [Substate::name].
13835        UnknownValue(substate::UnknownValue),
13836    }
13837
13838    #[doc(hidden)]
13839    pub mod substate {
13840        #[allow(unused_imports)]
13841        use super::*;
13842        #[derive(Clone, Debug, PartialEq)]
13843        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13844    }
13845
13846    impl Substate {
13847        /// Gets the enum value.
13848        ///
13849        /// Returns `None` if the enum contains an unknown value deserialized from
13850        /// the string representation of enums.
13851        pub fn value(&self) -> std::option::Option<i32> {
13852            match self {
13853                Self::Unspecified => std::option::Option::Some(0),
13854                Self::Submitted => std::option::Option::Some(1),
13855                Self::Queued => std::option::Option::Some(2),
13856                Self::StaleStatus => std::option::Option::Some(3),
13857                Self::UnknownValue(u) => u.0.value(),
13858            }
13859        }
13860
13861        /// Gets the enum value as a string.
13862        ///
13863        /// Returns `None` if the enum contains an unknown value deserialized from
13864        /// the integer representation of enums.
13865        pub fn name(&self) -> std::option::Option<&str> {
13866            match self {
13867                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
13868                Self::Submitted => std::option::Option::Some("SUBMITTED"),
13869                Self::Queued => std::option::Option::Some("QUEUED"),
13870                Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
13871                Self::UnknownValue(u) => u.0.name(),
13872            }
13873        }
13874    }
13875
13876    impl std::default::Default for Substate {
13877        fn default() -> Self {
13878            use std::convert::From;
13879            Self::from(0)
13880        }
13881    }
13882
13883    impl std::fmt::Display for Substate {
13884        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13885            wkt::internal::display_enum(f, self.name(), self.value())
13886        }
13887    }
13888
13889    impl std::convert::From<i32> for Substate {
13890        fn from(value: i32) -> Self {
13891            match value {
13892                0 => Self::Unspecified,
13893                1 => Self::Submitted,
13894                2 => Self::Queued,
13895                3 => Self::StaleStatus,
13896                _ => Self::UnknownValue(substate::UnknownValue(
13897                    wkt::internal::UnknownEnumValue::Integer(value),
13898                )),
13899            }
13900        }
13901    }
13902
13903    impl std::convert::From<&str> for Substate {
13904        fn from(value: &str) -> Self {
13905            use std::string::ToString;
13906            match value {
13907                "UNSPECIFIED" => Self::Unspecified,
13908                "SUBMITTED" => Self::Submitted,
13909                "QUEUED" => Self::Queued,
13910                "STALE_STATUS" => Self::StaleStatus,
13911                _ => Self::UnknownValue(substate::UnknownValue(
13912                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13913                )),
13914            }
13915        }
13916    }
13917
13918    impl serde::ser::Serialize for Substate {
13919        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13920        where
13921            S: serde::Serializer,
13922        {
13923            match self {
13924                Self::Unspecified => serializer.serialize_i32(0),
13925                Self::Submitted => serializer.serialize_i32(1),
13926                Self::Queued => serializer.serialize_i32(2),
13927                Self::StaleStatus => serializer.serialize_i32(3),
13928                Self::UnknownValue(u) => u.0.serialize(serializer),
13929            }
13930        }
13931    }
13932
13933    impl<'de> serde::de::Deserialize<'de> for Substate {
13934        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13935        where
13936            D: serde::Deserializer<'de>,
13937        {
13938            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
13939                ".google.cloud.dataproc.v1.JobStatus.Substate",
13940            ))
13941        }
13942    }
13943}
13944
13945/// Encapsulates the full scoping used to reference a job.
13946#[derive(Clone, Default, PartialEq)]
13947#[non_exhaustive]
13948pub struct JobReference {
13949    /// Optional. The ID of the Google Cloud Platform project that the job belongs
13950    /// to. If specified, must match the request project ID.
13951    pub project_id: std::string::String,
13952
13953    /// Optional. The job ID, which must be unique within the project.
13954    ///
13955    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
13956    /// underscores (_), or hyphens (-). The maximum length is 100 characters.
13957    ///
13958    /// If not specified by the caller, the job ID will be provided by the server.
13959    pub job_id: std::string::String,
13960
13961    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13962}
13963
13964impl JobReference {
13965    /// Creates a new default instance.
13966    pub fn new() -> Self {
13967        std::default::Default::default()
13968    }
13969
13970    /// Sets the value of [project_id][crate::model::JobReference::project_id].
13971    ///
13972    /// # Example
13973    /// ```ignore,no_run
13974    /// # use google_cloud_dataproc_v1::model::JobReference;
13975    /// let x = JobReference::new().set_project_id("example");
13976    /// ```
13977    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13978        self.project_id = v.into();
13979        self
13980    }
13981
13982    /// Sets the value of [job_id][crate::model::JobReference::job_id].
13983    ///
13984    /// # Example
13985    /// ```ignore,no_run
13986    /// # use google_cloud_dataproc_v1::model::JobReference;
13987    /// let x = JobReference::new().set_job_id("example");
13988    /// ```
13989    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13990        self.job_id = v.into();
13991        self
13992    }
13993}
13994
13995impl wkt::message::Message for JobReference {
13996    fn typename() -> &'static str {
13997        "type.googleapis.com/google.cloud.dataproc.v1.JobReference"
13998    }
13999}
14000
14001/// A YARN application created by a job. Application information is a subset of
14002/// \<code\>org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto\</code\>.
14003///
14004/// **Beta Feature**: This report is available for testing purposes only. It may
14005/// be changed before final release.
14006#[derive(Clone, Default, PartialEq)]
14007#[non_exhaustive]
14008pub struct YarnApplication {
14009    /// Required. The application name.
14010    pub name: std::string::String,
14011
14012    /// Required. The application state.
14013    pub state: crate::model::yarn_application::State,
14014
14015    /// Required. The numerical progress of the application, from 1 to 100.
14016    pub progress: f32,
14017
14018    /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or
14019    /// TimelineServer that provides application-specific information. The URL uses
14020    /// the internal hostname, and requires a proxy server for resolution and,
14021    /// possibly, access.
14022    pub tracking_url: std::string::String,
14023
14024    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14025}
14026
14027impl YarnApplication {
14028    /// Creates a new default instance.
14029    pub fn new() -> Self {
14030        std::default::Default::default()
14031    }
14032
14033    /// Sets the value of [name][crate::model::YarnApplication::name].
14034    ///
14035    /// # Example
14036    /// ```ignore,no_run
14037    /// # use google_cloud_dataproc_v1::model::YarnApplication;
14038    /// let x = YarnApplication::new().set_name("example");
14039    /// ```
14040    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14041        self.name = v.into();
14042        self
14043    }
14044
14045    /// Sets the value of [state][crate::model::YarnApplication::state].
14046    ///
14047    /// # Example
14048    /// ```ignore,no_run
14049    /// # use google_cloud_dataproc_v1::model::YarnApplication;
14050    /// use google_cloud_dataproc_v1::model::yarn_application::State;
14051    /// let x0 = YarnApplication::new().set_state(State::New);
14052    /// let x1 = YarnApplication::new().set_state(State::NewSaving);
14053    /// let x2 = YarnApplication::new().set_state(State::Submitted);
14054    /// ```
14055    pub fn set_state<T: std::convert::Into<crate::model::yarn_application::State>>(
14056        mut self,
14057        v: T,
14058    ) -> Self {
14059        self.state = v.into();
14060        self
14061    }
14062
14063    /// Sets the value of [progress][crate::model::YarnApplication::progress].
14064    ///
14065    /// # Example
14066    /// ```ignore,no_run
14067    /// # use google_cloud_dataproc_v1::model::YarnApplication;
14068    /// let x = YarnApplication::new().set_progress(42.0);
14069    /// ```
14070    pub fn set_progress<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
14071        self.progress = v.into();
14072        self
14073    }
14074
14075    /// Sets the value of [tracking_url][crate::model::YarnApplication::tracking_url].
14076    ///
14077    /// # Example
14078    /// ```ignore,no_run
14079    /// # use google_cloud_dataproc_v1::model::YarnApplication;
14080    /// let x = YarnApplication::new().set_tracking_url("example");
14081    /// ```
14082    pub fn set_tracking_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14083        self.tracking_url = v.into();
14084        self
14085    }
14086}
14087
14088impl wkt::message::Message for YarnApplication {
14089    fn typename() -> &'static str {
14090        "type.googleapis.com/google.cloud.dataproc.v1.YarnApplication"
14091    }
14092}
14093
14094/// Defines additional types related to [YarnApplication].
14095pub mod yarn_application {
14096    #[allow(unused_imports)]
14097    use super::*;
14098
14099    /// The application state, corresponding to
14100    /// \<code\>YarnProtos.YarnApplicationStateProto\</code\>.
14101    ///
14102    /// # Working with unknown values
14103    ///
14104    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14105    /// additional enum variants at any time. Adding new variants is not considered
14106    /// a breaking change. Applications should write their code in anticipation of:
14107    ///
14108    /// - New values appearing in future releases of the client library, **and**
14109    /// - New values received dynamically, without application changes.
14110    ///
14111    /// Please consult the [Working with enums] section in the user guide for some
14112    /// guidelines.
14113    ///
14114    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14115    #[derive(Clone, Debug, PartialEq)]
14116    #[non_exhaustive]
14117    pub enum State {
14118        /// Status is unspecified.
14119        Unspecified,
14120        /// Status is NEW.
14121        New,
14122        /// Status is NEW_SAVING.
14123        NewSaving,
14124        /// Status is SUBMITTED.
14125        Submitted,
14126        /// Status is ACCEPTED.
14127        Accepted,
14128        /// Status is RUNNING.
14129        Running,
14130        /// Status is FINISHED.
14131        Finished,
14132        /// Status is FAILED.
14133        Failed,
14134        /// Status is KILLED.
14135        Killed,
14136        /// If set, the enum was initialized with an unknown value.
14137        ///
14138        /// Applications can examine the value using [State::value] or
14139        /// [State::name].
14140        UnknownValue(state::UnknownValue),
14141    }
14142
14143    #[doc(hidden)]
14144    pub mod state {
14145        #[allow(unused_imports)]
14146        use super::*;
14147        #[derive(Clone, Debug, PartialEq)]
14148        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14149    }
14150
14151    impl State {
14152        /// Gets the enum value.
14153        ///
14154        /// Returns `None` if the enum contains an unknown value deserialized from
14155        /// the string representation of enums.
14156        pub fn value(&self) -> std::option::Option<i32> {
14157            match self {
14158                Self::Unspecified => std::option::Option::Some(0),
14159                Self::New => std::option::Option::Some(1),
14160                Self::NewSaving => std::option::Option::Some(2),
14161                Self::Submitted => std::option::Option::Some(3),
14162                Self::Accepted => std::option::Option::Some(4),
14163                Self::Running => std::option::Option::Some(5),
14164                Self::Finished => std::option::Option::Some(6),
14165                Self::Failed => std::option::Option::Some(7),
14166                Self::Killed => std::option::Option::Some(8),
14167                Self::UnknownValue(u) => u.0.value(),
14168            }
14169        }
14170
14171        /// Gets the enum value as a string.
14172        ///
14173        /// Returns `None` if the enum contains an unknown value deserialized from
14174        /// the integer representation of enums.
14175        pub fn name(&self) -> std::option::Option<&str> {
14176            match self {
14177                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
14178                Self::New => std::option::Option::Some("NEW"),
14179                Self::NewSaving => std::option::Option::Some("NEW_SAVING"),
14180                Self::Submitted => std::option::Option::Some("SUBMITTED"),
14181                Self::Accepted => std::option::Option::Some("ACCEPTED"),
14182                Self::Running => std::option::Option::Some("RUNNING"),
14183                Self::Finished => std::option::Option::Some("FINISHED"),
14184                Self::Failed => std::option::Option::Some("FAILED"),
14185                Self::Killed => std::option::Option::Some("KILLED"),
14186                Self::UnknownValue(u) => u.0.name(),
14187            }
14188        }
14189    }
14190
14191    impl std::default::Default for State {
14192        fn default() -> Self {
14193            use std::convert::From;
14194            Self::from(0)
14195        }
14196    }
14197
14198    impl std::fmt::Display for State {
14199        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14200            wkt::internal::display_enum(f, self.name(), self.value())
14201        }
14202    }
14203
14204    impl std::convert::From<i32> for State {
14205        fn from(value: i32) -> Self {
14206            match value {
14207                0 => Self::Unspecified,
14208                1 => Self::New,
14209                2 => Self::NewSaving,
14210                3 => Self::Submitted,
14211                4 => Self::Accepted,
14212                5 => Self::Running,
14213                6 => Self::Finished,
14214                7 => Self::Failed,
14215                8 => Self::Killed,
14216                _ => Self::UnknownValue(state::UnknownValue(
14217                    wkt::internal::UnknownEnumValue::Integer(value),
14218                )),
14219            }
14220        }
14221    }
14222
14223    impl std::convert::From<&str> for State {
14224        fn from(value: &str) -> Self {
14225            use std::string::ToString;
14226            match value {
14227                "STATE_UNSPECIFIED" => Self::Unspecified,
14228                "NEW" => Self::New,
14229                "NEW_SAVING" => Self::NewSaving,
14230                "SUBMITTED" => Self::Submitted,
14231                "ACCEPTED" => Self::Accepted,
14232                "RUNNING" => Self::Running,
14233                "FINISHED" => Self::Finished,
14234                "FAILED" => Self::Failed,
14235                "KILLED" => Self::Killed,
14236                _ => Self::UnknownValue(state::UnknownValue(
14237                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14238                )),
14239            }
14240        }
14241    }
14242
14243    impl serde::ser::Serialize for State {
14244        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14245        where
14246            S: serde::Serializer,
14247        {
14248            match self {
14249                Self::Unspecified => serializer.serialize_i32(0),
14250                Self::New => serializer.serialize_i32(1),
14251                Self::NewSaving => serializer.serialize_i32(2),
14252                Self::Submitted => serializer.serialize_i32(3),
14253                Self::Accepted => serializer.serialize_i32(4),
14254                Self::Running => serializer.serialize_i32(5),
14255                Self::Finished => serializer.serialize_i32(6),
14256                Self::Failed => serializer.serialize_i32(7),
14257                Self::Killed => serializer.serialize_i32(8),
14258                Self::UnknownValue(u) => u.0.serialize(serializer),
14259            }
14260        }
14261    }
14262
14263    impl<'de> serde::de::Deserialize<'de> for State {
14264        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14265        where
14266            D: serde::Deserializer<'de>,
14267        {
14268            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
14269                ".google.cloud.dataproc.v1.YarnApplication.State",
14270            ))
14271        }
14272    }
14273}
14274
14275/// A Dataproc job resource.
14276#[derive(Clone, Default, PartialEq)]
14277#[non_exhaustive]
14278pub struct Job {
14279    /// Optional. The fully qualified reference to the job, which can be used to
14280    /// obtain the equivalent REST path of the job resource. If this property
14281    /// is not specified when a job is created, the server generates a
14282    /// \<code\>job_id\</code\>.
14283    pub reference: std::option::Option<crate::model::JobReference>,
14284
14285    /// Required. Job information, including how, when, and where to
14286    /// run the job.
14287    pub placement: std::option::Option<crate::model::JobPlacement>,
14288
14289    /// Output only. The job status. Additional application-specific
14290    /// status information might be contained in the \<code\>type_job\</code\>
14291    /// and \<code\>yarn_applications\</code\> fields.
14292    pub status: std::option::Option<crate::model::JobStatus>,
14293
14294    /// Output only. The previous job status.
14295    pub status_history: std::vec::Vec<crate::model::JobStatus>,
14296
14297    /// Output only. The collection of YARN applications spun up by this job.
14298    ///
14299    /// **Beta** Feature: This report is available for testing purposes only. It
14300    /// might be changed before final release.
14301    pub yarn_applications: std::vec::Vec<crate::model::YarnApplication>,
14302
14303    /// Output only. A URI pointing to the location of the stdout of the job's
14304    /// driver program.
14305    pub driver_output_resource_uri: std::string::String,
14306
14307    /// Output only. If present, the location of miscellaneous control files
14308    /// which can be used as part of job setup and handling. If not present,
14309    /// control files might be placed in the same location as `driver_output_uri`.
14310    pub driver_control_files_uri: std::string::String,
14311
14312    /// Optional. The labels to associate with this job.
14313    /// Label **keys** must contain 1 to 63 characters, and must conform to
14314    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
14315    /// Label **values** can be empty, but, if present, must contain 1 to 63
14316    /// characters, and must conform to [RFC
14317    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
14318    /// associated with a job.
14319    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
14320
14321    /// Optional. Job scheduling configuration.
14322    pub scheduling: std::option::Option<crate::model::JobScheduling>,
14323
14324    /// Output only. A UUID that uniquely identifies a job within the project
14325    /// over time. This is in contrast to a user-settable reference.job_id that
14326    /// might be reused over time.
14327    pub job_uuid: std::string::String,
14328
14329    /// Output only. Indicates whether the job is completed. If the value is
14330    /// `false`, the job is still in progress. If `true`, the job is completed, and
14331    /// `status.state` field will indicate if it was successful, failed,
14332    /// or cancelled.
14333    pub done: bool,
14334
14335    /// Optional. Driver scheduling configuration.
14336    pub driver_scheduling_config: std::option::Option<crate::model::DriverSchedulingConfig>,
14337
14338    /// Required. The application/framework-specific portion of the job.
14339    pub type_job: std::option::Option<crate::model::job::TypeJob>,
14340
14341    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14342}
14343
14344impl Job {
14345    /// Creates a new default instance.
14346    pub fn new() -> Self {
14347        std::default::Default::default()
14348    }
14349
14350    /// Sets the value of [reference][crate::model::Job::reference].
14351    ///
14352    /// # Example
14353    /// ```ignore,no_run
14354    /// # use google_cloud_dataproc_v1::model::Job;
14355    /// use google_cloud_dataproc_v1::model::JobReference;
14356    /// let x = Job::new().set_reference(JobReference::default()/* use setters */);
14357    /// ```
14358    pub fn set_reference<T>(mut self, v: T) -> Self
14359    where
14360        T: std::convert::Into<crate::model::JobReference>,
14361    {
14362        self.reference = std::option::Option::Some(v.into());
14363        self
14364    }
14365
14366    /// Sets or clears the value of [reference][crate::model::Job::reference].
14367    ///
14368    /// # Example
14369    /// ```ignore,no_run
14370    /// # use google_cloud_dataproc_v1::model::Job;
14371    /// use google_cloud_dataproc_v1::model::JobReference;
14372    /// let x = Job::new().set_or_clear_reference(Some(JobReference::default()/* use setters */));
14373    /// let x = Job::new().set_or_clear_reference(None::<JobReference>);
14374    /// ```
14375    pub fn set_or_clear_reference<T>(mut self, v: std::option::Option<T>) -> Self
14376    where
14377        T: std::convert::Into<crate::model::JobReference>,
14378    {
14379        self.reference = v.map(|x| x.into());
14380        self
14381    }
14382
14383    /// Sets the value of [placement][crate::model::Job::placement].
14384    ///
14385    /// # Example
14386    /// ```ignore,no_run
14387    /// # use google_cloud_dataproc_v1::model::Job;
14388    /// use google_cloud_dataproc_v1::model::JobPlacement;
14389    /// let x = Job::new().set_placement(JobPlacement::default()/* use setters */);
14390    /// ```
14391    pub fn set_placement<T>(mut self, v: T) -> Self
14392    where
14393        T: std::convert::Into<crate::model::JobPlacement>,
14394    {
14395        self.placement = std::option::Option::Some(v.into());
14396        self
14397    }
14398
14399    /// Sets or clears the value of [placement][crate::model::Job::placement].
14400    ///
14401    /// # Example
14402    /// ```ignore,no_run
14403    /// # use google_cloud_dataproc_v1::model::Job;
14404    /// use google_cloud_dataproc_v1::model::JobPlacement;
14405    /// let x = Job::new().set_or_clear_placement(Some(JobPlacement::default()/* use setters */));
14406    /// let x = Job::new().set_or_clear_placement(None::<JobPlacement>);
14407    /// ```
14408    pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
14409    where
14410        T: std::convert::Into<crate::model::JobPlacement>,
14411    {
14412        self.placement = v.map(|x| x.into());
14413        self
14414    }
14415
14416    /// Sets the value of [status][crate::model::Job::status].
14417    ///
14418    /// # Example
14419    /// ```ignore,no_run
14420    /// # use google_cloud_dataproc_v1::model::Job;
14421    /// use google_cloud_dataproc_v1::model::JobStatus;
14422    /// let x = Job::new().set_status(JobStatus::default()/* use setters */);
14423    /// ```
14424    pub fn set_status<T>(mut self, v: T) -> Self
14425    where
14426        T: std::convert::Into<crate::model::JobStatus>,
14427    {
14428        self.status = std::option::Option::Some(v.into());
14429        self
14430    }
14431
14432    /// Sets or clears the value of [status][crate::model::Job::status].
14433    ///
14434    /// # Example
14435    /// ```ignore,no_run
14436    /// # use google_cloud_dataproc_v1::model::Job;
14437    /// use google_cloud_dataproc_v1::model::JobStatus;
14438    /// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
14439    /// let x = Job::new().set_or_clear_status(None::<JobStatus>);
14440    /// ```
14441    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
14442    where
14443        T: std::convert::Into<crate::model::JobStatus>,
14444    {
14445        self.status = v.map(|x| x.into());
14446        self
14447    }
14448
14449    /// Sets the value of [status_history][crate::model::Job::status_history].
14450    ///
14451    /// # Example
14452    /// ```ignore,no_run
14453    /// # use google_cloud_dataproc_v1::model::Job;
14454    /// use google_cloud_dataproc_v1::model::JobStatus;
14455    /// let x = Job::new()
14456    ///     .set_status_history([
14457    ///         JobStatus::default()/* use setters */,
14458    ///         JobStatus::default()/* use (different) setters */,
14459    ///     ]);
14460    /// ```
14461    pub fn set_status_history<T, V>(mut self, v: T) -> Self
14462    where
14463        T: std::iter::IntoIterator<Item = V>,
14464        V: std::convert::Into<crate::model::JobStatus>,
14465    {
14466        use std::iter::Iterator;
14467        self.status_history = v.into_iter().map(|i| i.into()).collect();
14468        self
14469    }
14470
14471    /// Sets the value of [yarn_applications][crate::model::Job::yarn_applications].
14472    ///
14473    /// # Example
14474    /// ```ignore,no_run
14475    /// # use google_cloud_dataproc_v1::model::Job;
14476    /// use google_cloud_dataproc_v1::model::YarnApplication;
14477    /// let x = Job::new()
14478    ///     .set_yarn_applications([
14479    ///         YarnApplication::default()/* use setters */,
14480    ///         YarnApplication::default()/* use (different) setters */,
14481    ///     ]);
14482    /// ```
14483    pub fn set_yarn_applications<T, V>(mut self, v: T) -> Self
14484    where
14485        T: std::iter::IntoIterator<Item = V>,
14486        V: std::convert::Into<crate::model::YarnApplication>,
14487    {
14488        use std::iter::Iterator;
14489        self.yarn_applications = v.into_iter().map(|i| i.into()).collect();
14490        self
14491    }
14492
14493    /// Sets the value of [driver_output_resource_uri][crate::model::Job::driver_output_resource_uri].
14494    ///
14495    /// # Example
14496    /// ```ignore,no_run
14497    /// # use google_cloud_dataproc_v1::model::Job;
14498    /// let x = Job::new().set_driver_output_resource_uri("example");
14499    /// ```
14500    pub fn set_driver_output_resource_uri<T: std::convert::Into<std::string::String>>(
14501        mut self,
14502        v: T,
14503    ) -> Self {
14504        self.driver_output_resource_uri = v.into();
14505        self
14506    }
14507
14508    /// Sets the value of [driver_control_files_uri][crate::model::Job::driver_control_files_uri].
14509    ///
14510    /// # Example
14511    /// ```ignore,no_run
14512    /// # use google_cloud_dataproc_v1::model::Job;
14513    /// let x = Job::new().set_driver_control_files_uri("example");
14514    /// ```
14515    pub fn set_driver_control_files_uri<T: std::convert::Into<std::string::String>>(
14516        mut self,
14517        v: T,
14518    ) -> Self {
14519        self.driver_control_files_uri = v.into();
14520        self
14521    }
14522
14523    /// Sets the value of [labels][crate::model::Job::labels].
14524    ///
14525    /// # Example
14526    /// ```ignore,no_run
14527    /// # use google_cloud_dataproc_v1::model::Job;
14528    /// let x = Job::new().set_labels([
14529    ///     ("key0", "abc"),
14530    ///     ("key1", "xyz"),
14531    /// ]);
14532    /// ```
14533    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14534    where
14535        T: std::iter::IntoIterator<Item = (K, V)>,
14536        K: std::convert::Into<std::string::String>,
14537        V: std::convert::Into<std::string::String>,
14538    {
14539        use std::iter::Iterator;
14540        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14541        self
14542    }
14543
14544    /// Sets the value of [scheduling][crate::model::Job::scheduling].
14545    ///
14546    /// # Example
14547    /// ```ignore,no_run
14548    /// # use google_cloud_dataproc_v1::model::Job;
14549    /// use google_cloud_dataproc_v1::model::JobScheduling;
14550    /// let x = Job::new().set_scheduling(JobScheduling::default()/* use setters */);
14551    /// ```
14552    pub fn set_scheduling<T>(mut self, v: T) -> Self
14553    where
14554        T: std::convert::Into<crate::model::JobScheduling>,
14555    {
14556        self.scheduling = std::option::Option::Some(v.into());
14557        self
14558    }
14559
14560    /// Sets or clears the value of [scheduling][crate::model::Job::scheduling].
14561    ///
14562    /// # Example
14563    /// ```ignore,no_run
14564    /// # use google_cloud_dataproc_v1::model::Job;
14565    /// use google_cloud_dataproc_v1::model::JobScheduling;
14566    /// let x = Job::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
14567    /// let x = Job::new().set_or_clear_scheduling(None::<JobScheduling>);
14568    /// ```
14569    pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
14570    where
14571        T: std::convert::Into<crate::model::JobScheduling>,
14572    {
14573        self.scheduling = v.map(|x| x.into());
14574        self
14575    }
14576
14577    /// Sets the value of [job_uuid][crate::model::Job::job_uuid].
14578    ///
14579    /// # Example
14580    /// ```ignore,no_run
14581    /// # use google_cloud_dataproc_v1::model::Job;
14582    /// let x = Job::new().set_job_uuid("example");
14583    /// ```
14584    pub fn set_job_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14585        self.job_uuid = v.into();
14586        self
14587    }
14588
14589    /// Sets the value of [done][crate::model::Job::done].
14590    ///
14591    /// # Example
14592    /// ```ignore,no_run
14593    /// # use google_cloud_dataproc_v1::model::Job;
14594    /// let x = Job::new().set_done(true);
14595    /// ```
14596    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14597        self.done = v.into();
14598        self
14599    }
14600
14601    /// Sets the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14602    ///
14603    /// # Example
14604    /// ```ignore,no_run
14605    /// # use google_cloud_dataproc_v1::model::Job;
14606    /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14607    /// let x = Job::new().set_driver_scheduling_config(DriverSchedulingConfig::default()/* use setters */);
14608    /// ```
14609    pub fn set_driver_scheduling_config<T>(mut self, v: T) -> Self
14610    where
14611        T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14612    {
14613        self.driver_scheduling_config = std::option::Option::Some(v.into());
14614        self
14615    }
14616
14617    /// Sets or clears the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14618    ///
14619    /// # Example
14620    /// ```ignore,no_run
14621    /// # use google_cloud_dataproc_v1::model::Job;
14622    /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14623    /// let x = Job::new().set_or_clear_driver_scheduling_config(Some(DriverSchedulingConfig::default()/* use setters */));
14624    /// let x = Job::new().set_or_clear_driver_scheduling_config(None::<DriverSchedulingConfig>);
14625    /// ```
14626    pub fn set_or_clear_driver_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
14627    where
14628        T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14629    {
14630        self.driver_scheduling_config = v.map(|x| x.into());
14631        self
14632    }
14633
14634    /// Sets the value of [type_job][crate::model::Job::type_job].
14635    ///
14636    /// Note that all the setters affecting `type_job` are mutually
14637    /// exclusive.
14638    ///
14639    /// # Example
14640    /// ```ignore,no_run
14641    /// # use google_cloud_dataproc_v1::model::Job;
14642    /// use google_cloud_dataproc_v1::model::HadoopJob;
14643    /// let x = Job::new().set_type_job(Some(
14644    ///     google_cloud_dataproc_v1::model::job::TypeJob::HadoopJob(HadoopJob::default().into())));
14645    /// ```
14646    pub fn set_type_job<T: std::convert::Into<std::option::Option<crate::model::job::TypeJob>>>(
14647        mut self,
14648        v: T,
14649    ) -> Self {
14650        self.type_job = v.into();
14651        self
14652    }
14653
14654    /// The value of [type_job][crate::model::Job::type_job]
14655    /// if it holds a `HadoopJob`, `None` if the field is not set or
14656    /// holds a different branch.
14657    pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
14658        #[allow(unreachable_patterns)]
14659        self.type_job.as_ref().and_then(|v| match v {
14660            crate::model::job::TypeJob::HadoopJob(v) => std::option::Option::Some(v),
14661            _ => std::option::Option::None,
14662        })
14663    }
14664
14665    /// Sets the value of [type_job][crate::model::Job::type_job]
14666    /// to hold a `HadoopJob`.
14667    ///
14668    /// Note that all the setters affecting `type_job` are
14669    /// mutually exclusive.
14670    ///
14671    /// # Example
14672    /// ```ignore,no_run
14673    /// # use google_cloud_dataproc_v1::model::Job;
14674    /// use google_cloud_dataproc_v1::model::HadoopJob;
14675    /// let x = Job::new().set_hadoop_job(HadoopJob::default()/* use setters */);
14676    /// assert!(x.hadoop_job().is_some());
14677    /// assert!(x.spark_job().is_none());
14678    /// assert!(x.pyspark_job().is_none());
14679    /// assert!(x.hive_job().is_none());
14680    /// assert!(x.pig_job().is_none());
14681    /// assert!(x.spark_r_job().is_none());
14682    /// assert!(x.spark_sql_job().is_none());
14683    /// assert!(x.presto_job().is_none());
14684    /// assert!(x.trino_job().is_none());
14685    /// assert!(x.flink_job().is_none());
14686    /// ```
14687    pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
14688        mut self,
14689        v: T,
14690    ) -> Self {
14691        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HadoopJob(v.into()));
14692        self
14693    }
14694
14695    /// The value of [type_job][crate::model::Job::type_job]
14696    /// if it holds a `SparkJob`, `None` if the field is not set or
14697    /// holds a different branch.
14698    pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
14699        #[allow(unreachable_patterns)]
14700        self.type_job.as_ref().and_then(|v| match v {
14701            crate::model::job::TypeJob::SparkJob(v) => std::option::Option::Some(v),
14702            _ => std::option::Option::None,
14703        })
14704    }
14705
14706    /// Sets the value of [type_job][crate::model::Job::type_job]
14707    /// to hold a `SparkJob`.
14708    ///
14709    /// Note that all the setters affecting `type_job` are
14710    /// mutually exclusive.
14711    ///
14712    /// # Example
14713    /// ```ignore,no_run
14714    /// # use google_cloud_dataproc_v1::model::Job;
14715    /// use google_cloud_dataproc_v1::model::SparkJob;
14716    /// let x = Job::new().set_spark_job(SparkJob::default()/* use setters */);
14717    /// assert!(x.spark_job().is_some());
14718    /// assert!(x.hadoop_job().is_none());
14719    /// assert!(x.pyspark_job().is_none());
14720    /// assert!(x.hive_job().is_none());
14721    /// assert!(x.pig_job().is_none());
14722    /// assert!(x.spark_r_job().is_none());
14723    /// assert!(x.spark_sql_job().is_none());
14724    /// assert!(x.presto_job().is_none());
14725    /// assert!(x.trino_job().is_none());
14726    /// assert!(x.flink_job().is_none());
14727    /// ```
14728    pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
14729        mut self,
14730        v: T,
14731    ) -> Self {
14732        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkJob(v.into()));
14733        self
14734    }
14735
14736    /// The value of [type_job][crate::model::Job::type_job]
14737    /// if it holds a `PysparkJob`, `None` if the field is not set or
14738    /// holds a different branch.
14739    pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
14740        #[allow(unreachable_patterns)]
14741        self.type_job.as_ref().and_then(|v| match v {
14742            crate::model::job::TypeJob::PysparkJob(v) => std::option::Option::Some(v),
14743            _ => std::option::Option::None,
14744        })
14745    }
14746
14747    /// Sets the value of [type_job][crate::model::Job::type_job]
14748    /// to hold a `PysparkJob`.
14749    ///
14750    /// Note that all the setters affecting `type_job` are
14751    /// mutually exclusive.
14752    ///
14753    /// # Example
14754    /// ```ignore,no_run
14755    /// # use google_cloud_dataproc_v1::model::Job;
14756    /// use google_cloud_dataproc_v1::model::PySparkJob;
14757    /// let x = Job::new().set_pyspark_job(PySparkJob::default()/* use setters */);
14758    /// assert!(x.pyspark_job().is_some());
14759    /// assert!(x.hadoop_job().is_none());
14760    /// assert!(x.spark_job().is_none());
14761    /// assert!(x.hive_job().is_none());
14762    /// assert!(x.pig_job().is_none());
14763    /// assert!(x.spark_r_job().is_none());
14764    /// assert!(x.spark_sql_job().is_none());
14765    /// assert!(x.presto_job().is_none());
14766    /// assert!(x.trino_job().is_none());
14767    /// assert!(x.flink_job().is_none());
14768    /// ```
14769    pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
14770        mut self,
14771        v: T,
14772    ) -> Self {
14773        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PysparkJob(v.into()));
14774        self
14775    }
14776
14777    /// The value of [type_job][crate::model::Job::type_job]
14778    /// if it holds a `HiveJob`, `None` if the field is not set or
14779    /// holds a different branch.
14780    pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
14781        #[allow(unreachable_patterns)]
14782        self.type_job.as_ref().and_then(|v| match v {
14783            crate::model::job::TypeJob::HiveJob(v) => std::option::Option::Some(v),
14784            _ => std::option::Option::None,
14785        })
14786    }
14787
14788    /// Sets the value of [type_job][crate::model::Job::type_job]
14789    /// to hold a `HiveJob`.
14790    ///
14791    /// Note that all the setters affecting `type_job` are
14792    /// mutually exclusive.
14793    ///
14794    /// # Example
14795    /// ```ignore,no_run
14796    /// # use google_cloud_dataproc_v1::model::Job;
14797    /// use google_cloud_dataproc_v1::model::HiveJob;
14798    /// let x = Job::new().set_hive_job(HiveJob::default()/* use setters */);
14799    /// assert!(x.hive_job().is_some());
14800    /// assert!(x.hadoop_job().is_none());
14801    /// assert!(x.spark_job().is_none());
14802    /// assert!(x.pyspark_job().is_none());
14803    /// assert!(x.pig_job().is_none());
14804    /// assert!(x.spark_r_job().is_none());
14805    /// assert!(x.spark_sql_job().is_none());
14806    /// assert!(x.presto_job().is_none());
14807    /// assert!(x.trino_job().is_none());
14808    /// assert!(x.flink_job().is_none());
14809    /// ```
14810    pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
14811        mut self,
14812        v: T,
14813    ) -> Self {
14814        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HiveJob(v.into()));
14815        self
14816    }
14817
14818    /// The value of [type_job][crate::model::Job::type_job]
14819    /// if it holds a `PigJob`, `None` if the field is not set or
14820    /// holds a different branch.
14821    pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
14822        #[allow(unreachable_patterns)]
14823        self.type_job.as_ref().and_then(|v| match v {
14824            crate::model::job::TypeJob::PigJob(v) => std::option::Option::Some(v),
14825            _ => std::option::Option::None,
14826        })
14827    }
14828
14829    /// Sets the value of [type_job][crate::model::Job::type_job]
14830    /// to hold a `PigJob`.
14831    ///
14832    /// Note that all the setters affecting `type_job` are
14833    /// mutually exclusive.
14834    ///
14835    /// # Example
14836    /// ```ignore,no_run
14837    /// # use google_cloud_dataproc_v1::model::Job;
14838    /// use google_cloud_dataproc_v1::model::PigJob;
14839    /// let x = Job::new().set_pig_job(PigJob::default()/* use setters */);
14840    /// assert!(x.pig_job().is_some());
14841    /// assert!(x.hadoop_job().is_none());
14842    /// assert!(x.spark_job().is_none());
14843    /// assert!(x.pyspark_job().is_none());
14844    /// assert!(x.hive_job().is_none());
14845    /// assert!(x.spark_r_job().is_none());
14846    /// assert!(x.spark_sql_job().is_none());
14847    /// assert!(x.presto_job().is_none());
14848    /// assert!(x.trino_job().is_none());
14849    /// assert!(x.flink_job().is_none());
14850    /// ```
14851    pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
14852        mut self,
14853        v: T,
14854    ) -> Self {
14855        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PigJob(v.into()));
14856        self
14857    }
14858
14859    /// The value of [type_job][crate::model::Job::type_job]
14860    /// if it holds a `SparkRJob`, `None` if the field is not set or
14861    /// holds a different branch.
14862    pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
14863        #[allow(unreachable_patterns)]
14864        self.type_job.as_ref().and_then(|v| match v {
14865            crate::model::job::TypeJob::SparkRJob(v) => std::option::Option::Some(v),
14866            _ => std::option::Option::None,
14867        })
14868    }
14869
14870    /// Sets the value of [type_job][crate::model::Job::type_job]
14871    /// to hold a `SparkRJob`.
14872    ///
14873    /// Note that all the setters affecting `type_job` are
14874    /// mutually exclusive.
14875    ///
14876    /// # Example
14877    /// ```ignore,no_run
14878    /// # use google_cloud_dataproc_v1::model::Job;
14879    /// use google_cloud_dataproc_v1::model::SparkRJob;
14880    /// let x = Job::new().set_spark_r_job(SparkRJob::default()/* use setters */);
14881    /// assert!(x.spark_r_job().is_some());
14882    /// assert!(x.hadoop_job().is_none());
14883    /// assert!(x.spark_job().is_none());
14884    /// assert!(x.pyspark_job().is_none());
14885    /// assert!(x.hive_job().is_none());
14886    /// assert!(x.pig_job().is_none());
14887    /// assert!(x.spark_sql_job().is_none());
14888    /// assert!(x.presto_job().is_none());
14889    /// assert!(x.trino_job().is_none());
14890    /// assert!(x.flink_job().is_none());
14891    /// ```
14892    pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
14893        mut self,
14894        v: T,
14895    ) -> Self {
14896        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkRJob(v.into()));
14897        self
14898    }
14899
14900    /// The value of [type_job][crate::model::Job::type_job]
14901    /// if it holds a `SparkSqlJob`, `None` if the field is not set or
14902    /// holds a different branch.
14903    pub fn spark_sql_job(
14904        &self,
14905    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
14906        #[allow(unreachable_patterns)]
14907        self.type_job.as_ref().and_then(|v| match v {
14908            crate::model::job::TypeJob::SparkSqlJob(v) => std::option::Option::Some(v),
14909            _ => std::option::Option::None,
14910        })
14911    }
14912
14913    /// Sets the value of [type_job][crate::model::Job::type_job]
14914    /// to hold a `SparkSqlJob`.
14915    ///
14916    /// Note that all the setters affecting `type_job` are
14917    /// mutually exclusive.
14918    ///
14919    /// # Example
14920    /// ```ignore,no_run
14921    /// # use google_cloud_dataproc_v1::model::Job;
14922    /// use google_cloud_dataproc_v1::model::SparkSqlJob;
14923    /// let x = Job::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
14924    /// assert!(x.spark_sql_job().is_some());
14925    /// assert!(x.hadoop_job().is_none());
14926    /// assert!(x.spark_job().is_none());
14927    /// assert!(x.pyspark_job().is_none());
14928    /// assert!(x.hive_job().is_none());
14929    /// assert!(x.pig_job().is_none());
14930    /// assert!(x.spark_r_job().is_none());
14931    /// assert!(x.presto_job().is_none());
14932    /// assert!(x.trino_job().is_none());
14933    /// assert!(x.flink_job().is_none());
14934    /// ```
14935    pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
14936        mut self,
14937        v: T,
14938    ) -> Self {
14939        self.type_job =
14940            std::option::Option::Some(crate::model::job::TypeJob::SparkSqlJob(v.into()));
14941        self
14942    }
14943
14944    /// The value of [type_job][crate::model::Job::type_job]
14945    /// if it holds a `PrestoJob`, `None` if the field is not set or
14946    /// holds a different branch.
14947    pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
14948        #[allow(unreachable_patterns)]
14949        self.type_job.as_ref().and_then(|v| match v {
14950            crate::model::job::TypeJob::PrestoJob(v) => std::option::Option::Some(v),
14951            _ => std::option::Option::None,
14952        })
14953    }
14954
14955    /// Sets the value of [type_job][crate::model::Job::type_job]
14956    /// to hold a `PrestoJob`.
14957    ///
14958    /// Note that all the setters affecting `type_job` are
14959    /// mutually exclusive.
14960    ///
14961    /// # Example
14962    /// ```ignore,no_run
14963    /// # use google_cloud_dataproc_v1::model::Job;
14964    /// use google_cloud_dataproc_v1::model::PrestoJob;
14965    /// let x = Job::new().set_presto_job(PrestoJob::default()/* use setters */);
14966    /// assert!(x.presto_job().is_some());
14967    /// assert!(x.hadoop_job().is_none());
14968    /// assert!(x.spark_job().is_none());
14969    /// assert!(x.pyspark_job().is_none());
14970    /// assert!(x.hive_job().is_none());
14971    /// assert!(x.pig_job().is_none());
14972    /// assert!(x.spark_r_job().is_none());
14973    /// assert!(x.spark_sql_job().is_none());
14974    /// assert!(x.trino_job().is_none());
14975    /// assert!(x.flink_job().is_none());
14976    /// ```
14977    pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
14978        mut self,
14979        v: T,
14980    ) -> Self {
14981        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PrestoJob(v.into()));
14982        self
14983    }
14984
14985    /// The value of [type_job][crate::model::Job::type_job]
14986    /// if it holds a `TrinoJob`, `None` if the field is not set or
14987    /// holds a different branch.
14988    pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
14989        #[allow(unreachable_patterns)]
14990        self.type_job.as_ref().and_then(|v| match v {
14991            crate::model::job::TypeJob::TrinoJob(v) => std::option::Option::Some(v),
14992            _ => std::option::Option::None,
14993        })
14994    }
14995
14996    /// Sets the value of [type_job][crate::model::Job::type_job]
14997    /// to hold a `TrinoJob`.
14998    ///
14999    /// Note that all the setters affecting `type_job` are
15000    /// mutually exclusive.
15001    ///
15002    /// # Example
15003    /// ```ignore,no_run
15004    /// # use google_cloud_dataproc_v1::model::Job;
15005    /// use google_cloud_dataproc_v1::model::TrinoJob;
15006    /// let x = Job::new().set_trino_job(TrinoJob::default()/* use setters */);
15007    /// assert!(x.trino_job().is_some());
15008    /// assert!(x.hadoop_job().is_none());
15009    /// assert!(x.spark_job().is_none());
15010    /// assert!(x.pyspark_job().is_none());
15011    /// assert!(x.hive_job().is_none());
15012    /// assert!(x.pig_job().is_none());
15013    /// assert!(x.spark_r_job().is_none());
15014    /// assert!(x.spark_sql_job().is_none());
15015    /// assert!(x.presto_job().is_none());
15016    /// assert!(x.flink_job().is_none());
15017    /// ```
15018    pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
15019        mut self,
15020        v: T,
15021    ) -> Self {
15022        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::TrinoJob(v.into()));
15023        self
15024    }
15025
15026    /// The value of [type_job][crate::model::Job::type_job]
15027    /// if it holds a `FlinkJob`, `None` if the field is not set or
15028    /// holds a different branch.
15029    pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
15030        #[allow(unreachable_patterns)]
15031        self.type_job.as_ref().and_then(|v| match v {
15032            crate::model::job::TypeJob::FlinkJob(v) => std::option::Option::Some(v),
15033            _ => std::option::Option::None,
15034        })
15035    }
15036
15037    /// Sets the value of [type_job][crate::model::Job::type_job]
15038    /// to hold a `FlinkJob`.
15039    ///
15040    /// Note that all the setters affecting `type_job` are
15041    /// mutually exclusive.
15042    ///
15043    /// # Example
15044    /// ```ignore,no_run
15045    /// # use google_cloud_dataproc_v1::model::Job;
15046    /// use google_cloud_dataproc_v1::model::FlinkJob;
15047    /// let x = Job::new().set_flink_job(FlinkJob::default()/* use setters */);
15048    /// assert!(x.flink_job().is_some());
15049    /// assert!(x.hadoop_job().is_none());
15050    /// assert!(x.spark_job().is_none());
15051    /// assert!(x.pyspark_job().is_none());
15052    /// assert!(x.hive_job().is_none());
15053    /// assert!(x.pig_job().is_none());
15054    /// assert!(x.spark_r_job().is_none());
15055    /// assert!(x.spark_sql_job().is_none());
15056    /// assert!(x.presto_job().is_none());
15057    /// assert!(x.trino_job().is_none());
15058    /// ```
15059    pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
15060        mut self,
15061        v: T,
15062    ) -> Self {
15063        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::FlinkJob(v.into()));
15064        self
15065    }
15066}
15067
15068impl wkt::message::Message for Job {
15069    fn typename() -> &'static str {
15070        "type.googleapis.com/google.cloud.dataproc.v1.Job"
15071    }
15072}
15073
15074/// Defines additional types related to [Job].
15075pub mod job {
15076    #[allow(unused_imports)]
15077    use super::*;
15078
15079    /// Required. The application/framework-specific portion of the job.
15080    #[derive(Clone, Debug, PartialEq)]
15081    #[non_exhaustive]
15082    pub enum TypeJob {
15083        /// Optional. Job is a Hadoop job.
15084        HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
15085        /// Optional. Job is a Spark job.
15086        SparkJob(std::boxed::Box<crate::model::SparkJob>),
15087        /// Optional. Job is a PySpark job.
15088        PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
15089        /// Optional. Job is a Hive job.
15090        HiveJob(std::boxed::Box<crate::model::HiveJob>),
15091        /// Optional. Job is a Pig job.
15092        PigJob(std::boxed::Box<crate::model::PigJob>),
15093        /// Optional. Job is a SparkR job.
15094        SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
15095        /// Optional. Job is a SparkSql job.
15096        SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
15097        /// Optional. Job is a Presto job.
15098        PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
15099        /// Optional. Job is a Trino job.
15100        TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
15101        /// Optional. Job is a Flink job.
15102        FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
15103    }
15104}
15105
15106/// Driver scheduling configuration.
15107#[derive(Clone, Default, PartialEq)]
15108#[non_exhaustive]
15109pub struct DriverSchedulingConfig {
15110    /// Required. The amount of memory in MB the driver is requesting.
15111    pub memory_mb: i32,
15112
15113    /// Required. The number of vCPUs the driver is requesting.
15114    pub vcores: i32,
15115
15116    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15117}
15118
15119impl DriverSchedulingConfig {
15120    /// Creates a new default instance.
15121    pub fn new() -> Self {
15122        std::default::Default::default()
15123    }
15124
15125    /// Sets the value of [memory_mb][crate::model::DriverSchedulingConfig::memory_mb].
15126    ///
15127    /// # Example
15128    /// ```ignore,no_run
15129    /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15130    /// let x = DriverSchedulingConfig::new().set_memory_mb(42);
15131    /// ```
15132    pub fn set_memory_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15133        self.memory_mb = v.into();
15134        self
15135    }
15136
15137    /// Sets the value of [vcores][crate::model::DriverSchedulingConfig::vcores].
15138    ///
15139    /// # Example
15140    /// ```ignore,no_run
15141    /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15142    /// let x = DriverSchedulingConfig::new().set_vcores(42);
15143    /// ```
15144    pub fn set_vcores<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15145        self.vcores = v.into();
15146        self
15147    }
15148}
15149
15150impl wkt::message::Message for DriverSchedulingConfig {
15151    fn typename() -> &'static str {
15152        "type.googleapis.com/google.cloud.dataproc.v1.DriverSchedulingConfig"
15153    }
15154}
15155
15156/// Job scheduling options.
15157#[derive(Clone, Default, PartialEq)]
15158#[non_exhaustive]
15159pub struct JobScheduling {
15160    /// Optional. Maximum number of times per hour a driver can be restarted as
15161    /// a result of driver exiting with non-zero code before job is
15162    /// reported failed.
15163    ///
15164    /// A job might be reported as thrashing if the driver exits with a non-zero
15165    /// code four times within a 10-minute window.
15166    ///
15167    /// Maximum value is 10.
15168    ///
15169    /// **Note:** This restartable job option is not supported in Dataproc
15170    /// [workflow templates]
15171    /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template>).
15172    pub max_failures_per_hour: i32,
15173
15174    /// Optional. Maximum total number of times a driver can be restarted as a
15175    /// result of the driver exiting with a non-zero code. After the maximum number
15176    /// is reached, the job will be reported as failed.
15177    ///
15178    /// Maximum value is 240.
15179    ///
15180    /// **Note:** Currently, this restartable job option is
15181    /// not supported in Dataproc
15182    /// [workflow
15183    /// templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
15184    pub max_failures_total: i32,
15185
15186    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15187}
15188
15189impl JobScheduling {
15190    /// Creates a new default instance.
15191    pub fn new() -> Self {
15192        std::default::Default::default()
15193    }
15194
15195    /// Sets the value of [max_failures_per_hour][crate::model::JobScheduling::max_failures_per_hour].
15196    ///
15197    /// # Example
15198    /// ```ignore,no_run
15199    /// # use google_cloud_dataproc_v1::model::JobScheduling;
15200    /// let x = JobScheduling::new().set_max_failures_per_hour(42);
15201    /// ```
15202    pub fn set_max_failures_per_hour<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15203        self.max_failures_per_hour = v.into();
15204        self
15205    }
15206
15207    /// Sets the value of [max_failures_total][crate::model::JobScheduling::max_failures_total].
15208    ///
15209    /// # Example
15210    /// ```ignore,no_run
15211    /// # use google_cloud_dataproc_v1::model::JobScheduling;
15212    /// let x = JobScheduling::new().set_max_failures_total(42);
15213    /// ```
15214    pub fn set_max_failures_total<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15215        self.max_failures_total = v.into();
15216        self
15217    }
15218}
15219
15220impl wkt::message::Message for JobScheduling {
15221    fn typename() -> &'static str {
15222        "type.googleapis.com/google.cloud.dataproc.v1.JobScheduling"
15223    }
15224}
15225
15226/// A request to submit a job.
15227#[derive(Clone, Default, PartialEq)]
15228#[non_exhaustive]
15229pub struct SubmitJobRequest {
15230    /// Required. The ID of the Google Cloud Platform project that the job
15231    /// belongs to.
15232    pub project_id: std::string::String,
15233
15234    /// Required. The Dataproc region in which to handle the request.
15235    pub region: std::string::String,
15236
15237    /// Required. The job resource.
15238    pub job: std::option::Option<crate::model::Job>,
15239
15240    /// Optional. A unique id used to identify the request. If the server
15241    /// receives two
15242    /// [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
15243    /// with the same id, then the second request will be ignored and the
15244    /// first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend
15245    /// is returned.
15246    ///
15247    /// It is recommended to always set this value to a
15248    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15249    ///
15250    /// The id must contain only letters (a-z, A-Z), numbers (0-9),
15251    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15252    ///
15253    /// [google.cloud.dataproc.v1.Job]: crate::model::Job
15254    pub request_id: std::string::String,
15255
15256    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15257}
15258
15259impl SubmitJobRequest {
15260    /// Creates a new default instance.
15261    pub fn new() -> Self {
15262        std::default::Default::default()
15263    }
15264
15265    /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
15266    ///
15267    /// # Example
15268    /// ```ignore,no_run
15269    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15270    /// let x = SubmitJobRequest::new().set_project_id("example");
15271    /// ```
15272    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15273        self.project_id = v.into();
15274        self
15275    }
15276
15277    /// Sets the value of [region][crate::model::SubmitJobRequest::region].
15278    ///
15279    /// # Example
15280    /// ```ignore,no_run
15281    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15282    /// let x = SubmitJobRequest::new().set_region("example");
15283    /// ```
15284    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15285        self.region = v.into();
15286        self
15287    }
15288
15289    /// Sets the value of [job][crate::model::SubmitJobRequest::job].
15290    ///
15291    /// # Example
15292    /// ```ignore,no_run
15293    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15294    /// use google_cloud_dataproc_v1::model::Job;
15295    /// let x = SubmitJobRequest::new().set_job(Job::default()/* use setters */);
15296    /// ```
15297    pub fn set_job<T>(mut self, v: T) -> Self
15298    where
15299        T: std::convert::Into<crate::model::Job>,
15300    {
15301        self.job = std::option::Option::Some(v.into());
15302        self
15303    }
15304
15305    /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
15306    ///
15307    /// # Example
15308    /// ```ignore,no_run
15309    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15310    /// use google_cloud_dataproc_v1::model::Job;
15311    /// let x = SubmitJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
15312    /// let x = SubmitJobRequest::new().set_or_clear_job(None::<Job>);
15313    /// ```
15314    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
15315    where
15316        T: std::convert::Into<crate::model::Job>,
15317    {
15318        self.job = v.map(|x| x.into());
15319        self
15320    }
15321
15322    /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
15323    ///
15324    /// # Example
15325    /// ```ignore,no_run
15326    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15327    /// let x = SubmitJobRequest::new().set_request_id("example");
15328    /// ```
15329    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15330        self.request_id = v.into();
15331        self
15332    }
15333}
15334
15335impl wkt::message::Message for SubmitJobRequest {
15336    fn typename() -> &'static str {
15337        "type.googleapis.com/google.cloud.dataproc.v1.SubmitJobRequest"
15338    }
15339}
15340
15341/// Job Operation metadata.
15342#[derive(Clone, Default, PartialEq)]
15343#[non_exhaustive]
15344pub struct JobMetadata {
15345    /// Output only. The job id.
15346    pub job_id: std::string::String,
15347
15348    /// Output only. Most recent job status.
15349    pub status: std::option::Option<crate::model::JobStatus>,
15350
15351    /// Output only. Operation type.
15352    pub operation_type: std::string::String,
15353
15354    /// Output only. Job submission time.
15355    pub start_time: std::option::Option<wkt::Timestamp>,
15356
15357    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15358}
15359
15360impl JobMetadata {
15361    /// Creates a new default instance.
15362    pub fn new() -> Self {
15363        std::default::Default::default()
15364    }
15365
15366    /// Sets the value of [job_id][crate::model::JobMetadata::job_id].
15367    ///
15368    /// # Example
15369    /// ```ignore,no_run
15370    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15371    /// let x = JobMetadata::new().set_job_id("example");
15372    /// ```
15373    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15374        self.job_id = v.into();
15375        self
15376    }
15377
15378    /// Sets the value of [status][crate::model::JobMetadata::status].
15379    ///
15380    /// # Example
15381    /// ```ignore,no_run
15382    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15383    /// use google_cloud_dataproc_v1::model::JobStatus;
15384    /// let x = JobMetadata::new().set_status(JobStatus::default()/* use setters */);
15385    /// ```
15386    pub fn set_status<T>(mut self, v: T) -> Self
15387    where
15388        T: std::convert::Into<crate::model::JobStatus>,
15389    {
15390        self.status = std::option::Option::Some(v.into());
15391        self
15392    }
15393
15394    /// Sets or clears the value of [status][crate::model::JobMetadata::status].
15395    ///
15396    /// # Example
15397    /// ```ignore,no_run
15398    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15399    /// use google_cloud_dataproc_v1::model::JobStatus;
15400    /// let x = JobMetadata::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
15401    /// let x = JobMetadata::new().set_or_clear_status(None::<JobStatus>);
15402    /// ```
15403    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
15404    where
15405        T: std::convert::Into<crate::model::JobStatus>,
15406    {
15407        self.status = v.map(|x| x.into());
15408        self
15409    }
15410
15411    /// Sets the value of [operation_type][crate::model::JobMetadata::operation_type].
15412    ///
15413    /// # Example
15414    /// ```ignore,no_run
15415    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15416    /// let x = JobMetadata::new().set_operation_type("example");
15417    /// ```
15418    pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15419        self.operation_type = v.into();
15420        self
15421    }
15422
15423    /// Sets the value of [start_time][crate::model::JobMetadata::start_time].
15424    ///
15425    /// # Example
15426    /// ```ignore,no_run
15427    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15428    /// use wkt::Timestamp;
15429    /// let x = JobMetadata::new().set_start_time(Timestamp::default()/* use setters */);
15430    /// ```
15431    pub fn set_start_time<T>(mut self, v: T) -> Self
15432    where
15433        T: std::convert::Into<wkt::Timestamp>,
15434    {
15435        self.start_time = std::option::Option::Some(v.into());
15436        self
15437    }
15438
15439    /// Sets or clears the value of [start_time][crate::model::JobMetadata::start_time].
15440    ///
15441    /// # Example
15442    /// ```ignore,no_run
15443    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15444    /// use wkt::Timestamp;
15445    /// let x = JobMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
15446    /// let x = JobMetadata::new().set_or_clear_start_time(None::<Timestamp>);
15447    /// ```
15448    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
15449    where
15450        T: std::convert::Into<wkt::Timestamp>,
15451    {
15452        self.start_time = v.map(|x| x.into());
15453        self
15454    }
15455}
15456
15457impl wkt::message::Message for JobMetadata {
15458    fn typename() -> &'static str {
15459        "type.googleapis.com/google.cloud.dataproc.v1.JobMetadata"
15460    }
15461}
15462
15463/// A request to get the resource representation for a job in a project.
15464#[derive(Clone, Default, PartialEq)]
15465#[non_exhaustive]
15466pub struct GetJobRequest {
15467    /// Required. The ID of the Google Cloud Platform project that the job
15468    /// belongs to.
15469    pub project_id: std::string::String,
15470
15471    /// Required. The Dataproc region in which to handle the request.
15472    pub region: std::string::String,
15473
15474    /// Required. The job ID.
15475    pub job_id: std::string::String,
15476
15477    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15478}
15479
15480impl GetJobRequest {
15481    /// Creates a new default instance.
15482    pub fn new() -> Self {
15483        std::default::Default::default()
15484    }
15485
15486    /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
15487    ///
15488    /// # Example
15489    /// ```ignore,no_run
15490    /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15491    /// let x = GetJobRequest::new().set_project_id("example");
15492    /// ```
15493    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15494        self.project_id = v.into();
15495        self
15496    }
15497
15498    /// Sets the value of [region][crate::model::GetJobRequest::region].
15499    ///
15500    /// # Example
15501    /// ```ignore,no_run
15502    /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15503    /// let x = GetJobRequest::new().set_region("example");
15504    /// ```
15505    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15506        self.region = v.into();
15507        self
15508    }
15509
15510    /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
15511    ///
15512    /// # Example
15513    /// ```ignore,no_run
15514    /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15515    /// let x = GetJobRequest::new().set_job_id("example");
15516    /// ```
15517    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15518        self.job_id = v.into();
15519        self
15520    }
15521}
15522
15523impl wkt::message::Message for GetJobRequest {
15524    fn typename() -> &'static str {
15525        "type.googleapis.com/google.cloud.dataproc.v1.GetJobRequest"
15526    }
15527}
15528
15529/// A request to list jobs in a project.
15530#[derive(Clone, Default, PartialEq)]
15531#[non_exhaustive]
15532pub struct ListJobsRequest {
15533    /// Required. The ID of the Google Cloud Platform project that the job
15534    /// belongs to.
15535    pub project_id: std::string::String,
15536
15537    /// Required. The Dataproc region in which to handle the request.
15538    pub region: std::string::String,
15539
15540    /// Optional. The number of results to return in each response.
15541    pub page_size: i32,
15542
15543    /// Optional. The page token, returned by a previous call, to request the
15544    /// next page of results.
15545    pub page_token: std::string::String,
15546
15547    /// Optional. If set, the returned jobs list includes only jobs that were
15548    /// submitted to the named cluster.
15549    pub cluster_name: std::string::String,
15550
15551    /// Optional. Specifies enumerated categories of jobs to list.
15552    /// (default = match ALL jobs).
15553    ///
15554    /// If `filter` is provided, `jobStateMatcher` will be ignored.
15555    pub job_state_matcher: crate::model::list_jobs_request::JobStateMatcher,
15556
15557    /// Optional. A filter constraining the jobs to list. Filters are
15558    /// case-sensitive and have the following syntax:
15559    ///
15560    /// [field = value] AND [field [= value]] ...
15561    ///
15562    /// where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
15563    /// key. **value** can be `*` to match all values.
15564    /// `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
15565    /// Only the logical `AND` operator is supported; space-separated items are
15566    /// treated as having an implicit `AND` operator.
15567    ///
15568    /// Example filter:
15569    ///
15570    /// status.state = ACTIVE AND labels.env = staging AND labels.starred = *
15571    pub filter: std::string::String,
15572
15573    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15574}
15575
15576impl ListJobsRequest {
15577    /// Creates a new default instance.
15578    pub fn new() -> Self {
15579        std::default::Default::default()
15580    }
15581
15582    /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
15583    ///
15584    /// # Example
15585    /// ```ignore,no_run
15586    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15587    /// let x = ListJobsRequest::new().set_project_id("example");
15588    /// ```
15589    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15590        self.project_id = v.into();
15591        self
15592    }
15593
15594    /// Sets the value of [region][crate::model::ListJobsRequest::region].
15595    ///
15596    /// # Example
15597    /// ```ignore,no_run
15598    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15599    /// let x = ListJobsRequest::new().set_region("example");
15600    /// ```
15601    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15602        self.region = v.into();
15603        self
15604    }
15605
15606    /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
15607    ///
15608    /// # Example
15609    /// ```ignore,no_run
15610    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15611    /// let x = ListJobsRequest::new().set_page_size(42);
15612    /// ```
15613    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15614        self.page_size = v.into();
15615        self
15616    }
15617
15618    /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
15619    ///
15620    /// # Example
15621    /// ```ignore,no_run
15622    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15623    /// let x = ListJobsRequest::new().set_page_token("example");
15624    /// ```
15625    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15626        self.page_token = v.into();
15627        self
15628    }
15629
15630    /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
15631    ///
15632    /// # Example
15633    /// ```ignore,no_run
15634    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15635    /// let x = ListJobsRequest::new().set_cluster_name("example");
15636    /// ```
15637    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15638        self.cluster_name = v.into();
15639        self
15640    }
15641
15642    /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
15643    ///
15644    /// # Example
15645    /// ```ignore,no_run
15646    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15647    /// use google_cloud_dataproc_v1::model::list_jobs_request::JobStateMatcher;
15648    /// let x0 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::Active);
15649    /// let x1 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::NonActive);
15650    /// ```
15651    pub fn set_job_state_matcher<
15652        T: std::convert::Into<crate::model::list_jobs_request::JobStateMatcher>,
15653    >(
15654        mut self,
15655        v: T,
15656    ) -> Self {
15657        self.job_state_matcher = v.into();
15658        self
15659    }
15660
15661    /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
15662    ///
15663    /// # Example
15664    /// ```ignore,no_run
15665    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15666    /// let x = ListJobsRequest::new().set_filter("example");
15667    /// ```
15668    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15669        self.filter = v.into();
15670        self
15671    }
15672}
15673
15674impl wkt::message::Message for ListJobsRequest {
15675    fn typename() -> &'static str {
15676        "type.googleapis.com/google.cloud.dataproc.v1.ListJobsRequest"
15677    }
15678}
15679
15680/// Defines additional types related to [ListJobsRequest].
15681pub mod list_jobs_request {
15682    #[allow(unused_imports)]
15683    use super::*;
15684
15685    /// A matcher that specifies categories of job states.
15686    ///
15687    /// # Working with unknown values
15688    ///
15689    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15690    /// additional enum variants at any time. Adding new variants is not considered
15691    /// a breaking change. Applications should write their code in anticipation of:
15692    ///
15693    /// - New values appearing in future releases of the client library, **and**
15694    /// - New values received dynamically, without application changes.
15695    ///
15696    /// Please consult the [Working with enums] section in the user guide for some
15697    /// guidelines.
15698    ///
15699    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15700    #[derive(Clone, Debug, PartialEq)]
15701    #[non_exhaustive]
15702    pub enum JobStateMatcher {
15703        /// Match all jobs, regardless of state.
15704        All,
15705        /// Only match jobs in non-terminal states: PENDING, RUNNING, or
15706        /// CANCEL_PENDING.
15707        Active,
15708        /// Only match jobs in terminal states: CANCELLED, DONE, or ERROR.
15709        NonActive,
15710        /// If set, the enum was initialized with an unknown value.
15711        ///
15712        /// Applications can examine the value using [JobStateMatcher::value] or
15713        /// [JobStateMatcher::name].
15714        UnknownValue(job_state_matcher::UnknownValue),
15715    }
15716
15717    #[doc(hidden)]
15718    pub mod job_state_matcher {
15719        #[allow(unused_imports)]
15720        use super::*;
15721        #[derive(Clone, Debug, PartialEq)]
15722        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15723    }
15724
15725    impl JobStateMatcher {
15726        /// Gets the enum value.
15727        ///
15728        /// Returns `None` if the enum contains an unknown value deserialized from
15729        /// the string representation of enums.
15730        pub fn value(&self) -> std::option::Option<i32> {
15731            match self {
15732                Self::All => std::option::Option::Some(0),
15733                Self::Active => std::option::Option::Some(1),
15734                Self::NonActive => std::option::Option::Some(2),
15735                Self::UnknownValue(u) => u.0.value(),
15736            }
15737        }
15738
15739        /// Gets the enum value as a string.
15740        ///
15741        /// Returns `None` if the enum contains an unknown value deserialized from
15742        /// the integer representation of enums.
15743        pub fn name(&self) -> std::option::Option<&str> {
15744            match self {
15745                Self::All => std::option::Option::Some("ALL"),
15746                Self::Active => std::option::Option::Some("ACTIVE"),
15747                Self::NonActive => std::option::Option::Some("NON_ACTIVE"),
15748                Self::UnknownValue(u) => u.0.name(),
15749            }
15750        }
15751    }
15752
15753    impl std::default::Default for JobStateMatcher {
15754        fn default() -> Self {
15755            use std::convert::From;
15756            Self::from(0)
15757        }
15758    }
15759
15760    impl std::fmt::Display for JobStateMatcher {
15761        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15762            wkt::internal::display_enum(f, self.name(), self.value())
15763        }
15764    }
15765
15766    impl std::convert::From<i32> for JobStateMatcher {
15767        fn from(value: i32) -> Self {
15768            match value {
15769                0 => Self::All,
15770                1 => Self::Active,
15771                2 => Self::NonActive,
15772                _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15773                    wkt::internal::UnknownEnumValue::Integer(value),
15774                )),
15775            }
15776        }
15777    }
15778
15779    impl std::convert::From<&str> for JobStateMatcher {
15780        fn from(value: &str) -> Self {
15781            use std::string::ToString;
15782            match value {
15783                "ALL" => Self::All,
15784                "ACTIVE" => Self::Active,
15785                "NON_ACTIVE" => Self::NonActive,
15786                _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15787                    wkt::internal::UnknownEnumValue::String(value.to_string()),
15788                )),
15789            }
15790        }
15791    }
15792
15793    impl serde::ser::Serialize for JobStateMatcher {
15794        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15795        where
15796            S: serde::Serializer,
15797        {
15798            match self {
15799                Self::All => serializer.serialize_i32(0),
15800                Self::Active => serializer.serialize_i32(1),
15801                Self::NonActive => serializer.serialize_i32(2),
15802                Self::UnknownValue(u) => u.0.serialize(serializer),
15803            }
15804        }
15805    }
15806
15807    impl<'de> serde::de::Deserialize<'de> for JobStateMatcher {
15808        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15809        where
15810            D: serde::Deserializer<'de>,
15811        {
15812            deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobStateMatcher>::new(
15813                ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher",
15814            ))
15815        }
15816    }
15817}
15818
15819/// A request to update a job.
15820#[derive(Clone, Default, PartialEq)]
15821#[non_exhaustive]
15822pub struct UpdateJobRequest {
15823    /// Required. The ID of the Google Cloud Platform project that the job
15824    /// belongs to.
15825    pub project_id: std::string::String,
15826
15827    /// Required. The Dataproc region in which to handle the request.
15828    pub region: std::string::String,
15829
15830    /// Required. The job ID.
15831    pub job_id: std::string::String,
15832
15833    /// Required. The changes to the job.
15834    pub job: std::option::Option<crate::model::Job>,
15835
15836    /// Required. Specifies the path, relative to \<code\>Job\</code\>, of
15837    /// the field to update. For example, to update the labels of a Job the
15838    /// \<code\>update_mask\</code\> parameter would be specified as
15839    /// \<code\>labels\</code\>, and the `PATCH` request body would specify the new
15840    /// value. \<strong\>Note:\</strong\> Currently, \<code\>labels\</code\> is the only
15841    /// field that can be updated.
15842    pub update_mask: std::option::Option<wkt::FieldMask>,
15843
15844    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15845}
15846
15847impl UpdateJobRequest {
15848    /// Creates a new default instance.
15849    pub fn new() -> Self {
15850        std::default::Default::default()
15851    }
15852
15853    /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
15854    ///
15855    /// # Example
15856    /// ```ignore,no_run
15857    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15858    /// let x = UpdateJobRequest::new().set_project_id("example");
15859    /// ```
15860    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15861        self.project_id = v.into();
15862        self
15863    }
15864
15865    /// Sets the value of [region][crate::model::UpdateJobRequest::region].
15866    ///
15867    /// # Example
15868    /// ```ignore,no_run
15869    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15870    /// let x = UpdateJobRequest::new().set_region("example");
15871    /// ```
15872    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15873        self.region = v.into();
15874        self
15875    }
15876
15877    /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
15878    ///
15879    /// # Example
15880    /// ```ignore,no_run
15881    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15882    /// let x = UpdateJobRequest::new().set_job_id("example");
15883    /// ```
15884    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15885        self.job_id = v.into();
15886        self
15887    }
15888
15889    /// Sets the value of [job][crate::model::UpdateJobRequest::job].
15890    ///
15891    /// # Example
15892    /// ```ignore,no_run
15893    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15894    /// use google_cloud_dataproc_v1::model::Job;
15895    /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
15896    /// ```
15897    pub fn set_job<T>(mut self, v: T) -> Self
15898    where
15899        T: std::convert::Into<crate::model::Job>,
15900    {
15901        self.job = std::option::Option::Some(v.into());
15902        self
15903    }
15904
15905    /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
15906    ///
15907    /// # Example
15908    /// ```ignore,no_run
15909    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15910    /// use google_cloud_dataproc_v1::model::Job;
15911    /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
15912    /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
15913    /// ```
15914    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
15915    where
15916        T: std::convert::Into<crate::model::Job>,
15917    {
15918        self.job = v.map(|x| x.into());
15919        self
15920    }
15921
15922    /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15923    ///
15924    /// # Example
15925    /// ```ignore,no_run
15926    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15927    /// use wkt::FieldMask;
15928    /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15929    /// ```
15930    pub fn set_update_mask<T>(mut self, v: T) -> Self
15931    where
15932        T: std::convert::Into<wkt::FieldMask>,
15933    {
15934        self.update_mask = std::option::Option::Some(v.into());
15935        self
15936    }
15937
15938    /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15939    ///
15940    /// # Example
15941    /// ```ignore,no_run
15942    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15943    /// use wkt::FieldMask;
15944    /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15945    /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15946    /// ```
15947    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15948    where
15949        T: std::convert::Into<wkt::FieldMask>,
15950    {
15951        self.update_mask = v.map(|x| x.into());
15952        self
15953    }
15954}
15955
15956impl wkt::message::Message for UpdateJobRequest {
15957    fn typename() -> &'static str {
15958        "type.googleapis.com/google.cloud.dataproc.v1.UpdateJobRequest"
15959    }
15960}
15961
15962/// A list of jobs in a project.
15963#[derive(Clone, Default, PartialEq)]
15964#[non_exhaustive]
15965pub struct ListJobsResponse {
15966    /// Output only. Jobs list.
15967    pub jobs: std::vec::Vec<crate::model::Job>,
15968
15969    /// Optional. This token is included in the response if there are more results
15970    /// to fetch. To fetch additional results, provide this value as the
15971    /// `page_token` in a subsequent \<code\>ListJobsRequest\</code\>.
15972    pub next_page_token: std::string::String,
15973
15974    /// Output only. List of jobs with
15975    /// [kms_key][google.cloud.dataproc.v1.EncryptionConfig.kms_key]-encrypted
15976    /// parameters that could not be decrypted. A response to a `jobs.get` request
15977    /// may indicate the reason for the decryption failure for a specific job.
15978    ///
15979    /// [google.cloud.dataproc.v1.EncryptionConfig.kms_key]: crate::model::EncryptionConfig::kms_key
15980    pub unreachable: std::vec::Vec<std::string::String>,
15981
15982    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15983}
15984
15985impl ListJobsResponse {
15986    /// Creates a new default instance.
15987    pub fn new() -> Self {
15988        std::default::Default::default()
15989    }
15990
15991    /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
15992    ///
15993    /// # Example
15994    /// ```ignore,no_run
15995    /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15996    /// use google_cloud_dataproc_v1::model::Job;
15997    /// let x = ListJobsResponse::new()
15998    ///     .set_jobs([
15999    ///         Job::default()/* use setters */,
16000    ///         Job::default()/* use (different) setters */,
16001    ///     ]);
16002    /// ```
16003    pub fn set_jobs<T, V>(mut self, v: T) -> Self
16004    where
16005        T: std::iter::IntoIterator<Item = V>,
16006        V: std::convert::Into<crate::model::Job>,
16007    {
16008        use std::iter::Iterator;
16009        self.jobs = v.into_iter().map(|i| i.into()).collect();
16010        self
16011    }
16012
16013    /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
16014    ///
16015    /// # Example
16016    /// ```ignore,no_run
16017    /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16018    /// let x = ListJobsResponse::new().set_next_page_token("example");
16019    /// ```
16020    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16021        self.next_page_token = v.into();
16022        self
16023    }
16024
16025    /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
16026    ///
16027    /// # Example
16028    /// ```ignore,no_run
16029    /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16030    /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
16031    /// ```
16032    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
16033    where
16034        T: std::iter::IntoIterator<Item = V>,
16035        V: std::convert::Into<std::string::String>,
16036    {
16037        use std::iter::Iterator;
16038        self.unreachable = v.into_iter().map(|i| i.into()).collect();
16039        self
16040    }
16041}
16042
16043impl wkt::message::Message for ListJobsResponse {
16044    fn typename() -> &'static str {
16045        "type.googleapis.com/google.cloud.dataproc.v1.ListJobsResponse"
16046    }
16047}
16048
16049#[doc(hidden)]
16050impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
16051    type PageItem = crate::model::Job;
16052
16053    fn items(self) -> std::vec::Vec<Self::PageItem> {
16054        self.jobs
16055    }
16056
16057    fn next_page_token(&self) -> std::string::String {
16058        use std::clone::Clone;
16059        self.next_page_token.clone()
16060    }
16061}
16062
16063/// A request to cancel a job.
16064#[derive(Clone, Default, PartialEq)]
16065#[non_exhaustive]
16066pub struct CancelJobRequest {
16067    /// Required. The ID of the Google Cloud Platform project that the job
16068    /// belongs to.
16069    pub project_id: std::string::String,
16070
16071    /// Required. The Dataproc region in which to handle the request.
16072    pub region: std::string::String,
16073
16074    /// Required. The job ID.
16075    pub job_id: std::string::String,
16076
16077    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16078}
16079
16080impl CancelJobRequest {
16081    /// Creates a new default instance.
16082    pub fn new() -> Self {
16083        std::default::Default::default()
16084    }
16085
16086    /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
16087    ///
16088    /// # Example
16089    /// ```ignore,no_run
16090    /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16091    /// let x = CancelJobRequest::new().set_project_id("example");
16092    /// ```
16093    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16094        self.project_id = v.into();
16095        self
16096    }
16097
16098    /// Sets the value of [region][crate::model::CancelJobRequest::region].
16099    ///
16100    /// # Example
16101    /// ```ignore,no_run
16102    /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16103    /// let x = CancelJobRequest::new().set_region("example");
16104    /// ```
16105    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16106        self.region = v.into();
16107        self
16108    }
16109
16110    /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
16111    ///
16112    /// # Example
16113    /// ```ignore,no_run
16114    /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16115    /// let x = CancelJobRequest::new().set_job_id("example");
16116    /// ```
16117    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16118        self.job_id = v.into();
16119        self
16120    }
16121}
16122
16123impl wkt::message::Message for CancelJobRequest {
16124    fn typename() -> &'static str {
16125        "type.googleapis.com/google.cloud.dataproc.v1.CancelJobRequest"
16126    }
16127}
16128
16129/// A request to delete a job.
16130#[derive(Clone, Default, PartialEq)]
16131#[non_exhaustive]
16132pub struct DeleteJobRequest {
16133    /// Required. The ID of the Google Cloud Platform project that the job
16134    /// belongs to.
16135    pub project_id: std::string::String,
16136
16137    /// Required. The Dataproc region in which to handle the request.
16138    pub region: std::string::String,
16139
16140    /// Required. The job ID.
16141    pub job_id: std::string::String,
16142
16143    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16144}
16145
16146impl DeleteJobRequest {
16147    /// Creates a new default instance.
16148    pub fn new() -> Self {
16149        std::default::Default::default()
16150    }
16151
16152    /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
16153    ///
16154    /// # Example
16155    /// ```ignore,no_run
16156    /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16157    /// let x = DeleteJobRequest::new().set_project_id("example");
16158    /// ```
16159    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16160        self.project_id = v.into();
16161        self
16162    }
16163
16164    /// Sets the value of [region][crate::model::DeleteJobRequest::region].
16165    ///
16166    /// # Example
16167    /// ```ignore,no_run
16168    /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16169    /// let x = DeleteJobRequest::new().set_region("example");
16170    /// ```
16171    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16172        self.region = v.into();
16173        self
16174    }
16175
16176    /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
16177    ///
16178    /// # Example
16179    /// ```ignore,no_run
16180    /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16181    /// let x = DeleteJobRequest::new().set_job_id("example");
16182    /// ```
16183    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16184        self.job_id = v.into();
16185        self
16186    }
16187}
16188
16189impl wkt::message::Message for DeleteJobRequest {
16190    fn typename() -> &'static str {
16191        "type.googleapis.com/google.cloud.dataproc.v1.DeleteJobRequest"
16192    }
16193}
16194
16195/// A request to create a node group.
16196#[derive(Clone, Default, PartialEq)]
16197#[non_exhaustive]
16198pub struct CreateNodeGroupRequest {
16199    /// Required. The parent resource where this node group will be created.
16200    /// Format: `projects/{project}/regions/{region}/clusters/{cluster}`
16201    pub parent: std::string::String,
16202
16203    /// Required. The node group to create.
16204    pub node_group: std::option::Option<crate::model::NodeGroup>,
16205
16206    /// Optional. An optional node group ID. Generated if not specified.
16207    ///
16208    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
16209    /// underscores (_), and hyphens (-). Cannot begin or end with underscore
16210    /// or hyphen. Must consist of from 3 to 33 characters.
16211    pub node_group_id: std::string::String,
16212
16213    /// Optional. A unique ID used to identify the request. If the server receives
16214    /// two
16215    /// [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
16216    /// with the same ID, the second request is ignored and the
16217    /// first [google.longrunning.Operation][google.longrunning.Operation] created
16218    /// and stored in the backend is returned.
16219    ///
16220    /// Recommendation: Set this value to a
16221    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
16222    ///
16223    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
16224    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
16225    ///
16226    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
16227    pub request_id: std::string::String,
16228
16229    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16230}
16231
16232impl CreateNodeGroupRequest {
16233    /// Creates a new default instance.
16234    pub fn new() -> Self {
16235        std::default::Default::default()
16236    }
16237
16238    /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
16239    ///
16240    /// # Example
16241    /// ```ignore,no_run
16242    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16243    /// let x = CreateNodeGroupRequest::new().set_parent("example");
16244    /// ```
16245    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16246        self.parent = v.into();
16247        self
16248    }
16249
16250    /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
16251    ///
16252    /// # Example
16253    /// ```ignore,no_run
16254    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16255    /// use google_cloud_dataproc_v1::model::NodeGroup;
16256    /// let x = CreateNodeGroupRequest::new().set_node_group(NodeGroup::default()/* use setters */);
16257    /// ```
16258    pub fn set_node_group<T>(mut self, v: T) -> Self
16259    where
16260        T: std::convert::Into<crate::model::NodeGroup>,
16261    {
16262        self.node_group = std::option::Option::Some(v.into());
16263        self
16264    }
16265
16266    /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
16267    ///
16268    /// # Example
16269    /// ```ignore,no_run
16270    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16271    /// use google_cloud_dataproc_v1::model::NodeGroup;
16272    /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
16273    /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(None::<NodeGroup>);
16274    /// ```
16275    pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
16276    where
16277        T: std::convert::Into<crate::model::NodeGroup>,
16278    {
16279        self.node_group = v.map(|x| x.into());
16280        self
16281    }
16282
16283    /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
16284    ///
16285    /// # Example
16286    /// ```ignore,no_run
16287    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16288    /// let x = CreateNodeGroupRequest::new().set_node_group_id("example");
16289    /// ```
16290    pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16291        self.node_group_id = v.into();
16292        self
16293    }
16294
16295    /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
16296    ///
16297    /// # Example
16298    /// ```ignore,no_run
16299    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16300    /// let x = CreateNodeGroupRequest::new().set_request_id("example");
16301    /// ```
16302    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16303        self.request_id = v.into();
16304        self
16305    }
16306}
16307
16308impl wkt::message::Message for CreateNodeGroupRequest {
16309    fn typename() -> &'static str {
16310        "type.googleapis.com/google.cloud.dataproc.v1.CreateNodeGroupRequest"
16311    }
16312}
16313
16314/// A request to resize a node group.
16315#[derive(Clone, Default, PartialEq)]
16316#[non_exhaustive]
16317pub struct ResizeNodeGroupRequest {
16318    /// Required. The name of the node group to resize.
16319    /// Format:
16320    /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
16321    pub name: std::string::String,
16322
16323    /// Required. The number of running instances for the node group to maintain.
16324    /// The group adds or removes instances to maintain the number of instances
16325    /// specified by this parameter.
16326    pub size: i32,
16327
16328    /// Optional. A unique ID used to identify the request. If the server receives
16329    /// two
16330    /// [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
16331    /// with the same ID, the second request is ignored and the
16332    /// first [google.longrunning.Operation][google.longrunning.Operation] created
16333    /// and stored in the backend is returned.
16334    ///
16335    /// Recommendation: Set this value to a
16336    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
16337    ///
16338    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
16339    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
16340    ///
16341    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
16342    pub request_id: std::string::String,
16343
16344    /// Optional. Timeout for graceful YARN decommissioning. [Graceful
16345    /// decommissioning]
16346    /// (<https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning>)
16347    /// allows the removal of nodes from the Compute Engine node group
16348    /// without interrupting jobs in progress. This timeout specifies how long to
16349    /// wait for jobs in progress to finish before forcefully removing nodes (and
16350    /// potentially interrupting jobs). Default timeout is 0 (for forceful
16351    /// decommission), and the maximum allowed timeout is 1 day. (see JSON
16352    /// representation of
16353    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
16354    ///
16355    /// Only supported on Dataproc image versions 1.2 and higher.
16356    pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
16357
16358    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16359}
16360
16361impl ResizeNodeGroupRequest {
16362    /// Creates a new default instance.
16363    pub fn new() -> Self {
16364        std::default::Default::default()
16365    }
16366
16367    /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
16368    ///
16369    /// # Example
16370    /// ```ignore,no_run
16371    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16372    /// let x = ResizeNodeGroupRequest::new().set_name("example");
16373    /// ```
16374    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16375        self.name = v.into();
16376        self
16377    }
16378
16379    /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
16380    ///
16381    /// # Example
16382    /// ```ignore,no_run
16383    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16384    /// let x = ResizeNodeGroupRequest::new().set_size(42);
16385    /// ```
16386    pub fn set_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16387        self.size = v.into();
16388        self
16389    }
16390
16391    /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
16392    ///
16393    /// # Example
16394    /// ```ignore,no_run
16395    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16396    /// let x = ResizeNodeGroupRequest::new().set_request_id("example");
16397    /// ```
16398    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16399        self.request_id = v.into();
16400        self
16401    }
16402
16403    /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
16404    ///
16405    /// # Example
16406    /// ```ignore,no_run
16407    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16408    /// use wkt::Duration;
16409    /// let x = ResizeNodeGroupRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
16410    /// ```
16411    pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
16412    where
16413        T: std::convert::Into<wkt::Duration>,
16414    {
16415        self.graceful_decommission_timeout = std::option::Option::Some(v.into());
16416        self
16417    }
16418
16419    /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
16420    ///
16421    /// # Example
16422    /// ```ignore,no_run
16423    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16424    /// use wkt::Duration;
16425    /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
16426    /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
16427    /// ```
16428    pub fn set_or_clear_graceful_decommission_timeout<T>(
16429        mut self,
16430        v: std::option::Option<T>,
16431    ) -> Self
16432    where
16433        T: std::convert::Into<wkt::Duration>,
16434    {
16435        self.graceful_decommission_timeout = v.map(|x| x.into());
16436        self
16437    }
16438}
16439
16440impl wkt::message::Message for ResizeNodeGroupRequest {
16441    fn typename() -> &'static str {
16442        "type.googleapis.com/google.cloud.dataproc.v1.ResizeNodeGroupRequest"
16443    }
16444}
16445
16446/// A request to get a node group .
16447#[derive(Clone, Default, PartialEq)]
16448#[non_exhaustive]
16449pub struct GetNodeGroupRequest {
16450    /// Required. The name of the node group to retrieve.
16451    /// Format:
16452    /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
16453    pub name: std::string::String,
16454
16455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16456}
16457
16458impl GetNodeGroupRequest {
16459    /// Creates a new default instance.
16460    pub fn new() -> Self {
16461        std::default::Default::default()
16462    }
16463
16464    /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
16465    ///
16466    /// # Example
16467    /// ```ignore,no_run
16468    /// # use google_cloud_dataproc_v1::model::GetNodeGroupRequest;
16469    /// let x = GetNodeGroupRequest::new().set_name("example");
16470    /// ```
16471    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16472        self.name = v.into();
16473        self
16474    }
16475}
16476
16477impl wkt::message::Message for GetNodeGroupRequest {
16478    fn typename() -> &'static str {
16479        "type.googleapis.com/google.cloud.dataproc.v1.GetNodeGroupRequest"
16480    }
16481}
16482
16483/// Metadata describing the Batch operation.
16484#[derive(Clone, Default, PartialEq)]
16485#[non_exhaustive]
16486pub struct BatchOperationMetadata {
16487    /// Name of the batch for the operation.
16488    pub batch: std::string::String,
16489
16490    /// Batch UUID for the operation.
16491    pub batch_uuid: std::string::String,
16492
16493    /// The time when the operation was created.
16494    pub create_time: std::option::Option<wkt::Timestamp>,
16495
16496    /// The time when the operation finished.
16497    pub done_time: std::option::Option<wkt::Timestamp>,
16498
16499    /// The operation type.
16500    pub operation_type: crate::model::batch_operation_metadata::BatchOperationType,
16501
16502    /// Short description of the operation.
16503    pub description: std::string::String,
16504
16505    /// Labels associated with the operation.
16506    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16507
16508    /// Warnings encountered during operation execution.
16509    pub warnings: std::vec::Vec<std::string::String>,
16510
16511    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16512}
16513
16514impl BatchOperationMetadata {
16515    /// Creates a new default instance.
16516    pub fn new() -> Self {
16517        std::default::Default::default()
16518    }
16519
16520    /// Sets the value of [batch][crate::model::BatchOperationMetadata::batch].
16521    ///
16522    /// # Example
16523    /// ```ignore,no_run
16524    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16525    /// let x = BatchOperationMetadata::new().set_batch("example");
16526    /// ```
16527    pub fn set_batch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16528        self.batch = v.into();
16529        self
16530    }
16531
16532    /// Sets the value of [batch_uuid][crate::model::BatchOperationMetadata::batch_uuid].
16533    ///
16534    /// # Example
16535    /// ```ignore,no_run
16536    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16537    /// let x = BatchOperationMetadata::new().set_batch_uuid("example");
16538    /// ```
16539    pub fn set_batch_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16540        self.batch_uuid = v.into();
16541        self
16542    }
16543
16544    /// Sets the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16545    ///
16546    /// # Example
16547    /// ```ignore,no_run
16548    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16549    /// use wkt::Timestamp;
16550    /// let x = BatchOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16551    /// ```
16552    pub fn set_create_time<T>(mut self, v: T) -> Self
16553    where
16554        T: std::convert::Into<wkt::Timestamp>,
16555    {
16556        self.create_time = std::option::Option::Some(v.into());
16557        self
16558    }
16559
16560    /// Sets or clears the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16561    ///
16562    /// # Example
16563    /// ```ignore,no_run
16564    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16565    /// use wkt::Timestamp;
16566    /// let x = BatchOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16567    /// let x = BatchOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16568    /// ```
16569    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16570    where
16571        T: std::convert::Into<wkt::Timestamp>,
16572    {
16573        self.create_time = v.map(|x| x.into());
16574        self
16575    }
16576
16577    /// Sets the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16578    ///
16579    /// # Example
16580    /// ```ignore,no_run
16581    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16582    /// use wkt::Timestamp;
16583    /// let x = BatchOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16584    /// ```
16585    pub fn set_done_time<T>(mut self, v: T) -> Self
16586    where
16587        T: std::convert::Into<wkt::Timestamp>,
16588    {
16589        self.done_time = std::option::Option::Some(v.into());
16590        self
16591    }
16592
16593    /// Sets or clears the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16594    ///
16595    /// # Example
16596    /// ```ignore,no_run
16597    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16598    /// use wkt::Timestamp;
16599    /// let x = BatchOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16600    /// let x = BatchOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16601    /// ```
16602    pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16603    where
16604        T: std::convert::Into<wkt::Timestamp>,
16605    {
16606        self.done_time = v.map(|x| x.into());
16607        self
16608    }
16609
16610    /// Sets the value of [operation_type][crate::model::BatchOperationMetadata::operation_type].
16611    ///
16612    /// # Example
16613    /// ```ignore,no_run
16614    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16615    /// use google_cloud_dataproc_v1::model::batch_operation_metadata::BatchOperationType;
16616    /// let x0 = BatchOperationMetadata::new().set_operation_type(BatchOperationType::Batch);
16617    /// ```
16618    pub fn set_operation_type<
16619        T: std::convert::Into<crate::model::batch_operation_metadata::BatchOperationType>,
16620    >(
16621        mut self,
16622        v: T,
16623    ) -> Self {
16624        self.operation_type = v.into();
16625        self
16626    }
16627
16628    /// Sets the value of [description][crate::model::BatchOperationMetadata::description].
16629    ///
16630    /// # Example
16631    /// ```ignore,no_run
16632    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16633    /// let x = BatchOperationMetadata::new().set_description("example");
16634    /// ```
16635    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16636        self.description = v.into();
16637        self
16638    }
16639
16640    /// Sets the value of [labels][crate::model::BatchOperationMetadata::labels].
16641    ///
16642    /// # Example
16643    /// ```ignore,no_run
16644    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16645    /// let x = BatchOperationMetadata::new().set_labels([
16646    ///     ("key0", "abc"),
16647    ///     ("key1", "xyz"),
16648    /// ]);
16649    /// ```
16650    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16651    where
16652        T: std::iter::IntoIterator<Item = (K, V)>,
16653        K: std::convert::Into<std::string::String>,
16654        V: std::convert::Into<std::string::String>,
16655    {
16656        use std::iter::Iterator;
16657        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16658        self
16659    }
16660
16661    /// Sets the value of [warnings][crate::model::BatchOperationMetadata::warnings].
16662    ///
16663    /// # Example
16664    /// ```ignore,no_run
16665    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16666    /// let x = BatchOperationMetadata::new().set_warnings(["a", "b", "c"]);
16667    /// ```
16668    pub fn set_warnings<T, V>(mut self, v: T) -> Self
16669    where
16670        T: std::iter::IntoIterator<Item = V>,
16671        V: std::convert::Into<std::string::String>,
16672    {
16673        use std::iter::Iterator;
16674        self.warnings = v.into_iter().map(|i| i.into()).collect();
16675        self
16676    }
16677}
16678
16679impl wkt::message::Message for BatchOperationMetadata {
16680    fn typename() -> &'static str {
16681        "type.googleapis.com/google.cloud.dataproc.v1.BatchOperationMetadata"
16682    }
16683}
16684
16685/// Defines additional types related to [BatchOperationMetadata].
16686pub mod batch_operation_metadata {
16687    #[allow(unused_imports)]
16688    use super::*;
16689
16690    /// Operation type for Batch resources
16691    ///
16692    /// # Working with unknown values
16693    ///
16694    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16695    /// additional enum variants at any time. Adding new variants is not considered
16696    /// a breaking change. Applications should write their code in anticipation of:
16697    ///
16698    /// - New values appearing in future releases of the client library, **and**
16699    /// - New values received dynamically, without application changes.
16700    ///
16701    /// Please consult the [Working with enums] section in the user guide for some
16702    /// guidelines.
16703    ///
16704    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16705    #[derive(Clone, Debug, PartialEq)]
16706    #[non_exhaustive]
16707    pub enum BatchOperationType {
16708        /// Batch operation type is unknown.
16709        Unspecified,
16710        /// Batch operation type.
16711        Batch,
16712        /// If set, the enum was initialized with an unknown value.
16713        ///
16714        /// Applications can examine the value using [BatchOperationType::value] or
16715        /// [BatchOperationType::name].
16716        UnknownValue(batch_operation_type::UnknownValue),
16717    }
16718
16719    #[doc(hidden)]
16720    pub mod batch_operation_type {
16721        #[allow(unused_imports)]
16722        use super::*;
16723        #[derive(Clone, Debug, PartialEq)]
16724        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16725    }
16726
16727    impl BatchOperationType {
16728        /// Gets the enum value.
16729        ///
16730        /// Returns `None` if the enum contains an unknown value deserialized from
16731        /// the string representation of enums.
16732        pub fn value(&self) -> std::option::Option<i32> {
16733            match self {
16734                Self::Unspecified => std::option::Option::Some(0),
16735                Self::Batch => std::option::Option::Some(1),
16736                Self::UnknownValue(u) => u.0.value(),
16737            }
16738        }
16739
16740        /// Gets the enum value as a string.
16741        ///
16742        /// Returns `None` if the enum contains an unknown value deserialized from
16743        /// the integer representation of enums.
16744        pub fn name(&self) -> std::option::Option<&str> {
16745            match self {
16746                Self::Unspecified => std::option::Option::Some("BATCH_OPERATION_TYPE_UNSPECIFIED"),
16747                Self::Batch => std::option::Option::Some("BATCH"),
16748                Self::UnknownValue(u) => u.0.name(),
16749            }
16750        }
16751    }
16752
16753    impl std::default::Default for BatchOperationType {
16754        fn default() -> Self {
16755            use std::convert::From;
16756            Self::from(0)
16757        }
16758    }
16759
16760    impl std::fmt::Display for BatchOperationType {
16761        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16762            wkt::internal::display_enum(f, self.name(), self.value())
16763        }
16764    }
16765
16766    impl std::convert::From<i32> for BatchOperationType {
16767        fn from(value: i32) -> Self {
16768            match value {
16769                0 => Self::Unspecified,
16770                1 => Self::Batch,
16771                _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16772                    wkt::internal::UnknownEnumValue::Integer(value),
16773                )),
16774            }
16775        }
16776    }
16777
16778    impl std::convert::From<&str> for BatchOperationType {
16779        fn from(value: &str) -> Self {
16780            use std::string::ToString;
16781            match value {
16782                "BATCH_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16783                "BATCH" => Self::Batch,
16784                _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16785                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16786                )),
16787            }
16788        }
16789    }
16790
16791    impl serde::ser::Serialize for BatchOperationType {
16792        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16793        where
16794            S: serde::Serializer,
16795        {
16796            match self {
16797                Self::Unspecified => serializer.serialize_i32(0),
16798                Self::Batch => serializer.serialize_i32(1),
16799                Self::UnknownValue(u) => u.0.serialize(serializer),
16800            }
16801        }
16802    }
16803
16804    impl<'de> serde::de::Deserialize<'de> for BatchOperationType {
16805        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16806        where
16807            D: serde::Deserializer<'de>,
16808        {
16809            deserializer.deserialize_any(wkt::internal::EnumVisitor::<BatchOperationType>::new(
16810                ".google.cloud.dataproc.v1.BatchOperationMetadata.BatchOperationType",
16811            ))
16812        }
16813    }
16814}
16815
16816/// Metadata describing the Session operation.
16817#[derive(Clone, Default, PartialEq)]
16818#[non_exhaustive]
16819pub struct SessionOperationMetadata {
16820    /// Name of the session for the operation.
16821    pub session: std::string::String,
16822
16823    /// Session UUID for the operation.
16824    pub session_uuid: std::string::String,
16825
16826    /// The time when the operation was created.
16827    pub create_time: std::option::Option<wkt::Timestamp>,
16828
16829    /// The time when the operation was finished.
16830    pub done_time: std::option::Option<wkt::Timestamp>,
16831
16832    /// The operation type.
16833    pub operation_type: crate::model::session_operation_metadata::SessionOperationType,
16834
16835    /// Short description of the operation.
16836    pub description: std::string::String,
16837
16838    /// Labels associated with the operation.
16839    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16840
16841    /// Warnings encountered during operation execution.
16842    pub warnings: std::vec::Vec<std::string::String>,
16843
16844    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16845}
16846
16847impl SessionOperationMetadata {
16848    /// Creates a new default instance.
16849    pub fn new() -> Self {
16850        std::default::Default::default()
16851    }
16852
16853    /// Sets the value of [session][crate::model::SessionOperationMetadata::session].
16854    ///
16855    /// # Example
16856    /// ```ignore,no_run
16857    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16858    /// let x = SessionOperationMetadata::new().set_session("example");
16859    /// ```
16860    pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16861        self.session = v.into();
16862        self
16863    }
16864
16865    /// Sets the value of [session_uuid][crate::model::SessionOperationMetadata::session_uuid].
16866    ///
16867    /// # Example
16868    /// ```ignore,no_run
16869    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16870    /// let x = SessionOperationMetadata::new().set_session_uuid("example");
16871    /// ```
16872    pub fn set_session_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16873        self.session_uuid = v.into();
16874        self
16875    }
16876
16877    /// Sets the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16878    ///
16879    /// # Example
16880    /// ```ignore,no_run
16881    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16882    /// use wkt::Timestamp;
16883    /// let x = SessionOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16884    /// ```
16885    pub fn set_create_time<T>(mut self, v: T) -> Self
16886    where
16887        T: std::convert::Into<wkt::Timestamp>,
16888    {
16889        self.create_time = std::option::Option::Some(v.into());
16890        self
16891    }
16892
16893    /// Sets or clears the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16894    ///
16895    /// # Example
16896    /// ```ignore,no_run
16897    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16898    /// use wkt::Timestamp;
16899    /// let x = SessionOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16900    /// let x = SessionOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16901    /// ```
16902    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16903    where
16904        T: std::convert::Into<wkt::Timestamp>,
16905    {
16906        self.create_time = v.map(|x| x.into());
16907        self
16908    }
16909
16910    /// Sets the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16911    ///
16912    /// # Example
16913    /// ```ignore,no_run
16914    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16915    /// use wkt::Timestamp;
16916    /// let x = SessionOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16917    /// ```
16918    pub fn set_done_time<T>(mut self, v: T) -> Self
16919    where
16920        T: std::convert::Into<wkt::Timestamp>,
16921    {
16922        self.done_time = std::option::Option::Some(v.into());
16923        self
16924    }
16925
16926    /// Sets or clears the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16927    ///
16928    /// # Example
16929    /// ```ignore,no_run
16930    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16931    /// use wkt::Timestamp;
16932    /// let x = SessionOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16933    /// let x = SessionOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16934    /// ```
16935    pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16936    where
16937        T: std::convert::Into<wkt::Timestamp>,
16938    {
16939        self.done_time = v.map(|x| x.into());
16940        self
16941    }
16942
16943    /// Sets the value of [operation_type][crate::model::SessionOperationMetadata::operation_type].
16944    ///
16945    /// # Example
16946    /// ```ignore,no_run
16947    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16948    /// use google_cloud_dataproc_v1::model::session_operation_metadata::SessionOperationType;
16949    /// let x0 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Create);
16950    /// let x1 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Terminate);
16951    /// let x2 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Delete);
16952    /// ```
16953    pub fn set_operation_type<
16954        T: std::convert::Into<crate::model::session_operation_metadata::SessionOperationType>,
16955    >(
16956        mut self,
16957        v: T,
16958    ) -> Self {
16959        self.operation_type = v.into();
16960        self
16961    }
16962
16963    /// Sets the value of [description][crate::model::SessionOperationMetadata::description].
16964    ///
16965    /// # Example
16966    /// ```ignore,no_run
16967    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16968    /// let x = SessionOperationMetadata::new().set_description("example");
16969    /// ```
16970    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16971        self.description = v.into();
16972        self
16973    }
16974
16975    /// Sets the value of [labels][crate::model::SessionOperationMetadata::labels].
16976    ///
16977    /// # Example
16978    /// ```ignore,no_run
16979    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16980    /// let x = SessionOperationMetadata::new().set_labels([
16981    ///     ("key0", "abc"),
16982    ///     ("key1", "xyz"),
16983    /// ]);
16984    /// ```
16985    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16986    where
16987        T: std::iter::IntoIterator<Item = (K, V)>,
16988        K: std::convert::Into<std::string::String>,
16989        V: std::convert::Into<std::string::String>,
16990    {
16991        use std::iter::Iterator;
16992        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16993        self
16994    }
16995
16996    /// Sets the value of [warnings][crate::model::SessionOperationMetadata::warnings].
16997    ///
16998    /// # Example
16999    /// ```ignore,no_run
17000    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17001    /// let x = SessionOperationMetadata::new().set_warnings(["a", "b", "c"]);
17002    /// ```
17003    pub fn set_warnings<T, V>(mut self, v: T) -> Self
17004    where
17005        T: std::iter::IntoIterator<Item = V>,
17006        V: std::convert::Into<std::string::String>,
17007    {
17008        use std::iter::Iterator;
17009        self.warnings = v.into_iter().map(|i| i.into()).collect();
17010        self
17011    }
17012}
17013
17014impl wkt::message::Message for SessionOperationMetadata {
17015    fn typename() -> &'static str {
17016        "type.googleapis.com/google.cloud.dataproc.v1.SessionOperationMetadata"
17017    }
17018}
17019
17020/// Defines additional types related to [SessionOperationMetadata].
17021pub mod session_operation_metadata {
17022    #[allow(unused_imports)]
17023    use super::*;
17024
17025    /// Operation type for Session resources
17026    ///
17027    /// # Working with unknown values
17028    ///
17029    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17030    /// additional enum variants at any time. Adding new variants is not considered
17031    /// a breaking change. Applications should write their code in anticipation of:
17032    ///
17033    /// - New values appearing in future releases of the client library, **and**
17034    /// - New values received dynamically, without application changes.
17035    ///
17036    /// Please consult the [Working with enums] section in the user guide for some
17037    /// guidelines.
17038    ///
17039    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17040    #[derive(Clone, Debug, PartialEq)]
17041    #[non_exhaustive]
17042    pub enum SessionOperationType {
17043        /// Session operation type is unknown.
17044        Unspecified,
17045        /// Create Session operation type.
17046        Create,
17047        /// Terminate Session operation type.
17048        Terminate,
17049        /// Delete Session operation type.
17050        Delete,
17051        /// If set, the enum was initialized with an unknown value.
17052        ///
17053        /// Applications can examine the value using [SessionOperationType::value] or
17054        /// [SessionOperationType::name].
17055        UnknownValue(session_operation_type::UnknownValue),
17056    }
17057
17058    #[doc(hidden)]
17059    pub mod session_operation_type {
17060        #[allow(unused_imports)]
17061        use super::*;
17062        #[derive(Clone, Debug, PartialEq)]
17063        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17064    }
17065
17066    impl SessionOperationType {
17067        /// Gets the enum value.
17068        ///
17069        /// Returns `None` if the enum contains an unknown value deserialized from
17070        /// the string representation of enums.
17071        pub fn value(&self) -> std::option::Option<i32> {
17072            match self {
17073                Self::Unspecified => std::option::Option::Some(0),
17074                Self::Create => std::option::Option::Some(1),
17075                Self::Terminate => std::option::Option::Some(2),
17076                Self::Delete => std::option::Option::Some(3),
17077                Self::UnknownValue(u) => u.0.value(),
17078            }
17079        }
17080
17081        /// Gets the enum value as a string.
17082        ///
17083        /// Returns `None` if the enum contains an unknown value deserialized from
17084        /// the integer representation of enums.
17085        pub fn name(&self) -> std::option::Option<&str> {
17086            match self {
17087                Self::Unspecified => {
17088                    std::option::Option::Some("SESSION_OPERATION_TYPE_UNSPECIFIED")
17089                }
17090                Self::Create => std::option::Option::Some("CREATE"),
17091                Self::Terminate => std::option::Option::Some("TERMINATE"),
17092                Self::Delete => std::option::Option::Some("DELETE"),
17093                Self::UnknownValue(u) => u.0.name(),
17094            }
17095        }
17096    }
17097
17098    impl std::default::Default for SessionOperationType {
17099        fn default() -> Self {
17100            use std::convert::From;
17101            Self::from(0)
17102        }
17103    }
17104
17105    impl std::fmt::Display for SessionOperationType {
17106        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17107            wkt::internal::display_enum(f, self.name(), self.value())
17108        }
17109    }
17110
17111    impl std::convert::From<i32> for SessionOperationType {
17112        fn from(value: i32) -> Self {
17113            match value {
17114                0 => Self::Unspecified,
17115                1 => Self::Create,
17116                2 => Self::Terminate,
17117                3 => Self::Delete,
17118                _ => Self::UnknownValue(session_operation_type::UnknownValue(
17119                    wkt::internal::UnknownEnumValue::Integer(value),
17120                )),
17121            }
17122        }
17123    }
17124
17125    impl std::convert::From<&str> for SessionOperationType {
17126        fn from(value: &str) -> Self {
17127            use std::string::ToString;
17128            match value {
17129                "SESSION_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17130                "CREATE" => Self::Create,
17131                "TERMINATE" => Self::Terminate,
17132                "DELETE" => Self::Delete,
17133                _ => Self::UnknownValue(session_operation_type::UnknownValue(
17134                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17135                )),
17136            }
17137        }
17138    }
17139
17140    impl serde::ser::Serialize for SessionOperationType {
17141        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17142        where
17143            S: serde::Serializer,
17144        {
17145            match self {
17146                Self::Unspecified => serializer.serialize_i32(0),
17147                Self::Create => serializer.serialize_i32(1),
17148                Self::Terminate => serializer.serialize_i32(2),
17149                Self::Delete => serializer.serialize_i32(3),
17150                Self::UnknownValue(u) => u.0.serialize(serializer),
17151            }
17152        }
17153    }
17154
17155    impl<'de> serde::de::Deserialize<'de> for SessionOperationType {
17156        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17157        where
17158            D: serde::Deserializer<'de>,
17159        {
17160            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionOperationType>::new(
17161                ".google.cloud.dataproc.v1.SessionOperationMetadata.SessionOperationType",
17162            ))
17163        }
17164    }
17165}
17166
17167/// The status of the operation.
17168#[derive(Clone, Default, PartialEq)]
17169#[non_exhaustive]
17170pub struct ClusterOperationStatus {
17171    /// Output only. A message containing the operation state.
17172    pub state: crate::model::cluster_operation_status::State,
17173
17174    /// Output only. A message containing the detailed operation state.
17175    pub inner_state: std::string::String,
17176
17177    /// Output only. A message containing any operation metadata details.
17178    pub details: std::string::String,
17179
17180    /// Output only. The time this state was entered.
17181    pub state_start_time: std::option::Option<wkt::Timestamp>,
17182
17183    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17184}
17185
17186impl ClusterOperationStatus {
17187    /// Creates a new default instance.
17188    pub fn new() -> Self {
17189        std::default::Default::default()
17190    }
17191
17192    /// Sets the value of [state][crate::model::ClusterOperationStatus::state].
17193    ///
17194    /// # Example
17195    /// ```ignore,no_run
17196    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17197    /// use google_cloud_dataproc_v1::model::cluster_operation_status::State;
17198    /// let x0 = ClusterOperationStatus::new().set_state(State::Pending);
17199    /// let x1 = ClusterOperationStatus::new().set_state(State::Running);
17200    /// let x2 = ClusterOperationStatus::new().set_state(State::Done);
17201    /// ```
17202    pub fn set_state<T: std::convert::Into<crate::model::cluster_operation_status::State>>(
17203        mut self,
17204        v: T,
17205    ) -> Self {
17206        self.state = v.into();
17207        self
17208    }
17209
17210    /// Sets the value of [inner_state][crate::model::ClusterOperationStatus::inner_state].
17211    ///
17212    /// # Example
17213    /// ```ignore,no_run
17214    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17215    /// let x = ClusterOperationStatus::new().set_inner_state("example");
17216    /// ```
17217    pub fn set_inner_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17218        self.inner_state = v.into();
17219        self
17220    }
17221
17222    /// Sets the value of [details][crate::model::ClusterOperationStatus::details].
17223    ///
17224    /// # Example
17225    /// ```ignore,no_run
17226    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17227    /// let x = ClusterOperationStatus::new().set_details("example");
17228    /// ```
17229    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17230        self.details = v.into();
17231        self
17232    }
17233
17234    /// Sets the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
17235    ///
17236    /// # Example
17237    /// ```ignore,no_run
17238    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17239    /// use wkt::Timestamp;
17240    /// let x = ClusterOperationStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
17241    /// ```
17242    pub fn set_state_start_time<T>(mut self, v: T) -> Self
17243    where
17244        T: std::convert::Into<wkt::Timestamp>,
17245    {
17246        self.state_start_time = std::option::Option::Some(v.into());
17247        self
17248    }
17249
17250    /// Sets or clears the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
17251    ///
17252    /// # Example
17253    /// ```ignore,no_run
17254    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17255    /// use wkt::Timestamp;
17256    /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
17257    /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
17258    /// ```
17259    pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
17260    where
17261        T: std::convert::Into<wkt::Timestamp>,
17262    {
17263        self.state_start_time = v.map(|x| x.into());
17264        self
17265    }
17266}
17267
17268impl wkt::message::Message for ClusterOperationStatus {
17269    fn typename() -> &'static str {
17270        "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationStatus"
17271    }
17272}
17273
17274/// Defines additional types related to [ClusterOperationStatus].
17275pub mod cluster_operation_status {
17276    #[allow(unused_imports)]
17277    use super::*;
17278
17279    /// The operation state.
17280    ///
17281    /// # Working with unknown values
17282    ///
17283    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17284    /// additional enum variants at any time. Adding new variants is not considered
17285    /// a breaking change. Applications should write their code in anticipation of:
17286    ///
17287    /// - New values appearing in future releases of the client library, **and**
17288    /// - New values received dynamically, without application changes.
17289    ///
17290    /// Please consult the [Working with enums] section in the user guide for some
17291    /// guidelines.
17292    ///
17293    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17294    #[derive(Clone, Debug, PartialEq)]
17295    #[non_exhaustive]
17296    pub enum State {
17297        /// Unused.
17298        Unknown,
17299        /// The operation has been created.
17300        Pending,
17301        /// The operation is running.
17302        Running,
17303        /// The operation is done; either cancelled or completed.
17304        Done,
17305        /// If set, the enum was initialized with an unknown value.
17306        ///
17307        /// Applications can examine the value using [State::value] or
17308        /// [State::name].
17309        UnknownValue(state::UnknownValue),
17310    }
17311
17312    #[doc(hidden)]
17313    pub mod state {
17314        #[allow(unused_imports)]
17315        use super::*;
17316        #[derive(Clone, Debug, PartialEq)]
17317        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17318    }
17319
17320    impl State {
17321        /// Gets the enum value.
17322        ///
17323        /// Returns `None` if the enum contains an unknown value deserialized from
17324        /// the string representation of enums.
17325        pub fn value(&self) -> std::option::Option<i32> {
17326            match self {
17327                Self::Unknown => std::option::Option::Some(0),
17328                Self::Pending => std::option::Option::Some(1),
17329                Self::Running => std::option::Option::Some(2),
17330                Self::Done => std::option::Option::Some(3),
17331                Self::UnknownValue(u) => u.0.value(),
17332            }
17333        }
17334
17335        /// Gets the enum value as a string.
17336        ///
17337        /// Returns `None` if the enum contains an unknown value deserialized from
17338        /// the integer representation of enums.
17339        pub fn name(&self) -> std::option::Option<&str> {
17340            match self {
17341                Self::Unknown => std::option::Option::Some("UNKNOWN"),
17342                Self::Pending => std::option::Option::Some("PENDING"),
17343                Self::Running => std::option::Option::Some("RUNNING"),
17344                Self::Done => std::option::Option::Some("DONE"),
17345                Self::UnknownValue(u) => u.0.name(),
17346            }
17347        }
17348    }
17349
17350    impl std::default::Default for State {
17351        fn default() -> Self {
17352            use std::convert::From;
17353            Self::from(0)
17354        }
17355    }
17356
17357    impl std::fmt::Display for State {
17358        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17359            wkt::internal::display_enum(f, self.name(), self.value())
17360        }
17361    }
17362
17363    impl std::convert::From<i32> for State {
17364        fn from(value: i32) -> Self {
17365            match value {
17366                0 => Self::Unknown,
17367                1 => Self::Pending,
17368                2 => Self::Running,
17369                3 => Self::Done,
17370                _ => Self::UnknownValue(state::UnknownValue(
17371                    wkt::internal::UnknownEnumValue::Integer(value),
17372                )),
17373            }
17374        }
17375    }
17376
17377    impl std::convert::From<&str> for State {
17378        fn from(value: &str) -> Self {
17379            use std::string::ToString;
17380            match value {
17381                "UNKNOWN" => Self::Unknown,
17382                "PENDING" => Self::Pending,
17383                "RUNNING" => Self::Running,
17384                "DONE" => Self::Done,
17385                _ => Self::UnknownValue(state::UnknownValue(
17386                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17387                )),
17388            }
17389        }
17390    }
17391
17392    impl serde::ser::Serialize for State {
17393        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17394        where
17395            S: serde::Serializer,
17396        {
17397            match self {
17398                Self::Unknown => serializer.serialize_i32(0),
17399                Self::Pending => serializer.serialize_i32(1),
17400                Self::Running => serializer.serialize_i32(2),
17401                Self::Done => serializer.serialize_i32(3),
17402                Self::UnknownValue(u) => u.0.serialize(serializer),
17403            }
17404        }
17405    }
17406
17407    impl<'de> serde::de::Deserialize<'de> for State {
17408        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17409        where
17410            D: serde::Deserializer<'de>,
17411        {
17412            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17413                ".google.cloud.dataproc.v1.ClusterOperationStatus.State",
17414            ))
17415        }
17416    }
17417}
17418
17419/// Metadata describing the operation.
17420#[derive(Clone, Default, PartialEq)]
17421#[non_exhaustive]
17422pub struct ClusterOperationMetadata {
17423    /// Output only. Name of the cluster for the operation.
17424    pub cluster_name: std::string::String,
17425
17426    /// Output only. Cluster UUID for the operation.
17427    pub cluster_uuid: std::string::String,
17428
17429    /// Output only. Current operation status.
17430    pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17431
17432    /// Output only. The previous operation status.
17433    pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17434
17435    /// Output only. The operation type.
17436    pub operation_type: std::string::String,
17437
17438    /// Output only. Short description of operation.
17439    pub description: std::string::String,
17440
17441    /// Output only. Labels associated with the operation
17442    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17443
17444    /// Output only. Errors encountered during operation execution.
17445    pub warnings: std::vec::Vec<std::string::String>,
17446
17447    /// Output only. Child operation ids
17448    pub child_operation_ids: std::vec::Vec<std::string::String>,
17449
17450    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17451}
17452
17453impl ClusterOperationMetadata {
17454    /// Creates a new default instance.
17455    pub fn new() -> Self {
17456        std::default::Default::default()
17457    }
17458
17459    /// Sets the value of [cluster_name][crate::model::ClusterOperationMetadata::cluster_name].
17460    ///
17461    /// # Example
17462    /// ```ignore,no_run
17463    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17464    /// let x = ClusterOperationMetadata::new().set_cluster_name("example");
17465    /// ```
17466    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17467        self.cluster_name = v.into();
17468        self
17469    }
17470
17471    /// Sets the value of [cluster_uuid][crate::model::ClusterOperationMetadata::cluster_uuid].
17472    ///
17473    /// # Example
17474    /// ```ignore,no_run
17475    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17476    /// let x = ClusterOperationMetadata::new().set_cluster_uuid("example");
17477    /// ```
17478    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17479        self.cluster_uuid = v.into();
17480        self
17481    }
17482
17483    /// Sets the value of [status][crate::model::ClusterOperationMetadata::status].
17484    ///
17485    /// # Example
17486    /// ```ignore,no_run
17487    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17488    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17489    /// let x = ClusterOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17490    /// ```
17491    pub fn set_status<T>(mut self, v: T) -> Self
17492    where
17493        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17494    {
17495        self.status = std::option::Option::Some(v.into());
17496        self
17497    }
17498
17499    /// Sets or clears the value of [status][crate::model::ClusterOperationMetadata::status].
17500    ///
17501    /// # Example
17502    /// ```ignore,no_run
17503    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17504    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17505    /// let x = ClusterOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17506    /// let x = ClusterOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17507    /// ```
17508    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17509    where
17510        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17511    {
17512        self.status = v.map(|x| x.into());
17513        self
17514    }
17515
17516    /// Sets the value of [status_history][crate::model::ClusterOperationMetadata::status_history].
17517    ///
17518    /// # Example
17519    /// ```ignore,no_run
17520    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17521    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17522    /// let x = ClusterOperationMetadata::new()
17523    ///     .set_status_history([
17524    ///         ClusterOperationStatus::default()/* use setters */,
17525    ///         ClusterOperationStatus::default()/* use (different) setters */,
17526    ///     ]);
17527    /// ```
17528    pub fn set_status_history<T, V>(mut self, v: T) -> Self
17529    where
17530        T: std::iter::IntoIterator<Item = V>,
17531        V: std::convert::Into<crate::model::ClusterOperationStatus>,
17532    {
17533        use std::iter::Iterator;
17534        self.status_history = v.into_iter().map(|i| i.into()).collect();
17535        self
17536    }
17537
17538    /// Sets the value of [operation_type][crate::model::ClusterOperationMetadata::operation_type].
17539    ///
17540    /// # Example
17541    /// ```ignore,no_run
17542    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17543    /// let x = ClusterOperationMetadata::new().set_operation_type("example");
17544    /// ```
17545    pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17546        self.operation_type = v.into();
17547        self
17548    }
17549
17550    /// Sets the value of [description][crate::model::ClusterOperationMetadata::description].
17551    ///
17552    /// # Example
17553    /// ```ignore,no_run
17554    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17555    /// let x = ClusterOperationMetadata::new().set_description("example");
17556    /// ```
17557    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17558        self.description = v.into();
17559        self
17560    }
17561
17562    /// Sets the value of [labels][crate::model::ClusterOperationMetadata::labels].
17563    ///
17564    /// # Example
17565    /// ```ignore,no_run
17566    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17567    /// let x = ClusterOperationMetadata::new().set_labels([
17568    ///     ("key0", "abc"),
17569    ///     ("key1", "xyz"),
17570    /// ]);
17571    /// ```
17572    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17573    where
17574        T: std::iter::IntoIterator<Item = (K, V)>,
17575        K: std::convert::Into<std::string::String>,
17576        V: std::convert::Into<std::string::String>,
17577    {
17578        use std::iter::Iterator;
17579        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17580        self
17581    }
17582
17583    /// Sets the value of [warnings][crate::model::ClusterOperationMetadata::warnings].
17584    ///
17585    /// # Example
17586    /// ```ignore,no_run
17587    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17588    /// let x = ClusterOperationMetadata::new().set_warnings(["a", "b", "c"]);
17589    /// ```
17590    pub fn set_warnings<T, V>(mut self, v: T) -> Self
17591    where
17592        T: std::iter::IntoIterator<Item = V>,
17593        V: std::convert::Into<std::string::String>,
17594    {
17595        use std::iter::Iterator;
17596        self.warnings = v.into_iter().map(|i| i.into()).collect();
17597        self
17598    }
17599
17600    /// Sets the value of [child_operation_ids][crate::model::ClusterOperationMetadata::child_operation_ids].
17601    ///
17602    /// # Example
17603    /// ```ignore,no_run
17604    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17605    /// let x = ClusterOperationMetadata::new().set_child_operation_ids(["a", "b", "c"]);
17606    /// ```
17607    pub fn set_child_operation_ids<T, V>(mut self, v: T) -> Self
17608    where
17609        T: std::iter::IntoIterator<Item = V>,
17610        V: std::convert::Into<std::string::String>,
17611    {
17612        use std::iter::Iterator;
17613        self.child_operation_ids = v.into_iter().map(|i| i.into()).collect();
17614        self
17615    }
17616}
17617
17618impl wkt::message::Message for ClusterOperationMetadata {
17619    fn typename() -> &'static str {
17620        "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationMetadata"
17621    }
17622}
17623
17624/// Metadata describing the node group operation.
17625#[derive(Clone, Default, PartialEq)]
17626#[non_exhaustive]
17627pub struct NodeGroupOperationMetadata {
17628    /// Output only. Node group ID for the operation.
17629    pub node_group_id: std::string::String,
17630
17631    /// Output only. Cluster UUID associated with the node group operation.
17632    pub cluster_uuid: std::string::String,
17633
17634    /// Output only. Current operation status.
17635    pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17636
17637    /// Output only. The previous operation status.
17638    pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17639
17640    /// The operation type.
17641    pub operation_type: crate::model::node_group_operation_metadata::NodeGroupOperationType,
17642
17643    /// Output only. Short description of operation.
17644    pub description: std::string::String,
17645
17646    /// Output only. Labels associated with the operation.
17647    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17648
17649    /// Output only. Errors encountered during operation execution.
17650    pub warnings: std::vec::Vec<std::string::String>,
17651
17652    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17653}
17654
17655impl NodeGroupOperationMetadata {
17656    /// Creates a new default instance.
17657    pub fn new() -> Self {
17658        std::default::Default::default()
17659    }
17660
17661    /// Sets the value of [node_group_id][crate::model::NodeGroupOperationMetadata::node_group_id].
17662    ///
17663    /// # Example
17664    /// ```ignore,no_run
17665    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17666    /// let x = NodeGroupOperationMetadata::new().set_node_group_id("example");
17667    /// ```
17668    pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17669        self.node_group_id = v.into();
17670        self
17671    }
17672
17673    /// Sets the value of [cluster_uuid][crate::model::NodeGroupOperationMetadata::cluster_uuid].
17674    ///
17675    /// # Example
17676    /// ```ignore,no_run
17677    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17678    /// let x = NodeGroupOperationMetadata::new().set_cluster_uuid("example");
17679    /// ```
17680    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17681        self.cluster_uuid = v.into();
17682        self
17683    }
17684
17685    /// Sets the value of [status][crate::model::NodeGroupOperationMetadata::status].
17686    ///
17687    /// # Example
17688    /// ```ignore,no_run
17689    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17690    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17691    /// let x = NodeGroupOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17692    /// ```
17693    pub fn set_status<T>(mut self, v: T) -> Self
17694    where
17695        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17696    {
17697        self.status = std::option::Option::Some(v.into());
17698        self
17699    }
17700
17701    /// Sets or clears the value of [status][crate::model::NodeGroupOperationMetadata::status].
17702    ///
17703    /// # Example
17704    /// ```ignore,no_run
17705    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17706    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17707    /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17708    /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17709    /// ```
17710    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17711    where
17712        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17713    {
17714        self.status = v.map(|x| x.into());
17715        self
17716    }
17717
17718    /// Sets the value of [status_history][crate::model::NodeGroupOperationMetadata::status_history].
17719    ///
17720    /// # Example
17721    /// ```ignore,no_run
17722    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17723    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17724    /// let x = NodeGroupOperationMetadata::new()
17725    ///     .set_status_history([
17726    ///         ClusterOperationStatus::default()/* use setters */,
17727    ///         ClusterOperationStatus::default()/* use (different) setters */,
17728    ///     ]);
17729    /// ```
17730    pub fn set_status_history<T, V>(mut self, v: T) -> Self
17731    where
17732        T: std::iter::IntoIterator<Item = V>,
17733        V: std::convert::Into<crate::model::ClusterOperationStatus>,
17734    {
17735        use std::iter::Iterator;
17736        self.status_history = v.into_iter().map(|i| i.into()).collect();
17737        self
17738    }
17739
17740    /// Sets the value of [operation_type][crate::model::NodeGroupOperationMetadata::operation_type].
17741    ///
17742    /// # Example
17743    /// ```ignore,no_run
17744    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17745    /// use google_cloud_dataproc_v1::model::node_group_operation_metadata::NodeGroupOperationType;
17746    /// let x0 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Create);
17747    /// let x1 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Update);
17748    /// let x2 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Delete);
17749    /// ```
17750    pub fn set_operation_type<
17751        T: std::convert::Into<crate::model::node_group_operation_metadata::NodeGroupOperationType>,
17752    >(
17753        mut self,
17754        v: T,
17755    ) -> Self {
17756        self.operation_type = v.into();
17757        self
17758    }
17759
17760    /// Sets the value of [description][crate::model::NodeGroupOperationMetadata::description].
17761    ///
17762    /// # Example
17763    /// ```ignore,no_run
17764    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17765    /// let x = NodeGroupOperationMetadata::new().set_description("example");
17766    /// ```
17767    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17768        self.description = v.into();
17769        self
17770    }
17771
17772    /// Sets the value of [labels][crate::model::NodeGroupOperationMetadata::labels].
17773    ///
17774    /// # Example
17775    /// ```ignore,no_run
17776    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17777    /// let x = NodeGroupOperationMetadata::new().set_labels([
17778    ///     ("key0", "abc"),
17779    ///     ("key1", "xyz"),
17780    /// ]);
17781    /// ```
17782    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17783    where
17784        T: std::iter::IntoIterator<Item = (K, V)>,
17785        K: std::convert::Into<std::string::String>,
17786        V: std::convert::Into<std::string::String>,
17787    {
17788        use std::iter::Iterator;
17789        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17790        self
17791    }
17792
17793    /// Sets the value of [warnings][crate::model::NodeGroupOperationMetadata::warnings].
17794    ///
17795    /// # Example
17796    /// ```ignore,no_run
17797    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17798    /// let x = NodeGroupOperationMetadata::new().set_warnings(["a", "b", "c"]);
17799    /// ```
17800    pub fn set_warnings<T, V>(mut self, v: T) -> Self
17801    where
17802        T: std::iter::IntoIterator<Item = V>,
17803        V: std::convert::Into<std::string::String>,
17804    {
17805        use std::iter::Iterator;
17806        self.warnings = v.into_iter().map(|i| i.into()).collect();
17807        self
17808    }
17809}
17810
17811impl wkt::message::Message for NodeGroupOperationMetadata {
17812    fn typename() -> &'static str {
17813        "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupOperationMetadata"
17814    }
17815}
17816
17817/// Defines additional types related to [NodeGroupOperationMetadata].
17818pub mod node_group_operation_metadata {
17819    #[allow(unused_imports)]
17820    use super::*;
17821
17822    /// Operation type for node group resources.
17823    ///
17824    /// # Working with unknown values
17825    ///
17826    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17827    /// additional enum variants at any time. Adding new variants is not considered
17828    /// a breaking change. Applications should write their code in anticipation of:
17829    ///
17830    /// - New values appearing in future releases of the client library, **and**
17831    /// - New values received dynamically, without application changes.
17832    ///
17833    /// Please consult the [Working with enums] section in the user guide for some
17834    /// guidelines.
17835    ///
17836    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17837    #[derive(Clone, Debug, PartialEq)]
17838    #[non_exhaustive]
17839    pub enum NodeGroupOperationType {
17840        /// Node group operation type is unknown.
17841        Unspecified,
17842        /// Create node group operation type.
17843        Create,
17844        /// Update node group operation type.
17845        Update,
17846        /// Delete node group operation type.
17847        Delete,
17848        /// Resize node group operation type.
17849        Resize,
17850        /// If set, the enum was initialized with an unknown value.
17851        ///
17852        /// Applications can examine the value using [NodeGroupOperationType::value] or
17853        /// [NodeGroupOperationType::name].
17854        UnknownValue(node_group_operation_type::UnknownValue),
17855    }
17856
17857    #[doc(hidden)]
17858    pub mod node_group_operation_type {
17859        #[allow(unused_imports)]
17860        use super::*;
17861        #[derive(Clone, Debug, PartialEq)]
17862        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17863    }
17864
17865    impl NodeGroupOperationType {
17866        /// Gets the enum value.
17867        ///
17868        /// Returns `None` if the enum contains an unknown value deserialized from
17869        /// the string representation of enums.
17870        pub fn value(&self) -> std::option::Option<i32> {
17871            match self {
17872                Self::Unspecified => std::option::Option::Some(0),
17873                Self::Create => std::option::Option::Some(1),
17874                Self::Update => std::option::Option::Some(2),
17875                Self::Delete => std::option::Option::Some(3),
17876                Self::Resize => std::option::Option::Some(4),
17877                Self::UnknownValue(u) => u.0.value(),
17878            }
17879        }
17880
17881        /// Gets the enum value as a string.
17882        ///
17883        /// Returns `None` if the enum contains an unknown value deserialized from
17884        /// the integer representation of enums.
17885        pub fn name(&self) -> std::option::Option<&str> {
17886            match self {
17887                Self::Unspecified => {
17888                    std::option::Option::Some("NODE_GROUP_OPERATION_TYPE_UNSPECIFIED")
17889                }
17890                Self::Create => std::option::Option::Some("CREATE"),
17891                Self::Update => std::option::Option::Some("UPDATE"),
17892                Self::Delete => std::option::Option::Some("DELETE"),
17893                Self::Resize => std::option::Option::Some("RESIZE"),
17894                Self::UnknownValue(u) => u.0.name(),
17895            }
17896        }
17897    }
17898
17899    impl std::default::Default for NodeGroupOperationType {
17900        fn default() -> Self {
17901            use std::convert::From;
17902            Self::from(0)
17903        }
17904    }
17905
17906    impl std::fmt::Display for NodeGroupOperationType {
17907        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17908            wkt::internal::display_enum(f, self.name(), self.value())
17909        }
17910    }
17911
17912    impl std::convert::From<i32> for NodeGroupOperationType {
17913        fn from(value: i32) -> Self {
17914            match value {
17915                0 => Self::Unspecified,
17916                1 => Self::Create,
17917                2 => Self::Update,
17918                3 => Self::Delete,
17919                4 => Self::Resize,
17920                _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17921                    wkt::internal::UnknownEnumValue::Integer(value),
17922                )),
17923            }
17924        }
17925    }
17926
17927    impl std::convert::From<&str> for NodeGroupOperationType {
17928        fn from(value: &str) -> Self {
17929            use std::string::ToString;
17930            match value {
17931                "NODE_GROUP_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17932                "CREATE" => Self::Create,
17933                "UPDATE" => Self::Update,
17934                "DELETE" => Self::Delete,
17935                "RESIZE" => Self::Resize,
17936                _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17937                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17938                )),
17939            }
17940        }
17941    }
17942
17943    impl serde::ser::Serialize for NodeGroupOperationType {
17944        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17945        where
17946            S: serde::Serializer,
17947        {
17948            match self {
17949                Self::Unspecified => serializer.serialize_i32(0),
17950                Self::Create => serializer.serialize_i32(1),
17951                Self::Update => serializer.serialize_i32(2),
17952                Self::Delete => serializer.serialize_i32(3),
17953                Self::Resize => serializer.serialize_i32(4),
17954                Self::UnknownValue(u) => u.0.serialize(serializer),
17955            }
17956        }
17957    }
17958
17959    impl<'de> serde::de::Deserialize<'de> for NodeGroupOperationType {
17960        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17961        where
17962            D: serde::Deserializer<'de>,
17963        {
17964            deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeGroupOperationType>::new(
17965                ".google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType",
17966            ))
17967        }
17968    }
17969}
17970
17971/// A request to create a session template.
17972#[derive(Clone, Default, PartialEq)]
17973#[non_exhaustive]
17974pub struct CreateSessionTemplateRequest {
17975    /// Required. The parent resource where this session template will be created.
17976    pub parent: std::string::String,
17977
17978    /// Required. The session template to create.
17979    pub session_template: std::option::Option<crate::model::SessionTemplate>,
17980
17981    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17982}
17983
17984impl CreateSessionTemplateRequest {
17985    /// Creates a new default instance.
17986    pub fn new() -> Self {
17987        std::default::Default::default()
17988    }
17989
17990    /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
17991    ///
17992    /// # Example
17993    /// ```ignore,no_run
17994    /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17995    /// let x = CreateSessionTemplateRequest::new().set_parent("example");
17996    /// ```
17997    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17998        self.parent = v.into();
17999        self
18000    }
18001
18002    /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
18003    ///
18004    /// # Example
18005    /// ```ignore,no_run
18006    /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18007    /// use google_cloud_dataproc_v1::model::SessionTemplate;
18008    /// let x = CreateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
18009    /// ```
18010    pub fn set_session_template<T>(mut self, v: T) -> Self
18011    where
18012        T: std::convert::Into<crate::model::SessionTemplate>,
18013    {
18014        self.session_template = std::option::Option::Some(v.into());
18015        self
18016    }
18017
18018    /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
18019    ///
18020    /// # Example
18021    /// ```ignore,no_run
18022    /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18023    /// use google_cloud_dataproc_v1::model::SessionTemplate;
18024    /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
18025    /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
18026    /// ```
18027    pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
18028    where
18029        T: std::convert::Into<crate::model::SessionTemplate>,
18030    {
18031        self.session_template = v.map(|x| x.into());
18032        self
18033    }
18034}
18035
18036impl wkt::message::Message for CreateSessionTemplateRequest {
18037    fn typename() -> &'static str {
18038        "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionTemplateRequest"
18039    }
18040}
18041
18042/// A request to update a session template.
18043#[derive(Clone, Default, PartialEq)]
18044#[non_exhaustive]
18045pub struct UpdateSessionTemplateRequest {
18046    /// Required. The updated session template.
18047    pub session_template: std::option::Option<crate::model::SessionTemplate>,
18048
18049    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18050}
18051
18052impl UpdateSessionTemplateRequest {
18053    /// Creates a new default instance.
18054    pub fn new() -> Self {
18055        std::default::Default::default()
18056    }
18057
18058    /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
18059    ///
18060    /// # Example
18061    /// ```ignore,no_run
18062    /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
18063    /// use google_cloud_dataproc_v1::model::SessionTemplate;
18064    /// let x = UpdateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
18065    /// ```
18066    pub fn set_session_template<T>(mut self, v: T) -> Self
18067    where
18068        T: std::convert::Into<crate::model::SessionTemplate>,
18069    {
18070        self.session_template = std::option::Option::Some(v.into());
18071        self
18072    }
18073
18074    /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
18075    ///
18076    /// # Example
18077    /// ```ignore,no_run
18078    /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
18079    /// use google_cloud_dataproc_v1::model::SessionTemplate;
18080    /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
18081    /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
18082    /// ```
18083    pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
18084    where
18085        T: std::convert::Into<crate::model::SessionTemplate>,
18086    {
18087        self.session_template = v.map(|x| x.into());
18088        self
18089    }
18090}
18091
18092impl wkt::message::Message for UpdateSessionTemplateRequest {
18093    fn typename() -> &'static str {
18094        "type.googleapis.com/google.cloud.dataproc.v1.UpdateSessionTemplateRequest"
18095    }
18096}
18097
18098/// A request to get the resource representation for a session template.
18099#[derive(Clone, Default, PartialEq)]
18100#[non_exhaustive]
18101pub struct GetSessionTemplateRequest {
18102    /// Required. The name of the session template to retrieve.
18103    pub name: std::string::String,
18104
18105    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18106}
18107
18108impl GetSessionTemplateRequest {
18109    /// Creates a new default instance.
18110    pub fn new() -> Self {
18111        std::default::Default::default()
18112    }
18113
18114    /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
18115    ///
18116    /// # Example
18117    /// ```ignore,no_run
18118    /// # use google_cloud_dataproc_v1::model::GetSessionTemplateRequest;
18119    /// let x = GetSessionTemplateRequest::new().set_name("example");
18120    /// ```
18121    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18122        self.name = v.into();
18123        self
18124    }
18125}
18126
18127impl wkt::message::Message for GetSessionTemplateRequest {
18128    fn typename() -> &'static str {
18129        "type.googleapis.com/google.cloud.dataproc.v1.GetSessionTemplateRequest"
18130    }
18131}
18132
18133/// A request to list session templates in a project.
18134#[derive(Clone, Default, PartialEq)]
18135#[non_exhaustive]
18136pub struct ListSessionTemplatesRequest {
18137    /// Required. The parent that owns this collection of session templates.
18138    pub parent: std::string::String,
18139
18140    /// Optional. The maximum number of sessions to return in each response.
18141    /// The service may return fewer than this value.
18142    pub page_size: i32,
18143
18144    /// Optional. A page token received from a previous `ListSessions` call.
18145    /// Provide this token to retrieve the subsequent page.
18146    pub page_token: std::string::String,
18147
18148    /// Optional. A filter for the session templates to return in the response.
18149    /// Filters are case sensitive and have the following syntax:
18150    ///
18151    /// [field = value] AND [field [= value]] ...
18152    pub filter: std::string::String,
18153
18154    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18155}
18156
18157impl ListSessionTemplatesRequest {
18158    /// Creates a new default instance.
18159    pub fn new() -> Self {
18160        std::default::Default::default()
18161    }
18162
18163    /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
18164    ///
18165    /// # Example
18166    /// ```ignore,no_run
18167    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18168    /// let x = ListSessionTemplatesRequest::new().set_parent("example");
18169    /// ```
18170    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18171        self.parent = v.into();
18172        self
18173    }
18174
18175    /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
18176    ///
18177    /// # Example
18178    /// ```ignore,no_run
18179    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18180    /// let x = ListSessionTemplatesRequest::new().set_page_size(42);
18181    /// ```
18182    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18183        self.page_size = v.into();
18184        self
18185    }
18186
18187    /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
18188    ///
18189    /// # Example
18190    /// ```ignore,no_run
18191    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18192    /// let x = ListSessionTemplatesRequest::new().set_page_token("example");
18193    /// ```
18194    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18195        self.page_token = v.into();
18196        self
18197    }
18198
18199    /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
18200    ///
18201    /// # Example
18202    /// ```ignore,no_run
18203    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18204    /// let x = ListSessionTemplatesRequest::new().set_filter("example");
18205    /// ```
18206    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18207        self.filter = v.into();
18208        self
18209    }
18210}
18211
18212impl wkt::message::Message for ListSessionTemplatesRequest {
18213    fn typename() -> &'static str {
18214        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesRequest"
18215    }
18216}
18217
18218/// A list of session templates.
18219#[derive(Clone, Default, PartialEq)]
18220#[non_exhaustive]
18221pub struct ListSessionTemplatesResponse {
18222    /// Output only. Session template list
18223    pub session_templates: std::vec::Vec<crate::model::SessionTemplate>,
18224
18225    /// A token, which can be sent as `page_token` to retrieve the next page.
18226    /// If this field is omitted, there are no subsequent pages.
18227    pub next_page_token: std::string::String,
18228
18229    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18230}
18231
18232impl ListSessionTemplatesResponse {
18233    /// Creates a new default instance.
18234    pub fn new() -> Self {
18235        std::default::Default::default()
18236    }
18237
18238    /// Sets the value of [session_templates][crate::model::ListSessionTemplatesResponse::session_templates].
18239    ///
18240    /// # Example
18241    /// ```ignore,no_run
18242    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
18243    /// use google_cloud_dataproc_v1::model::SessionTemplate;
18244    /// let x = ListSessionTemplatesResponse::new()
18245    ///     .set_session_templates([
18246    ///         SessionTemplate::default()/* use setters */,
18247    ///         SessionTemplate::default()/* use (different) setters */,
18248    ///     ]);
18249    /// ```
18250    pub fn set_session_templates<T, V>(mut self, v: T) -> Self
18251    where
18252        T: std::iter::IntoIterator<Item = V>,
18253        V: std::convert::Into<crate::model::SessionTemplate>,
18254    {
18255        use std::iter::Iterator;
18256        self.session_templates = v.into_iter().map(|i| i.into()).collect();
18257        self
18258    }
18259
18260    /// Sets the value of [next_page_token][crate::model::ListSessionTemplatesResponse::next_page_token].
18261    ///
18262    /// # Example
18263    /// ```ignore,no_run
18264    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
18265    /// let x = ListSessionTemplatesResponse::new().set_next_page_token("example");
18266    /// ```
18267    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18268        self.next_page_token = v.into();
18269        self
18270    }
18271}
18272
18273impl wkt::message::Message for ListSessionTemplatesResponse {
18274    fn typename() -> &'static str {
18275        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesResponse"
18276    }
18277}
18278
18279#[doc(hidden)]
18280impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionTemplatesResponse {
18281    type PageItem = crate::model::SessionTemplate;
18282
18283    fn items(self) -> std::vec::Vec<Self::PageItem> {
18284        self.session_templates
18285    }
18286
18287    fn next_page_token(&self) -> std::string::String {
18288        use std::clone::Clone;
18289        self.next_page_token.clone()
18290    }
18291}
18292
18293/// A request to delete a session template.
18294#[derive(Clone, Default, PartialEq)]
18295#[non_exhaustive]
18296pub struct DeleteSessionTemplateRequest {
18297    /// Required. The name of the session template resource to delete.
18298    pub name: std::string::String,
18299
18300    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18301}
18302
18303impl DeleteSessionTemplateRequest {
18304    /// Creates a new default instance.
18305    pub fn new() -> Self {
18306        std::default::Default::default()
18307    }
18308
18309    /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
18310    ///
18311    /// # Example
18312    /// ```ignore,no_run
18313    /// # use google_cloud_dataproc_v1::model::DeleteSessionTemplateRequest;
18314    /// let x = DeleteSessionTemplateRequest::new().set_name("example");
18315    /// ```
18316    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18317        self.name = v.into();
18318        self
18319    }
18320}
18321
18322impl wkt::message::Message for DeleteSessionTemplateRequest {
18323    fn typename() -> &'static str {
18324        "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionTemplateRequest"
18325    }
18326}
18327
18328/// A representation of a session template.
18329#[derive(Clone, Default, PartialEq)]
18330#[non_exhaustive]
18331pub struct SessionTemplate {
18332    /// Required. The resource name of the session template.
18333    pub name: std::string::String,
18334
18335    /// Optional. Brief description of the template.
18336    pub description: std::string::String,
18337
18338    /// Output only. The time when the template was created.
18339    pub create_time: std::option::Option<wkt::Timestamp>,
18340
18341    /// Output only. The email address of the user who created the template.
18342    pub creator: std::string::String,
18343
18344    /// Optional. Labels to associate with sessions created using this template.
18345    /// Label **keys** must contain 1 to 63 characters, and must conform to
18346    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
18347    /// Label **values** can be empty, but, if present, must contain 1 to 63
18348    /// characters and conform to [RFC
18349    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
18350    /// associated with a session.
18351    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18352
18353    /// Optional. Runtime configuration for session execution.
18354    pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
18355
18356    /// Optional. Environment configuration for session execution.
18357    pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
18358
18359    /// Output only. The time the template was last updated.
18360    pub update_time: std::option::Option<wkt::Timestamp>,
18361
18362    /// Output only. A session template UUID (Unique Universal Identifier). The
18363    /// service generates this value when it creates the session template.
18364    pub uuid: std::string::String,
18365
18366    /// The session configuration.
18367    pub session_config: std::option::Option<crate::model::session_template::SessionConfig>,
18368
18369    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18370}
18371
18372impl SessionTemplate {
18373    /// Creates a new default instance.
18374    pub fn new() -> Self {
18375        std::default::Default::default()
18376    }
18377
18378    /// Sets the value of [name][crate::model::SessionTemplate::name].
18379    ///
18380    /// # Example
18381    /// ```ignore,no_run
18382    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18383    /// let x = SessionTemplate::new().set_name("example");
18384    /// ```
18385    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18386        self.name = v.into();
18387        self
18388    }
18389
18390    /// Sets the value of [description][crate::model::SessionTemplate::description].
18391    ///
18392    /// # Example
18393    /// ```ignore,no_run
18394    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18395    /// let x = SessionTemplate::new().set_description("example");
18396    /// ```
18397    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18398        self.description = v.into();
18399        self
18400    }
18401
18402    /// Sets the value of [create_time][crate::model::SessionTemplate::create_time].
18403    ///
18404    /// # Example
18405    /// ```ignore,no_run
18406    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18407    /// use wkt::Timestamp;
18408    /// let x = SessionTemplate::new().set_create_time(Timestamp::default()/* use setters */);
18409    /// ```
18410    pub fn set_create_time<T>(mut self, v: T) -> Self
18411    where
18412        T: std::convert::Into<wkt::Timestamp>,
18413    {
18414        self.create_time = std::option::Option::Some(v.into());
18415        self
18416    }
18417
18418    /// Sets or clears the value of [create_time][crate::model::SessionTemplate::create_time].
18419    ///
18420    /// # Example
18421    /// ```ignore,no_run
18422    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18423    /// use wkt::Timestamp;
18424    /// let x = SessionTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18425    /// let x = SessionTemplate::new().set_or_clear_create_time(None::<Timestamp>);
18426    /// ```
18427    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18428    where
18429        T: std::convert::Into<wkt::Timestamp>,
18430    {
18431        self.create_time = v.map(|x| x.into());
18432        self
18433    }
18434
18435    /// Sets the value of [creator][crate::model::SessionTemplate::creator].
18436    ///
18437    /// # Example
18438    /// ```ignore,no_run
18439    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18440    /// let x = SessionTemplate::new().set_creator("example");
18441    /// ```
18442    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18443        self.creator = v.into();
18444        self
18445    }
18446
18447    /// Sets the value of [labels][crate::model::SessionTemplate::labels].
18448    ///
18449    /// # Example
18450    /// ```ignore,no_run
18451    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18452    /// let x = SessionTemplate::new().set_labels([
18453    ///     ("key0", "abc"),
18454    ///     ("key1", "xyz"),
18455    /// ]);
18456    /// ```
18457    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18458    where
18459        T: std::iter::IntoIterator<Item = (K, V)>,
18460        K: std::convert::Into<std::string::String>,
18461        V: std::convert::Into<std::string::String>,
18462    {
18463        use std::iter::Iterator;
18464        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18465        self
18466    }
18467
18468    /// Sets the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18469    ///
18470    /// # Example
18471    /// ```ignore,no_run
18472    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18473    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18474    /// let x = SessionTemplate::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18475    /// ```
18476    pub fn set_runtime_config<T>(mut self, v: T) -> Self
18477    where
18478        T: std::convert::Into<crate::model::RuntimeConfig>,
18479    {
18480        self.runtime_config = std::option::Option::Some(v.into());
18481        self
18482    }
18483
18484    /// Sets or clears the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18485    ///
18486    /// # Example
18487    /// ```ignore,no_run
18488    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18489    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18490    /// let x = SessionTemplate::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
18491    /// let x = SessionTemplate::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
18492    /// ```
18493    pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
18494    where
18495        T: std::convert::Into<crate::model::RuntimeConfig>,
18496    {
18497        self.runtime_config = v.map(|x| x.into());
18498        self
18499    }
18500
18501    /// Sets the value of [environment_config][crate::model::SessionTemplate::environment_config].
18502    ///
18503    /// # Example
18504    /// ```ignore,no_run
18505    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18506    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18507    /// let x = SessionTemplate::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
18508    /// ```
18509    pub fn set_environment_config<T>(mut self, v: T) -> Self
18510    where
18511        T: std::convert::Into<crate::model::EnvironmentConfig>,
18512    {
18513        self.environment_config = std::option::Option::Some(v.into());
18514        self
18515    }
18516
18517    /// Sets or clears the value of [environment_config][crate::model::SessionTemplate::environment_config].
18518    ///
18519    /// # Example
18520    /// ```ignore,no_run
18521    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18522    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18523    /// let x = SessionTemplate::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
18524    /// let x = SessionTemplate::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
18525    /// ```
18526    pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
18527    where
18528        T: std::convert::Into<crate::model::EnvironmentConfig>,
18529    {
18530        self.environment_config = v.map(|x| x.into());
18531        self
18532    }
18533
18534    /// Sets the value of [update_time][crate::model::SessionTemplate::update_time].
18535    ///
18536    /// # Example
18537    /// ```ignore,no_run
18538    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18539    /// use wkt::Timestamp;
18540    /// let x = SessionTemplate::new().set_update_time(Timestamp::default()/* use setters */);
18541    /// ```
18542    pub fn set_update_time<T>(mut self, v: T) -> Self
18543    where
18544        T: std::convert::Into<wkt::Timestamp>,
18545    {
18546        self.update_time = std::option::Option::Some(v.into());
18547        self
18548    }
18549
18550    /// Sets or clears the value of [update_time][crate::model::SessionTemplate::update_time].
18551    ///
18552    /// # Example
18553    /// ```ignore,no_run
18554    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18555    /// use wkt::Timestamp;
18556    /// let x = SessionTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
18557    /// let x = SessionTemplate::new().set_or_clear_update_time(None::<Timestamp>);
18558    /// ```
18559    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
18560    where
18561        T: std::convert::Into<wkt::Timestamp>,
18562    {
18563        self.update_time = v.map(|x| x.into());
18564        self
18565    }
18566
18567    /// Sets the value of [uuid][crate::model::SessionTemplate::uuid].
18568    ///
18569    /// # Example
18570    /// ```ignore,no_run
18571    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18572    /// let x = SessionTemplate::new().set_uuid("example");
18573    /// ```
18574    pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18575        self.uuid = v.into();
18576        self
18577    }
18578
18579    /// Sets the value of [session_config][crate::model::SessionTemplate::session_config].
18580    ///
18581    /// Note that all the setters affecting `session_config` are mutually
18582    /// exclusive.
18583    ///
18584    /// # Example
18585    /// ```ignore,no_run
18586    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18587    /// use google_cloud_dataproc_v1::model::JupyterConfig;
18588    /// let x = SessionTemplate::new().set_session_config(Some(
18589    ///     google_cloud_dataproc_v1::model::session_template::SessionConfig::JupyterSession(JupyterConfig::default().into())));
18590    /// ```
18591    pub fn set_session_config<
18592        T: std::convert::Into<std::option::Option<crate::model::session_template::SessionConfig>>,
18593    >(
18594        mut self,
18595        v: T,
18596    ) -> Self {
18597        self.session_config = v.into();
18598        self
18599    }
18600
18601    /// The value of [session_config][crate::model::SessionTemplate::session_config]
18602    /// if it holds a `JupyterSession`, `None` if the field is not set or
18603    /// holds a different branch.
18604    pub fn jupyter_session(
18605        &self,
18606    ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
18607        #[allow(unreachable_patterns)]
18608        self.session_config.as_ref().and_then(|v| match v {
18609            crate::model::session_template::SessionConfig::JupyterSession(v) => {
18610                std::option::Option::Some(v)
18611            }
18612            _ => std::option::Option::None,
18613        })
18614    }
18615
18616    /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18617    /// to hold a `JupyterSession`.
18618    ///
18619    /// Note that all the setters affecting `session_config` are
18620    /// mutually exclusive.
18621    ///
18622    /// # Example
18623    /// ```ignore,no_run
18624    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18625    /// use google_cloud_dataproc_v1::model::JupyterConfig;
18626    /// let x = SessionTemplate::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
18627    /// assert!(x.jupyter_session().is_some());
18628    /// assert!(x.spark_connect_session().is_none());
18629    /// ```
18630    pub fn set_jupyter_session<
18631        T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
18632    >(
18633        mut self,
18634        v: T,
18635    ) -> Self {
18636        self.session_config = std::option::Option::Some(
18637            crate::model::session_template::SessionConfig::JupyterSession(v.into()),
18638        );
18639        self
18640    }
18641
18642    /// The value of [session_config][crate::model::SessionTemplate::session_config]
18643    /// if it holds a `SparkConnectSession`, `None` if the field is not set or
18644    /// holds a different branch.
18645    pub fn spark_connect_session(
18646        &self,
18647    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
18648        #[allow(unreachable_patterns)]
18649        self.session_config.as_ref().and_then(|v| match v {
18650            crate::model::session_template::SessionConfig::SparkConnectSession(v) => {
18651                std::option::Option::Some(v)
18652            }
18653            _ => std::option::Option::None,
18654        })
18655    }
18656
18657    /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18658    /// to hold a `SparkConnectSession`.
18659    ///
18660    /// Note that all the setters affecting `session_config` are
18661    /// mutually exclusive.
18662    ///
18663    /// # Example
18664    /// ```ignore,no_run
18665    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18666    /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
18667    /// let x = SessionTemplate::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
18668    /// assert!(x.spark_connect_session().is_some());
18669    /// assert!(x.jupyter_session().is_none());
18670    /// ```
18671    pub fn set_spark_connect_session<
18672        T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
18673    >(
18674        mut self,
18675        v: T,
18676    ) -> Self {
18677        self.session_config = std::option::Option::Some(
18678            crate::model::session_template::SessionConfig::SparkConnectSession(v.into()),
18679        );
18680        self
18681    }
18682}
18683
18684impl wkt::message::Message for SessionTemplate {
18685    fn typename() -> &'static str {
18686        "type.googleapis.com/google.cloud.dataproc.v1.SessionTemplate"
18687    }
18688}
18689
18690/// Defines additional types related to [SessionTemplate].
18691pub mod session_template {
18692    #[allow(unused_imports)]
18693    use super::*;
18694
18695    /// The session configuration.
18696    #[derive(Clone, Debug, PartialEq)]
18697    #[non_exhaustive]
18698    pub enum SessionConfig {
18699        /// Optional. Jupyter session config.
18700        JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
18701        /// Optional. Spark Connect session config.
18702        SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
18703    }
18704}
18705
18706/// A request to create a session.
18707#[derive(Clone, Default, PartialEq)]
18708#[non_exhaustive]
18709pub struct CreateSessionRequest {
18710    /// Required. The parent resource where this session will be created.
18711    pub parent: std::string::String,
18712
18713    /// Required. The interactive session to create.
18714    pub session: std::option::Option<crate::model::Session>,
18715
18716    /// Required. The ID to use for the session, which becomes the final component
18717    /// of the session's resource name.
18718    ///
18719    /// This value must be 4-63 characters. Valid characters
18720    /// are /[a-z][0-9]-/.
18721    pub session_id: std::string::String,
18722
18723    /// Optional. A unique ID used to identify the request. If the service
18724    /// receives two
18725    /// [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
18726    /// with the same ID, the second request is ignored, and the
18727    /// first [Session][google.cloud.dataproc.v1.Session] is created and stored in
18728    /// the backend.
18729    ///
18730    /// Recommendation: Set this value to a
18731    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18732    ///
18733    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18734    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18735    ///
18736    /// [google.cloud.dataproc.v1.Session]: crate::model::Session
18737    pub request_id: std::string::String,
18738
18739    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18740}
18741
18742impl CreateSessionRequest {
18743    /// Creates a new default instance.
18744    pub fn new() -> Self {
18745        std::default::Default::default()
18746    }
18747
18748    /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
18749    ///
18750    /// # Example
18751    /// ```ignore,no_run
18752    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18753    /// let x = CreateSessionRequest::new().set_parent("example");
18754    /// ```
18755    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18756        self.parent = v.into();
18757        self
18758    }
18759
18760    /// Sets the value of [session][crate::model::CreateSessionRequest::session].
18761    ///
18762    /// # Example
18763    /// ```ignore,no_run
18764    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18765    /// use google_cloud_dataproc_v1::model::Session;
18766    /// let x = CreateSessionRequest::new().set_session(Session::default()/* use setters */);
18767    /// ```
18768    pub fn set_session<T>(mut self, v: T) -> Self
18769    where
18770        T: std::convert::Into<crate::model::Session>,
18771    {
18772        self.session = std::option::Option::Some(v.into());
18773        self
18774    }
18775
18776    /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
18777    ///
18778    /// # Example
18779    /// ```ignore,no_run
18780    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18781    /// use google_cloud_dataproc_v1::model::Session;
18782    /// let x = CreateSessionRequest::new().set_or_clear_session(Some(Session::default()/* use setters */));
18783    /// let x = CreateSessionRequest::new().set_or_clear_session(None::<Session>);
18784    /// ```
18785    pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
18786    where
18787        T: std::convert::Into<crate::model::Session>,
18788    {
18789        self.session = v.map(|x| x.into());
18790        self
18791    }
18792
18793    /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
18794    ///
18795    /// # Example
18796    /// ```ignore,no_run
18797    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18798    /// let x = CreateSessionRequest::new().set_session_id("example");
18799    /// ```
18800    pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18801        self.session_id = v.into();
18802        self
18803    }
18804
18805    /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
18806    ///
18807    /// # Example
18808    /// ```ignore,no_run
18809    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18810    /// let x = CreateSessionRequest::new().set_request_id("example");
18811    /// ```
18812    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18813        self.request_id = v.into();
18814        self
18815    }
18816}
18817
18818impl wkt::message::Message for CreateSessionRequest {
18819    fn typename() -> &'static str {
18820        "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionRequest"
18821    }
18822}
18823
18824/// A request to get the resource representation for a session.
18825#[derive(Clone, Default, PartialEq)]
18826#[non_exhaustive]
18827pub struct GetSessionRequest {
18828    /// Required. The name of the session to retrieve.
18829    pub name: std::string::String,
18830
18831    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18832}
18833
18834impl GetSessionRequest {
18835    /// Creates a new default instance.
18836    pub fn new() -> Self {
18837        std::default::Default::default()
18838    }
18839
18840    /// Sets the value of [name][crate::model::GetSessionRequest::name].
18841    ///
18842    /// # Example
18843    /// ```ignore,no_run
18844    /// # use google_cloud_dataproc_v1::model::GetSessionRequest;
18845    /// let x = GetSessionRequest::new().set_name("example");
18846    /// ```
18847    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18848        self.name = v.into();
18849        self
18850    }
18851}
18852
18853impl wkt::message::Message for GetSessionRequest {
18854    fn typename() -> &'static str {
18855        "type.googleapis.com/google.cloud.dataproc.v1.GetSessionRequest"
18856    }
18857}
18858
18859/// A request to list sessions in a project.
18860#[derive(Clone, Default, PartialEq)]
18861#[non_exhaustive]
18862pub struct ListSessionsRequest {
18863    /// Required. The parent, which owns this collection of sessions.
18864    pub parent: std::string::String,
18865
18866    /// Optional. The maximum number of sessions to return in each response.
18867    /// The service may return fewer than this value.
18868    pub page_size: i32,
18869
18870    /// Optional. A page token received from a previous `ListSessions` call.
18871    /// Provide this token to retrieve the subsequent page.
18872    pub page_token: std::string::String,
18873
18874    /// Optional. A filter for the sessions to return in the response.
18875    ///
18876    /// A filter is a logical expression constraining the values of various fields
18877    /// in each session resource. Filters are case sensitive, and may contain
18878    /// multiple clauses combined with logical operators (AND, OR).
18879    /// Supported fields are `session_id`, `session_uuid`, `state`, `create_time`,
18880    /// and `labels`.
18881    ///
18882    /// Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
18883    /// is a filter for sessions in an ACTIVE state that were created before
18884    /// 2023-01-01. `state = ACTIVE and labels.environment=production` is a filter
18885    /// for sessions in an ACTIVE state that have a production environment label.
18886    ///
18887    /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
18888    /// description of the filter syntax and a list of supported comparators.
18889    pub filter: std::string::String,
18890
18891    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18892}
18893
18894impl ListSessionsRequest {
18895    /// Creates a new default instance.
18896    pub fn new() -> Self {
18897        std::default::Default::default()
18898    }
18899
18900    /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
18901    ///
18902    /// # Example
18903    /// ```ignore,no_run
18904    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18905    /// let x = ListSessionsRequest::new().set_parent("example");
18906    /// ```
18907    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18908        self.parent = v.into();
18909        self
18910    }
18911
18912    /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
18913    ///
18914    /// # Example
18915    /// ```ignore,no_run
18916    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18917    /// let x = ListSessionsRequest::new().set_page_size(42);
18918    /// ```
18919    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18920        self.page_size = v.into();
18921        self
18922    }
18923
18924    /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
18925    ///
18926    /// # Example
18927    /// ```ignore,no_run
18928    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18929    /// let x = ListSessionsRequest::new().set_page_token("example");
18930    /// ```
18931    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18932        self.page_token = v.into();
18933        self
18934    }
18935
18936    /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
18937    ///
18938    /// # Example
18939    /// ```ignore,no_run
18940    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18941    /// let x = ListSessionsRequest::new().set_filter("example");
18942    /// ```
18943    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18944        self.filter = v.into();
18945        self
18946    }
18947}
18948
18949impl wkt::message::Message for ListSessionsRequest {
18950    fn typename() -> &'static str {
18951        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsRequest"
18952    }
18953}
18954
18955/// A list of interactive sessions.
18956#[derive(Clone, Default, PartialEq)]
18957#[non_exhaustive]
18958pub struct ListSessionsResponse {
18959    /// Output only. The sessions from the specified collection.
18960    pub sessions: std::vec::Vec<crate::model::Session>,
18961
18962    /// A token, which can be sent as `page_token`, to retrieve the next page.
18963    /// If this field is omitted, there are no subsequent pages.
18964    pub next_page_token: std::string::String,
18965
18966    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18967}
18968
18969impl ListSessionsResponse {
18970    /// Creates a new default instance.
18971    pub fn new() -> Self {
18972        std::default::Default::default()
18973    }
18974
18975    /// Sets the value of [sessions][crate::model::ListSessionsResponse::sessions].
18976    ///
18977    /// # Example
18978    /// ```ignore,no_run
18979    /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18980    /// use google_cloud_dataproc_v1::model::Session;
18981    /// let x = ListSessionsResponse::new()
18982    ///     .set_sessions([
18983    ///         Session::default()/* use setters */,
18984    ///         Session::default()/* use (different) setters */,
18985    ///     ]);
18986    /// ```
18987    pub fn set_sessions<T, V>(mut self, v: T) -> Self
18988    where
18989        T: std::iter::IntoIterator<Item = V>,
18990        V: std::convert::Into<crate::model::Session>,
18991    {
18992        use std::iter::Iterator;
18993        self.sessions = v.into_iter().map(|i| i.into()).collect();
18994        self
18995    }
18996
18997    /// Sets the value of [next_page_token][crate::model::ListSessionsResponse::next_page_token].
18998    ///
18999    /// # Example
19000    /// ```ignore,no_run
19001    /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
19002    /// let x = ListSessionsResponse::new().set_next_page_token("example");
19003    /// ```
19004    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19005        self.next_page_token = v.into();
19006        self
19007    }
19008}
19009
19010impl wkt::message::Message for ListSessionsResponse {
19011    fn typename() -> &'static str {
19012        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsResponse"
19013    }
19014}
19015
19016#[doc(hidden)]
19017impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionsResponse {
19018    type PageItem = crate::model::Session;
19019
19020    fn items(self) -> std::vec::Vec<Self::PageItem> {
19021        self.sessions
19022    }
19023
19024    fn next_page_token(&self) -> std::string::String {
19025        use std::clone::Clone;
19026        self.next_page_token.clone()
19027    }
19028}
19029
19030/// A request to terminate an interactive session.
19031#[derive(Clone, Default, PartialEq)]
19032#[non_exhaustive]
19033pub struct TerminateSessionRequest {
19034    /// Required. The name of the session resource to terminate.
19035    pub name: std::string::String,
19036
19037    /// Optional. A unique ID used to identify the request. If the service
19038    /// receives two
19039    /// [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
19040    /// with the same ID, the second request is ignored.
19041    ///
19042    /// Recommendation: Set this value to a
19043    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19044    ///
19045    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19046    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19047    pub request_id: std::string::String,
19048
19049    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19050}
19051
19052impl TerminateSessionRequest {
19053    /// Creates a new default instance.
19054    pub fn new() -> Self {
19055        std::default::Default::default()
19056    }
19057
19058    /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
19059    ///
19060    /// # Example
19061    /// ```ignore,no_run
19062    /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
19063    /// let x = TerminateSessionRequest::new().set_name("example");
19064    /// ```
19065    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19066        self.name = v.into();
19067        self
19068    }
19069
19070    /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
19071    ///
19072    /// # Example
19073    /// ```ignore,no_run
19074    /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
19075    /// let x = TerminateSessionRequest::new().set_request_id("example");
19076    /// ```
19077    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19078        self.request_id = v.into();
19079        self
19080    }
19081}
19082
19083impl wkt::message::Message for TerminateSessionRequest {
19084    fn typename() -> &'static str {
19085        "type.googleapis.com/google.cloud.dataproc.v1.TerminateSessionRequest"
19086    }
19087}
19088
19089/// A request to delete a session.
19090#[derive(Clone, Default, PartialEq)]
19091#[non_exhaustive]
19092pub struct DeleteSessionRequest {
19093    /// Required. The name of the session resource to delete.
19094    pub name: std::string::String,
19095
19096    /// Optional. A unique ID used to identify the request. If the service
19097    /// receives two
19098    /// [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
19099    /// with the same ID, the second request is ignored.
19100    ///
19101    /// Recommendation: Set this value to a
19102    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19103    ///
19104    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19105    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19106    pub request_id: std::string::String,
19107
19108    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19109}
19110
19111impl DeleteSessionRequest {
19112    /// Creates a new default instance.
19113    pub fn new() -> Self {
19114        std::default::Default::default()
19115    }
19116
19117    /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
19118    ///
19119    /// # Example
19120    /// ```ignore,no_run
19121    /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
19122    /// let x = DeleteSessionRequest::new().set_name("example");
19123    /// ```
19124    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19125        self.name = v.into();
19126        self
19127    }
19128
19129    /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
19130    ///
19131    /// # Example
19132    /// ```ignore,no_run
19133    /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
19134    /// let x = DeleteSessionRequest::new().set_request_id("example");
19135    /// ```
19136    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19137        self.request_id = v.into();
19138        self
19139    }
19140}
19141
19142impl wkt::message::Message for DeleteSessionRequest {
19143    fn typename() -> &'static str {
19144        "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionRequest"
19145    }
19146}
19147
19148/// A representation of a session.
19149#[derive(Clone, Default, PartialEq)]
19150#[non_exhaustive]
19151pub struct Session {
19152    /// Required. The resource name of the session.
19153    pub name: std::string::String,
19154
19155    /// Output only. A session UUID (Unique Universal Identifier). The service
19156    /// generates this value when it creates the session.
19157    pub uuid: std::string::String,
19158
19159    /// Output only. The time when the session was created.
19160    pub create_time: std::option::Option<wkt::Timestamp>,
19161
19162    /// Output only. Runtime information about session execution.
19163    pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
19164
19165    /// Output only. A state of the session.
19166    pub state: crate::model::session::State,
19167
19168    /// Output only. Session state details, such as the failure
19169    /// description if the state is `FAILED`.
19170    pub state_message: std::string::String,
19171
19172    /// Output only. The time when the session entered the current state.
19173    pub state_time: std::option::Option<wkt::Timestamp>,
19174
19175    /// Output only. The email address of the user who created the session.
19176    pub creator: std::string::String,
19177
19178    /// Optional. The labels to associate with the session.
19179    /// Label **keys** must contain 1 to 63 characters, and must conform to
19180    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
19181    /// Label **values** may be empty, but, if present, must contain 1 to 63
19182    /// characters, and must conform to [RFC
19183    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
19184    /// associated with a session.
19185    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
19186
19187    /// Optional. Runtime configuration for the session execution.
19188    pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
19189
19190    /// Optional. Environment configuration for the session execution.
19191    pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
19192
19193    /// Optional. The email address of the user who owns the session.
19194    pub user: std::string::String,
19195
19196    /// Output only. Historical state information for the session.
19197    pub state_history: std::vec::Vec<crate::model::session::SessionStateHistory>,
19198
19199    /// Optional. The session template used by the session.
19200    ///
19201    /// Only resource names, including project ID and location, are valid.
19202    ///
19203    /// Example:
19204    ///
19205    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
19206    /// * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
19207    ///
19208    /// The template must be in the same project and Dataproc region as the
19209    /// session.
19210    pub session_template: std::string::String,
19211
19212    /// The session configuration.
19213    pub session_config: std::option::Option<crate::model::session::SessionConfig>,
19214
19215    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19216}
19217
19218impl Session {
19219    /// Creates a new default instance.
19220    pub fn new() -> Self {
19221        std::default::Default::default()
19222    }
19223
19224    /// Sets the value of [name][crate::model::Session::name].
19225    ///
19226    /// # Example
19227    /// ```ignore,no_run
19228    /// # use google_cloud_dataproc_v1::model::Session;
19229    /// let x = Session::new().set_name("example");
19230    /// ```
19231    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19232        self.name = v.into();
19233        self
19234    }
19235
19236    /// Sets the value of [uuid][crate::model::Session::uuid].
19237    ///
19238    /// # Example
19239    /// ```ignore,no_run
19240    /// # use google_cloud_dataproc_v1::model::Session;
19241    /// let x = Session::new().set_uuid("example");
19242    /// ```
19243    pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19244        self.uuid = v.into();
19245        self
19246    }
19247
19248    /// Sets the value of [create_time][crate::model::Session::create_time].
19249    ///
19250    /// # Example
19251    /// ```ignore,no_run
19252    /// # use google_cloud_dataproc_v1::model::Session;
19253    /// use wkt::Timestamp;
19254    /// let x = Session::new().set_create_time(Timestamp::default()/* use setters */);
19255    /// ```
19256    pub fn set_create_time<T>(mut self, v: T) -> Self
19257    where
19258        T: std::convert::Into<wkt::Timestamp>,
19259    {
19260        self.create_time = std::option::Option::Some(v.into());
19261        self
19262    }
19263
19264    /// Sets or clears the value of [create_time][crate::model::Session::create_time].
19265    ///
19266    /// # Example
19267    /// ```ignore,no_run
19268    /// # use google_cloud_dataproc_v1::model::Session;
19269    /// use wkt::Timestamp;
19270    /// let x = Session::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19271    /// let x = Session::new().set_or_clear_create_time(None::<Timestamp>);
19272    /// ```
19273    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19274    where
19275        T: std::convert::Into<wkt::Timestamp>,
19276    {
19277        self.create_time = v.map(|x| x.into());
19278        self
19279    }
19280
19281    /// Sets the value of [runtime_info][crate::model::Session::runtime_info].
19282    ///
19283    /// # Example
19284    /// ```ignore,no_run
19285    /// # use google_cloud_dataproc_v1::model::Session;
19286    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
19287    /// let x = Session::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
19288    /// ```
19289    pub fn set_runtime_info<T>(mut self, v: T) -> Self
19290    where
19291        T: std::convert::Into<crate::model::RuntimeInfo>,
19292    {
19293        self.runtime_info = std::option::Option::Some(v.into());
19294        self
19295    }
19296
19297    /// Sets or clears the value of [runtime_info][crate::model::Session::runtime_info].
19298    ///
19299    /// # Example
19300    /// ```ignore,no_run
19301    /// # use google_cloud_dataproc_v1::model::Session;
19302    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
19303    /// let x = Session::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
19304    /// let x = Session::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
19305    /// ```
19306    pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
19307    where
19308        T: std::convert::Into<crate::model::RuntimeInfo>,
19309    {
19310        self.runtime_info = v.map(|x| x.into());
19311        self
19312    }
19313
19314    /// Sets the value of [state][crate::model::Session::state].
19315    ///
19316    /// # Example
19317    /// ```ignore,no_run
19318    /// # use google_cloud_dataproc_v1::model::Session;
19319    /// use google_cloud_dataproc_v1::model::session::State;
19320    /// let x0 = Session::new().set_state(State::Creating);
19321    /// let x1 = Session::new().set_state(State::Active);
19322    /// let x2 = Session::new().set_state(State::Terminating);
19323    /// ```
19324    pub fn set_state<T: std::convert::Into<crate::model::session::State>>(mut self, v: T) -> Self {
19325        self.state = v.into();
19326        self
19327    }
19328
19329    /// Sets the value of [state_message][crate::model::Session::state_message].
19330    ///
19331    /// # Example
19332    /// ```ignore,no_run
19333    /// # use google_cloud_dataproc_v1::model::Session;
19334    /// let x = Session::new().set_state_message("example");
19335    /// ```
19336    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19337        self.state_message = v.into();
19338        self
19339    }
19340
19341    /// Sets the value of [state_time][crate::model::Session::state_time].
19342    ///
19343    /// # Example
19344    /// ```ignore,no_run
19345    /// # use google_cloud_dataproc_v1::model::Session;
19346    /// use wkt::Timestamp;
19347    /// let x = Session::new().set_state_time(Timestamp::default()/* use setters */);
19348    /// ```
19349    pub fn set_state_time<T>(mut self, v: T) -> Self
19350    where
19351        T: std::convert::Into<wkt::Timestamp>,
19352    {
19353        self.state_time = std::option::Option::Some(v.into());
19354        self
19355    }
19356
19357    /// Sets or clears the value of [state_time][crate::model::Session::state_time].
19358    ///
19359    /// # Example
19360    /// ```ignore,no_run
19361    /// # use google_cloud_dataproc_v1::model::Session;
19362    /// use wkt::Timestamp;
19363    /// let x = Session::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
19364    /// let x = Session::new().set_or_clear_state_time(None::<Timestamp>);
19365    /// ```
19366    pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
19367    where
19368        T: std::convert::Into<wkt::Timestamp>,
19369    {
19370        self.state_time = v.map(|x| x.into());
19371        self
19372    }
19373
19374    /// Sets the value of [creator][crate::model::Session::creator].
19375    ///
19376    /// # Example
19377    /// ```ignore,no_run
19378    /// # use google_cloud_dataproc_v1::model::Session;
19379    /// let x = Session::new().set_creator("example");
19380    /// ```
19381    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19382        self.creator = v.into();
19383        self
19384    }
19385
19386    /// Sets the value of [labels][crate::model::Session::labels].
19387    ///
19388    /// # Example
19389    /// ```ignore,no_run
19390    /// # use google_cloud_dataproc_v1::model::Session;
19391    /// let x = Session::new().set_labels([
19392    ///     ("key0", "abc"),
19393    ///     ("key1", "xyz"),
19394    /// ]);
19395    /// ```
19396    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
19397    where
19398        T: std::iter::IntoIterator<Item = (K, V)>,
19399        K: std::convert::Into<std::string::String>,
19400        V: std::convert::Into<std::string::String>,
19401    {
19402        use std::iter::Iterator;
19403        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
19404        self
19405    }
19406
19407    /// Sets the value of [runtime_config][crate::model::Session::runtime_config].
19408    ///
19409    /// # Example
19410    /// ```ignore,no_run
19411    /// # use google_cloud_dataproc_v1::model::Session;
19412    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19413    /// let x = Session::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
19414    /// ```
19415    pub fn set_runtime_config<T>(mut self, v: T) -> Self
19416    where
19417        T: std::convert::Into<crate::model::RuntimeConfig>,
19418    {
19419        self.runtime_config = std::option::Option::Some(v.into());
19420        self
19421    }
19422
19423    /// Sets or clears the value of [runtime_config][crate::model::Session::runtime_config].
19424    ///
19425    /// # Example
19426    /// ```ignore,no_run
19427    /// # use google_cloud_dataproc_v1::model::Session;
19428    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19429    /// let x = Session::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
19430    /// let x = Session::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
19431    /// ```
19432    pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
19433    where
19434        T: std::convert::Into<crate::model::RuntimeConfig>,
19435    {
19436        self.runtime_config = v.map(|x| x.into());
19437        self
19438    }
19439
19440    /// Sets the value of [environment_config][crate::model::Session::environment_config].
19441    ///
19442    /// # Example
19443    /// ```ignore,no_run
19444    /// # use google_cloud_dataproc_v1::model::Session;
19445    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19446    /// let x = Session::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
19447    /// ```
19448    pub fn set_environment_config<T>(mut self, v: T) -> Self
19449    where
19450        T: std::convert::Into<crate::model::EnvironmentConfig>,
19451    {
19452        self.environment_config = std::option::Option::Some(v.into());
19453        self
19454    }
19455
19456    /// Sets or clears the value of [environment_config][crate::model::Session::environment_config].
19457    ///
19458    /// # Example
19459    /// ```ignore,no_run
19460    /// # use google_cloud_dataproc_v1::model::Session;
19461    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19462    /// let x = Session::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
19463    /// let x = Session::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
19464    /// ```
19465    pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
19466    where
19467        T: std::convert::Into<crate::model::EnvironmentConfig>,
19468    {
19469        self.environment_config = v.map(|x| x.into());
19470        self
19471    }
19472
19473    /// Sets the value of [user][crate::model::Session::user].
19474    ///
19475    /// # Example
19476    /// ```ignore,no_run
19477    /// # use google_cloud_dataproc_v1::model::Session;
19478    /// let x = Session::new().set_user("example");
19479    /// ```
19480    pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19481        self.user = v.into();
19482        self
19483    }
19484
19485    /// Sets the value of [state_history][crate::model::Session::state_history].
19486    ///
19487    /// # Example
19488    /// ```ignore,no_run
19489    /// # use google_cloud_dataproc_v1::model::Session;
19490    /// use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19491    /// let x = Session::new()
19492    ///     .set_state_history([
19493    ///         SessionStateHistory::default()/* use setters */,
19494    ///         SessionStateHistory::default()/* use (different) setters */,
19495    ///     ]);
19496    /// ```
19497    pub fn set_state_history<T, V>(mut self, v: T) -> Self
19498    where
19499        T: std::iter::IntoIterator<Item = V>,
19500        V: std::convert::Into<crate::model::session::SessionStateHistory>,
19501    {
19502        use std::iter::Iterator;
19503        self.state_history = v.into_iter().map(|i| i.into()).collect();
19504        self
19505    }
19506
19507    /// Sets the value of [session_template][crate::model::Session::session_template].
19508    ///
19509    /// # Example
19510    /// ```ignore,no_run
19511    /// # use google_cloud_dataproc_v1::model::Session;
19512    /// let x = Session::new().set_session_template("example");
19513    /// ```
19514    pub fn set_session_template<T: std::convert::Into<std::string::String>>(
19515        mut self,
19516        v: T,
19517    ) -> Self {
19518        self.session_template = v.into();
19519        self
19520    }
19521
19522    /// Sets the value of [session_config][crate::model::Session::session_config].
19523    ///
19524    /// Note that all the setters affecting `session_config` are mutually
19525    /// exclusive.
19526    ///
19527    /// # Example
19528    /// ```ignore,no_run
19529    /// # use google_cloud_dataproc_v1::model::Session;
19530    /// use google_cloud_dataproc_v1::model::JupyterConfig;
19531    /// let x = Session::new().set_session_config(Some(
19532    ///     google_cloud_dataproc_v1::model::session::SessionConfig::JupyterSession(JupyterConfig::default().into())));
19533    /// ```
19534    pub fn set_session_config<
19535        T: std::convert::Into<std::option::Option<crate::model::session::SessionConfig>>,
19536    >(
19537        mut self,
19538        v: T,
19539    ) -> Self {
19540        self.session_config = v.into();
19541        self
19542    }
19543
19544    /// The value of [session_config][crate::model::Session::session_config]
19545    /// if it holds a `JupyterSession`, `None` if the field is not set or
19546    /// holds a different branch.
19547    pub fn jupyter_session(
19548        &self,
19549    ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
19550        #[allow(unreachable_patterns)]
19551        self.session_config.as_ref().and_then(|v| match v {
19552            crate::model::session::SessionConfig::JupyterSession(v) => std::option::Option::Some(v),
19553            _ => std::option::Option::None,
19554        })
19555    }
19556
19557    /// Sets the value of [session_config][crate::model::Session::session_config]
19558    /// to hold a `JupyterSession`.
19559    ///
19560    /// Note that all the setters affecting `session_config` are
19561    /// mutually exclusive.
19562    ///
19563    /// # Example
19564    /// ```ignore,no_run
19565    /// # use google_cloud_dataproc_v1::model::Session;
19566    /// use google_cloud_dataproc_v1::model::JupyterConfig;
19567    /// let x = Session::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
19568    /// assert!(x.jupyter_session().is_some());
19569    /// assert!(x.spark_connect_session().is_none());
19570    /// ```
19571    pub fn set_jupyter_session<
19572        T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
19573    >(
19574        mut self,
19575        v: T,
19576    ) -> Self {
19577        self.session_config = std::option::Option::Some(
19578            crate::model::session::SessionConfig::JupyterSession(v.into()),
19579        );
19580        self
19581    }
19582
19583    /// The value of [session_config][crate::model::Session::session_config]
19584    /// if it holds a `SparkConnectSession`, `None` if the field is not set or
19585    /// holds a different branch.
19586    pub fn spark_connect_session(
19587        &self,
19588    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
19589        #[allow(unreachable_patterns)]
19590        self.session_config.as_ref().and_then(|v| match v {
19591            crate::model::session::SessionConfig::SparkConnectSession(v) => {
19592                std::option::Option::Some(v)
19593            }
19594            _ => std::option::Option::None,
19595        })
19596    }
19597
19598    /// Sets the value of [session_config][crate::model::Session::session_config]
19599    /// to hold a `SparkConnectSession`.
19600    ///
19601    /// Note that all the setters affecting `session_config` are
19602    /// mutually exclusive.
19603    ///
19604    /// # Example
19605    /// ```ignore,no_run
19606    /// # use google_cloud_dataproc_v1::model::Session;
19607    /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
19608    /// let x = Session::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
19609    /// assert!(x.spark_connect_session().is_some());
19610    /// assert!(x.jupyter_session().is_none());
19611    /// ```
19612    pub fn set_spark_connect_session<
19613        T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
19614    >(
19615        mut self,
19616        v: T,
19617    ) -> Self {
19618        self.session_config = std::option::Option::Some(
19619            crate::model::session::SessionConfig::SparkConnectSession(v.into()),
19620        );
19621        self
19622    }
19623}
19624
19625impl wkt::message::Message for Session {
19626    fn typename() -> &'static str {
19627        "type.googleapis.com/google.cloud.dataproc.v1.Session"
19628    }
19629}
19630
19631/// Defines additional types related to [Session].
19632pub mod session {
19633    #[allow(unused_imports)]
19634    use super::*;
19635
19636    /// Historical state information.
19637    #[derive(Clone, Default, PartialEq)]
19638    #[non_exhaustive]
19639    pub struct SessionStateHistory {
19640        /// Output only. The state of the session at this point in the session
19641        /// history.
19642        pub state: crate::model::session::State,
19643
19644        /// Output only. Details about the state at this point in the session
19645        /// history.
19646        pub state_message: std::string::String,
19647
19648        /// Output only. The time when the session entered the historical state.
19649        pub state_start_time: std::option::Option<wkt::Timestamp>,
19650
19651        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19652    }
19653
19654    impl SessionStateHistory {
19655        /// Creates a new default instance.
19656        pub fn new() -> Self {
19657            std::default::Default::default()
19658        }
19659
19660        /// Sets the value of [state][crate::model::session::SessionStateHistory::state].
19661        ///
19662        /// # Example
19663        /// ```ignore,no_run
19664        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19665        /// use google_cloud_dataproc_v1::model::session::State;
19666        /// let x0 = SessionStateHistory::new().set_state(State::Creating);
19667        /// let x1 = SessionStateHistory::new().set_state(State::Active);
19668        /// let x2 = SessionStateHistory::new().set_state(State::Terminating);
19669        /// ```
19670        pub fn set_state<T: std::convert::Into<crate::model::session::State>>(
19671            mut self,
19672            v: T,
19673        ) -> Self {
19674            self.state = v.into();
19675            self
19676        }
19677
19678        /// Sets the value of [state_message][crate::model::session::SessionStateHistory::state_message].
19679        ///
19680        /// # Example
19681        /// ```ignore,no_run
19682        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19683        /// let x = SessionStateHistory::new().set_state_message("example");
19684        /// ```
19685        pub fn set_state_message<T: std::convert::Into<std::string::String>>(
19686            mut self,
19687            v: T,
19688        ) -> Self {
19689            self.state_message = v.into();
19690            self
19691        }
19692
19693        /// Sets the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
19694        ///
19695        /// # Example
19696        /// ```ignore,no_run
19697        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19698        /// use wkt::Timestamp;
19699        /// let x = SessionStateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
19700        /// ```
19701        pub fn set_state_start_time<T>(mut self, v: T) -> Self
19702        where
19703            T: std::convert::Into<wkt::Timestamp>,
19704        {
19705            self.state_start_time = std::option::Option::Some(v.into());
19706            self
19707        }
19708
19709        /// Sets or clears the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
19710        ///
19711        /// # Example
19712        /// ```ignore,no_run
19713        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19714        /// use wkt::Timestamp;
19715        /// let x = SessionStateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
19716        /// let x = SessionStateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
19717        /// ```
19718        pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
19719        where
19720            T: std::convert::Into<wkt::Timestamp>,
19721        {
19722            self.state_start_time = v.map(|x| x.into());
19723            self
19724        }
19725    }
19726
19727    impl wkt::message::Message for SessionStateHistory {
19728        fn typename() -> &'static str {
19729            "type.googleapis.com/google.cloud.dataproc.v1.Session.SessionStateHistory"
19730        }
19731    }
19732
19733    /// The session state.
19734    ///
19735    /// # Working with unknown values
19736    ///
19737    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19738    /// additional enum variants at any time. Adding new variants is not considered
19739    /// a breaking change. Applications should write their code in anticipation of:
19740    ///
19741    /// - New values appearing in future releases of the client library, **and**
19742    /// - New values received dynamically, without application changes.
19743    ///
19744    /// Please consult the [Working with enums] section in the user guide for some
19745    /// guidelines.
19746    ///
19747    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19748    #[derive(Clone, Debug, PartialEq)]
19749    #[non_exhaustive]
19750    pub enum State {
19751        /// The session state is unknown.
19752        Unspecified,
19753        /// The session is created prior to running.
19754        Creating,
19755        /// The session is running.
19756        Active,
19757        /// The session is terminating.
19758        Terminating,
19759        /// The session is terminated successfully.
19760        Terminated,
19761        /// The session is no longer running due to an error.
19762        Failed,
19763        /// If set, the enum was initialized with an unknown value.
19764        ///
19765        /// Applications can examine the value using [State::value] or
19766        /// [State::name].
19767        UnknownValue(state::UnknownValue),
19768    }
19769
19770    #[doc(hidden)]
19771    pub mod state {
19772        #[allow(unused_imports)]
19773        use super::*;
19774        #[derive(Clone, Debug, PartialEq)]
19775        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19776    }
19777
19778    impl State {
19779        /// Gets the enum value.
19780        ///
19781        /// Returns `None` if the enum contains an unknown value deserialized from
19782        /// the string representation of enums.
19783        pub fn value(&self) -> std::option::Option<i32> {
19784            match self {
19785                Self::Unspecified => std::option::Option::Some(0),
19786                Self::Creating => std::option::Option::Some(1),
19787                Self::Active => std::option::Option::Some(2),
19788                Self::Terminating => std::option::Option::Some(3),
19789                Self::Terminated => std::option::Option::Some(4),
19790                Self::Failed => std::option::Option::Some(5),
19791                Self::UnknownValue(u) => u.0.value(),
19792            }
19793        }
19794
19795        /// Gets the enum value as a string.
19796        ///
19797        /// Returns `None` if the enum contains an unknown value deserialized from
19798        /// the integer representation of enums.
19799        pub fn name(&self) -> std::option::Option<&str> {
19800            match self {
19801                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19802                Self::Creating => std::option::Option::Some("CREATING"),
19803                Self::Active => std::option::Option::Some("ACTIVE"),
19804                Self::Terminating => std::option::Option::Some("TERMINATING"),
19805                Self::Terminated => std::option::Option::Some("TERMINATED"),
19806                Self::Failed => std::option::Option::Some("FAILED"),
19807                Self::UnknownValue(u) => u.0.name(),
19808            }
19809        }
19810    }
19811
19812    impl std::default::Default for State {
19813        fn default() -> Self {
19814            use std::convert::From;
19815            Self::from(0)
19816        }
19817    }
19818
19819    impl std::fmt::Display for State {
19820        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19821            wkt::internal::display_enum(f, self.name(), self.value())
19822        }
19823    }
19824
19825    impl std::convert::From<i32> for State {
19826        fn from(value: i32) -> Self {
19827            match value {
19828                0 => Self::Unspecified,
19829                1 => Self::Creating,
19830                2 => Self::Active,
19831                3 => Self::Terminating,
19832                4 => Self::Terminated,
19833                5 => Self::Failed,
19834                _ => Self::UnknownValue(state::UnknownValue(
19835                    wkt::internal::UnknownEnumValue::Integer(value),
19836                )),
19837            }
19838        }
19839    }
19840
19841    impl std::convert::From<&str> for State {
19842        fn from(value: &str) -> Self {
19843            use std::string::ToString;
19844            match value {
19845                "STATE_UNSPECIFIED" => Self::Unspecified,
19846                "CREATING" => Self::Creating,
19847                "ACTIVE" => Self::Active,
19848                "TERMINATING" => Self::Terminating,
19849                "TERMINATED" => Self::Terminated,
19850                "FAILED" => Self::Failed,
19851                _ => Self::UnknownValue(state::UnknownValue(
19852                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19853                )),
19854            }
19855        }
19856    }
19857
19858    impl serde::ser::Serialize for State {
19859        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19860        where
19861            S: serde::Serializer,
19862        {
19863            match self {
19864                Self::Unspecified => serializer.serialize_i32(0),
19865                Self::Creating => serializer.serialize_i32(1),
19866                Self::Active => serializer.serialize_i32(2),
19867                Self::Terminating => serializer.serialize_i32(3),
19868                Self::Terminated => serializer.serialize_i32(4),
19869                Self::Failed => serializer.serialize_i32(5),
19870                Self::UnknownValue(u) => u.0.serialize(serializer),
19871            }
19872        }
19873    }
19874
19875    impl<'de> serde::de::Deserialize<'de> for State {
19876        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19877        where
19878            D: serde::Deserializer<'de>,
19879        {
19880            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19881                ".google.cloud.dataproc.v1.Session.State",
19882            ))
19883        }
19884    }
19885
19886    /// The session configuration.
19887    #[derive(Clone, Debug, PartialEq)]
19888    #[non_exhaustive]
19889    pub enum SessionConfig {
19890        /// Optional. Jupyter session config.
19891        JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
19892        /// Optional. Spark Connect session config.
19893        SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
19894    }
19895}
19896
19897/// Jupyter configuration for an interactive session.
19898#[derive(Clone, Default, PartialEq)]
19899#[non_exhaustive]
19900pub struct JupyterConfig {
19901    /// Optional. Kernel
19902    pub kernel: crate::model::jupyter_config::Kernel,
19903
19904    /// Optional. Display name, shown in the Jupyter kernelspec card.
19905    pub display_name: std::string::String,
19906
19907    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19908}
19909
19910impl JupyterConfig {
19911    /// Creates a new default instance.
19912    pub fn new() -> Self {
19913        std::default::Default::default()
19914    }
19915
19916    /// Sets the value of [kernel][crate::model::JupyterConfig::kernel].
19917    ///
19918    /// # Example
19919    /// ```ignore,no_run
19920    /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19921    /// use google_cloud_dataproc_v1::model::jupyter_config::Kernel;
19922    /// let x0 = JupyterConfig::new().set_kernel(Kernel::Python);
19923    /// let x1 = JupyterConfig::new().set_kernel(Kernel::Scala);
19924    /// ```
19925    pub fn set_kernel<T: std::convert::Into<crate::model::jupyter_config::Kernel>>(
19926        mut self,
19927        v: T,
19928    ) -> Self {
19929        self.kernel = v.into();
19930        self
19931    }
19932
19933    /// Sets the value of [display_name][crate::model::JupyterConfig::display_name].
19934    ///
19935    /// # Example
19936    /// ```ignore,no_run
19937    /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19938    /// let x = JupyterConfig::new().set_display_name("example");
19939    /// ```
19940    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19941        self.display_name = v.into();
19942        self
19943    }
19944}
19945
19946impl wkt::message::Message for JupyterConfig {
19947    fn typename() -> &'static str {
19948        "type.googleapis.com/google.cloud.dataproc.v1.JupyterConfig"
19949    }
19950}
19951
19952/// Defines additional types related to [JupyterConfig].
19953pub mod jupyter_config {
19954    #[allow(unused_imports)]
19955    use super::*;
19956
19957    /// Jupyter kernel types.
19958    ///
19959    /// # Working with unknown values
19960    ///
19961    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19962    /// additional enum variants at any time. Adding new variants is not considered
19963    /// a breaking change. Applications should write their code in anticipation of:
19964    ///
19965    /// - New values appearing in future releases of the client library, **and**
19966    /// - New values received dynamically, without application changes.
19967    ///
19968    /// Please consult the [Working with enums] section in the user guide for some
19969    /// guidelines.
19970    ///
19971    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19972    #[derive(Clone, Debug, PartialEq)]
19973    #[non_exhaustive]
19974    pub enum Kernel {
19975        /// The kernel is unknown.
19976        Unspecified,
19977        /// Python kernel.
19978        Python,
19979        /// Scala kernel.
19980        Scala,
19981        /// If set, the enum was initialized with an unknown value.
19982        ///
19983        /// Applications can examine the value using [Kernel::value] or
19984        /// [Kernel::name].
19985        UnknownValue(kernel::UnknownValue),
19986    }
19987
19988    #[doc(hidden)]
19989    pub mod kernel {
19990        #[allow(unused_imports)]
19991        use super::*;
19992        #[derive(Clone, Debug, PartialEq)]
19993        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19994    }
19995
19996    impl Kernel {
19997        /// Gets the enum value.
19998        ///
19999        /// Returns `None` if the enum contains an unknown value deserialized from
20000        /// the string representation of enums.
20001        pub fn value(&self) -> std::option::Option<i32> {
20002            match self {
20003                Self::Unspecified => std::option::Option::Some(0),
20004                Self::Python => std::option::Option::Some(1),
20005                Self::Scala => std::option::Option::Some(2),
20006                Self::UnknownValue(u) => u.0.value(),
20007            }
20008        }
20009
20010        /// Gets the enum value as a string.
20011        ///
20012        /// Returns `None` if the enum contains an unknown value deserialized from
20013        /// the integer representation of enums.
20014        pub fn name(&self) -> std::option::Option<&str> {
20015            match self {
20016                Self::Unspecified => std::option::Option::Some("KERNEL_UNSPECIFIED"),
20017                Self::Python => std::option::Option::Some("PYTHON"),
20018                Self::Scala => std::option::Option::Some("SCALA"),
20019                Self::UnknownValue(u) => u.0.name(),
20020            }
20021        }
20022    }
20023
20024    impl std::default::Default for Kernel {
20025        fn default() -> Self {
20026            use std::convert::From;
20027            Self::from(0)
20028        }
20029    }
20030
20031    impl std::fmt::Display for Kernel {
20032        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20033            wkt::internal::display_enum(f, self.name(), self.value())
20034        }
20035    }
20036
20037    impl std::convert::From<i32> for Kernel {
20038        fn from(value: i32) -> Self {
20039            match value {
20040                0 => Self::Unspecified,
20041                1 => Self::Python,
20042                2 => Self::Scala,
20043                _ => Self::UnknownValue(kernel::UnknownValue(
20044                    wkt::internal::UnknownEnumValue::Integer(value),
20045                )),
20046            }
20047        }
20048    }
20049
20050    impl std::convert::From<&str> for Kernel {
20051        fn from(value: &str) -> Self {
20052            use std::string::ToString;
20053            match value {
20054                "KERNEL_UNSPECIFIED" => Self::Unspecified,
20055                "PYTHON" => Self::Python,
20056                "SCALA" => Self::Scala,
20057                _ => Self::UnknownValue(kernel::UnknownValue(
20058                    wkt::internal::UnknownEnumValue::String(value.to_string()),
20059                )),
20060            }
20061        }
20062    }
20063
20064    impl serde::ser::Serialize for Kernel {
20065        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20066        where
20067            S: serde::Serializer,
20068        {
20069            match self {
20070                Self::Unspecified => serializer.serialize_i32(0),
20071                Self::Python => serializer.serialize_i32(1),
20072                Self::Scala => serializer.serialize_i32(2),
20073                Self::UnknownValue(u) => u.0.serialize(serializer),
20074            }
20075        }
20076    }
20077
20078    impl<'de> serde::de::Deserialize<'de> for Kernel {
20079        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20080        where
20081            D: serde::Deserializer<'de>,
20082        {
20083            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kernel>::new(
20084                ".google.cloud.dataproc.v1.JupyterConfig.Kernel",
20085            ))
20086        }
20087    }
20088}
20089
20090/// Spark Connect configuration for an interactive session.
20091#[derive(Clone, Default, PartialEq)]
20092#[non_exhaustive]
20093pub struct SparkConnectConfig {
20094    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20095}
20096
20097impl SparkConnectConfig {
20098    /// Creates a new default instance.
20099    pub fn new() -> Self {
20100        std::default::Default::default()
20101    }
20102}
20103
20104impl wkt::message::Message for SparkConnectConfig {
20105    fn typename() -> &'static str {
20106        "type.googleapis.com/google.cloud.dataproc.v1.SparkConnectConfig"
20107    }
20108}
20109
20110/// Runtime configuration for a workload.
20111#[derive(Clone, Default, PartialEq)]
20112#[non_exhaustive]
20113pub struct RuntimeConfig {
20114    /// Optional. Version of the batch runtime.
20115    pub version: std::string::String,
20116
20117    /// Optional. Optional custom container image for the job runtime environment.
20118    /// If not specified, a default container image will be used.
20119    pub container_image: std::string::String,
20120
20121    /// Optional. A mapping of property names to values, which are used to
20122    /// configure workload execution.
20123    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
20124
20125    /// Optional. Dependency repository configuration.
20126    pub repository_config: std::option::Option<crate::model::RepositoryConfig>,
20127
20128    /// Optional. Autotuning configuration of the workload.
20129    pub autotuning_config: std::option::Option<crate::model::AutotuningConfig>,
20130
20131    /// Optional. Cohort identifier. Identifies families of the workloads having
20132    /// the same shape, e.g. daily ETL jobs.
20133    pub cohort: std::string::String,
20134
20135    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20136}
20137
20138impl RuntimeConfig {
20139    /// Creates a new default instance.
20140    pub fn new() -> Self {
20141        std::default::Default::default()
20142    }
20143
20144    /// Sets the value of [version][crate::model::RuntimeConfig::version].
20145    ///
20146    /// # Example
20147    /// ```ignore,no_run
20148    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20149    /// let x = RuntimeConfig::new().set_version("example");
20150    /// ```
20151    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20152        self.version = v.into();
20153        self
20154    }
20155
20156    /// Sets the value of [container_image][crate::model::RuntimeConfig::container_image].
20157    ///
20158    /// # Example
20159    /// ```ignore,no_run
20160    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20161    /// let x = RuntimeConfig::new().set_container_image("example");
20162    /// ```
20163    pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20164        self.container_image = v.into();
20165        self
20166    }
20167
20168    /// Sets the value of [properties][crate::model::RuntimeConfig::properties].
20169    ///
20170    /// # Example
20171    /// ```ignore,no_run
20172    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20173    /// let x = RuntimeConfig::new().set_properties([
20174    ///     ("key0", "abc"),
20175    ///     ("key1", "xyz"),
20176    /// ]);
20177    /// ```
20178    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
20179    where
20180        T: std::iter::IntoIterator<Item = (K, V)>,
20181        K: std::convert::Into<std::string::String>,
20182        V: std::convert::Into<std::string::String>,
20183    {
20184        use std::iter::Iterator;
20185        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20186        self
20187    }
20188
20189    /// Sets the value of [repository_config][crate::model::RuntimeConfig::repository_config].
20190    ///
20191    /// # Example
20192    /// ```ignore,no_run
20193    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20194    /// use google_cloud_dataproc_v1::model::RepositoryConfig;
20195    /// let x = RuntimeConfig::new().set_repository_config(RepositoryConfig::default()/* use setters */);
20196    /// ```
20197    pub fn set_repository_config<T>(mut self, v: T) -> Self
20198    where
20199        T: std::convert::Into<crate::model::RepositoryConfig>,
20200    {
20201        self.repository_config = std::option::Option::Some(v.into());
20202        self
20203    }
20204
20205    /// Sets or clears the value of [repository_config][crate::model::RuntimeConfig::repository_config].
20206    ///
20207    /// # Example
20208    /// ```ignore,no_run
20209    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20210    /// use google_cloud_dataproc_v1::model::RepositoryConfig;
20211    /// let x = RuntimeConfig::new().set_or_clear_repository_config(Some(RepositoryConfig::default()/* use setters */));
20212    /// let x = RuntimeConfig::new().set_or_clear_repository_config(None::<RepositoryConfig>);
20213    /// ```
20214    pub fn set_or_clear_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
20215    where
20216        T: std::convert::Into<crate::model::RepositoryConfig>,
20217    {
20218        self.repository_config = v.map(|x| x.into());
20219        self
20220    }
20221
20222    /// Sets the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
20223    ///
20224    /// # Example
20225    /// ```ignore,no_run
20226    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20227    /// use google_cloud_dataproc_v1::model::AutotuningConfig;
20228    /// let x = RuntimeConfig::new().set_autotuning_config(AutotuningConfig::default()/* use setters */);
20229    /// ```
20230    pub fn set_autotuning_config<T>(mut self, v: T) -> Self
20231    where
20232        T: std::convert::Into<crate::model::AutotuningConfig>,
20233    {
20234        self.autotuning_config = std::option::Option::Some(v.into());
20235        self
20236    }
20237
20238    /// Sets or clears the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
20239    ///
20240    /// # Example
20241    /// ```ignore,no_run
20242    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20243    /// use google_cloud_dataproc_v1::model::AutotuningConfig;
20244    /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(Some(AutotuningConfig::default()/* use setters */));
20245    /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(None::<AutotuningConfig>);
20246    /// ```
20247    pub fn set_or_clear_autotuning_config<T>(mut self, v: std::option::Option<T>) -> Self
20248    where
20249        T: std::convert::Into<crate::model::AutotuningConfig>,
20250    {
20251        self.autotuning_config = v.map(|x| x.into());
20252        self
20253    }
20254
20255    /// Sets the value of [cohort][crate::model::RuntimeConfig::cohort].
20256    ///
20257    /// # Example
20258    /// ```ignore,no_run
20259    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20260    /// let x = RuntimeConfig::new().set_cohort("example");
20261    /// ```
20262    pub fn set_cohort<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20263        self.cohort = v.into();
20264        self
20265    }
20266}
20267
20268impl wkt::message::Message for RuntimeConfig {
20269    fn typename() -> &'static str {
20270        "type.googleapis.com/google.cloud.dataproc.v1.RuntimeConfig"
20271    }
20272}
20273
20274/// Environment configuration for a workload.
20275#[derive(Clone, Default, PartialEq)]
20276#[non_exhaustive]
20277pub struct EnvironmentConfig {
20278    /// Optional. Execution configuration for a workload.
20279    pub execution_config: std::option::Option<crate::model::ExecutionConfig>,
20280
20281    /// Optional. Peripherals configuration that workload has access to.
20282    pub peripherals_config: std::option::Option<crate::model::PeripheralsConfig>,
20283
20284    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20285}
20286
20287impl EnvironmentConfig {
20288    /// Creates a new default instance.
20289    pub fn new() -> Self {
20290        std::default::Default::default()
20291    }
20292
20293    /// Sets the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
20294    ///
20295    /// # Example
20296    /// ```ignore,no_run
20297    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20298    /// use google_cloud_dataproc_v1::model::ExecutionConfig;
20299    /// let x = EnvironmentConfig::new().set_execution_config(ExecutionConfig::default()/* use setters */);
20300    /// ```
20301    pub fn set_execution_config<T>(mut self, v: T) -> Self
20302    where
20303        T: std::convert::Into<crate::model::ExecutionConfig>,
20304    {
20305        self.execution_config = std::option::Option::Some(v.into());
20306        self
20307    }
20308
20309    /// Sets or clears the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
20310    ///
20311    /// # Example
20312    /// ```ignore,no_run
20313    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20314    /// use google_cloud_dataproc_v1::model::ExecutionConfig;
20315    /// let x = EnvironmentConfig::new().set_or_clear_execution_config(Some(ExecutionConfig::default()/* use setters */));
20316    /// let x = EnvironmentConfig::new().set_or_clear_execution_config(None::<ExecutionConfig>);
20317    /// ```
20318    pub fn set_or_clear_execution_config<T>(mut self, v: std::option::Option<T>) -> Self
20319    where
20320        T: std::convert::Into<crate::model::ExecutionConfig>,
20321    {
20322        self.execution_config = v.map(|x| x.into());
20323        self
20324    }
20325
20326    /// Sets the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
20327    ///
20328    /// # Example
20329    /// ```ignore,no_run
20330    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20331    /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
20332    /// let x = EnvironmentConfig::new().set_peripherals_config(PeripheralsConfig::default()/* use setters */);
20333    /// ```
20334    pub fn set_peripherals_config<T>(mut self, v: T) -> Self
20335    where
20336        T: std::convert::Into<crate::model::PeripheralsConfig>,
20337    {
20338        self.peripherals_config = std::option::Option::Some(v.into());
20339        self
20340    }
20341
20342    /// Sets or clears the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
20343    ///
20344    /// # Example
20345    /// ```ignore,no_run
20346    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20347    /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
20348    /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(Some(PeripheralsConfig::default()/* use setters */));
20349    /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(None::<PeripheralsConfig>);
20350    /// ```
20351    pub fn set_or_clear_peripherals_config<T>(mut self, v: std::option::Option<T>) -> Self
20352    where
20353        T: std::convert::Into<crate::model::PeripheralsConfig>,
20354    {
20355        self.peripherals_config = v.map(|x| x.into());
20356        self
20357    }
20358}
20359
20360impl wkt::message::Message for EnvironmentConfig {
20361    fn typename() -> &'static str {
20362        "type.googleapis.com/google.cloud.dataproc.v1.EnvironmentConfig"
20363    }
20364}
20365
20366/// Execution configuration for a workload.
20367#[derive(Clone, Default, PartialEq)]
20368#[non_exhaustive]
20369pub struct ExecutionConfig {
20370    /// Optional. Service account that used to execute workload.
20371    pub service_account: std::string::String,
20372
20373    /// Optional. Tags used for network traffic control.
20374    pub network_tags: std::vec::Vec<std::string::String>,
20375
20376    /// Optional. The Cloud KMS key to use for encryption.
20377    pub kms_key: std::string::String,
20378
20379    /// Optional. Applies to sessions only. The duration to keep the session alive
20380    /// while it's idling. Exceeding this threshold causes the session to
20381    /// terminate. This field cannot be set on a batch workload. Minimum value is
20382    /// 10 minutes; maximum value is 14 days (see JSON representation of
20383    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
20384    /// Defaults to 1 hour if not set.
20385    /// If both `ttl` and `idle_ttl` are specified for an interactive session,
20386    /// the conditions are treated as `OR` conditions: the workload will be
20387    /// terminated when it has been idle for `idle_ttl` or when `ttl` has been
20388    /// exceeded, whichever occurs first.
20389    pub idle_ttl: std::option::Option<wkt::Duration>,
20390
20391    /// Optional. The duration after which the workload will be terminated,
20392    /// specified as the JSON representation for
20393    /// [Duration](https://protobuf.dev/programming-guides/proto3/#json).
20394    /// When the workload exceeds this duration, it will be unconditionally
20395    /// terminated without waiting for ongoing work to finish. If `ttl` is not
20396    /// specified for a batch workload, the workload will be allowed to run until
20397    /// it exits naturally (or run forever without exiting). If `ttl` is not
20398    /// specified for an interactive session, it defaults to 24 hours. If `ttl` is
20399    /// not specified for a batch that uses 2.1+ runtime version, it defaults to 4
20400    /// hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl`
20401    /// and `idle_ttl` are specified (for an interactive session), the conditions
20402    /// are treated as `OR` conditions: the workload will be terminated when it has
20403    /// been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs
20404    /// first.
20405    pub ttl: std::option::Option<wkt::Duration>,
20406
20407    /// Optional. A Cloud Storage bucket used to stage workload dependencies,
20408    /// config files, and store workload output and other ephemeral data, such as
20409    /// Spark history files. If you do not specify a staging bucket, Cloud Dataproc
20410    /// will determine a Cloud Storage location according to the region where your
20411    /// workload is running, and then create and manage project-level, per-location
20412    /// staging and temporary buckets.
20413    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
20414    /// a Cloud Storage bucket.**
20415    pub staging_bucket: std::string::String,
20416
20417    /// Optional. Authentication configuration used to set the default identity for
20418    /// the workload execution. The config specifies the type of identity
20419    /// (service account or user) that will be used by workloads to access
20420    /// resources on the project(s).
20421    pub authentication_config: std::option::Option<crate::model::AuthenticationConfig>,
20422
20423    /// Network configuration for workload execution.
20424    pub network: std::option::Option<crate::model::execution_config::Network>,
20425
20426    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20427}
20428
20429impl ExecutionConfig {
20430    /// Creates a new default instance.
20431    pub fn new() -> Self {
20432        std::default::Default::default()
20433    }
20434
20435    /// Sets the value of [service_account][crate::model::ExecutionConfig::service_account].
20436    ///
20437    /// # Example
20438    /// ```ignore,no_run
20439    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20440    /// let x = ExecutionConfig::new().set_service_account("example");
20441    /// ```
20442    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20443        self.service_account = v.into();
20444        self
20445    }
20446
20447    /// Sets the value of [network_tags][crate::model::ExecutionConfig::network_tags].
20448    ///
20449    /// # Example
20450    /// ```ignore,no_run
20451    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20452    /// let x = ExecutionConfig::new().set_network_tags(["a", "b", "c"]);
20453    /// ```
20454    pub fn set_network_tags<T, V>(mut self, v: T) -> Self
20455    where
20456        T: std::iter::IntoIterator<Item = V>,
20457        V: std::convert::Into<std::string::String>,
20458    {
20459        use std::iter::Iterator;
20460        self.network_tags = v.into_iter().map(|i| i.into()).collect();
20461        self
20462    }
20463
20464    /// Sets the value of [kms_key][crate::model::ExecutionConfig::kms_key].
20465    ///
20466    /// # Example
20467    /// ```ignore,no_run
20468    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20469    /// let x = ExecutionConfig::new().set_kms_key("example");
20470    /// ```
20471    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20472        self.kms_key = v.into();
20473        self
20474    }
20475
20476    /// Sets the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20477    ///
20478    /// # Example
20479    /// ```ignore,no_run
20480    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20481    /// use wkt::Duration;
20482    /// let x = ExecutionConfig::new().set_idle_ttl(Duration::default()/* use setters */);
20483    /// ```
20484    pub fn set_idle_ttl<T>(mut self, v: T) -> Self
20485    where
20486        T: std::convert::Into<wkt::Duration>,
20487    {
20488        self.idle_ttl = std::option::Option::Some(v.into());
20489        self
20490    }
20491
20492    /// Sets or clears the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20493    ///
20494    /// # Example
20495    /// ```ignore,no_run
20496    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20497    /// use wkt::Duration;
20498    /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(Some(Duration::default()/* use setters */));
20499    /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(None::<Duration>);
20500    /// ```
20501    pub fn set_or_clear_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20502    where
20503        T: std::convert::Into<wkt::Duration>,
20504    {
20505        self.idle_ttl = v.map(|x| x.into());
20506        self
20507    }
20508
20509    /// Sets the value of [ttl][crate::model::ExecutionConfig::ttl].
20510    ///
20511    /// # Example
20512    /// ```ignore,no_run
20513    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20514    /// use wkt::Duration;
20515    /// let x = ExecutionConfig::new().set_ttl(Duration::default()/* use setters */);
20516    /// ```
20517    pub fn set_ttl<T>(mut self, v: T) -> Self
20518    where
20519        T: std::convert::Into<wkt::Duration>,
20520    {
20521        self.ttl = std::option::Option::Some(v.into());
20522        self
20523    }
20524
20525    /// Sets or clears the value of [ttl][crate::model::ExecutionConfig::ttl].
20526    ///
20527    /// # Example
20528    /// ```ignore,no_run
20529    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20530    /// use wkt::Duration;
20531    /// let x = ExecutionConfig::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
20532    /// let x = ExecutionConfig::new().set_or_clear_ttl(None::<Duration>);
20533    /// ```
20534    pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20535    where
20536        T: std::convert::Into<wkt::Duration>,
20537    {
20538        self.ttl = v.map(|x| x.into());
20539        self
20540    }
20541
20542    /// Sets the value of [staging_bucket][crate::model::ExecutionConfig::staging_bucket].
20543    ///
20544    /// # Example
20545    /// ```ignore,no_run
20546    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20547    /// let x = ExecutionConfig::new().set_staging_bucket("example");
20548    /// ```
20549    pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20550        self.staging_bucket = v.into();
20551        self
20552    }
20553
20554    /// Sets the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20555    ///
20556    /// # Example
20557    /// ```ignore,no_run
20558    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20559    /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20560    /// let x = ExecutionConfig::new().set_authentication_config(AuthenticationConfig::default()/* use setters */);
20561    /// ```
20562    pub fn set_authentication_config<T>(mut self, v: T) -> Self
20563    where
20564        T: std::convert::Into<crate::model::AuthenticationConfig>,
20565    {
20566        self.authentication_config = std::option::Option::Some(v.into());
20567        self
20568    }
20569
20570    /// Sets or clears the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20571    ///
20572    /// # Example
20573    /// ```ignore,no_run
20574    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20575    /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20576    /// let x = ExecutionConfig::new().set_or_clear_authentication_config(Some(AuthenticationConfig::default()/* use setters */));
20577    /// let x = ExecutionConfig::new().set_or_clear_authentication_config(None::<AuthenticationConfig>);
20578    /// ```
20579    pub fn set_or_clear_authentication_config<T>(mut self, v: std::option::Option<T>) -> Self
20580    where
20581        T: std::convert::Into<crate::model::AuthenticationConfig>,
20582    {
20583        self.authentication_config = v.map(|x| x.into());
20584        self
20585    }
20586
20587    /// Sets the value of [network][crate::model::ExecutionConfig::network].
20588    ///
20589    /// Note that all the setters affecting `network` are mutually
20590    /// exclusive.
20591    ///
20592    /// # Example
20593    /// ```ignore,no_run
20594    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20595    /// use google_cloud_dataproc_v1::model::execution_config::Network;
20596    /// let x = ExecutionConfig::new().set_network(Some(Network::NetworkUri("example".to_string())));
20597    /// ```
20598    pub fn set_network<
20599        T: std::convert::Into<std::option::Option<crate::model::execution_config::Network>>,
20600    >(
20601        mut self,
20602        v: T,
20603    ) -> Self {
20604        self.network = v.into();
20605        self
20606    }
20607
20608    /// The value of [network][crate::model::ExecutionConfig::network]
20609    /// if it holds a `NetworkUri`, `None` if the field is not set or
20610    /// holds a different branch.
20611    pub fn network_uri(&self) -> std::option::Option<&std::string::String> {
20612        #[allow(unreachable_patterns)]
20613        self.network.as_ref().and_then(|v| match v {
20614            crate::model::execution_config::Network::NetworkUri(v) => std::option::Option::Some(v),
20615            _ => std::option::Option::None,
20616        })
20617    }
20618
20619    /// Sets the value of [network][crate::model::ExecutionConfig::network]
20620    /// to hold a `NetworkUri`.
20621    ///
20622    /// Note that all the setters affecting `network` are
20623    /// mutually exclusive.
20624    ///
20625    /// # Example
20626    /// ```ignore,no_run
20627    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20628    /// let x = ExecutionConfig::new().set_network_uri("example");
20629    /// assert!(x.network_uri().is_some());
20630    /// assert!(x.subnetwork_uri().is_none());
20631    /// ```
20632    pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20633        self.network = std::option::Option::Some(
20634            crate::model::execution_config::Network::NetworkUri(v.into()),
20635        );
20636        self
20637    }
20638
20639    /// The value of [network][crate::model::ExecutionConfig::network]
20640    /// if it holds a `SubnetworkUri`, `None` if the field is not set or
20641    /// holds a different branch.
20642    pub fn subnetwork_uri(&self) -> std::option::Option<&std::string::String> {
20643        #[allow(unreachable_patterns)]
20644        self.network.as_ref().and_then(|v| match v {
20645            crate::model::execution_config::Network::SubnetworkUri(v) => {
20646                std::option::Option::Some(v)
20647            }
20648            _ => std::option::Option::None,
20649        })
20650    }
20651
20652    /// Sets the value of [network][crate::model::ExecutionConfig::network]
20653    /// to hold a `SubnetworkUri`.
20654    ///
20655    /// Note that all the setters affecting `network` are
20656    /// mutually exclusive.
20657    ///
20658    /// # Example
20659    /// ```ignore,no_run
20660    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20661    /// let x = ExecutionConfig::new().set_subnetwork_uri("example");
20662    /// assert!(x.subnetwork_uri().is_some());
20663    /// assert!(x.network_uri().is_none());
20664    /// ```
20665    pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20666        self.network = std::option::Option::Some(
20667            crate::model::execution_config::Network::SubnetworkUri(v.into()),
20668        );
20669        self
20670    }
20671}
20672
20673impl wkt::message::Message for ExecutionConfig {
20674    fn typename() -> &'static str {
20675        "type.googleapis.com/google.cloud.dataproc.v1.ExecutionConfig"
20676    }
20677}
20678
20679/// Defines additional types related to [ExecutionConfig].
20680pub mod execution_config {
20681    #[allow(unused_imports)]
20682    use super::*;
20683
20684    /// Network configuration for workload execution.
20685    #[derive(Clone, Debug, PartialEq)]
20686    #[non_exhaustive]
20687    pub enum Network {
20688        /// Optional. Network URI to connect workload to.
20689        NetworkUri(std::string::String),
20690        /// Optional. Subnetwork URI to connect workload to.
20691        SubnetworkUri(std::string::String),
20692    }
20693}
20694
20695/// Spark History Server configuration for the workload.
20696#[derive(Clone, Default, PartialEq)]
20697#[non_exhaustive]
20698pub struct SparkHistoryServerConfig {
20699    /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark
20700    /// History Server for the workload.
20701    ///
20702    /// Example:
20703    ///
20704    /// * `projects/[project_id]/regions/[region]/clusters/[cluster_name]`
20705    pub dataproc_cluster: std::string::String,
20706
20707    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20708}
20709
20710impl SparkHistoryServerConfig {
20711    /// Creates a new default instance.
20712    pub fn new() -> Self {
20713        std::default::Default::default()
20714    }
20715
20716    /// Sets the value of [dataproc_cluster][crate::model::SparkHistoryServerConfig::dataproc_cluster].
20717    ///
20718    /// # Example
20719    /// ```ignore,no_run
20720    /// # use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20721    /// let x = SparkHistoryServerConfig::new().set_dataproc_cluster("example");
20722    /// ```
20723    pub fn set_dataproc_cluster<T: std::convert::Into<std::string::String>>(
20724        mut self,
20725        v: T,
20726    ) -> Self {
20727        self.dataproc_cluster = v.into();
20728        self
20729    }
20730}
20731
20732impl wkt::message::Message for SparkHistoryServerConfig {
20733    fn typename() -> &'static str {
20734        "type.googleapis.com/google.cloud.dataproc.v1.SparkHistoryServerConfig"
20735    }
20736}
20737
20738/// Auxiliary services configuration for a workload.
20739#[derive(Clone, Default, PartialEq)]
20740#[non_exhaustive]
20741pub struct PeripheralsConfig {
20742    /// Optional. Resource name of an existing Dataproc Metastore service.
20743    ///
20744    /// Example:
20745    ///
20746    /// * `projects/[project_id]/locations/[region]/services/[service_id]`
20747    pub metastore_service: std::string::String,
20748
20749    /// Optional. The Spark History Server configuration for the workload.
20750    pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
20751
20752    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20753}
20754
20755impl PeripheralsConfig {
20756    /// Creates a new default instance.
20757    pub fn new() -> Self {
20758        std::default::Default::default()
20759    }
20760
20761    /// Sets the value of [metastore_service][crate::model::PeripheralsConfig::metastore_service].
20762    ///
20763    /// # Example
20764    /// ```ignore,no_run
20765    /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20766    /// let x = PeripheralsConfig::new().set_metastore_service("example");
20767    /// ```
20768    pub fn set_metastore_service<T: std::convert::Into<std::string::String>>(
20769        mut self,
20770        v: T,
20771    ) -> Self {
20772        self.metastore_service = v.into();
20773        self
20774    }
20775
20776    /// Sets the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20777    ///
20778    /// # Example
20779    /// ```ignore,no_run
20780    /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20781    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20782    /// let x = PeripheralsConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
20783    /// ```
20784    pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
20785    where
20786        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20787    {
20788        self.spark_history_server_config = std::option::Option::Some(v.into());
20789        self
20790    }
20791
20792    /// Sets or clears the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20793    ///
20794    /// # Example
20795    /// ```ignore,no_run
20796    /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20797    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20798    /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
20799    /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
20800    /// ```
20801    pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
20802    where
20803        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20804    {
20805        self.spark_history_server_config = v.map(|x| x.into());
20806        self
20807    }
20808}
20809
20810impl wkt::message::Message for PeripheralsConfig {
20811    fn typename() -> &'static str {
20812        "type.googleapis.com/google.cloud.dataproc.v1.PeripheralsConfig"
20813    }
20814}
20815
20816/// Runtime information about workload execution.
20817#[derive(Clone, Default, PartialEq)]
20818#[non_exhaustive]
20819pub struct RuntimeInfo {
20820    /// Output only. Map of remote access endpoints (such as web interfaces and
20821    /// APIs) to their URIs.
20822    pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
20823
20824    /// Output only. A URI pointing to the location of the stdout and stderr of the
20825    /// workload.
20826    pub output_uri: std::string::String,
20827
20828    /// Output only. A URI pointing to the location of the diagnostics tarball.
20829    pub diagnostic_output_uri: std::string::String,
20830
20831    /// Output only. Approximate workload resource usage, calculated when
20832    /// the workload completes (see [Dataproc Serverless pricing]
20833    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20834    ///
20835    /// **Note:** This metric calculation may change in the future, for
20836    /// example, to capture cumulative workload resource
20837    /// consumption during workload execution (see the
20838    /// [Dataproc Serverless release notes]
20839    /// (<https://cloud.google.com/dataproc-serverless/docs/release-notes>)
20840    /// for announcements, changes, fixes
20841    /// and other Dataproc developments).
20842    pub approximate_usage: std::option::Option<crate::model::UsageMetrics>,
20843
20844    /// Output only. Snapshot of current workload resource usage.
20845    pub current_usage: std::option::Option<crate::model::UsageSnapshot>,
20846
20847    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20848}
20849
20850impl RuntimeInfo {
20851    /// Creates a new default instance.
20852    pub fn new() -> Self {
20853        std::default::Default::default()
20854    }
20855
20856    /// Sets the value of [endpoints][crate::model::RuntimeInfo::endpoints].
20857    ///
20858    /// # Example
20859    /// ```ignore,no_run
20860    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20861    /// let x = RuntimeInfo::new().set_endpoints([
20862    ///     ("key0", "abc"),
20863    ///     ("key1", "xyz"),
20864    /// ]);
20865    /// ```
20866    pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
20867    where
20868        T: std::iter::IntoIterator<Item = (K, V)>,
20869        K: std::convert::Into<std::string::String>,
20870        V: std::convert::Into<std::string::String>,
20871    {
20872        use std::iter::Iterator;
20873        self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20874        self
20875    }
20876
20877    /// Sets the value of [output_uri][crate::model::RuntimeInfo::output_uri].
20878    ///
20879    /// # Example
20880    /// ```ignore,no_run
20881    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20882    /// let x = RuntimeInfo::new().set_output_uri("example");
20883    /// ```
20884    pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20885        self.output_uri = v.into();
20886        self
20887    }
20888
20889    /// Sets the value of [diagnostic_output_uri][crate::model::RuntimeInfo::diagnostic_output_uri].
20890    ///
20891    /// # Example
20892    /// ```ignore,no_run
20893    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20894    /// let x = RuntimeInfo::new().set_diagnostic_output_uri("example");
20895    /// ```
20896    pub fn set_diagnostic_output_uri<T: std::convert::Into<std::string::String>>(
20897        mut self,
20898        v: T,
20899    ) -> Self {
20900        self.diagnostic_output_uri = v.into();
20901        self
20902    }
20903
20904    /// Sets the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20905    ///
20906    /// # Example
20907    /// ```ignore,no_run
20908    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20909    /// use google_cloud_dataproc_v1::model::UsageMetrics;
20910    /// let x = RuntimeInfo::new().set_approximate_usage(UsageMetrics::default()/* use setters */);
20911    /// ```
20912    pub fn set_approximate_usage<T>(mut self, v: T) -> Self
20913    where
20914        T: std::convert::Into<crate::model::UsageMetrics>,
20915    {
20916        self.approximate_usage = std::option::Option::Some(v.into());
20917        self
20918    }
20919
20920    /// Sets or clears the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20921    ///
20922    /// # Example
20923    /// ```ignore,no_run
20924    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20925    /// use google_cloud_dataproc_v1::model::UsageMetrics;
20926    /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(Some(UsageMetrics::default()/* use setters */));
20927    /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(None::<UsageMetrics>);
20928    /// ```
20929    pub fn set_or_clear_approximate_usage<T>(mut self, v: std::option::Option<T>) -> Self
20930    where
20931        T: std::convert::Into<crate::model::UsageMetrics>,
20932    {
20933        self.approximate_usage = v.map(|x| x.into());
20934        self
20935    }
20936
20937    /// Sets the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20938    ///
20939    /// # Example
20940    /// ```ignore,no_run
20941    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20942    /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20943    /// let x = RuntimeInfo::new().set_current_usage(UsageSnapshot::default()/* use setters */);
20944    /// ```
20945    pub fn set_current_usage<T>(mut self, v: T) -> Self
20946    where
20947        T: std::convert::Into<crate::model::UsageSnapshot>,
20948    {
20949        self.current_usage = std::option::Option::Some(v.into());
20950        self
20951    }
20952
20953    /// Sets or clears the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20954    ///
20955    /// # Example
20956    /// ```ignore,no_run
20957    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20958    /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20959    /// let x = RuntimeInfo::new().set_or_clear_current_usage(Some(UsageSnapshot::default()/* use setters */));
20960    /// let x = RuntimeInfo::new().set_or_clear_current_usage(None::<UsageSnapshot>);
20961    /// ```
20962    pub fn set_or_clear_current_usage<T>(mut self, v: std::option::Option<T>) -> Self
20963    where
20964        T: std::convert::Into<crate::model::UsageSnapshot>,
20965    {
20966        self.current_usage = v.map(|x| x.into());
20967        self
20968    }
20969}
20970
20971impl wkt::message::Message for RuntimeInfo {
20972    fn typename() -> &'static str {
20973        "type.googleapis.com/google.cloud.dataproc.v1.RuntimeInfo"
20974    }
20975}
20976
20977/// Usage metrics represent approximate total resources consumed by a workload.
20978#[derive(Clone, Default, PartialEq)]
20979#[non_exhaustive]
20980pub struct UsageMetrics {
20981    /// Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`)
20982    /// (see [Dataproc Serverless pricing]
20983    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20984    pub milli_dcu_seconds: i64,
20985
20986    /// Optional. Shuffle storage usage in (`GB` x `seconds`) (see
20987    /// [Dataproc Serverless pricing]
20988    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20989    pub shuffle_storage_gb_seconds: i64,
20990
20991    /// Optional. Accelerator usage in (`milliAccelerator` x `seconds`) (see
20992    /// [Dataproc Serverless pricing]
20993    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20994    pub milli_accelerator_seconds: i64,
20995
20996    /// Optional. Accelerator type being used, if any
20997    pub accelerator_type: std::string::String,
20998
20999    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21000}
21001
21002impl UsageMetrics {
21003    /// Creates a new default instance.
21004    pub fn new() -> Self {
21005        std::default::Default::default()
21006    }
21007
21008    /// Sets the value of [milli_dcu_seconds][crate::model::UsageMetrics::milli_dcu_seconds].
21009    ///
21010    /// # Example
21011    /// ```ignore,no_run
21012    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21013    /// let x = UsageMetrics::new().set_milli_dcu_seconds(42);
21014    /// ```
21015    pub fn set_milli_dcu_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21016        self.milli_dcu_seconds = v.into();
21017        self
21018    }
21019
21020    /// Sets the value of [shuffle_storage_gb_seconds][crate::model::UsageMetrics::shuffle_storage_gb_seconds].
21021    ///
21022    /// # Example
21023    /// ```ignore,no_run
21024    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21025    /// let x = UsageMetrics::new().set_shuffle_storage_gb_seconds(42);
21026    /// ```
21027    pub fn set_shuffle_storage_gb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21028        self.shuffle_storage_gb_seconds = v.into();
21029        self
21030    }
21031
21032    /// Sets the value of [milli_accelerator_seconds][crate::model::UsageMetrics::milli_accelerator_seconds].
21033    ///
21034    /// # Example
21035    /// ```ignore,no_run
21036    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21037    /// let x = UsageMetrics::new().set_milli_accelerator_seconds(42);
21038    /// ```
21039    pub fn set_milli_accelerator_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21040        self.milli_accelerator_seconds = v.into();
21041        self
21042    }
21043
21044    /// Sets the value of [accelerator_type][crate::model::UsageMetrics::accelerator_type].
21045    ///
21046    /// # Example
21047    /// ```ignore,no_run
21048    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21049    /// let x = UsageMetrics::new().set_accelerator_type("example");
21050    /// ```
21051    pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21052        mut self,
21053        v: T,
21054    ) -> Self {
21055        self.accelerator_type = v.into();
21056        self
21057    }
21058}
21059
21060impl wkt::message::Message for UsageMetrics {
21061    fn typename() -> &'static str {
21062        "type.googleapis.com/google.cloud.dataproc.v1.UsageMetrics"
21063    }
21064}
21065
21066/// The usage snapshot represents the resources consumed by a workload at a
21067/// specified time.
21068#[derive(Clone, Default, PartialEq)]
21069#[non_exhaustive]
21070pub struct UsageSnapshot {
21071    /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see
21072    /// [Dataproc Serverless pricing]
21073    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21074    pub milli_dcu: i64,
21075
21076    /// Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless
21077    /// pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
21078    pub shuffle_storage_gb: i64,
21079
21080    /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at
21081    /// premium tier (see [Dataproc Serverless pricing]
21082    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21083    pub milli_dcu_premium: i64,
21084
21085    /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see
21086    /// [Dataproc Serverless pricing]
21087    /// (<https://cloud.google.com/dataproc-serverless/pricing>))
21088    pub shuffle_storage_gb_premium: i64,
21089
21090    /// Optional. Milli (one-thousandth) accelerator. (see [Dataproc
21091    /// Serverless pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
21092    pub milli_accelerator: i64,
21093
21094    /// Optional. Accelerator type being used, if any
21095    pub accelerator_type: std::string::String,
21096
21097    /// Optional. The timestamp of the usage snapshot.
21098    pub snapshot_time: std::option::Option<wkt::Timestamp>,
21099
21100    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21101}
21102
21103impl UsageSnapshot {
21104    /// Creates a new default instance.
21105    pub fn new() -> Self {
21106        std::default::Default::default()
21107    }
21108
21109    /// Sets the value of [milli_dcu][crate::model::UsageSnapshot::milli_dcu].
21110    ///
21111    /// # Example
21112    /// ```ignore,no_run
21113    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21114    /// let x = UsageSnapshot::new().set_milli_dcu(42);
21115    /// ```
21116    pub fn set_milli_dcu<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21117        self.milli_dcu = v.into();
21118        self
21119    }
21120
21121    /// Sets the value of [shuffle_storage_gb][crate::model::UsageSnapshot::shuffle_storage_gb].
21122    ///
21123    /// # Example
21124    /// ```ignore,no_run
21125    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21126    /// let x = UsageSnapshot::new().set_shuffle_storage_gb(42);
21127    /// ```
21128    pub fn set_shuffle_storage_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21129        self.shuffle_storage_gb = v.into();
21130        self
21131    }
21132
21133    /// Sets the value of [milli_dcu_premium][crate::model::UsageSnapshot::milli_dcu_premium].
21134    ///
21135    /// # Example
21136    /// ```ignore,no_run
21137    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21138    /// let x = UsageSnapshot::new().set_milli_dcu_premium(42);
21139    /// ```
21140    pub fn set_milli_dcu_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21141        self.milli_dcu_premium = v.into();
21142        self
21143    }
21144
21145    /// Sets the value of [shuffle_storage_gb_premium][crate::model::UsageSnapshot::shuffle_storage_gb_premium].
21146    ///
21147    /// # Example
21148    /// ```ignore,no_run
21149    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21150    /// let x = UsageSnapshot::new().set_shuffle_storage_gb_premium(42);
21151    /// ```
21152    pub fn set_shuffle_storage_gb_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21153        self.shuffle_storage_gb_premium = v.into();
21154        self
21155    }
21156
21157    /// Sets the value of [milli_accelerator][crate::model::UsageSnapshot::milli_accelerator].
21158    ///
21159    /// # Example
21160    /// ```ignore,no_run
21161    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21162    /// let x = UsageSnapshot::new().set_milli_accelerator(42);
21163    /// ```
21164    pub fn set_milli_accelerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21165        self.milli_accelerator = v.into();
21166        self
21167    }
21168
21169    /// Sets the value of [accelerator_type][crate::model::UsageSnapshot::accelerator_type].
21170    ///
21171    /// # Example
21172    /// ```ignore,no_run
21173    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21174    /// let x = UsageSnapshot::new().set_accelerator_type("example");
21175    /// ```
21176    pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21177        mut self,
21178        v: T,
21179    ) -> Self {
21180        self.accelerator_type = v.into();
21181        self
21182    }
21183
21184    /// Sets the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
21185    ///
21186    /// # Example
21187    /// ```ignore,no_run
21188    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21189    /// use wkt::Timestamp;
21190    /// let x = UsageSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
21191    /// ```
21192    pub fn set_snapshot_time<T>(mut self, v: T) -> Self
21193    where
21194        T: std::convert::Into<wkt::Timestamp>,
21195    {
21196        self.snapshot_time = std::option::Option::Some(v.into());
21197        self
21198    }
21199
21200    /// Sets or clears the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
21201    ///
21202    /// # Example
21203    /// ```ignore,no_run
21204    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21205    /// use wkt::Timestamp;
21206    /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
21207    /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
21208    /// ```
21209    pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
21210    where
21211        T: std::convert::Into<wkt::Timestamp>,
21212    {
21213        self.snapshot_time = v.map(|x| x.into());
21214        self
21215    }
21216}
21217
21218impl wkt::message::Message for UsageSnapshot {
21219    fn typename() -> &'static str {
21220        "type.googleapis.com/google.cloud.dataproc.v1.UsageSnapshot"
21221    }
21222}
21223
21224/// The cluster's GKE config.
21225#[derive(Clone, Default, PartialEq)]
21226#[non_exhaustive]
21227pub struct GkeClusterConfig {
21228    /// Optional. A target GKE cluster to deploy to. It must be in the same project
21229    /// and region as the Dataproc cluster (the GKE cluster can be zonal or
21230    /// regional). Format:
21231    /// 'projects/{project}/locations/{location}/clusters/{cluster_id}'
21232    pub gke_cluster_target: std::string::String,
21233
21234    /// Optional. GKE node pools where workloads will be scheduled. At least one
21235    /// node pool must be assigned the `DEFAULT`
21236    /// [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role].
21237    /// If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT`
21238    /// `GkeNodePoolTarget`. Each role can be given to only one
21239    /// `GkeNodePoolTarget`. All node pools must have the same location settings.
21240    ///
21241    /// [google.cloud.dataproc.v1.GkeNodePoolTarget.Role]: crate::model::gke_node_pool_target::Role
21242    pub node_pool_target: std::vec::Vec<crate::model::GkeNodePoolTarget>,
21243
21244    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21245}
21246
21247impl GkeClusterConfig {
21248    /// Creates a new default instance.
21249    pub fn new() -> Self {
21250        std::default::Default::default()
21251    }
21252
21253    /// Sets the value of [gke_cluster_target][crate::model::GkeClusterConfig::gke_cluster_target].
21254    ///
21255    /// # Example
21256    /// ```ignore,no_run
21257    /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
21258    /// let x = GkeClusterConfig::new().set_gke_cluster_target("example");
21259    /// ```
21260    pub fn set_gke_cluster_target<T: std::convert::Into<std::string::String>>(
21261        mut self,
21262        v: T,
21263    ) -> Self {
21264        self.gke_cluster_target = v.into();
21265        self
21266    }
21267
21268    /// Sets the value of [node_pool_target][crate::model::GkeClusterConfig::node_pool_target].
21269    ///
21270    /// # Example
21271    /// ```ignore,no_run
21272    /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
21273    /// use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21274    /// let x = GkeClusterConfig::new()
21275    ///     .set_node_pool_target([
21276    ///         GkeNodePoolTarget::default()/* use setters */,
21277    ///         GkeNodePoolTarget::default()/* use (different) setters */,
21278    ///     ]);
21279    /// ```
21280    pub fn set_node_pool_target<T, V>(mut self, v: T) -> Self
21281    where
21282        T: std::iter::IntoIterator<Item = V>,
21283        V: std::convert::Into<crate::model::GkeNodePoolTarget>,
21284    {
21285        use std::iter::Iterator;
21286        self.node_pool_target = v.into_iter().map(|i| i.into()).collect();
21287        self
21288    }
21289}
21290
21291impl wkt::message::Message for GkeClusterConfig {
21292    fn typename() -> &'static str {
21293        "type.googleapis.com/google.cloud.dataproc.v1.GkeClusterConfig"
21294    }
21295}
21296
21297/// The configuration for running the Dataproc cluster on Kubernetes.
21298#[derive(Clone, Default, PartialEq)]
21299#[non_exhaustive]
21300pub struct KubernetesClusterConfig {
21301    /// Optional. A namespace within the Kubernetes cluster to deploy into. If this
21302    /// namespace does not exist, it is created. If it exists, Dataproc verifies
21303    /// that another Dataproc VirtualCluster is not installed into it. If not
21304    /// specified, the name of the Dataproc Cluster is used.
21305    pub kubernetes_namespace: std::string::String,
21306
21307    /// Optional. The software configuration for this Dataproc cluster running on
21308    /// Kubernetes.
21309    pub kubernetes_software_config: std::option::Option<crate::model::KubernetesSoftwareConfig>,
21310
21311    #[allow(missing_docs)]
21312    pub config: std::option::Option<crate::model::kubernetes_cluster_config::Config>,
21313
21314    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21315}
21316
21317impl KubernetesClusterConfig {
21318    /// Creates a new default instance.
21319    pub fn new() -> Self {
21320        std::default::Default::default()
21321    }
21322
21323    /// Sets the value of [kubernetes_namespace][crate::model::KubernetesClusterConfig::kubernetes_namespace].
21324    ///
21325    /// # Example
21326    /// ```ignore,no_run
21327    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21328    /// let x = KubernetesClusterConfig::new().set_kubernetes_namespace("example");
21329    /// ```
21330    pub fn set_kubernetes_namespace<T: std::convert::Into<std::string::String>>(
21331        mut self,
21332        v: T,
21333    ) -> Self {
21334        self.kubernetes_namespace = v.into();
21335        self
21336    }
21337
21338    /// Sets the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
21339    ///
21340    /// # Example
21341    /// ```ignore,no_run
21342    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21343    /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21344    /// let x = KubernetesClusterConfig::new().set_kubernetes_software_config(KubernetesSoftwareConfig::default()/* use setters */);
21345    /// ```
21346    pub fn set_kubernetes_software_config<T>(mut self, v: T) -> Self
21347    where
21348        T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
21349    {
21350        self.kubernetes_software_config = std::option::Option::Some(v.into());
21351        self
21352    }
21353
21354    /// Sets or clears the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
21355    ///
21356    /// # Example
21357    /// ```ignore,no_run
21358    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21359    /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21360    /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(Some(KubernetesSoftwareConfig::default()/* use setters */));
21361    /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(None::<KubernetesSoftwareConfig>);
21362    /// ```
21363    pub fn set_or_clear_kubernetes_software_config<T>(mut self, v: std::option::Option<T>) -> Self
21364    where
21365        T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
21366    {
21367        self.kubernetes_software_config = v.map(|x| x.into());
21368        self
21369    }
21370
21371    /// Sets the value of [config][crate::model::KubernetesClusterConfig::config].
21372    ///
21373    /// Note that all the setters affecting `config` are mutually
21374    /// exclusive.
21375    ///
21376    /// # Example
21377    /// ```ignore,no_run
21378    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21379    /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
21380    /// let x = KubernetesClusterConfig::new().set_config(Some(
21381    ///     google_cloud_dataproc_v1::model::kubernetes_cluster_config::Config::GkeClusterConfig(GkeClusterConfig::default().into())));
21382    /// ```
21383    pub fn set_config<
21384        T: std::convert::Into<std::option::Option<crate::model::kubernetes_cluster_config::Config>>,
21385    >(
21386        mut self,
21387        v: T,
21388    ) -> Self {
21389        self.config = v.into();
21390        self
21391    }
21392
21393    /// The value of [config][crate::model::KubernetesClusterConfig::config]
21394    /// if it holds a `GkeClusterConfig`, `None` if the field is not set or
21395    /// holds a different branch.
21396    pub fn gke_cluster_config(
21397        &self,
21398    ) -> std::option::Option<&std::boxed::Box<crate::model::GkeClusterConfig>> {
21399        #[allow(unreachable_patterns)]
21400        self.config.as_ref().and_then(|v| match v {
21401            crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v) => {
21402                std::option::Option::Some(v)
21403            }
21404            _ => std::option::Option::None,
21405        })
21406    }
21407
21408    /// Sets the value of [config][crate::model::KubernetesClusterConfig::config]
21409    /// to hold a `GkeClusterConfig`.
21410    ///
21411    /// Note that all the setters affecting `config` are
21412    /// mutually exclusive.
21413    ///
21414    /// # Example
21415    /// ```ignore,no_run
21416    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21417    /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
21418    /// let x = KubernetesClusterConfig::new().set_gke_cluster_config(GkeClusterConfig::default()/* use setters */);
21419    /// assert!(x.gke_cluster_config().is_some());
21420    /// ```
21421    pub fn set_gke_cluster_config<
21422        T: std::convert::Into<std::boxed::Box<crate::model::GkeClusterConfig>>,
21423    >(
21424        mut self,
21425        v: T,
21426    ) -> Self {
21427        self.config = std::option::Option::Some(
21428            crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v.into()),
21429        );
21430        self
21431    }
21432}
21433
21434impl wkt::message::Message for KubernetesClusterConfig {
21435    fn typename() -> &'static str {
21436        "type.googleapis.com/google.cloud.dataproc.v1.KubernetesClusterConfig"
21437    }
21438}
21439
21440/// Defines additional types related to [KubernetesClusterConfig].
21441pub mod kubernetes_cluster_config {
21442    #[allow(unused_imports)]
21443    use super::*;
21444
21445    #[allow(missing_docs)]
21446    #[derive(Clone, Debug, PartialEq)]
21447    #[non_exhaustive]
21448    pub enum Config {
21449        /// Required. The configuration for running the Dataproc cluster on GKE.
21450        GkeClusterConfig(std::boxed::Box<crate::model::GkeClusterConfig>),
21451    }
21452}
21453
21454/// The software configuration for this Dataproc cluster running on Kubernetes.
21455#[derive(Clone, Default, PartialEq)]
21456#[non_exhaustive]
21457pub struct KubernetesSoftwareConfig {
21458    /// The components that should be installed in this Dataproc cluster. The key
21459    /// must be a string from the KubernetesComponent enumeration. The value is
21460    /// the version of the software to be installed.
21461    /// At least one entry must be specified.
21462    pub component_version: std::collections::HashMap<std::string::String, std::string::String>,
21463
21464    /// The properties to set on daemon config files.
21465    ///
21466    /// Property keys are specified in `prefix:property` format, for example
21467    /// `spark:spark.kubernetes.container.image`. The following are supported
21468    /// prefixes and their mappings:
21469    ///
21470    /// * spark:  `spark-defaults.conf`
21471    ///
21472    /// For more information, see [Cluster
21473    /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
21474    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
21475
21476    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21477}
21478
21479impl KubernetesSoftwareConfig {
21480    /// Creates a new default instance.
21481    pub fn new() -> Self {
21482        std::default::Default::default()
21483    }
21484
21485    /// Sets the value of [component_version][crate::model::KubernetesSoftwareConfig::component_version].
21486    ///
21487    /// # Example
21488    /// ```ignore,no_run
21489    /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21490    /// let x = KubernetesSoftwareConfig::new().set_component_version([
21491    ///     ("key0", "abc"),
21492    ///     ("key1", "xyz"),
21493    /// ]);
21494    /// ```
21495    pub fn set_component_version<T, K, V>(mut self, v: T) -> Self
21496    where
21497        T: std::iter::IntoIterator<Item = (K, V)>,
21498        K: std::convert::Into<std::string::String>,
21499        V: std::convert::Into<std::string::String>,
21500    {
21501        use std::iter::Iterator;
21502        self.component_version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21503        self
21504    }
21505
21506    /// Sets the value of [properties][crate::model::KubernetesSoftwareConfig::properties].
21507    ///
21508    /// # Example
21509    /// ```ignore,no_run
21510    /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21511    /// let x = KubernetesSoftwareConfig::new().set_properties([
21512    ///     ("key0", "abc"),
21513    ///     ("key1", "xyz"),
21514    /// ]);
21515    /// ```
21516    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
21517    where
21518        T: std::iter::IntoIterator<Item = (K, V)>,
21519        K: std::convert::Into<std::string::String>,
21520        V: std::convert::Into<std::string::String>,
21521    {
21522        use std::iter::Iterator;
21523        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21524        self
21525    }
21526}
21527
21528impl wkt::message::Message for KubernetesSoftwareConfig {
21529    fn typename() -> &'static str {
21530        "type.googleapis.com/google.cloud.dataproc.v1.KubernetesSoftwareConfig"
21531    }
21532}
21533
21534/// GKE node pools that Dataproc workloads run on.
21535#[derive(Clone, Default, PartialEq)]
21536#[non_exhaustive]
21537pub struct GkeNodePoolTarget {
21538    /// Required. The target GKE node pool.
21539    /// Format:
21540    /// 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
21541    pub node_pool: std::string::String,
21542
21543    /// Required. The roles associated with the GKE node pool.
21544    pub roles: std::vec::Vec<crate::model::gke_node_pool_target::Role>,
21545
21546    /// Input only. The configuration for the GKE node pool.
21547    ///
21548    /// If specified, Dataproc attempts to create a node pool with the
21549    /// specified shape. If one with the same name already exists, it is
21550    /// verified against all specified fields. If a field differs, the
21551    /// virtual cluster creation will fail.
21552    ///
21553    /// If omitted, any node pool with the specified name is used. If a
21554    /// node pool with the specified name does not exist, Dataproc create a
21555    /// node pool with default values.
21556    ///
21557    /// This is an input only field. It will not be returned by the API.
21558    pub node_pool_config: std::option::Option<crate::model::GkeNodePoolConfig>,
21559
21560    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21561}
21562
21563impl GkeNodePoolTarget {
21564    /// Creates a new default instance.
21565    pub fn new() -> Self {
21566        std::default::Default::default()
21567    }
21568
21569    /// Sets the value of [node_pool][crate::model::GkeNodePoolTarget::node_pool].
21570    ///
21571    /// # Example
21572    /// ```ignore,no_run
21573    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21574    /// let x = GkeNodePoolTarget::new().set_node_pool("example");
21575    /// ```
21576    pub fn set_node_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21577        self.node_pool = v.into();
21578        self
21579    }
21580
21581    /// Sets the value of [roles][crate::model::GkeNodePoolTarget::roles].
21582    ///
21583    /// # Example
21584    /// ```ignore,no_run
21585    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21586    /// use google_cloud_dataproc_v1::model::gke_node_pool_target::Role;
21587    /// let x = GkeNodePoolTarget::new().set_roles([
21588    ///     Role::Default,
21589    ///     Role::Controller,
21590    ///     Role::SparkDriver,
21591    /// ]);
21592    /// ```
21593    pub fn set_roles<T, V>(mut self, v: T) -> Self
21594    where
21595        T: std::iter::IntoIterator<Item = V>,
21596        V: std::convert::Into<crate::model::gke_node_pool_target::Role>,
21597    {
21598        use std::iter::Iterator;
21599        self.roles = v.into_iter().map(|i| i.into()).collect();
21600        self
21601    }
21602
21603    /// Sets the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21604    ///
21605    /// # Example
21606    /// ```ignore,no_run
21607    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21608    /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21609    /// let x = GkeNodePoolTarget::new().set_node_pool_config(GkeNodePoolConfig::default()/* use setters */);
21610    /// ```
21611    pub fn set_node_pool_config<T>(mut self, v: T) -> Self
21612    where
21613        T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21614    {
21615        self.node_pool_config = std::option::Option::Some(v.into());
21616        self
21617    }
21618
21619    /// Sets or clears the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21620    ///
21621    /// # Example
21622    /// ```ignore,no_run
21623    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21624    /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21625    /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(Some(GkeNodePoolConfig::default()/* use setters */));
21626    /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(None::<GkeNodePoolConfig>);
21627    /// ```
21628    pub fn set_or_clear_node_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
21629    where
21630        T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21631    {
21632        self.node_pool_config = v.map(|x| x.into());
21633        self
21634    }
21635}
21636
21637impl wkt::message::Message for GkeNodePoolTarget {
21638    fn typename() -> &'static str {
21639        "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolTarget"
21640    }
21641}
21642
21643/// Defines additional types related to [GkeNodePoolTarget].
21644pub mod gke_node_pool_target {
21645    #[allow(unused_imports)]
21646    use super::*;
21647
21648    /// `Role` specifies the tasks that will run on the node pool. Roles can be
21649    /// specific to workloads. Exactly one
21650    /// [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the
21651    /// virtual cluster must have the `DEFAULT` role, which is used to run all
21652    /// workloads that are not associated with a node pool.
21653    ///
21654    /// [google.cloud.dataproc.v1.GkeNodePoolTarget]: crate::model::GkeNodePoolTarget
21655    ///
21656    /// # Working with unknown values
21657    ///
21658    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21659    /// additional enum variants at any time. Adding new variants is not considered
21660    /// a breaking change. Applications should write their code in anticipation of:
21661    ///
21662    /// - New values appearing in future releases of the client library, **and**
21663    /// - New values received dynamically, without application changes.
21664    ///
21665    /// Please consult the [Working with enums] section in the user guide for some
21666    /// guidelines.
21667    ///
21668    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21669    #[derive(Clone, Debug, PartialEq)]
21670    #[non_exhaustive]
21671    pub enum Role {
21672        /// Role is unspecified.
21673        Unspecified,
21674        /// At least one node pool must have the `DEFAULT` role.
21675        /// Work assigned to a role that is not associated with a node pool
21676        /// is assigned to the node pool with the `DEFAULT` role. For example,
21677        /// work assigned to the `CONTROLLER` role will be assigned to the node pool
21678        /// with the `DEFAULT` role if no node pool has the `CONTROLLER` role.
21679        Default,
21680        /// Run work associated with the Dataproc control plane (for example,
21681        /// controllers and webhooks). Very low resource requirements.
21682        Controller,
21683        /// Run work associated with a Spark driver of a job.
21684        SparkDriver,
21685        /// Run work associated with a Spark executor of a job.
21686        SparkExecutor,
21687        /// If set, the enum was initialized with an unknown value.
21688        ///
21689        /// Applications can examine the value using [Role::value] or
21690        /// [Role::name].
21691        UnknownValue(role::UnknownValue),
21692    }
21693
21694    #[doc(hidden)]
21695    pub mod role {
21696        #[allow(unused_imports)]
21697        use super::*;
21698        #[derive(Clone, Debug, PartialEq)]
21699        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21700    }
21701
21702    impl Role {
21703        /// Gets the enum value.
21704        ///
21705        /// Returns `None` if the enum contains an unknown value deserialized from
21706        /// the string representation of enums.
21707        pub fn value(&self) -> std::option::Option<i32> {
21708            match self {
21709                Self::Unspecified => std::option::Option::Some(0),
21710                Self::Default => std::option::Option::Some(1),
21711                Self::Controller => std::option::Option::Some(2),
21712                Self::SparkDriver => std::option::Option::Some(3),
21713                Self::SparkExecutor => std::option::Option::Some(4),
21714                Self::UnknownValue(u) => u.0.value(),
21715            }
21716        }
21717
21718        /// Gets the enum value as a string.
21719        ///
21720        /// Returns `None` if the enum contains an unknown value deserialized from
21721        /// the integer representation of enums.
21722        pub fn name(&self) -> std::option::Option<&str> {
21723            match self {
21724                Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
21725                Self::Default => std::option::Option::Some("DEFAULT"),
21726                Self::Controller => std::option::Option::Some("CONTROLLER"),
21727                Self::SparkDriver => std::option::Option::Some("SPARK_DRIVER"),
21728                Self::SparkExecutor => std::option::Option::Some("SPARK_EXECUTOR"),
21729                Self::UnknownValue(u) => u.0.name(),
21730            }
21731        }
21732    }
21733
21734    impl std::default::Default for Role {
21735        fn default() -> Self {
21736            use std::convert::From;
21737            Self::from(0)
21738        }
21739    }
21740
21741    impl std::fmt::Display for Role {
21742        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21743            wkt::internal::display_enum(f, self.name(), self.value())
21744        }
21745    }
21746
21747    impl std::convert::From<i32> for Role {
21748        fn from(value: i32) -> Self {
21749            match value {
21750                0 => Self::Unspecified,
21751                1 => Self::Default,
21752                2 => Self::Controller,
21753                3 => Self::SparkDriver,
21754                4 => Self::SparkExecutor,
21755                _ => Self::UnknownValue(role::UnknownValue(
21756                    wkt::internal::UnknownEnumValue::Integer(value),
21757                )),
21758            }
21759        }
21760    }
21761
21762    impl std::convert::From<&str> for Role {
21763        fn from(value: &str) -> Self {
21764            use std::string::ToString;
21765            match value {
21766                "ROLE_UNSPECIFIED" => Self::Unspecified,
21767                "DEFAULT" => Self::Default,
21768                "CONTROLLER" => Self::Controller,
21769                "SPARK_DRIVER" => Self::SparkDriver,
21770                "SPARK_EXECUTOR" => Self::SparkExecutor,
21771                _ => Self::UnknownValue(role::UnknownValue(
21772                    wkt::internal::UnknownEnumValue::String(value.to_string()),
21773                )),
21774            }
21775        }
21776    }
21777
21778    impl serde::ser::Serialize for Role {
21779        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21780        where
21781            S: serde::Serializer,
21782        {
21783            match self {
21784                Self::Unspecified => serializer.serialize_i32(0),
21785                Self::Default => serializer.serialize_i32(1),
21786                Self::Controller => serializer.serialize_i32(2),
21787                Self::SparkDriver => serializer.serialize_i32(3),
21788                Self::SparkExecutor => serializer.serialize_i32(4),
21789                Self::UnknownValue(u) => u.0.serialize(serializer),
21790            }
21791        }
21792    }
21793
21794    impl<'de> serde::de::Deserialize<'de> for Role {
21795        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21796        where
21797            D: serde::Deserializer<'de>,
21798        {
21799            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
21800                ".google.cloud.dataproc.v1.GkeNodePoolTarget.Role",
21801            ))
21802        }
21803    }
21804}
21805
21806/// The configuration of a GKE node pool used by a [Dataproc-on-GKE
21807/// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
21808#[derive(Clone, Default, PartialEq)]
21809#[non_exhaustive]
21810pub struct GkeNodePoolConfig {
21811    /// Optional. The node pool configuration.
21812    pub config: std::option::Option<crate::model::gke_node_pool_config::GkeNodeConfig>,
21813
21814    /// Optional. The list of Compute Engine
21815    /// [zones](https://cloud.google.com/compute/docs/zones#available) where
21816    /// node pool nodes associated with a Dataproc on GKE virtual cluster
21817    /// will be located.
21818    ///
21819    /// **Note:** All node pools associated with a virtual cluster
21820    /// must be located in the same region as the virtual cluster, and they must
21821    /// be located in the same zone within that region.
21822    ///
21823    /// If a location is not specified during node pool creation, Dataproc on GKE
21824    /// will choose the zone.
21825    pub locations: std::vec::Vec<std::string::String>,
21826
21827    /// Optional. The autoscaler configuration for this node pool. The autoscaler
21828    /// is enabled only when a valid configuration is present.
21829    pub autoscaling:
21830        std::option::Option<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21831
21832    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21833}
21834
21835impl GkeNodePoolConfig {
21836    /// Creates a new default instance.
21837    pub fn new() -> Self {
21838        std::default::Default::default()
21839    }
21840
21841    /// Sets the value of [config][crate::model::GkeNodePoolConfig::config].
21842    ///
21843    /// # Example
21844    /// ```ignore,no_run
21845    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21846    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21847    /// let x = GkeNodePoolConfig::new().set_config(GkeNodeConfig::default()/* use setters */);
21848    /// ```
21849    pub fn set_config<T>(mut self, v: T) -> Self
21850    where
21851        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21852    {
21853        self.config = std::option::Option::Some(v.into());
21854        self
21855    }
21856
21857    /// Sets or clears the value of [config][crate::model::GkeNodePoolConfig::config].
21858    ///
21859    /// # Example
21860    /// ```ignore,no_run
21861    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21862    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21863    /// let x = GkeNodePoolConfig::new().set_or_clear_config(Some(GkeNodeConfig::default()/* use setters */));
21864    /// let x = GkeNodePoolConfig::new().set_or_clear_config(None::<GkeNodeConfig>);
21865    /// ```
21866    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
21867    where
21868        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21869    {
21870        self.config = v.map(|x| x.into());
21871        self
21872    }
21873
21874    /// Sets the value of [locations][crate::model::GkeNodePoolConfig::locations].
21875    ///
21876    /// # Example
21877    /// ```ignore,no_run
21878    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21879    /// let x = GkeNodePoolConfig::new().set_locations(["a", "b", "c"]);
21880    /// ```
21881    pub fn set_locations<T, V>(mut self, v: T) -> Self
21882    where
21883        T: std::iter::IntoIterator<Item = V>,
21884        V: std::convert::Into<std::string::String>,
21885    {
21886        use std::iter::Iterator;
21887        self.locations = v.into_iter().map(|i| i.into()).collect();
21888        self
21889    }
21890
21891    /// Sets the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21892    ///
21893    /// # Example
21894    /// ```ignore,no_run
21895    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21896    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21897    /// let x = GkeNodePoolConfig::new().set_autoscaling(GkeNodePoolAutoscalingConfig::default()/* use setters */);
21898    /// ```
21899    pub fn set_autoscaling<T>(mut self, v: T) -> Self
21900    where
21901        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21902    {
21903        self.autoscaling = std::option::Option::Some(v.into());
21904        self
21905    }
21906
21907    /// Sets or clears the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21908    ///
21909    /// # Example
21910    /// ```ignore,no_run
21911    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21912    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21913    /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(Some(GkeNodePoolAutoscalingConfig::default()/* use setters */));
21914    /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(None::<GkeNodePoolAutoscalingConfig>);
21915    /// ```
21916    pub fn set_or_clear_autoscaling<T>(mut self, v: std::option::Option<T>) -> Self
21917    where
21918        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21919    {
21920        self.autoscaling = v.map(|x| x.into());
21921        self
21922    }
21923}
21924
21925impl wkt::message::Message for GkeNodePoolConfig {
21926    fn typename() -> &'static str {
21927        "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig"
21928    }
21929}
21930
21931/// Defines additional types related to [GkeNodePoolConfig].
21932pub mod gke_node_pool_config {
21933    #[allow(unused_imports)]
21934    use super::*;
21935
21936    /// Parameters that describe cluster nodes.
21937    #[derive(Clone, Default, PartialEq)]
21938    #[non_exhaustive]
21939    pub struct GkeNodeConfig {
21940        /// Optional. The name of a Compute Engine [machine
21941        /// type](https://cloud.google.com/compute/docs/machine-types).
21942        pub machine_type: std::string::String,
21943
21944        /// Optional. The number of local SSD disks to attach to the node, which is
21945        /// limited by the maximum number of disks allowable per zone (see [Adding
21946        /// Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)).
21947        pub local_ssd_count: i32,
21948
21949        /// Optional. Whether the nodes are created as legacy [preemptible VM
21950        /// instances] (<https://cloud.google.com/compute/docs/instances/preemptible>).
21951        /// Also see
21952        /// [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]
21953        /// VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot
21954        /// preemptible nodes cannot be used in a node pool with the `CONTROLLER`
21955        /// [role]
21956        /// (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21957        /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21958        /// DEFAULT node pool will assume the CONTROLLER role).
21959        ///
21960        /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]: crate::model::gke_node_pool_config::GkeNodeConfig::spot
21961        pub preemptible: bool,
21962
21963        /// Optional. A list of [hardware
21964        /// accelerators](https://cloud.google.com/compute/docs/gpus) to attach to
21965        /// each node.
21966        pub accelerators:
21967            std::vec::Vec<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21968
21969        /// Optional. [Minimum CPU
21970        /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
21971        /// to be used by this instance. The instance may be scheduled on the
21972        /// specified or a newer CPU platform. Specify the friendly names of CPU
21973        /// platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
21974        pub min_cpu_platform: std::string::String,
21975
21976        /// Optional. The [Customer Managed Encryption Key (CMEK)]
21977        /// (<https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek>)
21978        /// used to encrypt the boot disk attached to each node in the node pool.
21979        /// Specify the key using the following format:
21980        /// \<code\>projects/\<var\>KEY_PROJECT_ID\</var\>/locations/\<var\>LOCATION\</var\>/keyRings/\<var\>RING_NAME\</var\>/cryptoKeys/\<var\>KEY_NAME\</var\>\</code\>.
21981        pub boot_disk_kms_key: std::string::String,
21982
21983        /// Optional. Whether the nodes are created as [Spot VM instances]
21984        /// (<https://cloud.google.com/compute/docs/instances/spot>).
21985        /// Spot VMs are the latest update to legacy
21986        /// [preemptible
21987        /// VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible].
21988        /// Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible
21989        /// nodes cannot be used in a node pool with the `CONTROLLER`
21990        /// [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21991        /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21992        /// DEFAULT node pool will assume the CONTROLLER role).
21993        ///
21994        /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]: crate::model::gke_node_pool_config::GkeNodeConfig::preemptible
21995        pub spot: bool,
21996
21997        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21998    }
21999
22000    impl GkeNodeConfig {
22001        /// Creates a new default instance.
22002        pub fn new() -> Self {
22003            std::default::Default::default()
22004        }
22005
22006        /// Sets the value of [machine_type][crate::model::gke_node_pool_config::GkeNodeConfig::machine_type].
22007        ///
22008        /// # Example
22009        /// ```ignore,no_run
22010        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22011        /// let x = GkeNodeConfig::new().set_machine_type("example");
22012        /// ```
22013        pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
22014            mut self,
22015            v: T,
22016        ) -> Self {
22017            self.machine_type = v.into();
22018            self
22019        }
22020
22021        /// Sets the value of [local_ssd_count][crate::model::gke_node_pool_config::GkeNodeConfig::local_ssd_count].
22022        ///
22023        /// # Example
22024        /// ```ignore,no_run
22025        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22026        /// let x = GkeNodeConfig::new().set_local_ssd_count(42);
22027        /// ```
22028        pub fn set_local_ssd_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22029            self.local_ssd_count = v.into();
22030            self
22031        }
22032
22033        /// Sets the value of [preemptible][crate::model::gke_node_pool_config::GkeNodeConfig::preemptible].
22034        ///
22035        /// # Example
22036        /// ```ignore,no_run
22037        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22038        /// let x = GkeNodeConfig::new().set_preemptible(true);
22039        /// ```
22040        pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22041            self.preemptible = v.into();
22042            self
22043        }
22044
22045        /// Sets the value of [accelerators][crate::model::gke_node_pool_config::GkeNodeConfig::accelerators].
22046        ///
22047        /// # Example
22048        /// ```ignore,no_run
22049        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22050        /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22051        /// let x = GkeNodeConfig::new()
22052        ///     .set_accelerators([
22053        ///         GkeNodePoolAcceleratorConfig::default()/* use setters */,
22054        ///         GkeNodePoolAcceleratorConfig::default()/* use (different) setters */,
22055        ///     ]);
22056        /// ```
22057        pub fn set_accelerators<T, V>(mut self, v: T) -> Self
22058        where
22059            T: std::iter::IntoIterator<Item = V>,
22060            V: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
22061        {
22062            use std::iter::Iterator;
22063            self.accelerators = v.into_iter().map(|i| i.into()).collect();
22064            self
22065        }
22066
22067        /// Sets the value of [min_cpu_platform][crate::model::gke_node_pool_config::GkeNodeConfig::min_cpu_platform].
22068        ///
22069        /// # Example
22070        /// ```ignore,no_run
22071        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22072        /// let x = GkeNodeConfig::new().set_min_cpu_platform("example");
22073        /// ```
22074        pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
22075            mut self,
22076            v: T,
22077        ) -> Self {
22078            self.min_cpu_platform = v.into();
22079            self
22080        }
22081
22082        /// Sets the value of [boot_disk_kms_key][crate::model::gke_node_pool_config::GkeNodeConfig::boot_disk_kms_key].
22083        ///
22084        /// # Example
22085        /// ```ignore,no_run
22086        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22087        /// let x = GkeNodeConfig::new().set_boot_disk_kms_key("example");
22088        /// ```
22089        pub fn set_boot_disk_kms_key<T: std::convert::Into<std::string::String>>(
22090            mut self,
22091            v: T,
22092        ) -> Self {
22093            self.boot_disk_kms_key = v.into();
22094            self
22095        }
22096
22097        /// Sets the value of [spot][crate::model::gke_node_pool_config::GkeNodeConfig::spot].
22098        ///
22099        /// # Example
22100        /// ```ignore,no_run
22101        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22102        /// let x = GkeNodeConfig::new().set_spot(true);
22103        /// ```
22104        pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22105            self.spot = v.into();
22106            self
22107        }
22108    }
22109
22110    impl wkt::message::Message for GkeNodeConfig {
22111        fn typename() -> &'static str {
22112            "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig"
22113        }
22114    }
22115
22116    /// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request
22117    /// for a node pool.
22118    #[derive(Clone, Default, PartialEq)]
22119    #[non_exhaustive]
22120    pub struct GkeNodePoolAcceleratorConfig {
22121        /// The number of accelerator cards exposed to an instance.
22122        pub accelerator_count: i64,
22123
22124        /// The accelerator type resource namename (see GPUs on Compute Engine).
22125        pub accelerator_type: std::string::String,
22126
22127        /// Size of partitions to create on the GPU. Valid values are described in
22128        /// the NVIDIA [mig user
22129        /// guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
22130        pub gpu_partition_size: std::string::String,
22131
22132        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22133    }
22134
22135    impl GkeNodePoolAcceleratorConfig {
22136        /// Creates a new default instance.
22137        pub fn new() -> Self {
22138            std::default::Default::default()
22139        }
22140
22141        /// Sets the value of [accelerator_count][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_count].
22142        ///
22143        /// # Example
22144        /// ```ignore,no_run
22145        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22146        /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_count(42);
22147        /// ```
22148        pub fn set_accelerator_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22149            self.accelerator_count = v.into();
22150            self
22151        }
22152
22153        /// Sets the value of [accelerator_type][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_type].
22154        ///
22155        /// # Example
22156        /// ```ignore,no_run
22157        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22158        /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_type("example");
22159        /// ```
22160        pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
22161            mut self,
22162            v: T,
22163        ) -> Self {
22164            self.accelerator_type = v.into();
22165            self
22166        }
22167
22168        /// Sets the value of [gpu_partition_size][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::gpu_partition_size].
22169        ///
22170        /// # Example
22171        /// ```ignore,no_run
22172        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22173        /// let x = GkeNodePoolAcceleratorConfig::new().set_gpu_partition_size("example");
22174        /// ```
22175        pub fn set_gpu_partition_size<T: std::convert::Into<std::string::String>>(
22176            mut self,
22177            v: T,
22178        ) -> Self {
22179            self.gpu_partition_size = v.into();
22180            self
22181        }
22182    }
22183
22184    impl wkt::message::Message for GkeNodePoolAcceleratorConfig {
22185        fn typename() -> &'static str {
22186            "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAcceleratorConfig"
22187        }
22188    }
22189
22190    /// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to
22191    /// adjust the size of the node pool to the current cluster usage.
22192    #[derive(Clone, Default, PartialEq)]
22193    #[non_exhaustive]
22194    pub struct GkeNodePoolAutoscalingConfig {
22195        /// The minimum number of nodes in the node pool. Must be >= 0 and <=
22196        /// max_node_count.
22197        pub min_node_count: i32,
22198
22199        /// The maximum number of nodes in the node pool. Must be >= min_node_count,
22200        /// and must be > 0.
22201        /// **Note:** Quota must be sufficient to scale up the cluster.
22202        pub max_node_count: i32,
22203
22204        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22205    }
22206
22207    impl GkeNodePoolAutoscalingConfig {
22208        /// Creates a new default instance.
22209        pub fn new() -> Self {
22210            std::default::Default::default()
22211        }
22212
22213        /// Sets the value of [min_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::min_node_count].
22214        ///
22215        /// # Example
22216        /// ```ignore,no_run
22217        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22218        /// let x = GkeNodePoolAutoscalingConfig::new().set_min_node_count(42);
22219        /// ```
22220        pub fn set_min_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22221            self.min_node_count = v.into();
22222            self
22223        }
22224
22225        /// Sets the value of [max_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::max_node_count].
22226        ///
22227        /// # Example
22228        /// ```ignore,no_run
22229        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22230        /// let x = GkeNodePoolAutoscalingConfig::new().set_max_node_count(42);
22231        /// ```
22232        pub fn set_max_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22233            self.max_node_count = v.into();
22234            self
22235        }
22236    }
22237
22238    impl wkt::message::Message for GkeNodePoolAutoscalingConfig {
22239        fn typename() -> &'static str {
22240            "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAutoscalingConfig"
22241        }
22242    }
22243}
22244
22245/// Authentication configuration for a workload is used to set the default
22246/// identity for the workload execution.
22247/// The config specifies the type of identity (service account or user) that
22248/// will be used by workloads to access resources on the project(s).
22249#[derive(Clone, Default, PartialEq)]
22250#[non_exhaustive]
22251pub struct AuthenticationConfig {
22252    /// Optional. Authentication type for the user workload running in containers.
22253    pub user_workload_authentication_type: crate::model::authentication_config::AuthenticationType,
22254
22255    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22256}
22257
22258impl AuthenticationConfig {
22259    /// Creates a new default instance.
22260    pub fn new() -> Self {
22261        std::default::Default::default()
22262    }
22263
22264    /// Sets the value of [user_workload_authentication_type][crate::model::AuthenticationConfig::user_workload_authentication_type].
22265    ///
22266    /// # Example
22267    /// ```ignore,no_run
22268    /// # use google_cloud_dataproc_v1::model::AuthenticationConfig;
22269    /// use google_cloud_dataproc_v1::model::authentication_config::AuthenticationType;
22270    /// let x0 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::ServiceAccount);
22271    /// let x1 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::EndUserCredentials);
22272    /// ```
22273    pub fn set_user_workload_authentication_type<
22274        T: std::convert::Into<crate::model::authentication_config::AuthenticationType>,
22275    >(
22276        mut self,
22277        v: T,
22278    ) -> Self {
22279        self.user_workload_authentication_type = v.into();
22280        self
22281    }
22282}
22283
22284impl wkt::message::Message for AuthenticationConfig {
22285    fn typename() -> &'static str {
22286        "type.googleapis.com/google.cloud.dataproc.v1.AuthenticationConfig"
22287    }
22288}
22289
22290/// Defines additional types related to [AuthenticationConfig].
22291pub mod authentication_config {
22292    #[allow(unused_imports)]
22293    use super::*;
22294
22295    /// Authentication types for workload execution.
22296    ///
22297    /// # Working with unknown values
22298    ///
22299    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22300    /// additional enum variants at any time. Adding new variants is not considered
22301    /// a breaking change. Applications should write their code in anticipation of:
22302    ///
22303    /// - New values appearing in future releases of the client library, **and**
22304    /// - New values received dynamically, without application changes.
22305    ///
22306    /// Please consult the [Working with enums] section in the user guide for some
22307    /// guidelines.
22308    ///
22309    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22310    #[derive(Clone, Debug, PartialEq)]
22311    #[non_exhaustive]
22312    pub enum AuthenticationType {
22313        /// If AuthenticationType is unspecified then END_USER_CREDENTIALS is used
22314        /// for 3.0 and newer runtimes, and SERVICE_ACCOUNT is used for older
22315        /// runtimes.
22316        Unspecified,
22317        /// Use service account credentials for authenticating to other services.
22318        ServiceAccount,
22319        /// Use OAuth credentials associated with the workload creator/user for
22320        /// authenticating to other services.
22321        EndUserCredentials,
22322        /// If set, the enum was initialized with an unknown value.
22323        ///
22324        /// Applications can examine the value using [AuthenticationType::value] or
22325        /// [AuthenticationType::name].
22326        UnknownValue(authentication_type::UnknownValue),
22327    }
22328
22329    #[doc(hidden)]
22330    pub mod authentication_type {
22331        #[allow(unused_imports)]
22332        use super::*;
22333        #[derive(Clone, Debug, PartialEq)]
22334        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22335    }
22336
22337    impl AuthenticationType {
22338        /// Gets the enum value.
22339        ///
22340        /// Returns `None` if the enum contains an unknown value deserialized from
22341        /// the string representation of enums.
22342        pub fn value(&self) -> std::option::Option<i32> {
22343            match self {
22344                Self::Unspecified => std::option::Option::Some(0),
22345                Self::ServiceAccount => std::option::Option::Some(1),
22346                Self::EndUserCredentials => std::option::Option::Some(2),
22347                Self::UnknownValue(u) => u.0.value(),
22348            }
22349        }
22350
22351        /// Gets the enum value as a string.
22352        ///
22353        /// Returns `None` if the enum contains an unknown value deserialized from
22354        /// the integer representation of enums.
22355        pub fn name(&self) -> std::option::Option<&str> {
22356            match self {
22357                Self::Unspecified => std::option::Option::Some("AUTHENTICATION_TYPE_UNSPECIFIED"),
22358                Self::ServiceAccount => std::option::Option::Some("SERVICE_ACCOUNT"),
22359                Self::EndUserCredentials => std::option::Option::Some("END_USER_CREDENTIALS"),
22360                Self::UnknownValue(u) => u.0.name(),
22361            }
22362        }
22363    }
22364
22365    impl std::default::Default for AuthenticationType {
22366        fn default() -> Self {
22367            use std::convert::From;
22368            Self::from(0)
22369        }
22370    }
22371
22372    impl std::fmt::Display for AuthenticationType {
22373        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22374            wkt::internal::display_enum(f, self.name(), self.value())
22375        }
22376    }
22377
22378    impl std::convert::From<i32> for AuthenticationType {
22379        fn from(value: i32) -> Self {
22380            match value {
22381                0 => Self::Unspecified,
22382                1 => Self::ServiceAccount,
22383                2 => Self::EndUserCredentials,
22384                _ => Self::UnknownValue(authentication_type::UnknownValue(
22385                    wkt::internal::UnknownEnumValue::Integer(value),
22386                )),
22387            }
22388        }
22389    }
22390
22391    impl std::convert::From<&str> for AuthenticationType {
22392        fn from(value: &str) -> Self {
22393            use std::string::ToString;
22394            match value {
22395                "AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
22396                "SERVICE_ACCOUNT" => Self::ServiceAccount,
22397                "END_USER_CREDENTIALS" => Self::EndUserCredentials,
22398                _ => Self::UnknownValue(authentication_type::UnknownValue(
22399                    wkt::internal::UnknownEnumValue::String(value.to_string()),
22400                )),
22401            }
22402        }
22403    }
22404
22405    impl serde::ser::Serialize for AuthenticationType {
22406        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22407        where
22408            S: serde::Serializer,
22409        {
22410            match self {
22411                Self::Unspecified => serializer.serialize_i32(0),
22412                Self::ServiceAccount => serializer.serialize_i32(1),
22413                Self::EndUserCredentials => serializer.serialize_i32(2),
22414                Self::UnknownValue(u) => u.0.serialize(serializer),
22415            }
22416        }
22417    }
22418
22419    impl<'de> serde::de::Deserialize<'de> for AuthenticationType {
22420        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22421        where
22422            D: serde::Deserializer<'de>,
22423        {
22424            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthenticationType>::new(
22425                ".google.cloud.dataproc.v1.AuthenticationConfig.AuthenticationType",
22426            ))
22427        }
22428    }
22429}
22430
22431/// Autotuning configuration of the workload.
22432#[derive(Clone, Default, PartialEq)]
22433#[non_exhaustive]
22434pub struct AutotuningConfig {
22435    /// Optional. Scenarios for which tunings are applied.
22436    pub scenarios: std::vec::Vec<crate::model::autotuning_config::Scenario>,
22437
22438    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22439}
22440
22441impl AutotuningConfig {
22442    /// Creates a new default instance.
22443    pub fn new() -> Self {
22444        std::default::Default::default()
22445    }
22446
22447    /// Sets the value of [scenarios][crate::model::AutotuningConfig::scenarios].
22448    ///
22449    /// # Example
22450    /// ```ignore,no_run
22451    /// # use google_cloud_dataproc_v1::model::AutotuningConfig;
22452    /// use google_cloud_dataproc_v1::model::autotuning_config::Scenario;
22453    /// let x = AutotuningConfig::new().set_scenarios([
22454    ///     Scenario::Scaling,
22455    ///     Scenario::BroadcastHashJoin,
22456    ///     Scenario::Memory,
22457    /// ]);
22458    /// ```
22459    pub fn set_scenarios<T, V>(mut self, v: T) -> Self
22460    where
22461        T: std::iter::IntoIterator<Item = V>,
22462        V: std::convert::Into<crate::model::autotuning_config::Scenario>,
22463    {
22464        use std::iter::Iterator;
22465        self.scenarios = v.into_iter().map(|i| i.into()).collect();
22466        self
22467    }
22468}
22469
22470impl wkt::message::Message for AutotuningConfig {
22471    fn typename() -> &'static str {
22472        "type.googleapis.com/google.cloud.dataproc.v1.AutotuningConfig"
22473    }
22474}
22475
22476/// Defines additional types related to [AutotuningConfig].
22477pub mod autotuning_config {
22478    #[allow(unused_imports)]
22479    use super::*;
22480
22481    /// Scenario represents a specific goal that autotuning will attempt to achieve
22482    /// by modifying workloads.
22483    ///
22484    /// # Working with unknown values
22485    ///
22486    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22487    /// additional enum variants at any time. Adding new variants is not considered
22488    /// a breaking change. Applications should write their code in anticipation of:
22489    ///
22490    /// - New values appearing in future releases of the client library, **and**
22491    /// - New values received dynamically, without application changes.
22492    ///
22493    /// Please consult the [Working with enums] section in the user guide for some
22494    /// guidelines.
22495    ///
22496    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22497    #[derive(Clone, Debug, PartialEq)]
22498    #[non_exhaustive]
22499    pub enum Scenario {
22500        /// Default value.
22501        Unspecified,
22502        /// Scaling recommendations such as initialExecutors.
22503        Scaling,
22504        /// Adding hints for potential relation broadcasts.
22505        BroadcastHashJoin,
22506        /// Memory management for workloads.
22507        Memory,
22508        /// No autotuning.
22509        None,
22510        /// Automatic selection of scenarios.
22511        Auto,
22512        /// If set, the enum was initialized with an unknown value.
22513        ///
22514        /// Applications can examine the value using [Scenario::value] or
22515        /// [Scenario::name].
22516        UnknownValue(scenario::UnknownValue),
22517    }
22518
22519    #[doc(hidden)]
22520    pub mod scenario {
22521        #[allow(unused_imports)]
22522        use super::*;
22523        #[derive(Clone, Debug, PartialEq)]
22524        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22525    }
22526
22527    impl Scenario {
22528        /// Gets the enum value.
22529        ///
22530        /// Returns `None` if the enum contains an unknown value deserialized from
22531        /// the string representation of enums.
22532        pub fn value(&self) -> std::option::Option<i32> {
22533            match self {
22534                Self::Unspecified => std::option::Option::Some(0),
22535                Self::Scaling => std::option::Option::Some(2),
22536                Self::BroadcastHashJoin => std::option::Option::Some(3),
22537                Self::Memory => std::option::Option::Some(4),
22538                Self::None => std::option::Option::Some(5),
22539                Self::Auto => std::option::Option::Some(6),
22540                Self::UnknownValue(u) => u.0.value(),
22541            }
22542        }
22543
22544        /// Gets the enum value as a string.
22545        ///
22546        /// Returns `None` if the enum contains an unknown value deserialized from
22547        /// the integer representation of enums.
22548        pub fn name(&self) -> std::option::Option<&str> {
22549            match self {
22550                Self::Unspecified => std::option::Option::Some("SCENARIO_UNSPECIFIED"),
22551                Self::Scaling => std::option::Option::Some("SCALING"),
22552                Self::BroadcastHashJoin => std::option::Option::Some("BROADCAST_HASH_JOIN"),
22553                Self::Memory => std::option::Option::Some("MEMORY"),
22554                Self::None => std::option::Option::Some("NONE"),
22555                Self::Auto => std::option::Option::Some("AUTO"),
22556                Self::UnknownValue(u) => u.0.name(),
22557            }
22558        }
22559    }
22560
22561    impl std::default::Default for Scenario {
22562        fn default() -> Self {
22563            use std::convert::From;
22564            Self::from(0)
22565        }
22566    }
22567
22568    impl std::fmt::Display for Scenario {
22569        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22570            wkt::internal::display_enum(f, self.name(), self.value())
22571        }
22572    }
22573
22574    impl std::convert::From<i32> for Scenario {
22575        fn from(value: i32) -> Self {
22576            match value {
22577                0 => Self::Unspecified,
22578                2 => Self::Scaling,
22579                3 => Self::BroadcastHashJoin,
22580                4 => Self::Memory,
22581                5 => Self::None,
22582                6 => Self::Auto,
22583                _ => Self::UnknownValue(scenario::UnknownValue(
22584                    wkt::internal::UnknownEnumValue::Integer(value),
22585                )),
22586            }
22587        }
22588    }
22589
22590    impl std::convert::From<&str> for Scenario {
22591        fn from(value: &str) -> Self {
22592            use std::string::ToString;
22593            match value {
22594                "SCENARIO_UNSPECIFIED" => Self::Unspecified,
22595                "SCALING" => Self::Scaling,
22596                "BROADCAST_HASH_JOIN" => Self::BroadcastHashJoin,
22597                "MEMORY" => Self::Memory,
22598                "NONE" => Self::None,
22599                "AUTO" => Self::Auto,
22600                _ => Self::UnknownValue(scenario::UnknownValue(
22601                    wkt::internal::UnknownEnumValue::String(value.to_string()),
22602                )),
22603            }
22604        }
22605    }
22606
22607    impl serde::ser::Serialize for Scenario {
22608        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22609        where
22610            S: serde::Serializer,
22611        {
22612            match self {
22613                Self::Unspecified => serializer.serialize_i32(0),
22614                Self::Scaling => serializer.serialize_i32(2),
22615                Self::BroadcastHashJoin => serializer.serialize_i32(3),
22616                Self::Memory => serializer.serialize_i32(4),
22617                Self::None => serializer.serialize_i32(5),
22618                Self::Auto => serializer.serialize_i32(6),
22619                Self::UnknownValue(u) => u.0.serialize(serializer),
22620            }
22621        }
22622    }
22623
22624    impl<'de> serde::de::Deserialize<'de> for Scenario {
22625        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22626        where
22627            D: serde::Deserializer<'de>,
22628        {
22629            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scenario>::new(
22630                ".google.cloud.dataproc.v1.AutotuningConfig.Scenario",
22631            ))
22632        }
22633    }
22634}
22635
22636/// Configuration for dependency repositories
22637#[derive(Clone, Default, PartialEq)]
22638#[non_exhaustive]
22639pub struct RepositoryConfig {
22640    /// Optional. Configuration for PyPi repository.
22641    pub pypi_repository_config: std::option::Option<crate::model::PyPiRepositoryConfig>,
22642
22643    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22644}
22645
22646impl RepositoryConfig {
22647    /// Creates a new default instance.
22648    pub fn new() -> Self {
22649        std::default::Default::default()
22650    }
22651
22652    /// Sets the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
22653    ///
22654    /// # Example
22655    /// ```ignore,no_run
22656    /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
22657    /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22658    /// let x = RepositoryConfig::new().set_pypi_repository_config(PyPiRepositoryConfig::default()/* use setters */);
22659    /// ```
22660    pub fn set_pypi_repository_config<T>(mut self, v: T) -> Self
22661    where
22662        T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
22663    {
22664        self.pypi_repository_config = std::option::Option::Some(v.into());
22665        self
22666    }
22667
22668    /// Sets or clears the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
22669    ///
22670    /// # Example
22671    /// ```ignore,no_run
22672    /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
22673    /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22674    /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(Some(PyPiRepositoryConfig::default()/* use setters */));
22675    /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(None::<PyPiRepositoryConfig>);
22676    /// ```
22677    pub fn set_or_clear_pypi_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
22678    where
22679        T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
22680    {
22681        self.pypi_repository_config = v.map(|x| x.into());
22682        self
22683    }
22684}
22685
22686impl wkt::message::Message for RepositoryConfig {
22687    fn typename() -> &'static str {
22688        "type.googleapis.com/google.cloud.dataproc.v1.RepositoryConfig"
22689    }
22690}
22691
22692/// Configuration for PyPi repository
22693#[derive(Clone, Default, PartialEq)]
22694#[non_exhaustive]
22695pub struct PyPiRepositoryConfig {
22696    /// Optional. PyPi repository address
22697    pub pypi_repository: std::string::String,
22698
22699    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22700}
22701
22702impl PyPiRepositoryConfig {
22703    /// Creates a new default instance.
22704    pub fn new() -> Self {
22705        std::default::Default::default()
22706    }
22707
22708    /// Sets the value of [pypi_repository][crate::model::PyPiRepositoryConfig::pypi_repository].
22709    ///
22710    /// # Example
22711    /// ```ignore,no_run
22712    /// # use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22713    /// let x = PyPiRepositoryConfig::new().set_pypi_repository("example");
22714    /// ```
22715    pub fn set_pypi_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22716        self.pypi_repository = v.into();
22717        self
22718    }
22719}
22720
22721impl wkt::message::Message for PyPiRepositoryConfig {
22722    fn typename() -> &'static str {
22723        "type.googleapis.com/google.cloud.dataproc.v1.PyPiRepositoryConfig"
22724    }
22725}
22726
22727/// A Dataproc workflow template resource.
22728#[derive(Clone, Default, PartialEq)]
22729#[non_exhaustive]
22730pub struct WorkflowTemplate {
22731    #[allow(missing_docs)]
22732    pub id: std::string::String,
22733
22734    /// Output only. The resource name of the workflow template, as described
22735    /// in <https://cloud.google.com/apis/design/resource_names>.
22736    ///
22737    /// * For `projects.regions.workflowTemplates`, the resource name of the
22738    ///   template has the following format:
22739    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
22740    ///
22741    /// * For `projects.locations.workflowTemplates`, the resource name of the
22742    ///   template has the following format:
22743    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
22744    ///
22745    pub name: std::string::String,
22746
22747    /// Optional. Used to perform a consistent read-modify-write.
22748    ///
22749    /// This field should be left blank for a `CreateWorkflowTemplate` request. It
22750    /// is required for an `UpdateWorkflowTemplate` request, and must match the
22751    /// current server version. A typical update template flow would fetch the
22752    /// current template with a `GetWorkflowTemplate` request, which will return
22753    /// the current template with the `version` field filled in with the
22754    /// current server version. The user updates other fields in the template,
22755    /// then returns it as part of the `UpdateWorkflowTemplate` request.
22756    pub version: i32,
22757
22758    /// Output only. The time template was created.
22759    pub create_time: std::option::Option<wkt::Timestamp>,
22760
22761    /// Output only. The time template was last updated.
22762    pub update_time: std::option::Option<wkt::Timestamp>,
22763
22764    /// Optional. The labels to associate with this template. These labels
22765    /// will be propagated to all jobs and clusters created by the workflow
22766    /// instance.
22767    ///
22768    /// Label **keys** must contain 1 to 63 characters, and must conform to
22769    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22770    ///
22771    /// Label **values** may be empty, but, if present, must contain 1 to 63
22772    /// characters, and must conform to
22773    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22774    ///
22775    /// No more than 32 labels can be associated with a template.
22776    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22777
22778    /// Required. WorkflowTemplate scheduling information.
22779    pub placement: std::option::Option<crate::model::WorkflowTemplatePlacement>,
22780
22781    /// Required. The Directed Acyclic Graph of Jobs to submit.
22782    pub jobs: std::vec::Vec<crate::model::OrderedJob>,
22783
22784    /// Optional. Template parameters whose values are substituted into the
22785    /// template. Values for parameters must be provided when the template is
22786    /// instantiated.
22787    pub parameters: std::vec::Vec<crate::model::TemplateParameter>,
22788
22789    /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
22790    /// [JSON representation of
22791    /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
22792    /// The timeout duration must be from 10 minutes ("600s") to 24 hours
22793    /// ("86400s"). The timer begins when the first job is submitted. If the
22794    /// workflow is running at the end of the timeout period, any remaining jobs
22795    /// are cancelled, the workflow is ended, and if the workflow was running on a
22796    /// [managed
22797    /// cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
22798    /// the cluster is deleted.
22799    pub dag_timeout: std::option::Option<wkt::Duration>,
22800
22801    /// Optional. Encryption settings for encrypting workflow template job
22802    /// arguments.
22803    pub encryption_config: std::option::Option<crate::model::workflow_template::EncryptionConfig>,
22804
22805    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22806}
22807
22808impl WorkflowTemplate {
22809    /// Creates a new default instance.
22810    pub fn new() -> Self {
22811        std::default::Default::default()
22812    }
22813
22814    /// Sets the value of [id][crate::model::WorkflowTemplate::id].
22815    ///
22816    /// # Example
22817    /// ```ignore,no_run
22818    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22819    /// let x = WorkflowTemplate::new().set_id("example");
22820    /// ```
22821    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22822        self.id = v.into();
22823        self
22824    }
22825
22826    /// Sets the value of [name][crate::model::WorkflowTemplate::name].
22827    ///
22828    /// # Example
22829    /// ```ignore,no_run
22830    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22831    /// let x = WorkflowTemplate::new().set_name("example");
22832    /// ```
22833    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22834        self.name = v.into();
22835        self
22836    }
22837
22838    /// Sets the value of [version][crate::model::WorkflowTemplate::version].
22839    ///
22840    /// # Example
22841    /// ```ignore,no_run
22842    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22843    /// let x = WorkflowTemplate::new().set_version(42);
22844    /// ```
22845    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22846        self.version = v.into();
22847        self
22848    }
22849
22850    /// Sets the value of [create_time][crate::model::WorkflowTemplate::create_time].
22851    ///
22852    /// # Example
22853    /// ```ignore,no_run
22854    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22855    /// use wkt::Timestamp;
22856    /// let x = WorkflowTemplate::new().set_create_time(Timestamp::default()/* use setters */);
22857    /// ```
22858    pub fn set_create_time<T>(mut self, v: T) -> Self
22859    where
22860        T: std::convert::Into<wkt::Timestamp>,
22861    {
22862        self.create_time = std::option::Option::Some(v.into());
22863        self
22864    }
22865
22866    /// Sets or clears the value of [create_time][crate::model::WorkflowTemplate::create_time].
22867    ///
22868    /// # Example
22869    /// ```ignore,no_run
22870    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22871    /// use wkt::Timestamp;
22872    /// let x = WorkflowTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
22873    /// let x = WorkflowTemplate::new().set_or_clear_create_time(None::<Timestamp>);
22874    /// ```
22875    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
22876    where
22877        T: std::convert::Into<wkt::Timestamp>,
22878    {
22879        self.create_time = v.map(|x| x.into());
22880        self
22881    }
22882
22883    /// Sets the value of [update_time][crate::model::WorkflowTemplate::update_time].
22884    ///
22885    /// # Example
22886    /// ```ignore,no_run
22887    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22888    /// use wkt::Timestamp;
22889    /// let x = WorkflowTemplate::new().set_update_time(Timestamp::default()/* use setters */);
22890    /// ```
22891    pub fn set_update_time<T>(mut self, v: T) -> Self
22892    where
22893        T: std::convert::Into<wkt::Timestamp>,
22894    {
22895        self.update_time = std::option::Option::Some(v.into());
22896        self
22897    }
22898
22899    /// Sets or clears the value of [update_time][crate::model::WorkflowTemplate::update_time].
22900    ///
22901    /// # Example
22902    /// ```ignore,no_run
22903    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22904    /// use wkt::Timestamp;
22905    /// let x = WorkflowTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
22906    /// let x = WorkflowTemplate::new().set_or_clear_update_time(None::<Timestamp>);
22907    /// ```
22908    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
22909    where
22910        T: std::convert::Into<wkt::Timestamp>,
22911    {
22912        self.update_time = v.map(|x| x.into());
22913        self
22914    }
22915
22916    /// Sets the value of [labels][crate::model::WorkflowTemplate::labels].
22917    ///
22918    /// # Example
22919    /// ```ignore,no_run
22920    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22921    /// let x = WorkflowTemplate::new().set_labels([
22922    ///     ("key0", "abc"),
22923    ///     ("key1", "xyz"),
22924    /// ]);
22925    /// ```
22926    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22927    where
22928        T: std::iter::IntoIterator<Item = (K, V)>,
22929        K: std::convert::Into<std::string::String>,
22930        V: std::convert::Into<std::string::String>,
22931    {
22932        use std::iter::Iterator;
22933        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22934        self
22935    }
22936
22937    /// Sets the value of [placement][crate::model::WorkflowTemplate::placement].
22938    ///
22939    /// # Example
22940    /// ```ignore,no_run
22941    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22942    /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22943    /// let x = WorkflowTemplate::new().set_placement(WorkflowTemplatePlacement::default()/* use setters */);
22944    /// ```
22945    pub fn set_placement<T>(mut self, v: T) -> Self
22946    where
22947        T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22948    {
22949        self.placement = std::option::Option::Some(v.into());
22950        self
22951    }
22952
22953    /// Sets or clears the value of [placement][crate::model::WorkflowTemplate::placement].
22954    ///
22955    /// # Example
22956    /// ```ignore,no_run
22957    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22958    /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22959    /// let x = WorkflowTemplate::new().set_or_clear_placement(Some(WorkflowTemplatePlacement::default()/* use setters */));
22960    /// let x = WorkflowTemplate::new().set_or_clear_placement(None::<WorkflowTemplatePlacement>);
22961    /// ```
22962    pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
22963    where
22964        T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22965    {
22966        self.placement = v.map(|x| x.into());
22967        self
22968    }
22969
22970    /// Sets the value of [jobs][crate::model::WorkflowTemplate::jobs].
22971    ///
22972    /// # Example
22973    /// ```ignore,no_run
22974    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22975    /// use google_cloud_dataproc_v1::model::OrderedJob;
22976    /// let x = WorkflowTemplate::new()
22977    ///     .set_jobs([
22978    ///         OrderedJob::default()/* use setters */,
22979    ///         OrderedJob::default()/* use (different) setters */,
22980    ///     ]);
22981    /// ```
22982    pub fn set_jobs<T, V>(mut self, v: T) -> Self
22983    where
22984        T: std::iter::IntoIterator<Item = V>,
22985        V: std::convert::Into<crate::model::OrderedJob>,
22986    {
22987        use std::iter::Iterator;
22988        self.jobs = v.into_iter().map(|i| i.into()).collect();
22989        self
22990    }
22991
22992    /// Sets the value of [parameters][crate::model::WorkflowTemplate::parameters].
22993    ///
22994    /// # Example
22995    /// ```ignore,no_run
22996    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22997    /// use google_cloud_dataproc_v1::model::TemplateParameter;
22998    /// let x = WorkflowTemplate::new()
22999    ///     .set_parameters([
23000    ///         TemplateParameter::default()/* use setters */,
23001    ///         TemplateParameter::default()/* use (different) setters */,
23002    ///     ]);
23003    /// ```
23004    pub fn set_parameters<T, V>(mut self, v: T) -> Self
23005    where
23006        T: std::iter::IntoIterator<Item = V>,
23007        V: std::convert::Into<crate::model::TemplateParameter>,
23008    {
23009        use std::iter::Iterator;
23010        self.parameters = v.into_iter().map(|i| i.into()).collect();
23011        self
23012    }
23013
23014    /// Sets the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
23015    ///
23016    /// # Example
23017    /// ```ignore,no_run
23018    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23019    /// use wkt::Duration;
23020    /// let x = WorkflowTemplate::new().set_dag_timeout(Duration::default()/* use setters */);
23021    /// ```
23022    pub fn set_dag_timeout<T>(mut self, v: T) -> Self
23023    where
23024        T: std::convert::Into<wkt::Duration>,
23025    {
23026        self.dag_timeout = std::option::Option::Some(v.into());
23027        self
23028    }
23029
23030    /// Sets or clears the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
23031    ///
23032    /// # Example
23033    /// ```ignore,no_run
23034    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23035    /// use wkt::Duration;
23036    /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
23037    /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(None::<Duration>);
23038    /// ```
23039    pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
23040    where
23041        T: std::convert::Into<wkt::Duration>,
23042    {
23043        self.dag_timeout = v.map(|x| x.into());
23044        self
23045    }
23046
23047    /// Sets the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
23048    ///
23049    /// # Example
23050    /// ```ignore,no_run
23051    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23052    /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
23053    /// let x = WorkflowTemplate::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
23054    /// ```
23055    pub fn set_encryption_config<T>(mut self, v: T) -> Self
23056    where
23057        T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
23058    {
23059        self.encryption_config = std::option::Option::Some(v.into());
23060        self
23061    }
23062
23063    /// Sets or clears the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
23064    ///
23065    /// # Example
23066    /// ```ignore,no_run
23067    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23068    /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
23069    /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
23070    /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
23071    /// ```
23072    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
23073    where
23074        T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
23075    {
23076        self.encryption_config = v.map(|x| x.into());
23077        self
23078    }
23079}
23080
23081impl wkt::message::Message for WorkflowTemplate {
23082    fn typename() -> &'static str {
23083        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate"
23084    }
23085}
23086
23087/// Defines additional types related to [WorkflowTemplate].
23088pub mod workflow_template {
23089    #[allow(unused_imports)]
23090    use super::*;
23091
23092    /// Encryption settings for encrypting workflow template job arguments.
23093    #[derive(Clone, Default, PartialEq)]
23094    #[non_exhaustive]
23095    pub struct EncryptionConfig {
23096        /// Optional. The Cloud KMS key name to use for encrypting
23097        /// workflow template job arguments.
23098        ///
23099        /// When this this key is provided, the following workflow template
23100        /// [job arguments]
23101        /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template>),
23102        /// if present, are
23103        /// [CMEK
23104        /// encrypted](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data):
23105        ///
23106        /// * [FlinkJob
23107        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
23108        /// * [HadoopJob
23109        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
23110        /// * [SparkJob
23111        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
23112        /// * [SparkRJob
23113        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
23114        /// * [PySparkJob
23115        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
23116        /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
23117        ///   scriptVariables and queryList.queries
23118        /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
23119        ///   scriptVariables and queryList.queries
23120        /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
23121        ///   scriptVariables and queryList.queries
23122        /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
23123        ///   scriptVariables and queryList.queries
23124        pub kms_key: std::string::String,
23125
23126        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23127    }
23128
23129    impl EncryptionConfig {
23130        /// Creates a new default instance.
23131        pub fn new() -> Self {
23132            std::default::Default::default()
23133        }
23134
23135        /// Sets the value of [kms_key][crate::model::workflow_template::EncryptionConfig::kms_key].
23136        ///
23137        /// # Example
23138        /// ```ignore,no_run
23139        /// # use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
23140        /// let x = EncryptionConfig::new().set_kms_key("example");
23141        /// ```
23142        pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23143            self.kms_key = v.into();
23144            self
23145        }
23146    }
23147
23148    impl wkt::message::Message for EncryptionConfig {
23149        fn typename() -> &'static str {
23150            "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate.EncryptionConfig"
23151        }
23152    }
23153}
23154
23155/// Specifies workflow execution target.
23156///
23157/// Either `managed_cluster` or `cluster_selector` is required.
23158#[derive(Clone, Default, PartialEq)]
23159#[non_exhaustive]
23160pub struct WorkflowTemplatePlacement {
23161    /// Required. Specifies where workflow executes; either on a managed
23162    /// cluster or an existing cluster chosen by labels.
23163    pub placement: std::option::Option<crate::model::workflow_template_placement::Placement>,
23164
23165    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23166}
23167
23168impl WorkflowTemplatePlacement {
23169    /// Creates a new default instance.
23170    pub fn new() -> Self {
23171        std::default::Default::default()
23172    }
23173
23174    /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement].
23175    ///
23176    /// Note that all the setters affecting `placement` are mutually
23177    /// exclusive.
23178    ///
23179    /// # Example
23180    /// ```ignore,no_run
23181    /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23182    /// use google_cloud_dataproc_v1::model::ManagedCluster;
23183    /// let x = WorkflowTemplatePlacement::new().set_placement(Some(
23184    ///     google_cloud_dataproc_v1::model::workflow_template_placement::Placement::ManagedCluster(ManagedCluster::default().into())));
23185    /// ```
23186    pub fn set_placement<
23187        T: std::convert::Into<
23188                std::option::Option<crate::model::workflow_template_placement::Placement>,
23189            >,
23190    >(
23191        mut self,
23192        v: T,
23193    ) -> Self {
23194        self.placement = v.into();
23195        self
23196    }
23197
23198    /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23199    /// if it holds a `ManagedCluster`, `None` if the field is not set or
23200    /// holds a different branch.
23201    pub fn managed_cluster(
23202        &self,
23203    ) -> std::option::Option<&std::boxed::Box<crate::model::ManagedCluster>> {
23204        #[allow(unreachable_patterns)]
23205        self.placement.as_ref().and_then(|v| match v {
23206            crate::model::workflow_template_placement::Placement::ManagedCluster(v) => {
23207                std::option::Option::Some(v)
23208            }
23209            _ => std::option::Option::None,
23210        })
23211    }
23212
23213    /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23214    /// to hold a `ManagedCluster`.
23215    ///
23216    /// Note that all the setters affecting `placement` are
23217    /// mutually exclusive.
23218    ///
23219    /// # Example
23220    /// ```ignore,no_run
23221    /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23222    /// use google_cloud_dataproc_v1::model::ManagedCluster;
23223    /// let x = WorkflowTemplatePlacement::new().set_managed_cluster(ManagedCluster::default()/* use setters */);
23224    /// assert!(x.managed_cluster().is_some());
23225    /// assert!(x.cluster_selector().is_none());
23226    /// ```
23227    pub fn set_managed_cluster<
23228        T: std::convert::Into<std::boxed::Box<crate::model::ManagedCluster>>,
23229    >(
23230        mut self,
23231        v: T,
23232    ) -> Self {
23233        self.placement = std::option::Option::Some(
23234            crate::model::workflow_template_placement::Placement::ManagedCluster(v.into()),
23235        );
23236        self
23237    }
23238
23239    /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23240    /// if it holds a `ClusterSelector`, `None` if the field is not set or
23241    /// holds a different branch.
23242    pub fn cluster_selector(
23243        &self,
23244    ) -> std::option::Option<&std::boxed::Box<crate::model::ClusterSelector>> {
23245        #[allow(unreachable_patterns)]
23246        self.placement.as_ref().and_then(|v| match v {
23247            crate::model::workflow_template_placement::Placement::ClusterSelector(v) => {
23248                std::option::Option::Some(v)
23249            }
23250            _ => std::option::Option::None,
23251        })
23252    }
23253
23254    /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23255    /// to hold a `ClusterSelector`.
23256    ///
23257    /// Note that all the setters affecting `placement` are
23258    /// mutually exclusive.
23259    ///
23260    /// # Example
23261    /// ```ignore,no_run
23262    /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23263    /// use google_cloud_dataproc_v1::model::ClusterSelector;
23264    /// let x = WorkflowTemplatePlacement::new().set_cluster_selector(ClusterSelector::default()/* use setters */);
23265    /// assert!(x.cluster_selector().is_some());
23266    /// assert!(x.managed_cluster().is_none());
23267    /// ```
23268    pub fn set_cluster_selector<
23269        T: std::convert::Into<std::boxed::Box<crate::model::ClusterSelector>>,
23270    >(
23271        mut self,
23272        v: T,
23273    ) -> Self {
23274        self.placement = std::option::Option::Some(
23275            crate::model::workflow_template_placement::Placement::ClusterSelector(v.into()),
23276        );
23277        self
23278    }
23279}
23280
23281impl wkt::message::Message for WorkflowTemplatePlacement {
23282    fn typename() -> &'static str {
23283        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplatePlacement"
23284    }
23285}
23286
23287/// Defines additional types related to [WorkflowTemplatePlacement].
23288pub mod workflow_template_placement {
23289    #[allow(unused_imports)]
23290    use super::*;
23291
23292    /// Required. Specifies where workflow executes; either on a managed
23293    /// cluster or an existing cluster chosen by labels.
23294    #[derive(Clone, Debug, PartialEq)]
23295    #[non_exhaustive]
23296    pub enum Placement {
23297        /// A cluster that is managed by the workflow.
23298        ManagedCluster(std::boxed::Box<crate::model::ManagedCluster>),
23299        /// Optional. A selector that chooses target cluster for jobs based
23300        /// on metadata.
23301        ///
23302        /// The selector is evaluated at the time each job is submitted.
23303        ClusterSelector(std::boxed::Box<crate::model::ClusterSelector>),
23304    }
23305}
23306
23307/// Cluster that is managed by the workflow.
23308#[derive(Clone, Default, PartialEq)]
23309#[non_exhaustive]
23310pub struct ManagedCluster {
23311    /// Required. The cluster name prefix. A unique cluster name will be formed by
23312    /// appending a random suffix.
23313    ///
23314    /// The name must contain only lower-case letters (a-z), numbers (0-9),
23315    /// and hyphens (-). Must begin with a letter. Cannot begin or end with
23316    /// hyphen. Must consist of between 2 and 35 characters.
23317    pub cluster_name: std::string::String,
23318
23319    /// Required. The cluster configuration.
23320    pub config: std::option::Option<crate::model::ClusterConfig>,
23321
23322    /// Optional. The labels to associate with this cluster.
23323    ///
23324    /// Label keys must be between 1 and 63 characters long, and must conform to
23325    /// the following PCRE regular expression:
23326    /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
23327    ///
23328    /// Label values must be between 1 and 63 characters long, and must conform to
23329    /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
23330    ///
23331    /// No more than 32 labels can be associated with a given cluster.
23332    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23333
23334    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23335}
23336
23337impl ManagedCluster {
23338    /// Creates a new default instance.
23339    pub fn new() -> Self {
23340        std::default::Default::default()
23341    }
23342
23343    /// Sets the value of [cluster_name][crate::model::ManagedCluster::cluster_name].
23344    ///
23345    /// # Example
23346    /// ```ignore,no_run
23347    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23348    /// let x = ManagedCluster::new().set_cluster_name("example");
23349    /// ```
23350    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23351        self.cluster_name = v.into();
23352        self
23353    }
23354
23355    /// Sets the value of [config][crate::model::ManagedCluster::config].
23356    ///
23357    /// # Example
23358    /// ```ignore,no_run
23359    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23360    /// use google_cloud_dataproc_v1::model::ClusterConfig;
23361    /// let x = ManagedCluster::new().set_config(ClusterConfig::default()/* use setters */);
23362    /// ```
23363    pub fn set_config<T>(mut self, v: T) -> Self
23364    where
23365        T: std::convert::Into<crate::model::ClusterConfig>,
23366    {
23367        self.config = std::option::Option::Some(v.into());
23368        self
23369    }
23370
23371    /// Sets or clears the value of [config][crate::model::ManagedCluster::config].
23372    ///
23373    /// # Example
23374    /// ```ignore,no_run
23375    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23376    /// use google_cloud_dataproc_v1::model::ClusterConfig;
23377    /// let x = ManagedCluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
23378    /// let x = ManagedCluster::new().set_or_clear_config(None::<ClusterConfig>);
23379    /// ```
23380    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
23381    where
23382        T: std::convert::Into<crate::model::ClusterConfig>,
23383    {
23384        self.config = v.map(|x| x.into());
23385        self
23386    }
23387
23388    /// Sets the value of [labels][crate::model::ManagedCluster::labels].
23389    ///
23390    /// # Example
23391    /// ```ignore,no_run
23392    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23393    /// let x = ManagedCluster::new().set_labels([
23394    ///     ("key0", "abc"),
23395    ///     ("key1", "xyz"),
23396    /// ]);
23397    /// ```
23398    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23399    where
23400        T: std::iter::IntoIterator<Item = (K, V)>,
23401        K: std::convert::Into<std::string::String>,
23402        V: std::convert::Into<std::string::String>,
23403    {
23404        use std::iter::Iterator;
23405        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23406        self
23407    }
23408}
23409
23410impl wkt::message::Message for ManagedCluster {
23411    fn typename() -> &'static str {
23412        "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
23413    }
23414}
23415
23416/// A selector that chooses target cluster for jobs based on metadata.
23417#[derive(Clone, Default, PartialEq)]
23418#[non_exhaustive]
23419pub struct ClusterSelector {
23420    /// Optional. The zone where workflow process executes. This parameter does not
23421    /// affect the selection of the cluster.
23422    ///
23423    /// If unspecified, the zone of the first cluster matching the selector
23424    /// is used.
23425    pub zone: std::string::String,
23426
23427    /// Required. The cluster labels. Cluster must have all labels
23428    /// to match.
23429    pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
23430
23431    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23432}
23433
23434impl ClusterSelector {
23435    /// Creates a new default instance.
23436    pub fn new() -> Self {
23437        std::default::Default::default()
23438    }
23439
23440    /// Sets the value of [zone][crate::model::ClusterSelector::zone].
23441    ///
23442    /// # Example
23443    /// ```ignore,no_run
23444    /// # use google_cloud_dataproc_v1::model::ClusterSelector;
23445    /// let x = ClusterSelector::new().set_zone("example");
23446    /// ```
23447    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23448        self.zone = v.into();
23449        self
23450    }
23451
23452    /// Sets the value of [cluster_labels][crate::model::ClusterSelector::cluster_labels].
23453    ///
23454    /// # Example
23455    /// ```ignore,no_run
23456    /// # use google_cloud_dataproc_v1::model::ClusterSelector;
23457    /// let x = ClusterSelector::new().set_cluster_labels([
23458    ///     ("key0", "abc"),
23459    ///     ("key1", "xyz"),
23460    /// ]);
23461    /// ```
23462    pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
23463    where
23464        T: std::iter::IntoIterator<Item = (K, V)>,
23465        K: std::convert::Into<std::string::String>,
23466        V: std::convert::Into<std::string::String>,
23467    {
23468        use std::iter::Iterator;
23469        self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23470        self
23471    }
23472}
23473
23474impl wkt::message::Message for ClusterSelector {
23475    fn typename() -> &'static str {
23476        "type.googleapis.com/google.cloud.dataproc.v1.ClusterSelector"
23477    }
23478}
23479
23480/// A job executed by the workflow.
23481#[derive(Clone, Default, PartialEq)]
23482#[non_exhaustive]
23483pub struct OrderedJob {
23484    /// Required. The step id. The id must be unique among all jobs
23485    /// within the template.
23486    ///
23487    /// The step id is used as prefix for job id, as job
23488    /// `goog-dataproc-workflow-step-id` label, and in
23489    /// [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
23490    /// field from other steps.
23491    ///
23492    /// The id must contain only letters (a-z, A-Z), numbers (0-9),
23493    /// underscores (_), and hyphens (-). Cannot begin or end with underscore
23494    /// or hyphen. Must consist of between 3 and 50 characters.
23495    ///
23496    /// [google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]: crate::model::OrderedJob::prerequisite_step_ids
23497    pub step_id: std::string::String,
23498
23499    /// Optional. The labels to associate with this job.
23500    ///
23501    /// Label keys must be between 1 and 63 characters long, and must conform to
23502    /// the following regular expression:
23503    /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
23504    ///
23505    /// Label values must be between 1 and 63 characters long, and must conform to
23506    /// the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
23507    ///
23508    /// No more than 32 labels can be associated with a given job.
23509    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23510
23511    /// Optional. Job scheduling configuration.
23512    pub scheduling: std::option::Option<crate::model::JobScheduling>,
23513
23514    /// Optional. The optional list of prerequisite job step_ids.
23515    /// If not specified, the job will start at the beginning of workflow.
23516    pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
23517
23518    /// Required. The job definition.
23519    pub job_type: std::option::Option<crate::model::ordered_job::JobType>,
23520
23521    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23522}
23523
23524impl OrderedJob {
23525    /// Creates a new default instance.
23526    pub fn new() -> Self {
23527        std::default::Default::default()
23528    }
23529
23530    /// Sets the value of [step_id][crate::model::OrderedJob::step_id].
23531    ///
23532    /// # Example
23533    /// ```ignore,no_run
23534    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23535    /// let x = OrderedJob::new().set_step_id("example");
23536    /// ```
23537    pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23538        self.step_id = v.into();
23539        self
23540    }
23541
23542    /// Sets the value of [labels][crate::model::OrderedJob::labels].
23543    ///
23544    /// # Example
23545    /// ```ignore,no_run
23546    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23547    /// let x = OrderedJob::new().set_labels([
23548    ///     ("key0", "abc"),
23549    ///     ("key1", "xyz"),
23550    /// ]);
23551    /// ```
23552    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23553    where
23554        T: std::iter::IntoIterator<Item = (K, V)>,
23555        K: std::convert::Into<std::string::String>,
23556        V: std::convert::Into<std::string::String>,
23557    {
23558        use std::iter::Iterator;
23559        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23560        self
23561    }
23562
23563    /// Sets the value of [scheduling][crate::model::OrderedJob::scheduling].
23564    ///
23565    /// # Example
23566    /// ```ignore,no_run
23567    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23568    /// use google_cloud_dataproc_v1::model::JobScheduling;
23569    /// let x = OrderedJob::new().set_scheduling(JobScheduling::default()/* use setters */);
23570    /// ```
23571    pub fn set_scheduling<T>(mut self, v: T) -> Self
23572    where
23573        T: std::convert::Into<crate::model::JobScheduling>,
23574    {
23575        self.scheduling = std::option::Option::Some(v.into());
23576        self
23577    }
23578
23579    /// Sets or clears the value of [scheduling][crate::model::OrderedJob::scheduling].
23580    ///
23581    /// # Example
23582    /// ```ignore,no_run
23583    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23584    /// use google_cloud_dataproc_v1::model::JobScheduling;
23585    /// let x = OrderedJob::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
23586    /// let x = OrderedJob::new().set_or_clear_scheduling(None::<JobScheduling>);
23587    /// ```
23588    pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
23589    where
23590        T: std::convert::Into<crate::model::JobScheduling>,
23591    {
23592        self.scheduling = v.map(|x| x.into());
23593        self
23594    }
23595
23596    /// Sets the value of [prerequisite_step_ids][crate::model::OrderedJob::prerequisite_step_ids].
23597    ///
23598    /// # Example
23599    /// ```ignore,no_run
23600    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23601    /// let x = OrderedJob::new().set_prerequisite_step_ids(["a", "b", "c"]);
23602    /// ```
23603    pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
23604    where
23605        T: std::iter::IntoIterator<Item = V>,
23606        V: std::convert::Into<std::string::String>,
23607    {
23608        use std::iter::Iterator;
23609        self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
23610        self
23611    }
23612
23613    /// Sets the value of [job_type][crate::model::OrderedJob::job_type].
23614    ///
23615    /// Note that all the setters affecting `job_type` are mutually
23616    /// exclusive.
23617    ///
23618    /// # Example
23619    /// ```ignore,no_run
23620    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23621    /// use google_cloud_dataproc_v1::model::HadoopJob;
23622    /// let x = OrderedJob::new().set_job_type(Some(
23623    ///     google_cloud_dataproc_v1::model::ordered_job::JobType::HadoopJob(HadoopJob::default().into())));
23624    /// ```
23625    pub fn set_job_type<
23626        T: std::convert::Into<std::option::Option<crate::model::ordered_job::JobType>>,
23627    >(
23628        mut self,
23629        v: T,
23630    ) -> Self {
23631        self.job_type = v.into();
23632        self
23633    }
23634
23635    /// The value of [job_type][crate::model::OrderedJob::job_type]
23636    /// if it holds a `HadoopJob`, `None` if the field is not set or
23637    /// holds a different branch.
23638    pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
23639        #[allow(unreachable_patterns)]
23640        self.job_type.as_ref().and_then(|v| match v {
23641            crate::model::ordered_job::JobType::HadoopJob(v) => std::option::Option::Some(v),
23642            _ => std::option::Option::None,
23643        })
23644    }
23645
23646    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23647    /// to hold a `HadoopJob`.
23648    ///
23649    /// Note that all the setters affecting `job_type` are
23650    /// mutually exclusive.
23651    ///
23652    /// # Example
23653    /// ```ignore,no_run
23654    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23655    /// use google_cloud_dataproc_v1::model::HadoopJob;
23656    /// let x = OrderedJob::new().set_hadoop_job(HadoopJob::default()/* use setters */);
23657    /// assert!(x.hadoop_job().is_some());
23658    /// assert!(x.spark_job().is_none());
23659    /// assert!(x.pyspark_job().is_none());
23660    /// assert!(x.hive_job().is_none());
23661    /// assert!(x.pig_job().is_none());
23662    /// assert!(x.spark_r_job().is_none());
23663    /// assert!(x.spark_sql_job().is_none());
23664    /// assert!(x.presto_job().is_none());
23665    /// assert!(x.trino_job().is_none());
23666    /// assert!(x.flink_job().is_none());
23667    /// ```
23668    pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
23669        mut self,
23670        v: T,
23671    ) -> Self {
23672        self.job_type =
23673            std::option::Option::Some(crate::model::ordered_job::JobType::HadoopJob(v.into()));
23674        self
23675    }
23676
23677    /// The value of [job_type][crate::model::OrderedJob::job_type]
23678    /// if it holds a `SparkJob`, `None` if the field is not set or
23679    /// holds a different branch.
23680    pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
23681        #[allow(unreachable_patterns)]
23682        self.job_type.as_ref().and_then(|v| match v {
23683            crate::model::ordered_job::JobType::SparkJob(v) => std::option::Option::Some(v),
23684            _ => std::option::Option::None,
23685        })
23686    }
23687
23688    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23689    /// to hold a `SparkJob`.
23690    ///
23691    /// Note that all the setters affecting `job_type` are
23692    /// mutually exclusive.
23693    ///
23694    /// # Example
23695    /// ```ignore,no_run
23696    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23697    /// use google_cloud_dataproc_v1::model::SparkJob;
23698    /// let x = OrderedJob::new().set_spark_job(SparkJob::default()/* use setters */);
23699    /// assert!(x.spark_job().is_some());
23700    /// assert!(x.hadoop_job().is_none());
23701    /// assert!(x.pyspark_job().is_none());
23702    /// assert!(x.hive_job().is_none());
23703    /// assert!(x.pig_job().is_none());
23704    /// assert!(x.spark_r_job().is_none());
23705    /// assert!(x.spark_sql_job().is_none());
23706    /// assert!(x.presto_job().is_none());
23707    /// assert!(x.trino_job().is_none());
23708    /// assert!(x.flink_job().is_none());
23709    /// ```
23710    pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
23711        mut self,
23712        v: T,
23713    ) -> Self {
23714        self.job_type =
23715            std::option::Option::Some(crate::model::ordered_job::JobType::SparkJob(v.into()));
23716        self
23717    }
23718
23719    /// The value of [job_type][crate::model::OrderedJob::job_type]
23720    /// if it holds a `PysparkJob`, `None` if the field is not set or
23721    /// holds a different branch.
23722    pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
23723        #[allow(unreachable_patterns)]
23724        self.job_type.as_ref().and_then(|v| match v {
23725            crate::model::ordered_job::JobType::PysparkJob(v) => std::option::Option::Some(v),
23726            _ => std::option::Option::None,
23727        })
23728    }
23729
23730    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23731    /// to hold a `PysparkJob`.
23732    ///
23733    /// Note that all the setters affecting `job_type` are
23734    /// mutually exclusive.
23735    ///
23736    /// # Example
23737    /// ```ignore,no_run
23738    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23739    /// use google_cloud_dataproc_v1::model::PySparkJob;
23740    /// let x = OrderedJob::new().set_pyspark_job(PySparkJob::default()/* use setters */);
23741    /// assert!(x.pyspark_job().is_some());
23742    /// assert!(x.hadoop_job().is_none());
23743    /// assert!(x.spark_job().is_none());
23744    /// assert!(x.hive_job().is_none());
23745    /// assert!(x.pig_job().is_none());
23746    /// assert!(x.spark_r_job().is_none());
23747    /// assert!(x.spark_sql_job().is_none());
23748    /// assert!(x.presto_job().is_none());
23749    /// assert!(x.trino_job().is_none());
23750    /// assert!(x.flink_job().is_none());
23751    /// ```
23752    pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
23753        mut self,
23754        v: T,
23755    ) -> Self {
23756        self.job_type =
23757            std::option::Option::Some(crate::model::ordered_job::JobType::PysparkJob(v.into()));
23758        self
23759    }
23760
23761    /// The value of [job_type][crate::model::OrderedJob::job_type]
23762    /// if it holds a `HiveJob`, `None` if the field is not set or
23763    /// holds a different branch.
23764    pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
23765        #[allow(unreachable_patterns)]
23766        self.job_type.as_ref().and_then(|v| match v {
23767            crate::model::ordered_job::JobType::HiveJob(v) => std::option::Option::Some(v),
23768            _ => std::option::Option::None,
23769        })
23770    }
23771
23772    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23773    /// to hold a `HiveJob`.
23774    ///
23775    /// Note that all the setters affecting `job_type` are
23776    /// mutually exclusive.
23777    ///
23778    /// # Example
23779    /// ```ignore,no_run
23780    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23781    /// use google_cloud_dataproc_v1::model::HiveJob;
23782    /// let x = OrderedJob::new().set_hive_job(HiveJob::default()/* use setters */);
23783    /// assert!(x.hive_job().is_some());
23784    /// assert!(x.hadoop_job().is_none());
23785    /// assert!(x.spark_job().is_none());
23786    /// assert!(x.pyspark_job().is_none());
23787    /// assert!(x.pig_job().is_none());
23788    /// assert!(x.spark_r_job().is_none());
23789    /// assert!(x.spark_sql_job().is_none());
23790    /// assert!(x.presto_job().is_none());
23791    /// assert!(x.trino_job().is_none());
23792    /// assert!(x.flink_job().is_none());
23793    /// ```
23794    pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
23795        mut self,
23796        v: T,
23797    ) -> Self {
23798        self.job_type =
23799            std::option::Option::Some(crate::model::ordered_job::JobType::HiveJob(v.into()));
23800        self
23801    }
23802
23803    /// The value of [job_type][crate::model::OrderedJob::job_type]
23804    /// if it holds a `PigJob`, `None` if the field is not set or
23805    /// holds a different branch.
23806    pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
23807        #[allow(unreachable_patterns)]
23808        self.job_type.as_ref().and_then(|v| match v {
23809            crate::model::ordered_job::JobType::PigJob(v) => std::option::Option::Some(v),
23810            _ => std::option::Option::None,
23811        })
23812    }
23813
23814    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23815    /// to hold a `PigJob`.
23816    ///
23817    /// Note that all the setters affecting `job_type` are
23818    /// mutually exclusive.
23819    ///
23820    /// # Example
23821    /// ```ignore,no_run
23822    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23823    /// use google_cloud_dataproc_v1::model::PigJob;
23824    /// let x = OrderedJob::new().set_pig_job(PigJob::default()/* use setters */);
23825    /// assert!(x.pig_job().is_some());
23826    /// assert!(x.hadoop_job().is_none());
23827    /// assert!(x.spark_job().is_none());
23828    /// assert!(x.pyspark_job().is_none());
23829    /// assert!(x.hive_job().is_none());
23830    /// assert!(x.spark_r_job().is_none());
23831    /// assert!(x.spark_sql_job().is_none());
23832    /// assert!(x.presto_job().is_none());
23833    /// assert!(x.trino_job().is_none());
23834    /// assert!(x.flink_job().is_none());
23835    /// ```
23836    pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
23837        mut self,
23838        v: T,
23839    ) -> Self {
23840        self.job_type =
23841            std::option::Option::Some(crate::model::ordered_job::JobType::PigJob(v.into()));
23842        self
23843    }
23844
23845    /// The value of [job_type][crate::model::OrderedJob::job_type]
23846    /// if it holds a `SparkRJob`, `None` if the field is not set or
23847    /// holds a different branch.
23848    pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
23849        #[allow(unreachable_patterns)]
23850        self.job_type.as_ref().and_then(|v| match v {
23851            crate::model::ordered_job::JobType::SparkRJob(v) => std::option::Option::Some(v),
23852            _ => std::option::Option::None,
23853        })
23854    }
23855
23856    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23857    /// to hold a `SparkRJob`.
23858    ///
23859    /// Note that all the setters affecting `job_type` are
23860    /// mutually exclusive.
23861    ///
23862    /// # Example
23863    /// ```ignore,no_run
23864    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23865    /// use google_cloud_dataproc_v1::model::SparkRJob;
23866    /// let x = OrderedJob::new().set_spark_r_job(SparkRJob::default()/* use setters */);
23867    /// assert!(x.spark_r_job().is_some());
23868    /// assert!(x.hadoop_job().is_none());
23869    /// assert!(x.spark_job().is_none());
23870    /// assert!(x.pyspark_job().is_none());
23871    /// assert!(x.hive_job().is_none());
23872    /// assert!(x.pig_job().is_none());
23873    /// assert!(x.spark_sql_job().is_none());
23874    /// assert!(x.presto_job().is_none());
23875    /// assert!(x.trino_job().is_none());
23876    /// assert!(x.flink_job().is_none());
23877    /// ```
23878    pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
23879        mut self,
23880        v: T,
23881    ) -> Self {
23882        self.job_type =
23883            std::option::Option::Some(crate::model::ordered_job::JobType::SparkRJob(v.into()));
23884        self
23885    }
23886
23887    /// The value of [job_type][crate::model::OrderedJob::job_type]
23888    /// if it holds a `SparkSqlJob`, `None` if the field is not set or
23889    /// holds a different branch.
23890    pub fn spark_sql_job(
23891        &self,
23892    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
23893        #[allow(unreachable_patterns)]
23894        self.job_type.as_ref().and_then(|v| match v {
23895            crate::model::ordered_job::JobType::SparkSqlJob(v) => std::option::Option::Some(v),
23896            _ => std::option::Option::None,
23897        })
23898    }
23899
23900    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23901    /// to hold a `SparkSqlJob`.
23902    ///
23903    /// Note that all the setters affecting `job_type` are
23904    /// mutually exclusive.
23905    ///
23906    /// # Example
23907    /// ```ignore,no_run
23908    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23909    /// use google_cloud_dataproc_v1::model::SparkSqlJob;
23910    /// let x = OrderedJob::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
23911    /// assert!(x.spark_sql_job().is_some());
23912    /// assert!(x.hadoop_job().is_none());
23913    /// assert!(x.spark_job().is_none());
23914    /// assert!(x.pyspark_job().is_none());
23915    /// assert!(x.hive_job().is_none());
23916    /// assert!(x.pig_job().is_none());
23917    /// assert!(x.spark_r_job().is_none());
23918    /// assert!(x.presto_job().is_none());
23919    /// assert!(x.trino_job().is_none());
23920    /// assert!(x.flink_job().is_none());
23921    /// ```
23922    pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
23923        mut self,
23924        v: T,
23925    ) -> Self {
23926        self.job_type =
23927            std::option::Option::Some(crate::model::ordered_job::JobType::SparkSqlJob(v.into()));
23928        self
23929    }
23930
23931    /// The value of [job_type][crate::model::OrderedJob::job_type]
23932    /// if it holds a `PrestoJob`, `None` if the field is not set or
23933    /// holds a different branch.
23934    pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
23935        #[allow(unreachable_patterns)]
23936        self.job_type.as_ref().and_then(|v| match v {
23937            crate::model::ordered_job::JobType::PrestoJob(v) => std::option::Option::Some(v),
23938            _ => std::option::Option::None,
23939        })
23940    }
23941
23942    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23943    /// to hold a `PrestoJob`.
23944    ///
23945    /// Note that all the setters affecting `job_type` are
23946    /// mutually exclusive.
23947    ///
23948    /// # Example
23949    /// ```ignore,no_run
23950    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23951    /// use google_cloud_dataproc_v1::model::PrestoJob;
23952    /// let x = OrderedJob::new().set_presto_job(PrestoJob::default()/* use setters */);
23953    /// assert!(x.presto_job().is_some());
23954    /// assert!(x.hadoop_job().is_none());
23955    /// assert!(x.spark_job().is_none());
23956    /// assert!(x.pyspark_job().is_none());
23957    /// assert!(x.hive_job().is_none());
23958    /// assert!(x.pig_job().is_none());
23959    /// assert!(x.spark_r_job().is_none());
23960    /// assert!(x.spark_sql_job().is_none());
23961    /// assert!(x.trino_job().is_none());
23962    /// assert!(x.flink_job().is_none());
23963    /// ```
23964    pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
23965        mut self,
23966        v: T,
23967    ) -> Self {
23968        self.job_type =
23969            std::option::Option::Some(crate::model::ordered_job::JobType::PrestoJob(v.into()));
23970        self
23971    }
23972
23973    /// The value of [job_type][crate::model::OrderedJob::job_type]
23974    /// if it holds a `TrinoJob`, `None` if the field is not set or
23975    /// holds a different branch.
23976    pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
23977        #[allow(unreachable_patterns)]
23978        self.job_type.as_ref().and_then(|v| match v {
23979            crate::model::ordered_job::JobType::TrinoJob(v) => std::option::Option::Some(v),
23980            _ => std::option::Option::None,
23981        })
23982    }
23983
23984    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23985    /// to hold a `TrinoJob`.
23986    ///
23987    /// Note that all the setters affecting `job_type` are
23988    /// mutually exclusive.
23989    ///
23990    /// # Example
23991    /// ```ignore,no_run
23992    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23993    /// use google_cloud_dataproc_v1::model::TrinoJob;
23994    /// let x = OrderedJob::new().set_trino_job(TrinoJob::default()/* use setters */);
23995    /// assert!(x.trino_job().is_some());
23996    /// assert!(x.hadoop_job().is_none());
23997    /// assert!(x.spark_job().is_none());
23998    /// assert!(x.pyspark_job().is_none());
23999    /// assert!(x.hive_job().is_none());
24000    /// assert!(x.pig_job().is_none());
24001    /// assert!(x.spark_r_job().is_none());
24002    /// assert!(x.spark_sql_job().is_none());
24003    /// assert!(x.presto_job().is_none());
24004    /// assert!(x.flink_job().is_none());
24005    /// ```
24006    pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
24007        mut self,
24008        v: T,
24009    ) -> Self {
24010        self.job_type =
24011            std::option::Option::Some(crate::model::ordered_job::JobType::TrinoJob(v.into()));
24012        self
24013    }
24014
24015    /// The value of [job_type][crate::model::OrderedJob::job_type]
24016    /// if it holds a `FlinkJob`, `None` if the field is not set or
24017    /// holds a different branch.
24018    pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
24019        #[allow(unreachable_patterns)]
24020        self.job_type.as_ref().and_then(|v| match v {
24021            crate::model::ordered_job::JobType::FlinkJob(v) => std::option::Option::Some(v),
24022            _ => std::option::Option::None,
24023        })
24024    }
24025
24026    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24027    /// to hold a `FlinkJob`.
24028    ///
24029    /// Note that all the setters affecting `job_type` are
24030    /// mutually exclusive.
24031    ///
24032    /// # Example
24033    /// ```ignore,no_run
24034    /// # use google_cloud_dataproc_v1::model::OrderedJob;
24035    /// use google_cloud_dataproc_v1::model::FlinkJob;
24036    /// let x = OrderedJob::new().set_flink_job(FlinkJob::default()/* use setters */);
24037    /// assert!(x.flink_job().is_some());
24038    /// assert!(x.hadoop_job().is_none());
24039    /// assert!(x.spark_job().is_none());
24040    /// assert!(x.pyspark_job().is_none());
24041    /// assert!(x.hive_job().is_none());
24042    /// assert!(x.pig_job().is_none());
24043    /// assert!(x.spark_r_job().is_none());
24044    /// assert!(x.spark_sql_job().is_none());
24045    /// assert!(x.presto_job().is_none());
24046    /// assert!(x.trino_job().is_none());
24047    /// ```
24048    pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
24049        mut self,
24050        v: T,
24051    ) -> Self {
24052        self.job_type =
24053            std::option::Option::Some(crate::model::ordered_job::JobType::FlinkJob(v.into()));
24054        self
24055    }
24056}
24057
24058impl wkt::message::Message for OrderedJob {
24059    fn typename() -> &'static str {
24060        "type.googleapis.com/google.cloud.dataproc.v1.OrderedJob"
24061    }
24062}
24063
24064/// Defines additional types related to [OrderedJob].
24065pub mod ordered_job {
24066    #[allow(unused_imports)]
24067    use super::*;
24068
24069    /// Required. The job definition.
24070    #[derive(Clone, Debug, PartialEq)]
24071    #[non_exhaustive]
24072    pub enum JobType {
24073        /// Optional. Job is a Hadoop job.
24074        HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
24075        /// Optional. Job is a Spark job.
24076        SparkJob(std::boxed::Box<crate::model::SparkJob>),
24077        /// Optional. Job is a PySpark job.
24078        PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
24079        /// Optional. Job is a Hive job.
24080        HiveJob(std::boxed::Box<crate::model::HiveJob>),
24081        /// Optional. Job is a Pig job.
24082        PigJob(std::boxed::Box<crate::model::PigJob>),
24083        /// Optional. Job is a SparkR job.
24084        SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
24085        /// Optional. Job is a SparkSql job.
24086        SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
24087        /// Optional. Job is a Presto job.
24088        PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
24089        /// Optional. Job is a Trino job.
24090        TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
24091        /// Optional. Job is a Flink job.
24092        FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
24093    }
24094}
24095
24096/// A configurable parameter that replaces one or more fields in the template.
24097/// Parameterizable fields:
24098///
24099/// - Labels
24100/// - File uris
24101/// - Job properties
24102/// - Job arguments
24103/// - Script variables
24104/// - Main class (in HadoopJob and SparkJob)
24105/// - Zone (in ClusterSelector)
24106#[derive(Clone, Default, PartialEq)]
24107#[non_exhaustive]
24108pub struct TemplateParameter {
24109    /// Required. Parameter name.
24110    /// The parameter name is used as the key, and paired with the
24111    /// parameter value, which are passed to the template when the template
24112    /// is instantiated.
24113    /// The name must contain only capital letters (A-Z), numbers (0-9), and
24114    /// underscores (_), and must not start with a number. The maximum length is
24115    /// 40 characters.
24116    pub name: std::string::String,
24117
24118    /// Required. Paths to all fields that the parameter replaces.
24119    /// A field is allowed to appear in at most one parameter's list of field
24120    /// paths.
24121    ///
24122    /// A field path is similar in syntax to a
24123    /// [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
24124    /// field path that references the zone field of a workflow template's cluster
24125    /// selector would be specified as `placement.clusterSelector.zone`.
24126    ///
24127    /// Also, field paths can reference fields using the following syntax:
24128    ///
24129    /// * Values in maps can be referenced by key:
24130    ///
24131    ///   * labels['key']
24132    ///   * placement.clusterSelector.clusterLabels['key']
24133    ///   * placement.managedCluster.labels['key']
24134    ///   * placement.clusterSelector.clusterLabels['key']
24135    ///   * jobs['step-id'].labels['key']
24136    /// * Jobs in the jobs list can be referenced by step-id:
24137    ///
24138    ///   * jobs['step-id'].hadoopJob.mainJarFileUri
24139    ///   * jobs['step-id'].hiveJob.queryFileUri
24140    ///   * jobs['step-id'].pySparkJob.mainPythonFileUri
24141    ///   * jobs['step-id'].hadoopJob.jarFileUris[0]
24142    ///   * jobs['step-id'].hadoopJob.archiveUris[0]
24143    ///   * jobs['step-id'].hadoopJob.fileUris[0]
24144    ///   * jobs['step-id'].pySparkJob.pythonFileUris[0]
24145    /// * Items in repeated fields can be referenced by a zero-based index:
24146    ///
24147    ///   * jobs['step-id'].sparkJob.args[0]
24148    /// * Other examples:
24149    ///
24150    ///   * jobs['step-id'].hadoopJob.properties['key']
24151    ///   * jobs['step-id'].hadoopJob.args[0]
24152    ///   * jobs['step-id'].hiveJob.scriptVariables['key']
24153    ///   * jobs['step-id'].hadoopJob.mainJarFileUri
24154    ///   * placement.clusterSelector.zone
24155    ///
24156    /// It may not be possible to parameterize maps and repeated fields in their
24157    /// entirety since only individual map values and individual items in repeated
24158    /// fields can be referenced. For example, the following field paths are
24159    /// invalid:
24160    ///
24161    /// - placement.clusterSelector.clusterLabels
24162    /// - jobs['step-id'].sparkJob.args
24163    ///
24164    /// [google.protobuf.FieldMask]: wkt::FieldMask
24165    pub fields: std::vec::Vec<std::string::String>,
24166
24167    /// Optional. Brief description of the parameter.
24168    /// Must not exceed 1024 characters.
24169    pub description: std::string::String,
24170
24171    /// Optional. Validation rules to be applied to this parameter's value.
24172    pub validation: std::option::Option<crate::model::ParameterValidation>,
24173
24174    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24175}
24176
24177impl TemplateParameter {
24178    /// Creates a new default instance.
24179    pub fn new() -> Self {
24180        std::default::Default::default()
24181    }
24182
24183    /// Sets the value of [name][crate::model::TemplateParameter::name].
24184    ///
24185    /// # Example
24186    /// ```ignore,no_run
24187    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24188    /// let x = TemplateParameter::new().set_name("example");
24189    /// ```
24190    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24191        self.name = v.into();
24192        self
24193    }
24194
24195    /// Sets the value of [fields][crate::model::TemplateParameter::fields].
24196    ///
24197    /// # Example
24198    /// ```ignore,no_run
24199    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24200    /// let x = TemplateParameter::new().set_fields(["a", "b", "c"]);
24201    /// ```
24202    pub fn set_fields<T, V>(mut self, v: T) -> Self
24203    where
24204        T: std::iter::IntoIterator<Item = V>,
24205        V: std::convert::Into<std::string::String>,
24206    {
24207        use std::iter::Iterator;
24208        self.fields = v.into_iter().map(|i| i.into()).collect();
24209        self
24210    }
24211
24212    /// Sets the value of [description][crate::model::TemplateParameter::description].
24213    ///
24214    /// # Example
24215    /// ```ignore,no_run
24216    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24217    /// let x = TemplateParameter::new().set_description("example");
24218    /// ```
24219    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24220        self.description = v.into();
24221        self
24222    }
24223
24224    /// Sets the value of [validation][crate::model::TemplateParameter::validation].
24225    ///
24226    /// # Example
24227    /// ```ignore,no_run
24228    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24229    /// use google_cloud_dataproc_v1::model::ParameterValidation;
24230    /// let x = TemplateParameter::new().set_validation(ParameterValidation::default()/* use setters */);
24231    /// ```
24232    pub fn set_validation<T>(mut self, v: T) -> Self
24233    where
24234        T: std::convert::Into<crate::model::ParameterValidation>,
24235    {
24236        self.validation = std::option::Option::Some(v.into());
24237        self
24238    }
24239
24240    /// Sets or clears the value of [validation][crate::model::TemplateParameter::validation].
24241    ///
24242    /// # Example
24243    /// ```ignore,no_run
24244    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24245    /// use google_cloud_dataproc_v1::model::ParameterValidation;
24246    /// let x = TemplateParameter::new().set_or_clear_validation(Some(ParameterValidation::default()/* use setters */));
24247    /// let x = TemplateParameter::new().set_or_clear_validation(None::<ParameterValidation>);
24248    /// ```
24249    pub fn set_or_clear_validation<T>(mut self, v: std::option::Option<T>) -> Self
24250    where
24251        T: std::convert::Into<crate::model::ParameterValidation>,
24252    {
24253        self.validation = v.map(|x| x.into());
24254        self
24255    }
24256}
24257
24258impl wkt::message::Message for TemplateParameter {
24259    fn typename() -> &'static str {
24260        "type.googleapis.com/google.cloud.dataproc.v1.TemplateParameter"
24261    }
24262}
24263
24264/// Configuration for parameter validation.
24265#[derive(Clone, Default, PartialEq)]
24266#[non_exhaustive]
24267pub struct ParameterValidation {
24268    /// Required. The type of validation to be performed.
24269    pub validation_type: std::option::Option<crate::model::parameter_validation::ValidationType>,
24270
24271    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24272}
24273
24274impl ParameterValidation {
24275    /// Creates a new default instance.
24276    pub fn new() -> Self {
24277        std::default::Default::default()
24278    }
24279
24280    /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type].
24281    ///
24282    /// Note that all the setters affecting `validation_type` are mutually
24283    /// exclusive.
24284    ///
24285    /// # Example
24286    /// ```ignore,no_run
24287    /// # use google_cloud_dataproc_v1::model::ParameterValidation;
24288    /// use google_cloud_dataproc_v1::model::RegexValidation;
24289    /// let x = ParameterValidation::new().set_validation_type(Some(
24290    ///     google_cloud_dataproc_v1::model::parameter_validation::ValidationType::Regex(RegexValidation::default().into())));
24291    /// ```
24292    pub fn set_validation_type<
24293        T: std::convert::Into<std::option::Option<crate::model::parameter_validation::ValidationType>>,
24294    >(
24295        mut self,
24296        v: T,
24297    ) -> Self {
24298        self.validation_type = v.into();
24299        self
24300    }
24301
24302    /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
24303    /// if it holds a `Regex`, `None` if the field is not set or
24304    /// holds a different branch.
24305    pub fn regex(&self) -> std::option::Option<&std::boxed::Box<crate::model::RegexValidation>> {
24306        #[allow(unreachable_patterns)]
24307        self.validation_type.as_ref().and_then(|v| match v {
24308            crate::model::parameter_validation::ValidationType::Regex(v) => {
24309                std::option::Option::Some(v)
24310            }
24311            _ => std::option::Option::None,
24312        })
24313    }
24314
24315    /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
24316    /// to hold a `Regex`.
24317    ///
24318    /// Note that all the setters affecting `validation_type` are
24319    /// mutually exclusive.
24320    ///
24321    /// # Example
24322    /// ```ignore,no_run
24323    /// # use google_cloud_dataproc_v1::model::ParameterValidation;
24324    /// use google_cloud_dataproc_v1::model::RegexValidation;
24325    /// let x = ParameterValidation::new().set_regex(RegexValidation::default()/* use setters */);
24326    /// assert!(x.regex().is_some());
24327    /// assert!(x.values().is_none());
24328    /// ```
24329    pub fn set_regex<T: std::convert::Into<std::boxed::Box<crate::model::RegexValidation>>>(
24330        mut self,
24331        v: T,
24332    ) -> Self {
24333        self.validation_type = std::option::Option::Some(
24334            crate::model::parameter_validation::ValidationType::Regex(v.into()),
24335        );
24336        self
24337    }
24338
24339    /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
24340    /// if it holds a `Values`, `None` if the field is not set or
24341    /// holds a different branch.
24342    pub fn values(&self) -> std::option::Option<&std::boxed::Box<crate::model::ValueValidation>> {
24343        #[allow(unreachable_patterns)]
24344        self.validation_type.as_ref().and_then(|v| match v {
24345            crate::model::parameter_validation::ValidationType::Values(v) => {
24346                std::option::Option::Some(v)
24347            }
24348            _ => std::option::Option::None,
24349        })
24350    }
24351
24352    /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
24353    /// to hold a `Values`.
24354    ///
24355    /// Note that all the setters affecting `validation_type` are
24356    /// mutually exclusive.
24357    ///
24358    /// # Example
24359    /// ```ignore,no_run
24360    /// # use google_cloud_dataproc_v1::model::ParameterValidation;
24361    /// use google_cloud_dataproc_v1::model::ValueValidation;
24362    /// let x = ParameterValidation::new().set_values(ValueValidation::default()/* use setters */);
24363    /// assert!(x.values().is_some());
24364    /// assert!(x.regex().is_none());
24365    /// ```
24366    pub fn set_values<T: std::convert::Into<std::boxed::Box<crate::model::ValueValidation>>>(
24367        mut self,
24368        v: T,
24369    ) -> Self {
24370        self.validation_type = std::option::Option::Some(
24371            crate::model::parameter_validation::ValidationType::Values(v.into()),
24372        );
24373        self
24374    }
24375}
24376
24377impl wkt::message::Message for ParameterValidation {
24378    fn typename() -> &'static str {
24379        "type.googleapis.com/google.cloud.dataproc.v1.ParameterValidation"
24380    }
24381}
24382
24383/// Defines additional types related to [ParameterValidation].
24384pub mod parameter_validation {
24385    #[allow(unused_imports)]
24386    use super::*;
24387
24388    /// Required. The type of validation to be performed.
24389    #[derive(Clone, Debug, PartialEq)]
24390    #[non_exhaustive]
24391    pub enum ValidationType {
24392        /// Validation based on regular expressions.
24393        Regex(std::boxed::Box<crate::model::RegexValidation>),
24394        /// Validation based on a list of allowed values.
24395        Values(std::boxed::Box<crate::model::ValueValidation>),
24396    }
24397}
24398
24399/// Validation based on regular expressions.
24400#[derive(Clone, Default, PartialEq)]
24401#[non_exhaustive]
24402pub struct RegexValidation {
24403    /// Required. RE2 regular expressions used to validate the parameter's value.
24404    /// The value must match the regex in its entirety (substring
24405    /// matches are not sufficient).
24406    pub regexes: std::vec::Vec<std::string::String>,
24407
24408    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24409}
24410
24411impl RegexValidation {
24412    /// Creates a new default instance.
24413    pub fn new() -> Self {
24414        std::default::Default::default()
24415    }
24416
24417    /// Sets the value of [regexes][crate::model::RegexValidation::regexes].
24418    ///
24419    /// # Example
24420    /// ```ignore,no_run
24421    /// # use google_cloud_dataproc_v1::model::RegexValidation;
24422    /// let x = RegexValidation::new().set_regexes(["a", "b", "c"]);
24423    /// ```
24424    pub fn set_regexes<T, V>(mut self, v: T) -> Self
24425    where
24426        T: std::iter::IntoIterator<Item = V>,
24427        V: std::convert::Into<std::string::String>,
24428    {
24429        use std::iter::Iterator;
24430        self.regexes = v.into_iter().map(|i| i.into()).collect();
24431        self
24432    }
24433}
24434
24435impl wkt::message::Message for RegexValidation {
24436    fn typename() -> &'static str {
24437        "type.googleapis.com/google.cloud.dataproc.v1.RegexValidation"
24438    }
24439}
24440
24441/// Validation based on a list of allowed values.
24442#[derive(Clone, Default, PartialEq)]
24443#[non_exhaustive]
24444pub struct ValueValidation {
24445    /// Required. List of allowed values for the parameter.
24446    pub values: std::vec::Vec<std::string::String>,
24447
24448    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24449}
24450
24451impl ValueValidation {
24452    /// Creates a new default instance.
24453    pub fn new() -> Self {
24454        std::default::Default::default()
24455    }
24456
24457    /// Sets the value of [values][crate::model::ValueValidation::values].
24458    ///
24459    /// # Example
24460    /// ```ignore,no_run
24461    /// # use google_cloud_dataproc_v1::model::ValueValidation;
24462    /// let x = ValueValidation::new().set_values(["a", "b", "c"]);
24463    /// ```
24464    pub fn set_values<T, V>(mut self, v: T) -> Self
24465    where
24466        T: std::iter::IntoIterator<Item = V>,
24467        V: std::convert::Into<std::string::String>,
24468    {
24469        use std::iter::Iterator;
24470        self.values = v.into_iter().map(|i| i.into()).collect();
24471        self
24472    }
24473}
24474
24475impl wkt::message::Message for ValueValidation {
24476    fn typename() -> &'static str {
24477        "type.googleapis.com/google.cloud.dataproc.v1.ValueValidation"
24478    }
24479}
24480
24481/// A Dataproc workflow template resource.
24482#[derive(Clone, Default, PartialEq)]
24483#[non_exhaustive]
24484pub struct WorkflowMetadata {
24485    /// Output only. The resource name of the workflow template as described
24486    /// in <https://cloud.google.com/apis/design/resource_names>.
24487    ///
24488    /// * For `projects.regions.workflowTemplates`, the resource name of the
24489    ///   template has the following format:
24490    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24491    ///
24492    /// * For `projects.locations.workflowTemplates`, the resource name of the
24493    ///   template has the following format:
24494    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24495    ///
24496    pub template: std::string::String,
24497
24498    /// Output only. The version of template at the time of
24499    /// workflow instantiation.
24500    pub version: i32,
24501
24502    /// Output only. The create cluster operation metadata.
24503    pub create_cluster: std::option::Option<crate::model::ClusterOperation>,
24504
24505    /// Output only. The workflow graph.
24506    pub graph: std::option::Option<crate::model::WorkflowGraph>,
24507
24508    /// Output only. The delete cluster operation metadata.
24509    pub delete_cluster: std::option::Option<crate::model::ClusterOperation>,
24510
24511    /// Output only. The workflow state.
24512    pub state: crate::model::workflow_metadata::State,
24513
24514    /// Output only. The name of the target cluster.
24515    pub cluster_name: std::string::String,
24516
24517    /// Map from parameter names to values that were used for those parameters.
24518    pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
24519
24520    /// Output only. Workflow start time.
24521    pub start_time: std::option::Option<wkt::Timestamp>,
24522
24523    /// Output only. Workflow end time.
24524    pub end_time: std::option::Option<wkt::Timestamp>,
24525
24526    /// Output only. The UUID of target cluster.
24527    pub cluster_uuid: std::string::String,
24528
24529    /// Output only. The timeout duration for the DAG of jobs, expressed in seconds
24530    /// (see [JSON representation of
24531    /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
24532    pub dag_timeout: std::option::Option<wkt::Duration>,
24533
24534    /// Output only. DAG start time, only set for workflows with
24535    /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24536    /// DAG begins.
24537    ///
24538    /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24539    pub dag_start_time: std::option::Option<wkt::Timestamp>,
24540
24541    /// Output only. DAG end time, only set for workflows with
24542    /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24543    /// DAG ends.
24544    ///
24545    /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24546    pub dag_end_time: std::option::Option<wkt::Timestamp>,
24547
24548    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24549}
24550
24551impl WorkflowMetadata {
24552    /// Creates a new default instance.
24553    pub fn new() -> Self {
24554        std::default::Default::default()
24555    }
24556
24557    /// Sets the value of [template][crate::model::WorkflowMetadata::template].
24558    ///
24559    /// # Example
24560    /// ```ignore,no_run
24561    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24562    /// let x = WorkflowMetadata::new().set_template("example");
24563    /// ```
24564    pub fn set_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24565        self.template = v.into();
24566        self
24567    }
24568
24569    /// Sets the value of [version][crate::model::WorkflowMetadata::version].
24570    ///
24571    /// # Example
24572    /// ```ignore,no_run
24573    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24574    /// let x = WorkflowMetadata::new().set_version(42);
24575    /// ```
24576    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24577        self.version = v.into();
24578        self
24579    }
24580
24581    /// Sets the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24582    ///
24583    /// # Example
24584    /// ```ignore,no_run
24585    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24586    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24587    /// let x = WorkflowMetadata::new().set_create_cluster(ClusterOperation::default()/* use setters */);
24588    /// ```
24589    pub fn set_create_cluster<T>(mut self, v: T) -> Self
24590    where
24591        T: std::convert::Into<crate::model::ClusterOperation>,
24592    {
24593        self.create_cluster = std::option::Option::Some(v.into());
24594        self
24595    }
24596
24597    /// Sets or clears the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24598    ///
24599    /// # Example
24600    /// ```ignore,no_run
24601    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24602    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24603    /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(Some(ClusterOperation::default()/* use setters */));
24604    /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(None::<ClusterOperation>);
24605    /// ```
24606    pub fn set_or_clear_create_cluster<T>(mut self, v: std::option::Option<T>) -> Self
24607    where
24608        T: std::convert::Into<crate::model::ClusterOperation>,
24609    {
24610        self.create_cluster = v.map(|x| x.into());
24611        self
24612    }
24613
24614    /// Sets the value of [graph][crate::model::WorkflowMetadata::graph].
24615    ///
24616    /// # Example
24617    /// ```ignore,no_run
24618    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24619    /// use google_cloud_dataproc_v1::model::WorkflowGraph;
24620    /// let x = WorkflowMetadata::new().set_graph(WorkflowGraph::default()/* use setters */);
24621    /// ```
24622    pub fn set_graph<T>(mut self, v: T) -> Self
24623    where
24624        T: std::convert::Into<crate::model::WorkflowGraph>,
24625    {
24626        self.graph = std::option::Option::Some(v.into());
24627        self
24628    }
24629
24630    /// Sets or clears the value of [graph][crate::model::WorkflowMetadata::graph].
24631    ///
24632    /// # Example
24633    /// ```ignore,no_run
24634    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24635    /// use google_cloud_dataproc_v1::model::WorkflowGraph;
24636    /// let x = WorkflowMetadata::new().set_or_clear_graph(Some(WorkflowGraph::default()/* use setters */));
24637    /// let x = WorkflowMetadata::new().set_or_clear_graph(None::<WorkflowGraph>);
24638    /// ```
24639    pub fn set_or_clear_graph<T>(mut self, v: std::option::Option<T>) -> Self
24640    where
24641        T: std::convert::Into<crate::model::WorkflowGraph>,
24642    {
24643        self.graph = v.map(|x| x.into());
24644        self
24645    }
24646
24647    /// Sets the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
24648    ///
24649    /// # Example
24650    /// ```ignore,no_run
24651    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24652    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24653    /// let x = WorkflowMetadata::new().set_delete_cluster(ClusterOperation::default()/* use setters */);
24654    /// ```
24655    pub fn set_delete_cluster<T>(mut self, v: T) -> Self
24656    where
24657        T: std::convert::Into<crate::model::ClusterOperation>,
24658    {
24659        self.delete_cluster = std::option::Option::Some(v.into());
24660        self
24661    }
24662
24663    /// Sets or clears the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
24664    ///
24665    /// # Example
24666    /// ```ignore,no_run
24667    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24668    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24669    /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(Some(ClusterOperation::default()/* use setters */));
24670    /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(None::<ClusterOperation>);
24671    /// ```
24672    pub fn set_or_clear_delete_cluster<T>(mut self, v: std::option::Option<T>) -> Self
24673    where
24674        T: std::convert::Into<crate::model::ClusterOperation>,
24675    {
24676        self.delete_cluster = v.map(|x| x.into());
24677        self
24678    }
24679
24680    /// Sets the value of [state][crate::model::WorkflowMetadata::state].
24681    ///
24682    /// # Example
24683    /// ```ignore,no_run
24684    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24685    /// use google_cloud_dataproc_v1::model::workflow_metadata::State;
24686    /// let x0 = WorkflowMetadata::new().set_state(State::Pending);
24687    /// let x1 = WorkflowMetadata::new().set_state(State::Running);
24688    /// let x2 = WorkflowMetadata::new().set_state(State::Done);
24689    /// ```
24690    pub fn set_state<T: std::convert::Into<crate::model::workflow_metadata::State>>(
24691        mut self,
24692        v: T,
24693    ) -> Self {
24694        self.state = v.into();
24695        self
24696    }
24697
24698    /// Sets the value of [cluster_name][crate::model::WorkflowMetadata::cluster_name].
24699    ///
24700    /// # Example
24701    /// ```ignore,no_run
24702    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24703    /// let x = WorkflowMetadata::new().set_cluster_name("example");
24704    /// ```
24705    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24706        self.cluster_name = v.into();
24707        self
24708    }
24709
24710    /// Sets the value of [parameters][crate::model::WorkflowMetadata::parameters].
24711    ///
24712    /// # Example
24713    /// ```ignore,no_run
24714    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24715    /// let x = WorkflowMetadata::new().set_parameters([
24716    ///     ("key0", "abc"),
24717    ///     ("key1", "xyz"),
24718    /// ]);
24719    /// ```
24720    pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
24721    where
24722        T: std::iter::IntoIterator<Item = (K, V)>,
24723        K: std::convert::Into<std::string::String>,
24724        V: std::convert::Into<std::string::String>,
24725    {
24726        use std::iter::Iterator;
24727        self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24728        self
24729    }
24730
24731    /// Sets the value of [start_time][crate::model::WorkflowMetadata::start_time].
24732    ///
24733    /// # Example
24734    /// ```ignore,no_run
24735    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24736    /// use wkt::Timestamp;
24737    /// let x = WorkflowMetadata::new().set_start_time(Timestamp::default()/* use setters */);
24738    /// ```
24739    pub fn set_start_time<T>(mut self, v: T) -> Self
24740    where
24741        T: std::convert::Into<wkt::Timestamp>,
24742    {
24743        self.start_time = std::option::Option::Some(v.into());
24744        self
24745    }
24746
24747    /// Sets or clears the value of [start_time][crate::model::WorkflowMetadata::start_time].
24748    ///
24749    /// # Example
24750    /// ```ignore,no_run
24751    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24752    /// use wkt::Timestamp;
24753    /// let x = WorkflowMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
24754    /// let x = WorkflowMetadata::new().set_or_clear_start_time(None::<Timestamp>);
24755    /// ```
24756    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24757    where
24758        T: std::convert::Into<wkt::Timestamp>,
24759    {
24760        self.start_time = v.map(|x| x.into());
24761        self
24762    }
24763
24764    /// Sets the value of [end_time][crate::model::WorkflowMetadata::end_time].
24765    ///
24766    /// # Example
24767    /// ```ignore,no_run
24768    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24769    /// use wkt::Timestamp;
24770    /// let x = WorkflowMetadata::new().set_end_time(Timestamp::default()/* use setters */);
24771    /// ```
24772    pub fn set_end_time<T>(mut self, v: T) -> Self
24773    where
24774        T: std::convert::Into<wkt::Timestamp>,
24775    {
24776        self.end_time = std::option::Option::Some(v.into());
24777        self
24778    }
24779
24780    /// Sets or clears the value of [end_time][crate::model::WorkflowMetadata::end_time].
24781    ///
24782    /// # Example
24783    /// ```ignore,no_run
24784    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24785    /// use wkt::Timestamp;
24786    /// let x = WorkflowMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
24787    /// let x = WorkflowMetadata::new().set_or_clear_end_time(None::<Timestamp>);
24788    /// ```
24789    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24790    where
24791        T: std::convert::Into<wkt::Timestamp>,
24792    {
24793        self.end_time = v.map(|x| x.into());
24794        self
24795    }
24796
24797    /// Sets the value of [cluster_uuid][crate::model::WorkflowMetadata::cluster_uuid].
24798    ///
24799    /// # Example
24800    /// ```ignore,no_run
24801    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24802    /// let x = WorkflowMetadata::new().set_cluster_uuid("example");
24803    /// ```
24804    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24805        self.cluster_uuid = v.into();
24806        self
24807    }
24808
24809    /// Sets the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24810    ///
24811    /// # Example
24812    /// ```ignore,no_run
24813    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24814    /// use wkt::Duration;
24815    /// let x = WorkflowMetadata::new().set_dag_timeout(Duration::default()/* use setters */);
24816    /// ```
24817    pub fn set_dag_timeout<T>(mut self, v: T) -> Self
24818    where
24819        T: std::convert::Into<wkt::Duration>,
24820    {
24821        self.dag_timeout = std::option::Option::Some(v.into());
24822        self
24823    }
24824
24825    /// Sets or clears the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24826    ///
24827    /// # Example
24828    /// ```ignore,no_run
24829    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24830    /// use wkt::Duration;
24831    /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
24832    /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(None::<Duration>);
24833    /// ```
24834    pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
24835    where
24836        T: std::convert::Into<wkt::Duration>,
24837    {
24838        self.dag_timeout = v.map(|x| x.into());
24839        self
24840    }
24841
24842    /// Sets the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24843    ///
24844    /// # Example
24845    /// ```ignore,no_run
24846    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24847    /// use wkt::Timestamp;
24848    /// let x = WorkflowMetadata::new().set_dag_start_time(Timestamp::default()/* use setters */);
24849    /// ```
24850    pub fn set_dag_start_time<T>(mut self, v: T) -> Self
24851    where
24852        T: std::convert::Into<wkt::Timestamp>,
24853    {
24854        self.dag_start_time = std::option::Option::Some(v.into());
24855        self
24856    }
24857
24858    /// Sets or clears the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24859    ///
24860    /// # Example
24861    /// ```ignore,no_run
24862    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24863    /// use wkt::Timestamp;
24864    /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(Some(Timestamp::default()/* use setters */));
24865    /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(None::<Timestamp>);
24866    /// ```
24867    pub fn set_or_clear_dag_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24868    where
24869        T: std::convert::Into<wkt::Timestamp>,
24870    {
24871        self.dag_start_time = v.map(|x| x.into());
24872        self
24873    }
24874
24875    /// Sets the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24876    ///
24877    /// # Example
24878    /// ```ignore,no_run
24879    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24880    /// use wkt::Timestamp;
24881    /// let x = WorkflowMetadata::new().set_dag_end_time(Timestamp::default()/* use setters */);
24882    /// ```
24883    pub fn set_dag_end_time<T>(mut self, v: T) -> Self
24884    where
24885        T: std::convert::Into<wkt::Timestamp>,
24886    {
24887        self.dag_end_time = std::option::Option::Some(v.into());
24888        self
24889    }
24890
24891    /// Sets or clears the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24892    ///
24893    /// # Example
24894    /// ```ignore,no_run
24895    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24896    /// use wkt::Timestamp;
24897    /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(Some(Timestamp::default()/* use setters */));
24898    /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(None::<Timestamp>);
24899    /// ```
24900    pub fn set_or_clear_dag_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24901    where
24902        T: std::convert::Into<wkt::Timestamp>,
24903    {
24904        self.dag_end_time = v.map(|x| x.into());
24905        self
24906    }
24907}
24908
24909impl wkt::message::Message for WorkflowMetadata {
24910    fn typename() -> &'static str {
24911        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowMetadata"
24912    }
24913}
24914
24915/// Defines additional types related to [WorkflowMetadata].
24916pub mod workflow_metadata {
24917    #[allow(unused_imports)]
24918    use super::*;
24919
24920    /// The operation state.
24921    ///
24922    /// # Working with unknown values
24923    ///
24924    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24925    /// additional enum variants at any time. Adding new variants is not considered
24926    /// a breaking change. Applications should write their code in anticipation of:
24927    ///
24928    /// - New values appearing in future releases of the client library, **and**
24929    /// - New values received dynamically, without application changes.
24930    ///
24931    /// Please consult the [Working with enums] section in the user guide for some
24932    /// guidelines.
24933    ///
24934    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
24935    #[derive(Clone, Debug, PartialEq)]
24936    #[non_exhaustive]
24937    pub enum State {
24938        /// Unused.
24939        Unknown,
24940        /// The operation has been created.
24941        Pending,
24942        /// The operation is running.
24943        Running,
24944        /// The operation is done; either cancelled or completed.
24945        Done,
24946        /// If set, the enum was initialized with an unknown value.
24947        ///
24948        /// Applications can examine the value using [State::value] or
24949        /// [State::name].
24950        UnknownValue(state::UnknownValue),
24951    }
24952
24953    #[doc(hidden)]
24954    pub mod state {
24955        #[allow(unused_imports)]
24956        use super::*;
24957        #[derive(Clone, Debug, PartialEq)]
24958        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24959    }
24960
24961    impl State {
24962        /// Gets the enum value.
24963        ///
24964        /// Returns `None` if the enum contains an unknown value deserialized from
24965        /// the string representation of enums.
24966        pub fn value(&self) -> std::option::Option<i32> {
24967            match self {
24968                Self::Unknown => std::option::Option::Some(0),
24969                Self::Pending => std::option::Option::Some(1),
24970                Self::Running => std::option::Option::Some(2),
24971                Self::Done => std::option::Option::Some(3),
24972                Self::UnknownValue(u) => u.0.value(),
24973            }
24974        }
24975
24976        /// Gets the enum value as a string.
24977        ///
24978        /// Returns `None` if the enum contains an unknown value deserialized from
24979        /// the integer representation of enums.
24980        pub fn name(&self) -> std::option::Option<&str> {
24981            match self {
24982                Self::Unknown => std::option::Option::Some("UNKNOWN"),
24983                Self::Pending => std::option::Option::Some("PENDING"),
24984                Self::Running => std::option::Option::Some("RUNNING"),
24985                Self::Done => std::option::Option::Some("DONE"),
24986                Self::UnknownValue(u) => u.0.name(),
24987            }
24988        }
24989    }
24990
24991    impl std::default::Default for State {
24992        fn default() -> Self {
24993            use std::convert::From;
24994            Self::from(0)
24995        }
24996    }
24997
24998    impl std::fmt::Display for State {
24999        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25000            wkt::internal::display_enum(f, self.name(), self.value())
25001        }
25002    }
25003
25004    impl std::convert::From<i32> for State {
25005        fn from(value: i32) -> Self {
25006            match value {
25007                0 => Self::Unknown,
25008                1 => Self::Pending,
25009                2 => Self::Running,
25010                3 => Self::Done,
25011                _ => Self::UnknownValue(state::UnknownValue(
25012                    wkt::internal::UnknownEnumValue::Integer(value),
25013                )),
25014            }
25015        }
25016    }
25017
25018    impl std::convert::From<&str> for State {
25019        fn from(value: &str) -> Self {
25020            use std::string::ToString;
25021            match value {
25022                "UNKNOWN" => Self::Unknown,
25023                "PENDING" => Self::Pending,
25024                "RUNNING" => Self::Running,
25025                "DONE" => Self::Done,
25026                _ => Self::UnknownValue(state::UnknownValue(
25027                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25028                )),
25029            }
25030        }
25031    }
25032
25033    impl serde::ser::Serialize for State {
25034        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25035        where
25036            S: serde::Serializer,
25037        {
25038            match self {
25039                Self::Unknown => serializer.serialize_i32(0),
25040                Self::Pending => serializer.serialize_i32(1),
25041                Self::Running => serializer.serialize_i32(2),
25042                Self::Done => serializer.serialize_i32(3),
25043                Self::UnknownValue(u) => u.0.serialize(serializer),
25044            }
25045        }
25046    }
25047
25048    impl<'de> serde::de::Deserialize<'de> for State {
25049        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25050        where
25051            D: serde::Deserializer<'de>,
25052        {
25053            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
25054                ".google.cloud.dataproc.v1.WorkflowMetadata.State",
25055            ))
25056        }
25057    }
25058}
25059
25060/// The cluster operation triggered by a workflow.
25061#[derive(Clone, Default, PartialEq)]
25062#[non_exhaustive]
25063pub struct ClusterOperation {
25064    /// Output only. The id of the cluster operation.
25065    pub operation_id: std::string::String,
25066
25067    /// Output only. Error, if operation failed.
25068    pub error: std::string::String,
25069
25070    /// Output only. Indicates the operation is done.
25071    pub done: bool,
25072
25073    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25074}
25075
25076impl ClusterOperation {
25077    /// Creates a new default instance.
25078    pub fn new() -> Self {
25079        std::default::Default::default()
25080    }
25081
25082    /// Sets the value of [operation_id][crate::model::ClusterOperation::operation_id].
25083    ///
25084    /// # Example
25085    /// ```ignore,no_run
25086    /// # use google_cloud_dataproc_v1::model::ClusterOperation;
25087    /// let x = ClusterOperation::new().set_operation_id("example");
25088    /// ```
25089    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25090        self.operation_id = v.into();
25091        self
25092    }
25093
25094    /// Sets the value of [error][crate::model::ClusterOperation::error].
25095    ///
25096    /// # Example
25097    /// ```ignore,no_run
25098    /// # use google_cloud_dataproc_v1::model::ClusterOperation;
25099    /// let x = ClusterOperation::new().set_error("example");
25100    /// ```
25101    pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25102        self.error = v.into();
25103        self
25104    }
25105
25106    /// Sets the value of [done][crate::model::ClusterOperation::done].
25107    ///
25108    /// # Example
25109    /// ```ignore,no_run
25110    /// # use google_cloud_dataproc_v1::model::ClusterOperation;
25111    /// let x = ClusterOperation::new().set_done(true);
25112    /// ```
25113    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25114        self.done = v.into();
25115        self
25116    }
25117}
25118
25119impl wkt::message::Message for ClusterOperation {
25120    fn typename() -> &'static str {
25121        "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperation"
25122    }
25123}
25124
25125/// The workflow graph.
25126#[derive(Clone, Default, PartialEq)]
25127#[non_exhaustive]
25128pub struct WorkflowGraph {
25129    /// Output only. The workflow nodes.
25130    pub nodes: std::vec::Vec<crate::model::WorkflowNode>,
25131
25132    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25133}
25134
25135impl WorkflowGraph {
25136    /// Creates a new default instance.
25137    pub fn new() -> Self {
25138        std::default::Default::default()
25139    }
25140
25141    /// Sets the value of [nodes][crate::model::WorkflowGraph::nodes].
25142    ///
25143    /// # Example
25144    /// ```ignore,no_run
25145    /// # use google_cloud_dataproc_v1::model::WorkflowGraph;
25146    /// use google_cloud_dataproc_v1::model::WorkflowNode;
25147    /// let x = WorkflowGraph::new()
25148    ///     .set_nodes([
25149    ///         WorkflowNode::default()/* use setters */,
25150    ///         WorkflowNode::default()/* use (different) setters */,
25151    ///     ]);
25152    /// ```
25153    pub fn set_nodes<T, V>(mut self, v: T) -> Self
25154    where
25155        T: std::iter::IntoIterator<Item = V>,
25156        V: std::convert::Into<crate::model::WorkflowNode>,
25157    {
25158        use std::iter::Iterator;
25159        self.nodes = v.into_iter().map(|i| i.into()).collect();
25160        self
25161    }
25162}
25163
25164impl wkt::message::Message for WorkflowGraph {
25165    fn typename() -> &'static str {
25166        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowGraph"
25167    }
25168}
25169
25170/// The workflow node.
25171#[derive(Clone, Default, PartialEq)]
25172#[non_exhaustive]
25173pub struct WorkflowNode {
25174    /// Output only. The name of the node.
25175    pub step_id: std::string::String,
25176
25177    /// Output only. Node's prerequisite nodes.
25178    pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
25179
25180    /// Output only. The job id; populated after the node enters RUNNING state.
25181    pub job_id: std::string::String,
25182
25183    /// Output only. The node state.
25184    pub state: crate::model::workflow_node::NodeState,
25185
25186    /// Output only. The error detail.
25187    pub error: std::string::String,
25188
25189    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25190}
25191
25192impl WorkflowNode {
25193    /// Creates a new default instance.
25194    pub fn new() -> Self {
25195        std::default::Default::default()
25196    }
25197
25198    /// Sets the value of [step_id][crate::model::WorkflowNode::step_id].
25199    ///
25200    /// # Example
25201    /// ```ignore,no_run
25202    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25203    /// let x = WorkflowNode::new().set_step_id("example");
25204    /// ```
25205    pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25206        self.step_id = v.into();
25207        self
25208    }
25209
25210    /// Sets the value of [prerequisite_step_ids][crate::model::WorkflowNode::prerequisite_step_ids].
25211    ///
25212    /// # Example
25213    /// ```ignore,no_run
25214    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25215    /// let x = WorkflowNode::new().set_prerequisite_step_ids(["a", "b", "c"]);
25216    /// ```
25217    pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
25218    where
25219        T: std::iter::IntoIterator<Item = V>,
25220        V: std::convert::Into<std::string::String>,
25221    {
25222        use std::iter::Iterator;
25223        self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
25224        self
25225    }
25226
25227    /// Sets the value of [job_id][crate::model::WorkflowNode::job_id].
25228    ///
25229    /// # Example
25230    /// ```ignore,no_run
25231    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25232    /// let x = WorkflowNode::new().set_job_id("example");
25233    /// ```
25234    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25235        self.job_id = v.into();
25236        self
25237    }
25238
25239    /// Sets the value of [state][crate::model::WorkflowNode::state].
25240    ///
25241    /// # Example
25242    /// ```ignore,no_run
25243    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25244    /// use google_cloud_dataproc_v1::model::workflow_node::NodeState;
25245    /// let x0 = WorkflowNode::new().set_state(NodeState::Blocked);
25246    /// let x1 = WorkflowNode::new().set_state(NodeState::Runnable);
25247    /// let x2 = WorkflowNode::new().set_state(NodeState::Running);
25248    /// ```
25249    pub fn set_state<T: std::convert::Into<crate::model::workflow_node::NodeState>>(
25250        mut self,
25251        v: T,
25252    ) -> Self {
25253        self.state = v.into();
25254        self
25255    }
25256
25257    /// Sets the value of [error][crate::model::WorkflowNode::error].
25258    ///
25259    /// # Example
25260    /// ```ignore,no_run
25261    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25262    /// let x = WorkflowNode::new().set_error("example");
25263    /// ```
25264    pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25265        self.error = v.into();
25266        self
25267    }
25268}
25269
25270impl wkt::message::Message for WorkflowNode {
25271    fn typename() -> &'static str {
25272        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowNode"
25273    }
25274}
25275
25276/// Defines additional types related to [WorkflowNode].
25277pub mod workflow_node {
25278    #[allow(unused_imports)]
25279    use super::*;
25280
25281    /// The workflow node state.
25282    ///
25283    /// # Working with unknown values
25284    ///
25285    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25286    /// additional enum variants at any time. Adding new variants is not considered
25287    /// a breaking change. Applications should write their code in anticipation of:
25288    ///
25289    /// - New values appearing in future releases of the client library, **and**
25290    /// - New values received dynamically, without application changes.
25291    ///
25292    /// Please consult the [Working with enums] section in the user guide for some
25293    /// guidelines.
25294    ///
25295    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25296    #[derive(Clone, Debug, PartialEq)]
25297    #[non_exhaustive]
25298    pub enum NodeState {
25299        /// State is unspecified.
25300        Unspecified,
25301        /// The node is awaiting prerequisite node to finish.
25302        Blocked,
25303        /// The node is runnable but not running.
25304        Runnable,
25305        /// The node is running.
25306        Running,
25307        /// The node completed successfully.
25308        Completed,
25309        /// The node failed. A node can be marked FAILED because
25310        /// its ancestor or peer failed.
25311        Failed,
25312        /// If set, the enum was initialized with an unknown value.
25313        ///
25314        /// Applications can examine the value using [NodeState::value] or
25315        /// [NodeState::name].
25316        UnknownValue(node_state::UnknownValue),
25317    }
25318
25319    #[doc(hidden)]
25320    pub mod node_state {
25321        #[allow(unused_imports)]
25322        use super::*;
25323        #[derive(Clone, Debug, PartialEq)]
25324        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25325    }
25326
25327    impl NodeState {
25328        /// Gets the enum value.
25329        ///
25330        /// Returns `None` if the enum contains an unknown value deserialized from
25331        /// the string representation of enums.
25332        pub fn value(&self) -> std::option::Option<i32> {
25333            match self {
25334                Self::Unspecified => std::option::Option::Some(0),
25335                Self::Blocked => std::option::Option::Some(1),
25336                Self::Runnable => std::option::Option::Some(2),
25337                Self::Running => std::option::Option::Some(3),
25338                Self::Completed => std::option::Option::Some(4),
25339                Self::Failed => std::option::Option::Some(5),
25340                Self::UnknownValue(u) => u.0.value(),
25341            }
25342        }
25343
25344        /// Gets the enum value as a string.
25345        ///
25346        /// Returns `None` if the enum contains an unknown value deserialized from
25347        /// the integer representation of enums.
25348        pub fn name(&self) -> std::option::Option<&str> {
25349            match self {
25350                Self::Unspecified => std::option::Option::Some("NODE_STATE_UNSPECIFIED"),
25351                Self::Blocked => std::option::Option::Some("BLOCKED"),
25352                Self::Runnable => std::option::Option::Some("RUNNABLE"),
25353                Self::Running => std::option::Option::Some("RUNNING"),
25354                Self::Completed => std::option::Option::Some("COMPLETED"),
25355                Self::Failed => std::option::Option::Some("FAILED"),
25356                Self::UnknownValue(u) => u.0.name(),
25357            }
25358        }
25359    }
25360
25361    impl std::default::Default for NodeState {
25362        fn default() -> Self {
25363            use std::convert::From;
25364            Self::from(0)
25365        }
25366    }
25367
25368    impl std::fmt::Display for NodeState {
25369        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25370            wkt::internal::display_enum(f, self.name(), self.value())
25371        }
25372    }
25373
25374    impl std::convert::From<i32> for NodeState {
25375        fn from(value: i32) -> Self {
25376            match value {
25377                0 => Self::Unspecified,
25378                1 => Self::Blocked,
25379                2 => Self::Runnable,
25380                3 => Self::Running,
25381                4 => Self::Completed,
25382                5 => Self::Failed,
25383                _ => Self::UnknownValue(node_state::UnknownValue(
25384                    wkt::internal::UnknownEnumValue::Integer(value),
25385                )),
25386            }
25387        }
25388    }
25389
25390    impl std::convert::From<&str> for NodeState {
25391        fn from(value: &str) -> Self {
25392            use std::string::ToString;
25393            match value {
25394                "NODE_STATE_UNSPECIFIED" => Self::Unspecified,
25395                "BLOCKED" => Self::Blocked,
25396                "RUNNABLE" => Self::Runnable,
25397                "RUNNING" => Self::Running,
25398                "COMPLETED" => Self::Completed,
25399                "FAILED" => Self::Failed,
25400                _ => Self::UnknownValue(node_state::UnknownValue(
25401                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25402                )),
25403            }
25404        }
25405    }
25406
25407    impl serde::ser::Serialize for NodeState {
25408        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25409        where
25410            S: serde::Serializer,
25411        {
25412            match self {
25413                Self::Unspecified => serializer.serialize_i32(0),
25414                Self::Blocked => serializer.serialize_i32(1),
25415                Self::Runnable => serializer.serialize_i32(2),
25416                Self::Running => serializer.serialize_i32(3),
25417                Self::Completed => serializer.serialize_i32(4),
25418                Self::Failed => serializer.serialize_i32(5),
25419                Self::UnknownValue(u) => u.0.serialize(serializer),
25420            }
25421        }
25422    }
25423
25424    impl<'de> serde::de::Deserialize<'de> for NodeState {
25425        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25426        where
25427            D: serde::Deserializer<'de>,
25428        {
25429            deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeState>::new(
25430                ".google.cloud.dataproc.v1.WorkflowNode.NodeState",
25431            ))
25432        }
25433    }
25434}
25435
25436/// A request to create a workflow template.
25437#[derive(Clone, Default, PartialEq)]
25438#[non_exhaustive]
25439pub struct CreateWorkflowTemplateRequest {
25440    /// Required. The resource name of the region or location, as described
25441    /// in <https://cloud.google.com/apis/design/resource_names>.
25442    ///
25443    /// * For `projects.regions.workflowTemplates.create`, the resource name of the
25444    ///   region has the following format:
25445    ///   `projects/{project_id}/regions/{region}`
25446    ///
25447    /// * For `projects.locations.workflowTemplates.create`, the resource name of
25448    ///   the location has the following format:
25449    ///   `projects/{project_id}/locations/{location}`
25450    ///
25451    pub parent: std::string::String,
25452
25453    /// Required. The Dataproc workflow template to create.
25454    pub template: std::option::Option<crate::model::WorkflowTemplate>,
25455
25456    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25457}
25458
25459impl CreateWorkflowTemplateRequest {
25460    /// Creates a new default instance.
25461    pub fn new() -> Self {
25462        std::default::Default::default()
25463    }
25464
25465    /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
25466    ///
25467    /// # Example
25468    /// ```ignore,no_run
25469    /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25470    /// let x = CreateWorkflowTemplateRequest::new().set_parent("example");
25471    /// ```
25472    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25473        self.parent = v.into();
25474        self
25475    }
25476
25477    /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25478    ///
25479    /// # Example
25480    /// ```ignore,no_run
25481    /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25482    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25483    /// let x = CreateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25484    /// ```
25485    pub fn set_template<T>(mut self, v: T) -> Self
25486    where
25487        T: std::convert::Into<crate::model::WorkflowTemplate>,
25488    {
25489        self.template = std::option::Option::Some(v.into());
25490        self
25491    }
25492
25493    /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25494    ///
25495    /// # Example
25496    /// ```ignore,no_run
25497    /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25498    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25499    /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25500    /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25501    /// ```
25502    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25503    where
25504        T: std::convert::Into<crate::model::WorkflowTemplate>,
25505    {
25506        self.template = v.map(|x| x.into());
25507        self
25508    }
25509}
25510
25511impl wkt::message::Message for CreateWorkflowTemplateRequest {
25512    fn typename() -> &'static str {
25513        "type.googleapis.com/google.cloud.dataproc.v1.CreateWorkflowTemplateRequest"
25514    }
25515}
25516
25517/// A request to fetch a workflow template.
25518#[derive(Clone, Default, PartialEq)]
25519#[non_exhaustive]
25520pub struct GetWorkflowTemplateRequest {
25521    /// Required. The resource name of the workflow template, as described
25522    /// in <https://cloud.google.com/apis/design/resource_names>.
25523    ///
25524    /// * For `projects.regions.workflowTemplates.get`, the resource name of the
25525    ///   template has the following format:
25526    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25527    ///
25528    /// * For `projects.locations.workflowTemplates.get`, the resource name of the
25529    ///   template has the following format:
25530    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25531    ///
25532    pub name: std::string::String,
25533
25534    /// Optional. The version of workflow template to retrieve. Only previously
25535    /// instantiated versions can be retrieved.
25536    ///
25537    /// If unspecified, retrieves the current version.
25538    pub version: i32,
25539
25540    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25541}
25542
25543impl GetWorkflowTemplateRequest {
25544    /// Creates a new default instance.
25545    pub fn new() -> Self {
25546        std::default::Default::default()
25547    }
25548
25549    /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
25550    ///
25551    /// # Example
25552    /// ```ignore,no_run
25553    /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25554    /// let x = GetWorkflowTemplateRequest::new().set_name("example");
25555    /// ```
25556    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25557        self.name = v.into();
25558        self
25559    }
25560
25561    /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
25562    ///
25563    /// # Example
25564    /// ```ignore,no_run
25565    /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25566    /// let x = GetWorkflowTemplateRequest::new().set_version(42);
25567    /// ```
25568    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25569        self.version = v.into();
25570        self
25571    }
25572}
25573
25574impl wkt::message::Message for GetWorkflowTemplateRequest {
25575    fn typename() -> &'static str {
25576        "type.googleapis.com/google.cloud.dataproc.v1.GetWorkflowTemplateRequest"
25577    }
25578}
25579
25580/// A request to instantiate a workflow template.
25581#[derive(Clone, Default, PartialEq)]
25582#[non_exhaustive]
25583pub struct InstantiateWorkflowTemplateRequest {
25584    /// Required. The resource name of the workflow template, as described
25585    /// in <https://cloud.google.com/apis/design/resource_names>.
25586    ///
25587    /// * For `projects.regions.workflowTemplates.instantiate`, the resource name
25588    ///   of the template has the following format:
25589    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25590    ///
25591    /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25592    ///   of the template has the following format:
25593    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25594    ///
25595    pub name: std::string::String,
25596
25597    /// Optional. The version of workflow template to instantiate. If specified,
25598    /// the workflow will be instantiated only if the current version of
25599    /// the workflow template has the supplied version.
25600    ///
25601    /// This option cannot be used to instantiate a previous version of
25602    /// workflow template.
25603    pub version: i32,
25604
25605    /// Optional. A tag that prevents multiple concurrent workflow
25606    /// instances with the same tag from running. This mitigates risk of
25607    /// concurrent instances started due to retries.
25608    ///
25609    /// It is recommended to always set this value to a
25610    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
25611    ///
25612    /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
25613    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
25614    pub request_id: std::string::String,
25615
25616    /// Optional. Map from parameter names to values that should be used for those
25617    /// parameters. Values may not exceed 1000 characters.
25618    pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
25619
25620    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25621}
25622
25623impl InstantiateWorkflowTemplateRequest {
25624    /// Creates a new default instance.
25625    pub fn new() -> Self {
25626        std::default::Default::default()
25627    }
25628
25629    /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
25630    ///
25631    /// # Example
25632    /// ```ignore,no_run
25633    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25634    /// let x = InstantiateWorkflowTemplateRequest::new().set_name("example");
25635    /// ```
25636    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25637        self.name = v.into();
25638        self
25639    }
25640
25641    /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
25642    ///
25643    /// # Example
25644    /// ```ignore,no_run
25645    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25646    /// let x = InstantiateWorkflowTemplateRequest::new().set_version(42);
25647    /// ```
25648    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25649        self.version = v.into();
25650        self
25651    }
25652
25653    /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
25654    ///
25655    /// # Example
25656    /// ```ignore,no_run
25657    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25658    /// let x = InstantiateWorkflowTemplateRequest::new().set_request_id("example");
25659    /// ```
25660    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25661        self.request_id = v.into();
25662        self
25663    }
25664
25665    /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
25666    ///
25667    /// # Example
25668    /// ```ignore,no_run
25669    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25670    /// let x = InstantiateWorkflowTemplateRequest::new().set_parameters([
25671    ///     ("key0", "abc"),
25672    ///     ("key1", "xyz"),
25673    /// ]);
25674    /// ```
25675    pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
25676    where
25677        T: std::iter::IntoIterator<Item = (K, V)>,
25678        K: std::convert::Into<std::string::String>,
25679        V: std::convert::Into<std::string::String>,
25680    {
25681        use std::iter::Iterator;
25682        self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
25683        self
25684    }
25685}
25686
25687impl wkt::message::Message for InstantiateWorkflowTemplateRequest {
25688    fn typename() -> &'static str {
25689        "type.googleapis.com/google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest"
25690    }
25691}
25692
25693/// A request to instantiate an inline workflow template.
25694#[derive(Clone, Default, PartialEq)]
25695#[non_exhaustive]
25696pub struct InstantiateInlineWorkflowTemplateRequest {
25697    /// Required. The resource name of the region or location, as described
25698    /// in <https://cloud.google.com/apis/design/resource_names>.
25699    ///
25700    /// * For `projects.regions.workflowTemplates,instantiateinline`, the resource
25701    ///   name of the region has the following format:
25702    ///   `projects/{project_id}/regions/{region}`
25703    ///
25704    /// * For `projects.locations.workflowTemplates.instantiateinline`, the
25705    ///   resource name of the location has the following format:
25706    ///   `projects/{project_id}/locations/{location}`
25707    ///
25708    pub parent: std::string::String,
25709
25710    /// Required. The workflow template to instantiate.
25711    pub template: std::option::Option<crate::model::WorkflowTemplate>,
25712
25713    /// Optional. A tag that prevents multiple concurrent workflow
25714    /// instances with the same tag from running. This mitigates risk of
25715    /// concurrent instances started due to retries.
25716    ///
25717    /// It is recommended to always set this value to a
25718    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
25719    ///
25720    /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
25721    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
25722    pub request_id: std::string::String,
25723
25724    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25725}
25726
25727impl InstantiateInlineWorkflowTemplateRequest {
25728    /// Creates a new default instance.
25729    pub fn new() -> Self {
25730        std::default::Default::default()
25731    }
25732
25733    /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
25734    ///
25735    /// # Example
25736    /// ```ignore,no_run
25737    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25738    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_parent("example");
25739    /// ```
25740    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25741        self.parent = v.into();
25742        self
25743    }
25744
25745    /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
25746    ///
25747    /// # Example
25748    /// ```ignore,no_run
25749    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25750    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25751    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25752    /// ```
25753    pub fn set_template<T>(mut self, v: T) -> Self
25754    where
25755        T: std::convert::Into<crate::model::WorkflowTemplate>,
25756    {
25757        self.template = std::option::Option::Some(v.into());
25758        self
25759    }
25760
25761    /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
25762    ///
25763    /// # Example
25764    /// ```ignore,no_run
25765    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25766    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25767    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25768    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25769    /// ```
25770    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25771    where
25772        T: std::convert::Into<crate::model::WorkflowTemplate>,
25773    {
25774        self.template = v.map(|x| x.into());
25775        self
25776    }
25777
25778    /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
25779    ///
25780    /// # Example
25781    /// ```ignore,no_run
25782    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25783    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_request_id("example");
25784    /// ```
25785    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25786        self.request_id = v.into();
25787        self
25788    }
25789}
25790
25791impl wkt::message::Message for InstantiateInlineWorkflowTemplateRequest {
25792    fn typename() -> &'static str {
25793        "type.googleapis.com/google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest"
25794    }
25795}
25796
25797/// A request to update a workflow template.
25798#[derive(Clone, Default, PartialEq)]
25799#[non_exhaustive]
25800pub struct UpdateWorkflowTemplateRequest {
25801    /// Required. The updated workflow template.
25802    ///
25803    /// The `template.version` field must match the current version.
25804    pub template: std::option::Option<crate::model::WorkflowTemplate>,
25805
25806    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25807}
25808
25809impl UpdateWorkflowTemplateRequest {
25810    /// Creates a new default instance.
25811    pub fn new() -> Self {
25812        std::default::Default::default()
25813    }
25814
25815    /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25816    ///
25817    /// # Example
25818    /// ```ignore,no_run
25819    /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25820    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25821    /// let x = UpdateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25822    /// ```
25823    pub fn set_template<T>(mut self, v: T) -> Self
25824    where
25825        T: std::convert::Into<crate::model::WorkflowTemplate>,
25826    {
25827        self.template = std::option::Option::Some(v.into());
25828        self
25829    }
25830
25831    /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25832    ///
25833    /// # Example
25834    /// ```ignore,no_run
25835    /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25836    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25837    /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25838    /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25839    /// ```
25840    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25841    where
25842        T: std::convert::Into<crate::model::WorkflowTemplate>,
25843    {
25844        self.template = v.map(|x| x.into());
25845        self
25846    }
25847}
25848
25849impl wkt::message::Message for UpdateWorkflowTemplateRequest {
25850    fn typename() -> &'static str {
25851        "type.googleapis.com/google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest"
25852    }
25853}
25854
25855/// A request to list workflow templates in a project.
25856#[derive(Clone, Default, PartialEq)]
25857#[non_exhaustive]
25858pub struct ListWorkflowTemplatesRequest {
25859    /// Required. The resource name of the region or location, as described
25860    /// in <https://cloud.google.com/apis/design/resource_names>.
25861    ///
25862    /// * For `projects.regions.workflowTemplates,list`, the resource
25863    ///   name of the region has the following format:
25864    ///   `projects/{project_id}/regions/{region}`
25865    ///
25866    /// * For `projects.locations.workflowTemplates.list`, the
25867    ///   resource name of the location has the following format:
25868    ///   `projects/{project_id}/locations/{location}`
25869    ///
25870    pub parent: std::string::String,
25871
25872    /// Optional. The maximum number of results to return in each response.
25873    pub page_size: i32,
25874
25875    /// Optional. The page token, returned by a previous call, to request the
25876    /// next page of results.
25877    pub page_token: std::string::String,
25878
25879    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25880}
25881
25882impl ListWorkflowTemplatesRequest {
25883    /// Creates a new default instance.
25884    pub fn new() -> Self {
25885        std::default::Default::default()
25886    }
25887
25888    /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
25889    ///
25890    /// # Example
25891    /// ```ignore,no_run
25892    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25893    /// let x = ListWorkflowTemplatesRequest::new().set_parent("example");
25894    /// ```
25895    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25896        self.parent = v.into();
25897        self
25898    }
25899
25900    /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
25901    ///
25902    /// # Example
25903    /// ```ignore,no_run
25904    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25905    /// let x = ListWorkflowTemplatesRequest::new().set_page_size(42);
25906    /// ```
25907    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25908        self.page_size = v.into();
25909        self
25910    }
25911
25912    /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
25913    ///
25914    /// # Example
25915    /// ```ignore,no_run
25916    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25917    /// let x = ListWorkflowTemplatesRequest::new().set_page_token("example");
25918    /// ```
25919    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25920        self.page_token = v.into();
25921        self
25922    }
25923}
25924
25925impl wkt::message::Message for ListWorkflowTemplatesRequest {
25926    fn typename() -> &'static str {
25927        "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesRequest"
25928    }
25929}
25930
25931/// A response to a request to list workflow templates in a project.
25932#[derive(Clone, Default, PartialEq)]
25933#[non_exhaustive]
25934pub struct ListWorkflowTemplatesResponse {
25935    /// Output only. WorkflowTemplates list.
25936    pub templates: std::vec::Vec<crate::model::WorkflowTemplate>,
25937
25938    /// Output only. This token is included in the response if there are more
25939    /// results to fetch. To fetch additional results, provide this value as the
25940    /// page_token in a subsequent \<code\>ListWorkflowTemplatesRequest\</code\>.
25941    pub next_page_token: std::string::String,
25942
25943    /// Output only. List of workflow templates that could not be included in the
25944    /// response. Attempting to get one of these resources may indicate why it was
25945    /// not included in the list response.
25946    pub unreachable: std::vec::Vec<std::string::String>,
25947
25948    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25949}
25950
25951impl ListWorkflowTemplatesResponse {
25952    /// Creates a new default instance.
25953    pub fn new() -> Self {
25954        std::default::Default::default()
25955    }
25956
25957    /// Sets the value of [templates][crate::model::ListWorkflowTemplatesResponse::templates].
25958    ///
25959    /// # Example
25960    /// ```ignore,no_run
25961    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25962    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25963    /// let x = ListWorkflowTemplatesResponse::new()
25964    ///     .set_templates([
25965    ///         WorkflowTemplate::default()/* use setters */,
25966    ///         WorkflowTemplate::default()/* use (different) setters */,
25967    ///     ]);
25968    /// ```
25969    pub fn set_templates<T, V>(mut self, v: T) -> Self
25970    where
25971        T: std::iter::IntoIterator<Item = V>,
25972        V: std::convert::Into<crate::model::WorkflowTemplate>,
25973    {
25974        use std::iter::Iterator;
25975        self.templates = v.into_iter().map(|i| i.into()).collect();
25976        self
25977    }
25978
25979    /// Sets the value of [next_page_token][crate::model::ListWorkflowTemplatesResponse::next_page_token].
25980    ///
25981    /// # Example
25982    /// ```ignore,no_run
25983    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25984    /// let x = ListWorkflowTemplatesResponse::new().set_next_page_token("example");
25985    /// ```
25986    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25987        self.next_page_token = v.into();
25988        self
25989    }
25990
25991    /// Sets the value of [unreachable][crate::model::ListWorkflowTemplatesResponse::unreachable].
25992    ///
25993    /// # Example
25994    /// ```ignore,no_run
25995    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25996    /// let x = ListWorkflowTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
25997    /// ```
25998    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
25999    where
26000        T: std::iter::IntoIterator<Item = V>,
26001        V: std::convert::Into<std::string::String>,
26002    {
26003        use std::iter::Iterator;
26004        self.unreachable = v.into_iter().map(|i| i.into()).collect();
26005        self
26006    }
26007}
26008
26009impl wkt::message::Message for ListWorkflowTemplatesResponse {
26010    fn typename() -> &'static str {
26011        "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesResponse"
26012    }
26013}
26014
26015#[doc(hidden)]
26016impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowTemplatesResponse {
26017    type PageItem = crate::model::WorkflowTemplate;
26018
26019    fn items(self) -> std::vec::Vec<Self::PageItem> {
26020        self.templates
26021    }
26022
26023    fn next_page_token(&self) -> std::string::String {
26024        use std::clone::Clone;
26025        self.next_page_token.clone()
26026    }
26027}
26028
26029/// A request to delete a workflow template.
26030///
26031/// Currently started workflows will remain running.
26032#[derive(Clone, Default, PartialEq)]
26033#[non_exhaustive]
26034pub struct DeleteWorkflowTemplateRequest {
26035    /// Required. The resource name of the workflow template, as described
26036    /// in <https://cloud.google.com/apis/design/resource_names>.
26037    ///
26038    /// * For `projects.regions.workflowTemplates.delete`, the resource name
26039    ///   of the template has the following format:
26040    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
26041    ///
26042    /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
26043    ///   of the template has the following format:
26044    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
26045    ///
26046    pub name: std::string::String,
26047
26048    /// Optional. The version of workflow template to delete. If specified,
26049    /// will only delete the template if the current server version matches
26050    /// specified version.
26051    pub version: i32,
26052
26053    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26054}
26055
26056impl DeleteWorkflowTemplateRequest {
26057    /// Creates a new default instance.
26058    pub fn new() -> Self {
26059        std::default::Default::default()
26060    }
26061
26062    /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
26063    ///
26064    /// # Example
26065    /// ```ignore,no_run
26066    /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
26067    /// let x = DeleteWorkflowTemplateRequest::new().set_name("example");
26068    /// ```
26069    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26070        self.name = v.into();
26071        self
26072    }
26073
26074    /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
26075    ///
26076    /// # Example
26077    /// ```ignore,no_run
26078    /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
26079    /// let x = DeleteWorkflowTemplateRequest::new().set_version(42);
26080    /// ```
26081    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26082        self.version = v.into();
26083        self
26084    }
26085}
26086
26087impl wkt::message::Message for DeleteWorkflowTemplateRequest {
26088    fn typename() -> &'static str {
26089        "type.googleapis.com/google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest"
26090    }
26091}
26092
26093/// Cluster components that can be activated.
26094///
26095/// # Working with unknown values
26096///
26097/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26098/// additional enum variants at any time. Adding new variants is not considered
26099/// a breaking change. Applications should write their code in anticipation of:
26100///
26101/// - New values appearing in future releases of the client library, **and**
26102/// - New values received dynamically, without application changes.
26103///
26104/// Please consult the [Working with enums] section in the user guide for some
26105/// guidelines.
26106///
26107/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
26108#[derive(Clone, Debug, PartialEq)]
26109#[non_exhaustive]
26110pub enum Component {
26111    /// Unspecified component. Specifying this will cause Cluster creation to fail.
26112    Unspecified,
26113    /// The Anaconda component is no longer supported or applicable to
26114    /// [supported Dataproc on Compute Engine image versions]
26115    /// (<https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-version-clusters#supported-dataproc-image-versions>).
26116    /// It cannot be activated on clusters created with supported Dataproc on
26117    /// Compute Engine image versions.
26118    Anaconda,
26119    /// Delta Lake.
26120    Delta,
26121    /// Docker
26122    Docker,
26123    /// The Druid query engine. (alpha)
26124    Druid,
26125    /// Flink
26126    Flink,
26127    /// HBase. (beta)
26128    Hbase,
26129    /// The Hive Web HCatalog (the REST service for accessing HCatalog).
26130    HiveWebhcat,
26131    /// Hudi.
26132    Hudi,
26133    /// Iceberg.
26134    Iceberg,
26135    /// The Jupyter Notebook.
26136    Jupyter,
26137    /// The Jupyter Kernel Gateway.
26138    JupyterKernelGateway,
26139    /// The Pig component.
26140    Pig,
26141    /// The Presto query engine.
26142    Presto,
26143    /// The Trino query engine.
26144    Trino,
26145    /// The Ranger service.
26146    Ranger,
26147    /// The Solr service.
26148    Solr,
26149    /// The Zeppelin notebook.
26150    Zeppelin,
26151    /// The Zookeeper service.
26152    Zookeeper,
26153    /// If set, the enum was initialized with an unknown value.
26154    ///
26155    /// Applications can examine the value using [Component::value] or
26156    /// [Component::name].
26157    UnknownValue(component::UnknownValue),
26158}
26159
26160#[doc(hidden)]
26161pub mod component {
26162    #[allow(unused_imports)]
26163    use super::*;
26164    #[derive(Clone, Debug, PartialEq)]
26165    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26166}
26167
26168impl Component {
26169    /// Gets the enum value.
26170    ///
26171    /// Returns `None` if the enum contains an unknown value deserialized from
26172    /// the string representation of enums.
26173    pub fn value(&self) -> std::option::Option<i32> {
26174        match self {
26175            Self::Unspecified => std::option::Option::Some(0),
26176            Self::Anaconda => std::option::Option::Some(5),
26177            Self::Delta => std::option::Option::Some(20),
26178            Self::Docker => std::option::Option::Some(13),
26179            Self::Druid => std::option::Option::Some(9),
26180            Self::Flink => std::option::Option::Some(14),
26181            Self::Hbase => std::option::Option::Some(11),
26182            Self::HiveWebhcat => std::option::Option::Some(3),
26183            Self::Hudi => std::option::Option::Some(18),
26184            Self::Iceberg => std::option::Option::Some(19),
26185            Self::Jupyter => std::option::Option::Some(1),
26186            Self::JupyterKernelGateway => std::option::Option::Some(22),
26187            Self::Pig => std::option::Option::Some(21),
26188            Self::Presto => std::option::Option::Some(6),
26189            Self::Trino => std::option::Option::Some(17),
26190            Self::Ranger => std::option::Option::Some(12),
26191            Self::Solr => std::option::Option::Some(10),
26192            Self::Zeppelin => std::option::Option::Some(4),
26193            Self::Zookeeper => std::option::Option::Some(8),
26194            Self::UnknownValue(u) => u.0.value(),
26195        }
26196    }
26197
26198    /// Gets the enum value as a string.
26199    ///
26200    /// Returns `None` if the enum contains an unknown value deserialized from
26201    /// the integer representation of enums.
26202    pub fn name(&self) -> std::option::Option<&str> {
26203        match self {
26204            Self::Unspecified => std::option::Option::Some("COMPONENT_UNSPECIFIED"),
26205            Self::Anaconda => std::option::Option::Some("ANACONDA"),
26206            Self::Delta => std::option::Option::Some("DELTA"),
26207            Self::Docker => std::option::Option::Some("DOCKER"),
26208            Self::Druid => std::option::Option::Some("DRUID"),
26209            Self::Flink => std::option::Option::Some("FLINK"),
26210            Self::Hbase => std::option::Option::Some("HBASE"),
26211            Self::HiveWebhcat => std::option::Option::Some("HIVE_WEBHCAT"),
26212            Self::Hudi => std::option::Option::Some("HUDI"),
26213            Self::Iceberg => std::option::Option::Some("ICEBERG"),
26214            Self::Jupyter => std::option::Option::Some("JUPYTER"),
26215            Self::JupyterKernelGateway => std::option::Option::Some("JUPYTER_KERNEL_GATEWAY"),
26216            Self::Pig => std::option::Option::Some("PIG"),
26217            Self::Presto => std::option::Option::Some("PRESTO"),
26218            Self::Trino => std::option::Option::Some("TRINO"),
26219            Self::Ranger => std::option::Option::Some("RANGER"),
26220            Self::Solr => std::option::Option::Some("SOLR"),
26221            Self::Zeppelin => std::option::Option::Some("ZEPPELIN"),
26222            Self::Zookeeper => std::option::Option::Some("ZOOKEEPER"),
26223            Self::UnknownValue(u) => u.0.name(),
26224        }
26225    }
26226}
26227
26228impl std::default::Default for Component {
26229    fn default() -> Self {
26230        use std::convert::From;
26231        Self::from(0)
26232    }
26233}
26234
26235impl std::fmt::Display for Component {
26236    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26237        wkt::internal::display_enum(f, self.name(), self.value())
26238    }
26239}
26240
26241impl std::convert::From<i32> for Component {
26242    fn from(value: i32) -> Self {
26243        match value {
26244            0 => Self::Unspecified,
26245            1 => Self::Jupyter,
26246            3 => Self::HiveWebhcat,
26247            4 => Self::Zeppelin,
26248            5 => Self::Anaconda,
26249            6 => Self::Presto,
26250            8 => Self::Zookeeper,
26251            9 => Self::Druid,
26252            10 => Self::Solr,
26253            11 => Self::Hbase,
26254            12 => Self::Ranger,
26255            13 => Self::Docker,
26256            14 => Self::Flink,
26257            17 => Self::Trino,
26258            18 => Self::Hudi,
26259            19 => Self::Iceberg,
26260            20 => Self::Delta,
26261            21 => Self::Pig,
26262            22 => Self::JupyterKernelGateway,
26263            _ => Self::UnknownValue(component::UnknownValue(
26264                wkt::internal::UnknownEnumValue::Integer(value),
26265            )),
26266        }
26267    }
26268}
26269
26270impl std::convert::From<&str> for Component {
26271    fn from(value: &str) -> Self {
26272        use std::string::ToString;
26273        match value {
26274            "COMPONENT_UNSPECIFIED" => Self::Unspecified,
26275            "ANACONDA" => Self::Anaconda,
26276            "DELTA" => Self::Delta,
26277            "DOCKER" => Self::Docker,
26278            "DRUID" => Self::Druid,
26279            "FLINK" => Self::Flink,
26280            "HBASE" => Self::Hbase,
26281            "HIVE_WEBHCAT" => Self::HiveWebhcat,
26282            "HUDI" => Self::Hudi,
26283            "ICEBERG" => Self::Iceberg,
26284            "JUPYTER" => Self::Jupyter,
26285            "JUPYTER_KERNEL_GATEWAY" => Self::JupyterKernelGateway,
26286            "PIG" => Self::Pig,
26287            "PRESTO" => Self::Presto,
26288            "TRINO" => Self::Trino,
26289            "RANGER" => Self::Ranger,
26290            "SOLR" => Self::Solr,
26291            "ZEPPELIN" => Self::Zeppelin,
26292            "ZOOKEEPER" => Self::Zookeeper,
26293            _ => Self::UnknownValue(component::UnknownValue(
26294                wkt::internal::UnknownEnumValue::String(value.to_string()),
26295            )),
26296        }
26297    }
26298}
26299
26300impl serde::ser::Serialize for Component {
26301    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26302    where
26303        S: serde::Serializer,
26304    {
26305        match self {
26306            Self::Unspecified => serializer.serialize_i32(0),
26307            Self::Anaconda => serializer.serialize_i32(5),
26308            Self::Delta => serializer.serialize_i32(20),
26309            Self::Docker => serializer.serialize_i32(13),
26310            Self::Druid => serializer.serialize_i32(9),
26311            Self::Flink => serializer.serialize_i32(14),
26312            Self::Hbase => serializer.serialize_i32(11),
26313            Self::HiveWebhcat => serializer.serialize_i32(3),
26314            Self::Hudi => serializer.serialize_i32(18),
26315            Self::Iceberg => serializer.serialize_i32(19),
26316            Self::Jupyter => serializer.serialize_i32(1),
26317            Self::JupyterKernelGateway => serializer.serialize_i32(22),
26318            Self::Pig => serializer.serialize_i32(21),
26319            Self::Presto => serializer.serialize_i32(6),
26320            Self::Trino => serializer.serialize_i32(17),
26321            Self::Ranger => serializer.serialize_i32(12),
26322            Self::Solr => serializer.serialize_i32(10),
26323            Self::Zeppelin => serializer.serialize_i32(4),
26324            Self::Zookeeper => serializer.serialize_i32(8),
26325            Self::UnknownValue(u) => u.0.serialize(serializer),
26326        }
26327    }
26328}
26329
26330impl<'de> serde::de::Deserialize<'de> for Component {
26331    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26332    where
26333        D: serde::Deserializer<'de>,
26334    {
26335        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Component>::new(
26336            ".google.cloud.dataproc.v1.Component",
26337        ))
26338    }
26339}
26340
26341/// Actions in response to failure of a resource associated with a cluster.
26342///
26343/// # Working with unknown values
26344///
26345/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26346/// additional enum variants at any time. Adding new variants is not considered
26347/// a breaking change. Applications should write their code in anticipation of:
26348///
26349/// - New values appearing in future releases of the client library, **and**
26350/// - New values received dynamically, without application changes.
26351///
26352/// Please consult the [Working with enums] section in the user guide for some
26353/// guidelines.
26354///
26355/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
26356#[derive(Clone, Debug, PartialEq)]
26357#[non_exhaustive]
26358pub enum FailureAction {
26359    /// When FailureAction is unspecified, failure action defaults to NO_ACTION.
26360    Unspecified,
26361    /// Take no action on failure to create a cluster resource. NO_ACTION is the
26362    /// default.
26363    NoAction,
26364    /// Delete the failed cluster resource.
26365    Delete,
26366    /// If set, the enum was initialized with an unknown value.
26367    ///
26368    /// Applications can examine the value using [FailureAction::value] or
26369    /// [FailureAction::name].
26370    UnknownValue(failure_action::UnknownValue),
26371}
26372
26373#[doc(hidden)]
26374pub mod failure_action {
26375    #[allow(unused_imports)]
26376    use super::*;
26377    #[derive(Clone, Debug, PartialEq)]
26378    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26379}
26380
26381impl FailureAction {
26382    /// Gets the enum value.
26383    ///
26384    /// Returns `None` if the enum contains an unknown value deserialized from
26385    /// the string representation of enums.
26386    pub fn value(&self) -> std::option::Option<i32> {
26387        match self {
26388            Self::Unspecified => std::option::Option::Some(0),
26389            Self::NoAction => std::option::Option::Some(1),
26390            Self::Delete => std::option::Option::Some(2),
26391            Self::UnknownValue(u) => u.0.value(),
26392        }
26393    }
26394
26395    /// Gets the enum value as a string.
26396    ///
26397    /// Returns `None` if the enum contains an unknown value deserialized from
26398    /// the integer representation of enums.
26399    pub fn name(&self) -> std::option::Option<&str> {
26400        match self {
26401            Self::Unspecified => std::option::Option::Some("FAILURE_ACTION_UNSPECIFIED"),
26402            Self::NoAction => std::option::Option::Some("NO_ACTION"),
26403            Self::Delete => std::option::Option::Some("DELETE"),
26404            Self::UnknownValue(u) => u.0.name(),
26405        }
26406    }
26407}
26408
26409impl std::default::Default for FailureAction {
26410    fn default() -> Self {
26411        use std::convert::From;
26412        Self::from(0)
26413    }
26414}
26415
26416impl std::fmt::Display for FailureAction {
26417    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26418        wkt::internal::display_enum(f, self.name(), self.value())
26419    }
26420}
26421
26422impl std::convert::From<i32> for FailureAction {
26423    fn from(value: i32) -> Self {
26424        match value {
26425            0 => Self::Unspecified,
26426            1 => Self::NoAction,
26427            2 => Self::Delete,
26428            _ => Self::UnknownValue(failure_action::UnknownValue(
26429                wkt::internal::UnknownEnumValue::Integer(value),
26430            )),
26431        }
26432    }
26433}
26434
26435impl std::convert::From<&str> for FailureAction {
26436    fn from(value: &str) -> Self {
26437        use std::string::ToString;
26438        match value {
26439            "FAILURE_ACTION_UNSPECIFIED" => Self::Unspecified,
26440            "NO_ACTION" => Self::NoAction,
26441            "DELETE" => Self::Delete,
26442            _ => Self::UnknownValue(failure_action::UnknownValue(
26443                wkt::internal::UnknownEnumValue::String(value.to_string()),
26444            )),
26445        }
26446    }
26447}
26448
26449impl serde::ser::Serialize for FailureAction {
26450    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26451    where
26452        S: serde::Serializer,
26453    {
26454        match self {
26455            Self::Unspecified => serializer.serialize_i32(0),
26456            Self::NoAction => serializer.serialize_i32(1),
26457            Self::Delete => serializer.serialize_i32(2),
26458            Self::UnknownValue(u) => u.0.serialize(serializer),
26459        }
26460    }
26461}
26462
26463impl<'de> serde::de::Deserialize<'de> for FailureAction {
26464    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26465    where
26466        D: serde::Deserializer<'de>,
26467    {
26468        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureAction>::new(
26469            ".google.cloud.dataproc.v1.FailureAction",
26470        ))
26471    }
26472}