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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate google_cloud_type;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Describes an autoscaling policy for Dataproc cluster autoscaler.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct AutoscalingPolicy {
45 /// Required. The policy id.
46 ///
47 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
48 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
49 /// or hyphen. Must consist of between 3 and 50 characters.
50 pub id: std::string::String,
51
52 /// Output only. The "resource name" of the autoscaling policy, as described
53 /// in <https://cloud.google.com/apis/design/resource_names>.
54 ///
55 /// * For `projects.regions.autoscalingPolicies`, the resource name of the
56 /// policy has the following format:
57 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
58 ///
59 /// * For `projects.locations.autoscalingPolicies`, the resource name of the
60 /// policy has the following format:
61 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
62 ///
63 pub name: std::string::String,
64
65 /// Required. Describes how the autoscaler will operate for primary workers.
66 pub worker_config: std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
67
68 /// Optional. Describes how the autoscaler will operate for secondary workers.
69 pub secondary_worker_config:
70 std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
71
72 /// Optional. The labels to associate with this autoscaling policy.
73 /// Label **keys** must contain 1 to 63 characters, and must conform to
74 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
75 /// Label **values** may be empty, but, if present, must contain 1 to 63
76 /// characters, and must conform to [RFC
77 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
78 /// associated with an autoscaling policy.
79 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
80
81 /// Optional. The type of the clusters for which this autoscaling policy is to
82 /// be configured.
83 pub cluster_type: crate::model::autoscaling_policy::ClusterType,
84
85 /// Autoscaling algorithm for policy.
86 pub algorithm: std::option::Option<crate::model::autoscaling_policy::Algorithm>,
87
88 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
89}
90
91impl AutoscalingPolicy {
92 /// Creates a new default instance.
93 pub fn new() -> Self {
94 std::default::Default::default()
95 }
96
97 /// Sets the value of [id][crate::model::AutoscalingPolicy::id].
98 ///
99 /// # Example
100 /// ```ignore,no_run
101 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
102 /// let x = AutoscalingPolicy::new().set_id("example");
103 /// ```
104 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
105 self.id = v.into();
106 self
107 }
108
109 /// Sets the value of [name][crate::model::AutoscalingPolicy::name].
110 ///
111 /// # Example
112 /// ```ignore,no_run
113 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
114 /// # let project_id = "project_id";
115 /// # let location_id = "location_id";
116 /// # let autoscaling_policy_id = "autoscaling_policy_id";
117 /// let x = AutoscalingPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/autoscalingPolicies/{autoscaling_policy_id}"));
118 /// ```
119 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
120 self.name = v.into();
121 self
122 }
123
124 /// Sets the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
125 ///
126 /// # Example
127 /// ```ignore,no_run
128 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
129 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
130 /// let x = AutoscalingPolicy::new().set_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
131 /// ```
132 pub fn set_worker_config<T>(mut self, v: T) -> Self
133 where
134 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
135 {
136 self.worker_config = std::option::Option::Some(v.into());
137 self
138 }
139
140 /// Sets or clears the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
141 ///
142 /// # Example
143 /// ```ignore,no_run
144 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
145 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
146 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
147 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
148 /// ```
149 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
150 where
151 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
152 {
153 self.worker_config = v.map(|x| x.into());
154 self
155 }
156
157 /// Sets the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
158 ///
159 /// # Example
160 /// ```ignore,no_run
161 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
162 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
163 /// let x = AutoscalingPolicy::new().set_secondary_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
164 /// ```
165 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
166 where
167 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
168 {
169 self.secondary_worker_config = std::option::Option::Some(v.into());
170 self
171 }
172
173 /// Sets or clears the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
174 ///
175 /// # Example
176 /// ```ignore,no_run
177 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
178 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
179 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
180 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
181 /// ```
182 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
183 where
184 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
185 {
186 self.secondary_worker_config = v.map(|x| x.into());
187 self
188 }
189
190 /// Sets the value of [labels][crate::model::AutoscalingPolicy::labels].
191 ///
192 /// # Example
193 /// ```ignore,no_run
194 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
195 /// let x = AutoscalingPolicy::new().set_labels([
196 /// ("key0", "abc"),
197 /// ("key1", "xyz"),
198 /// ]);
199 /// ```
200 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
201 where
202 T: std::iter::IntoIterator<Item = (K, V)>,
203 K: std::convert::Into<std::string::String>,
204 V: std::convert::Into<std::string::String>,
205 {
206 use std::iter::Iterator;
207 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
208 self
209 }
210
211 /// Sets the value of [cluster_type][crate::model::AutoscalingPolicy::cluster_type].
212 ///
213 /// # Example
214 /// ```ignore,no_run
215 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
216 /// use google_cloud_dataproc_v1::model::autoscaling_policy::ClusterType;
217 /// let x0 = AutoscalingPolicy::new().set_cluster_type(ClusterType::Standard);
218 /// let x1 = AutoscalingPolicy::new().set_cluster_type(ClusterType::ZeroScale);
219 /// ```
220 pub fn set_cluster_type<
221 T: std::convert::Into<crate::model::autoscaling_policy::ClusterType>,
222 >(
223 mut self,
224 v: T,
225 ) -> Self {
226 self.cluster_type = v.into();
227 self
228 }
229
230 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm].
231 ///
232 /// Note that all the setters affecting `algorithm` are mutually
233 /// exclusive.
234 ///
235 /// # Example
236 /// ```ignore,no_run
237 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
238 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
239 /// let x = AutoscalingPolicy::new().set_algorithm(Some(
240 /// google_cloud_dataproc_v1::model::autoscaling_policy::Algorithm::BasicAlgorithm(BasicAutoscalingAlgorithm::default().into())));
241 /// ```
242 pub fn set_algorithm<
243 T: std::convert::Into<std::option::Option<crate::model::autoscaling_policy::Algorithm>>,
244 >(
245 mut self,
246 v: T,
247 ) -> Self {
248 self.algorithm = v.into();
249 self
250 }
251
252 /// The value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
253 /// if it holds a `BasicAlgorithm`, `None` if the field is not set or
254 /// holds a different branch.
255 pub fn basic_algorithm(
256 &self,
257 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>> {
258 #[allow(unreachable_patterns)]
259 self.algorithm.as_ref().and_then(|v| match v {
260 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v) => {
261 std::option::Option::Some(v)
262 }
263 _ => std::option::Option::None,
264 })
265 }
266
267 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
268 /// to hold a `BasicAlgorithm`.
269 ///
270 /// Note that all the setters affecting `algorithm` are
271 /// mutually exclusive.
272 ///
273 /// # Example
274 /// ```ignore,no_run
275 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
276 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
277 /// let x = AutoscalingPolicy::new().set_basic_algorithm(BasicAutoscalingAlgorithm::default()/* use setters */);
278 /// assert!(x.basic_algorithm().is_some());
279 /// ```
280 pub fn set_basic_algorithm<
281 T: std::convert::Into<std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>>,
282 >(
283 mut self,
284 v: T,
285 ) -> Self {
286 self.algorithm = std::option::Option::Some(
287 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v.into()),
288 );
289 self
290 }
291}
292
293impl wkt::message::Message for AutoscalingPolicy {
294 fn typename() -> &'static str {
295 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingPolicy"
296 }
297}
298
299/// Defines additional types related to [AutoscalingPolicy].
300pub mod autoscaling_policy {
301 #[allow(unused_imports)]
302 use super::*;
303
304 /// The type of the clusters for which this autoscaling policy is to be
305 /// configured.
306 ///
307 /// # Working with unknown values
308 ///
309 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
310 /// additional enum variants at any time. Adding new variants is not considered
311 /// a breaking change. Applications should write their code in anticipation of:
312 ///
313 /// - New values appearing in future releases of the client library, **and**
314 /// - New values received dynamically, without application changes.
315 ///
316 /// Please consult the [Working with enums] section in the user guide for some
317 /// guidelines.
318 ///
319 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
320 #[derive(Clone, Debug, PartialEq)]
321 #[non_exhaustive]
322 pub enum ClusterType {
323 /// Not set.
324 Unspecified,
325 /// Standard dataproc cluster with a minimum of two primary workers.
326 Standard,
327 /// Clusters that can use only secondary workers and be scaled down to zero
328 /// secondary worker nodes.
329 ZeroScale,
330 /// If set, the enum was initialized with an unknown value.
331 ///
332 /// Applications can examine the value using [ClusterType::value] or
333 /// [ClusterType::name].
334 UnknownValue(cluster_type::UnknownValue),
335 }
336
337 #[doc(hidden)]
338 pub mod cluster_type {
339 #[allow(unused_imports)]
340 use super::*;
341 #[derive(Clone, Debug, PartialEq)]
342 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
343 }
344
345 impl ClusterType {
346 /// Gets the enum value.
347 ///
348 /// Returns `None` if the enum contains an unknown value deserialized from
349 /// the string representation of enums.
350 pub fn value(&self) -> std::option::Option<i32> {
351 match self {
352 Self::Unspecified => std::option::Option::Some(0),
353 Self::Standard => std::option::Option::Some(1),
354 Self::ZeroScale => std::option::Option::Some(2),
355 Self::UnknownValue(u) => u.0.value(),
356 }
357 }
358
359 /// Gets the enum value as a string.
360 ///
361 /// Returns `None` if the enum contains an unknown value deserialized from
362 /// the integer representation of enums.
363 pub fn name(&self) -> std::option::Option<&str> {
364 match self {
365 Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
366 Self::Standard => std::option::Option::Some("STANDARD"),
367 Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
368 Self::UnknownValue(u) => u.0.name(),
369 }
370 }
371 }
372
373 impl std::default::Default for ClusterType {
374 fn default() -> Self {
375 use std::convert::From;
376 Self::from(0)
377 }
378 }
379
380 impl std::fmt::Display for ClusterType {
381 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
382 wkt::internal::display_enum(f, self.name(), self.value())
383 }
384 }
385
386 impl std::convert::From<i32> for ClusterType {
387 fn from(value: i32) -> Self {
388 match value {
389 0 => Self::Unspecified,
390 1 => Self::Standard,
391 2 => Self::ZeroScale,
392 _ => Self::UnknownValue(cluster_type::UnknownValue(
393 wkt::internal::UnknownEnumValue::Integer(value),
394 )),
395 }
396 }
397 }
398
399 impl std::convert::From<&str> for ClusterType {
400 fn from(value: &str) -> Self {
401 use std::string::ToString;
402 match value {
403 "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
404 "STANDARD" => Self::Standard,
405 "ZERO_SCALE" => Self::ZeroScale,
406 _ => Self::UnknownValue(cluster_type::UnknownValue(
407 wkt::internal::UnknownEnumValue::String(value.to_string()),
408 )),
409 }
410 }
411 }
412
413 impl serde::ser::Serialize for ClusterType {
414 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
415 where
416 S: serde::Serializer,
417 {
418 match self {
419 Self::Unspecified => serializer.serialize_i32(0),
420 Self::Standard => serializer.serialize_i32(1),
421 Self::ZeroScale => serializer.serialize_i32(2),
422 Self::UnknownValue(u) => u.0.serialize(serializer),
423 }
424 }
425 }
426
427 impl<'de> serde::de::Deserialize<'de> for ClusterType {
428 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
429 where
430 D: serde::Deserializer<'de>,
431 {
432 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
433 ".google.cloud.dataproc.v1.AutoscalingPolicy.ClusterType",
434 ))
435 }
436 }
437
438 /// Autoscaling algorithm for policy.
439 #[derive(Clone, Debug, PartialEq)]
440 #[non_exhaustive]
441 pub enum Algorithm {
442 #[allow(missing_docs)]
443 BasicAlgorithm(std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>),
444 }
445}
446
447/// Basic algorithm for autoscaling.
448#[derive(Clone, Default, PartialEq)]
449#[non_exhaustive]
450pub struct BasicAutoscalingAlgorithm {
451 /// Optional. Duration between scaling events. A scaling period starts after
452 /// the update operation from the previous event has completed.
453 ///
454 /// Bounds: [2m, 1d]. Default: 2m.
455 pub cooldown_period: std::option::Option<wkt::Duration>,
456
457 #[allow(missing_docs)]
458 pub config: std::option::Option<crate::model::basic_autoscaling_algorithm::Config>,
459
460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
461}
462
463impl BasicAutoscalingAlgorithm {
464 /// Creates a new default instance.
465 pub fn new() -> Self {
466 std::default::Default::default()
467 }
468
469 /// Sets the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
470 ///
471 /// # Example
472 /// ```ignore,no_run
473 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
474 /// use wkt::Duration;
475 /// let x = BasicAutoscalingAlgorithm::new().set_cooldown_period(Duration::default()/* use setters */);
476 /// ```
477 pub fn set_cooldown_period<T>(mut self, v: T) -> Self
478 where
479 T: std::convert::Into<wkt::Duration>,
480 {
481 self.cooldown_period = std::option::Option::Some(v.into());
482 self
483 }
484
485 /// Sets or clears the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
486 ///
487 /// # Example
488 /// ```ignore,no_run
489 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
490 /// use wkt::Duration;
491 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(Some(Duration::default()/* use setters */));
492 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(None::<Duration>);
493 /// ```
494 pub fn set_or_clear_cooldown_period<T>(mut self, v: std::option::Option<T>) -> Self
495 where
496 T: std::convert::Into<wkt::Duration>,
497 {
498 self.cooldown_period = v.map(|x| x.into());
499 self
500 }
501
502 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config].
503 ///
504 /// Note that all the setters affecting `config` are mutually
505 /// exclusive.
506 ///
507 /// # Example
508 /// ```ignore,no_run
509 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
510 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
511 /// let x = BasicAutoscalingAlgorithm::new().set_config(Some(
512 /// google_cloud_dataproc_v1::model::basic_autoscaling_algorithm::Config::YarnConfig(BasicYarnAutoscalingConfig::default().into())));
513 /// ```
514 pub fn set_config<
515 T: std::convert::Into<std::option::Option<crate::model::basic_autoscaling_algorithm::Config>>,
516 >(
517 mut self,
518 v: T,
519 ) -> Self {
520 self.config = v.into();
521 self
522 }
523
524 /// The value of [config][crate::model::BasicAutoscalingAlgorithm::config]
525 /// if it holds a `YarnConfig`, `None` if the field is not set or
526 /// holds a different branch.
527 pub fn yarn_config(
528 &self,
529 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>> {
530 #[allow(unreachable_patterns)]
531 self.config.as_ref().and_then(|v| match v {
532 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v) => {
533 std::option::Option::Some(v)
534 }
535 _ => std::option::Option::None,
536 })
537 }
538
539 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config]
540 /// to hold a `YarnConfig`.
541 ///
542 /// Note that all the setters affecting `config` are
543 /// mutually exclusive.
544 ///
545 /// # Example
546 /// ```ignore,no_run
547 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
548 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
549 /// let x = BasicAutoscalingAlgorithm::new().set_yarn_config(BasicYarnAutoscalingConfig::default()/* use setters */);
550 /// assert!(x.yarn_config().is_some());
551 /// ```
552 pub fn set_yarn_config<
553 T: std::convert::Into<std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>>,
554 >(
555 mut self,
556 v: T,
557 ) -> Self {
558 self.config = std::option::Option::Some(
559 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v.into()),
560 );
561 self
562 }
563}
564
565impl wkt::message::Message for BasicAutoscalingAlgorithm {
566 fn typename() -> &'static str {
567 "type.googleapis.com/google.cloud.dataproc.v1.BasicAutoscalingAlgorithm"
568 }
569}
570
571/// Defines additional types related to [BasicAutoscalingAlgorithm].
572pub mod basic_autoscaling_algorithm {
573 #[allow(unused_imports)]
574 use super::*;
575
576 #[allow(missing_docs)]
577 #[derive(Clone, Debug, PartialEq)]
578 #[non_exhaustive]
579 pub enum Config {
580 /// Required. YARN autoscaling configuration.
581 YarnConfig(std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>),
582 }
583}
584
585/// Basic autoscaling configurations for YARN.
586#[derive(Clone, Default, PartialEq)]
587#[non_exhaustive]
588pub struct BasicYarnAutoscalingConfig {
589 /// Required. Timeout for YARN graceful decommissioning of Node Managers.
590 /// Specifies the duration to wait for jobs to complete before forcefully
591 /// removing workers (and potentially interrupting jobs). Only applicable to
592 /// downscaling operations.
593 ///
594 /// Bounds: [0s, 1d].
595 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
596
597 /// Required. Fraction of average YARN pending memory in the last cooldown
598 /// period for which to add workers. A scale-up factor of 1.0 will result in
599 /// scaling up so that there is no pending memory remaining after the update
600 /// (more aggressive scaling). A scale-up factor closer to 0 will result in a
601 /// smaller magnitude of scaling up (less aggressive scaling). See [How
602 /// autoscaling
603 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
604 /// for more information.
605 ///
606 /// Bounds: [0.0, 1.0].
607 pub scale_up_factor: f64,
608
609 /// Required. Fraction of average YARN pending memory in the last cooldown
610 /// period for which to remove workers. A scale-down factor of 1 will result in
611 /// scaling down so that there is no available memory remaining after the
612 /// update (more aggressive scaling). A scale-down factor of 0 disables
613 /// removing workers, which can be beneficial for autoscaling a single job.
614 /// See [How autoscaling
615 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
616 /// for more information.
617 ///
618 /// Bounds: [0.0, 1.0].
619 pub scale_down_factor: f64,
620
621 /// Optional. Minimum scale-up threshold as a fraction of total cluster size
622 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
623 /// 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
624 /// the cluster to scale. A threshold of 0 means the autoscaler will scale up
625 /// on any recommended change.
626 ///
627 /// Bounds: [0.0, 1.0]. Default: 0.0.
628 pub scale_up_min_worker_fraction: f64,
629
630 /// Optional. Minimum scale-down threshold as a fraction of total cluster size
631 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
632 /// 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
633 /// the cluster to scale. A threshold of 0 means the autoscaler will scale down
634 /// on any recommended change.
635 ///
636 /// Bounds: [0.0, 1.0]. Default: 0.0.
637 pub scale_down_min_worker_fraction: f64,
638
639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
640}
641
642impl BasicYarnAutoscalingConfig {
643 /// Creates a new default instance.
644 pub fn new() -> Self {
645 std::default::Default::default()
646 }
647
648 /// Sets the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
649 ///
650 /// # Example
651 /// ```ignore,no_run
652 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
653 /// use wkt::Duration;
654 /// let x = BasicYarnAutoscalingConfig::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
655 /// ```
656 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
657 where
658 T: std::convert::Into<wkt::Duration>,
659 {
660 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
661 self
662 }
663
664 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
665 ///
666 /// # Example
667 /// ```ignore,no_run
668 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
669 /// use wkt::Duration;
670 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
671 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
672 /// ```
673 pub fn set_or_clear_graceful_decommission_timeout<T>(
674 mut self,
675 v: std::option::Option<T>,
676 ) -> Self
677 where
678 T: std::convert::Into<wkt::Duration>,
679 {
680 self.graceful_decommission_timeout = v.map(|x| x.into());
681 self
682 }
683
684 /// Sets the value of [scale_up_factor][crate::model::BasicYarnAutoscalingConfig::scale_up_factor].
685 ///
686 /// # Example
687 /// ```ignore,no_run
688 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
689 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_factor(42.0);
690 /// ```
691 pub fn set_scale_up_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
692 self.scale_up_factor = v.into();
693 self
694 }
695
696 /// Sets the value of [scale_down_factor][crate::model::BasicYarnAutoscalingConfig::scale_down_factor].
697 ///
698 /// # Example
699 /// ```ignore,no_run
700 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
701 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_factor(42.0);
702 /// ```
703 pub fn set_scale_down_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
704 self.scale_down_factor = v.into();
705 self
706 }
707
708 /// Sets the value of [scale_up_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_up_min_worker_fraction].
709 ///
710 /// # Example
711 /// ```ignore,no_run
712 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
713 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_min_worker_fraction(42.0);
714 /// ```
715 pub fn set_scale_up_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
716 self.scale_up_min_worker_fraction = v.into();
717 self
718 }
719
720 /// Sets the value of [scale_down_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_down_min_worker_fraction].
721 ///
722 /// # Example
723 /// ```ignore,no_run
724 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
725 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_min_worker_fraction(42.0);
726 /// ```
727 pub fn set_scale_down_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
728 self.scale_down_min_worker_fraction = v.into();
729 self
730 }
731}
732
733impl wkt::message::Message for BasicYarnAutoscalingConfig {
734 fn typename() -> &'static str {
735 "type.googleapis.com/google.cloud.dataproc.v1.BasicYarnAutoscalingConfig"
736 }
737}
738
739/// Configuration for the size bounds of an instance group, including its
740/// proportional size to other groups.
741#[derive(Clone, Default, PartialEq)]
742#[non_exhaustive]
743pub struct InstanceGroupAutoscalingPolicyConfig {
744 /// Optional. Minimum number of instances for this group.
745 ///
746 /// Primary workers - Bounds: [2, max_instances]. Default: 2.
747 /// Secondary workers - Bounds: [0, max_instances]. Default: 0.
748 pub min_instances: i32,
749
750 /// Required. Maximum number of instances for this group. Required for primary
751 /// workers. Note that by default, clusters will not use secondary workers.
752 /// Required for secondary workers if the minimum secondary instances is set.
753 ///
754 /// Primary workers - Bounds: [min_instances, ).
755 /// Secondary workers - Bounds: [min_instances, ). Default: 0.
756 pub max_instances: i32,
757
758 /// Optional. Weight for the instance group, which is used to determine the
759 /// fraction of total workers in the cluster from this instance group.
760 /// For example, if primary workers have weight 2, and secondary workers have
761 /// weight 1, the cluster will have approximately 2 primary workers for each
762 /// secondary worker.
763 ///
764 /// The cluster may not reach the specified balance if constrained
765 /// by min/max bounds or other autoscaling settings. For example, if
766 /// `max_instances` for secondary workers is 0, then only primary workers will
767 /// be added. The cluster can also be out of balance when created.
768 ///
769 /// If weight is not set on any instance group, the cluster will default to
770 /// equal weight for all groups: the cluster will attempt to maintain an equal
771 /// number of workers in each group within the configured size bounds for each
772 /// group. If weight is set for one group only, the cluster will default to
773 /// zero weight on the unset group. For example if weight is set only on
774 /// primary workers, the cluster will use primary workers only and no
775 /// secondary workers.
776 pub weight: i32,
777
778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
779}
780
781impl InstanceGroupAutoscalingPolicyConfig {
782 /// Creates a new default instance.
783 pub fn new() -> Self {
784 std::default::Default::default()
785 }
786
787 /// Sets the value of [min_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::min_instances].
788 ///
789 /// # Example
790 /// ```ignore,no_run
791 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
792 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_min_instances(42);
793 /// ```
794 pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
795 self.min_instances = v.into();
796 self
797 }
798
799 /// Sets the value of [max_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::max_instances].
800 ///
801 /// # Example
802 /// ```ignore,no_run
803 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
804 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_max_instances(42);
805 /// ```
806 pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
807 self.max_instances = v.into();
808 self
809 }
810
811 /// Sets the value of [weight][crate::model::InstanceGroupAutoscalingPolicyConfig::weight].
812 ///
813 /// # Example
814 /// ```ignore,no_run
815 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
816 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_weight(42);
817 /// ```
818 pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
819 self.weight = v.into();
820 self
821 }
822}
823
824impl wkt::message::Message for InstanceGroupAutoscalingPolicyConfig {
825 fn typename() -> &'static str {
826 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig"
827 }
828}
829
830/// A request to create an autoscaling policy.
831#[derive(Clone, Default, PartialEq)]
832#[non_exhaustive]
833pub struct CreateAutoscalingPolicyRequest {
834 /// Required. The "resource name" of the region or location, as described
835 /// in <https://cloud.google.com/apis/design/resource_names>.
836 ///
837 /// * For `projects.regions.autoscalingPolicies.create`, the resource name
838 /// of the region has the following format:
839 /// `projects/{project_id}/regions/{region}`
840 ///
841 /// * For `projects.locations.autoscalingPolicies.create`, the resource name
842 /// of the location has the following format:
843 /// `projects/{project_id}/locations/{location}`
844 ///
845 pub parent: std::string::String,
846
847 /// Required. The autoscaling policy to create.
848 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
849
850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
851}
852
853impl CreateAutoscalingPolicyRequest {
854 /// Creates a new default instance.
855 pub fn new() -> Self {
856 std::default::Default::default()
857 }
858
859 /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
860 ///
861 /// # Example
862 /// ```ignore,no_run
863 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
864 /// # let project_id = "project_id";
865 /// # let location_id = "location_id";
866 /// let x = CreateAutoscalingPolicyRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
867 /// ```
868 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
869 self.parent = v.into();
870 self
871 }
872
873 /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
874 ///
875 /// # Example
876 /// ```ignore,no_run
877 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
878 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
879 /// let x = CreateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
880 /// ```
881 pub fn set_policy<T>(mut self, v: T) -> Self
882 where
883 T: std::convert::Into<crate::model::AutoscalingPolicy>,
884 {
885 self.policy = std::option::Option::Some(v.into());
886 self
887 }
888
889 /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
890 ///
891 /// # Example
892 /// ```ignore,no_run
893 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
894 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
895 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
896 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
897 /// ```
898 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
899 where
900 T: std::convert::Into<crate::model::AutoscalingPolicy>,
901 {
902 self.policy = v.map(|x| x.into());
903 self
904 }
905}
906
907impl wkt::message::Message for CreateAutoscalingPolicyRequest {
908 fn typename() -> &'static str {
909 "type.googleapis.com/google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest"
910 }
911}
912
913/// A request to fetch an autoscaling policy.
914#[derive(Clone, Default, PartialEq)]
915#[non_exhaustive]
916pub struct GetAutoscalingPolicyRequest {
917 /// Required. The "resource name" of the autoscaling policy, as described
918 /// in <https://cloud.google.com/apis/design/resource_names>.
919 ///
920 /// * For `projects.regions.autoscalingPolicies.get`, the resource name
921 /// of the policy has the following format:
922 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
923 ///
924 /// * For `projects.locations.autoscalingPolicies.get`, the resource name
925 /// of the policy has the following format:
926 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
927 ///
928 pub name: std::string::String,
929
930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
931}
932
933impl GetAutoscalingPolicyRequest {
934 /// Creates a new default instance.
935 pub fn new() -> Self {
936 std::default::Default::default()
937 }
938
939 /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
940 ///
941 /// # Example
942 /// ```ignore,no_run
943 /// # use google_cloud_dataproc_v1::model::GetAutoscalingPolicyRequest;
944 /// # let project_id = "project_id";
945 /// # let location_id = "location_id";
946 /// # let autoscaling_policy_id = "autoscaling_policy_id";
947 /// let x = GetAutoscalingPolicyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/autoscalingPolicies/{autoscaling_policy_id}"));
948 /// ```
949 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
950 self.name = v.into();
951 self
952 }
953}
954
955impl wkt::message::Message for GetAutoscalingPolicyRequest {
956 fn typename() -> &'static str {
957 "type.googleapis.com/google.cloud.dataproc.v1.GetAutoscalingPolicyRequest"
958 }
959}
960
961/// A request to update an autoscaling policy.
962#[derive(Clone, Default, PartialEq)]
963#[non_exhaustive]
964pub struct UpdateAutoscalingPolicyRequest {
965 /// Required. The updated autoscaling policy.
966 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
967
968 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
969}
970
971impl UpdateAutoscalingPolicyRequest {
972 /// Creates a new default instance.
973 pub fn new() -> Self {
974 std::default::Default::default()
975 }
976
977 /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
978 ///
979 /// # Example
980 /// ```ignore,no_run
981 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
982 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
983 /// let x = UpdateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
984 /// ```
985 pub fn set_policy<T>(mut self, v: T) -> Self
986 where
987 T: std::convert::Into<crate::model::AutoscalingPolicy>,
988 {
989 self.policy = std::option::Option::Some(v.into());
990 self
991 }
992
993 /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
994 ///
995 /// # Example
996 /// ```ignore,no_run
997 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
998 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
999 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
1000 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
1001 /// ```
1002 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1003 where
1004 T: std::convert::Into<crate::model::AutoscalingPolicy>,
1005 {
1006 self.policy = v.map(|x| x.into());
1007 self
1008 }
1009}
1010
1011impl wkt::message::Message for UpdateAutoscalingPolicyRequest {
1012 fn typename() -> &'static str {
1013 "type.googleapis.com/google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest"
1014 }
1015}
1016
1017/// A request to delete an autoscaling policy.
1018///
1019/// Autoscaling policies in use by one or more clusters will not be deleted.
1020#[derive(Clone, Default, PartialEq)]
1021#[non_exhaustive]
1022pub struct DeleteAutoscalingPolicyRequest {
1023 /// Required. The "resource name" of the autoscaling policy, as described
1024 /// in <https://cloud.google.com/apis/design/resource_names>.
1025 ///
1026 /// * For `projects.regions.autoscalingPolicies.delete`, the resource name
1027 /// of the policy has the following format:
1028 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
1029 ///
1030 /// * For `projects.locations.autoscalingPolicies.delete`, the resource name
1031 /// of the policy has the following format:
1032 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
1033 ///
1034 pub name: std::string::String,
1035
1036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1037}
1038
1039impl DeleteAutoscalingPolicyRequest {
1040 /// Creates a new default instance.
1041 pub fn new() -> Self {
1042 std::default::Default::default()
1043 }
1044
1045 /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
1046 ///
1047 /// # Example
1048 /// ```ignore,no_run
1049 /// # use google_cloud_dataproc_v1::model::DeleteAutoscalingPolicyRequest;
1050 /// # let project_id = "project_id";
1051 /// # let location_id = "location_id";
1052 /// # let autoscaling_policy_id = "autoscaling_policy_id";
1053 /// let x = DeleteAutoscalingPolicyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/autoscalingPolicies/{autoscaling_policy_id}"));
1054 /// ```
1055 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1056 self.name = v.into();
1057 self
1058 }
1059}
1060
1061impl wkt::message::Message for DeleteAutoscalingPolicyRequest {
1062 fn typename() -> &'static str {
1063 "type.googleapis.com/google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest"
1064 }
1065}
1066
1067/// A request to list autoscaling policies in a project.
1068#[derive(Clone, Default, PartialEq)]
1069#[non_exhaustive]
1070pub struct ListAutoscalingPoliciesRequest {
1071 /// Required. The "resource name" of the region or location, as described
1072 /// in <https://cloud.google.com/apis/design/resource_names>.
1073 ///
1074 /// * For `projects.regions.autoscalingPolicies.list`, the resource name
1075 /// of the region has the following format:
1076 /// `projects/{project_id}/regions/{region}`
1077 ///
1078 /// * For `projects.locations.autoscalingPolicies.list`, the resource name
1079 /// of the location has the following format:
1080 /// `projects/{project_id}/locations/{location}`
1081 ///
1082 pub parent: std::string::String,
1083
1084 /// Optional. The maximum number of results to return in each response.
1085 /// Must be less than or equal to 1000. Defaults to 100.
1086 pub page_size: i32,
1087
1088 /// Optional. The page token, returned by a previous call, to request the
1089 /// next page of results.
1090 pub page_token: std::string::String,
1091
1092 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1093}
1094
1095impl ListAutoscalingPoliciesRequest {
1096 /// Creates a new default instance.
1097 pub fn new() -> Self {
1098 std::default::Default::default()
1099 }
1100
1101 /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
1102 ///
1103 /// # Example
1104 /// ```ignore,no_run
1105 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1106 /// # let project_id = "project_id";
1107 /// # let location_id = "location_id";
1108 /// let x = ListAutoscalingPoliciesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1109 /// ```
1110 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1111 self.parent = v.into();
1112 self
1113 }
1114
1115 /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
1116 ///
1117 /// # Example
1118 /// ```ignore,no_run
1119 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1120 /// let x = ListAutoscalingPoliciesRequest::new().set_page_size(42);
1121 /// ```
1122 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1123 self.page_size = v.into();
1124 self
1125 }
1126
1127 /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
1128 ///
1129 /// # Example
1130 /// ```ignore,no_run
1131 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1132 /// let x = ListAutoscalingPoliciesRequest::new().set_page_token("example");
1133 /// ```
1134 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1135 self.page_token = v.into();
1136 self
1137 }
1138}
1139
1140impl wkt::message::Message for ListAutoscalingPoliciesRequest {
1141 fn typename() -> &'static str {
1142 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest"
1143 }
1144}
1145
1146/// A response to a request to list autoscaling policies in a project.
1147#[derive(Clone, Default, PartialEq)]
1148#[non_exhaustive]
1149pub struct ListAutoscalingPoliciesResponse {
1150 /// Output only. Autoscaling policies list.
1151 pub policies: std::vec::Vec<crate::model::AutoscalingPolicy>,
1152
1153 /// Output only. This token is included in the response if there are more
1154 /// results to fetch.
1155 pub next_page_token: std::string::String,
1156
1157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1158}
1159
1160impl ListAutoscalingPoliciesResponse {
1161 /// Creates a new default instance.
1162 pub fn new() -> Self {
1163 std::default::Default::default()
1164 }
1165
1166 /// Sets the value of [policies][crate::model::ListAutoscalingPoliciesResponse::policies].
1167 ///
1168 /// # Example
1169 /// ```ignore,no_run
1170 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1171 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
1172 /// let x = ListAutoscalingPoliciesResponse::new()
1173 /// .set_policies([
1174 /// AutoscalingPolicy::default()/* use setters */,
1175 /// AutoscalingPolicy::default()/* use (different) setters */,
1176 /// ]);
1177 /// ```
1178 pub fn set_policies<T, V>(mut self, v: T) -> Self
1179 where
1180 T: std::iter::IntoIterator<Item = V>,
1181 V: std::convert::Into<crate::model::AutoscalingPolicy>,
1182 {
1183 use std::iter::Iterator;
1184 self.policies = v.into_iter().map(|i| i.into()).collect();
1185 self
1186 }
1187
1188 /// Sets the value of [next_page_token][crate::model::ListAutoscalingPoliciesResponse::next_page_token].
1189 ///
1190 /// # Example
1191 /// ```ignore,no_run
1192 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1193 /// let x = ListAutoscalingPoliciesResponse::new().set_next_page_token("example");
1194 /// ```
1195 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1196 self.next_page_token = v.into();
1197 self
1198 }
1199}
1200
1201impl wkt::message::Message for ListAutoscalingPoliciesResponse {
1202 fn typename() -> &'static str {
1203 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse"
1204 }
1205}
1206
1207#[doc(hidden)]
1208impl google_cloud_gax::paginator::internal::PageableResponse for ListAutoscalingPoliciesResponse {
1209 type PageItem = crate::model::AutoscalingPolicy;
1210
1211 fn items(self) -> std::vec::Vec<Self::PageItem> {
1212 self.policies
1213 }
1214
1215 fn next_page_token(&self) -> std::string::String {
1216 use std::clone::Clone;
1217 self.next_page_token.clone()
1218 }
1219}
1220
1221/// A request to create a batch workload.
1222#[derive(Clone, Default, PartialEq)]
1223#[non_exhaustive]
1224pub struct CreateBatchRequest {
1225 /// Required. The parent resource where this batch will be created.
1226 pub parent: std::string::String,
1227
1228 /// Required. The batch to create.
1229 pub batch: std::option::Option<crate::model::Batch>,
1230
1231 /// Optional. The ID to use for the batch, which will become the final
1232 /// component of the batch's resource name.
1233 ///
1234 /// This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
1235 pub batch_id: std::string::String,
1236
1237 /// Optional. A unique ID used to identify the request. If the service
1238 /// receives two
1239 /// `CreateBatchRequests` with the same `request_id`, the second request is
1240 /// ignored and the operation that corresponds to the first Batch created and
1241 /// stored in the backend is returned.
1242 ///
1243 /// Recommendation: Set this value to a
1244 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
1245 ///
1246 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
1247 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
1248 pub request_id: std::string::String,
1249
1250 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1251}
1252
1253impl CreateBatchRequest {
1254 /// Creates a new default instance.
1255 pub fn new() -> Self {
1256 std::default::Default::default()
1257 }
1258
1259 /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1260 ///
1261 /// # Example
1262 /// ```ignore,no_run
1263 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1264 /// # let project_id = "project_id";
1265 /// # let location_id = "location_id";
1266 /// let x = CreateBatchRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1267 /// ```
1268 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1269 self.parent = v.into();
1270 self
1271 }
1272
1273 /// Sets 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_batch(Batch::default()/* use setters */);
1280 /// ```
1281 pub fn set_batch<T>(mut self, v: T) -> Self
1282 where
1283 T: std::convert::Into<crate::model::Batch>,
1284 {
1285 self.batch = std::option::Option::Some(v.into());
1286 self
1287 }
1288
1289 /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1290 ///
1291 /// # Example
1292 /// ```ignore,no_run
1293 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1294 /// use google_cloud_dataproc_v1::model::Batch;
1295 /// let x = CreateBatchRequest::new().set_or_clear_batch(Some(Batch::default()/* use setters */));
1296 /// let x = CreateBatchRequest::new().set_or_clear_batch(None::<Batch>);
1297 /// ```
1298 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1299 where
1300 T: std::convert::Into<crate::model::Batch>,
1301 {
1302 self.batch = v.map(|x| x.into());
1303 self
1304 }
1305
1306 /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1307 ///
1308 /// # Example
1309 /// ```ignore,no_run
1310 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1311 /// let x = CreateBatchRequest::new().set_batch_id("example");
1312 /// ```
1313 pub fn set_batch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1314 self.batch_id = v.into();
1315 self
1316 }
1317
1318 /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1319 ///
1320 /// # Example
1321 /// ```ignore,no_run
1322 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1323 /// let x = CreateBatchRequest::new().set_request_id("example");
1324 /// ```
1325 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1326 self.request_id = v.into();
1327 self
1328 }
1329}
1330
1331impl wkt::message::Message for CreateBatchRequest {
1332 fn typename() -> &'static str {
1333 "type.googleapis.com/google.cloud.dataproc.v1.CreateBatchRequest"
1334 }
1335}
1336
1337/// A request to get the resource representation for a batch workload.
1338#[derive(Clone, Default, PartialEq)]
1339#[non_exhaustive]
1340pub struct GetBatchRequest {
1341 /// Required. The fully qualified name of the batch to retrieve
1342 /// in the format
1343 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1344 pub name: std::string::String,
1345
1346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1347}
1348
1349impl GetBatchRequest {
1350 /// Creates a new default instance.
1351 pub fn new() -> Self {
1352 std::default::Default::default()
1353 }
1354
1355 /// Sets the value of [name][crate::model::GetBatchRequest::name].
1356 ///
1357 /// # Example
1358 /// ```ignore,no_run
1359 /// # use google_cloud_dataproc_v1::model::GetBatchRequest;
1360 /// # let project_id = "project_id";
1361 /// # let location_id = "location_id";
1362 /// # let batch_id = "batch_id";
1363 /// let x = GetBatchRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/batches/{batch_id}"));
1364 /// ```
1365 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1366 self.name = v.into();
1367 self
1368 }
1369}
1370
1371impl wkt::message::Message for GetBatchRequest {
1372 fn typename() -> &'static str {
1373 "type.googleapis.com/google.cloud.dataproc.v1.GetBatchRequest"
1374 }
1375}
1376
1377/// A request to list batch workloads in a project.
1378#[derive(Clone, Default, PartialEq)]
1379#[non_exhaustive]
1380pub struct ListBatchesRequest {
1381 /// Required. The parent, which owns this collection of batches.
1382 pub parent: std::string::String,
1383
1384 /// Optional. The maximum number of batches to return in each response.
1385 /// The service may return fewer than this value.
1386 /// The default page size is 20; the maximum page size is 1000.
1387 pub page_size: i32,
1388
1389 /// Optional. A page token received from a previous `ListBatches` call.
1390 /// Provide this token to retrieve the subsequent page.
1391 pub page_token: std::string::String,
1392
1393 /// Optional. A filter for the batches to return in the response.
1394 ///
1395 /// A filter is a logical expression constraining the values of various fields
1396 /// in each batch resource. Filters are case sensitive, and may contain
1397 /// multiple clauses combined with logical operators (AND/OR).
1398 /// Supported fields are `batch_id`, `batch_uuid`, `state`, `create_time`, and
1399 /// `labels`.
1400 ///
1401 /// e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"`
1402 /// filters for batches in state RUNNING that were created before 2023-01-01.
1403 /// `state = RUNNING and labels.environment=production` filters for batches in
1404 /// state in a RUNNING state that have a production environment label.
1405 ///
1406 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
1407 /// description of the filter syntax and a list of supported comparisons.
1408 pub filter: std::string::String,
1409
1410 /// Optional. Field(s) on which to sort the list of batches.
1411 ///
1412 /// Currently the only supported sort orders are unspecified (empty) and
1413 /// `create_time desc` to sort by most recently created batches first.
1414 ///
1415 /// See <https://google.aip.dev/132#ordering> for more details.
1416 pub order_by: std::string::String,
1417
1418 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1419}
1420
1421impl ListBatchesRequest {
1422 /// Creates a new default instance.
1423 pub fn new() -> Self {
1424 std::default::Default::default()
1425 }
1426
1427 /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1428 ///
1429 /// # Example
1430 /// ```ignore,no_run
1431 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1432 /// # let project_id = "project_id";
1433 /// # let location_id = "location_id";
1434 /// let x = ListBatchesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1435 /// ```
1436 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1437 self.parent = v.into();
1438 self
1439 }
1440
1441 /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1442 ///
1443 /// # Example
1444 /// ```ignore,no_run
1445 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1446 /// let x = ListBatchesRequest::new().set_page_size(42);
1447 /// ```
1448 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1449 self.page_size = v.into();
1450 self
1451 }
1452
1453 /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1454 ///
1455 /// # Example
1456 /// ```ignore,no_run
1457 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1458 /// let x = ListBatchesRequest::new().set_page_token("example");
1459 /// ```
1460 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1461 self.page_token = v.into();
1462 self
1463 }
1464
1465 /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1466 ///
1467 /// # Example
1468 /// ```ignore,no_run
1469 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1470 /// let x = ListBatchesRequest::new().set_filter("example");
1471 /// ```
1472 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1473 self.filter = v.into();
1474 self
1475 }
1476
1477 /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1478 ///
1479 /// # Example
1480 /// ```ignore,no_run
1481 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1482 /// let x = ListBatchesRequest::new().set_order_by("example");
1483 /// ```
1484 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1485 self.order_by = v.into();
1486 self
1487 }
1488}
1489
1490impl wkt::message::Message for ListBatchesRequest {
1491 fn typename() -> &'static str {
1492 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesRequest"
1493 }
1494}
1495
1496/// A list of batch workloads.
1497#[derive(Clone, Default, PartialEq)]
1498#[non_exhaustive]
1499pub struct ListBatchesResponse {
1500 /// Output only. The batches from the specified collection.
1501 pub batches: std::vec::Vec<crate::model::Batch>,
1502
1503 /// A token, which can be sent as `page_token` to retrieve the next page.
1504 /// If this field is omitted, there are no subsequent pages.
1505 pub next_page_token: std::string::String,
1506
1507 /// Output only. List of Batches that could not be included in the response.
1508 /// Attempting to get one of these resources may indicate why it was not
1509 /// included in the list response.
1510 pub unreachable: std::vec::Vec<std::string::String>,
1511
1512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1513}
1514
1515impl ListBatchesResponse {
1516 /// Creates a new default instance.
1517 pub fn new() -> Self {
1518 std::default::Default::default()
1519 }
1520
1521 /// Sets the value of [batches][crate::model::ListBatchesResponse::batches].
1522 ///
1523 /// # Example
1524 /// ```ignore,no_run
1525 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1526 /// use google_cloud_dataproc_v1::model::Batch;
1527 /// let x = ListBatchesResponse::new()
1528 /// .set_batches([
1529 /// Batch::default()/* use setters */,
1530 /// Batch::default()/* use (different) setters */,
1531 /// ]);
1532 /// ```
1533 pub fn set_batches<T, V>(mut self, v: T) -> Self
1534 where
1535 T: std::iter::IntoIterator<Item = V>,
1536 V: std::convert::Into<crate::model::Batch>,
1537 {
1538 use std::iter::Iterator;
1539 self.batches = v.into_iter().map(|i| i.into()).collect();
1540 self
1541 }
1542
1543 /// Sets the value of [next_page_token][crate::model::ListBatchesResponse::next_page_token].
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1548 /// let x = ListBatchesResponse::new().set_next_page_token("example");
1549 /// ```
1550 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1551 self.next_page_token = v.into();
1552 self
1553 }
1554
1555 /// Sets the value of [unreachable][crate::model::ListBatchesResponse::unreachable].
1556 ///
1557 /// # Example
1558 /// ```ignore,no_run
1559 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1560 /// let x = ListBatchesResponse::new().set_unreachable(["a", "b", "c"]);
1561 /// ```
1562 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1563 where
1564 T: std::iter::IntoIterator<Item = V>,
1565 V: std::convert::Into<std::string::String>,
1566 {
1567 use std::iter::Iterator;
1568 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1569 self
1570 }
1571}
1572
1573impl wkt::message::Message for ListBatchesResponse {
1574 fn typename() -> &'static str {
1575 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesResponse"
1576 }
1577}
1578
1579#[doc(hidden)]
1580impl google_cloud_gax::paginator::internal::PageableResponse for ListBatchesResponse {
1581 type PageItem = crate::model::Batch;
1582
1583 fn items(self) -> std::vec::Vec<Self::PageItem> {
1584 self.batches
1585 }
1586
1587 fn next_page_token(&self) -> std::string::String {
1588 use std::clone::Clone;
1589 self.next_page_token.clone()
1590 }
1591}
1592
1593/// A request to delete a batch workload.
1594#[derive(Clone, Default, PartialEq)]
1595#[non_exhaustive]
1596pub struct DeleteBatchRequest {
1597 /// Required. The fully qualified name of the batch to retrieve
1598 /// in the format
1599 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1600 pub name: std::string::String,
1601
1602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1603}
1604
1605impl DeleteBatchRequest {
1606 /// Creates a new default instance.
1607 pub fn new() -> Self {
1608 std::default::Default::default()
1609 }
1610
1611 /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1612 ///
1613 /// # Example
1614 /// ```ignore,no_run
1615 /// # use google_cloud_dataproc_v1::model::DeleteBatchRequest;
1616 /// # let project_id = "project_id";
1617 /// # let location_id = "location_id";
1618 /// # let batch_id = "batch_id";
1619 /// let x = DeleteBatchRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/batches/{batch_id}"));
1620 /// ```
1621 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1622 self.name = v.into();
1623 self
1624 }
1625}
1626
1627impl wkt::message::Message for DeleteBatchRequest {
1628 fn typename() -> &'static str {
1629 "type.googleapis.com/google.cloud.dataproc.v1.DeleteBatchRequest"
1630 }
1631}
1632
1633/// A representation of a batch workload in the service.
1634#[derive(Clone, Default, PartialEq)]
1635#[non_exhaustive]
1636pub struct Batch {
1637 /// Output only. The resource name of the batch.
1638 pub name: std::string::String,
1639
1640 /// Output only. A batch UUID (Unique Universal Identifier). The service
1641 /// generates this value when it creates the batch.
1642 pub uuid: std::string::String,
1643
1644 /// Output only. The time when the batch was created.
1645 pub create_time: std::option::Option<wkt::Timestamp>,
1646
1647 /// Output only. Runtime information about batch execution.
1648 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
1649
1650 /// Output only. The state of the batch.
1651 pub state: crate::model::batch::State,
1652
1653 /// Output only. Batch state details, such as a failure
1654 /// description if the state is `FAILED`.
1655 pub state_message: std::string::String,
1656
1657 /// Output only. The time when the batch entered a current state.
1658 pub state_time: std::option::Option<wkt::Timestamp>,
1659
1660 /// Output only. The email address of the user who created the batch.
1661 pub creator: std::string::String,
1662
1663 /// Optional. The labels to associate with this batch.
1664 /// Label **keys** must contain 1 to 63 characters, and must conform to
1665 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
1666 /// Label **values** may be empty, but, if present, must contain 1 to 63
1667 /// characters, and must conform to [RFC
1668 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
1669 /// associated with a batch.
1670 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1671
1672 /// Optional. Runtime configuration for the batch execution.
1673 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
1674
1675 /// Optional. Environment configuration for the batch execution.
1676 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
1677
1678 /// Output only. The resource name of the operation associated with this batch.
1679 pub operation: std::string::String,
1680
1681 /// Output only. Historical state information for the batch.
1682 pub state_history: std::vec::Vec<crate::model::batch::StateHistory>,
1683
1684 /// The application/framework-specific portion of the batch configuration.
1685 pub batch_config: std::option::Option<crate::model::batch::BatchConfig>,
1686
1687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1688}
1689
1690impl Batch {
1691 /// Creates a new default instance.
1692 pub fn new() -> Self {
1693 std::default::Default::default()
1694 }
1695
1696 /// Sets the value of [name][crate::model::Batch::name].
1697 ///
1698 /// # Example
1699 /// ```ignore,no_run
1700 /// # use google_cloud_dataproc_v1::model::Batch;
1701 /// # let project_id = "project_id";
1702 /// # let location_id = "location_id";
1703 /// # let batch_id = "batch_id";
1704 /// let x = Batch::new().set_name(format!("projects/{project_id}/locations/{location_id}/batches/{batch_id}"));
1705 /// ```
1706 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1707 self.name = v.into();
1708 self
1709 }
1710
1711 /// Sets the value of [uuid][crate::model::Batch::uuid].
1712 ///
1713 /// # Example
1714 /// ```ignore,no_run
1715 /// # use google_cloud_dataproc_v1::model::Batch;
1716 /// let x = Batch::new().set_uuid("example");
1717 /// ```
1718 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1719 self.uuid = v.into();
1720 self
1721 }
1722
1723 /// Sets the value of [create_time][crate::model::Batch::create_time].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_dataproc_v1::model::Batch;
1728 /// use wkt::Timestamp;
1729 /// let x = Batch::new().set_create_time(Timestamp::default()/* use setters */);
1730 /// ```
1731 pub fn set_create_time<T>(mut self, v: T) -> Self
1732 where
1733 T: std::convert::Into<wkt::Timestamp>,
1734 {
1735 self.create_time = std::option::Option::Some(v.into());
1736 self
1737 }
1738
1739 /// Sets or clears the value of [create_time][crate::model::Batch::create_time].
1740 ///
1741 /// # Example
1742 /// ```ignore,no_run
1743 /// # use google_cloud_dataproc_v1::model::Batch;
1744 /// use wkt::Timestamp;
1745 /// let x = Batch::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1746 /// let x = Batch::new().set_or_clear_create_time(None::<Timestamp>);
1747 /// ```
1748 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1749 where
1750 T: std::convert::Into<wkt::Timestamp>,
1751 {
1752 self.create_time = v.map(|x| x.into());
1753 self
1754 }
1755
1756 /// Sets the value of [runtime_info][crate::model::Batch::runtime_info].
1757 ///
1758 /// # Example
1759 /// ```ignore,no_run
1760 /// # use google_cloud_dataproc_v1::model::Batch;
1761 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1762 /// let x = Batch::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
1763 /// ```
1764 pub fn set_runtime_info<T>(mut self, v: T) -> Self
1765 where
1766 T: std::convert::Into<crate::model::RuntimeInfo>,
1767 {
1768 self.runtime_info = std::option::Option::Some(v.into());
1769 self
1770 }
1771
1772 /// Sets or clears the value of [runtime_info][crate::model::Batch::runtime_info].
1773 ///
1774 /// # Example
1775 /// ```ignore,no_run
1776 /// # use google_cloud_dataproc_v1::model::Batch;
1777 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1778 /// let x = Batch::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
1779 /// let x = Batch::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
1780 /// ```
1781 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
1782 where
1783 T: std::convert::Into<crate::model::RuntimeInfo>,
1784 {
1785 self.runtime_info = v.map(|x| x.into());
1786 self
1787 }
1788
1789 /// Sets the value of [state][crate::model::Batch::state].
1790 ///
1791 /// # Example
1792 /// ```ignore,no_run
1793 /// # use google_cloud_dataproc_v1::model::Batch;
1794 /// use google_cloud_dataproc_v1::model::batch::State;
1795 /// let x0 = Batch::new().set_state(State::Pending);
1796 /// let x1 = Batch::new().set_state(State::Running);
1797 /// let x2 = Batch::new().set_state(State::Cancelling);
1798 /// ```
1799 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(mut self, v: T) -> Self {
1800 self.state = v.into();
1801 self
1802 }
1803
1804 /// Sets the value of [state_message][crate::model::Batch::state_message].
1805 ///
1806 /// # Example
1807 /// ```ignore,no_run
1808 /// # use google_cloud_dataproc_v1::model::Batch;
1809 /// let x = Batch::new().set_state_message("example");
1810 /// ```
1811 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1812 self.state_message = v.into();
1813 self
1814 }
1815
1816 /// Sets the value of [state_time][crate::model::Batch::state_time].
1817 ///
1818 /// # Example
1819 /// ```ignore,no_run
1820 /// # use google_cloud_dataproc_v1::model::Batch;
1821 /// use wkt::Timestamp;
1822 /// let x = Batch::new().set_state_time(Timestamp::default()/* use setters */);
1823 /// ```
1824 pub fn set_state_time<T>(mut self, v: T) -> Self
1825 where
1826 T: std::convert::Into<wkt::Timestamp>,
1827 {
1828 self.state_time = std::option::Option::Some(v.into());
1829 self
1830 }
1831
1832 /// Sets or clears the value of [state_time][crate::model::Batch::state_time].
1833 ///
1834 /// # Example
1835 /// ```ignore,no_run
1836 /// # use google_cloud_dataproc_v1::model::Batch;
1837 /// use wkt::Timestamp;
1838 /// let x = Batch::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
1839 /// let x = Batch::new().set_or_clear_state_time(None::<Timestamp>);
1840 /// ```
1841 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
1842 where
1843 T: std::convert::Into<wkt::Timestamp>,
1844 {
1845 self.state_time = v.map(|x| x.into());
1846 self
1847 }
1848
1849 /// Sets the value of [creator][crate::model::Batch::creator].
1850 ///
1851 /// # Example
1852 /// ```ignore,no_run
1853 /// # use google_cloud_dataproc_v1::model::Batch;
1854 /// let x = Batch::new().set_creator("example");
1855 /// ```
1856 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1857 self.creator = v.into();
1858 self
1859 }
1860
1861 /// Sets the value of [labels][crate::model::Batch::labels].
1862 ///
1863 /// # Example
1864 /// ```ignore,no_run
1865 /// # use google_cloud_dataproc_v1::model::Batch;
1866 /// let x = Batch::new().set_labels([
1867 /// ("key0", "abc"),
1868 /// ("key1", "xyz"),
1869 /// ]);
1870 /// ```
1871 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1872 where
1873 T: std::iter::IntoIterator<Item = (K, V)>,
1874 K: std::convert::Into<std::string::String>,
1875 V: std::convert::Into<std::string::String>,
1876 {
1877 use std::iter::Iterator;
1878 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1879 self
1880 }
1881
1882 /// Sets the value of [runtime_config][crate::model::Batch::runtime_config].
1883 ///
1884 /// # Example
1885 /// ```ignore,no_run
1886 /// # use google_cloud_dataproc_v1::model::Batch;
1887 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1888 /// let x = Batch::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
1889 /// ```
1890 pub fn set_runtime_config<T>(mut self, v: T) -> Self
1891 where
1892 T: std::convert::Into<crate::model::RuntimeConfig>,
1893 {
1894 self.runtime_config = std::option::Option::Some(v.into());
1895 self
1896 }
1897
1898 /// Sets or clears the value of [runtime_config][crate::model::Batch::runtime_config].
1899 ///
1900 /// # Example
1901 /// ```ignore,no_run
1902 /// # use google_cloud_dataproc_v1::model::Batch;
1903 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1904 /// let x = Batch::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
1905 /// let x = Batch::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
1906 /// ```
1907 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
1908 where
1909 T: std::convert::Into<crate::model::RuntimeConfig>,
1910 {
1911 self.runtime_config = v.map(|x| x.into());
1912 self
1913 }
1914
1915 /// Sets the value of [environment_config][crate::model::Batch::environment_config].
1916 ///
1917 /// # Example
1918 /// ```ignore,no_run
1919 /// # use google_cloud_dataproc_v1::model::Batch;
1920 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1921 /// let x = Batch::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
1922 /// ```
1923 pub fn set_environment_config<T>(mut self, v: T) -> Self
1924 where
1925 T: std::convert::Into<crate::model::EnvironmentConfig>,
1926 {
1927 self.environment_config = std::option::Option::Some(v.into());
1928 self
1929 }
1930
1931 /// Sets or clears the value of [environment_config][crate::model::Batch::environment_config].
1932 ///
1933 /// # Example
1934 /// ```ignore,no_run
1935 /// # use google_cloud_dataproc_v1::model::Batch;
1936 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1937 /// let x = Batch::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
1938 /// let x = Batch::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
1939 /// ```
1940 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
1941 where
1942 T: std::convert::Into<crate::model::EnvironmentConfig>,
1943 {
1944 self.environment_config = v.map(|x| x.into());
1945 self
1946 }
1947
1948 /// Sets the value of [operation][crate::model::Batch::operation].
1949 ///
1950 /// # Example
1951 /// ```ignore,no_run
1952 /// # use google_cloud_dataproc_v1::model::Batch;
1953 /// let x = Batch::new().set_operation("example");
1954 /// ```
1955 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1956 self.operation = v.into();
1957 self
1958 }
1959
1960 /// Sets the value of [state_history][crate::model::Batch::state_history].
1961 ///
1962 /// # Example
1963 /// ```ignore,no_run
1964 /// # use google_cloud_dataproc_v1::model::Batch;
1965 /// use google_cloud_dataproc_v1::model::batch::StateHistory;
1966 /// let x = Batch::new()
1967 /// .set_state_history([
1968 /// StateHistory::default()/* use setters */,
1969 /// StateHistory::default()/* use (different) setters */,
1970 /// ]);
1971 /// ```
1972 pub fn set_state_history<T, V>(mut self, v: T) -> Self
1973 where
1974 T: std::iter::IntoIterator<Item = V>,
1975 V: std::convert::Into<crate::model::batch::StateHistory>,
1976 {
1977 use std::iter::Iterator;
1978 self.state_history = v.into_iter().map(|i| i.into()).collect();
1979 self
1980 }
1981
1982 /// Sets the value of [batch_config][crate::model::Batch::batch_config].
1983 ///
1984 /// Note that all the setters affecting `batch_config` are mutually
1985 /// exclusive.
1986 ///
1987 /// # Example
1988 /// ```ignore,no_run
1989 /// # use google_cloud_dataproc_v1::model::Batch;
1990 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1991 /// let x = Batch::new().set_batch_config(Some(
1992 /// google_cloud_dataproc_v1::model::batch::BatchConfig::PysparkBatch(PySparkBatch::default().into())));
1993 /// ```
1994 pub fn set_batch_config<
1995 T: std::convert::Into<std::option::Option<crate::model::batch::BatchConfig>>,
1996 >(
1997 mut self,
1998 v: T,
1999 ) -> Self {
2000 self.batch_config = v.into();
2001 self
2002 }
2003
2004 /// The value of [batch_config][crate::model::Batch::batch_config]
2005 /// if it holds a `PysparkBatch`, `None` if the field is not set or
2006 /// holds a different branch.
2007 pub fn pyspark_batch(
2008 &self,
2009 ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkBatch>> {
2010 #[allow(unreachable_patterns)]
2011 self.batch_config.as_ref().and_then(|v| match v {
2012 crate::model::batch::BatchConfig::PysparkBatch(v) => std::option::Option::Some(v),
2013 _ => std::option::Option::None,
2014 })
2015 }
2016
2017 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2018 /// to hold a `PysparkBatch`.
2019 ///
2020 /// Note that all the setters affecting `batch_config` are
2021 /// mutually exclusive.
2022 ///
2023 /// # Example
2024 /// ```ignore,no_run
2025 /// # use google_cloud_dataproc_v1::model::Batch;
2026 /// use google_cloud_dataproc_v1::model::PySparkBatch;
2027 /// let x = Batch::new().set_pyspark_batch(PySparkBatch::default()/* use setters */);
2028 /// assert!(x.pyspark_batch().is_some());
2029 /// assert!(x.spark_batch().is_none());
2030 /// assert!(x.spark_r_batch().is_none());
2031 /// assert!(x.spark_sql_batch().is_none());
2032 /// assert!(x.pyspark_notebook_batch().is_none());
2033 /// ```
2034 pub fn set_pyspark_batch<T: std::convert::Into<std::boxed::Box<crate::model::PySparkBatch>>>(
2035 mut self,
2036 v: T,
2037 ) -> Self {
2038 self.batch_config =
2039 std::option::Option::Some(crate::model::batch::BatchConfig::PysparkBatch(v.into()));
2040 self
2041 }
2042
2043 /// The value of [batch_config][crate::model::Batch::batch_config]
2044 /// if it holds a `SparkBatch`, `None` if the field is not set or
2045 /// holds a different branch.
2046 pub fn spark_batch(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkBatch>> {
2047 #[allow(unreachable_patterns)]
2048 self.batch_config.as_ref().and_then(|v| match v {
2049 crate::model::batch::BatchConfig::SparkBatch(v) => std::option::Option::Some(v),
2050 _ => std::option::Option::None,
2051 })
2052 }
2053
2054 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2055 /// to hold a `SparkBatch`.
2056 ///
2057 /// Note that all the setters affecting `batch_config` are
2058 /// mutually exclusive.
2059 ///
2060 /// # Example
2061 /// ```ignore,no_run
2062 /// # use google_cloud_dataproc_v1::model::Batch;
2063 /// use google_cloud_dataproc_v1::model::SparkBatch;
2064 /// let x = Batch::new().set_spark_batch(SparkBatch::default()/* use setters */);
2065 /// assert!(x.spark_batch().is_some());
2066 /// assert!(x.pyspark_batch().is_none());
2067 /// assert!(x.spark_r_batch().is_none());
2068 /// assert!(x.spark_sql_batch().is_none());
2069 /// assert!(x.pyspark_notebook_batch().is_none());
2070 /// ```
2071 pub fn set_spark_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkBatch>>>(
2072 mut self,
2073 v: T,
2074 ) -> Self {
2075 self.batch_config =
2076 std::option::Option::Some(crate::model::batch::BatchConfig::SparkBatch(v.into()));
2077 self
2078 }
2079
2080 /// The value of [batch_config][crate::model::Batch::batch_config]
2081 /// if it holds a `SparkRBatch`, `None` if the field is not set or
2082 /// holds a different branch.
2083 pub fn spark_r_batch(
2084 &self,
2085 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkRBatch>> {
2086 #[allow(unreachable_patterns)]
2087 self.batch_config.as_ref().and_then(|v| match v {
2088 crate::model::batch::BatchConfig::SparkRBatch(v) => std::option::Option::Some(v),
2089 _ => std::option::Option::None,
2090 })
2091 }
2092
2093 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2094 /// to hold a `SparkRBatch`.
2095 ///
2096 /// Note that all the setters affecting `batch_config` are
2097 /// mutually exclusive.
2098 ///
2099 /// # Example
2100 /// ```ignore,no_run
2101 /// # use google_cloud_dataproc_v1::model::Batch;
2102 /// use google_cloud_dataproc_v1::model::SparkRBatch;
2103 /// let x = Batch::new().set_spark_r_batch(SparkRBatch::default()/* use setters */);
2104 /// assert!(x.spark_r_batch().is_some());
2105 /// assert!(x.pyspark_batch().is_none());
2106 /// assert!(x.spark_batch().is_none());
2107 /// assert!(x.spark_sql_batch().is_none());
2108 /// assert!(x.pyspark_notebook_batch().is_none());
2109 /// ```
2110 pub fn set_spark_r_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkRBatch>>>(
2111 mut self,
2112 v: T,
2113 ) -> Self {
2114 self.batch_config =
2115 std::option::Option::Some(crate::model::batch::BatchConfig::SparkRBatch(v.into()));
2116 self
2117 }
2118
2119 /// The value of [batch_config][crate::model::Batch::batch_config]
2120 /// if it holds a `SparkSqlBatch`, `None` if the field is not set or
2121 /// holds a different branch.
2122 pub fn spark_sql_batch(
2123 &self,
2124 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlBatch>> {
2125 #[allow(unreachable_patterns)]
2126 self.batch_config.as_ref().and_then(|v| match v {
2127 crate::model::batch::BatchConfig::SparkSqlBatch(v) => std::option::Option::Some(v),
2128 _ => std::option::Option::None,
2129 })
2130 }
2131
2132 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2133 /// to hold a `SparkSqlBatch`.
2134 ///
2135 /// Note that all the setters affecting `batch_config` are
2136 /// mutually exclusive.
2137 ///
2138 /// # Example
2139 /// ```ignore,no_run
2140 /// # use google_cloud_dataproc_v1::model::Batch;
2141 /// use google_cloud_dataproc_v1::model::SparkSqlBatch;
2142 /// let x = Batch::new().set_spark_sql_batch(SparkSqlBatch::default()/* use setters */);
2143 /// assert!(x.spark_sql_batch().is_some());
2144 /// assert!(x.pyspark_batch().is_none());
2145 /// assert!(x.spark_batch().is_none());
2146 /// assert!(x.spark_r_batch().is_none());
2147 /// assert!(x.pyspark_notebook_batch().is_none());
2148 /// ```
2149 pub fn set_spark_sql_batch<
2150 T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlBatch>>,
2151 >(
2152 mut self,
2153 v: T,
2154 ) -> Self {
2155 self.batch_config =
2156 std::option::Option::Some(crate::model::batch::BatchConfig::SparkSqlBatch(v.into()));
2157 self
2158 }
2159
2160 /// The value of [batch_config][crate::model::Batch::batch_config]
2161 /// if it holds a `PysparkNotebookBatch`, `None` if the field is not set or
2162 /// holds a different branch.
2163 pub fn pyspark_notebook_batch(
2164 &self,
2165 ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkNotebookBatch>> {
2166 #[allow(unreachable_patterns)]
2167 self.batch_config.as_ref().and_then(|v| match v {
2168 crate::model::batch::BatchConfig::PysparkNotebookBatch(v) => {
2169 std::option::Option::Some(v)
2170 }
2171 _ => std::option::Option::None,
2172 })
2173 }
2174
2175 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2176 /// to hold a `PysparkNotebookBatch`.
2177 ///
2178 /// Note that all the setters affecting `batch_config` are
2179 /// mutually exclusive.
2180 ///
2181 /// # Example
2182 /// ```ignore,no_run
2183 /// # use google_cloud_dataproc_v1::model::Batch;
2184 /// use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
2185 /// let x = Batch::new().set_pyspark_notebook_batch(PySparkNotebookBatch::default()/* use setters */);
2186 /// assert!(x.pyspark_notebook_batch().is_some());
2187 /// assert!(x.pyspark_batch().is_none());
2188 /// assert!(x.spark_batch().is_none());
2189 /// assert!(x.spark_r_batch().is_none());
2190 /// assert!(x.spark_sql_batch().is_none());
2191 /// ```
2192 pub fn set_pyspark_notebook_batch<
2193 T: std::convert::Into<std::boxed::Box<crate::model::PySparkNotebookBatch>>,
2194 >(
2195 mut self,
2196 v: T,
2197 ) -> Self {
2198 self.batch_config = std::option::Option::Some(
2199 crate::model::batch::BatchConfig::PysparkNotebookBatch(v.into()),
2200 );
2201 self
2202 }
2203}
2204
2205impl wkt::message::Message for Batch {
2206 fn typename() -> &'static str {
2207 "type.googleapis.com/google.cloud.dataproc.v1.Batch"
2208 }
2209}
2210
2211/// Defines additional types related to [Batch].
2212pub mod batch {
2213 #[allow(unused_imports)]
2214 use super::*;
2215
2216 /// Historical state information.
2217 #[derive(Clone, Default, PartialEq)]
2218 #[non_exhaustive]
2219 pub struct StateHistory {
2220 /// Output only. The state of the batch at this point in history.
2221 pub state: crate::model::batch::State,
2222
2223 /// Output only. Details about the state at this point in history.
2224 pub state_message: std::string::String,
2225
2226 /// Output only. The time when the batch entered the historical state.
2227 pub state_start_time: std::option::Option<wkt::Timestamp>,
2228
2229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2230 }
2231
2232 impl StateHistory {
2233 /// Creates a new default instance.
2234 pub fn new() -> Self {
2235 std::default::Default::default()
2236 }
2237
2238 /// Sets the value of [state][crate::model::batch::StateHistory::state].
2239 ///
2240 /// # Example
2241 /// ```ignore,no_run
2242 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2243 /// use google_cloud_dataproc_v1::model::batch::State;
2244 /// let x0 = StateHistory::new().set_state(State::Pending);
2245 /// let x1 = StateHistory::new().set_state(State::Running);
2246 /// let x2 = StateHistory::new().set_state(State::Cancelling);
2247 /// ```
2248 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(
2249 mut self,
2250 v: T,
2251 ) -> Self {
2252 self.state = v.into();
2253 self
2254 }
2255
2256 /// Sets the value of [state_message][crate::model::batch::StateHistory::state_message].
2257 ///
2258 /// # Example
2259 /// ```ignore,no_run
2260 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2261 /// let x = StateHistory::new().set_state_message("example");
2262 /// ```
2263 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
2264 mut self,
2265 v: T,
2266 ) -> Self {
2267 self.state_message = v.into();
2268 self
2269 }
2270
2271 /// Sets the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2272 ///
2273 /// # Example
2274 /// ```ignore,no_run
2275 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2276 /// use wkt::Timestamp;
2277 /// let x = StateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
2278 /// ```
2279 pub fn set_state_start_time<T>(mut self, v: T) -> Self
2280 where
2281 T: std::convert::Into<wkt::Timestamp>,
2282 {
2283 self.state_start_time = std::option::Option::Some(v.into());
2284 self
2285 }
2286
2287 /// Sets or clears the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2288 ///
2289 /// # Example
2290 /// ```ignore,no_run
2291 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2292 /// use wkt::Timestamp;
2293 /// let x = StateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
2294 /// let x = StateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
2295 /// ```
2296 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2297 where
2298 T: std::convert::Into<wkt::Timestamp>,
2299 {
2300 self.state_start_time = v.map(|x| x.into());
2301 self
2302 }
2303 }
2304
2305 impl wkt::message::Message for StateHistory {
2306 fn typename() -> &'static str {
2307 "type.googleapis.com/google.cloud.dataproc.v1.Batch.StateHistory"
2308 }
2309 }
2310
2311 /// The batch state.
2312 ///
2313 /// # Working with unknown values
2314 ///
2315 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2316 /// additional enum variants at any time. Adding new variants is not considered
2317 /// a breaking change. Applications should write their code in anticipation of:
2318 ///
2319 /// - New values appearing in future releases of the client library, **and**
2320 /// - New values received dynamically, without application changes.
2321 ///
2322 /// Please consult the [Working with enums] section in the user guide for some
2323 /// guidelines.
2324 ///
2325 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2326 #[derive(Clone, Debug, PartialEq)]
2327 #[non_exhaustive]
2328 pub enum State {
2329 /// The batch state is unknown.
2330 Unspecified,
2331 /// The batch is created before running.
2332 Pending,
2333 /// The batch is running.
2334 Running,
2335 /// The batch is cancelling.
2336 Cancelling,
2337 /// The batch cancellation was successful.
2338 Cancelled,
2339 /// The batch completed successfully.
2340 Succeeded,
2341 /// The batch is no longer running due to an error.
2342 Failed,
2343 /// If set, the enum was initialized with an unknown value.
2344 ///
2345 /// Applications can examine the value using [State::value] or
2346 /// [State::name].
2347 UnknownValue(state::UnknownValue),
2348 }
2349
2350 #[doc(hidden)]
2351 pub mod state {
2352 #[allow(unused_imports)]
2353 use super::*;
2354 #[derive(Clone, Debug, PartialEq)]
2355 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2356 }
2357
2358 impl State {
2359 /// Gets the enum value.
2360 ///
2361 /// Returns `None` if the enum contains an unknown value deserialized from
2362 /// the string representation of enums.
2363 pub fn value(&self) -> std::option::Option<i32> {
2364 match self {
2365 Self::Unspecified => std::option::Option::Some(0),
2366 Self::Pending => std::option::Option::Some(1),
2367 Self::Running => std::option::Option::Some(2),
2368 Self::Cancelling => std::option::Option::Some(3),
2369 Self::Cancelled => std::option::Option::Some(4),
2370 Self::Succeeded => std::option::Option::Some(5),
2371 Self::Failed => std::option::Option::Some(6),
2372 Self::UnknownValue(u) => u.0.value(),
2373 }
2374 }
2375
2376 /// Gets the enum value as a string.
2377 ///
2378 /// Returns `None` if the enum contains an unknown value deserialized from
2379 /// the integer representation of enums.
2380 pub fn name(&self) -> std::option::Option<&str> {
2381 match self {
2382 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2383 Self::Pending => std::option::Option::Some("PENDING"),
2384 Self::Running => std::option::Option::Some("RUNNING"),
2385 Self::Cancelling => std::option::Option::Some("CANCELLING"),
2386 Self::Cancelled => std::option::Option::Some("CANCELLED"),
2387 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2388 Self::Failed => std::option::Option::Some("FAILED"),
2389 Self::UnknownValue(u) => u.0.name(),
2390 }
2391 }
2392 }
2393
2394 impl std::default::Default for State {
2395 fn default() -> Self {
2396 use std::convert::From;
2397 Self::from(0)
2398 }
2399 }
2400
2401 impl std::fmt::Display for State {
2402 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2403 wkt::internal::display_enum(f, self.name(), self.value())
2404 }
2405 }
2406
2407 impl std::convert::From<i32> for State {
2408 fn from(value: i32) -> Self {
2409 match value {
2410 0 => Self::Unspecified,
2411 1 => Self::Pending,
2412 2 => Self::Running,
2413 3 => Self::Cancelling,
2414 4 => Self::Cancelled,
2415 5 => Self::Succeeded,
2416 6 => Self::Failed,
2417 _ => Self::UnknownValue(state::UnknownValue(
2418 wkt::internal::UnknownEnumValue::Integer(value),
2419 )),
2420 }
2421 }
2422 }
2423
2424 impl std::convert::From<&str> for State {
2425 fn from(value: &str) -> Self {
2426 use std::string::ToString;
2427 match value {
2428 "STATE_UNSPECIFIED" => Self::Unspecified,
2429 "PENDING" => Self::Pending,
2430 "RUNNING" => Self::Running,
2431 "CANCELLING" => Self::Cancelling,
2432 "CANCELLED" => Self::Cancelled,
2433 "SUCCEEDED" => Self::Succeeded,
2434 "FAILED" => Self::Failed,
2435 _ => Self::UnknownValue(state::UnknownValue(
2436 wkt::internal::UnknownEnumValue::String(value.to_string()),
2437 )),
2438 }
2439 }
2440 }
2441
2442 impl serde::ser::Serialize for State {
2443 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2444 where
2445 S: serde::Serializer,
2446 {
2447 match self {
2448 Self::Unspecified => serializer.serialize_i32(0),
2449 Self::Pending => serializer.serialize_i32(1),
2450 Self::Running => serializer.serialize_i32(2),
2451 Self::Cancelling => serializer.serialize_i32(3),
2452 Self::Cancelled => serializer.serialize_i32(4),
2453 Self::Succeeded => serializer.serialize_i32(5),
2454 Self::Failed => serializer.serialize_i32(6),
2455 Self::UnknownValue(u) => u.0.serialize(serializer),
2456 }
2457 }
2458 }
2459
2460 impl<'de> serde::de::Deserialize<'de> for State {
2461 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2462 where
2463 D: serde::Deserializer<'de>,
2464 {
2465 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2466 ".google.cloud.dataproc.v1.Batch.State",
2467 ))
2468 }
2469 }
2470
2471 /// The application/framework-specific portion of the batch configuration.
2472 #[derive(Clone, Debug, PartialEq)]
2473 #[non_exhaustive]
2474 pub enum BatchConfig {
2475 /// Optional. PySpark batch config.
2476 PysparkBatch(std::boxed::Box<crate::model::PySparkBatch>),
2477 /// Optional. Spark batch config.
2478 SparkBatch(std::boxed::Box<crate::model::SparkBatch>),
2479 /// Optional. SparkR batch config.
2480 SparkRBatch(std::boxed::Box<crate::model::SparkRBatch>),
2481 /// Optional. SparkSql batch config.
2482 SparkSqlBatch(std::boxed::Box<crate::model::SparkSqlBatch>),
2483 /// Optional. PySpark notebook batch config.
2484 PysparkNotebookBatch(std::boxed::Box<crate::model::PySparkNotebookBatch>),
2485 }
2486}
2487
2488/// A configuration for running an
2489/// [Apache
2490/// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html)
2491/// batch workload.
2492#[derive(Clone, Default, PartialEq)]
2493#[non_exhaustive]
2494pub struct PySparkBatch {
2495 /// Required. The HCFS URI of the main Python file to use as the Spark driver.
2496 /// Must be a .py file.
2497 pub main_python_file_uri: std::string::String,
2498
2499 /// Optional. The arguments to pass to the driver. Do not include arguments
2500 /// that can be set as batch properties, such as `--conf`, since a collision
2501 /// can occur that causes an incorrect batch submission.
2502 pub args: std::vec::Vec<std::string::String>,
2503
2504 /// Optional. HCFS file URIs of Python files to pass to the PySpark
2505 /// framework. Supported file types: `.py`, `.egg`, and `.zip`.
2506 pub python_file_uris: std::vec::Vec<std::string::String>,
2507
2508 /// Optional. HCFS URIs of jar files to add to the classpath of the
2509 /// Spark driver and tasks.
2510 pub jar_file_uris: std::vec::Vec<std::string::String>,
2511
2512 /// Optional. HCFS URIs of files to be placed in the working directory of
2513 /// each executor.
2514 pub file_uris: std::vec::Vec<std::string::String>,
2515
2516 /// Optional. HCFS URIs of archives to be extracted into the working directory
2517 /// of each executor. Supported file types:
2518 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2519 pub archive_uris: std::vec::Vec<std::string::String>,
2520
2521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2522}
2523
2524impl PySparkBatch {
2525 /// Creates a new default instance.
2526 pub fn new() -> Self {
2527 std::default::Default::default()
2528 }
2529
2530 /// Sets the value of [main_python_file_uri][crate::model::PySparkBatch::main_python_file_uri].
2531 ///
2532 /// # Example
2533 /// ```ignore,no_run
2534 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2535 /// let x = PySparkBatch::new().set_main_python_file_uri("example");
2536 /// ```
2537 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
2538 mut self,
2539 v: T,
2540 ) -> Self {
2541 self.main_python_file_uri = v.into();
2542 self
2543 }
2544
2545 /// Sets the value of [args][crate::model::PySparkBatch::args].
2546 ///
2547 /// # Example
2548 /// ```ignore,no_run
2549 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2550 /// let x = PySparkBatch::new().set_args(["a", "b", "c"]);
2551 /// ```
2552 pub fn set_args<T, V>(mut self, v: T) -> Self
2553 where
2554 T: std::iter::IntoIterator<Item = V>,
2555 V: std::convert::Into<std::string::String>,
2556 {
2557 use std::iter::Iterator;
2558 self.args = v.into_iter().map(|i| i.into()).collect();
2559 self
2560 }
2561
2562 /// Sets the value of [python_file_uris][crate::model::PySparkBatch::python_file_uris].
2563 ///
2564 /// # Example
2565 /// ```ignore,no_run
2566 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2567 /// let x = PySparkBatch::new().set_python_file_uris(["a", "b", "c"]);
2568 /// ```
2569 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
2570 where
2571 T: std::iter::IntoIterator<Item = V>,
2572 V: std::convert::Into<std::string::String>,
2573 {
2574 use std::iter::Iterator;
2575 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
2576 self
2577 }
2578
2579 /// Sets the value of [jar_file_uris][crate::model::PySparkBatch::jar_file_uris].
2580 ///
2581 /// # Example
2582 /// ```ignore,no_run
2583 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2584 /// let x = PySparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2585 /// ```
2586 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2587 where
2588 T: std::iter::IntoIterator<Item = V>,
2589 V: std::convert::Into<std::string::String>,
2590 {
2591 use std::iter::Iterator;
2592 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2593 self
2594 }
2595
2596 /// Sets the value of [file_uris][crate::model::PySparkBatch::file_uris].
2597 ///
2598 /// # Example
2599 /// ```ignore,no_run
2600 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2601 /// let x = PySparkBatch::new().set_file_uris(["a", "b", "c"]);
2602 /// ```
2603 pub fn set_file_uris<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.file_uris = v.into_iter().map(|i| i.into()).collect();
2610 self
2611 }
2612
2613 /// Sets the value of [archive_uris][crate::model::PySparkBatch::archive_uris].
2614 ///
2615 /// # Example
2616 /// ```ignore,no_run
2617 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2618 /// let x = PySparkBatch::new().set_archive_uris(["a", "b", "c"]);
2619 /// ```
2620 pub fn set_archive_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.archive_uris = v.into_iter().map(|i| i.into()).collect();
2627 self
2628 }
2629}
2630
2631impl wkt::message::Message for PySparkBatch {
2632 fn typename() -> &'static str {
2633 "type.googleapis.com/google.cloud.dataproc.v1.PySparkBatch"
2634 }
2635}
2636
2637/// A configuration for running an [Apache Spark](https://spark.apache.org/)
2638/// batch workload.
2639#[derive(Clone, Default, PartialEq)]
2640#[non_exhaustive]
2641pub struct SparkBatch {
2642 /// Optional. The arguments to pass to the driver. Do not include arguments
2643 /// that can be set as batch properties, such as `--conf`, since a collision
2644 /// can occur that causes an incorrect batch submission.
2645 pub args: std::vec::Vec<std::string::String>,
2646
2647 /// Optional. HCFS URIs of jar files to add to the classpath of the
2648 /// Spark driver and tasks.
2649 pub jar_file_uris: std::vec::Vec<std::string::String>,
2650
2651 /// Optional. HCFS URIs of files to be placed in the working directory of
2652 /// each executor.
2653 pub file_uris: std::vec::Vec<std::string::String>,
2654
2655 /// Optional. HCFS URIs of archives to be extracted into the working directory
2656 /// of each executor. Supported file types:
2657 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2658 pub archive_uris: std::vec::Vec<std::string::String>,
2659
2660 /// The specification of the main method to call to drive the Spark
2661 /// workload. Specify either the jar file that contains the main class or the
2662 /// main class name. To pass both a main jar and a main class in that jar, add
2663 /// the jar to `jar_file_uris`, and then specify the main class
2664 /// name in `main_class`.
2665 pub driver: std::option::Option<crate::model::spark_batch::Driver>,
2666
2667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2668}
2669
2670impl SparkBatch {
2671 /// Creates a new default instance.
2672 pub fn new() -> Self {
2673 std::default::Default::default()
2674 }
2675
2676 /// Sets the value of [args][crate::model::SparkBatch::args].
2677 ///
2678 /// # Example
2679 /// ```ignore,no_run
2680 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2681 /// let x = SparkBatch::new().set_args(["a", "b", "c"]);
2682 /// ```
2683 pub fn set_args<T, V>(mut self, v: T) -> Self
2684 where
2685 T: std::iter::IntoIterator<Item = V>,
2686 V: std::convert::Into<std::string::String>,
2687 {
2688 use std::iter::Iterator;
2689 self.args = v.into_iter().map(|i| i.into()).collect();
2690 self
2691 }
2692
2693 /// Sets the value of [jar_file_uris][crate::model::SparkBatch::jar_file_uris].
2694 ///
2695 /// # Example
2696 /// ```ignore,no_run
2697 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2698 /// let x = SparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2699 /// ```
2700 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2701 where
2702 T: std::iter::IntoIterator<Item = V>,
2703 V: std::convert::Into<std::string::String>,
2704 {
2705 use std::iter::Iterator;
2706 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2707 self
2708 }
2709
2710 /// Sets the value of [file_uris][crate::model::SparkBatch::file_uris].
2711 ///
2712 /// # Example
2713 /// ```ignore,no_run
2714 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2715 /// let x = SparkBatch::new().set_file_uris(["a", "b", "c"]);
2716 /// ```
2717 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2718 where
2719 T: std::iter::IntoIterator<Item = V>,
2720 V: std::convert::Into<std::string::String>,
2721 {
2722 use std::iter::Iterator;
2723 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2724 self
2725 }
2726
2727 /// Sets the value of [archive_uris][crate::model::SparkBatch::archive_uris].
2728 ///
2729 /// # Example
2730 /// ```ignore,no_run
2731 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2732 /// let x = SparkBatch::new().set_archive_uris(["a", "b", "c"]);
2733 /// ```
2734 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2735 where
2736 T: std::iter::IntoIterator<Item = V>,
2737 V: std::convert::Into<std::string::String>,
2738 {
2739 use std::iter::Iterator;
2740 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2741 self
2742 }
2743
2744 /// Sets the value of [driver][crate::model::SparkBatch::driver].
2745 ///
2746 /// Note that all the setters affecting `driver` are mutually
2747 /// exclusive.
2748 ///
2749 /// # Example
2750 /// ```ignore,no_run
2751 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2752 /// use google_cloud_dataproc_v1::model::spark_batch::Driver;
2753 /// let x = SparkBatch::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
2754 /// ```
2755 pub fn set_driver<
2756 T: std::convert::Into<std::option::Option<crate::model::spark_batch::Driver>>,
2757 >(
2758 mut self,
2759 v: T,
2760 ) -> Self {
2761 self.driver = v.into();
2762 self
2763 }
2764
2765 /// The value of [driver][crate::model::SparkBatch::driver]
2766 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
2767 /// holds a different branch.
2768 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
2769 #[allow(unreachable_patterns)]
2770 self.driver.as_ref().and_then(|v| match v {
2771 crate::model::spark_batch::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
2772 _ => std::option::Option::None,
2773 })
2774 }
2775
2776 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2777 /// to hold a `MainJarFileUri`.
2778 ///
2779 /// Note that all the setters affecting `driver` are
2780 /// mutually exclusive.
2781 ///
2782 /// # Example
2783 /// ```ignore,no_run
2784 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2785 /// let x = SparkBatch::new().set_main_jar_file_uri("example");
2786 /// assert!(x.main_jar_file_uri().is_some());
2787 /// assert!(x.main_class().is_none());
2788 /// ```
2789 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
2790 mut self,
2791 v: T,
2792 ) -> Self {
2793 self.driver =
2794 std::option::Option::Some(crate::model::spark_batch::Driver::MainJarFileUri(v.into()));
2795 self
2796 }
2797
2798 /// The value of [driver][crate::model::SparkBatch::driver]
2799 /// if it holds a `MainClass`, `None` if the field is not set or
2800 /// holds a different branch.
2801 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
2802 #[allow(unreachable_patterns)]
2803 self.driver.as_ref().and_then(|v| match v {
2804 crate::model::spark_batch::Driver::MainClass(v) => std::option::Option::Some(v),
2805 _ => std::option::Option::None,
2806 })
2807 }
2808
2809 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2810 /// to hold a `MainClass`.
2811 ///
2812 /// Note that all the setters affecting `driver` are
2813 /// mutually exclusive.
2814 ///
2815 /// # Example
2816 /// ```ignore,no_run
2817 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2818 /// let x = SparkBatch::new().set_main_class("example");
2819 /// assert!(x.main_class().is_some());
2820 /// assert!(x.main_jar_file_uri().is_none());
2821 /// ```
2822 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2823 self.driver =
2824 std::option::Option::Some(crate::model::spark_batch::Driver::MainClass(v.into()));
2825 self
2826 }
2827}
2828
2829impl wkt::message::Message for SparkBatch {
2830 fn typename() -> &'static str {
2831 "type.googleapis.com/google.cloud.dataproc.v1.SparkBatch"
2832 }
2833}
2834
2835/// Defines additional types related to [SparkBatch].
2836pub mod spark_batch {
2837 #[allow(unused_imports)]
2838 use super::*;
2839
2840 /// The specification of the main method to call to drive the Spark
2841 /// workload. Specify either the jar file that contains the main class or the
2842 /// main class name. To pass both a main jar and a main class in that jar, add
2843 /// the jar to `jar_file_uris`, and then specify the main class
2844 /// name in `main_class`.
2845 #[derive(Clone, Debug, PartialEq)]
2846 #[non_exhaustive]
2847 pub enum Driver {
2848 /// Optional. The HCFS URI of the jar file that contains the main class.
2849 MainJarFileUri(std::string::String),
2850 /// Optional. The name of the driver main class. The jar file that contains
2851 /// the class must be in the classpath or specified in `jar_file_uris`.
2852 MainClass(std::string::String),
2853 }
2854}
2855
2856/// A configuration for running an
2857/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
2858/// batch workload.
2859#[derive(Clone, Default, PartialEq)]
2860#[non_exhaustive]
2861pub struct SparkRBatch {
2862 /// Required. The HCFS URI of the main R file to use as the driver.
2863 /// Must be a `.R` or `.r` file.
2864 pub main_r_file_uri: std::string::String,
2865
2866 /// Optional. The arguments to pass to the Spark driver. Do not include
2867 /// arguments that can be set as batch properties, such as `--conf`, since a
2868 /// collision can occur that causes an incorrect batch submission.
2869 pub args: std::vec::Vec<std::string::String>,
2870
2871 /// Optional. HCFS URIs of files to be placed in the working directory of
2872 /// each executor.
2873 pub file_uris: std::vec::Vec<std::string::String>,
2874
2875 /// Optional. HCFS URIs of archives to be extracted into the working directory
2876 /// of each executor. Supported file types:
2877 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2878 pub archive_uris: std::vec::Vec<std::string::String>,
2879
2880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2881}
2882
2883impl SparkRBatch {
2884 /// Creates a new default instance.
2885 pub fn new() -> Self {
2886 std::default::Default::default()
2887 }
2888
2889 /// Sets the value of [main_r_file_uri][crate::model::SparkRBatch::main_r_file_uri].
2890 ///
2891 /// # Example
2892 /// ```ignore,no_run
2893 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2894 /// let x = SparkRBatch::new().set_main_r_file_uri("example");
2895 /// ```
2896 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2897 self.main_r_file_uri = v.into();
2898 self
2899 }
2900
2901 /// Sets the value of [args][crate::model::SparkRBatch::args].
2902 ///
2903 /// # Example
2904 /// ```ignore,no_run
2905 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2906 /// let x = SparkRBatch::new().set_args(["a", "b", "c"]);
2907 /// ```
2908 pub fn set_args<T, V>(mut self, v: T) -> Self
2909 where
2910 T: std::iter::IntoIterator<Item = V>,
2911 V: std::convert::Into<std::string::String>,
2912 {
2913 use std::iter::Iterator;
2914 self.args = v.into_iter().map(|i| i.into()).collect();
2915 self
2916 }
2917
2918 /// Sets the value of [file_uris][crate::model::SparkRBatch::file_uris].
2919 ///
2920 /// # Example
2921 /// ```ignore,no_run
2922 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2923 /// let x = SparkRBatch::new().set_file_uris(["a", "b", "c"]);
2924 /// ```
2925 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2926 where
2927 T: std::iter::IntoIterator<Item = V>,
2928 V: std::convert::Into<std::string::String>,
2929 {
2930 use std::iter::Iterator;
2931 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2932 self
2933 }
2934
2935 /// Sets the value of [archive_uris][crate::model::SparkRBatch::archive_uris].
2936 ///
2937 /// # Example
2938 /// ```ignore,no_run
2939 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2940 /// let x = SparkRBatch::new().set_archive_uris(["a", "b", "c"]);
2941 /// ```
2942 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2943 where
2944 T: std::iter::IntoIterator<Item = V>,
2945 V: std::convert::Into<std::string::String>,
2946 {
2947 use std::iter::Iterator;
2948 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2949 self
2950 }
2951}
2952
2953impl wkt::message::Message for SparkRBatch {
2954 fn typename() -> &'static str {
2955 "type.googleapis.com/google.cloud.dataproc.v1.SparkRBatch"
2956 }
2957}
2958
2959/// A configuration for running
2960/// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch
2961/// workload.
2962#[derive(Clone, Default, PartialEq)]
2963#[non_exhaustive]
2964pub struct SparkSqlBatch {
2965 /// Required. The HCFS URI of the script that contains Spark SQL queries to
2966 /// execute.
2967 pub query_file_uri: std::string::String,
2968
2969 /// Optional. Mapping of query variable names to values (equivalent to the
2970 /// Spark SQL command: `SET name="value";`).
2971 pub query_variables: std::collections::HashMap<std::string::String, std::string::String>,
2972
2973 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2974 pub jar_file_uris: std::vec::Vec<std::string::String>,
2975
2976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2977}
2978
2979impl SparkSqlBatch {
2980 /// Creates a new default instance.
2981 pub fn new() -> Self {
2982 std::default::Default::default()
2983 }
2984
2985 /// Sets the value of [query_file_uri][crate::model::SparkSqlBatch::query_file_uri].
2986 ///
2987 /// # Example
2988 /// ```ignore,no_run
2989 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2990 /// let x = SparkSqlBatch::new().set_query_file_uri("example");
2991 /// ```
2992 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2993 self.query_file_uri = v.into();
2994 self
2995 }
2996
2997 /// Sets the value of [query_variables][crate::model::SparkSqlBatch::query_variables].
2998 ///
2999 /// # Example
3000 /// ```ignore,no_run
3001 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
3002 /// let x = SparkSqlBatch::new().set_query_variables([
3003 /// ("key0", "abc"),
3004 /// ("key1", "xyz"),
3005 /// ]);
3006 /// ```
3007 pub fn set_query_variables<T, K, V>(mut self, v: T) -> Self
3008 where
3009 T: std::iter::IntoIterator<Item = (K, V)>,
3010 K: std::convert::Into<std::string::String>,
3011 V: std::convert::Into<std::string::String>,
3012 {
3013 use std::iter::Iterator;
3014 self.query_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3015 self
3016 }
3017
3018 /// Sets the value of [jar_file_uris][crate::model::SparkSqlBatch::jar_file_uris].
3019 ///
3020 /// # Example
3021 /// ```ignore,no_run
3022 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
3023 /// let x = SparkSqlBatch::new().set_jar_file_uris(["a", "b", "c"]);
3024 /// ```
3025 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
3026 where
3027 T: std::iter::IntoIterator<Item = V>,
3028 V: std::convert::Into<std::string::String>,
3029 {
3030 use std::iter::Iterator;
3031 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
3032 self
3033 }
3034}
3035
3036impl wkt::message::Message for SparkSqlBatch {
3037 fn typename() -> &'static str {
3038 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlBatch"
3039 }
3040}
3041
3042/// A configuration for running a PySpark Notebook batch workload.
3043#[derive(Clone, Default, PartialEq)]
3044#[non_exhaustive]
3045pub struct PySparkNotebookBatch {
3046 /// Required. The HCFS URI of the notebook file to execute.
3047 pub notebook_file_uri: std::string::String,
3048
3049 /// Optional. The parameters to pass to the notebook.
3050 pub params: std::collections::HashMap<std::string::String, std::string::String>,
3051
3052 /// Optional. HCFS URIs of Python files to pass to the PySpark framework.
3053 pub python_file_uris: std::vec::Vec<std::string::String>,
3054
3055 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
3056 pub jar_file_uris: std::vec::Vec<std::string::String>,
3057
3058 /// Optional. HCFS URIs of files to be placed in the working directory of
3059 /// each executor
3060 pub file_uris: std::vec::Vec<std::string::String>,
3061
3062 /// Optional. HCFS URIs of archives to be extracted into the working directory
3063 /// of each executor. Supported file types:
3064 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
3065 pub archive_uris: std::vec::Vec<std::string::String>,
3066
3067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3068}
3069
3070impl PySparkNotebookBatch {
3071 /// Creates a new default instance.
3072 pub fn new() -> Self {
3073 std::default::Default::default()
3074 }
3075
3076 /// Sets the value of [notebook_file_uri][crate::model::PySparkNotebookBatch::notebook_file_uri].
3077 ///
3078 /// # Example
3079 /// ```ignore,no_run
3080 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3081 /// let x = PySparkNotebookBatch::new().set_notebook_file_uri("example");
3082 /// ```
3083 pub fn set_notebook_file_uri<T: std::convert::Into<std::string::String>>(
3084 mut self,
3085 v: T,
3086 ) -> Self {
3087 self.notebook_file_uri = v.into();
3088 self
3089 }
3090
3091 /// Sets the value of [params][crate::model::PySparkNotebookBatch::params].
3092 ///
3093 /// # Example
3094 /// ```ignore,no_run
3095 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3096 /// let x = PySparkNotebookBatch::new().set_params([
3097 /// ("key0", "abc"),
3098 /// ("key1", "xyz"),
3099 /// ]);
3100 /// ```
3101 pub fn set_params<T, K, V>(mut self, v: T) -> Self
3102 where
3103 T: std::iter::IntoIterator<Item = (K, V)>,
3104 K: std::convert::Into<std::string::String>,
3105 V: std::convert::Into<std::string::String>,
3106 {
3107 use std::iter::Iterator;
3108 self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3109 self
3110 }
3111
3112 /// Sets the value of [python_file_uris][crate::model::PySparkNotebookBatch::python_file_uris].
3113 ///
3114 /// # Example
3115 /// ```ignore,no_run
3116 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3117 /// let x = PySparkNotebookBatch::new().set_python_file_uris(["a", "b", "c"]);
3118 /// ```
3119 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
3120 where
3121 T: std::iter::IntoIterator<Item = V>,
3122 V: std::convert::Into<std::string::String>,
3123 {
3124 use std::iter::Iterator;
3125 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
3126 self
3127 }
3128
3129 /// Sets the value of [jar_file_uris][crate::model::PySparkNotebookBatch::jar_file_uris].
3130 ///
3131 /// # Example
3132 /// ```ignore,no_run
3133 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3134 /// let x = PySparkNotebookBatch::new().set_jar_file_uris(["a", "b", "c"]);
3135 /// ```
3136 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
3137 where
3138 T: std::iter::IntoIterator<Item = V>,
3139 V: std::convert::Into<std::string::String>,
3140 {
3141 use std::iter::Iterator;
3142 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
3143 self
3144 }
3145
3146 /// Sets the value of [file_uris][crate::model::PySparkNotebookBatch::file_uris].
3147 ///
3148 /// # Example
3149 /// ```ignore,no_run
3150 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3151 /// let x = PySparkNotebookBatch::new().set_file_uris(["a", "b", "c"]);
3152 /// ```
3153 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
3154 where
3155 T: std::iter::IntoIterator<Item = V>,
3156 V: std::convert::Into<std::string::String>,
3157 {
3158 use std::iter::Iterator;
3159 self.file_uris = v.into_iter().map(|i| i.into()).collect();
3160 self
3161 }
3162
3163 /// Sets the value of [archive_uris][crate::model::PySparkNotebookBatch::archive_uris].
3164 ///
3165 /// # Example
3166 /// ```ignore,no_run
3167 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3168 /// let x = PySparkNotebookBatch::new().set_archive_uris(["a", "b", "c"]);
3169 /// ```
3170 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
3171 where
3172 T: std::iter::IntoIterator<Item = V>,
3173 V: std::convert::Into<std::string::String>,
3174 {
3175 use std::iter::Iterator;
3176 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
3177 self
3178 }
3179}
3180
3181impl wkt::message::Message for PySparkNotebookBatch {
3182 fn typename() -> &'static str {
3183 "type.googleapis.com/google.cloud.dataproc.v1.PySparkNotebookBatch"
3184 }
3185}
3186
3187/// Describes the identifying information, config, and status of
3188/// a Dataproc cluster
3189#[derive(Clone, Default, PartialEq)]
3190#[non_exhaustive]
3191pub struct Cluster {
3192 /// Required. The Google Cloud Platform project ID that the cluster belongs to.
3193 pub project_id: std::string::String,
3194
3195 /// Required. The cluster name, which must be unique within a project.
3196 /// The name must start with a lowercase letter, and can contain
3197 /// up to 51 lowercase letters, numbers, and hyphens. It cannot end
3198 /// with a hyphen. The name of a deleted cluster can be reused.
3199 pub cluster_name: std::string::String,
3200
3201 /// Optional. The cluster config for a cluster of Compute Engine Instances.
3202 /// Note that Dataproc may set default values, and values may change
3203 /// when clusters are updated.
3204 ///
3205 /// Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
3206 pub config: std::option::Option<crate::model::ClusterConfig>,
3207
3208 /// Optional. The virtual cluster config is used when creating a Dataproc
3209 /// cluster that does not directly control the underlying compute resources,
3210 /// for example, when creating a [Dataproc-on-GKE
3211 /// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
3212 /// Dataproc may set default values, and values may change when
3213 /// clusters are updated. Exactly one of
3214 /// [config][google.cloud.dataproc.v1.Cluster.config] or
3215 /// [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config]
3216 /// must be specified.
3217 ///
3218 /// [google.cloud.dataproc.v1.Cluster.config]: crate::model::Cluster::config
3219 /// [google.cloud.dataproc.v1.Cluster.virtual_cluster_config]: crate::model::Cluster::virtual_cluster_config
3220 pub virtual_cluster_config: std::option::Option<crate::model::VirtualClusterConfig>,
3221
3222 /// Optional. The labels to associate with this cluster.
3223 /// Label **keys** must contain 1 to 63 characters, and must conform to
3224 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
3225 /// Label **values** may be empty, but, if present, must contain 1 to 63
3226 /// characters, and must conform to [RFC
3227 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
3228 /// associated with a cluster.
3229 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3230
3231 /// Output only. Cluster status.
3232 pub status: std::option::Option<crate::model::ClusterStatus>,
3233
3234 /// Output only. The previous cluster status.
3235 pub status_history: std::vec::Vec<crate::model::ClusterStatus>,
3236
3237 /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc
3238 /// generates this value when it creates the cluster.
3239 pub cluster_uuid: std::string::String,
3240
3241 /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.
3242 ///
3243 /// **Beta Feature**: This report is available for testing purposes only. It
3244 /// may be changed before final release.
3245 pub metrics: std::option::Option<crate::model::ClusterMetrics>,
3246
3247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3248}
3249
3250impl Cluster {
3251 /// Creates a new default instance.
3252 pub fn new() -> Self {
3253 std::default::Default::default()
3254 }
3255
3256 /// Sets the value of [project_id][crate::model::Cluster::project_id].
3257 ///
3258 /// # Example
3259 /// ```ignore,no_run
3260 /// # use google_cloud_dataproc_v1::model::Cluster;
3261 /// let x = Cluster::new().set_project_id("example");
3262 /// ```
3263 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3264 self.project_id = v.into();
3265 self
3266 }
3267
3268 /// Sets the value of [cluster_name][crate::model::Cluster::cluster_name].
3269 ///
3270 /// # Example
3271 /// ```ignore,no_run
3272 /// # use google_cloud_dataproc_v1::model::Cluster;
3273 /// let x = Cluster::new().set_cluster_name("example");
3274 /// ```
3275 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3276 self.cluster_name = v.into();
3277 self
3278 }
3279
3280 /// Sets the value of [config][crate::model::Cluster::config].
3281 ///
3282 /// # Example
3283 /// ```ignore,no_run
3284 /// # use google_cloud_dataproc_v1::model::Cluster;
3285 /// use google_cloud_dataproc_v1::model::ClusterConfig;
3286 /// let x = Cluster::new().set_config(ClusterConfig::default()/* use setters */);
3287 /// ```
3288 pub fn set_config<T>(mut self, v: T) -> Self
3289 where
3290 T: std::convert::Into<crate::model::ClusterConfig>,
3291 {
3292 self.config = std::option::Option::Some(v.into());
3293 self
3294 }
3295
3296 /// Sets or clears the value of [config][crate::model::Cluster::config].
3297 ///
3298 /// # Example
3299 /// ```ignore,no_run
3300 /// # use google_cloud_dataproc_v1::model::Cluster;
3301 /// use google_cloud_dataproc_v1::model::ClusterConfig;
3302 /// let x = Cluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
3303 /// let x = Cluster::new().set_or_clear_config(None::<ClusterConfig>);
3304 /// ```
3305 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
3306 where
3307 T: std::convert::Into<crate::model::ClusterConfig>,
3308 {
3309 self.config = v.map(|x| x.into());
3310 self
3311 }
3312
3313 /// Sets the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3314 ///
3315 /// # Example
3316 /// ```ignore,no_run
3317 /// # use google_cloud_dataproc_v1::model::Cluster;
3318 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3319 /// let x = Cluster::new().set_virtual_cluster_config(VirtualClusterConfig::default()/* use setters */);
3320 /// ```
3321 pub fn set_virtual_cluster_config<T>(mut self, v: T) -> Self
3322 where
3323 T: std::convert::Into<crate::model::VirtualClusterConfig>,
3324 {
3325 self.virtual_cluster_config = std::option::Option::Some(v.into());
3326 self
3327 }
3328
3329 /// Sets or clears the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3330 ///
3331 /// # Example
3332 /// ```ignore,no_run
3333 /// # use google_cloud_dataproc_v1::model::Cluster;
3334 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3335 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(Some(VirtualClusterConfig::default()/* use setters */));
3336 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(None::<VirtualClusterConfig>);
3337 /// ```
3338 pub fn set_or_clear_virtual_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3339 where
3340 T: std::convert::Into<crate::model::VirtualClusterConfig>,
3341 {
3342 self.virtual_cluster_config = v.map(|x| x.into());
3343 self
3344 }
3345
3346 /// Sets the value of [labels][crate::model::Cluster::labels].
3347 ///
3348 /// # Example
3349 /// ```ignore,no_run
3350 /// # use google_cloud_dataproc_v1::model::Cluster;
3351 /// let x = Cluster::new().set_labels([
3352 /// ("key0", "abc"),
3353 /// ("key1", "xyz"),
3354 /// ]);
3355 /// ```
3356 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3357 where
3358 T: std::iter::IntoIterator<Item = (K, V)>,
3359 K: std::convert::Into<std::string::String>,
3360 V: std::convert::Into<std::string::String>,
3361 {
3362 use std::iter::Iterator;
3363 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3364 self
3365 }
3366
3367 /// Sets the value of [status][crate::model::Cluster::status].
3368 ///
3369 /// # Example
3370 /// ```ignore,no_run
3371 /// # use google_cloud_dataproc_v1::model::Cluster;
3372 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3373 /// let x = Cluster::new().set_status(ClusterStatus::default()/* use setters */);
3374 /// ```
3375 pub fn set_status<T>(mut self, v: T) -> Self
3376 where
3377 T: std::convert::Into<crate::model::ClusterStatus>,
3378 {
3379 self.status = std::option::Option::Some(v.into());
3380 self
3381 }
3382
3383 /// Sets or clears the value of [status][crate::model::Cluster::status].
3384 ///
3385 /// # Example
3386 /// ```ignore,no_run
3387 /// # use google_cloud_dataproc_v1::model::Cluster;
3388 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3389 /// let x = Cluster::new().set_or_clear_status(Some(ClusterStatus::default()/* use setters */));
3390 /// let x = Cluster::new().set_or_clear_status(None::<ClusterStatus>);
3391 /// ```
3392 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
3393 where
3394 T: std::convert::Into<crate::model::ClusterStatus>,
3395 {
3396 self.status = v.map(|x| x.into());
3397 self
3398 }
3399
3400 /// Sets the value of [status_history][crate::model::Cluster::status_history].
3401 ///
3402 /// # Example
3403 /// ```ignore,no_run
3404 /// # use google_cloud_dataproc_v1::model::Cluster;
3405 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3406 /// let x = Cluster::new()
3407 /// .set_status_history([
3408 /// ClusterStatus::default()/* use setters */,
3409 /// ClusterStatus::default()/* use (different) setters */,
3410 /// ]);
3411 /// ```
3412 pub fn set_status_history<T, V>(mut self, v: T) -> Self
3413 where
3414 T: std::iter::IntoIterator<Item = V>,
3415 V: std::convert::Into<crate::model::ClusterStatus>,
3416 {
3417 use std::iter::Iterator;
3418 self.status_history = v.into_iter().map(|i| i.into()).collect();
3419 self
3420 }
3421
3422 /// Sets the value of [cluster_uuid][crate::model::Cluster::cluster_uuid].
3423 ///
3424 /// # Example
3425 /// ```ignore,no_run
3426 /// # use google_cloud_dataproc_v1::model::Cluster;
3427 /// let x = Cluster::new().set_cluster_uuid("example");
3428 /// ```
3429 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3430 self.cluster_uuid = v.into();
3431 self
3432 }
3433
3434 /// Sets the value of [metrics][crate::model::Cluster::metrics].
3435 ///
3436 /// # Example
3437 /// ```ignore,no_run
3438 /// # use google_cloud_dataproc_v1::model::Cluster;
3439 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3440 /// let x = Cluster::new().set_metrics(ClusterMetrics::default()/* use setters */);
3441 /// ```
3442 pub fn set_metrics<T>(mut self, v: T) -> Self
3443 where
3444 T: std::convert::Into<crate::model::ClusterMetrics>,
3445 {
3446 self.metrics = std::option::Option::Some(v.into());
3447 self
3448 }
3449
3450 /// Sets or clears the value of [metrics][crate::model::Cluster::metrics].
3451 ///
3452 /// # Example
3453 /// ```ignore,no_run
3454 /// # use google_cloud_dataproc_v1::model::Cluster;
3455 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3456 /// let x = Cluster::new().set_or_clear_metrics(Some(ClusterMetrics::default()/* use setters */));
3457 /// let x = Cluster::new().set_or_clear_metrics(None::<ClusterMetrics>);
3458 /// ```
3459 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
3460 where
3461 T: std::convert::Into<crate::model::ClusterMetrics>,
3462 {
3463 self.metrics = v.map(|x| x.into());
3464 self
3465 }
3466}
3467
3468impl wkt::message::Message for Cluster {
3469 fn typename() -> &'static str {
3470 "type.googleapis.com/google.cloud.dataproc.v1.Cluster"
3471 }
3472}
3473
3474/// The cluster config.
3475#[derive(Clone, Default, PartialEq)]
3476#[non_exhaustive]
3477pub struct ClusterConfig {
3478 /// Optional. The type of the cluster.
3479 pub cluster_type: crate::model::cluster_config::ClusterType,
3480
3481 /// Optional. The cluster tier.
3482 pub cluster_tier: crate::model::cluster_config::ClusterTier,
3483
3484 /// Optional. The cluster engine.
3485 pub engine: crate::model::cluster_config::Engine,
3486
3487 /// Optional. A Cloud Storage bucket used to stage job
3488 /// dependencies, config files, and job driver console output.
3489 /// If you do not specify a staging bucket, Cloud
3490 /// Dataproc will determine a Cloud Storage location (US,
3491 /// ASIA, or EU) for your cluster's staging bucket according to the
3492 /// Compute Engine zone where your cluster is deployed, and then create
3493 /// and manage this project-level, per-location bucket (see
3494 /// [Dataproc staging and temp
3495 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3496 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3497 /// a Cloud Storage bucket.**
3498 pub config_bucket: std::string::String,
3499
3500 /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs
3501 /// data, such as Spark and MapReduce history files. If you do not specify a
3502 /// temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or
3503 /// EU) for your cluster's temp bucket according to the Compute Engine zone
3504 /// where your cluster is deployed, and then create and manage this
3505 /// project-level, per-location bucket. The default bucket has a TTL of 90
3506 /// days, but you can use any TTL (or none) if you specify a bucket (see
3507 /// [Dataproc staging and temp
3508 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3509 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3510 /// a Cloud Storage bucket.**
3511 pub temp_bucket: std::string::String,
3512
3513 /// Optional. The shared Compute Engine config settings for
3514 /// all instances in a cluster.
3515 pub gce_cluster_config: std::option::Option<crate::model::GceClusterConfig>,
3516
3517 /// Optional. The Compute Engine config settings for
3518 /// the cluster's master instance.
3519 pub master_config: std::option::Option<crate::model::InstanceGroupConfig>,
3520
3521 /// Optional. The Compute Engine config settings for
3522 /// the cluster's worker instances.
3523 pub worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3524
3525 /// Optional. The Compute Engine config settings for
3526 /// a cluster's secondary worker instances
3527 pub secondary_worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3528
3529 /// Optional. The config settings for cluster software.
3530 pub software_config: std::option::Option<crate::model::SoftwareConfig>,
3531
3532 /// Optional. Commands to execute on each node after config is
3533 /// completed. By default, executables are run on master and all worker nodes.
3534 /// You can test a node's `role` metadata to run an executable on
3535 /// a master or worker node, as shown below using `curl` (you can also use
3536 /// `wget`):
3537 ///
3538 /// ```norust
3539 /// ROLE=$(curl -H Metadata-Flavor:Google
3540 /// http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
3541 /// if [[ "${ROLE}" == 'Master' ]]; then
3542 /// ... master specific actions ...
3543 /// else
3544 /// ... worker specific actions ...
3545 /// fi
3546 /// ```
3547 pub initialization_actions: std::vec::Vec<crate::model::NodeInitializationAction>,
3548
3549 /// Optional. Encryption settings for the cluster.
3550 pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
3551
3552 /// Optional. Autoscaling config for the policy associated with the cluster.
3553 /// Cluster does not autoscale if this field is unset.
3554 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
3555
3556 /// Optional. Security settings for the cluster.
3557 pub security_config: std::option::Option<crate::model::SecurityConfig>,
3558
3559 /// Optional. Lifecycle setting for the cluster.
3560 pub lifecycle_config: std::option::Option<crate::model::LifecycleConfig>,
3561
3562 /// Optional. Port/endpoint configuration for this cluster
3563 pub endpoint_config: std::option::Option<crate::model::EndpointConfig>,
3564
3565 /// Optional. Metastore configuration.
3566 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3567
3568 /// Optional. The config for Dataproc metrics.
3569 pub dataproc_metric_config: std::option::Option<crate::model::DataprocMetricConfig>,
3570
3571 /// Optional. The node group settings.
3572 pub auxiliary_node_groups: std::vec::Vec<crate::model::AuxiliaryNodeGroup>,
3573
3574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3575}
3576
3577impl ClusterConfig {
3578 /// Creates a new default instance.
3579 pub fn new() -> Self {
3580 std::default::Default::default()
3581 }
3582
3583 /// Sets the value of [cluster_type][crate::model::ClusterConfig::cluster_type].
3584 ///
3585 /// # Example
3586 /// ```ignore,no_run
3587 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3588 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterType;
3589 /// let x0 = ClusterConfig::new().set_cluster_type(ClusterType::Standard);
3590 /// let x1 = ClusterConfig::new().set_cluster_type(ClusterType::SingleNode);
3591 /// let x2 = ClusterConfig::new().set_cluster_type(ClusterType::ZeroScale);
3592 /// ```
3593 pub fn set_cluster_type<T: std::convert::Into<crate::model::cluster_config::ClusterType>>(
3594 mut self,
3595 v: T,
3596 ) -> Self {
3597 self.cluster_type = v.into();
3598 self
3599 }
3600
3601 /// Sets the value of [cluster_tier][crate::model::ClusterConfig::cluster_tier].
3602 ///
3603 /// # Example
3604 /// ```ignore,no_run
3605 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3606 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterTier;
3607 /// let x0 = ClusterConfig::new().set_cluster_tier(ClusterTier::Standard);
3608 /// let x1 = ClusterConfig::new().set_cluster_tier(ClusterTier::Premium);
3609 /// ```
3610 pub fn set_cluster_tier<T: std::convert::Into<crate::model::cluster_config::ClusterTier>>(
3611 mut self,
3612 v: T,
3613 ) -> Self {
3614 self.cluster_tier = v.into();
3615 self
3616 }
3617
3618 /// Sets the value of [engine][crate::model::ClusterConfig::engine].
3619 ///
3620 /// # Example
3621 /// ```ignore,no_run
3622 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3623 /// use google_cloud_dataproc_v1::model::cluster_config::Engine;
3624 /// let x0 = ClusterConfig::new().set_engine(Engine::Default);
3625 /// let x1 = ClusterConfig::new().set_engine(Engine::Lightning);
3626 /// ```
3627 pub fn set_engine<T: std::convert::Into<crate::model::cluster_config::Engine>>(
3628 mut self,
3629 v: T,
3630 ) -> Self {
3631 self.engine = v.into();
3632 self
3633 }
3634
3635 /// Sets the value of [config_bucket][crate::model::ClusterConfig::config_bucket].
3636 ///
3637 /// # Example
3638 /// ```ignore,no_run
3639 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3640 /// let x = ClusterConfig::new().set_config_bucket("example");
3641 /// ```
3642 pub fn set_config_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3643 self.config_bucket = v.into();
3644 self
3645 }
3646
3647 /// Sets the value of [temp_bucket][crate::model::ClusterConfig::temp_bucket].
3648 ///
3649 /// # Example
3650 /// ```ignore,no_run
3651 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3652 /// let x = ClusterConfig::new().set_temp_bucket("example");
3653 /// ```
3654 pub fn set_temp_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3655 self.temp_bucket = v.into();
3656 self
3657 }
3658
3659 /// Sets the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3660 ///
3661 /// # Example
3662 /// ```ignore,no_run
3663 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3664 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3665 /// let x = ClusterConfig::new().set_gce_cluster_config(GceClusterConfig::default()/* use setters */);
3666 /// ```
3667 pub fn set_gce_cluster_config<T>(mut self, v: T) -> Self
3668 where
3669 T: std::convert::Into<crate::model::GceClusterConfig>,
3670 {
3671 self.gce_cluster_config = std::option::Option::Some(v.into());
3672 self
3673 }
3674
3675 /// Sets or clears the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3676 ///
3677 /// # Example
3678 /// ```ignore,no_run
3679 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3680 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3681 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(Some(GceClusterConfig::default()/* use setters */));
3682 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(None::<GceClusterConfig>);
3683 /// ```
3684 pub fn set_or_clear_gce_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3685 where
3686 T: std::convert::Into<crate::model::GceClusterConfig>,
3687 {
3688 self.gce_cluster_config = v.map(|x| x.into());
3689 self
3690 }
3691
3692 /// Sets the value of [master_config][crate::model::ClusterConfig::master_config].
3693 ///
3694 /// # Example
3695 /// ```ignore,no_run
3696 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3697 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3698 /// let x = ClusterConfig::new().set_master_config(InstanceGroupConfig::default()/* use setters */);
3699 /// ```
3700 pub fn set_master_config<T>(mut self, v: T) -> Self
3701 where
3702 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3703 {
3704 self.master_config = std::option::Option::Some(v.into());
3705 self
3706 }
3707
3708 /// Sets or clears the value of [master_config][crate::model::ClusterConfig::master_config].
3709 ///
3710 /// # Example
3711 /// ```ignore,no_run
3712 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3713 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3714 /// let x = ClusterConfig::new().set_or_clear_master_config(Some(InstanceGroupConfig::default()/* use setters */));
3715 /// let x = ClusterConfig::new().set_or_clear_master_config(None::<InstanceGroupConfig>);
3716 /// ```
3717 pub fn set_or_clear_master_config<T>(mut self, v: std::option::Option<T>) -> Self
3718 where
3719 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3720 {
3721 self.master_config = v.map(|x| x.into());
3722 self
3723 }
3724
3725 /// Sets the value of [worker_config][crate::model::ClusterConfig::worker_config].
3726 ///
3727 /// # Example
3728 /// ```ignore,no_run
3729 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3730 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3731 /// let x = ClusterConfig::new().set_worker_config(InstanceGroupConfig::default()/* use setters */);
3732 /// ```
3733 pub fn set_worker_config<T>(mut self, v: T) -> Self
3734 where
3735 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3736 {
3737 self.worker_config = std::option::Option::Some(v.into());
3738 self
3739 }
3740
3741 /// Sets or clears the value of [worker_config][crate::model::ClusterConfig::worker_config].
3742 ///
3743 /// # Example
3744 /// ```ignore,no_run
3745 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3746 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3747 /// let x = ClusterConfig::new().set_or_clear_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3748 /// let x = ClusterConfig::new().set_or_clear_worker_config(None::<InstanceGroupConfig>);
3749 /// ```
3750 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3751 where
3752 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3753 {
3754 self.worker_config = v.map(|x| x.into());
3755 self
3756 }
3757
3758 /// Sets the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3759 ///
3760 /// # Example
3761 /// ```ignore,no_run
3762 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3763 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3764 /// let x = ClusterConfig::new().set_secondary_worker_config(InstanceGroupConfig::default()/* use setters */);
3765 /// ```
3766 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
3767 where
3768 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3769 {
3770 self.secondary_worker_config = std::option::Option::Some(v.into());
3771 self
3772 }
3773
3774 /// Sets or clears the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3775 ///
3776 /// # Example
3777 /// ```ignore,no_run
3778 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3779 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3780 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3781 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(None::<InstanceGroupConfig>);
3782 /// ```
3783 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3784 where
3785 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3786 {
3787 self.secondary_worker_config = v.map(|x| x.into());
3788 self
3789 }
3790
3791 /// Sets the value of [software_config][crate::model::ClusterConfig::software_config].
3792 ///
3793 /// # Example
3794 /// ```ignore,no_run
3795 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3796 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3797 /// let x = ClusterConfig::new().set_software_config(SoftwareConfig::default()/* use setters */);
3798 /// ```
3799 pub fn set_software_config<T>(mut self, v: T) -> Self
3800 where
3801 T: std::convert::Into<crate::model::SoftwareConfig>,
3802 {
3803 self.software_config = std::option::Option::Some(v.into());
3804 self
3805 }
3806
3807 /// Sets or clears the value of [software_config][crate::model::ClusterConfig::software_config].
3808 ///
3809 /// # Example
3810 /// ```ignore,no_run
3811 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3812 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3813 /// let x = ClusterConfig::new().set_or_clear_software_config(Some(SoftwareConfig::default()/* use setters */));
3814 /// let x = ClusterConfig::new().set_or_clear_software_config(None::<SoftwareConfig>);
3815 /// ```
3816 pub fn set_or_clear_software_config<T>(mut self, v: std::option::Option<T>) -> Self
3817 where
3818 T: std::convert::Into<crate::model::SoftwareConfig>,
3819 {
3820 self.software_config = v.map(|x| x.into());
3821 self
3822 }
3823
3824 /// Sets the value of [initialization_actions][crate::model::ClusterConfig::initialization_actions].
3825 ///
3826 /// # Example
3827 /// ```ignore,no_run
3828 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3829 /// use google_cloud_dataproc_v1::model::NodeInitializationAction;
3830 /// let x = ClusterConfig::new()
3831 /// .set_initialization_actions([
3832 /// NodeInitializationAction::default()/* use setters */,
3833 /// NodeInitializationAction::default()/* use (different) setters */,
3834 /// ]);
3835 /// ```
3836 pub fn set_initialization_actions<T, V>(mut self, v: T) -> Self
3837 where
3838 T: std::iter::IntoIterator<Item = V>,
3839 V: std::convert::Into<crate::model::NodeInitializationAction>,
3840 {
3841 use std::iter::Iterator;
3842 self.initialization_actions = v.into_iter().map(|i| i.into()).collect();
3843 self
3844 }
3845
3846 /// Sets the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3847 ///
3848 /// # Example
3849 /// ```ignore,no_run
3850 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3851 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3852 /// let x = ClusterConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3853 /// ```
3854 pub fn set_encryption_config<T>(mut self, v: T) -> Self
3855 where
3856 T: std::convert::Into<crate::model::EncryptionConfig>,
3857 {
3858 self.encryption_config = std::option::Option::Some(v.into());
3859 self
3860 }
3861
3862 /// Sets or clears the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3863 ///
3864 /// # Example
3865 /// ```ignore,no_run
3866 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3867 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3868 /// let x = ClusterConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3869 /// let x = ClusterConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3870 /// ```
3871 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3872 where
3873 T: std::convert::Into<crate::model::EncryptionConfig>,
3874 {
3875 self.encryption_config = v.map(|x| x.into());
3876 self
3877 }
3878
3879 /// Sets the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3880 ///
3881 /// # Example
3882 /// ```ignore,no_run
3883 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3884 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3885 /// let x = ClusterConfig::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
3886 /// ```
3887 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
3888 where
3889 T: std::convert::Into<crate::model::AutoscalingConfig>,
3890 {
3891 self.autoscaling_config = std::option::Option::Some(v.into());
3892 self
3893 }
3894
3895 /// Sets or clears the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3896 ///
3897 /// # Example
3898 /// ```ignore,no_run
3899 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3900 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3901 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
3902 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
3903 /// ```
3904 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
3905 where
3906 T: std::convert::Into<crate::model::AutoscalingConfig>,
3907 {
3908 self.autoscaling_config = v.map(|x| x.into());
3909 self
3910 }
3911
3912 /// Sets the value of [security_config][crate::model::ClusterConfig::security_config].
3913 ///
3914 /// # Example
3915 /// ```ignore,no_run
3916 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3917 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3918 /// let x = ClusterConfig::new().set_security_config(SecurityConfig::default()/* use setters */);
3919 /// ```
3920 pub fn set_security_config<T>(mut self, v: T) -> Self
3921 where
3922 T: std::convert::Into<crate::model::SecurityConfig>,
3923 {
3924 self.security_config = std::option::Option::Some(v.into());
3925 self
3926 }
3927
3928 /// Sets or clears the value of [security_config][crate::model::ClusterConfig::security_config].
3929 ///
3930 /// # Example
3931 /// ```ignore,no_run
3932 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3933 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3934 /// let x = ClusterConfig::new().set_or_clear_security_config(Some(SecurityConfig::default()/* use setters */));
3935 /// let x = ClusterConfig::new().set_or_clear_security_config(None::<SecurityConfig>);
3936 /// ```
3937 pub fn set_or_clear_security_config<T>(mut self, v: std::option::Option<T>) -> Self
3938 where
3939 T: std::convert::Into<crate::model::SecurityConfig>,
3940 {
3941 self.security_config = v.map(|x| x.into());
3942 self
3943 }
3944
3945 /// Sets the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3946 ///
3947 /// # Example
3948 /// ```ignore,no_run
3949 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3950 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3951 /// let x = ClusterConfig::new().set_lifecycle_config(LifecycleConfig::default()/* use setters */);
3952 /// ```
3953 pub fn set_lifecycle_config<T>(mut self, v: T) -> Self
3954 where
3955 T: std::convert::Into<crate::model::LifecycleConfig>,
3956 {
3957 self.lifecycle_config = std::option::Option::Some(v.into());
3958 self
3959 }
3960
3961 /// Sets or clears the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3962 ///
3963 /// # Example
3964 /// ```ignore,no_run
3965 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3966 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3967 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(Some(LifecycleConfig::default()/* use setters */));
3968 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(None::<LifecycleConfig>);
3969 /// ```
3970 pub fn set_or_clear_lifecycle_config<T>(mut self, v: std::option::Option<T>) -> Self
3971 where
3972 T: std::convert::Into<crate::model::LifecycleConfig>,
3973 {
3974 self.lifecycle_config = v.map(|x| x.into());
3975 self
3976 }
3977
3978 /// Sets the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3979 ///
3980 /// # Example
3981 /// ```ignore,no_run
3982 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3983 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3984 /// let x = ClusterConfig::new().set_endpoint_config(EndpointConfig::default()/* use setters */);
3985 /// ```
3986 pub fn set_endpoint_config<T>(mut self, v: T) -> Self
3987 where
3988 T: std::convert::Into<crate::model::EndpointConfig>,
3989 {
3990 self.endpoint_config = std::option::Option::Some(v.into());
3991 self
3992 }
3993
3994 /// Sets or clears the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3995 ///
3996 /// # Example
3997 /// ```ignore,no_run
3998 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3999 /// use google_cloud_dataproc_v1::model::EndpointConfig;
4000 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(Some(EndpointConfig::default()/* use setters */));
4001 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(None::<EndpointConfig>);
4002 /// ```
4003 pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
4004 where
4005 T: std::convert::Into<crate::model::EndpointConfig>,
4006 {
4007 self.endpoint_config = v.map(|x| x.into());
4008 self
4009 }
4010
4011 /// Sets the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
4012 ///
4013 /// # Example
4014 /// ```ignore,no_run
4015 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4016 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4017 /// let x = ClusterConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
4018 /// ```
4019 pub fn set_metastore_config<T>(mut self, v: T) -> Self
4020 where
4021 T: std::convert::Into<crate::model::MetastoreConfig>,
4022 {
4023 self.metastore_config = std::option::Option::Some(v.into());
4024 self
4025 }
4026
4027 /// Sets or clears the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
4028 ///
4029 /// # Example
4030 /// ```ignore,no_run
4031 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4032 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4033 /// let x = ClusterConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4034 /// let x = ClusterConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4035 /// ```
4036 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4037 where
4038 T: std::convert::Into<crate::model::MetastoreConfig>,
4039 {
4040 self.metastore_config = v.map(|x| x.into());
4041 self
4042 }
4043
4044 /// Sets the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
4045 ///
4046 /// # Example
4047 /// ```ignore,no_run
4048 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4049 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
4050 /// let x = ClusterConfig::new().set_dataproc_metric_config(DataprocMetricConfig::default()/* use setters */);
4051 /// ```
4052 pub fn set_dataproc_metric_config<T>(mut self, v: T) -> Self
4053 where
4054 T: std::convert::Into<crate::model::DataprocMetricConfig>,
4055 {
4056 self.dataproc_metric_config = std::option::Option::Some(v.into());
4057 self
4058 }
4059
4060 /// Sets or clears the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
4061 ///
4062 /// # Example
4063 /// ```ignore,no_run
4064 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4065 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
4066 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(Some(DataprocMetricConfig::default()/* use setters */));
4067 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(None::<DataprocMetricConfig>);
4068 /// ```
4069 pub fn set_or_clear_dataproc_metric_config<T>(mut self, v: std::option::Option<T>) -> Self
4070 where
4071 T: std::convert::Into<crate::model::DataprocMetricConfig>,
4072 {
4073 self.dataproc_metric_config = v.map(|x| x.into());
4074 self
4075 }
4076
4077 /// Sets the value of [auxiliary_node_groups][crate::model::ClusterConfig::auxiliary_node_groups].
4078 ///
4079 /// # Example
4080 /// ```ignore,no_run
4081 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4082 /// use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
4083 /// let x = ClusterConfig::new()
4084 /// .set_auxiliary_node_groups([
4085 /// AuxiliaryNodeGroup::default()/* use setters */,
4086 /// AuxiliaryNodeGroup::default()/* use (different) setters */,
4087 /// ]);
4088 /// ```
4089 pub fn set_auxiliary_node_groups<T, V>(mut self, v: T) -> Self
4090 where
4091 T: std::iter::IntoIterator<Item = V>,
4092 V: std::convert::Into<crate::model::AuxiliaryNodeGroup>,
4093 {
4094 use std::iter::Iterator;
4095 self.auxiliary_node_groups = v.into_iter().map(|i| i.into()).collect();
4096 self
4097 }
4098}
4099
4100impl wkt::message::Message for ClusterConfig {
4101 fn typename() -> &'static str {
4102 "type.googleapis.com/google.cloud.dataproc.v1.ClusterConfig"
4103 }
4104}
4105
4106/// Defines additional types related to [ClusterConfig].
4107pub mod cluster_config {
4108 #[allow(unused_imports)]
4109 use super::*;
4110
4111 /// The type of the cluster.
4112 ///
4113 /// # Working with unknown values
4114 ///
4115 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4116 /// additional enum variants at any time. Adding new variants is not considered
4117 /// a breaking change. Applications should write their code in anticipation of:
4118 ///
4119 /// - New values appearing in future releases of the client library, **and**
4120 /// - New values received dynamically, without application changes.
4121 ///
4122 /// Please consult the [Working with enums] section in the user guide for some
4123 /// guidelines.
4124 ///
4125 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4126 #[derive(Clone, Debug, PartialEq)]
4127 #[non_exhaustive]
4128 pub enum ClusterType {
4129 /// Not set.
4130 Unspecified,
4131 /// Standard dataproc cluster with a minimum of two primary workers.
4132 Standard,
4133 /// <https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/single-node-clusters>
4134 SingleNode,
4135 /// Clusters that can use only secondary workers and be scaled down to zero
4136 /// secondary worker nodes.
4137 ZeroScale,
4138 /// If set, the enum was initialized with an unknown value.
4139 ///
4140 /// Applications can examine the value using [ClusterType::value] or
4141 /// [ClusterType::name].
4142 UnknownValue(cluster_type::UnknownValue),
4143 }
4144
4145 #[doc(hidden)]
4146 pub mod cluster_type {
4147 #[allow(unused_imports)]
4148 use super::*;
4149 #[derive(Clone, Debug, PartialEq)]
4150 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4151 }
4152
4153 impl ClusterType {
4154 /// Gets the enum value.
4155 ///
4156 /// Returns `None` if the enum contains an unknown value deserialized from
4157 /// the string representation of enums.
4158 pub fn value(&self) -> std::option::Option<i32> {
4159 match self {
4160 Self::Unspecified => std::option::Option::Some(0),
4161 Self::Standard => std::option::Option::Some(1),
4162 Self::SingleNode => std::option::Option::Some(2),
4163 Self::ZeroScale => std::option::Option::Some(3),
4164 Self::UnknownValue(u) => u.0.value(),
4165 }
4166 }
4167
4168 /// Gets the enum value as a string.
4169 ///
4170 /// Returns `None` if the enum contains an unknown value deserialized from
4171 /// the integer representation of enums.
4172 pub fn name(&self) -> std::option::Option<&str> {
4173 match self {
4174 Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
4175 Self::Standard => std::option::Option::Some("STANDARD"),
4176 Self::SingleNode => std::option::Option::Some("SINGLE_NODE"),
4177 Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
4178 Self::UnknownValue(u) => u.0.name(),
4179 }
4180 }
4181 }
4182
4183 impl std::default::Default for ClusterType {
4184 fn default() -> Self {
4185 use std::convert::From;
4186 Self::from(0)
4187 }
4188 }
4189
4190 impl std::fmt::Display for ClusterType {
4191 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4192 wkt::internal::display_enum(f, self.name(), self.value())
4193 }
4194 }
4195
4196 impl std::convert::From<i32> for ClusterType {
4197 fn from(value: i32) -> Self {
4198 match value {
4199 0 => Self::Unspecified,
4200 1 => Self::Standard,
4201 2 => Self::SingleNode,
4202 3 => Self::ZeroScale,
4203 _ => Self::UnknownValue(cluster_type::UnknownValue(
4204 wkt::internal::UnknownEnumValue::Integer(value),
4205 )),
4206 }
4207 }
4208 }
4209
4210 impl std::convert::From<&str> for ClusterType {
4211 fn from(value: &str) -> Self {
4212 use std::string::ToString;
4213 match value {
4214 "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
4215 "STANDARD" => Self::Standard,
4216 "SINGLE_NODE" => Self::SingleNode,
4217 "ZERO_SCALE" => Self::ZeroScale,
4218 _ => Self::UnknownValue(cluster_type::UnknownValue(
4219 wkt::internal::UnknownEnumValue::String(value.to_string()),
4220 )),
4221 }
4222 }
4223 }
4224
4225 impl serde::ser::Serialize for ClusterType {
4226 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4227 where
4228 S: serde::Serializer,
4229 {
4230 match self {
4231 Self::Unspecified => serializer.serialize_i32(0),
4232 Self::Standard => serializer.serialize_i32(1),
4233 Self::SingleNode => serializer.serialize_i32(2),
4234 Self::ZeroScale => serializer.serialize_i32(3),
4235 Self::UnknownValue(u) => u.0.serialize(serializer),
4236 }
4237 }
4238 }
4239
4240 impl<'de> serde::de::Deserialize<'de> for ClusterType {
4241 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4242 where
4243 D: serde::Deserializer<'de>,
4244 {
4245 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
4246 ".google.cloud.dataproc.v1.ClusterConfig.ClusterType",
4247 ))
4248 }
4249 }
4250
4251 /// The cluster tier.
4252 ///
4253 /// # Working with unknown values
4254 ///
4255 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4256 /// additional enum variants at any time. Adding new variants is not considered
4257 /// a breaking change. Applications should write their code in anticipation of:
4258 ///
4259 /// - New values appearing in future releases of the client library, **and**
4260 /// - New values received dynamically, without application changes.
4261 ///
4262 /// Please consult the [Working with enums] section in the user guide for some
4263 /// guidelines.
4264 ///
4265 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4266 #[derive(Clone, Debug, PartialEq)]
4267 #[non_exhaustive]
4268 pub enum ClusterTier {
4269 /// Not set. Works the same as CLUSTER_TIER_STANDARD.
4270 Unspecified,
4271 /// Standard Dataproc cluster.
4272 Standard,
4273 /// Premium Dataproc cluster.
4274 Premium,
4275 /// If set, the enum was initialized with an unknown value.
4276 ///
4277 /// Applications can examine the value using [ClusterTier::value] or
4278 /// [ClusterTier::name].
4279 UnknownValue(cluster_tier::UnknownValue),
4280 }
4281
4282 #[doc(hidden)]
4283 pub mod cluster_tier {
4284 #[allow(unused_imports)]
4285 use super::*;
4286 #[derive(Clone, Debug, PartialEq)]
4287 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4288 }
4289
4290 impl ClusterTier {
4291 /// Gets the enum value.
4292 ///
4293 /// Returns `None` if the enum contains an unknown value deserialized from
4294 /// the string representation of enums.
4295 pub fn value(&self) -> std::option::Option<i32> {
4296 match self {
4297 Self::Unspecified => std::option::Option::Some(0),
4298 Self::Standard => std::option::Option::Some(1),
4299 Self::Premium => std::option::Option::Some(2),
4300 Self::UnknownValue(u) => u.0.value(),
4301 }
4302 }
4303
4304 /// Gets the enum value as a string.
4305 ///
4306 /// Returns `None` if the enum contains an unknown value deserialized from
4307 /// the integer representation of enums.
4308 pub fn name(&self) -> std::option::Option<&str> {
4309 match self {
4310 Self::Unspecified => std::option::Option::Some("CLUSTER_TIER_UNSPECIFIED"),
4311 Self::Standard => std::option::Option::Some("CLUSTER_TIER_STANDARD"),
4312 Self::Premium => std::option::Option::Some("CLUSTER_TIER_PREMIUM"),
4313 Self::UnknownValue(u) => u.0.name(),
4314 }
4315 }
4316 }
4317
4318 impl std::default::Default for ClusterTier {
4319 fn default() -> Self {
4320 use std::convert::From;
4321 Self::from(0)
4322 }
4323 }
4324
4325 impl std::fmt::Display for ClusterTier {
4326 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4327 wkt::internal::display_enum(f, self.name(), self.value())
4328 }
4329 }
4330
4331 impl std::convert::From<i32> for ClusterTier {
4332 fn from(value: i32) -> Self {
4333 match value {
4334 0 => Self::Unspecified,
4335 1 => Self::Standard,
4336 2 => Self::Premium,
4337 _ => Self::UnknownValue(cluster_tier::UnknownValue(
4338 wkt::internal::UnknownEnumValue::Integer(value),
4339 )),
4340 }
4341 }
4342 }
4343
4344 impl std::convert::From<&str> for ClusterTier {
4345 fn from(value: &str) -> Self {
4346 use std::string::ToString;
4347 match value {
4348 "CLUSTER_TIER_UNSPECIFIED" => Self::Unspecified,
4349 "CLUSTER_TIER_STANDARD" => Self::Standard,
4350 "CLUSTER_TIER_PREMIUM" => Self::Premium,
4351 _ => Self::UnknownValue(cluster_tier::UnknownValue(
4352 wkt::internal::UnknownEnumValue::String(value.to_string()),
4353 )),
4354 }
4355 }
4356 }
4357
4358 impl serde::ser::Serialize for ClusterTier {
4359 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4360 where
4361 S: serde::Serializer,
4362 {
4363 match self {
4364 Self::Unspecified => serializer.serialize_i32(0),
4365 Self::Standard => serializer.serialize_i32(1),
4366 Self::Premium => serializer.serialize_i32(2),
4367 Self::UnknownValue(u) => u.0.serialize(serializer),
4368 }
4369 }
4370 }
4371
4372 impl<'de> serde::de::Deserialize<'de> for ClusterTier {
4373 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4374 where
4375 D: serde::Deserializer<'de>,
4376 {
4377 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterTier>::new(
4378 ".google.cloud.dataproc.v1.ClusterConfig.ClusterTier",
4379 ))
4380 }
4381 }
4382
4383 /// The cluster engine.
4384 ///
4385 /// # Working with unknown values
4386 ///
4387 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4388 /// additional enum variants at any time. Adding new variants is not considered
4389 /// a breaking change. Applications should write their code in anticipation of:
4390 ///
4391 /// - New values appearing in future releases of the client library, **and**
4392 /// - New values received dynamically, without application changes.
4393 ///
4394 /// Please consult the [Working with enums] section in the user guide for some
4395 /// guidelines.
4396 ///
4397 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4398 #[derive(Clone, Debug, PartialEq)]
4399 #[non_exhaustive]
4400 pub enum Engine {
4401 /// The engine is not specified. Works the same as ENGINE_DEFAULT.
4402 Unspecified,
4403 /// The cluster is a default engine cluster.
4404 Default,
4405 /// The cluster is a lightning engine cluster.
4406 Lightning,
4407 /// If set, the enum was initialized with an unknown value.
4408 ///
4409 /// Applications can examine the value using [Engine::value] or
4410 /// [Engine::name].
4411 UnknownValue(engine::UnknownValue),
4412 }
4413
4414 #[doc(hidden)]
4415 pub mod engine {
4416 #[allow(unused_imports)]
4417 use super::*;
4418 #[derive(Clone, Debug, PartialEq)]
4419 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4420 }
4421
4422 impl Engine {
4423 /// Gets the enum value.
4424 ///
4425 /// Returns `None` if the enum contains an unknown value deserialized from
4426 /// the string representation of enums.
4427 pub fn value(&self) -> std::option::Option<i32> {
4428 match self {
4429 Self::Unspecified => std::option::Option::Some(0),
4430 Self::Default => std::option::Option::Some(1),
4431 Self::Lightning => std::option::Option::Some(2),
4432 Self::UnknownValue(u) => u.0.value(),
4433 }
4434 }
4435
4436 /// Gets the enum value as a string.
4437 ///
4438 /// Returns `None` if the enum contains an unknown value deserialized from
4439 /// the integer representation of enums.
4440 pub fn name(&self) -> std::option::Option<&str> {
4441 match self {
4442 Self::Unspecified => std::option::Option::Some("ENGINE_UNSPECIFIED"),
4443 Self::Default => std::option::Option::Some("DEFAULT"),
4444 Self::Lightning => std::option::Option::Some("LIGHTNING"),
4445 Self::UnknownValue(u) => u.0.name(),
4446 }
4447 }
4448 }
4449
4450 impl std::default::Default for Engine {
4451 fn default() -> Self {
4452 use std::convert::From;
4453 Self::from(0)
4454 }
4455 }
4456
4457 impl std::fmt::Display for Engine {
4458 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4459 wkt::internal::display_enum(f, self.name(), self.value())
4460 }
4461 }
4462
4463 impl std::convert::From<i32> for Engine {
4464 fn from(value: i32) -> Self {
4465 match value {
4466 0 => Self::Unspecified,
4467 1 => Self::Default,
4468 2 => Self::Lightning,
4469 _ => Self::UnknownValue(engine::UnknownValue(
4470 wkt::internal::UnknownEnumValue::Integer(value),
4471 )),
4472 }
4473 }
4474 }
4475
4476 impl std::convert::From<&str> for Engine {
4477 fn from(value: &str) -> Self {
4478 use std::string::ToString;
4479 match value {
4480 "ENGINE_UNSPECIFIED" => Self::Unspecified,
4481 "DEFAULT" => Self::Default,
4482 "LIGHTNING" => Self::Lightning,
4483 _ => Self::UnknownValue(engine::UnknownValue(
4484 wkt::internal::UnknownEnumValue::String(value.to_string()),
4485 )),
4486 }
4487 }
4488 }
4489
4490 impl serde::ser::Serialize for Engine {
4491 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4492 where
4493 S: serde::Serializer,
4494 {
4495 match self {
4496 Self::Unspecified => serializer.serialize_i32(0),
4497 Self::Default => serializer.serialize_i32(1),
4498 Self::Lightning => serializer.serialize_i32(2),
4499 Self::UnknownValue(u) => u.0.serialize(serializer),
4500 }
4501 }
4502 }
4503
4504 impl<'de> serde::de::Deserialize<'de> for Engine {
4505 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4506 where
4507 D: serde::Deserializer<'de>,
4508 {
4509 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Engine>::new(
4510 ".google.cloud.dataproc.v1.ClusterConfig.Engine",
4511 ))
4512 }
4513 }
4514}
4515
4516/// The Dataproc cluster config for a cluster that does not directly control the
4517/// underlying compute resources, such as a [Dataproc-on-GKE
4518/// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
4519#[derive(Clone, Default, PartialEq)]
4520#[non_exhaustive]
4521pub struct VirtualClusterConfig {
4522 /// Optional. A Cloud Storage bucket used to stage job
4523 /// dependencies, config files, and job driver console output.
4524 /// If you do not specify a staging bucket, Cloud
4525 /// Dataproc will determine a Cloud Storage location (US,
4526 /// ASIA, or EU) for your cluster's staging bucket according to the
4527 /// Compute Engine zone where your cluster is deployed, and then create
4528 /// and manage this project-level, per-location bucket (see
4529 /// [Dataproc staging and temp
4530 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
4531 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
4532 /// a Cloud Storage bucket.**
4533 pub staging_bucket: std::string::String,
4534
4535 /// Optional. Configuration of auxiliary services used by this cluster.
4536 pub auxiliary_services_config: std::option::Option<crate::model::AuxiliaryServicesConfig>,
4537
4538 #[allow(missing_docs)]
4539 pub infrastructure_config:
4540 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4541
4542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4543}
4544
4545impl VirtualClusterConfig {
4546 /// Creates a new default instance.
4547 pub fn new() -> Self {
4548 std::default::Default::default()
4549 }
4550
4551 /// Sets the value of [staging_bucket][crate::model::VirtualClusterConfig::staging_bucket].
4552 ///
4553 /// # Example
4554 /// ```ignore,no_run
4555 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4556 /// let x = VirtualClusterConfig::new().set_staging_bucket("example");
4557 /// ```
4558 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4559 self.staging_bucket = v.into();
4560 self
4561 }
4562
4563 /// Sets the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4564 ///
4565 /// # Example
4566 /// ```ignore,no_run
4567 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4568 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4569 /// let x = VirtualClusterConfig::new().set_auxiliary_services_config(AuxiliaryServicesConfig::default()/* use setters */);
4570 /// ```
4571 pub fn set_auxiliary_services_config<T>(mut self, v: T) -> Self
4572 where
4573 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4574 {
4575 self.auxiliary_services_config = std::option::Option::Some(v.into());
4576 self
4577 }
4578
4579 /// Sets or clears the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4580 ///
4581 /// # Example
4582 /// ```ignore,no_run
4583 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4584 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4585 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(Some(AuxiliaryServicesConfig::default()/* use setters */));
4586 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(None::<AuxiliaryServicesConfig>);
4587 /// ```
4588 pub fn set_or_clear_auxiliary_services_config<T>(mut self, v: std::option::Option<T>) -> Self
4589 where
4590 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4591 {
4592 self.auxiliary_services_config = v.map(|x| x.into());
4593 self
4594 }
4595
4596 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config].
4597 ///
4598 /// Note that all the setters affecting `infrastructure_config` are mutually
4599 /// exclusive.
4600 ///
4601 /// # Example
4602 /// ```ignore,no_run
4603 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4604 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4605 /// let x = VirtualClusterConfig::new().set_infrastructure_config(Some(
4606 /// google_cloud_dataproc_v1::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(KubernetesClusterConfig::default().into())));
4607 /// ```
4608 pub fn set_infrastructure_config<
4609 T: std::convert::Into<
4610 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4611 >,
4612 >(
4613 mut self,
4614 v: T,
4615 ) -> Self {
4616 self.infrastructure_config = v.into();
4617 self
4618 }
4619
4620 /// The value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4621 /// if it holds a `KubernetesClusterConfig`, `None` if the field is not set or
4622 /// holds a different branch.
4623 pub fn kubernetes_cluster_config(
4624 &self,
4625 ) -> std::option::Option<&std::boxed::Box<crate::model::KubernetesClusterConfig>> {
4626 #[allow(unreachable_patterns)]
4627 self.infrastructure_config.as_ref().and_then(|v| match v {
4628 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4629 v,
4630 ) => std::option::Option::Some(v),
4631 _ => std::option::Option::None,
4632 })
4633 }
4634
4635 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4636 /// to hold a `KubernetesClusterConfig`.
4637 ///
4638 /// Note that all the setters affecting `infrastructure_config` are
4639 /// mutually exclusive.
4640 ///
4641 /// # Example
4642 /// ```ignore,no_run
4643 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4644 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4645 /// let x = VirtualClusterConfig::new().set_kubernetes_cluster_config(KubernetesClusterConfig::default()/* use setters */);
4646 /// assert!(x.kubernetes_cluster_config().is_some());
4647 /// ```
4648 pub fn set_kubernetes_cluster_config<
4649 T: std::convert::Into<std::boxed::Box<crate::model::KubernetesClusterConfig>>,
4650 >(
4651 mut self,
4652 v: T,
4653 ) -> Self {
4654 self.infrastructure_config = std::option::Option::Some(
4655 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4656 v.into(),
4657 ),
4658 );
4659 self
4660 }
4661}
4662
4663impl wkt::message::Message for VirtualClusterConfig {
4664 fn typename() -> &'static str {
4665 "type.googleapis.com/google.cloud.dataproc.v1.VirtualClusterConfig"
4666 }
4667}
4668
4669/// Defines additional types related to [VirtualClusterConfig].
4670pub mod virtual_cluster_config {
4671 #[allow(unused_imports)]
4672 use super::*;
4673
4674 #[allow(missing_docs)]
4675 #[derive(Clone, Debug, PartialEq)]
4676 #[non_exhaustive]
4677 pub enum InfrastructureConfig {
4678 /// Required. The configuration for running the Dataproc cluster on
4679 /// Kubernetes.
4680 KubernetesClusterConfig(std::boxed::Box<crate::model::KubernetesClusterConfig>),
4681 }
4682}
4683
4684/// Auxiliary services configuration for a Cluster.
4685#[derive(Clone, Default, PartialEq)]
4686#[non_exhaustive]
4687pub struct AuxiliaryServicesConfig {
4688 /// Optional. The Hive Metastore configuration for this workload.
4689 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
4690
4691 /// Optional. The Spark History Server configuration for the workload.
4692 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
4693
4694 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4695}
4696
4697impl AuxiliaryServicesConfig {
4698 /// Creates a new default instance.
4699 pub fn new() -> Self {
4700 std::default::Default::default()
4701 }
4702
4703 /// Sets the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4704 ///
4705 /// # Example
4706 /// ```ignore,no_run
4707 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4708 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4709 /// let x = AuxiliaryServicesConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
4710 /// ```
4711 pub fn set_metastore_config<T>(mut self, v: T) -> Self
4712 where
4713 T: std::convert::Into<crate::model::MetastoreConfig>,
4714 {
4715 self.metastore_config = std::option::Option::Some(v.into());
4716 self
4717 }
4718
4719 /// Sets or clears the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4720 ///
4721 /// # Example
4722 /// ```ignore,no_run
4723 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4724 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4725 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4726 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4727 /// ```
4728 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4729 where
4730 T: std::convert::Into<crate::model::MetastoreConfig>,
4731 {
4732 self.metastore_config = v.map(|x| x.into());
4733 self
4734 }
4735
4736 /// Sets the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4737 ///
4738 /// # Example
4739 /// ```ignore,no_run
4740 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4741 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4742 /// let x = AuxiliaryServicesConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
4743 /// ```
4744 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
4745 where
4746 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4747 {
4748 self.spark_history_server_config = std::option::Option::Some(v.into());
4749 self
4750 }
4751
4752 /// Sets or clears the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4753 ///
4754 /// # Example
4755 /// ```ignore,no_run
4756 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4757 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4758 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
4759 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
4760 /// ```
4761 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
4762 where
4763 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4764 {
4765 self.spark_history_server_config = v.map(|x| x.into());
4766 self
4767 }
4768}
4769
4770impl wkt::message::Message for AuxiliaryServicesConfig {
4771 fn typename() -> &'static str {
4772 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryServicesConfig"
4773 }
4774}
4775
4776/// Endpoint config for this cluster
4777#[derive(Clone, Default, PartialEq)]
4778#[non_exhaustive]
4779pub struct EndpointConfig {
4780 /// Output only. The map of port descriptions to URLs. Will only be populated
4781 /// if enable_http_port_access is true.
4782 pub http_ports: std::collections::HashMap<std::string::String, std::string::String>,
4783
4784 /// Optional. If true, enable http access to specific ports on the cluster
4785 /// from external sources. Defaults to false.
4786 pub enable_http_port_access: bool,
4787
4788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4789}
4790
4791impl EndpointConfig {
4792 /// Creates a new default instance.
4793 pub fn new() -> Self {
4794 std::default::Default::default()
4795 }
4796
4797 /// Sets the value of [http_ports][crate::model::EndpointConfig::http_ports].
4798 ///
4799 /// # Example
4800 /// ```ignore,no_run
4801 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4802 /// let x = EndpointConfig::new().set_http_ports([
4803 /// ("key0", "abc"),
4804 /// ("key1", "xyz"),
4805 /// ]);
4806 /// ```
4807 pub fn set_http_ports<T, K, V>(mut self, v: T) -> Self
4808 where
4809 T: std::iter::IntoIterator<Item = (K, V)>,
4810 K: std::convert::Into<std::string::String>,
4811 V: std::convert::Into<std::string::String>,
4812 {
4813 use std::iter::Iterator;
4814 self.http_ports = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4815 self
4816 }
4817
4818 /// Sets the value of [enable_http_port_access][crate::model::EndpointConfig::enable_http_port_access].
4819 ///
4820 /// # Example
4821 /// ```ignore,no_run
4822 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4823 /// let x = EndpointConfig::new().set_enable_http_port_access(true);
4824 /// ```
4825 pub fn set_enable_http_port_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4826 self.enable_http_port_access = v.into();
4827 self
4828 }
4829}
4830
4831impl wkt::message::Message for EndpointConfig {
4832 fn typename() -> &'static str {
4833 "type.googleapis.com/google.cloud.dataproc.v1.EndpointConfig"
4834 }
4835}
4836
4837/// Autoscaling Policy config associated with the cluster.
4838#[derive(Clone, Default, PartialEq)]
4839#[non_exhaustive]
4840pub struct AutoscalingConfig {
4841 /// Optional. The autoscaling policy used by the cluster.
4842 ///
4843 /// Only resource names including projectid and location (region) are valid.
4844 /// Examples:
4845 ///
4846 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4847 /// * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4848 ///
4849 /// Note that the policy must be in the same project and Dataproc region.
4850 pub policy_uri: std::string::String,
4851
4852 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4853}
4854
4855impl AutoscalingConfig {
4856 /// Creates a new default instance.
4857 pub fn new() -> Self {
4858 std::default::Default::default()
4859 }
4860
4861 /// Sets the value of [policy_uri][crate::model::AutoscalingConfig::policy_uri].
4862 ///
4863 /// # Example
4864 /// ```ignore,no_run
4865 /// # use google_cloud_dataproc_v1::model::AutoscalingConfig;
4866 /// let x = AutoscalingConfig::new().set_policy_uri("example");
4867 /// ```
4868 pub fn set_policy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4869 self.policy_uri = v.into();
4870 self
4871 }
4872}
4873
4874impl wkt::message::Message for AutoscalingConfig {
4875 fn typename() -> &'static str {
4876 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingConfig"
4877 }
4878}
4879
4880/// Encryption settings for the cluster.
4881#[derive(Clone, Default, PartialEq)]
4882#[non_exhaustive]
4883pub struct EncryptionConfig {
4884 /// Optional. The Cloud KMS key resource name to use for persistent disk
4885 /// encryption for all instances in the cluster. See [Use CMEK with cluster
4886 /// data]
4887 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4888 /// for more information.
4889 pub gce_pd_kms_key_name: std::string::String,
4890
4891 /// Optional. The Cloud KMS key resource name to use for cluster persistent
4892 /// disk and job argument encryption. See [Use CMEK with cluster data]
4893 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4894 /// for more information.
4895 ///
4896 /// When this key resource name is provided, the following job arguments of
4897 /// the following job types submitted to the cluster are encrypted using CMEK:
4898 ///
4899 /// * [FlinkJob
4900 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
4901 /// * [HadoopJob
4902 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
4903 /// * [SparkJob
4904 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
4905 /// * [SparkRJob
4906 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
4907 /// * [PySparkJob
4908 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
4909 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
4910 /// scriptVariables and queryList.queries
4911 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
4912 /// scriptVariables and queryList.queries
4913 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
4914 /// scriptVariables and queryList.queries
4915 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
4916 /// scriptVariables and queryList.queries
4917 pub kms_key: std::string::String,
4918
4919 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4920}
4921
4922impl EncryptionConfig {
4923 /// Creates a new default instance.
4924 pub fn new() -> Self {
4925 std::default::Default::default()
4926 }
4927
4928 /// Sets the value of [gce_pd_kms_key_name][crate::model::EncryptionConfig::gce_pd_kms_key_name].
4929 ///
4930 /// # Example
4931 /// ```ignore,no_run
4932 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4933 /// let x = EncryptionConfig::new().set_gce_pd_kms_key_name("example");
4934 /// ```
4935 pub fn set_gce_pd_kms_key_name<T: std::convert::Into<std::string::String>>(
4936 mut self,
4937 v: T,
4938 ) -> Self {
4939 self.gce_pd_kms_key_name = v.into();
4940 self
4941 }
4942
4943 /// Sets the value of [kms_key][crate::model::EncryptionConfig::kms_key].
4944 ///
4945 /// # Example
4946 /// ```ignore,no_run
4947 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4948 /// let x = EncryptionConfig::new().set_kms_key("example");
4949 /// ```
4950 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4951 self.kms_key = v.into();
4952 self
4953 }
4954}
4955
4956impl wkt::message::Message for EncryptionConfig {
4957 fn typename() -> &'static str {
4958 "type.googleapis.com/google.cloud.dataproc.v1.EncryptionConfig"
4959 }
4960}
4961
4962/// Common config settings for resources of Compute Engine cluster
4963/// instances, applicable to all instances in the cluster.
4964#[derive(Clone, Default, PartialEq)]
4965#[non_exhaustive]
4966pub struct GceClusterConfig {
4967 /// Optional. The Compute Engine zone where the Dataproc cluster will be
4968 /// located. If omitted, the service will pick a zone in the cluster's Compute
4969 /// Engine region. On a get request, zone will always be present.
4970 ///
4971 /// A full URL, partial URI, or short name are valid. Examples:
4972 ///
4973 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]`
4974 /// * `projects/[project_id]/zones/[zone]`
4975 /// * `[zone]`
4976 pub zone_uri: std::string::String,
4977
4978 /// Optional. The Compute Engine network to be used for machine
4979 /// communications. Cannot be specified with subnetwork_uri. If neither
4980 /// `network_uri` nor `subnetwork_uri` is specified, the "default" network of
4981 /// the project is used, if it exists. Cannot be a "Custom Subnet Network" (see
4982 /// [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for
4983 /// more information).
4984 ///
4985 /// A full URL, partial URI, or short name are valid. Examples:
4986 ///
4987 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/networks/default`
4988 /// * `projects/[project_id]/global/networks/default`
4989 /// * `default`
4990 pub network_uri: std::string::String,
4991
4992 /// Optional. The Compute Engine subnetwork to be used for machine
4993 /// communications. Cannot be specified with network_uri.
4994 ///
4995 /// A full URL, partial URI, or short name are valid. Examples:
4996 ///
4997 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/regions/[region]/subnetworks/sub0`
4998 /// * `projects/[project_id]/regions/[region]/subnetworks/sub0`
4999 /// * `sub0`
5000 pub subnetwork_uri: std::string::String,
5001
5002 /// Optional. This setting applies to subnetwork-enabled networks. It is set to
5003 /// `true` by default in clusters created with image versions 2.2.x.
5004 ///
5005 /// When set to `true`:
5006 ///
5007 /// * All cluster VMs have internal IP addresses.
5008 /// * [Google Private Access]
5009 /// (<https://cloud.google.com/vpc/docs/private-google-access>)
5010 /// must be enabled to access Dataproc and other Google Cloud APIs.
5011 /// * Off-cluster dependencies must be configured to be accessible
5012 /// without external IP addresses.
5013 ///
5014 /// When set to `false`:
5015 ///
5016 /// * Cluster VMs are not restricted to internal IP addresses.
5017 /// * Ephemeral external IP addresses are assigned to each cluster VM.
5018 pub internal_ip_only: std::option::Option<bool>,
5019
5020 /// Optional. The type of IPv6 access for a cluster.
5021 pub private_ipv6_google_access: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess,
5022
5023 /// Optional. The [Dataproc service
5024 /// account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc)
5025 /// (also see [VM Data Plane
5026 /// identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity))
5027 /// used by Dataproc cluster VM instances to access Google Cloud Platform
5028 /// services.
5029 ///
5030 /// If not specified, the
5031 /// [Compute Engine default service
5032 /// account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
5033 /// is used.
5034 pub service_account: std::string::String,
5035
5036 /// Optional. The URIs of service account scopes to be included in
5037 /// Compute Engine instances. The following base set of scopes is always
5038 /// included:
5039 ///
5040 /// * <https://www.googleapis.com/auth/cloud.useraccounts.readonly>
5041 /// * <https://www.googleapis.com/auth/devstorage.read_write>
5042 /// * <https://www.googleapis.com/auth/logging.write>
5043 ///
5044 /// If no scopes are specified, the following defaults are also provided:
5045 ///
5046 /// * <https://www.googleapis.com/auth/bigquery>
5047 /// * <https://www.googleapis.com/auth/bigtable.admin.table>
5048 /// * <https://www.googleapis.com/auth/bigtable.data>
5049 /// * <https://www.googleapis.com/auth/devstorage.full_control>
5050 pub service_account_scopes: std::vec::Vec<std::string::String>,
5051
5052 /// The Compute Engine network tags to add to all instances (see [Tagging
5053 /// instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
5054 pub tags: std::vec::Vec<std::string::String>,
5055
5056 /// Optional. The Compute Engine metadata entries to add to all instances (see
5057 /// [Project and instance
5058 /// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
5059 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
5060
5061 /// Optional. Reservation Affinity for consuming Zonal reservation.
5062 pub reservation_affinity: std::option::Option<crate::model::ReservationAffinity>,
5063
5064 /// Optional. Node Group Affinity for sole-tenant clusters.
5065 pub node_group_affinity: std::option::Option<crate::model::NodeGroupAffinity>,
5066
5067 /// Optional. Shielded Instance Config for clusters using [Compute Engine
5068 /// Shielded
5069 /// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
5070 pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
5071
5072 /// Optional. Confidential Instance Config for clusters using [Confidential
5073 /// VMs](https://cloud.google.com/confidential-computing/confidential-vm/docs).
5074 pub confidential_instance_config: std::option::Option<crate::model::ConfidentialInstanceConfig>,
5075
5076 /// Optional. [Resource manager tags]
5077 /// (<https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing>)
5078 /// to add to all instances (see [Use secure tags]
5079 /// (<https://cloud.google.com/dataproc/docs/guides/use-secure-tags>)).
5080 pub resource_manager_tags: std::collections::HashMap<std::string::String, std::string::String>,
5081
5082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5083}
5084
5085impl GceClusterConfig {
5086 /// Creates a new default instance.
5087 pub fn new() -> Self {
5088 std::default::Default::default()
5089 }
5090
5091 /// Sets the value of [zone_uri][crate::model::GceClusterConfig::zone_uri].
5092 ///
5093 /// # Example
5094 /// ```ignore,no_run
5095 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5096 /// let x = GceClusterConfig::new().set_zone_uri("example");
5097 /// ```
5098 pub fn set_zone_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5099 self.zone_uri = v.into();
5100 self
5101 }
5102
5103 /// Sets the value of [network_uri][crate::model::GceClusterConfig::network_uri].
5104 ///
5105 /// # Example
5106 /// ```ignore,no_run
5107 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5108 /// let x = GceClusterConfig::new().set_network_uri("example");
5109 /// ```
5110 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5111 self.network_uri = v.into();
5112 self
5113 }
5114
5115 /// Sets the value of [subnetwork_uri][crate::model::GceClusterConfig::subnetwork_uri].
5116 ///
5117 /// # Example
5118 /// ```ignore,no_run
5119 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5120 /// let x = GceClusterConfig::new().set_subnetwork_uri("example");
5121 /// ```
5122 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5123 self.subnetwork_uri = v.into();
5124 self
5125 }
5126
5127 /// Sets the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
5128 ///
5129 /// # Example
5130 /// ```ignore,no_run
5131 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5132 /// let x = GceClusterConfig::new().set_internal_ip_only(true);
5133 /// ```
5134 pub fn set_internal_ip_only<T>(mut self, v: T) -> Self
5135 where
5136 T: std::convert::Into<bool>,
5137 {
5138 self.internal_ip_only = std::option::Option::Some(v.into());
5139 self
5140 }
5141
5142 /// Sets or clears the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
5143 ///
5144 /// # Example
5145 /// ```ignore,no_run
5146 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5147 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(Some(false));
5148 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(None::<bool>);
5149 /// ```
5150 pub fn set_or_clear_internal_ip_only<T>(mut self, v: std::option::Option<T>) -> Self
5151 where
5152 T: std::convert::Into<bool>,
5153 {
5154 self.internal_ip_only = v.map(|x| x.into());
5155 self
5156 }
5157
5158 /// Sets the value of [private_ipv6_google_access][crate::model::GceClusterConfig::private_ipv6_google_access].
5159 ///
5160 /// # Example
5161 /// ```ignore,no_run
5162 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5163 /// use google_cloud_dataproc_v1::model::gce_cluster_config::PrivateIpv6GoogleAccess;
5164 /// let x0 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::InheritFromSubnetwork);
5165 /// let x1 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Outbound);
5166 /// let x2 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Bidirectional);
5167 /// ```
5168 pub fn set_private_ipv6_google_access<
5169 T: std::convert::Into<crate::model::gce_cluster_config::PrivateIpv6GoogleAccess>,
5170 >(
5171 mut self,
5172 v: T,
5173 ) -> Self {
5174 self.private_ipv6_google_access = v.into();
5175 self
5176 }
5177
5178 /// Sets the value of [service_account][crate::model::GceClusterConfig::service_account].
5179 ///
5180 /// # Example
5181 /// ```ignore,no_run
5182 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5183 /// let x = GceClusterConfig::new().set_service_account("example");
5184 /// ```
5185 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5186 self.service_account = v.into();
5187 self
5188 }
5189
5190 /// Sets the value of [service_account_scopes][crate::model::GceClusterConfig::service_account_scopes].
5191 ///
5192 /// # Example
5193 /// ```ignore,no_run
5194 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5195 /// let x = GceClusterConfig::new().set_service_account_scopes(["a", "b", "c"]);
5196 /// ```
5197 pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
5198 where
5199 T: std::iter::IntoIterator<Item = V>,
5200 V: std::convert::Into<std::string::String>,
5201 {
5202 use std::iter::Iterator;
5203 self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
5204 self
5205 }
5206
5207 /// Sets the value of [tags][crate::model::GceClusterConfig::tags].
5208 ///
5209 /// # Example
5210 /// ```ignore,no_run
5211 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5212 /// let x = GceClusterConfig::new().set_tags(["a", "b", "c"]);
5213 /// ```
5214 pub fn set_tags<T, V>(mut self, v: T) -> Self
5215 where
5216 T: std::iter::IntoIterator<Item = V>,
5217 V: std::convert::Into<std::string::String>,
5218 {
5219 use std::iter::Iterator;
5220 self.tags = v.into_iter().map(|i| i.into()).collect();
5221 self
5222 }
5223
5224 /// Sets the value of [metadata][crate::model::GceClusterConfig::metadata].
5225 ///
5226 /// # Example
5227 /// ```ignore,no_run
5228 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5229 /// let x = GceClusterConfig::new().set_metadata([
5230 /// ("key0", "abc"),
5231 /// ("key1", "xyz"),
5232 /// ]);
5233 /// ```
5234 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
5235 where
5236 T: std::iter::IntoIterator<Item = (K, V)>,
5237 K: std::convert::Into<std::string::String>,
5238 V: std::convert::Into<std::string::String>,
5239 {
5240 use std::iter::Iterator;
5241 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5242 self
5243 }
5244
5245 /// Sets the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
5246 ///
5247 /// # Example
5248 /// ```ignore,no_run
5249 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5250 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
5251 /// let x = GceClusterConfig::new().set_reservation_affinity(ReservationAffinity::default()/* use setters */);
5252 /// ```
5253 pub fn set_reservation_affinity<T>(mut self, v: T) -> Self
5254 where
5255 T: std::convert::Into<crate::model::ReservationAffinity>,
5256 {
5257 self.reservation_affinity = std::option::Option::Some(v.into());
5258 self
5259 }
5260
5261 /// Sets or clears the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
5262 ///
5263 /// # Example
5264 /// ```ignore,no_run
5265 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5266 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
5267 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(Some(ReservationAffinity::default()/* use setters */));
5268 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(None::<ReservationAffinity>);
5269 /// ```
5270 pub fn set_or_clear_reservation_affinity<T>(mut self, v: std::option::Option<T>) -> Self
5271 where
5272 T: std::convert::Into<crate::model::ReservationAffinity>,
5273 {
5274 self.reservation_affinity = v.map(|x| x.into());
5275 self
5276 }
5277
5278 /// Sets the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
5279 ///
5280 /// # Example
5281 /// ```ignore,no_run
5282 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5283 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5284 /// let x = GceClusterConfig::new().set_node_group_affinity(NodeGroupAffinity::default()/* use setters */);
5285 /// ```
5286 pub fn set_node_group_affinity<T>(mut self, v: T) -> Self
5287 where
5288 T: std::convert::Into<crate::model::NodeGroupAffinity>,
5289 {
5290 self.node_group_affinity = std::option::Option::Some(v.into());
5291 self
5292 }
5293
5294 /// Sets or clears the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
5295 ///
5296 /// # Example
5297 /// ```ignore,no_run
5298 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5299 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5300 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(Some(NodeGroupAffinity::default()/* use setters */));
5301 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(None::<NodeGroupAffinity>);
5302 /// ```
5303 pub fn set_or_clear_node_group_affinity<T>(mut self, v: std::option::Option<T>) -> Self
5304 where
5305 T: std::convert::Into<crate::model::NodeGroupAffinity>,
5306 {
5307 self.node_group_affinity = v.map(|x| x.into());
5308 self
5309 }
5310
5311 /// Sets the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
5312 ///
5313 /// # Example
5314 /// ```ignore,no_run
5315 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5316 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5317 /// let x = GceClusterConfig::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
5318 /// ```
5319 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
5320 where
5321 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
5322 {
5323 self.shielded_instance_config = std::option::Option::Some(v.into());
5324 self
5325 }
5326
5327 /// Sets or clears the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
5328 ///
5329 /// # Example
5330 /// ```ignore,no_run
5331 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5332 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5333 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
5334 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
5335 /// ```
5336 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5337 where
5338 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
5339 {
5340 self.shielded_instance_config = v.map(|x| x.into());
5341 self
5342 }
5343
5344 /// Sets the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
5345 ///
5346 /// # Example
5347 /// ```ignore,no_run
5348 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5349 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5350 /// let x = GceClusterConfig::new().set_confidential_instance_config(ConfidentialInstanceConfig::default()/* use setters */);
5351 /// ```
5352 pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
5353 where
5354 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
5355 {
5356 self.confidential_instance_config = std::option::Option::Some(v.into());
5357 self
5358 }
5359
5360 /// Sets or clears the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
5361 ///
5362 /// # Example
5363 /// ```ignore,no_run
5364 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5365 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5366 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(Some(ConfidentialInstanceConfig::default()/* use setters */));
5367 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(None::<ConfidentialInstanceConfig>);
5368 /// ```
5369 pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5370 where
5371 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
5372 {
5373 self.confidential_instance_config = v.map(|x| x.into());
5374 self
5375 }
5376
5377 /// Sets the value of [resource_manager_tags][crate::model::GceClusterConfig::resource_manager_tags].
5378 ///
5379 /// # Example
5380 /// ```ignore,no_run
5381 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5382 /// let x = GceClusterConfig::new().set_resource_manager_tags([
5383 /// ("key0", "abc"),
5384 /// ("key1", "xyz"),
5385 /// ]);
5386 /// ```
5387 pub fn set_resource_manager_tags<T, K, V>(mut self, v: T) -> Self
5388 where
5389 T: std::iter::IntoIterator<Item = (K, V)>,
5390 K: std::convert::Into<std::string::String>,
5391 V: std::convert::Into<std::string::String>,
5392 {
5393 use std::iter::Iterator;
5394 self.resource_manager_tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5395 self
5396 }
5397}
5398
5399impl wkt::message::Message for GceClusterConfig {
5400 fn typename() -> &'static str {
5401 "type.googleapis.com/google.cloud.dataproc.v1.GceClusterConfig"
5402 }
5403}
5404
5405/// Defines additional types related to [GceClusterConfig].
5406pub mod gce_cluster_config {
5407 #[allow(unused_imports)]
5408 use super::*;
5409
5410 /// `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes
5411 /// can communicate with Google Services through gRPC over IPv6.
5412 /// These values are directly mapped to corresponding values in the
5413 /// [Compute Engine Instance
5414 /// fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
5415 ///
5416 /// # Working with unknown values
5417 ///
5418 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5419 /// additional enum variants at any time. Adding new variants is not considered
5420 /// a breaking change. Applications should write their code in anticipation of:
5421 ///
5422 /// - New values appearing in future releases of the client library, **and**
5423 /// - New values received dynamically, without application changes.
5424 ///
5425 /// Please consult the [Working with enums] section in the user guide for some
5426 /// guidelines.
5427 ///
5428 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5429 #[derive(Clone, Debug, PartialEq)]
5430 #[non_exhaustive]
5431 pub enum PrivateIpv6GoogleAccess {
5432 /// If unspecified, Compute Engine default behavior will apply, which
5433 /// is the same as
5434 /// [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK].
5435 ///
5436 /// [google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess::InheritFromSubnetwork
5437 Unspecified,
5438 /// Private access to and from Google Services configuration
5439 /// inherited from the subnetwork configuration. This is the
5440 /// default Compute Engine behavior.
5441 InheritFromSubnetwork,
5442 /// Enables outbound private IPv6 access to Google Services from the Dataproc
5443 /// cluster.
5444 Outbound,
5445 /// Enables bidirectional private IPv6 access between Google Services and the
5446 /// Dataproc cluster.
5447 Bidirectional,
5448 /// If set, the enum was initialized with an unknown value.
5449 ///
5450 /// Applications can examine the value using [PrivateIpv6GoogleAccess::value] or
5451 /// [PrivateIpv6GoogleAccess::name].
5452 UnknownValue(private_ipv_6_google_access::UnknownValue),
5453 }
5454
5455 #[doc(hidden)]
5456 pub mod private_ipv_6_google_access {
5457 #[allow(unused_imports)]
5458 use super::*;
5459 #[derive(Clone, Debug, PartialEq)]
5460 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5461 }
5462
5463 impl PrivateIpv6GoogleAccess {
5464 /// Gets the enum value.
5465 ///
5466 /// Returns `None` if the enum contains an unknown value deserialized from
5467 /// the string representation of enums.
5468 pub fn value(&self) -> std::option::Option<i32> {
5469 match self {
5470 Self::Unspecified => std::option::Option::Some(0),
5471 Self::InheritFromSubnetwork => std::option::Option::Some(1),
5472 Self::Outbound => std::option::Option::Some(2),
5473 Self::Bidirectional => std::option::Option::Some(3),
5474 Self::UnknownValue(u) => u.0.value(),
5475 }
5476 }
5477
5478 /// Gets the enum value as a string.
5479 ///
5480 /// Returns `None` if the enum contains an unknown value deserialized from
5481 /// the integer representation of enums.
5482 pub fn name(&self) -> std::option::Option<&str> {
5483 match self {
5484 Self::Unspecified => {
5485 std::option::Option::Some("PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED")
5486 }
5487 Self::InheritFromSubnetwork => std::option::Option::Some("INHERIT_FROM_SUBNETWORK"),
5488 Self::Outbound => std::option::Option::Some("OUTBOUND"),
5489 Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
5490 Self::UnknownValue(u) => u.0.name(),
5491 }
5492 }
5493 }
5494
5495 impl std::default::Default for PrivateIpv6GoogleAccess {
5496 fn default() -> Self {
5497 use std::convert::From;
5498 Self::from(0)
5499 }
5500 }
5501
5502 impl std::fmt::Display for PrivateIpv6GoogleAccess {
5503 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5504 wkt::internal::display_enum(f, self.name(), self.value())
5505 }
5506 }
5507
5508 impl std::convert::From<i32> for PrivateIpv6GoogleAccess {
5509 fn from(value: i32) -> Self {
5510 match value {
5511 0 => Self::Unspecified,
5512 1 => Self::InheritFromSubnetwork,
5513 2 => Self::Outbound,
5514 3 => Self::Bidirectional,
5515 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5516 wkt::internal::UnknownEnumValue::Integer(value),
5517 )),
5518 }
5519 }
5520 }
5521
5522 impl std::convert::From<&str> for PrivateIpv6GoogleAccess {
5523 fn from(value: &str) -> Self {
5524 use std::string::ToString;
5525 match value {
5526 "PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED" => Self::Unspecified,
5527 "INHERIT_FROM_SUBNETWORK" => Self::InheritFromSubnetwork,
5528 "OUTBOUND" => Self::Outbound,
5529 "BIDIRECTIONAL" => Self::Bidirectional,
5530 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5531 wkt::internal::UnknownEnumValue::String(value.to_string()),
5532 )),
5533 }
5534 }
5535 }
5536
5537 impl serde::ser::Serialize for PrivateIpv6GoogleAccess {
5538 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5539 where
5540 S: serde::Serializer,
5541 {
5542 match self {
5543 Self::Unspecified => serializer.serialize_i32(0),
5544 Self::InheritFromSubnetwork => serializer.serialize_i32(1),
5545 Self::Outbound => serializer.serialize_i32(2),
5546 Self::Bidirectional => serializer.serialize_i32(3),
5547 Self::UnknownValue(u) => u.0.serialize(serializer),
5548 }
5549 }
5550 }
5551
5552 impl<'de> serde::de::Deserialize<'de> for PrivateIpv6GoogleAccess {
5553 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5554 where
5555 D: serde::Deserializer<'de>,
5556 {
5557 deserializer.deserialize_any(
5558 wkt::internal::EnumVisitor::<PrivateIpv6GoogleAccess>::new(
5559 ".google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess",
5560 ),
5561 )
5562 }
5563 }
5564}
5565
5566/// Node Group Affinity for clusters using sole-tenant node groups.
5567/// **The Dataproc `NodeGroupAffinity` resource is not related to the
5568/// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.**
5569///
5570/// [google.cloud.dataproc.v1.NodeGroup]: crate::model::NodeGroup
5571#[derive(Clone, Default, PartialEq)]
5572#[non_exhaustive]
5573pub struct NodeGroupAffinity {
5574 /// Required. The URI of a
5575 /// sole-tenant [node group
5576 /// resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups)
5577 /// that the cluster will be created on.
5578 ///
5579 /// A full URL, partial URI, or node group name are valid. Examples:
5580 ///
5581 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/nodeGroups/node-group-1`
5582 /// * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1`
5583 /// * `node-group-1`
5584 pub node_group_uri: std::string::String,
5585
5586 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5587}
5588
5589impl NodeGroupAffinity {
5590 /// Creates a new default instance.
5591 pub fn new() -> Self {
5592 std::default::Default::default()
5593 }
5594
5595 /// Sets the value of [node_group_uri][crate::model::NodeGroupAffinity::node_group_uri].
5596 ///
5597 /// # Example
5598 /// ```ignore,no_run
5599 /// # use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5600 /// let x = NodeGroupAffinity::new().set_node_group_uri("example");
5601 /// ```
5602 pub fn set_node_group_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5603 self.node_group_uri = v.into();
5604 self
5605 }
5606}
5607
5608impl wkt::message::Message for NodeGroupAffinity {
5609 fn typename() -> &'static str {
5610 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupAffinity"
5611 }
5612}
5613
5614/// Shielded Instance Config for clusters using [Compute Engine Shielded
5615/// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
5616#[derive(Clone, Default, PartialEq)]
5617#[non_exhaustive]
5618pub struct ShieldedInstanceConfig {
5619 /// Optional. Defines whether instances have Secure Boot enabled.
5620 pub enable_secure_boot: std::option::Option<bool>,
5621
5622 /// Optional. Defines whether instances have the vTPM enabled.
5623 pub enable_vtpm: std::option::Option<bool>,
5624
5625 /// Optional. Defines whether instances have integrity monitoring enabled.
5626 pub enable_integrity_monitoring: std::option::Option<bool>,
5627
5628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5629}
5630
5631impl ShieldedInstanceConfig {
5632 /// Creates a new default instance.
5633 pub fn new() -> Self {
5634 std::default::Default::default()
5635 }
5636
5637 /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5638 ///
5639 /// # Example
5640 /// ```ignore,no_run
5641 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5642 /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
5643 /// ```
5644 pub fn set_enable_secure_boot<T>(mut self, v: T) -> Self
5645 where
5646 T: std::convert::Into<bool>,
5647 {
5648 self.enable_secure_boot = std::option::Option::Some(v.into());
5649 self
5650 }
5651
5652 /// Sets or clears the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5653 ///
5654 /// # Example
5655 /// ```ignore,no_run
5656 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5657 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(Some(false));
5658 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(None::<bool>);
5659 /// ```
5660 pub fn set_or_clear_enable_secure_boot<T>(mut self, v: std::option::Option<T>) -> Self
5661 where
5662 T: std::convert::Into<bool>,
5663 {
5664 self.enable_secure_boot = v.map(|x| x.into());
5665 self
5666 }
5667
5668 /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5669 ///
5670 /// # Example
5671 /// ```ignore,no_run
5672 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5673 /// let x = ShieldedInstanceConfig::new().set_enable_vtpm(true);
5674 /// ```
5675 pub fn set_enable_vtpm<T>(mut self, v: T) -> Self
5676 where
5677 T: std::convert::Into<bool>,
5678 {
5679 self.enable_vtpm = std::option::Option::Some(v.into());
5680 self
5681 }
5682
5683 /// Sets or clears the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5684 ///
5685 /// # Example
5686 /// ```ignore,no_run
5687 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5688 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(Some(false));
5689 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(None::<bool>);
5690 /// ```
5691 pub fn set_or_clear_enable_vtpm<T>(mut self, v: std::option::Option<T>) -> Self
5692 where
5693 T: std::convert::Into<bool>,
5694 {
5695 self.enable_vtpm = v.map(|x| x.into());
5696 self
5697 }
5698
5699 /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5700 ///
5701 /// # Example
5702 /// ```ignore,no_run
5703 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5704 /// let x = ShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
5705 /// ```
5706 pub fn set_enable_integrity_monitoring<T>(mut self, v: T) -> Self
5707 where
5708 T: std::convert::Into<bool>,
5709 {
5710 self.enable_integrity_monitoring = std::option::Option::Some(v.into());
5711 self
5712 }
5713
5714 /// Sets or clears the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5715 ///
5716 /// # Example
5717 /// ```ignore,no_run
5718 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5719 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(Some(false));
5720 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(None::<bool>);
5721 /// ```
5722 pub fn set_or_clear_enable_integrity_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
5723 where
5724 T: std::convert::Into<bool>,
5725 {
5726 self.enable_integrity_monitoring = v.map(|x| x.into());
5727 self
5728 }
5729}
5730
5731impl wkt::message::Message for ShieldedInstanceConfig {
5732 fn typename() -> &'static str {
5733 "type.googleapis.com/google.cloud.dataproc.v1.ShieldedInstanceConfig"
5734 }
5735}
5736
5737/// Confidential Instance Config for clusters using [Confidential
5738/// VMs](https://cloud.google.com/confidential-computing/confidential-vm/docs)
5739#[derive(Clone, Default, PartialEq)]
5740#[non_exhaustive]
5741pub struct ConfidentialInstanceConfig {
5742 /// Optional. Deprecated: Use 'confidential_instance_type' instead.
5743 /// Defines whether the instance should have confidential compute enabled.
5744 #[deprecated]
5745 pub enable_confidential_compute: bool,
5746
5747 /// Optional. Defines the type of Confidential Compute technology to use.
5748 pub confidential_instance_type:
5749 crate::model::confidential_instance_config::ConfidentialInstanceType,
5750
5751 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5752}
5753
5754impl ConfidentialInstanceConfig {
5755 /// Creates a new default instance.
5756 pub fn new() -> Self {
5757 std::default::Default::default()
5758 }
5759
5760 /// Sets the value of [enable_confidential_compute][crate::model::ConfidentialInstanceConfig::enable_confidential_compute].
5761 ///
5762 /// # Example
5763 /// ```ignore,no_run
5764 /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5765 /// let x = ConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
5766 /// ```
5767 #[deprecated]
5768 pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5769 self.enable_confidential_compute = v.into();
5770 self
5771 }
5772
5773 /// Sets the value of [confidential_instance_type][crate::model::ConfidentialInstanceConfig::confidential_instance_type].
5774 ///
5775 /// # Example
5776 /// ```ignore,no_run
5777 /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5778 /// use google_cloud_dataproc_v1::model::confidential_instance_config::ConfidentialInstanceType;
5779 /// let x0 = ConfidentialInstanceConfig::new().set_confidential_instance_type(ConfidentialInstanceType::Sev);
5780 /// let x1 = ConfidentialInstanceConfig::new().set_confidential_instance_type(ConfidentialInstanceType::SevSnp);
5781 /// let x2 = ConfidentialInstanceConfig::new().set_confidential_instance_type(ConfidentialInstanceType::Tdx);
5782 /// ```
5783 pub fn set_confidential_instance_type<
5784 T: std::convert::Into<crate::model::confidential_instance_config::ConfidentialInstanceType>,
5785 >(
5786 mut self,
5787 v: T,
5788 ) -> Self {
5789 self.confidential_instance_type = v.into();
5790 self
5791 }
5792}
5793
5794impl wkt::message::Message for ConfidentialInstanceConfig {
5795 fn typename() -> &'static str {
5796 "type.googleapis.com/google.cloud.dataproc.v1.ConfidentialInstanceConfig"
5797 }
5798}
5799
5800/// Defines additional types related to [ConfidentialInstanceConfig].
5801pub mod confidential_instance_config {
5802 #[allow(unused_imports)]
5803 use super::*;
5804
5805 /// The type of Confidential Compute technology as per [Confidential Computing
5806 /// types](https://cloud.google.com/confidential-computing/confidential-vm/docs/create-a-confidential-vm-instance#create-instance).
5807 /// New values may be added in the future.
5808 ///
5809 /// # Working with unknown values
5810 ///
5811 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5812 /// additional enum variants at any time. Adding new variants is not considered
5813 /// a breaking change. Applications should write their code in anticipation of:
5814 ///
5815 /// - New values appearing in future releases of the client library, **and**
5816 /// - New values received dynamically, without application changes.
5817 ///
5818 /// Please consult the [Working with enums] section in the user guide for some
5819 /// guidelines.
5820 ///
5821 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5822 #[derive(Clone, Debug, PartialEq)]
5823 #[non_exhaustive]
5824 pub enum ConfidentialInstanceType {
5825 /// Confidential Instance Type is not specified.
5826 Unspecified,
5827 /// [AMD Secure Encrypted
5828 /// Virtualization](https://cloud.google.com/confidential-computing/confidential-vm/docs/confidential-vm-overview#amd_sev)
5829 Sev,
5830 /// [AMD Secure Encrypted Virtualization-Secure Nested
5831 /// Paging](https://cloud.google.com/confidential-computing/confidential-vm/docs/confidential-vm-overview#amd_sev-snp)
5832 SevSnp,
5833 /// [Intel Trust Domain
5834 /// Extensions](https://cloud.google.com/confidential-computing/confidential-vm/docs/confidential-vm-overview#intel_tdx)
5835 Tdx,
5836 /// If set, the enum was initialized with an unknown value.
5837 ///
5838 /// Applications can examine the value using [ConfidentialInstanceType::value] or
5839 /// [ConfidentialInstanceType::name].
5840 UnknownValue(confidential_instance_type::UnknownValue),
5841 }
5842
5843 #[doc(hidden)]
5844 pub mod confidential_instance_type {
5845 #[allow(unused_imports)]
5846 use super::*;
5847 #[derive(Clone, Debug, PartialEq)]
5848 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5849 }
5850
5851 impl ConfidentialInstanceType {
5852 /// Gets the enum value.
5853 ///
5854 /// Returns `None` if the enum contains an unknown value deserialized from
5855 /// the string representation of enums.
5856 pub fn value(&self) -> std::option::Option<i32> {
5857 match self {
5858 Self::Unspecified => std::option::Option::Some(0),
5859 Self::Sev => std::option::Option::Some(1),
5860 Self::SevSnp => std::option::Option::Some(2),
5861 Self::Tdx => std::option::Option::Some(3),
5862 Self::UnknownValue(u) => u.0.value(),
5863 }
5864 }
5865
5866 /// Gets the enum value as a string.
5867 ///
5868 /// Returns `None` if the enum contains an unknown value deserialized from
5869 /// the integer representation of enums.
5870 pub fn name(&self) -> std::option::Option<&str> {
5871 match self {
5872 Self::Unspecified => {
5873 std::option::Option::Some("CONFIDENTIAL_INSTANCE_TYPE_UNSPECIFIED")
5874 }
5875 Self::Sev => std::option::Option::Some("SEV"),
5876 Self::SevSnp => std::option::Option::Some("SEV_SNP"),
5877 Self::Tdx => std::option::Option::Some("TDX"),
5878 Self::UnknownValue(u) => u.0.name(),
5879 }
5880 }
5881 }
5882
5883 impl std::default::Default for ConfidentialInstanceType {
5884 fn default() -> Self {
5885 use std::convert::From;
5886 Self::from(0)
5887 }
5888 }
5889
5890 impl std::fmt::Display for ConfidentialInstanceType {
5891 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5892 wkt::internal::display_enum(f, self.name(), self.value())
5893 }
5894 }
5895
5896 impl std::convert::From<i32> for ConfidentialInstanceType {
5897 fn from(value: i32) -> Self {
5898 match value {
5899 0 => Self::Unspecified,
5900 1 => Self::Sev,
5901 2 => Self::SevSnp,
5902 3 => Self::Tdx,
5903 _ => Self::UnknownValue(confidential_instance_type::UnknownValue(
5904 wkt::internal::UnknownEnumValue::Integer(value),
5905 )),
5906 }
5907 }
5908 }
5909
5910 impl std::convert::From<&str> for ConfidentialInstanceType {
5911 fn from(value: &str) -> Self {
5912 use std::string::ToString;
5913 match value {
5914 "CONFIDENTIAL_INSTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
5915 "SEV" => Self::Sev,
5916 "SEV_SNP" => Self::SevSnp,
5917 "TDX" => Self::Tdx,
5918 _ => Self::UnknownValue(confidential_instance_type::UnknownValue(
5919 wkt::internal::UnknownEnumValue::String(value.to_string()),
5920 )),
5921 }
5922 }
5923 }
5924
5925 impl serde::ser::Serialize for ConfidentialInstanceType {
5926 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5927 where
5928 S: serde::Serializer,
5929 {
5930 match self {
5931 Self::Unspecified => serializer.serialize_i32(0),
5932 Self::Sev => serializer.serialize_i32(1),
5933 Self::SevSnp => serializer.serialize_i32(2),
5934 Self::Tdx => serializer.serialize_i32(3),
5935 Self::UnknownValue(u) => u.0.serialize(serializer),
5936 }
5937 }
5938 }
5939
5940 impl<'de> serde::de::Deserialize<'de> for ConfidentialInstanceType {
5941 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5942 where
5943 D: serde::Deserializer<'de>,
5944 {
5945 deserializer.deserialize_any(
5946 wkt::internal::EnumVisitor::<ConfidentialInstanceType>::new(
5947 ".google.cloud.dataproc.v1.ConfidentialInstanceConfig.ConfidentialInstanceType",
5948 ),
5949 )
5950 }
5951 }
5952}
5953
5954/// The config settings for Compute Engine resources in
5955/// an instance group, such as a master or worker group.
5956#[derive(Clone, Default, PartialEq)]
5957#[non_exhaustive]
5958pub struct InstanceGroupConfig {
5959 /// Optional. The number of VM instances in the instance group.
5960 /// For [HA
5961 /// cluster](/dataproc/docs/concepts/configuring-clusters/high-availability)
5962 /// [master_config](#FIELDS.master_config) groups, **must be set to 3**.
5963 /// For standard cluster [master_config](#FIELDS.master_config) groups,
5964 /// **must be set to 1**.
5965 pub num_instances: i32,
5966
5967 /// Output only. The list of instance names. Dataproc derives the names
5968 /// from `cluster_name`, `num_instances`, and the instance group.
5969 pub instance_names: std::vec::Vec<std::string::String>,
5970
5971 /// Output only. List of references to Compute Engine instances.
5972 pub instance_references: std::vec::Vec<crate::model::InstanceReference>,
5973
5974 /// Optional. The Compute Engine image resource used for cluster instances.
5975 ///
5976 /// The URI can represent an image or image family.
5977 ///
5978 /// Image examples:
5979 ///
5980 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/[image-id]`
5981 /// * `projects/[project_id]/global/images/[image-id]`
5982 /// * `image-id`
5983 ///
5984 /// Image family examples. Dataproc will use the most recent
5985 /// image from the family:
5986 ///
5987 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/family/[custom-image-family-name]`
5988 /// * `projects/[project_id]/global/images/family/[custom-image-family-name]`
5989 ///
5990 /// If the URI is unspecified, it will be inferred from
5991 /// `SoftwareConfig.image_version` or the system default.
5992 pub image_uri: std::string::String,
5993
5994 /// Optional. The Compute Engine machine type used for cluster instances.
5995 ///
5996 /// A full URL, partial URI, or short name are valid. Examples:
5997 ///
5998 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5999 /// * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2`
6000 /// * `n1-standard-2`
6001 ///
6002 /// **Auto Zone Exception**: If you are using the Dataproc
6003 /// [Auto Zone
6004 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
6005 /// feature, you must use the short name of the machine type
6006 /// resource, for example, `n1-standard-2`.
6007 pub machine_type_uri: std::string::String,
6008
6009 /// Optional. Disk option config settings.
6010 pub disk_config: std::option::Option<crate::model::DiskConfig>,
6011
6012 /// Output only. Specifies that this instance group contains preemptible
6013 /// instances.
6014 pub is_preemptible: bool,
6015
6016 /// Optional. Specifies the preemptibility of the instance group.
6017 ///
6018 /// The default value for master and worker groups is
6019 /// `NON_PREEMPTIBLE`. This default cannot be changed.
6020 ///
6021 /// The default value for secondary instances is
6022 /// `PREEMPTIBLE`.
6023 pub preemptibility: crate::model::instance_group_config::Preemptibility,
6024
6025 /// Output only. The config for Compute Engine Instance Group
6026 /// Manager that manages this group.
6027 /// This is only used for preemptible instance groups.
6028 pub managed_group_config: std::option::Option<crate::model::ManagedGroupConfig>,
6029
6030 /// Optional. The Compute Engine accelerator configuration for these
6031 /// instances.
6032 pub accelerators: std::vec::Vec<crate::model::AcceleratorConfig>,
6033
6034 /// Optional. Specifies the minimum cpu platform for the Instance Group.
6035 /// See [Dataproc -> Minimum CPU
6036 /// Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
6037 pub min_cpu_platform: std::string::String,
6038
6039 /// Optional. The minimum number of primary worker instances to create.
6040 /// If `min_num_instances` is set, cluster creation will succeed if
6041 /// the number of primary workers created is at least equal to the
6042 /// `min_num_instances` number.
6043 ///
6044 /// Example: Cluster creation request with `num_instances` = `5` and
6045 /// `min_num_instances` = `3`:
6046 ///
6047 /// * If 4 VMs are created and 1 instance fails,
6048 /// the failed VM is deleted. The cluster is
6049 /// resized to 4 instances and placed in a `RUNNING` state.
6050 /// * If 2 instances are created and 3 instances fail,
6051 /// the cluster in placed in an `ERROR` state. The failed VMs
6052 /// are not deleted.
6053 pub min_num_instances: i32,
6054
6055 /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and
6056 /// provisioning models.
6057 pub instance_flexibility_policy: std::option::Option<crate::model::InstanceFlexibilityPolicy>,
6058
6059 /// Optional. Configuration to handle the startup of instances during cluster
6060 /// create and update process.
6061 pub startup_config: std::option::Option<crate::model::StartupConfig>,
6062
6063 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6064}
6065
6066impl InstanceGroupConfig {
6067 /// Creates a new default instance.
6068 pub fn new() -> Self {
6069 std::default::Default::default()
6070 }
6071
6072 /// Sets the value of [num_instances][crate::model::InstanceGroupConfig::num_instances].
6073 ///
6074 /// # Example
6075 /// ```ignore,no_run
6076 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6077 /// let x = InstanceGroupConfig::new().set_num_instances(42);
6078 /// ```
6079 pub fn set_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6080 self.num_instances = v.into();
6081 self
6082 }
6083
6084 /// Sets the value of [instance_names][crate::model::InstanceGroupConfig::instance_names].
6085 ///
6086 /// # Example
6087 /// ```ignore,no_run
6088 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6089 /// let x = InstanceGroupConfig::new().set_instance_names(["a", "b", "c"]);
6090 /// ```
6091 pub fn set_instance_names<T, V>(mut self, v: T) -> Self
6092 where
6093 T: std::iter::IntoIterator<Item = V>,
6094 V: std::convert::Into<std::string::String>,
6095 {
6096 use std::iter::Iterator;
6097 self.instance_names = v.into_iter().map(|i| i.into()).collect();
6098 self
6099 }
6100
6101 /// Sets the value of [instance_references][crate::model::InstanceGroupConfig::instance_references].
6102 ///
6103 /// # Example
6104 /// ```ignore,no_run
6105 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6106 /// use google_cloud_dataproc_v1::model::InstanceReference;
6107 /// let x = InstanceGroupConfig::new()
6108 /// .set_instance_references([
6109 /// InstanceReference::default()/* use setters */,
6110 /// InstanceReference::default()/* use (different) setters */,
6111 /// ]);
6112 /// ```
6113 pub fn set_instance_references<T, V>(mut self, v: T) -> Self
6114 where
6115 T: std::iter::IntoIterator<Item = V>,
6116 V: std::convert::Into<crate::model::InstanceReference>,
6117 {
6118 use std::iter::Iterator;
6119 self.instance_references = v.into_iter().map(|i| i.into()).collect();
6120 self
6121 }
6122
6123 /// Sets the value of [image_uri][crate::model::InstanceGroupConfig::image_uri].
6124 ///
6125 /// # Example
6126 /// ```ignore,no_run
6127 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6128 /// let x = InstanceGroupConfig::new().set_image_uri("example");
6129 /// ```
6130 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6131 self.image_uri = v.into();
6132 self
6133 }
6134
6135 /// Sets the value of [machine_type_uri][crate::model::InstanceGroupConfig::machine_type_uri].
6136 ///
6137 /// # Example
6138 /// ```ignore,no_run
6139 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6140 /// let x = InstanceGroupConfig::new().set_machine_type_uri("example");
6141 /// ```
6142 pub fn set_machine_type_uri<T: std::convert::Into<std::string::String>>(
6143 mut self,
6144 v: T,
6145 ) -> Self {
6146 self.machine_type_uri = v.into();
6147 self
6148 }
6149
6150 /// Sets the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
6151 ///
6152 /// # Example
6153 /// ```ignore,no_run
6154 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6155 /// use google_cloud_dataproc_v1::model::DiskConfig;
6156 /// let x = InstanceGroupConfig::new().set_disk_config(DiskConfig::default()/* use setters */);
6157 /// ```
6158 pub fn set_disk_config<T>(mut self, v: T) -> Self
6159 where
6160 T: std::convert::Into<crate::model::DiskConfig>,
6161 {
6162 self.disk_config = std::option::Option::Some(v.into());
6163 self
6164 }
6165
6166 /// Sets or clears the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
6167 ///
6168 /// # Example
6169 /// ```ignore,no_run
6170 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6171 /// use google_cloud_dataproc_v1::model::DiskConfig;
6172 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
6173 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(None::<DiskConfig>);
6174 /// ```
6175 pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
6176 where
6177 T: std::convert::Into<crate::model::DiskConfig>,
6178 {
6179 self.disk_config = v.map(|x| x.into());
6180 self
6181 }
6182
6183 /// Sets the value of [is_preemptible][crate::model::InstanceGroupConfig::is_preemptible].
6184 ///
6185 /// # Example
6186 /// ```ignore,no_run
6187 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6188 /// let x = InstanceGroupConfig::new().set_is_preemptible(true);
6189 /// ```
6190 pub fn set_is_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6191 self.is_preemptible = v.into();
6192 self
6193 }
6194
6195 /// Sets the value of [preemptibility][crate::model::InstanceGroupConfig::preemptibility].
6196 ///
6197 /// # Example
6198 /// ```ignore,no_run
6199 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6200 /// use google_cloud_dataproc_v1::model::instance_group_config::Preemptibility;
6201 /// let x0 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::NonPreemptible);
6202 /// let x1 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Preemptible);
6203 /// let x2 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Spot);
6204 /// ```
6205 pub fn set_preemptibility<
6206 T: std::convert::Into<crate::model::instance_group_config::Preemptibility>,
6207 >(
6208 mut self,
6209 v: T,
6210 ) -> Self {
6211 self.preemptibility = v.into();
6212 self
6213 }
6214
6215 /// Sets the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
6216 ///
6217 /// # Example
6218 /// ```ignore,no_run
6219 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6220 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6221 /// let x = InstanceGroupConfig::new().set_managed_group_config(ManagedGroupConfig::default()/* use setters */);
6222 /// ```
6223 pub fn set_managed_group_config<T>(mut self, v: T) -> Self
6224 where
6225 T: std::convert::Into<crate::model::ManagedGroupConfig>,
6226 {
6227 self.managed_group_config = std::option::Option::Some(v.into());
6228 self
6229 }
6230
6231 /// Sets or clears the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
6232 ///
6233 /// # Example
6234 /// ```ignore,no_run
6235 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6236 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6237 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(Some(ManagedGroupConfig::default()/* use setters */));
6238 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(None::<ManagedGroupConfig>);
6239 /// ```
6240 pub fn set_or_clear_managed_group_config<T>(mut self, v: std::option::Option<T>) -> Self
6241 where
6242 T: std::convert::Into<crate::model::ManagedGroupConfig>,
6243 {
6244 self.managed_group_config = v.map(|x| x.into());
6245 self
6246 }
6247
6248 /// Sets the value of [accelerators][crate::model::InstanceGroupConfig::accelerators].
6249 ///
6250 /// # Example
6251 /// ```ignore,no_run
6252 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6253 /// use google_cloud_dataproc_v1::model::AcceleratorConfig;
6254 /// let x = InstanceGroupConfig::new()
6255 /// .set_accelerators([
6256 /// AcceleratorConfig::default()/* use setters */,
6257 /// AcceleratorConfig::default()/* use (different) setters */,
6258 /// ]);
6259 /// ```
6260 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
6261 where
6262 T: std::iter::IntoIterator<Item = V>,
6263 V: std::convert::Into<crate::model::AcceleratorConfig>,
6264 {
6265 use std::iter::Iterator;
6266 self.accelerators = v.into_iter().map(|i| i.into()).collect();
6267 self
6268 }
6269
6270 /// Sets the value of [min_cpu_platform][crate::model::InstanceGroupConfig::min_cpu_platform].
6271 ///
6272 /// # Example
6273 /// ```ignore,no_run
6274 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6275 /// let x = InstanceGroupConfig::new().set_min_cpu_platform("example");
6276 /// ```
6277 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
6278 mut self,
6279 v: T,
6280 ) -> Self {
6281 self.min_cpu_platform = v.into();
6282 self
6283 }
6284
6285 /// Sets the value of [min_num_instances][crate::model::InstanceGroupConfig::min_num_instances].
6286 ///
6287 /// # Example
6288 /// ```ignore,no_run
6289 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6290 /// let x = InstanceGroupConfig::new().set_min_num_instances(42);
6291 /// ```
6292 pub fn set_min_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6293 self.min_num_instances = v.into();
6294 self
6295 }
6296
6297 /// Sets the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
6298 ///
6299 /// # Example
6300 /// ```ignore,no_run
6301 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6302 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6303 /// let x = InstanceGroupConfig::new().set_instance_flexibility_policy(InstanceFlexibilityPolicy::default()/* use setters */);
6304 /// ```
6305 pub fn set_instance_flexibility_policy<T>(mut self, v: T) -> Self
6306 where
6307 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
6308 {
6309 self.instance_flexibility_policy = std::option::Option::Some(v.into());
6310 self
6311 }
6312
6313 /// Sets or clears the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
6314 ///
6315 /// # Example
6316 /// ```ignore,no_run
6317 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6318 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6319 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(Some(InstanceFlexibilityPolicy::default()/* use setters */));
6320 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(None::<InstanceFlexibilityPolicy>);
6321 /// ```
6322 pub fn set_or_clear_instance_flexibility_policy<T>(mut self, v: std::option::Option<T>) -> Self
6323 where
6324 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
6325 {
6326 self.instance_flexibility_policy = v.map(|x| x.into());
6327 self
6328 }
6329
6330 /// Sets the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
6331 ///
6332 /// # Example
6333 /// ```ignore,no_run
6334 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6335 /// use google_cloud_dataproc_v1::model::StartupConfig;
6336 /// let x = InstanceGroupConfig::new().set_startup_config(StartupConfig::default()/* use setters */);
6337 /// ```
6338 pub fn set_startup_config<T>(mut self, v: T) -> Self
6339 where
6340 T: std::convert::Into<crate::model::StartupConfig>,
6341 {
6342 self.startup_config = std::option::Option::Some(v.into());
6343 self
6344 }
6345
6346 /// Sets or clears the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
6347 ///
6348 /// # Example
6349 /// ```ignore,no_run
6350 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6351 /// use google_cloud_dataproc_v1::model::StartupConfig;
6352 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(Some(StartupConfig::default()/* use setters */));
6353 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(None::<StartupConfig>);
6354 /// ```
6355 pub fn set_or_clear_startup_config<T>(mut self, v: std::option::Option<T>) -> Self
6356 where
6357 T: std::convert::Into<crate::model::StartupConfig>,
6358 {
6359 self.startup_config = v.map(|x| x.into());
6360 self
6361 }
6362}
6363
6364impl wkt::message::Message for InstanceGroupConfig {
6365 fn typename() -> &'static str {
6366 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupConfig"
6367 }
6368}
6369
6370/// Defines additional types related to [InstanceGroupConfig].
6371pub mod instance_group_config {
6372 #[allow(unused_imports)]
6373 use super::*;
6374
6375 /// Controls the use of preemptible instances within the group.
6376 ///
6377 /// # Working with unknown values
6378 ///
6379 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6380 /// additional enum variants at any time. Adding new variants is not considered
6381 /// a breaking change. Applications should write their code in anticipation of:
6382 ///
6383 /// - New values appearing in future releases of the client library, **and**
6384 /// - New values received dynamically, without application changes.
6385 ///
6386 /// Please consult the [Working with enums] section in the user guide for some
6387 /// guidelines.
6388 ///
6389 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6390 #[derive(Clone, Debug, PartialEq)]
6391 #[non_exhaustive]
6392 pub enum Preemptibility {
6393 /// Preemptibility is unspecified, the system will choose the
6394 /// appropriate setting for each instance group.
6395 Unspecified,
6396 /// Instances are non-preemptible.
6397 ///
6398 /// This option is allowed for all instance groups and is the only valid
6399 /// value for Master and Worker instance groups.
6400 NonPreemptible,
6401 /// Instances are [preemptible]
6402 /// (<https://cloud.google.com/compute/docs/instances/preemptible>).
6403 ///
6404 /// This option is allowed only for [secondary worker]
6405 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
6406 /// groups.
6407 Preemptible,
6408 /// Instances are [Spot VMs]
6409 /// (<https://cloud.google.com/compute/docs/instances/spot>).
6410 ///
6411 /// This option is allowed only for [secondary worker]
6412 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
6413 /// groups. Spot VMs are the latest version of [preemptible VMs]
6414 /// (<https://cloud.google.com/compute/docs/instances/preemptible>), and
6415 /// provide additional features.
6416 Spot,
6417 /// If set, the enum was initialized with an unknown value.
6418 ///
6419 /// Applications can examine the value using [Preemptibility::value] or
6420 /// [Preemptibility::name].
6421 UnknownValue(preemptibility::UnknownValue),
6422 }
6423
6424 #[doc(hidden)]
6425 pub mod preemptibility {
6426 #[allow(unused_imports)]
6427 use super::*;
6428 #[derive(Clone, Debug, PartialEq)]
6429 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6430 }
6431
6432 impl Preemptibility {
6433 /// Gets the enum value.
6434 ///
6435 /// Returns `None` if the enum contains an unknown value deserialized from
6436 /// the string representation of enums.
6437 pub fn value(&self) -> std::option::Option<i32> {
6438 match self {
6439 Self::Unspecified => std::option::Option::Some(0),
6440 Self::NonPreemptible => std::option::Option::Some(1),
6441 Self::Preemptible => std::option::Option::Some(2),
6442 Self::Spot => std::option::Option::Some(3),
6443 Self::UnknownValue(u) => u.0.value(),
6444 }
6445 }
6446
6447 /// Gets the enum value as a string.
6448 ///
6449 /// Returns `None` if the enum contains an unknown value deserialized from
6450 /// the integer representation of enums.
6451 pub fn name(&self) -> std::option::Option<&str> {
6452 match self {
6453 Self::Unspecified => std::option::Option::Some("PREEMPTIBILITY_UNSPECIFIED"),
6454 Self::NonPreemptible => std::option::Option::Some("NON_PREEMPTIBLE"),
6455 Self::Preemptible => std::option::Option::Some("PREEMPTIBLE"),
6456 Self::Spot => std::option::Option::Some("SPOT"),
6457 Self::UnknownValue(u) => u.0.name(),
6458 }
6459 }
6460 }
6461
6462 impl std::default::Default for Preemptibility {
6463 fn default() -> Self {
6464 use std::convert::From;
6465 Self::from(0)
6466 }
6467 }
6468
6469 impl std::fmt::Display for Preemptibility {
6470 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6471 wkt::internal::display_enum(f, self.name(), self.value())
6472 }
6473 }
6474
6475 impl std::convert::From<i32> for Preemptibility {
6476 fn from(value: i32) -> Self {
6477 match value {
6478 0 => Self::Unspecified,
6479 1 => Self::NonPreemptible,
6480 2 => Self::Preemptible,
6481 3 => Self::Spot,
6482 _ => Self::UnknownValue(preemptibility::UnknownValue(
6483 wkt::internal::UnknownEnumValue::Integer(value),
6484 )),
6485 }
6486 }
6487 }
6488
6489 impl std::convert::From<&str> for Preemptibility {
6490 fn from(value: &str) -> Self {
6491 use std::string::ToString;
6492 match value {
6493 "PREEMPTIBILITY_UNSPECIFIED" => Self::Unspecified,
6494 "NON_PREEMPTIBLE" => Self::NonPreemptible,
6495 "PREEMPTIBLE" => Self::Preemptible,
6496 "SPOT" => Self::Spot,
6497 _ => Self::UnknownValue(preemptibility::UnknownValue(
6498 wkt::internal::UnknownEnumValue::String(value.to_string()),
6499 )),
6500 }
6501 }
6502 }
6503
6504 impl serde::ser::Serialize for Preemptibility {
6505 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6506 where
6507 S: serde::Serializer,
6508 {
6509 match self {
6510 Self::Unspecified => serializer.serialize_i32(0),
6511 Self::NonPreemptible => serializer.serialize_i32(1),
6512 Self::Preemptible => serializer.serialize_i32(2),
6513 Self::Spot => serializer.serialize_i32(3),
6514 Self::UnknownValue(u) => u.0.serialize(serializer),
6515 }
6516 }
6517 }
6518
6519 impl<'de> serde::de::Deserialize<'de> for Preemptibility {
6520 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6521 where
6522 D: serde::Deserializer<'de>,
6523 {
6524 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Preemptibility>::new(
6525 ".google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility",
6526 ))
6527 }
6528 }
6529}
6530
6531/// Configuration to handle the startup of instances during cluster create and
6532/// update process.
6533#[derive(Clone, Default, PartialEq)]
6534#[non_exhaustive]
6535pub struct StartupConfig {
6536 /// Optional. The config setting to enable cluster creation/ updation to be
6537 /// successful only after required_registration_fraction of instances are up
6538 /// and running. This configuration is applicable to only secondary workers for
6539 /// now. The cluster will fail if required_registration_fraction of instances
6540 /// are not available. This will include instance creation, agent registration,
6541 /// and service registration (if enabled).
6542 pub required_registration_fraction: std::option::Option<f64>,
6543
6544 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6545}
6546
6547impl StartupConfig {
6548 /// Creates a new default instance.
6549 pub fn new() -> Self {
6550 std::default::Default::default()
6551 }
6552
6553 /// Sets the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
6554 ///
6555 /// # Example
6556 /// ```ignore,no_run
6557 /// # use google_cloud_dataproc_v1::model::StartupConfig;
6558 /// let x = StartupConfig::new().set_required_registration_fraction(42.0);
6559 /// ```
6560 pub fn set_required_registration_fraction<T>(mut self, v: T) -> Self
6561 where
6562 T: std::convert::Into<f64>,
6563 {
6564 self.required_registration_fraction = std::option::Option::Some(v.into());
6565 self
6566 }
6567
6568 /// Sets or clears the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
6569 ///
6570 /// # Example
6571 /// ```ignore,no_run
6572 /// # use google_cloud_dataproc_v1::model::StartupConfig;
6573 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(Some(42.0));
6574 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(None::<f32>);
6575 /// ```
6576 pub fn set_or_clear_required_registration_fraction<T>(
6577 mut self,
6578 v: std::option::Option<T>,
6579 ) -> Self
6580 where
6581 T: std::convert::Into<f64>,
6582 {
6583 self.required_registration_fraction = v.map(|x| x.into());
6584 self
6585 }
6586}
6587
6588impl wkt::message::Message for StartupConfig {
6589 fn typename() -> &'static str {
6590 "type.googleapis.com/google.cloud.dataproc.v1.StartupConfig"
6591 }
6592}
6593
6594/// A reference to a Compute Engine instance.
6595#[derive(Clone, Default, PartialEq)]
6596#[non_exhaustive]
6597pub struct InstanceReference {
6598 /// The user-friendly name of the Compute Engine instance.
6599 pub instance_name: std::string::String,
6600
6601 /// The unique identifier of the Compute Engine instance.
6602 pub instance_id: std::string::String,
6603
6604 /// The public RSA key used for sharing data with this instance.
6605 pub public_key: std::string::String,
6606
6607 /// The public ECIES key used for sharing data with this instance.
6608 pub public_ecies_key: std::string::String,
6609
6610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6611}
6612
6613impl InstanceReference {
6614 /// Creates a new default instance.
6615 pub fn new() -> Self {
6616 std::default::Default::default()
6617 }
6618
6619 /// Sets the value of [instance_name][crate::model::InstanceReference::instance_name].
6620 ///
6621 /// # Example
6622 /// ```ignore,no_run
6623 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6624 /// let x = InstanceReference::new().set_instance_name("example");
6625 /// ```
6626 pub fn set_instance_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6627 self.instance_name = v.into();
6628 self
6629 }
6630
6631 /// Sets the value of [instance_id][crate::model::InstanceReference::instance_id].
6632 ///
6633 /// # Example
6634 /// ```ignore,no_run
6635 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6636 /// let x = InstanceReference::new().set_instance_id("example");
6637 /// ```
6638 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6639 self.instance_id = v.into();
6640 self
6641 }
6642
6643 /// Sets the value of [public_key][crate::model::InstanceReference::public_key].
6644 ///
6645 /// # Example
6646 /// ```ignore,no_run
6647 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6648 /// let x = InstanceReference::new().set_public_key("example");
6649 /// ```
6650 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6651 self.public_key = v.into();
6652 self
6653 }
6654
6655 /// Sets the value of [public_ecies_key][crate::model::InstanceReference::public_ecies_key].
6656 ///
6657 /// # Example
6658 /// ```ignore,no_run
6659 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6660 /// let x = InstanceReference::new().set_public_ecies_key("example");
6661 /// ```
6662 pub fn set_public_ecies_key<T: std::convert::Into<std::string::String>>(
6663 mut self,
6664 v: T,
6665 ) -> Self {
6666 self.public_ecies_key = v.into();
6667 self
6668 }
6669}
6670
6671impl wkt::message::Message for InstanceReference {
6672 fn typename() -> &'static str {
6673 "type.googleapis.com/google.cloud.dataproc.v1.InstanceReference"
6674 }
6675}
6676
6677/// Specifies the resources used to actively manage an instance group.
6678#[derive(Clone, Default, PartialEq)]
6679#[non_exhaustive]
6680pub struct ManagedGroupConfig {
6681 /// Output only. The name of the Instance Template used for the Managed
6682 /// Instance Group.
6683 pub instance_template_name: std::string::String,
6684
6685 /// Output only. The name of the Instance Group Manager for this group.
6686 pub instance_group_manager_name: std::string::String,
6687
6688 /// Output only. The partial URI to the instance group manager for this group.
6689 /// E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
6690 pub instance_group_manager_uri: std::string::String,
6691
6692 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6693}
6694
6695impl ManagedGroupConfig {
6696 /// Creates a new default instance.
6697 pub fn new() -> Self {
6698 std::default::Default::default()
6699 }
6700
6701 /// Sets the value of [instance_template_name][crate::model::ManagedGroupConfig::instance_template_name].
6702 ///
6703 /// # Example
6704 /// ```ignore,no_run
6705 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6706 /// let x = ManagedGroupConfig::new().set_instance_template_name("example");
6707 /// ```
6708 pub fn set_instance_template_name<T: std::convert::Into<std::string::String>>(
6709 mut self,
6710 v: T,
6711 ) -> Self {
6712 self.instance_template_name = v.into();
6713 self
6714 }
6715
6716 /// Sets the value of [instance_group_manager_name][crate::model::ManagedGroupConfig::instance_group_manager_name].
6717 ///
6718 /// # Example
6719 /// ```ignore,no_run
6720 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6721 /// let x = ManagedGroupConfig::new().set_instance_group_manager_name("example");
6722 /// ```
6723 pub fn set_instance_group_manager_name<T: std::convert::Into<std::string::String>>(
6724 mut self,
6725 v: T,
6726 ) -> Self {
6727 self.instance_group_manager_name = v.into();
6728 self
6729 }
6730
6731 /// Sets the value of [instance_group_manager_uri][crate::model::ManagedGroupConfig::instance_group_manager_uri].
6732 ///
6733 /// # Example
6734 /// ```ignore,no_run
6735 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6736 /// let x = ManagedGroupConfig::new().set_instance_group_manager_uri("example");
6737 /// ```
6738 pub fn set_instance_group_manager_uri<T: std::convert::Into<std::string::String>>(
6739 mut self,
6740 v: T,
6741 ) -> Self {
6742 self.instance_group_manager_uri = v.into();
6743 self
6744 }
6745}
6746
6747impl wkt::message::Message for ManagedGroupConfig {
6748 fn typename() -> &'static str {
6749 "type.googleapis.com/google.cloud.dataproc.v1.ManagedGroupConfig"
6750 }
6751}
6752
6753/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning
6754/// models.
6755#[derive(Clone, Default, PartialEq)]
6756#[non_exhaustive]
6757pub struct InstanceFlexibilityPolicy {
6758 /// Optional. Defines how the Group selects the provisioning model to ensure
6759 /// required reliability.
6760 pub provisioning_model_mix:
6761 std::option::Option<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6762
6763 /// Optional. List of instance selection options that the group will use when
6764 /// creating new VMs.
6765 pub instance_selection_list:
6766 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelection>,
6767
6768 /// Output only. A list of instance selection results in the group.
6769 pub instance_selection_results:
6770 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6771
6772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6773}
6774
6775impl InstanceFlexibilityPolicy {
6776 /// Creates a new default instance.
6777 pub fn new() -> Self {
6778 std::default::Default::default()
6779 }
6780
6781 /// Sets the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6782 ///
6783 /// # Example
6784 /// ```ignore,no_run
6785 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6786 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6787 /// let x = InstanceFlexibilityPolicy::new().set_provisioning_model_mix(ProvisioningModelMix::default()/* use setters */);
6788 /// ```
6789 pub fn set_provisioning_model_mix<T>(mut self, v: T) -> Self
6790 where
6791 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6792 {
6793 self.provisioning_model_mix = std::option::Option::Some(v.into());
6794 self
6795 }
6796
6797 /// Sets or clears the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6798 ///
6799 /// # Example
6800 /// ```ignore,no_run
6801 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6802 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6803 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(Some(ProvisioningModelMix::default()/* use setters */));
6804 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(None::<ProvisioningModelMix>);
6805 /// ```
6806 pub fn set_or_clear_provisioning_model_mix<T>(mut self, v: std::option::Option<T>) -> Self
6807 where
6808 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6809 {
6810 self.provisioning_model_mix = v.map(|x| x.into());
6811 self
6812 }
6813
6814 /// Sets the value of [instance_selection_list][crate::model::InstanceFlexibilityPolicy::instance_selection_list].
6815 ///
6816 /// # Example
6817 /// ```ignore,no_run
6818 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6819 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6820 /// let x = InstanceFlexibilityPolicy::new()
6821 /// .set_instance_selection_list([
6822 /// InstanceSelection::default()/* use setters */,
6823 /// InstanceSelection::default()/* use (different) setters */,
6824 /// ]);
6825 /// ```
6826 pub fn set_instance_selection_list<T, V>(mut self, v: T) -> Self
6827 where
6828 T: std::iter::IntoIterator<Item = V>,
6829 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelection>,
6830 {
6831 use std::iter::Iterator;
6832 self.instance_selection_list = v.into_iter().map(|i| i.into()).collect();
6833 self
6834 }
6835
6836 /// Sets the value of [instance_selection_results][crate::model::InstanceFlexibilityPolicy::instance_selection_results].
6837 ///
6838 /// # Example
6839 /// ```ignore,no_run
6840 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6841 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6842 /// let x = InstanceFlexibilityPolicy::new()
6843 /// .set_instance_selection_results([
6844 /// InstanceSelectionResult::default()/* use setters */,
6845 /// InstanceSelectionResult::default()/* use (different) setters */,
6846 /// ]);
6847 /// ```
6848 pub fn set_instance_selection_results<T, V>(mut self, v: T) -> Self
6849 where
6850 T: std::iter::IntoIterator<Item = V>,
6851 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6852 {
6853 use std::iter::Iterator;
6854 self.instance_selection_results = v.into_iter().map(|i| i.into()).collect();
6855 self
6856 }
6857}
6858
6859impl wkt::message::Message for InstanceFlexibilityPolicy {
6860 fn typename() -> &'static str {
6861 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy"
6862 }
6863}
6864
6865/// Defines additional types related to [InstanceFlexibilityPolicy].
6866pub mod instance_flexibility_policy {
6867 #[allow(unused_imports)]
6868 use super::*;
6869
6870 /// Defines how Dataproc should create VMs with a mixture of provisioning
6871 /// models.
6872 #[derive(Clone, Default, PartialEq)]
6873 #[non_exhaustive]
6874 pub struct ProvisioningModelMix {
6875 /// Optional. The base capacity that will always use Standard VMs to avoid
6876 /// risk of more preemption than the minimum capacity you need. Dataproc will
6877 /// create only standard VMs until it reaches standard_capacity_base, then it
6878 /// will start using standard_capacity_percent_above_base to mix Spot with
6879 /// Standard VMs. eg. If 15 instances are requested and
6880 /// standard_capacity_base is 5, Dataproc will create 5 standard VMs and then
6881 /// start mixing spot and standard VMs for remaining 10 instances.
6882 pub standard_capacity_base: std::option::Option<i32>,
6883
6884 /// Optional. The percentage of target capacity that should use Standard VM.
6885 /// The remaining percentage will use Spot VMs. The percentage applies only
6886 /// to the capacity above standard_capacity_base. eg. If 15 instances are
6887 /// requested and standard_capacity_base is 5 and
6888 /// standard_capacity_percent_above_base is 30, Dataproc will create 5
6889 /// standard VMs and then start mixing spot and standard VMs for remaining 10
6890 /// instances. The mix will be 30% standard and 70% spot.
6891 pub standard_capacity_percent_above_base: std::option::Option<i32>,
6892
6893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6894 }
6895
6896 impl ProvisioningModelMix {
6897 /// Creates a new default instance.
6898 pub fn new() -> Self {
6899 std::default::Default::default()
6900 }
6901
6902 /// Sets the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6903 ///
6904 /// # Example
6905 /// ```ignore,no_run
6906 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6907 /// let x = ProvisioningModelMix::new().set_standard_capacity_base(42);
6908 /// ```
6909 pub fn set_standard_capacity_base<T>(mut self, v: T) -> Self
6910 where
6911 T: std::convert::Into<i32>,
6912 {
6913 self.standard_capacity_base = std::option::Option::Some(v.into());
6914 self
6915 }
6916
6917 /// Sets or clears the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6918 ///
6919 /// # Example
6920 /// ```ignore,no_run
6921 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6922 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(Some(42));
6923 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(None::<i32>);
6924 /// ```
6925 pub fn set_or_clear_standard_capacity_base<T>(mut self, v: std::option::Option<T>) -> Self
6926 where
6927 T: std::convert::Into<i32>,
6928 {
6929 self.standard_capacity_base = v.map(|x| x.into());
6930 self
6931 }
6932
6933 /// Sets the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6934 ///
6935 /// # Example
6936 /// ```ignore,no_run
6937 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6938 /// let x = ProvisioningModelMix::new().set_standard_capacity_percent_above_base(42);
6939 /// ```
6940 pub fn set_standard_capacity_percent_above_base<T>(mut self, v: T) -> Self
6941 where
6942 T: std::convert::Into<i32>,
6943 {
6944 self.standard_capacity_percent_above_base = std::option::Option::Some(v.into());
6945 self
6946 }
6947
6948 /// Sets or clears the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6949 ///
6950 /// # Example
6951 /// ```ignore,no_run
6952 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6953 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(Some(42));
6954 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(None::<i32>);
6955 /// ```
6956 pub fn set_or_clear_standard_capacity_percent_above_base<T>(
6957 mut self,
6958 v: std::option::Option<T>,
6959 ) -> Self
6960 where
6961 T: std::convert::Into<i32>,
6962 {
6963 self.standard_capacity_percent_above_base = v.map(|x| x.into());
6964 self
6965 }
6966 }
6967
6968 impl wkt::message::Message for ProvisioningModelMix {
6969 fn typename() -> &'static str {
6970 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.ProvisioningModelMix"
6971 }
6972 }
6973
6974 /// Defines machines types and a rank to which the machines types belong.
6975 #[derive(Clone, Default, PartialEq)]
6976 #[non_exhaustive]
6977 pub struct InstanceSelection {
6978 /// Optional. Full machine-type names, e.g. "n1-standard-16".
6979 pub machine_types: std::vec::Vec<std::string::String>,
6980
6981 /// Optional. Preference of this instance selection. Lower number means
6982 /// higher preference. Dataproc will first try to create a VM based on the
6983 /// machine-type with priority rank and fallback to next rank based on
6984 /// availability. Machine types and instance selections with the same
6985 /// priority have the same preference.
6986 pub rank: i32,
6987
6988 /// Optional. Disk configuration to apply to the instances in this instance
6989 /// selection. If specified on any entry in instanceSelectionList, then it
6990 /// must be specified on every entry in instanceSelectionList and the
6991 /// instanceGroupConfig must not specify any diskConfig.
6992 pub disk_config: std::option::Option<crate::model::DiskConfig>,
6993
6994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6995 }
6996
6997 impl InstanceSelection {
6998 /// Creates a new default instance.
6999 pub fn new() -> Self {
7000 std::default::Default::default()
7001 }
7002
7003 /// Sets the value of [machine_types][crate::model::instance_flexibility_policy::InstanceSelection::machine_types].
7004 ///
7005 /// # Example
7006 /// ```ignore,no_run
7007 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
7008 /// let x = InstanceSelection::new().set_machine_types(["a", "b", "c"]);
7009 /// ```
7010 pub fn set_machine_types<T, V>(mut self, v: T) -> Self
7011 where
7012 T: std::iter::IntoIterator<Item = V>,
7013 V: std::convert::Into<std::string::String>,
7014 {
7015 use std::iter::Iterator;
7016 self.machine_types = v.into_iter().map(|i| i.into()).collect();
7017 self
7018 }
7019
7020 /// Sets the value of [rank][crate::model::instance_flexibility_policy::InstanceSelection::rank].
7021 ///
7022 /// # Example
7023 /// ```ignore,no_run
7024 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
7025 /// let x = InstanceSelection::new().set_rank(42);
7026 /// ```
7027 pub fn set_rank<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7028 self.rank = v.into();
7029 self
7030 }
7031
7032 /// Sets the value of [disk_config][crate::model::instance_flexibility_policy::InstanceSelection::disk_config].
7033 ///
7034 /// # Example
7035 /// ```ignore,no_run
7036 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
7037 /// use google_cloud_dataproc_v1::model::DiskConfig;
7038 /// let x = InstanceSelection::new().set_disk_config(DiskConfig::default()/* use setters */);
7039 /// ```
7040 pub fn set_disk_config<T>(mut self, v: T) -> Self
7041 where
7042 T: std::convert::Into<crate::model::DiskConfig>,
7043 {
7044 self.disk_config = std::option::Option::Some(v.into());
7045 self
7046 }
7047
7048 /// Sets or clears the value of [disk_config][crate::model::instance_flexibility_policy::InstanceSelection::disk_config].
7049 ///
7050 /// # Example
7051 /// ```ignore,no_run
7052 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
7053 /// use google_cloud_dataproc_v1::model::DiskConfig;
7054 /// let x = InstanceSelection::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
7055 /// let x = InstanceSelection::new().set_or_clear_disk_config(None::<DiskConfig>);
7056 /// ```
7057 pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
7058 where
7059 T: std::convert::Into<crate::model::DiskConfig>,
7060 {
7061 self.disk_config = v.map(|x| x.into());
7062 self
7063 }
7064 }
7065
7066 impl wkt::message::Message for InstanceSelection {
7067 fn typename() -> &'static str {
7068 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelection"
7069 }
7070 }
7071
7072 /// Defines a mapping from machine types to the number of VMs that are created
7073 /// with each machine type.
7074 #[derive(Clone, Default, PartialEq)]
7075 #[non_exhaustive]
7076 pub struct InstanceSelectionResult {
7077 /// Output only. Full machine-type names, e.g. "n1-standard-16".
7078 pub machine_type: std::option::Option<std::string::String>,
7079
7080 /// Output only. Number of VM provisioned with the machine_type.
7081 pub vm_count: std::option::Option<i32>,
7082
7083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7084 }
7085
7086 impl InstanceSelectionResult {
7087 /// Creates a new default instance.
7088 pub fn new() -> Self {
7089 std::default::Default::default()
7090 }
7091
7092 /// Sets the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
7093 ///
7094 /// # Example
7095 /// ```ignore,no_run
7096 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
7097 /// let x = InstanceSelectionResult::new().set_machine_type("example");
7098 /// ```
7099 pub fn set_machine_type<T>(mut self, v: T) -> Self
7100 where
7101 T: std::convert::Into<std::string::String>,
7102 {
7103 self.machine_type = std::option::Option::Some(v.into());
7104 self
7105 }
7106
7107 /// Sets or clears the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
7108 ///
7109 /// # Example
7110 /// ```ignore,no_run
7111 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
7112 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(Some("example"));
7113 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(None::<String>);
7114 /// ```
7115 pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
7116 where
7117 T: std::convert::Into<std::string::String>,
7118 {
7119 self.machine_type = v.map(|x| x.into());
7120 self
7121 }
7122
7123 /// Sets the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
7124 ///
7125 /// # Example
7126 /// ```ignore,no_run
7127 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
7128 /// let x = InstanceSelectionResult::new().set_vm_count(42);
7129 /// ```
7130 pub fn set_vm_count<T>(mut self, v: T) -> Self
7131 where
7132 T: std::convert::Into<i32>,
7133 {
7134 self.vm_count = std::option::Option::Some(v.into());
7135 self
7136 }
7137
7138 /// Sets or clears the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
7139 ///
7140 /// # Example
7141 /// ```ignore,no_run
7142 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
7143 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(Some(42));
7144 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(None::<i32>);
7145 /// ```
7146 pub fn set_or_clear_vm_count<T>(mut self, v: std::option::Option<T>) -> Self
7147 where
7148 T: std::convert::Into<i32>,
7149 {
7150 self.vm_count = v.map(|x| x.into());
7151 self
7152 }
7153 }
7154
7155 impl wkt::message::Message for InstanceSelectionResult {
7156 fn typename() -> &'static str {
7157 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelectionResult"
7158 }
7159 }
7160}
7161
7162/// Specifies the type and number of accelerator cards attached to the instances
7163/// of an instance. See [GPUs on Compute
7164/// Engine](https://cloud.google.com/compute/docs/gpus/).
7165#[derive(Clone, Default, PartialEq)]
7166#[non_exhaustive]
7167pub struct AcceleratorConfig {
7168 /// Full URL, partial URI, or short name of the accelerator type resource to
7169 /// expose to this instance. See
7170 /// [Compute Engine
7171 /// AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).
7172 ///
7173 /// Examples:
7174 ///
7175 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
7176 /// * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
7177 /// * `nvidia-tesla-t4`
7178 ///
7179 /// **Auto Zone Exception**: If you are using the Dataproc
7180 /// [Auto Zone
7181 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
7182 /// feature, you must use the short name of the accelerator type
7183 /// resource, for example, `nvidia-tesla-t4`.
7184 pub accelerator_type_uri: std::string::String,
7185
7186 /// The number of the accelerator cards of this type exposed to this instance.
7187 pub accelerator_count: i32,
7188
7189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7190}
7191
7192impl AcceleratorConfig {
7193 /// Creates a new default instance.
7194 pub fn new() -> Self {
7195 std::default::Default::default()
7196 }
7197
7198 /// Sets the value of [accelerator_type_uri][crate::model::AcceleratorConfig::accelerator_type_uri].
7199 ///
7200 /// # Example
7201 /// ```ignore,no_run
7202 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
7203 /// let x = AcceleratorConfig::new().set_accelerator_type_uri("example");
7204 /// ```
7205 pub fn set_accelerator_type_uri<T: std::convert::Into<std::string::String>>(
7206 mut self,
7207 v: T,
7208 ) -> Self {
7209 self.accelerator_type_uri = v.into();
7210 self
7211 }
7212
7213 /// Sets the value of [accelerator_count][crate::model::AcceleratorConfig::accelerator_count].
7214 ///
7215 /// # Example
7216 /// ```ignore,no_run
7217 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
7218 /// let x = AcceleratorConfig::new().set_accelerator_count(42);
7219 /// ```
7220 pub fn set_accelerator_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7221 self.accelerator_count = v.into();
7222 self
7223 }
7224}
7225
7226impl wkt::message::Message for AcceleratorConfig {
7227 fn typename() -> &'static str {
7228 "type.googleapis.com/google.cloud.dataproc.v1.AcceleratorConfig"
7229 }
7230}
7231
7232/// Specifies the config of boot disk and attached disk options for a group of VM
7233/// instances.
7234#[derive(Clone, Default, PartialEq)]
7235#[non_exhaustive]
7236pub struct DiskConfig {
7237 /// Optional. Type of the boot disk (default is `pd-standard`).
7238 /// Valid values: `pd-balanced` (Persistent Disk Balanced Solid State Drive),
7239 /// `pd-ssd` (Persistent Disk Solid State Drive),
7240 /// or `pd-standard` (Persistent Disk Hard Disk Drive).
7241 /// See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types).
7242 pub boot_disk_type: std::string::String,
7243
7244 /// Optional. Size in GB of the boot disk (default is 500GB).
7245 pub boot_disk_size_gb: i32,
7246
7247 /// Optional. Number of attached SSDs, from 0 to 8 (default is 0).
7248 /// If SSDs are not attached, the boot disk is used to store runtime logs and
7249 /// [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data.
7250 /// If one or more SSDs are attached, this runtime bulk
7251 /// data is spread across them, and the boot disk contains only basic
7252 /// config and installed binaries.
7253 ///
7254 /// Note: Local SSD options may vary by machine type and number of vCPUs
7255 /// selected.
7256 pub num_local_ssds: i32,
7257
7258 /// Optional. Interface type of local SSDs (default is `scsi`).
7259 /// Valid values: `scsi` (Small Computer System Interface),
7260 /// `nvme` (Non-Volatile Memory Express).
7261 /// See [local SSD
7262 /// performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance).
7263 pub local_ssd_interface: std::string::String,
7264
7265 /// Optional. Indicates how many IOPS to provision for the disk. This sets the
7266 /// number of I/O operations per second that the disk can handle.
7267 /// **This field is supported only if
7268 /// [boot_disk_type][google.cloud.dataproc.v1.DiskConfig.boot_disk_type] is
7269 /// `hyperdisk-balanced`.**
7270 ///
7271 /// [google.cloud.dataproc.v1.DiskConfig.boot_disk_type]: crate::model::DiskConfig::boot_disk_type
7272 pub boot_disk_provisioned_iops: std::option::Option<i64>,
7273
7274 /// Optional. Indicates how much throughput to provision for the disk. This
7275 /// sets the number of throughput mb per second that the disk can handle.
7276 /// Values must be greater than or equal to 1. **This field is supported only
7277 /// if [boot_disk_type][google.cloud.dataproc.v1.DiskConfig.boot_disk_type] is
7278 /// `hyperdisk-balanced`.**
7279 ///
7280 /// [google.cloud.dataproc.v1.DiskConfig.boot_disk_type]: crate::model::DiskConfig::boot_disk_type
7281 pub boot_disk_provisioned_throughput: std::option::Option<i64>,
7282
7283 /// Optional. A list of attached disk configs for a group of VM instances.
7284 pub attached_disk_configs: std::vec::Vec<crate::model::AttachedDiskConfig>,
7285
7286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7287}
7288
7289impl DiskConfig {
7290 /// Creates a new default instance.
7291 pub fn new() -> Self {
7292 std::default::Default::default()
7293 }
7294
7295 /// Sets the value of [boot_disk_type][crate::model::DiskConfig::boot_disk_type].
7296 ///
7297 /// # Example
7298 /// ```ignore,no_run
7299 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7300 /// let x = DiskConfig::new().set_boot_disk_type("example");
7301 /// ```
7302 pub fn set_boot_disk_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7303 self.boot_disk_type = v.into();
7304 self
7305 }
7306
7307 /// Sets the value of [boot_disk_size_gb][crate::model::DiskConfig::boot_disk_size_gb].
7308 ///
7309 /// # Example
7310 /// ```ignore,no_run
7311 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7312 /// let x = DiskConfig::new().set_boot_disk_size_gb(42);
7313 /// ```
7314 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7315 self.boot_disk_size_gb = v.into();
7316 self
7317 }
7318
7319 /// Sets the value of [num_local_ssds][crate::model::DiskConfig::num_local_ssds].
7320 ///
7321 /// # Example
7322 /// ```ignore,no_run
7323 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7324 /// let x = DiskConfig::new().set_num_local_ssds(42);
7325 /// ```
7326 pub fn set_num_local_ssds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7327 self.num_local_ssds = v.into();
7328 self
7329 }
7330
7331 /// Sets the value of [local_ssd_interface][crate::model::DiskConfig::local_ssd_interface].
7332 ///
7333 /// # Example
7334 /// ```ignore,no_run
7335 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7336 /// let x = DiskConfig::new().set_local_ssd_interface("example");
7337 /// ```
7338 pub fn set_local_ssd_interface<T: std::convert::Into<std::string::String>>(
7339 mut self,
7340 v: T,
7341 ) -> Self {
7342 self.local_ssd_interface = v.into();
7343 self
7344 }
7345
7346 /// Sets the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
7347 ///
7348 /// # Example
7349 /// ```ignore,no_run
7350 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7351 /// let x = DiskConfig::new().set_boot_disk_provisioned_iops(42);
7352 /// ```
7353 pub fn set_boot_disk_provisioned_iops<T>(mut self, v: T) -> Self
7354 where
7355 T: std::convert::Into<i64>,
7356 {
7357 self.boot_disk_provisioned_iops = std::option::Option::Some(v.into());
7358 self
7359 }
7360
7361 /// Sets or clears the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
7362 ///
7363 /// # Example
7364 /// ```ignore,no_run
7365 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7366 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(Some(42));
7367 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(None::<i32>);
7368 /// ```
7369 pub fn set_or_clear_boot_disk_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
7370 where
7371 T: std::convert::Into<i64>,
7372 {
7373 self.boot_disk_provisioned_iops = v.map(|x| x.into());
7374 self
7375 }
7376
7377 /// Sets the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
7378 ///
7379 /// # Example
7380 /// ```ignore,no_run
7381 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7382 /// let x = DiskConfig::new().set_boot_disk_provisioned_throughput(42);
7383 /// ```
7384 pub fn set_boot_disk_provisioned_throughput<T>(mut self, v: T) -> Self
7385 where
7386 T: std::convert::Into<i64>,
7387 {
7388 self.boot_disk_provisioned_throughput = std::option::Option::Some(v.into());
7389 self
7390 }
7391
7392 /// Sets or clears the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
7393 ///
7394 /// # Example
7395 /// ```ignore,no_run
7396 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7397 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(Some(42));
7398 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(None::<i32>);
7399 /// ```
7400 pub fn set_or_clear_boot_disk_provisioned_throughput<T>(
7401 mut self,
7402 v: std::option::Option<T>,
7403 ) -> Self
7404 where
7405 T: std::convert::Into<i64>,
7406 {
7407 self.boot_disk_provisioned_throughput = v.map(|x| x.into());
7408 self
7409 }
7410
7411 /// Sets the value of [attached_disk_configs][crate::model::DiskConfig::attached_disk_configs].
7412 ///
7413 /// # Example
7414 /// ```ignore,no_run
7415 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7416 /// use google_cloud_dataproc_v1::model::AttachedDiskConfig;
7417 /// let x = DiskConfig::new()
7418 /// .set_attached_disk_configs([
7419 /// AttachedDiskConfig::default()/* use setters */,
7420 /// AttachedDiskConfig::default()/* use (different) setters */,
7421 /// ]);
7422 /// ```
7423 pub fn set_attached_disk_configs<T, V>(mut self, v: T) -> Self
7424 where
7425 T: std::iter::IntoIterator<Item = V>,
7426 V: std::convert::Into<crate::model::AttachedDiskConfig>,
7427 {
7428 use std::iter::Iterator;
7429 self.attached_disk_configs = v.into_iter().map(|i| i.into()).collect();
7430 self
7431 }
7432}
7433
7434impl wkt::message::Message for DiskConfig {
7435 fn typename() -> &'static str {
7436 "type.googleapis.com/google.cloud.dataproc.v1.DiskConfig"
7437 }
7438}
7439
7440/// Specifies the config of attached disk options for single VM instance.
7441#[derive(Clone, Default, PartialEq)]
7442#[non_exhaustive]
7443pub struct AttachedDiskConfig {
7444 /// Optional. Disk type.
7445 pub disk_type: crate::model::attached_disk_config::DiskType,
7446
7447 /// Optional. Disk size in GB.
7448 pub disk_size_gb: i32,
7449
7450 /// Optional. Indicates how many IOPS to provision for the attached disk. This
7451 /// sets the number of I/O operations per second that the disk can handle. See
7452 /// <https://cloud.google.com/compute/docs/disks/hyperdisks#hyperdisk-features>
7453 pub provisioned_iops: std::option::Option<i64>,
7454
7455 /// Optional. Indicates how much throughput to provision for the attached
7456 /// disk. This sets the number of throughput mb per second that the disk can
7457 /// handle. See
7458 /// <https://cloud.google.com/compute/docs/disks/hyperdisks#hyperdisk-features>
7459 pub provisioned_throughput: std::option::Option<i64>,
7460
7461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7462}
7463
7464impl AttachedDiskConfig {
7465 /// Creates a new default instance.
7466 pub fn new() -> Self {
7467 std::default::Default::default()
7468 }
7469
7470 /// Sets the value of [disk_type][crate::model::AttachedDiskConfig::disk_type].
7471 ///
7472 /// # Example
7473 /// ```ignore,no_run
7474 /// # use google_cloud_dataproc_v1::model::AttachedDiskConfig;
7475 /// use google_cloud_dataproc_v1::model::attached_disk_config::DiskType;
7476 /// let x0 = AttachedDiskConfig::new().set_disk_type(DiskType::HyperdiskBalanced);
7477 /// let x1 = AttachedDiskConfig::new().set_disk_type(DiskType::HyperdiskExtreme);
7478 /// let x2 = AttachedDiskConfig::new().set_disk_type(DiskType::HyperdiskMl);
7479 /// ```
7480 pub fn set_disk_type<T: std::convert::Into<crate::model::attached_disk_config::DiskType>>(
7481 mut self,
7482 v: T,
7483 ) -> Self {
7484 self.disk_type = v.into();
7485 self
7486 }
7487
7488 /// Sets the value of [disk_size_gb][crate::model::AttachedDiskConfig::disk_size_gb].
7489 ///
7490 /// # Example
7491 /// ```ignore,no_run
7492 /// # use google_cloud_dataproc_v1::model::AttachedDiskConfig;
7493 /// let x = AttachedDiskConfig::new().set_disk_size_gb(42);
7494 /// ```
7495 pub fn set_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7496 self.disk_size_gb = v.into();
7497 self
7498 }
7499
7500 /// Sets the value of [provisioned_iops][crate::model::AttachedDiskConfig::provisioned_iops].
7501 ///
7502 /// # Example
7503 /// ```ignore,no_run
7504 /// # use google_cloud_dataproc_v1::model::AttachedDiskConfig;
7505 /// let x = AttachedDiskConfig::new().set_provisioned_iops(42);
7506 /// ```
7507 pub fn set_provisioned_iops<T>(mut self, v: T) -> Self
7508 where
7509 T: std::convert::Into<i64>,
7510 {
7511 self.provisioned_iops = std::option::Option::Some(v.into());
7512 self
7513 }
7514
7515 /// Sets or clears the value of [provisioned_iops][crate::model::AttachedDiskConfig::provisioned_iops].
7516 ///
7517 /// # Example
7518 /// ```ignore,no_run
7519 /// # use google_cloud_dataproc_v1::model::AttachedDiskConfig;
7520 /// let x = AttachedDiskConfig::new().set_or_clear_provisioned_iops(Some(42));
7521 /// let x = AttachedDiskConfig::new().set_or_clear_provisioned_iops(None::<i32>);
7522 /// ```
7523 pub fn set_or_clear_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
7524 where
7525 T: std::convert::Into<i64>,
7526 {
7527 self.provisioned_iops = v.map(|x| x.into());
7528 self
7529 }
7530
7531 /// Sets the value of [provisioned_throughput][crate::model::AttachedDiskConfig::provisioned_throughput].
7532 ///
7533 /// # Example
7534 /// ```ignore,no_run
7535 /// # use google_cloud_dataproc_v1::model::AttachedDiskConfig;
7536 /// let x = AttachedDiskConfig::new().set_provisioned_throughput(42);
7537 /// ```
7538 pub fn set_provisioned_throughput<T>(mut self, v: T) -> Self
7539 where
7540 T: std::convert::Into<i64>,
7541 {
7542 self.provisioned_throughput = std::option::Option::Some(v.into());
7543 self
7544 }
7545
7546 /// Sets or clears the value of [provisioned_throughput][crate::model::AttachedDiskConfig::provisioned_throughput].
7547 ///
7548 /// # Example
7549 /// ```ignore,no_run
7550 /// # use google_cloud_dataproc_v1::model::AttachedDiskConfig;
7551 /// let x = AttachedDiskConfig::new().set_or_clear_provisioned_throughput(Some(42));
7552 /// let x = AttachedDiskConfig::new().set_or_clear_provisioned_throughput(None::<i32>);
7553 /// ```
7554 pub fn set_or_clear_provisioned_throughput<T>(mut self, v: std::option::Option<T>) -> Self
7555 where
7556 T: std::convert::Into<i64>,
7557 {
7558 self.provisioned_throughput = v.map(|x| x.into());
7559 self
7560 }
7561}
7562
7563impl wkt::message::Message for AttachedDiskConfig {
7564 fn typename() -> &'static str {
7565 "type.googleapis.com/google.cloud.dataproc.v1.AttachedDiskConfig"
7566 }
7567}
7568
7569/// Defines additional types related to [AttachedDiskConfig].
7570pub mod attached_disk_config {
7571 #[allow(unused_imports)]
7572 use super::*;
7573
7574 /// Enum for [DiskType].
7575 ///
7576 /// # Working with unknown values
7577 ///
7578 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7579 /// additional enum variants at any time. Adding new variants is not considered
7580 /// a breaking change. Applications should write their code in anticipation of:
7581 ///
7582 /// - New values appearing in future releases of the client library, **and**
7583 /// - New values received dynamically, without application changes.
7584 ///
7585 /// Please consult the [Working with enums] section in the user guide for some
7586 /// guidelines.
7587 ///
7588 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7589 #[derive(Clone, Debug, PartialEq)]
7590 #[non_exhaustive]
7591 pub enum DiskType {
7592 /// Required unspecified disk type.
7593 Unspecified,
7594 /// Hyperdisk Balanced disk type.
7595 HyperdiskBalanced,
7596 /// Hyperdisk Extreme disk type.
7597 HyperdiskExtreme,
7598 /// Hyperdisk ML disk type.
7599 HyperdiskMl,
7600 /// Hyperdisk Throughput disk type.
7601 HyperdiskThroughput,
7602 /// If set, the enum was initialized with an unknown value.
7603 ///
7604 /// Applications can examine the value using [DiskType::value] or
7605 /// [DiskType::name].
7606 UnknownValue(disk_type::UnknownValue),
7607 }
7608
7609 #[doc(hidden)]
7610 pub mod disk_type {
7611 #[allow(unused_imports)]
7612 use super::*;
7613 #[derive(Clone, Debug, PartialEq)]
7614 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7615 }
7616
7617 impl DiskType {
7618 /// Gets the enum value.
7619 ///
7620 /// Returns `None` if the enum contains an unknown value deserialized from
7621 /// the string representation of enums.
7622 pub fn value(&self) -> std::option::Option<i32> {
7623 match self {
7624 Self::Unspecified => std::option::Option::Some(0),
7625 Self::HyperdiskBalanced => std::option::Option::Some(1),
7626 Self::HyperdiskExtreme => std::option::Option::Some(2),
7627 Self::HyperdiskMl => std::option::Option::Some(3),
7628 Self::HyperdiskThroughput => std::option::Option::Some(4),
7629 Self::UnknownValue(u) => u.0.value(),
7630 }
7631 }
7632
7633 /// Gets the enum value as a string.
7634 ///
7635 /// Returns `None` if the enum contains an unknown value deserialized from
7636 /// the integer representation of enums.
7637 pub fn name(&self) -> std::option::Option<&str> {
7638 match self {
7639 Self::Unspecified => std::option::Option::Some("DISK_TYPE_UNSPECIFIED"),
7640 Self::HyperdiskBalanced => std::option::Option::Some("HYPERDISK_BALANCED"),
7641 Self::HyperdiskExtreme => std::option::Option::Some("HYPERDISK_EXTREME"),
7642 Self::HyperdiskMl => std::option::Option::Some("HYPERDISK_ML"),
7643 Self::HyperdiskThroughput => std::option::Option::Some("HYPERDISK_THROUGHPUT"),
7644 Self::UnknownValue(u) => u.0.name(),
7645 }
7646 }
7647 }
7648
7649 impl std::default::Default for DiskType {
7650 fn default() -> Self {
7651 use std::convert::From;
7652 Self::from(0)
7653 }
7654 }
7655
7656 impl std::fmt::Display for DiskType {
7657 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7658 wkt::internal::display_enum(f, self.name(), self.value())
7659 }
7660 }
7661
7662 impl std::convert::From<i32> for DiskType {
7663 fn from(value: i32) -> Self {
7664 match value {
7665 0 => Self::Unspecified,
7666 1 => Self::HyperdiskBalanced,
7667 2 => Self::HyperdiskExtreme,
7668 3 => Self::HyperdiskMl,
7669 4 => Self::HyperdiskThroughput,
7670 _ => Self::UnknownValue(disk_type::UnknownValue(
7671 wkt::internal::UnknownEnumValue::Integer(value),
7672 )),
7673 }
7674 }
7675 }
7676
7677 impl std::convert::From<&str> for DiskType {
7678 fn from(value: &str) -> Self {
7679 use std::string::ToString;
7680 match value {
7681 "DISK_TYPE_UNSPECIFIED" => Self::Unspecified,
7682 "HYPERDISK_BALANCED" => Self::HyperdiskBalanced,
7683 "HYPERDISK_EXTREME" => Self::HyperdiskExtreme,
7684 "HYPERDISK_ML" => Self::HyperdiskMl,
7685 "HYPERDISK_THROUGHPUT" => Self::HyperdiskThroughput,
7686 _ => Self::UnknownValue(disk_type::UnknownValue(
7687 wkt::internal::UnknownEnumValue::String(value.to_string()),
7688 )),
7689 }
7690 }
7691 }
7692
7693 impl serde::ser::Serialize for DiskType {
7694 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7695 where
7696 S: serde::Serializer,
7697 {
7698 match self {
7699 Self::Unspecified => serializer.serialize_i32(0),
7700 Self::HyperdiskBalanced => serializer.serialize_i32(1),
7701 Self::HyperdiskExtreme => serializer.serialize_i32(2),
7702 Self::HyperdiskMl => serializer.serialize_i32(3),
7703 Self::HyperdiskThroughput => serializer.serialize_i32(4),
7704 Self::UnknownValue(u) => u.0.serialize(serializer),
7705 }
7706 }
7707 }
7708
7709 impl<'de> serde::de::Deserialize<'de> for DiskType {
7710 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7711 where
7712 D: serde::Deserializer<'de>,
7713 {
7714 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiskType>::new(
7715 ".google.cloud.dataproc.v1.AttachedDiskConfig.DiskType",
7716 ))
7717 }
7718 }
7719}
7720
7721/// Node group identification and configuration information.
7722#[derive(Clone, Default, PartialEq)]
7723#[non_exhaustive]
7724pub struct AuxiliaryNodeGroup {
7725 /// Required. Node group configuration.
7726 pub node_group: std::option::Option<crate::model::NodeGroup>,
7727
7728 /// Optional. A node group ID. Generated if not specified.
7729 ///
7730 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
7731 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
7732 /// or hyphen. Must consist of from 3 to 33 characters.
7733 pub node_group_id: std::string::String,
7734
7735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7736}
7737
7738impl AuxiliaryNodeGroup {
7739 /// Creates a new default instance.
7740 pub fn new() -> Self {
7741 std::default::Default::default()
7742 }
7743
7744 /// Sets the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
7745 ///
7746 /// # Example
7747 /// ```ignore,no_run
7748 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
7749 /// use google_cloud_dataproc_v1::model::NodeGroup;
7750 /// let x = AuxiliaryNodeGroup::new().set_node_group(NodeGroup::default()/* use setters */);
7751 /// ```
7752 pub fn set_node_group<T>(mut self, v: T) -> Self
7753 where
7754 T: std::convert::Into<crate::model::NodeGroup>,
7755 {
7756 self.node_group = std::option::Option::Some(v.into());
7757 self
7758 }
7759
7760 /// Sets or clears the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
7761 ///
7762 /// # Example
7763 /// ```ignore,no_run
7764 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
7765 /// use google_cloud_dataproc_v1::model::NodeGroup;
7766 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
7767 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(None::<NodeGroup>);
7768 /// ```
7769 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
7770 where
7771 T: std::convert::Into<crate::model::NodeGroup>,
7772 {
7773 self.node_group = v.map(|x| x.into());
7774 self
7775 }
7776
7777 /// Sets the value of [node_group_id][crate::model::AuxiliaryNodeGroup::node_group_id].
7778 ///
7779 /// # Example
7780 /// ```ignore,no_run
7781 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
7782 /// let x = AuxiliaryNodeGroup::new().set_node_group_id("example");
7783 /// ```
7784 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7785 self.node_group_id = v.into();
7786 self
7787 }
7788}
7789
7790impl wkt::message::Message for AuxiliaryNodeGroup {
7791 fn typename() -> &'static str {
7792 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryNodeGroup"
7793 }
7794}
7795
7796/// Dataproc Node Group.
7797/// **The Dataproc `NodeGroup` resource is not related to the
7798/// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity]
7799/// resource.**
7800///
7801/// [google.cloud.dataproc.v1.NodeGroupAffinity]: crate::model::NodeGroupAffinity
7802#[derive(Clone, Default, PartialEq)]
7803#[non_exhaustive]
7804pub struct NodeGroup {
7805 /// The Node group [resource name](https://aip.dev/122).
7806 pub name: std::string::String,
7807
7808 /// Required. Node group roles.
7809 pub roles: std::vec::Vec<crate::model::node_group::Role>,
7810
7811 /// Optional. The node group instance group configuration.
7812 pub node_group_config: std::option::Option<crate::model::InstanceGroupConfig>,
7813
7814 /// Optional. Node group labels.
7815 ///
7816 /// * Label **keys** must consist of from 1 to 63 characters and conform to
7817 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
7818 /// * Label **values** can be empty. If specified, they must consist of from
7819 /// 1 to 63 characters and conform to [RFC 1035]
7820 /// (<https://www.ietf.org/rfc/rfc1035.txt>).
7821 /// * The node group must have no more than 32 labels.
7822 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7823
7824 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7825}
7826
7827impl NodeGroup {
7828 /// Creates a new default instance.
7829 pub fn new() -> Self {
7830 std::default::Default::default()
7831 }
7832
7833 /// Sets the value of [name][crate::model::NodeGroup::name].
7834 ///
7835 /// # Example
7836 /// ```ignore,no_run
7837 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7838 /// # let project_id = "project_id";
7839 /// # let region_id = "region_id";
7840 /// # let cluster_id = "cluster_id";
7841 /// # let node_group_id = "node_group_id";
7842 /// let x = NodeGroup::new().set_name(format!("projects/{project_id}/regions/{region_id}/clusters/{cluster_id}/nodeGroups/{node_group_id}"));
7843 /// ```
7844 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7845 self.name = v.into();
7846 self
7847 }
7848
7849 /// Sets the value of [roles][crate::model::NodeGroup::roles].
7850 ///
7851 /// # Example
7852 /// ```ignore,no_run
7853 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7854 /// use google_cloud_dataproc_v1::model::node_group::Role;
7855 /// let x = NodeGroup::new().set_roles([
7856 /// Role::Driver,
7857 /// ]);
7858 /// ```
7859 pub fn set_roles<T, V>(mut self, v: T) -> Self
7860 where
7861 T: std::iter::IntoIterator<Item = V>,
7862 V: std::convert::Into<crate::model::node_group::Role>,
7863 {
7864 use std::iter::Iterator;
7865 self.roles = v.into_iter().map(|i| i.into()).collect();
7866 self
7867 }
7868
7869 /// Sets the value of [node_group_config][crate::model::NodeGroup::node_group_config].
7870 ///
7871 /// # Example
7872 /// ```ignore,no_run
7873 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7874 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
7875 /// let x = NodeGroup::new().set_node_group_config(InstanceGroupConfig::default()/* use setters */);
7876 /// ```
7877 pub fn set_node_group_config<T>(mut self, v: T) -> Self
7878 where
7879 T: std::convert::Into<crate::model::InstanceGroupConfig>,
7880 {
7881 self.node_group_config = std::option::Option::Some(v.into());
7882 self
7883 }
7884
7885 /// Sets or clears the value of [node_group_config][crate::model::NodeGroup::node_group_config].
7886 ///
7887 /// # Example
7888 /// ```ignore,no_run
7889 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7890 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
7891 /// let x = NodeGroup::new().set_or_clear_node_group_config(Some(InstanceGroupConfig::default()/* use setters */));
7892 /// let x = NodeGroup::new().set_or_clear_node_group_config(None::<InstanceGroupConfig>);
7893 /// ```
7894 pub fn set_or_clear_node_group_config<T>(mut self, v: std::option::Option<T>) -> Self
7895 where
7896 T: std::convert::Into<crate::model::InstanceGroupConfig>,
7897 {
7898 self.node_group_config = v.map(|x| x.into());
7899 self
7900 }
7901
7902 /// Sets the value of [labels][crate::model::NodeGroup::labels].
7903 ///
7904 /// # Example
7905 /// ```ignore,no_run
7906 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7907 /// let x = NodeGroup::new().set_labels([
7908 /// ("key0", "abc"),
7909 /// ("key1", "xyz"),
7910 /// ]);
7911 /// ```
7912 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7913 where
7914 T: std::iter::IntoIterator<Item = (K, V)>,
7915 K: std::convert::Into<std::string::String>,
7916 V: std::convert::Into<std::string::String>,
7917 {
7918 use std::iter::Iterator;
7919 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7920 self
7921 }
7922}
7923
7924impl wkt::message::Message for NodeGroup {
7925 fn typename() -> &'static str {
7926 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroup"
7927 }
7928}
7929
7930/// Defines additional types related to [NodeGroup].
7931pub mod node_group {
7932 #[allow(unused_imports)]
7933 use super::*;
7934
7935 /// Node pool roles.
7936 ///
7937 /// # Working with unknown values
7938 ///
7939 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7940 /// additional enum variants at any time. Adding new variants is not considered
7941 /// a breaking change. Applications should write their code in anticipation of:
7942 ///
7943 /// - New values appearing in future releases of the client library, **and**
7944 /// - New values received dynamically, without application changes.
7945 ///
7946 /// Please consult the [Working with enums] section in the user guide for some
7947 /// guidelines.
7948 ///
7949 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7950 #[derive(Clone, Debug, PartialEq)]
7951 #[non_exhaustive]
7952 pub enum Role {
7953 /// Required unspecified role.
7954 Unspecified,
7955 /// Job drivers run on the node pool.
7956 Driver,
7957 /// If set, the enum was initialized with an unknown value.
7958 ///
7959 /// Applications can examine the value using [Role::value] or
7960 /// [Role::name].
7961 UnknownValue(role::UnknownValue),
7962 }
7963
7964 #[doc(hidden)]
7965 pub mod role {
7966 #[allow(unused_imports)]
7967 use super::*;
7968 #[derive(Clone, Debug, PartialEq)]
7969 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7970 }
7971
7972 impl Role {
7973 /// Gets the enum value.
7974 ///
7975 /// Returns `None` if the enum contains an unknown value deserialized from
7976 /// the string representation of enums.
7977 pub fn value(&self) -> std::option::Option<i32> {
7978 match self {
7979 Self::Unspecified => std::option::Option::Some(0),
7980 Self::Driver => std::option::Option::Some(1),
7981 Self::UnknownValue(u) => u.0.value(),
7982 }
7983 }
7984
7985 /// Gets the enum value as a string.
7986 ///
7987 /// Returns `None` if the enum contains an unknown value deserialized from
7988 /// the integer representation of enums.
7989 pub fn name(&self) -> std::option::Option<&str> {
7990 match self {
7991 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
7992 Self::Driver => std::option::Option::Some("DRIVER"),
7993 Self::UnknownValue(u) => u.0.name(),
7994 }
7995 }
7996 }
7997
7998 impl std::default::Default for Role {
7999 fn default() -> Self {
8000 use std::convert::From;
8001 Self::from(0)
8002 }
8003 }
8004
8005 impl std::fmt::Display for Role {
8006 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8007 wkt::internal::display_enum(f, self.name(), self.value())
8008 }
8009 }
8010
8011 impl std::convert::From<i32> for Role {
8012 fn from(value: i32) -> Self {
8013 match value {
8014 0 => Self::Unspecified,
8015 1 => Self::Driver,
8016 _ => Self::UnknownValue(role::UnknownValue(
8017 wkt::internal::UnknownEnumValue::Integer(value),
8018 )),
8019 }
8020 }
8021 }
8022
8023 impl std::convert::From<&str> for Role {
8024 fn from(value: &str) -> Self {
8025 use std::string::ToString;
8026 match value {
8027 "ROLE_UNSPECIFIED" => Self::Unspecified,
8028 "DRIVER" => Self::Driver,
8029 _ => Self::UnknownValue(role::UnknownValue(
8030 wkt::internal::UnknownEnumValue::String(value.to_string()),
8031 )),
8032 }
8033 }
8034 }
8035
8036 impl serde::ser::Serialize for Role {
8037 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8038 where
8039 S: serde::Serializer,
8040 {
8041 match self {
8042 Self::Unspecified => serializer.serialize_i32(0),
8043 Self::Driver => serializer.serialize_i32(1),
8044 Self::UnknownValue(u) => u.0.serialize(serializer),
8045 }
8046 }
8047 }
8048
8049 impl<'de> serde::de::Deserialize<'de> for Role {
8050 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8051 where
8052 D: serde::Deserializer<'de>,
8053 {
8054 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
8055 ".google.cloud.dataproc.v1.NodeGroup.Role",
8056 ))
8057 }
8058 }
8059}
8060
8061/// Specifies an executable to run on a fully configured node and a
8062/// timeout period for executable completion.
8063#[derive(Clone, Default, PartialEq)]
8064#[non_exhaustive]
8065pub struct NodeInitializationAction {
8066 /// Required. Cloud Storage URI of executable file.
8067 pub executable_file: std::string::String,
8068
8069 /// Optional. Amount of time executable has to complete. Default is
8070 /// 10 minutes (see JSON representation of
8071 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8072 ///
8073 /// Cluster creation fails with an explanatory error message (the
8074 /// name of the executable that caused the error and the exceeded timeout
8075 /// period) if the executable is not completed at end of the timeout period.
8076 pub execution_timeout: std::option::Option<wkt::Duration>,
8077
8078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8079}
8080
8081impl NodeInitializationAction {
8082 /// Creates a new default instance.
8083 pub fn new() -> Self {
8084 std::default::Default::default()
8085 }
8086
8087 /// Sets the value of [executable_file][crate::model::NodeInitializationAction::executable_file].
8088 ///
8089 /// # Example
8090 /// ```ignore,no_run
8091 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
8092 /// let x = NodeInitializationAction::new().set_executable_file("example");
8093 /// ```
8094 pub fn set_executable_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8095 self.executable_file = v.into();
8096 self
8097 }
8098
8099 /// Sets the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
8100 ///
8101 /// # Example
8102 /// ```ignore,no_run
8103 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
8104 /// use wkt::Duration;
8105 /// let x = NodeInitializationAction::new().set_execution_timeout(Duration::default()/* use setters */);
8106 /// ```
8107 pub fn set_execution_timeout<T>(mut self, v: T) -> Self
8108 where
8109 T: std::convert::Into<wkt::Duration>,
8110 {
8111 self.execution_timeout = std::option::Option::Some(v.into());
8112 self
8113 }
8114
8115 /// Sets or clears the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
8116 ///
8117 /// # Example
8118 /// ```ignore,no_run
8119 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
8120 /// use wkt::Duration;
8121 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
8122 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(None::<Duration>);
8123 /// ```
8124 pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
8125 where
8126 T: std::convert::Into<wkt::Duration>,
8127 {
8128 self.execution_timeout = v.map(|x| x.into());
8129 self
8130 }
8131}
8132
8133impl wkt::message::Message for NodeInitializationAction {
8134 fn typename() -> &'static str {
8135 "type.googleapis.com/google.cloud.dataproc.v1.NodeInitializationAction"
8136 }
8137}
8138
8139/// The status of a cluster and its instances.
8140#[derive(Clone, Default, PartialEq)]
8141#[non_exhaustive]
8142pub struct ClusterStatus {
8143 /// Output only. The cluster's state.
8144 pub state: crate::model::cluster_status::State,
8145
8146 /// Optional. Output only. Details of cluster's state.
8147 pub detail: std::string::String,
8148
8149 /// Output only. Time when this state was entered (see JSON representation of
8150 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8151 pub state_start_time: std::option::Option<wkt::Timestamp>,
8152
8153 /// Output only. Additional state information that includes
8154 /// status reported by the agent.
8155 pub substate: crate::model::cluster_status::Substate,
8156
8157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8158}
8159
8160impl ClusterStatus {
8161 /// Creates a new default instance.
8162 pub fn new() -> Self {
8163 std::default::Default::default()
8164 }
8165
8166 /// Sets the value of [state][crate::model::ClusterStatus::state].
8167 ///
8168 /// # Example
8169 /// ```ignore,no_run
8170 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
8171 /// use google_cloud_dataproc_v1::model::cluster_status::State;
8172 /// let x0 = ClusterStatus::new().set_state(State::Creating);
8173 /// let x1 = ClusterStatus::new().set_state(State::Running);
8174 /// let x2 = ClusterStatus::new().set_state(State::Error);
8175 /// ```
8176 pub fn set_state<T: std::convert::Into<crate::model::cluster_status::State>>(
8177 mut self,
8178 v: T,
8179 ) -> Self {
8180 self.state = v.into();
8181 self
8182 }
8183
8184 /// Sets the value of [detail][crate::model::ClusterStatus::detail].
8185 ///
8186 /// # Example
8187 /// ```ignore,no_run
8188 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
8189 /// let x = ClusterStatus::new().set_detail("example");
8190 /// ```
8191 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8192 self.detail = v.into();
8193 self
8194 }
8195
8196 /// Sets the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
8197 ///
8198 /// # Example
8199 /// ```ignore,no_run
8200 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
8201 /// use wkt::Timestamp;
8202 /// let x = ClusterStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
8203 /// ```
8204 pub fn set_state_start_time<T>(mut self, v: T) -> Self
8205 where
8206 T: std::convert::Into<wkt::Timestamp>,
8207 {
8208 self.state_start_time = std::option::Option::Some(v.into());
8209 self
8210 }
8211
8212 /// Sets or clears the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
8213 ///
8214 /// # Example
8215 /// ```ignore,no_run
8216 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
8217 /// use wkt::Timestamp;
8218 /// let x = ClusterStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
8219 /// let x = ClusterStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
8220 /// ```
8221 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8222 where
8223 T: std::convert::Into<wkt::Timestamp>,
8224 {
8225 self.state_start_time = v.map(|x| x.into());
8226 self
8227 }
8228
8229 /// Sets the value of [substate][crate::model::ClusterStatus::substate].
8230 ///
8231 /// # Example
8232 /// ```ignore,no_run
8233 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
8234 /// use google_cloud_dataproc_v1::model::cluster_status::Substate;
8235 /// let x0 = ClusterStatus::new().set_substate(Substate::Unhealthy);
8236 /// let x1 = ClusterStatus::new().set_substate(Substate::StaleStatus);
8237 /// ```
8238 pub fn set_substate<T: std::convert::Into<crate::model::cluster_status::Substate>>(
8239 mut self,
8240 v: T,
8241 ) -> Self {
8242 self.substate = v.into();
8243 self
8244 }
8245}
8246
8247impl wkt::message::Message for ClusterStatus {
8248 fn typename() -> &'static str {
8249 "type.googleapis.com/google.cloud.dataproc.v1.ClusterStatus"
8250 }
8251}
8252
8253/// Defines additional types related to [ClusterStatus].
8254pub mod cluster_status {
8255 #[allow(unused_imports)]
8256 use super::*;
8257
8258 /// The cluster state.
8259 ///
8260 /// # Working with unknown values
8261 ///
8262 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8263 /// additional enum variants at any time. Adding new variants is not considered
8264 /// a breaking change. Applications should write their code in anticipation of:
8265 ///
8266 /// - New values appearing in future releases of the client library, **and**
8267 /// - New values received dynamically, without application changes.
8268 ///
8269 /// Please consult the [Working with enums] section in the user guide for some
8270 /// guidelines.
8271 ///
8272 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8273 #[derive(Clone, Debug, PartialEq)]
8274 #[non_exhaustive]
8275 pub enum State {
8276 /// The cluster state is unknown.
8277 Unknown,
8278 /// The cluster is being created and set up. It is not ready for use.
8279 Creating,
8280 /// The cluster is currently running and healthy. It is ready for use.
8281 ///
8282 /// **Note:** The cluster state changes from "creating" to "running" status
8283 /// after the master node(s), first two primary worker nodes (and the last
8284 /// primary worker node if primary workers > 2) are running.
8285 Running,
8286 /// The cluster encountered an error. It is not ready for use.
8287 Error,
8288 /// The cluster has encountered an error while being updated. Jobs can
8289 /// be submitted to the cluster, but the cluster cannot be updated.
8290 ErrorDueToUpdate,
8291 /// The cluster is being deleted. It cannot be used.
8292 Deleting,
8293 /// The cluster is being updated. It continues to accept and process jobs.
8294 Updating,
8295 /// The cluster is being stopped. It cannot be used.
8296 Stopping,
8297 /// The cluster is currently stopped. It is not ready for use.
8298 Stopped,
8299 /// The cluster is being started. It is not ready for use.
8300 Starting,
8301 /// The cluster is being repaired. It is not ready for use.
8302 Repairing,
8303 /// If set, the enum was initialized with an unknown value.
8304 ///
8305 /// Applications can examine the value using [State::value] or
8306 /// [State::name].
8307 UnknownValue(state::UnknownValue),
8308 }
8309
8310 #[doc(hidden)]
8311 pub mod state {
8312 #[allow(unused_imports)]
8313 use super::*;
8314 #[derive(Clone, Debug, PartialEq)]
8315 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8316 }
8317
8318 impl State {
8319 /// Gets the enum value.
8320 ///
8321 /// Returns `None` if the enum contains an unknown value deserialized from
8322 /// the string representation of enums.
8323 pub fn value(&self) -> std::option::Option<i32> {
8324 match self {
8325 Self::Unknown => std::option::Option::Some(0),
8326 Self::Creating => std::option::Option::Some(1),
8327 Self::Running => std::option::Option::Some(2),
8328 Self::Error => std::option::Option::Some(3),
8329 Self::ErrorDueToUpdate => std::option::Option::Some(9),
8330 Self::Deleting => std::option::Option::Some(4),
8331 Self::Updating => std::option::Option::Some(5),
8332 Self::Stopping => std::option::Option::Some(6),
8333 Self::Stopped => std::option::Option::Some(7),
8334 Self::Starting => std::option::Option::Some(8),
8335 Self::Repairing => std::option::Option::Some(10),
8336 Self::UnknownValue(u) => u.0.value(),
8337 }
8338 }
8339
8340 /// Gets the enum value as a string.
8341 ///
8342 /// Returns `None` if the enum contains an unknown value deserialized from
8343 /// the integer representation of enums.
8344 pub fn name(&self) -> std::option::Option<&str> {
8345 match self {
8346 Self::Unknown => std::option::Option::Some("UNKNOWN"),
8347 Self::Creating => std::option::Option::Some("CREATING"),
8348 Self::Running => std::option::Option::Some("RUNNING"),
8349 Self::Error => std::option::Option::Some("ERROR"),
8350 Self::ErrorDueToUpdate => std::option::Option::Some("ERROR_DUE_TO_UPDATE"),
8351 Self::Deleting => std::option::Option::Some("DELETING"),
8352 Self::Updating => std::option::Option::Some("UPDATING"),
8353 Self::Stopping => std::option::Option::Some("STOPPING"),
8354 Self::Stopped => std::option::Option::Some("STOPPED"),
8355 Self::Starting => std::option::Option::Some("STARTING"),
8356 Self::Repairing => std::option::Option::Some("REPAIRING"),
8357 Self::UnknownValue(u) => u.0.name(),
8358 }
8359 }
8360 }
8361
8362 impl std::default::Default for State {
8363 fn default() -> Self {
8364 use std::convert::From;
8365 Self::from(0)
8366 }
8367 }
8368
8369 impl std::fmt::Display for State {
8370 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8371 wkt::internal::display_enum(f, self.name(), self.value())
8372 }
8373 }
8374
8375 impl std::convert::From<i32> for State {
8376 fn from(value: i32) -> Self {
8377 match value {
8378 0 => Self::Unknown,
8379 1 => Self::Creating,
8380 2 => Self::Running,
8381 3 => Self::Error,
8382 4 => Self::Deleting,
8383 5 => Self::Updating,
8384 6 => Self::Stopping,
8385 7 => Self::Stopped,
8386 8 => Self::Starting,
8387 9 => Self::ErrorDueToUpdate,
8388 10 => Self::Repairing,
8389 _ => Self::UnknownValue(state::UnknownValue(
8390 wkt::internal::UnknownEnumValue::Integer(value),
8391 )),
8392 }
8393 }
8394 }
8395
8396 impl std::convert::From<&str> for State {
8397 fn from(value: &str) -> Self {
8398 use std::string::ToString;
8399 match value {
8400 "UNKNOWN" => Self::Unknown,
8401 "CREATING" => Self::Creating,
8402 "RUNNING" => Self::Running,
8403 "ERROR" => Self::Error,
8404 "ERROR_DUE_TO_UPDATE" => Self::ErrorDueToUpdate,
8405 "DELETING" => Self::Deleting,
8406 "UPDATING" => Self::Updating,
8407 "STOPPING" => Self::Stopping,
8408 "STOPPED" => Self::Stopped,
8409 "STARTING" => Self::Starting,
8410 "REPAIRING" => Self::Repairing,
8411 _ => Self::UnknownValue(state::UnknownValue(
8412 wkt::internal::UnknownEnumValue::String(value.to_string()),
8413 )),
8414 }
8415 }
8416 }
8417
8418 impl serde::ser::Serialize for State {
8419 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8420 where
8421 S: serde::Serializer,
8422 {
8423 match self {
8424 Self::Unknown => serializer.serialize_i32(0),
8425 Self::Creating => serializer.serialize_i32(1),
8426 Self::Running => serializer.serialize_i32(2),
8427 Self::Error => serializer.serialize_i32(3),
8428 Self::ErrorDueToUpdate => serializer.serialize_i32(9),
8429 Self::Deleting => serializer.serialize_i32(4),
8430 Self::Updating => serializer.serialize_i32(5),
8431 Self::Stopping => serializer.serialize_i32(6),
8432 Self::Stopped => serializer.serialize_i32(7),
8433 Self::Starting => serializer.serialize_i32(8),
8434 Self::Repairing => serializer.serialize_i32(10),
8435 Self::UnknownValue(u) => u.0.serialize(serializer),
8436 }
8437 }
8438 }
8439
8440 impl<'de> serde::de::Deserialize<'de> for State {
8441 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8442 where
8443 D: serde::Deserializer<'de>,
8444 {
8445 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8446 ".google.cloud.dataproc.v1.ClusterStatus.State",
8447 ))
8448 }
8449 }
8450
8451 /// The cluster substate.
8452 ///
8453 /// # Working with unknown values
8454 ///
8455 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8456 /// additional enum variants at any time. Adding new variants is not considered
8457 /// a breaking change. Applications should write their code in anticipation of:
8458 ///
8459 /// - New values appearing in future releases of the client library, **and**
8460 /// - New values received dynamically, without application changes.
8461 ///
8462 /// Please consult the [Working with enums] section in the user guide for some
8463 /// guidelines.
8464 ///
8465 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8466 #[derive(Clone, Debug, PartialEq)]
8467 #[non_exhaustive]
8468 pub enum Substate {
8469 /// The cluster substate is unknown.
8470 Unspecified,
8471 /// The cluster is known to be in an unhealthy state
8472 /// (for example, critical daemons are not running or HDFS capacity is
8473 /// exhausted).
8474 ///
8475 /// Applies to RUNNING state.
8476 Unhealthy,
8477 /// The agent-reported status is out of date (may occur if
8478 /// Dataproc loses communication with Agent).
8479 ///
8480 /// Applies to RUNNING state.
8481 StaleStatus,
8482 /// If set, the enum was initialized with an unknown value.
8483 ///
8484 /// Applications can examine the value using [Substate::value] or
8485 /// [Substate::name].
8486 UnknownValue(substate::UnknownValue),
8487 }
8488
8489 #[doc(hidden)]
8490 pub mod substate {
8491 #[allow(unused_imports)]
8492 use super::*;
8493 #[derive(Clone, Debug, PartialEq)]
8494 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8495 }
8496
8497 impl Substate {
8498 /// Gets the enum value.
8499 ///
8500 /// Returns `None` if the enum contains an unknown value deserialized from
8501 /// the string representation of enums.
8502 pub fn value(&self) -> std::option::Option<i32> {
8503 match self {
8504 Self::Unspecified => std::option::Option::Some(0),
8505 Self::Unhealthy => std::option::Option::Some(1),
8506 Self::StaleStatus => std::option::Option::Some(2),
8507 Self::UnknownValue(u) => u.0.value(),
8508 }
8509 }
8510
8511 /// Gets the enum value as a string.
8512 ///
8513 /// Returns `None` if the enum contains an unknown value deserialized from
8514 /// the integer representation of enums.
8515 pub fn name(&self) -> std::option::Option<&str> {
8516 match self {
8517 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
8518 Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
8519 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
8520 Self::UnknownValue(u) => u.0.name(),
8521 }
8522 }
8523 }
8524
8525 impl std::default::Default for Substate {
8526 fn default() -> Self {
8527 use std::convert::From;
8528 Self::from(0)
8529 }
8530 }
8531
8532 impl std::fmt::Display for Substate {
8533 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8534 wkt::internal::display_enum(f, self.name(), self.value())
8535 }
8536 }
8537
8538 impl std::convert::From<i32> for Substate {
8539 fn from(value: i32) -> Self {
8540 match value {
8541 0 => Self::Unspecified,
8542 1 => Self::Unhealthy,
8543 2 => Self::StaleStatus,
8544 _ => Self::UnknownValue(substate::UnknownValue(
8545 wkt::internal::UnknownEnumValue::Integer(value),
8546 )),
8547 }
8548 }
8549 }
8550
8551 impl std::convert::From<&str> for Substate {
8552 fn from(value: &str) -> Self {
8553 use std::string::ToString;
8554 match value {
8555 "UNSPECIFIED" => Self::Unspecified,
8556 "UNHEALTHY" => Self::Unhealthy,
8557 "STALE_STATUS" => Self::StaleStatus,
8558 _ => Self::UnknownValue(substate::UnknownValue(
8559 wkt::internal::UnknownEnumValue::String(value.to_string()),
8560 )),
8561 }
8562 }
8563 }
8564
8565 impl serde::ser::Serialize for Substate {
8566 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8567 where
8568 S: serde::Serializer,
8569 {
8570 match self {
8571 Self::Unspecified => serializer.serialize_i32(0),
8572 Self::Unhealthy => serializer.serialize_i32(1),
8573 Self::StaleStatus => serializer.serialize_i32(2),
8574 Self::UnknownValue(u) => u.0.serialize(serializer),
8575 }
8576 }
8577 }
8578
8579 impl<'de> serde::de::Deserialize<'de> for Substate {
8580 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8581 where
8582 D: serde::Deserializer<'de>,
8583 {
8584 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
8585 ".google.cloud.dataproc.v1.ClusterStatus.Substate",
8586 ))
8587 }
8588 }
8589}
8590
8591/// Security related configuration, including encryption, Kerberos, etc.
8592#[derive(Clone, Default, PartialEq)]
8593#[non_exhaustive]
8594pub struct SecurityConfig {
8595 /// Optional. Kerberos related configuration.
8596 pub kerberos_config: std::option::Option<crate::model::KerberosConfig>,
8597
8598 /// Optional. Identity related configuration, including service account based
8599 /// secure multi-tenancy user mappings.
8600 pub identity_config: std::option::Option<crate::model::IdentityConfig>,
8601
8602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8603}
8604
8605impl SecurityConfig {
8606 /// Creates a new default instance.
8607 pub fn new() -> Self {
8608 std::default::Default::default()
8609 }
8610
8611 /// Sets the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
8612 ///
8613 /// # Example
8614 /// ```ignore,no_run
8615 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8616 /// use google_cloud_dataproc_v1::model::KerberosConfig;
8617 /// let x = SecurityConfig::new().set_kerberos_config(KerberosConfig::default()/* use setters */);
8618 /// ```
8619 pub fn set_kerberos_config<T>(mut self, v: T) -> Self
8620 where
8621 T: std::convert::Into<crate::model::KerberosConfig>,
8622 {
8623 self.kerberos_config = std::option::Option::Some(v.into());
8624 self
8625 }
8626
8627 /// Sets or clears the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
8628 ///
8629 /// # Example
8630 /// ```ignore,no_run
8631 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8632 /// use google_cloud_dataproc_v1::model::KerberosConfig;
8633 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(Some(KerberosConfig::default()/* use setters */));
8634 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(None::<KerberosConfig>);
8635 /// ```
8636 pub fn set_or_clear_kerberos_config<T>(mut self, v: std::option::Option<T>) -> Self
8637 where
8638 T: std::convert::Into<crate::model::KerberosConfig>,
8639 {
8640 self.kerberos_config = v.map(|x| x.into());
8641 self
8642 }
8643
8644 /// Sets the value of [identity_config][crate::model::SecurityConfig::identity_config].
8645 ///
8646 /// # Example
8647 /// ```ignore,no_run
8648 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8649 /// use google_cloud_dataproc_v1::model::IdentityConfig;
8650 /// let x = SecurityConfig::new().set_identity_config(IdentityConfig::default()/* use setters */);
8651 /// ```
8652 pub fn set_identity_config<T>(mut self, v: T) -> Self
8653 where
8654 T: std::convert::Into<crate::model::IdentityConfig>,
8655 {
8656 self.identity_config = std::option::Option::Some(v.into());
8657 self
8658 }
8659
8660 /// Sets or clears the value of [identity_config][crate::model::SecurityConfig::identity_config].
8661 ///
8662 /// # Example
8663 /// ```ignore,no_run
8664 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8665 /// use google_cloud_dataproc_v1::model::IdentityConfig;
8666 /// let x = SecurityConfig::new().set_or_clear_identity_config(Some(IdentityConfig::default()/* use setters */));
8667 /// let x = SecurityConfig::new().set_or_clear_identity_config(None::<IdentityConfig>);
8668 /// ```
8669 pub fn set_or_clear_identity_config<T>(mut self, v: std::option::Option<T>) -> Self
8670 where
8671 T: std::convert::Into<crate::model::IdentityConfig>,
8672 {
8673 self.identity_config = v.map(|x| x.into());
8674 self
8675 }
8676}
8677
8678impl wkt::message::Message for SecurityConfig {
8679 fn typename() -> &'static str {
8680 "type.googleapis.com/google.cloud.dataproc.v1.SecurityConfig"
8681 }
8682}
8683
8684/// Specifies Kerberos related configuration.
8685#[derive(Clone, Default, PartialEq)]
8686#[non_exhaustive]
8687pub struct KerberosConfig {
8688 /// Optional. Flag to indicate whether to Kerberize the cluster (default:
8689 /// false). Set this field to true to enable Kerberos on a cluster.
8690 pub enable_kerberos: bool,
8691
8692 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root
8693 /// principal password.
8694 pub root_principal_password_uri: std::string::String,
8695
8696 /// Optional. The URI of the KMS key used to encrypt sensitive
8697 /// files.
8698 pub kms_key_uri: std::string::String,
8699
8700 /// Optional. The Cloud Storage URI of the keystore file used for SSL
8701 /// encryption. If not provided, Dataproc will provide a self-signed
8702 /// certificate.
8703 pub keystore_uri: std::string::String,
8704
8705 /// Optional. The Cloud Storage URI of the truststore file used for SSL
8706 /// encryption. If not provided, Dataproc will provide a self-signed
8707 /// certificate.
8708 pub truststore_uri: std::string::String,
8709
8710 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8711 /// password to the user provided keystore. For the self-signed certificate,
8712 /// this password is generated by Dataproc.
8713 pub keystore_password_uri: std::string::String,
8714
8715 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8716 /// password to the user provided key. For the self-signed certificate, this
8717 /// password is generated by Dataproc.
8718 pub key_password_uri: std::string::String,
8719
8720 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8721 /// password to the user provided truststore. For the self-signed certificate,
8722 /// this password is generated by Dataproc.
8723 pub truststore_password_uri: std::string::String,
8724
8725 /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should
8726 /// the user enable cross realm trust.
8727 pub cross_realm_trust_realm: std::string::String,
8728
8729 /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross
8730 /// realm trust relationship.
8731 pub cross_realm_trust_kdc: std::string::String,
8732
8733 /// Optional. The admin server (IP or hostname) for the remote trusted realm in
8734 /// a cross realm trust relationship.
8735 pub cross_realm_trust_admin_server: std::string::String,
8736
8737 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8738 /// shared password between the on-cluster Kerberos realm and the remote
8739 /// trusted realm, in a cross realm trust relationship.
8740 pub cross_realm_trust_shared_password_uri: std::string::String,
8741
8742 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8743 /// master key of the KDC database.
8744 pub kdc_db_key_uri: std::string::String,
8745
8746 /// Optional. The lifetime of the ticket granting ticket, in hours.
8747 /// If not specified, or user specifies 0, then default value 10
8748 /// will be used.
8749 pub tgt_lifetime_hours: i32,
8750
8751 /// Optional. The name of the on-cluster Kerberos realm.
8752 /// If not specified, the uppercased domain of hostnames will be the realm.
8753 pub realm: std::string::String,
8754
8755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8756}
8757
8758impl KerberosConfig {
8759 /// Creates a new default instance.
8760 pub fn new() -> Self {
8761 std::default::Default::default()
8762 }
8763
8764 /// Sets the value of [enable_kerberos][crate::model::KerberosConfig::enable_kerberos].
8765 ///
8766 /// # Example
8767 /// ```ignore,no_run
8768 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8769 /// let x = KerberosConfig::new().set_enable_kerberos(true);
8770 /// ```
8771 pub fn set_enable_kerberos<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8772 self.enable_kerberos = v.into();
8773 self
8774 }
8775
8776 /// Sets the value of [root_principal_password_uri][crate::model::KerberosConfig::root_principal_password_uri].
8777 ///
8778 /// # Example
8779 /// ```ignore,no_run
8780 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8781 /// let x = KerberosConfig::new().set_root_principal_password_uri("example");
8782 /// ```
8783 pub fn set_root_principal_password_uri<T: std::convert::Into<std::string::String>>(
8784 mut self,
8785 v: T,
8786 ) -> Self {
8787 self.root_principal_password_uri = v.into();
8788 self
8789 }
8790
8791 /// Sets the value of [kms_key_uri][crate::model::KerberosConfig::kms_key_uri].
8792 ///
8793 /// # Example
8794 /// ```ignore,no_run
8795 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8796 /// let x = KerberosConfig::new().set_kms_key_uri("example");
8797 /// ```
8798 pub fn set_kms_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8799 self.kms_key_uri = v.into();
8800 self
8801 }
8802
8803 /// Sets the value of [keystore_uri][crate::model::KerberosConfig::keystore_uri].
8804 ///
8805 /// # Example
8806 /// ```ignore,no_run
8807 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8808 /// let x = KerberosConfig::new().set_keystore_uri("example");
8809 /// ```
8810 pub fn set_keystore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8811 self.keystore_uri = v.into();
8812 self
8813 }
8814
8815 /// Sets the value of [truststore_uri][crate::model::KerberosConfig::truststore_uri].
8816 ///
8817 /// # Example
8818 /// ```ignore,no_run
8819 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8820 /// let x = KerberosConfig::new().set_truststore_uri("example");
8821 /// ```
8822 pub fn set_truststore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8823 self.truststore_uri = v.into();
8824 self
8825 }
8826
8827 /// Sets the value of [keystore_password_uri][crate::model::KerberosConfig::keystore_password_uri].
8828 ///
8829 /// # Example
8830 /// ```ignore,no_run
8831 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8832 /// let x = KerberosConfig::new().set_keystore_password_uri("example");
8833 /// ```
8834 pub fn set_keystore_password_uri<T: std::convert::Into<std::string::String>>(
8835 mut self,
8836 v: T,
8837 ) -> Self {
8838 self.keystore_password_uri = v.into();
8839 self
8840 }
8841
8842 /// Sets the value of [key_password_uri][crate::model::KerberosConfig::key_password_uri].
8843 ///
8844 /// # Example
8845 /// ```ignore,no_run
8846 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8847 /// let x = KerberosConfig::new().set_key_password_uri("example");
8848 /// ```
8849 pub fn set_key_password_uri<T: std::convert::Into<std::string::String>>(
8850 mut self,
8851 v: T,
8852 ) -> Self {
8853 self.key_password_uri = v.into();
8854 self
8855 }
8856
8857 /// Sets the value of [truststore_password_uri][crate::model::KerberosConfig::truststore_password_uri].
8858 ///
8859 /// # Example
8860 /// ```ignore,no_run
8861 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8862 /// let x = KerberosConfig::new().set_truststore_password_uri("example");
8863 /// ```
8864 pub fn set_truststore_password_uri<T: std::convert::Into<std::string::String>>(
8865 mut self,
8866 v: T,
8867 ) -> Self {
8868 self.truststore_password_uri = v.into();
8869 self
8870 }
8871
8872 /// Sets the value of [cross_realm_trust_realm][crate::model::KerberosConfig::cross_realm_trust_realm].
8873 ///
8874 /// # Example
8875 /// ```ignore,no_run
8876 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8877 /// let x = KerberosConfig::new().set_cross_realm_trust_realm("example");
8878 /// ```
8879 pub fn set_cross_realm_trust_realm<T: std::convert::Into<std::string::String>>(
8880 mut self,
8881 v: T,
8882 ) -> Self {
8883 self.cross_realm_trust_realm = v.into();
8884 self
8885 }
8886
8887 /// Sets the value of [cross_realm_trust_kdc][crate::model::KerberosConfig::cross_realm_trust_kdc].
8888 ///
8889 /// # Example
8890 /// ```ignore,no_run
8891 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8892 /// let x = KerberosConfig::new().set_cross_realm_trust_kdc("example");
8893 /// ```
8894 pub fn set_cross_realm_trust_kdc<T: std::convert::Into<std::string::String>>(
8895 mut self,
8896 v: T,
8897 ) -> Self {
8898 self.cross_realm_trust_kdc = v.into();
8899 self
8900 }
8901
8902 /// Sets the value of [cross_realm_trust_admin_server][crate::model::KerberosConfig::cross_realm_trust_admin_server].
8903 ///
8904 /// # Example
8905 /// ```ignore,no_run
8906 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8907 /// let x = KerberosConfig::new().set_cross_realm_trust_admin_server("example");
8908 /// ```
8909 pub fn set_cross_realm_trust_admin_server<T: std::convert::Into<std::string::String>>(
8910 mut self,
8911 v: T,
8912 ) -> Self {
8913 self.cross_realm_trust_admin_server = v.into();
8914 self
8915 }
8916
8917 /// Sets the value of [cross_realm_trust_shared_password_uri][crate::model::KerberosConfig::cross_realm_trust_shared_password_uri].
8918 ///
8919 /// # Example
8920 /// ```ignore,no_run
8921 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8922 /// let x = KerberosConfig::new().set_cross_realm_trust_shared_password_uri("example");
8923 /// ```
8924 pub fn set_cross_realm_trust_shared_password_uri<T: std::convert::Into<std::string::String>>(
8925 mut self,
8926 v: T,
8927 ) -> Self {
8928 self.cross_realm_trust_shared_password_uri = v.into();
8929 self
8930 }
8931
8932 /// Sets the value of [kdc_db_key_uri][crate::model::KerberosConfig::kdc_db_key_uri].
8933 ///
8934 /// # Example
8935 /// ```ignore,no_run
8936 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8937 /// let x = KerberosConfig::new().set_kdc_db_key_uri("example");
8938 /// ```
8939 pub fn set_kdc_db_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8940 self.kdc_db_key_uri = v.into();
8941 self
8942 }
8943
8944 /// Sets the value of [tgt_lifetime_hours][crate::model::KerberosConfig::tgt_lifetime_hours].
8945 ///
8946 /// # Example
8947 /// ```ignore,no_run
8948 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8949 /// let x = KerberosConfig::new().set_tgt_lifetime_hours(42);
8950 /// ```
8951 pub fn set_tgt_lifetime_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8952 self.tgt_lifetime_hours = v.into();
8953 self
8954 }
8955
8956 /// Sets the value of [realm][crate::model::KerberosConfig::realm].
8957 ///
8958 /// # Example
8959 /// ```ignore,no_run
8960 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8961 /// let x = KerberosConfig::new().set_realm("example");
8962 /// ```
8963 pub fn set_realm<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8964 self.realm = v.into();
8965 self
8966 }
8967}
8968
8969impl wkt::message::Message for KerberosConfig {
8970 fn typename() -> &'static str {
8971 "type.googleapis.com/google.cloud.dataproc.v1.KerberosConfig"
8972 }
8973}
8974
8975/// Identity related configuration, including service account based
8976/// secure multi-tenancy user mappings.
8977#[derive(Clone, Default, PartialEq)]
8978#[non_exhaustive]
8979pub struct IdentityConfig {
8980 /// Required. Map of user to service account.
8981 pub user_service_account_mapping:
8982 std::collections::HashMap<std::string::String, std::string::String>,
8983
8984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8985}
8986
8987impl IdentityConfig {
8988 /// Creates a new default instance.
8989 pub fn new() -> Self {
8990 std::default::Default::default()
8991 }
8992
8993 /// Sets the value of [user_service_account_mapping][crate::model::IdentityConfig::user_service_account_mapping].
8994 ///
8995 /// # Example
8996 /// ```ignore,no_run
8997 /// # use google_cloud_dataproc_v1::model::IdentityConfig;
8998 /// let x = IdentityConfig::new().set_user_service_account_mapping([
8999 /// ("key0", "abc"),
9000 /// ("key1", "xyz"),
9001 /// ]);
9002 /// ```
9003 pub fn set_user_service_account_mapping<T, K, V>(mut self, v: T) -> Self
9004 where
9005 T: std::iter::IntoIterator<Item = (K, V)>,
9006 K: std::convert::Into<std::string::String>,
9007 V: std::convert::Into<std::string::String>,
9008 {
9009 use std::iter::Iterator;
9010 self.user_service_account_mapping =
9011 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9012 self
9013 }
9014}
9015
9016impl wkt::message::Message for IdentityConfig {
9017 fn typename() -> &'static str {
9018 "type.googleapis.com/google.cloud.dataproc.v1.IdentityConfig"
9019 }
9020}
9021
9022/// Specifies the selection and config of software inside the cluster.
9023#[derive(Clone, Default, PartialEq)]
9024#[non_exhaustive]
9025pub struct SoftwareConfig {
9026 /// Optional. The version of software inside the cluster. It must be one of the
9027 /// supported [Dataproc
9028 /// Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported-dataproc-image-versions),
9029 /// such as "1.2" (including a subminor version, such as "1.2.29"), or the
9030 /// ["preview"
9031 /// version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
9032 /// If unspecified, it defaults to the latest Debian version.
9033 pub image_version: std::string::String,
9034
9035 /// Optional. The properties to set on daemon config files.
9036 ///
9037 /// Property keys are specified in `prefix:property` format, for example
9038 /// `core:hadoop.tmp.dir`. The following are supported prefixes
9039 /// and their mappings:
9040 ///
9041 /// * capacity-scheduler: `capacity-scheduler.xml`
9042 /// * core: `core-site.xml`
9043 /// * distcp: `distcp-default.xml`
9044 /// * hdfs: `hdfs-site.xml`
9045 /// * hive: `hive-site.xml`
9046 /// * mapred: `mapred-site.xml`
9047 /// * pig: `pig.properties`
9048 /// * spark: `spark-defaults.conf`
9049 /// * yarn: `yarn-site.xml`
9050 ///
9051 /// For more information, see [Cluster
9052 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
9053 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
9054
9055 /// Optional. The set of components to activate on the cluster.
9056 pub optional_components: std::vec::Vec<crate::model::Component>,
9057
9058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9059}
9060
9061impl SoftwareConfig {
9062 /// Creates a new default instance.
9063 pub fn new() -> Self {
9064 std::default::Default::default()
9065 }
9066
9067 /// Sets the value of [image_version][crate::model::SoftwareConfig::image_version].
9068 ///
9069 /// # Example
9070 /// ```ignore,no_run
9071 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
9072 /// let x = SoftwareConfig::new().set_image_version("example");
9073 /// ```
9074 pub fn set_image_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9075 self.image_version = v.into();
9076 self
9077 }
9078
9079 /// Sets the value of [properties][crate::model::SoftwareConfig::properties].
9080 ///
9081 /// # Example
9082 /// ```ignore,no_run
9083 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
9084 /// let x = SoftwareConfig::new().set_properties([
9085 /// ("key0", "abc"),
9086 /// ("key1", "xyz"),
9087 /// ]);
9088 /// ```
9089 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
9090 where
9091 T: std::iter::IntoIterator<Item = (K, V)>,
9092 K: std::convert::Into<std::string::String>,
9093 V: std::convert::Into<std::string::String>,
9094 {
9095 use std::iter::Iterator;
9096 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9097 self
9098 }
9099
9100 /// Sets the value of [optional_components][crate::model::SoftwareConfig::optional_components].
9101 ///
9102 /// # Example
9103 /// ```ignore,no_run
9104 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
9105 /// use google_cloud_dataproc_v1::model::Component;
9106 /// let x = SoftwareConfig::new().set_optional_components([
9107 /// Component::Anaconda,
9108 /// Component::Delta,
9109 /// Component::Docker,
9110 /// ]);
9111 /// ```
9112 pub fn set_optional_components<T, V>(mut self, v: T) -> Self
9113 where
9114 T: std::iter::IntoIterator<Item = V>,
9115 V: std::convert::Into<crate::model::Component>,
9116 {
9117 use std::iter::Iterator;
9118 self.optional_components = v.into_iter().map(|i| i.into()).collect();
9119 self
9120 }
9121}
9122
9123impl wkt::message::Message for SoftwareConfig {
9124 fn typename() -> &'static str {
9125 "type.googleapis.com/google.cloud.dataproc.v1.SoftwareConfig"
9126 }
9127}
9128
9129/// Specifies the cluster auto-delete schedule configuration.
9130#[derive(Clone, Default, PartialEq)]
9131#[non_exhaustive]
9132pub struct LifecycleConfig {
9133 /// Optional. The duration to keep the cluster alive while idling (when no jobs
9134 /// are running). Passing this threshold will cause the cluster to be
9135 /// deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON
9136 /// representation of
9137 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9138 pub idle_delete_ttl: std::option::Option<wkt::Duration>,
9139
9140 /// Optional. The duration to keep the cluster started while idling (when no
9141 /// jobs are running). Passing this threshold will cause the cluster to be
9142 /// stopped. Minimum value is 5 minutes; maximum value is 14 days (see JSON
9143 /// representation of
9144 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9145 pub idle_stop_ttl: std::option::Option<wkt::Duration>,
9146
9147 /// Output only. The time when cluster became idle (most recent job finished)
9148 /// and became eligible for deletion due to idleness (see JSON representation
9149 /// of
9150 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9151 pub idle_start_time: std::option::Option<wkt::Timestamp>,
9152
9153 /// Either the exact time the cluster should be deleted at or
9154 /// the cluster maximum age.
9155 pub ttl: std::option::Option<crate::model::lifecycle_config::Ttl>,
9156
9157 /// Either the exact time the cluster should be stopped at or
9158 /// the cluster maximum age.
9159 pub stop_ttl: std::option::Option<crate::model::lifecycle_config::StopTtl>,
9160
9161 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9162}
9163
9164impl LifecycleConfig {
9165 /// Creates a new default instance.
9166 pub fn new() -> Self {
9167 std::default::Default::default()
9168 }
9169
9170 /// Sets the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
9171 ///
9172 /// # Example
9173 /// ```ignore,no_run
9174 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9175 /// use wkt::Duration;
9176 /// let x = LifecycleConfig::new().set_idle_delete_ttl(Duration::default()/* use setters */);
9177 /// ```
9178 pub fn set_idle_delete_ttl<T>(mut self, v: T) -> Self
9179 where
9180 T: std::convert::Into<wkt::Duration>,
9181 {
9182 self.idle_delete_ttl = std::option::Option::Some(v.into());
9183 self
9184 }
9185
9186 /// Sets or clears the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
9187 ///
9188 /// # Example
9189 /// ```ignore,no_run
9190 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9191 /// use wkt::Duration;
9192 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(Some(Duration::default()/* use setters */));
9193 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(None::<Duration>);
9194 /// ```
9195 pub fn set_or_clear_idle_delete_ttl<T>(mut self, v: std::option::Option<T>) -> Self
9196 where
9197 T: std::convert::Into<wkt::Duration>,
9198 {
9199 self.idle_delete_ttl = v.map(|x| x.into());
9200 self
9201 }
9202
9203 /// Sets the value of [idle_stop_ttl][crate::model::LifecycleConfig::idle_stop_ttl].
9204 ///
9205 /// # Example
9206 /// ```ignore,no_run
9207 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9208 /// use wkt::Duration;
9209 /// let x = LifecycleConfig::new().set_idle_stop_ttl(Duration::default()/* use setters */);
9210 /// ```
9211 pub fn set_idle_stop_ttl<T>(mut self, v: T) -> Self
9212 where
9213 T: std::convert::Into<wkt::Duration>,
9214 {
9215 self.idle_stop_ttl = std::option::Option::Some(v.into());
9216 self
9217 }
9218
9219 /// Sets or clears the value of [idle_stop_ttl][crate::model::LifecycleConfig::idle_stop_ttl].
9220 ///
9221 /// # Example
9222 /// ```ignore,no_run
9223 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9224 /// use wkt::Duration;
9225 /// let x = LifecycleConfig::new().set_or_clear_idle_stop_ttl(Some(Duration::default()/* use setters */));
9226 /// let x = LifecycleConfig::new().set_or_clear_idle_stop_ttl(None::<Duration>);
9227 /// ```
9228 pub fn set_or_clear_idle_stop_ttl<T>(mut self, v: std::option::Option<T>) -> Self
9229 where
9230 T: std::convert::Into<wkt::Duration>,
9231 {
9232 self.idle_stop_ttl = v.map(|x| x.into());
9233 self
9234 }
9235
9236 /// Sets the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
9237 ///
9238 /// # Example
9239 /// ```ignore,no_run
9240 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9241 /// use wkt::Timestamp;
9242 /// let x = LifecycleConfig::new().set_idle_start_time(Timestamp::default()/* use setters */);
9243 /// ```
9244 pub fn set_idle_start_time<T>(mut self, v: T) -> Self
9245 where
9246 T: std::convert::Into<wkt::Timestamp>,
9247 {
9248 self.idle_start_time = std::option::Option::Some(v.into());
9249 self
9250 }
9251
9252 /// Sets or clears the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
9253 ///
9254 /// # Example
9255 /// ```ignore,no_run
9256 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9257 /// use wkt::Timestamp;
9258 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(Some(Timestamp::default()/* use setters */));
9259 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(None::<Timestamp>);
9260 /// ```
9261 pub fn set_or_clear_idle_start_time<T>(mut self, v: std::option::Option<T>) -> Self
9262 where
9263 T: std::convert::Into<wkt::Timestamp>,
9264 {
9265 self.idle_start_time = v.map(|x| x.into());
9266 self
9267 }
9268
9269 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl].
9270 ///
9271 /// Note that all the setters affecting `ttl` are mutually
9272 /// exclusive.
9273 ///
9274 /// # Example
9275 /// ```ignore,no_run
9276 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9277 /// use wkt::Timestamp;
9278 /// let x = LifecycleConfig::new().set_ttl(Some(
9279 /// google_cloud_dataproc_v1::model::lifecycle_config::Ttl::AutoDeleteTime(Timestamp::default().into())));
9280 /// ```
9281 pub fn set_ttl<
9282 T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::Ttl>>,
9283 >(
9284 mut self,
9285 v: T,
9286 ) -> Self {
9287 self.ttl = v.into();
9288 self
9289 }
9290
9291 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
9292 /// if it holds a `AutoDeleteTime`, `None` if the field is not set or
9293 /// holds a different branch.
9294 pub fn auto_delete_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
9295 #[allow(unreachable_patterns)]
9296 self.ttl.as_ref().and_then(|v| match v {
9297 crate::model::lifecycle_config::Ttl::AutoDeleteTime(v) => std::option::Option::Some(v),
9298 _ => std::option::Option::None,
9299 })
9300 }
9301
9302 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
9303 /// to hold a `AutoDeleteTime`.
9304 ///
9305 /// Note that all the setters affecting `ttl` are
9306 /// mutually exclusive.
9307 ///
9308 /// # Example
9309 /// ```ignore,no_run
9310 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9311 /// use wkt::Timestamp;
9312 /// let x = LifecycleConfig::new().set_auto_delete_time(Timestamp::default()/* use setters */);
9313 /// assert!(x.auto_delete_time().is_some());
9314 /// assert!(x.auto_delete_ttl().is_none());
9315 /// ```
9316 pub fn set_auto_delete_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
9317 mut self,
9318 v: T,
9319 ) -> Self {
9320 self.ttl = std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTime(
9321 v.into(),
9322 ));
9323 self
9324 }
9325
9326 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
9327 /// if it holds a `AutoDeleteTtl`, `None` if the field is not set or
9328 /// holds a different branch.
9329 pub fn auto_delete_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
9330 #[allow(unreachable_patterns)]
9331 self.ttl.as_ref().and_then(|v| match v {
9332 crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v) => std::option::Option::Some(v),
9333 _ => std::option::Option::None,
9334 })
9335 }
9336
9337 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
9338 /// to hold a `AutoDeleteTtl`.
9339 ///
9340 /// Note that all the setters affecting `ttl` are
9341 /// mutually exclusive.
9342 ///
9343 /// # Example
9344 /// ```ignore,no_run
9345 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9346 /// use wkt::Duration;
9347 /// let x = LifecycleConfig::new().set_auto_delete_ttl(Duration::default()/* use setters */);
9348 /// assert!(x.auto_delete_ttl().is_some());
9349 /// assert!(x.auto_delete_time().is_none());
9350 /// ```
9351 pub fn set_auto_delete_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
9352 mut self,
9353 v: T,
9354 ) -> Self {
9355 self.ttl =
9356 std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v.into()));
9357 self
9358 }
9359
9360 /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl].
9361 ///
9362 /// Note that all the setters affecting `stop_ttl` are mutually
9363 /// exclusive.
9364 ///
9365 /// # Example
9366 /// ```ignore,no_run
9367 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9368 /// use wkt::Timestamp;
9369 /// let x = LifecycleConfig::new().set_stop_ttl(Some(
9370 /// google_cloud_dataproc_v1::model::lifecycle_config::StopTtl::AutoStopTime(Timestamp::default().into())));
9371 /// ```
9372 pub fn set_stop_ttl<
9373 T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::StopTtl>>,
9374 >(
9375 mut self,
9376 v: T,
9377 ) -> Self {
9378 self.stop_ttl = v.into();
9379 self
9380 }
9381
9382 /// The value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
9383 /// if it holds a `AutoStopTime`, `None` if the field is not set or
9384 /// holds a different branch.
9385 pub fn auto_stop_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
9386 #[allow(unreachable_patterns)]
9387 self.stop_ttl.as_ref().and_then(|v| match v {
9388 crate::model::lifecycle_config::StopTtl::AutoStopTime(v) => {
9389 std::option::Option::Some(v)
9390 }
9391 _ => std::option::Option::None,
9392 })
9393 }
9394
9395 /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
9396 /// to hold a `AutoStopTime`.
9397 ///
9398 /// Note that all the setters affecting `stop_ttl` are
9399 /// mutually exclusive.
9400 ///
9401 /// # Example
9402 /// ```ignore,no_run
9403 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9404 /// use wkt::Timestamp;
9405 /// let x = LifecycleConfig::new().set_auto_stop_time(Timestamp::default()/* use setters */);
9406 /// assert!(x.auto_stop_time().is_some());
9407 /// assert!(x.auto_stop_ttl().is_none());
9408 /// ```
9409 pub fn set_auto_stop_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
9410 mut self,
9411 v: T,
9412 ) -> Self {
9413 self.stop_ttl = std::option::Option::Some(
9414 crate::model::lifecycle_config::StopTtl::AutoStopTime(v.into()),
9415 );
9416 self
9417 }
9418
9419 /// The value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
9420 /// if it holds a `AutoStopTtl`, `None` if the field is not set or
9421 /// holds a different branch.
9422 pub fn auto_stop_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
9423 #[allow(unreachable_patterns)]
9424 self.stop_ttl.as_ref().and_then(|v| match v {
9425 crate::model::lifecycle_config::StopTtl::AutoStopTtl(v) => std::option::Option::Some(v),
9426 _ => std::option::Option::None,
9427 })
9428 }
9429
9430 /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
9431 /// to hold a `AutoStopTtl`.
9432 ///
9433 /// Note that all the setters affecting `stop_ttl` are
9434 /// mutually exclusive.
9435 ///
9436 /// # Example
9437 /// ```ignore,no_run
9438 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
9439 /// use wkt::Duration;
9440 /// let x = LifecycleConfig::new().set_auto_stop_ttl(Duration::default()/* use setters */);
9441 /// assert!(x.auto_stop_ttl().is_some());
9442 /// assert!(x.auto_stop_time().is_none());
9443 /// ```
9444 pub fn set_auto_stop_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
9445 mut self,
9446 v: T,
9447 ) -> Self {
9448 self.stop_ttl = std::option::Option::Some(
9449 crate::model::lifecycle_config::StopTtl::AutoStopTtl(v.into()),
9450 );
9451 self
9452 }
9453}
9454
9455impl wkt::message::Message for LifecycleConfig {
9456 fn typename() -> &'static str {
9457 "type.googleapis.com/google.cloud.dataproc.v1.LifecycleConfig"
9458 }
9459}
9460
9461/// Defines additional types related to [LifecycleConfig].
9462pub mod lifecycle_config {
9463 #[allow(unused_imports)]
9464 use super::*;
9465
9466 /// Either the exact time the cluster should be deleted at or
9467 /// the cluster maximum age.
9468 #[derive(Clone, Debug, PartialEq)]
9469 #[non_exhaustive]
9470 pub enum Ttl {
9471 /// Optional. The time when cluster will be auto-deleted (see JSON
9472 /// representation of
9473 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9474 AutoDeleteTime(std::boxed::Box<wkt::Timestamp>),
9475 /// Optional. The lifetime duration of cluster. The cluster will be
9476 /// auto-deleted at the end of this period. Minimum value is 10 minutes;
9477 /// maximum value is 14 days (see JSON representation of
9478 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9479 AutoDeleteTtl(std::boxed::Box<wkt::Duration>),
9480 }
9481
9482 /// Either the exact time the cluster should be stopped at or
9483 /// the cluster maximum age.
9484 #[derive(Clone, Debug, PartialEq)]
9485 #[non_exhaustive]
9486 pub enum StopTtl {
9487 /// Optional. The time when cluster will be auto-stopped (see JSON
9488 /// representation of
9489 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9490 AutoStopTime(std::boxed::Box<wkt::Timestamp>),
9491 /// Optional. The lifetime duration of the cluster. The cluster will be
9492 /// auto-stopped at the end of this period, calculated from the time of
9493 /// submission of the create or update cluster request. Minimum value is 10
9494 /// minutes; maximum value is 14 days (see JSON representation of
9495 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9496 AutoStopTtl(std::boxed::Box<wkt::Duration>),
9497 }
9498}
9499
9500/// Specifies a Metastore configuration.
9501#[derive(Clone, Default, PartialEq)]
9502#[non_exhaustive]
9503pub struct MetastoreConfig {
9504 /// Required. Resource name of an existing Dataproc Metastore service.
9505 ///
9506 /// Example:
9507 ///
9508 /// * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]`
9509 pub dataproc_metastore_service: std::string::String,
9510
9511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9512}
9513
9514impl MetastoreConfig {
9515 /// Creates a new default instance.
9516 pub fn new() -> Self {
9517 std::default::Default::default()
9518 }
9519
9520 /// Sets the value of [dataproc_metastore_service][crate::model::MetastoreConfig::dataproc_metastore_service].
9521 ///
9522 /// # Example
9523 /// ```ignore,no_run
9524 /// # use google_cloud_dataproc_v1::model::MetastoreConfig;
9525 /// let x = MetastoreConfig::new().set_dataproc_metastore_service("example");
9526 /// ```
9527 pub fn set_dataproc_metastore_service<T: std::convert::Into<std::string::String>>(
9528 mut self,
9529 v: T,
9530 ) -> Self {
9531 self.dataproc_metastore_service = v.into();
9532 self
9533 }
9534}
9535
9536impl wkt::message::Message for MetastoreConfig {
9537 fn typename() -> &'static str {
9538 "type.googleapis.com/google.cloud.dataproc.v1.MetastoreConfig"
9539 }
9540}
9541
9542/// Contains cluster daemon metrics, such as HDFS and YARN stats.
9543///
9544/// **Beta Feature**: This report is available for testing purposes only. It may
9545/// be changed before final release.
9546#[derive(Clone, Default, PartialEq)]
9547#[non_exhaustive]
9548pub struct ClusterMetrics {
9549 /// The HDFS metrics.
9550 pub hdfs_metrics: std::collections::HashMap<std::string::String, i64>,
9551
9552 /// YARN metrics.
9553 pub yarn_metrics: std::collections::HashMap<std::string::String, i64>,
9554
9555 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9556}
9557
9558impl ClusterMetrics {
9559 /// Creates a new default instance.
9560 pub fn new() -> Self {
9561 std::default::Default::default()
9562 }
9563
9564 /// Sets the value of [hdfs_metrics][crate::model::ClusterMetrics::hdfs_metrics].
9565 ///
9566 /// # Example
9567 /// ```ignore,no_run
9568 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
9569 /// let x = ClusterMetrics::new().set_hdfs_metrics([
9570 /// ("key0", 123),
9571 /// ("key1", 456),
9572 /// ]);
9573 /// ```
9574 pub fn set_hdfs_metrics<T, K, V>(mut self, v: T) -> Self
9575 where
9576 T: std::iter::IntoIterator<Item = (K, V)>,
9577 K: std::convert::Into<std::string::String>,
9578 V: std::convert::Into<i64>,
9579 {
9580 use std::iter::Iterator;
9581 self.hdfs_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9582 self
9583 }
9584
9585 /// Sets the value of [yarn_metrics][crate::model::ClusterMetrics::yarn_metrics].
9586 ///
9587 /// # Example
9588 /// ```ignore,no_run
9589 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
9590 /// let x = ClusterMetrics::new().set_yarn_metrics([
9591 /// ("key0", 123),
9592 /// ("key1", 456),
9593 /// ]);
9594 /// ```
9595 pub fn set_yarn_metrics<T, K, V>(mut self, v: T) -> Self
9596 where
9597 T: std::iter::IntoIterator<Item = (K, V)>,
9598 K: std::convert::Into<std::string::String>,
9599 V: std::convert::Into<i64>,
9600 {
9601 use std::iter::Iterator;
9602 self.yarn_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9603 self
9604 }
9605}
9606
9607impl wkt::message::Message for ClusterMetrics {
9608 fn typename() -> &'static str {
9609 "type.googleapis.com/google.cloud.dataproc.v1.ClusterMetrics"
9610 }
9611}
9612
9613/// Dataproc metric config.
9614#[derive(Clone, Default, PartialEq)]
9615#[non_exhaustive]
9616pub struct DataprocMetricConfig {
9617 /// Required. Metrics sources to enable.
9618 pub metrics: std::vec::Vec<crate::model::dataproc_metric_config::Metric>,
9619
9620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9621}
9622
9623impl DataprocMetricConfig {
9624 /// Creates a new default instance.
9625 pub fn new() -> Self {
9626 std::default::Default::default()
9627 }
9628
9629 /// Sets the value of [metrics][crate::model::DataprocMetricConfig::metrics].
9630 ///
9631 /// # Example
9632 /// ```ignore,no_run
9633 /// # use google_cloud_dataproc_v1::model::DataprocMetricConfig;
9634 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
9635 /// let x = DataprocMetricConfig::new()
9636 /// .set_metrics([
9637 /// Metric::default()/* use setters */,
9638 /// Metric::default()/* use (different) setters */,
9639 /// ]);
9640 /// ```
9641 pub fn set_metrics<T, V>(mut self, v: T) -> Self
9642 where
9643 T: std::iter::IntoIterator<Item = V>,
9644 V: std::convert::Into<crate::model::dataproc_metric_config::Metric>,
9645 {
9646 use std::iter::Iterator;
9647 self.metrics = v.into_iter().map(|i| i.into()).collect();
9648 self
9649 }
9650}
9651
9652impl wkt::message::Message for DataprocMetricConfig {
9653 fn typename() -> &'static str {
9654 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig"
9655 }
9656}
9657
9658/// Defines additional types related to [DataprocMetricConfig].
9659pub mod dataproc_metric_config {
9660 #[allow(unused_imports)]
9661 use super::*;
9662
9663 /// A Dataproc custom metric.
9664 #[derive(Clone, Default, PartialEq)]
9665 #[non_exhaustive]
9666 pub struct Metric {
9667 /// Required. A standard set of metrics is collected unless `metricOverrides`
9668 /// are specified for the metric source (see [Custom metrics]
9669 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
9670 /// for more information).
9671 pub metric_source: crate::model::dataproc_metric_config::MetricSource,
9672
9673 /// Optional. Specify one or more [Custom metrics]
9674 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
9675 /// to collect for the metric course (for the `SPARK` metric source (any
9676 /// [Spark metric]
9677 /// (<https://spark.apache.org/docs/latest/monitoring.html#metrics>) can be
9678 /// specified).
9679 ///
9680 /// Provide metrics in the following format:
9681 /// \<code\>\<var\>METRIC_SOURCE\</var\>:\<var\>INSTANCE\</var\>:\<var\>GROUP\</var\>:\<var\>METRIC\</var\>\</code\>
9682 /// Use camelcase as appropriate.
9683 ///
9684 /// Examples:
9685 ///
9686 /// ```norust
9687 /// yarn:ResourceManager:QueueMetrics:AppsCompleted
9688 /// spark:driver:DAGScheduler:job.allJobs
9689 /// sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed
9690 /// hiveserver2:JVM:Memory:NonHeapMemoryUsage.used
9691 /// ```
9692 ///
9693 /// Notes:
9694 ///
9695 /// * Only the specified overridden metrics are collected for the
9696 /// metric source. For example, if one or more `spark:executive` metrics
9697 /// are listed as metric overrides, other `SPARK` metrics are not
9698 /// collected. The collection of the metrics for other enabled custom
9699 /// metric sources is unaffected. For example, if both `SPARK` andd `YARN`
9700 /// metric sources are enabled, and overrides are provided for Spark
9701 /// metrics only, all YARN metrics are collected.
9702 pub metric_overrides: std::vec::Vec<std::string::String>,
9703
9704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9705 }
9706
9707 impl Metric {
9708 /// Creates a new default instance.
9709 pub fn new() -> Self {
9710 std::default::Default::default()
9711 }
9712
9713 /// Sets the value of [metric_source][crate::model::dataproc_metric_config::Metric::metric_source].
9714 ///
9715 /// # Example
9716 /// ```ignore,no_run
9717 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
9718 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::MetricSource;
9719 /// let x0 = Metric::new().set_metric_source(MetricSource::MonitoringAgentDefaults);
9720 /// let x1 = Metric::new().set_metric_source(MetricSource::Hdfs);
9721 /// let x2 = Metric::new().set_metric_source(MetricSource::Spark);
9722 /// ```
9723 pub fn set_metric_source<
9724 T: std::convert::Into<crate::model::dataproc_metric_config::MetricSource>,
9725 >(
9726 mut self,
9727 v: T,
9728 ) -> Self {
9729 self.metric_source = v.into();
9730 self
9731 }
9732
9733 /// Sets the value of [metric_overrides][crate::model::dataproc_metric_config::Metric::metric_overrides].
9734 ///
9735 /// # Example
9736 /// ```ignore,no_run
9737 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
9738 /// let x = Metric::new().set_metric_overrides(["a", "b", "c"]);
9739 /// ```
9740 pub fn set_metric_overrides<T, V>(mut self, v: T) -> Self
9741 where
9742 T: std::iter::IntoIterator<Item = V>,
9743 V: std::convert::Into<std::string::String>,
9744 {
9745 use std::iter::Iterator;
9746 self.metric_overrides = v.into_iter().map(|i| i.into()).collect();
9747 self
9748 }
9749 }
9750
9751 impl wkt::message::Message for Metric {
9752 fn typename() -> &'static str {
9753 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig.Metric"
9754 }
9755 }
9756
9757 /// A source for the collection of Dataproc custom metrics (see [Custom
9758 /// metrics]
9759 /// (<https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics>)).
9760 ///
9761 /// # Working with unknown values
9762 ///
9763 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9764 /// additional enum variants at any time. Adding new variants is not considered
9765 /// a breaking change. Applications should write their code in anticipation of:
9766 ///
9767 /// - New values appearing in future releases of the client library, **and**
9768 /// - New values received dynamically, without application changes.
9769 ///
9770 /// Please consult the [Working with enums] section in the user guide for some
9771 /// guidelines.
9772 ///
9773 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9774 #[derive(Clone, Debug, PartialEq)]
9775 #[non_exhaustive]
9776 pub enum MetricSource {
9777 /// Required unspecified metric source.
9778 Unspecified,
9779 /// Monitoring agent metrics. If this source is enabled,
9780 /// Dataproc enables the monitoring agent in Compute Engine,
9781 /// and collects monitoring agent metrics, which are published
9782 /// with an `agent.googleapis.com` prefix.
9783 MonitoringAgentDefaults,
9784 /// HDFS metric source.
9785 Hdfs,
9786 /// Spark metric source.
9787 Spark,
9788 /// YARN metric source.
9789 Yarn,
9790 /// Spark History Server metric source.
9791 SparkHistoryServer,
9792 /// Hiveserver2 metric source.
9793 Hiveserver2,
9794 /// hivemetastore metric source
9795 Hivemetastore,
9796 /// flink metric source
9797 Flink,
9798 /// If set, the enum was initialized with an unknown value.
9799 ///
9800 /// Applications can examine the value using [MetricSource::value] or
9801 /// [MetricSource::name].
9802 UnknownValue(metric_source::UnknownValue),
9803 }
9804
9805 #[doc(hidden)]
9806 pub mod metric_source {
9807 #[allow(unused_imports)]
9808 use super::*;
9809 #[derive(Clone, Debug, PartialEq)]
9810 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9811 }
9812
9813 impl MetricSource {
9814 /// Gets the enum value.
9815 ///
9816 /// Returns `None` if the enum contains an unknown value deserialized from
9817 /// the string representation of enums.
9818 pub fn value(&self) -> std::option::Option<i32> {
9819 match self {
9820 Self::Unspecified => std::option::Option::Some(0),
9821 Self::MonitoringAgentDefaults => std::option::Option::Some(1),
9822 Self::Hdfs => std::option::Option::Some(2),
9823 Self::Spark => std::option::Option::Some(3),
9824 Self::Yarn => std::option::Option::Some(4),
9825 Self::SparkHistoryServer => std::option::Option::Some(5),
9826 Self::Hiveserver2 => std::option::Option::Some(6),
9827 Self::Hivemetastore => std::option::Option::Some(7),
9828 Self::Flink => std::option::Option::Some(8),
9829 Self::UnknownValue(u) => u.0.value(),
9830 }
9831 }
9832
9833 /// Gets the enum value as a string.
9834 ///
9835 /// Returns `None` if the enum contains an unknown value deserialized from
9836 /// the integer representation of enums.
9837 pub fn name(&self) -> std::option::Option<&str> {
9838 match self {
9839 Self::Unspecified => std::option::Option::Some("METRIC_SOURCE_UNSPECIFIED"),
9840 Self::MonitoringAgentDefaults => {
9841 std::option::Option::Some("MONITORING_AGENT_DEFAULTS")
9842 }
9843 Self::Hdfs => std::option::Option::Some("HDFS"),
9844 Self::Spark => std::option::Option::Some("SPARK"),
9845 Self::Yarn => std::option::Option::Some("YARN"),
9846 Self::SparkHistoryServer => std::option::Option::Some("SPARK_HISTORY_SERVER"),
9847 Self::Hiveserver2 => std::option::Option::Some("HIVESERVER2"),
9848 Self::Hivemetastore => std::option::Option::Some("HIVEMETASTORE"),
9849 Self::Flink => std::option::Option::Some("FLINK"),
9850 Self::UnknownValue(u) => u.0.name(),
9851 }
9852 }
9853 }
9854
9855 impl std::default::Default for MetricSource {
9856 fn default() -> Self {
9857 use std::convert::From;
9858 Self::from(0)
9859 }
9860 }
9861
9862 impl std::fmt::Display for MetricSource {
9863 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9864 wkt::internal::display_enum(f, self.name(), self.value())
9865 }
9866 }
9867
9868 impl std::convert::From<i32> for MetricSource {
9869 fn from(value: i32) -> Self {
9870 match value {
9871 0 => Self::Unspecified,
9872 1 => Self::MonitoringAgentDefaults,
9873 2 => Self::Hdfs,
9874 3 => Self::Spark,
9875 4 => Self::Yarn,
9876 5 => Self::SparkHistoryServer,
9877 6 => Self::Hiveserver2,
9878 7 => Self::Hivemetastore,
9879 8 => Self::Flink,
9880 _ => Self::UnknownValue(metric_source::UnknownValue(
9881 wkt::internal::UnknownEnumValue::Integer(value),
9882 )),
9883 }
9884 }
9885 }
9886
9887 impl std::convert::From<&str> for MetricSource {
9888 fn from(value: &str) -> Self {
9889 use std::string::ToString;
9890 match value {
9891 "METRIC_SOURCE_UNSPECIFIED" => Self::Unspecified,
9892 "MONITORING_AGENT_DEFAULTS" => Self::MonitoringAgentDefaults,
9893 "HDFS" => Self::Hdfs,
9894 "SPARK" => Self::Spark,
9895 "YARN" => Self::Yarn,
9896 "SPARK_HISTORY_SERVER" => Self::SparkHistoryServer,
9897 "HIVESERVER2" => Self::Hiveserver2,
9898 "HIVEMETASTORE" => Self::Hivemetastore,
9899 "FLINK" => Self::Flink,
9900 _ => Self::UnknownValue(metric_source::UnknownValue(
9901 wkt::internal::UnknownEnumValue::String(value.to_string()),
9902 )),
9903 }
9904 }
9905 }
9906
9907 impl serde::ser::Serialize for MetricSource {
9908 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9909 where
9910 S: serde::Serializer,
9911 {
9912 match self {
9913 Self::Unspecified => serializer.serialize_i32(0),
9914 Self::MonitoringAgentDefaults => serializer.serialize_i32(1),
9915 Self::Hdfs => serializer.serialize_i32(2),
9916 Self::Spark => serializer.serialize_i32(3),
9917 Self::Yarn => serializer.serialize_i32(4),
9918 Self::SparkHistoryServer => serializer.serialize_i32(5),
9919 Self::Hiveserver2 => serializer.serialize_i32(6),
9920 Self::Hivemetastore => serializer.serialize_i32(7),
9921 Self::Flink => serializer.serialize_i32(8),
9922 Self::UnknownValue(u) => u.0.serialize(serializer),
9923 }
9924 }
9925 }
9926
9927 impl<'de> serde::de::Deserialize<'de> for MetricSource {
9928 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9929 where
9930 D: serde::Deserializer<'de>,
9931 {
9932 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricSource>::new(
9933 ".google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource",
9934 ))
9935 }
9936 }
9937}
9938
9939/// A request to create a cluster.
9940#[derive(Clone, Default, PartialEq)]
9941#[non_exhaustive]
9942pub struct CreateClusterRequest {
9943 /// Required. The ID of the Google Cloud Platform project that the cluster
9944 /// belongs to.
9945 pub project_id: std::string::String,
9946
9947 /// Required. The Dataproc region in which to handle the request.
9948 pub region: std::string::String,
9949
9950 /// Required. The cluster to create.
9951 pub cluster: std::option::Option<crate::model::Cluster>,
9952
9953 /// Optional. A unique ID used to identify the request. If the server receives
9954 /// two
9955 /// [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
9956 /// with the same id, then the second request will be ignored and the
9957 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9958 /// and stored in the backend is returned.
9959 ///
9960 /// It is recommended to always set this value to a
9961 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9962 ///
9963 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9964 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9965 ///
9966 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9967 pub request_id: std::string::String,
9968
9969 /// Optional. Failure action when primary worker creation fails.
9970 pub action_on_failed_primary_workers: crate::model::FailureAction,
9971
9972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9973}
9974
9975impl CreateClusterRequest {
9976 /// Creates a new default instance.
9977 pub fn new() -> Self {
9978 std::default::Default::default()
9979 }
9980
9981 /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
9982 ///
9983 /// # Example
9984 /// ```ignore,no_run
9985 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9986 /// let x = CreateClusterRequest::new().set_project_id("example");
9987 /// ```
9988 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9989 self.project_id = v.into();
9990 self
9991 }
9992
9993 /// Sets the value of [region][crate::model::CreateClusterRequest::region].
9994 ///
9995 /// # Example
9996 /// ```ignore,no_run
9997 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9998 /// let x = CreateClusterRequest::new().set_region("example");
9999 /// ```
10000 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10001 self.region = v.into();
10002 self
10003 }
10004
10005 /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
10006 ///
10007 /// # Example
10008 /// ```ignore,no_run
10009 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
10010 /// use google_cloud_dataproc_v1::model::Cluster;
10011 /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
10012 /// ```
10013 pub fn set_cluster<T>(mut self, v: T) -> Self
10014 where
10015 T: std::convert::Into<crate::model::Cluster>,
10016 {
10017 self.cluster = std::option::Option::Some(v.into());
10018 self
10019 }
10020
10021 /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
10022 ///
10023 /// # Example
10024 /// ```ignore,no_run
10025 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
10026 /// use google_cloud_dataproc_v1::model::Cluster;
10027 /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
10028 /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
10029 /// ```
10030 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
10031 where
10032 T: std::convert::Into<crate::model::Cluster>,
10033 {
10034 self.cluster = v.map(|x| x.into());
10035 self
10036 }
10037
10038 /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
10039 ///
10040 /// # Example
10041 /// ```ignore,no_run
10042 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
10043 /// let x = CreateClusterRequest::new().set_request_id("example");
10044 /// ```
10045 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10046 self.request_id = v.into();
10047 self
10048 }
10049
10050 /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
10051 ///
10052 /// # Example
10053 /// ```ignore,no_run
10054 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
10055 /// use google_cloud_dataproc_v1::model::FailureAction;
10056 /// let x0 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::NoAction);
10057 /// let x1 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::Delete);
10058 /// ```
10059 pub fn set_action_on_failed_primary_workers<
10060 T: std::convert::Into<crate::model::FailureAction>,
10061 >(
10062 mut self,
10063 v: T,
10064 ) -> Self {
10065 self.action_on_failed_primary_workers = v.into();
10066 self
10067 }
10068}
10069
10070impl wkt::message::Message for CreateClusterRequest {
10071 fn typename() -> &'static str {
10072 "type.googleapis.com/google.cloud.dataproc.v1.CreateClusterRequest"
10073 }
10074}
10075
10076/// A request to update a cluster.
10077#[derive(Clone, Default, PartialEq)]
10078#[non_exhaustive]
10079pub struct UpdateClusterRequest {
10080 /// Required. The ID of the Google Cloud Platform project the
10081 /// cluster belongs to.
10082 pub project_id: std::string::String,
10083
10084 /// Required. The Dataproc region in which to handle the request.
10085 pub region: std::string::String,
10086
10087 /// Required. The cluster name.
10088 pub cluster_name: std::string::String,
10089
10090 /// Required. The changes to the cluster.
10091 pub cluster: std::option::Option<crate::model::Cluster>,
10092
10093 /// Optional. Timeout for graceful YARN decommissioning. Graceful
10094 /// decommissioning allows removing nodes from the cluster without
10095 /// interrupting jobs in progress. Timeout specifies how long to wait for jobs
10096 /// in progress to finish before forcefully removing nodes (and potentially
10097 /// interrupting jobs). Default timeout is 0 (for forceful decommission), and
10098 /// the maximum allowed timeout is 1 day. (see JSON representation of
10099 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
10100 ///
10101 /// Only supported on Dataproc image versions 1.2 and higher.
10102 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
10103
10104 /// Required. Specifies the path, relative to `Cluster`, of
10105 /// the field to update. For example, to change the number of workers
10106 /// in a cluster to 5, the `update_mask` parameter would be
10107 /// specified as `config.worker_config.num_instances`,
10108 /// and the `PATCH` request body would specify the new value, as follows:
10109 ///
10110 /// ```norust
10111 /// {
10112 /// "config":{
10113 /// "workerConfig":{
10114 /// "numInstances":"5"
10115 /// }
10116 /// }
10117 /// }
10118 /// ```
10119 ///
10120 /// Similarly, to change the number of preemptible workers in a cluster to 5,
10121 /// the `update_mask` parameter would be
10122 /// `config.secondary_worker_config.num_instances`, and the `PATCH` request
10123 /// body would be set as follows:
10124 ///
10125 /// ```norust
10126 /// {
10127 /// "config":{
10128 /// "secondaryWorkerConfig":{
10129 /// "numInstances":"5"
10130 /// }
10131 /// }
10132 /// }
10133 /// ```
10134 ///
10135 /// \<strong\>Note:\</strong\> Currently, only the following fields can be updated:
10136 pub update_mask: std::option::Option<wkt::FieldMask>,
10137
10138 /// Optional. A unique ID used to identify the request. If the server
10139 /// receives two
10140 /// [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
10141 /// with the same id, then the second request will be ignored and the
10142 /// first [google.longrunning.Operation][google.longrunning.Operation] created
10143 /// and stored in the backend is returned.
10144 ///
10145 /// It is recommended to always set this value to a
10146 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
10147 ///
10148 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
10149 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
10150 ///
10151 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
10152 pub request_id: std::string::String,
10153
10154 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10155}
10156
10157impl UpdateClusterRequest {
10158 /// Creates a new default instance.
10159 pub fn new() -> Self {
10160 std::default::Default::default()
10161 }
10162
10163 /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
10164 ///
10165 /// # Example
10166 /// ```ignore,no_run
10167 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10168 /// let x = UpdateClusterRequest::new().set_project_id("example");
10169 /// ```
10170 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10171 self.project_id = v.into();
10172 self
10173 }
10174
10175 /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
10176 ///
10177 /// # Example
10178 /// ```ignore,no_run
10179 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10180 /// let x = UpdateClusterRequest::new().set_region("example");
10181 /// ```
10182 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10183 self.region = v.into();
10184 self
10185 }
10186
10187 /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
10188 ///
10189 /// # Example
10190 /// ```ignore,no_run
10191 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10192 /// let x = UpdateClusterRequest::new().set_cluster_name("example");
10193 /// ```
10194 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10195 self.cluster_name = v.into();
10196 self
10197 }
10198
10199 /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
10200 ///
10201 /// # Example
10202 /// ```ignore,no_run
10203 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10204 /// use google_cloud_dataproc_v1::model::Cluster;
10205 /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
10206 /// ```
10207 pub fn set_cluster<T>(mut self, v: T) -> Self
10208 where
10209 T: std::convert::Into<crate::model::Cluster>,
10210 {
10211 self.cluster = std::option::Option::Some(v.into());
10212 self
10213 }
10214
10215 /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
10216 ///
10217 /// # Example
10218 /// ```ignore,no_run
10219 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10220 /// use google_cloud_dataproc_v1::model::Cluster;
10221 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
10222 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
10223 /// ```
10224 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
10225 where
10226 T: std::convert::Into<crate::model::Cluster>,
10227 {
10228 self.cluster = v.map(|x| x.into());
10229 self
10230 }
10231
10232 /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
10233 ///
10234 /// # Example
10235 /// ```ignore,no_run
10236 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10237 /// use wkt::Duration;
10238 /// let x = UpdateClusterRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
10239 /// ```
10240 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
10241 where
10242 T: std::convert::Into<wkt::Duration>,
10243 {
10244 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
10245 self
10246 }
10247
10248 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
10249 ///
10250 /// # Example
10251 /// ```ignore,no_run
10252 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10253 /// use wkt::Duration;
10254 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
10255 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
10256 /// ```
10257 pub fn set_or_clear_graceful_decommission_timeout<T>(
10258 mut self,
10259 v: std::option::Option<T>,
10260 ) -> Self
10261 where
10262 T: std::convert::Into<wkt::Duration>,
10263 {
10264 self.graceful_decommission_timeout = v.map(|x| x.into());
10265 self
10266 }
10267
10268 /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
10269 ///
10270 /// # Example
10271 /// ```ignore,no_run
10272 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10273 /// use wkt::FieldMask;
10274 /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10275 /// ```
10276 pub fn set_update_mask<T>(mut self, v: T) -> Self
10277 where
10278 T: std::convert::Into<wkt::FieldMask>,
10279 {
10280 self.update_mask = std::option::Option::Some(v.into());
10281 self
10282 }
10283
10284 /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
10285 ///
10286 /// # Example
10287 /// ```ignore,no_run
10288 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10289 /// use wkt::FieldMask;
10290 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10291 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10292 /// ```
10293 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10294 where
10295 T: std::convert::Into<wkt::FieldMask>,
10296 {
10297 self.update_mask = v.map(|x| x.into());
10298 self
10299 }
10300
10301 /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
10302 ///
10303 /// # Example
10304 /// ```ignore,no_run
10305 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
10306 /// let x = UpdateClusterRequest::new().set_request_id("example");
10307 /// ```
10308 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10309 self.request_id = v.into();
10310 self
10311 }
10312}
10313
10314impl wkt::message::Message for UpdateClusterRequest {
10315 fn typename() -> &'static str {
10316 "type.googleapis.com/google.cloud.dataproc.v1.UpdateClusterRequest"
10317 }
10318}
10319
10320/// A request to stop a cluster.
10321#[derive(Clone, Default, PartialEq)]
10322#[non_exhaustive]
10323pub struct StopClusterRequest {
10324 /// Required. The ID of the Google Cloud Platform project the
10325 /// cluster belongs to.
10326 pub project_id: std::string::String,
10327
10328 /// Required. The Dataproc region in which to handle the request.
10329 pub region: std::string::String,
10330
10331 /// Required. The cluster name.
10332 pub cluster_name: std::string::String,
10333
10334 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
10335 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
10336 pub cluster_uuid: std::string::String,
10337
10338 /// Optional. A unique ID used to identify the request. If the server
10339 /// receives two
10340 /// [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
10341 /// with the same id, then the second request will be ignored and the
10342 /// first [google.longrunning.Operation][google.longrunning.Operation] created
10343 /// and stored in the backend is returned.
10344 ///
10345 /// Recommendation: Set this value to a
10346 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
10347 ///
10348 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
10349 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
10350 ///
10351 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
10352 pub request_id: std::string::String,
10353
10354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10355}
10356
10357impl StopClusterRequest {
10358 /// Creates a new default instance.
10359 pub fn new() -> Self {
10360 std::default::Default::default()
10361 }
10362
10363 /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
10364 ///
10365 /// # Example
10366 /// ```ignore,no_run
10367 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
10368 /// let x = StopClusterRequest::new().set_project_id("example");
10369 /// ```
10370 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10371 self.project_id = v.into();
10372 self
10373 }
10374
10375 /// Sets the value of [region][crate::model::StopClusterRequest::region].
10376 ///
10377 /// # Example
10378 /// ```ignore,no_run
10379 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
10380 /// let x = StopClusterRequest::new().set_region("example");
10381 /// ```
10382 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10383 self.region = v.into();
10384 self
10385 }
10386
10387 /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
10388 ///
10389 /// # Example
10390 /// ```ignore,no_run
10391 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
10392 /// let x = StopClusterRequest::new().set_cluster_name("example");
10393 /// ```
10394 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10395 self.cluster_name = v.into();
10396 self
10397 }
10398
10399 /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
10400 ///
10401 /// # Example
10402 /// ```ignore,no_run
10403 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
10404 /// let x = StopClusterRequest::new().set_cluster_uuid("example");
10405 /// ```
10406 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10407 self.cluster_uuid = v.into();
10408 self
10409 }
10410
10411 /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
10412 ///
10413 /// # Example
10414 /// ```ignore,no_run
10415 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
10416 /// let x = StopClusterRequest::new().set_request_id("example");
10417 /// ```
10418 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10419 self.request_id = v.into();
10420 self
10421 }
10422}
10423
10424impl wkt::message::Message for StopClusterRequest {
10425 fn typename() -> &'static str {
10426 "type.googleapis.com/google.cloud.dataproc.v1.StopClusterRequest"
10427 }
10428}
10429
10430/// A request to start a cluster.
10431#[derive(Clone, Default, PartialEq)]
10432#[non_exhaustive]
10433pub struct StartClusterRequest {
10434 /// Required. The ID of the Google Cloud Platform project the
10435 /// cluster belongs to.
10436 pub project_id: std::string::String,
10437
10438 /// Required. The Dataproc region in which to handle the request.
10439 pub region: std::string::String,
10440
10441 /// Required. The cluster name.
10442 pub cluster_name: std::string::String,
10443
10444 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
10445 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
10446 pub cluster_uuid: std::string::String,
10447
10448 /// Optional. A unique ID used to identify the request. If the server
10449 /// receives two
10450 /// [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
10451 /// with the same id, then the second request will be ignored and the
10452 /// first [google.longrunning.Operation][google.longrunning.Operation] created
10453 /// and stored in the backend is returned.
10454 ///
10455 /// Recommendation: Set this value to a
10456 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
10457 ///
10458 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
10459 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
10460 ///
10461 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
10462 pub request_id: std::string::String,
10463
10464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10465}
10466
10467impl StartClusterRequest {
10468 /// Creates a new default instance.
10469 pub fn new() -> Self {
10470 std::default::Default::default()
10471 }
10472
10473 /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
10474 ///
10475 /// # Example
10476 /// ```ignore,no_run
10477 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
10478 /// let x = StartClusterRequest::new().set_project_id("example");
10479 /// ```
10480 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10481 self.project_id = v.into();
10482 self
10483 }
10484
10485 /// Sets the value of [region][crate::model::StartClusterRequest::region].
10486 ///
10487 /// # Example
10488 /// ```ignore,no_run
10489 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
10490 /// let x = StartClusterRequest::new().set_region("example");
10491 /// ```
10492 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10493 self.region = v.into();
10494 self
10495 }
10496
10497 /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
10498 ///
10499 /// # Example
10500 /// ```ignore,no_run
10501 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
10502 /// let x = StartClusterRequest::new().set_cluster_name("example");
10503 /// ```
10504 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10505 self.cluster_name = v.into();
10506 self
10507 }
10508
10509 /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
10510 ///
10511 /// # Example
10512 /// ```ignore,no_run
10513 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
10514 /// let x = StartClusterRequest::new().set_cluster_uuid("example");
10515 /// ```
10516 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10517 self.cluster_uuid = v.into();
10518 self
10519 }
10520
10521 /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
10522 ///
10523 /// # Example
10524 /// ```ignore,no_run
10525 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
10526 /// let x = StartClusterRequest::new().set_request_id("example");
10527 /// ```
10528 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10529 self.request_id = v.into();
10530 self
10531 }
10532}
10533
10534impl wkt::message::Message for StartClusterRequest {
10535 fn typename() -> &'static str {
10536 "type.googleapis.com/google.cloud.dataproc.v1.StartClusterRequest"
10537 }
10538}
10539
10540/// A request to delete a cluster.
10541#[derive(Clone, Default, PartialEq)]
10542#[non_exhaustive]
10543pub struct DeleteClusterRequest {
10544 /// Required. The ID of the Google Cloud Platform project that the cluster
10545 /// belongs to.
10546 pub project_id: std::string::String,
10547
10548 /// Required. The Dataproc region in which to handle the request.
10549 pub region: std::string::String,
10550
10551 /// Required. The cluster name.
10552 pub cluster_name: std::string::String,
10553
10554 /// Optional. Specifying the `cluster_uuid` means the RPC should fail
10555 /// (with error NOT_FOUND) if cluster with specified UUID does not exist.
10556 pub cluster_uuid: std::string::String,
10557
10558 /// Optional. A unique ID used to identify the request. If the server
10559 /// receives two
10560 /// [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
10561 /// with the same id, then the second request will be ignored and the
10562 /// first [google.longrunning.Operation][google.longrunning.Operation] created
10563 /// and stored in the backend is returned.
10564 ///
10565 /// It is recommended to always set this value to a
10566 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
10567 ///
10568 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
10569 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
10570 ///
10571 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
10572 pub request_id: std::string::String,
10573
10574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10575}
10576
10577impl DeleteClusterRequest {
10578 /// Creates a new default instance.
10579 pub fn new() -> Self {
10580 std::default::Default::default()
10581 }
10582
10583 /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
10584 ///
10585 /// # Example
10586 /// ```ignore,no_run
10587 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10588 /// let x = DeleteClusterRequest::new().set_project_id("example");
10589 /// ```
10590 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10591 self.project_id = v.into();
10592 self
10593 }
10594
10595 /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
10596 ///
10597 /// # Example
10598 /// ```ignore,no_run
10599 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10600 /// let x = DeleteClusterRequest::new().set_region("example");
10601 /// ```
10602 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10603 self.region = v.into();
10604 self
10605 }
10606
10607 /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
10608 ///
10609 /// # Example
10610 /// ```ignore,no_run
10611 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10612 /// let x = DeleteClusterRequest::new().set_cluster_name("example");
10613 /// ```
10614 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10615 self.cluster_name = v.into();
10616 self
10617 }
10618
10619 /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
10620 ///
10621 /// # Example
10622 /// ```ignore,no_run
10623 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10624 /// let x = DeleteClusterRequest::new().set_cluster_uuid("example");
10625 /// ```
10626 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10627 self.cluster_uuid = v.into();
10628 self
10629 }
10630
10631 /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
10632 ///
10633 /// # Example
10634 /// ```ignore,no_run
10635 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10636 /// let x = DeleteClusterRequest::new().set_request_id("example");
10637 /// ```
10638 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10639 self.request_id = v.into();
10640 self
10641 }
10642}
10643
10644impl wkt::message::Message for DeleteClusterRequest {
10645 fn typename() -> &'static str {
10646 "type.googleapis.com/google.cloud.dataproc.v1.DeleteClusterRequest"
10647 }
10648}
10649
10650/// Request to get the resource representation for a cluster in a project.
10651#[derive(Clone, Default, PartialEq)]
10652#[non_exhaustive]
10653pub struct GetClusterRequest {
10654 /// Required. The ID of the Google Cloud Platform project that the cluster
10655 /// belongs to.
10656 pub project_id: std::string::String,
10657
10658 /// Required. The Dataproc region in which to handle the request.
10659 pub region: std::string::String,
10660
10661 /// Required. The cluster name.
10662 pub cluster_name: std::string::String,
10663
10664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10665}
10666
10667impl GetClusterRequest {
10668 /// Creates a new default instance.
10669 pub fn new() -> Self {
10670 std::default::Default::default()
10671 }
10672
10673 /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
10674 ///
10675 /// # Example
10676 /// ```ignore,no_run
10677 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
10678 /// let x = GetClusterRequest::new().set_project_id("example");
10679 /// ```
10680 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10681 self.project_id = v.into();
10682 self
10683 }
10684
10685 /// Sets the value of [region][crate::model::GetClusterRequest::region].
10686 ///
10687 /// # Example
10688 /// ```ignore,no_run
10689 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
10690 /// let x = GetClusterRequest::new().set_region("example");
10691 /// ```
10692 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10693 self.region = v.into();
10694 self
10695 }
10696
10697 /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
10698 ///
10699 /// # Example
10700 /// ```ignore,no_run
10701 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
10702 /// let x = GetClusterRequest::new().set_cluster_name("example");
10703 /// ```
10704 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10705 self.cluster_name = v.into();
10706 self
10707 }
10708}
10709
10710impl wkt::message::Message for GetClusterRequest {
10711 fn typename() -> &'static str {
10712 "type.googleapis.com/google.cloud.dataproc.v1.GetClusterRequest"
10713 }
10714}
10715
10716/// A request to list the clusters in a project.
10717#[derive(Clone, Default, PartialEq)]
10718#[non_exhaustive]
10719pub struct ListClustersRequest {
10720 /// Required. The ID of the Google Cloud Platform project that the cluster
10721 /// belongs to.
10722 pub project_id: std::string::String,
10723
10724 /// Required. The Dataproc region in which to handle the request.
10725 pub region: std::string::String,
10726
10727 /// Optional. A filter constraining the clusters to list. Filters are
10728 /// case-sensitive and have the following syntax:
10729 ///
10730 /// field = value [AND [field = value]] ...
10731 ///
10732 /// where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
10733 /// and `[KEY]` is a label key. **value** can be `*` to match all values.
10734 /// `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
10735 /// `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
10736 /// `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
10737 /// states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
10738 /// `STOPPED` states. `clusterName` is the name of the cluster provided at
10739 /// creation time. Only the logical `AND` operator is supported;
10740 /// space-separated items are treated as having an implicit `AND` operator.
10741 ///
10742 /// Example filter:
10743 ///
10744 /// status.state = ACTIVE AND clusterName = mycluster
10745 /// AND labels.env = staging AND labels.starred = *
10746 pub filter: std::string::String,
10747
10748 /// Optional. The standard List page size.
10749 pub page_size: i32,
10750
10751 /// Optional. The standard List page token.
10752 pub page_token: std::string::String,
10753
10754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10755}
10756
10757impl ListClustersRequest {
10758 /// Creates a new default instance.
10759 pub fn new() -> Self {
10760 std::default::Default::default()
10761 }
10762
10763 /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
10764 ///
10765 /// # Example
10766 /// ```ignore,no_run
10767 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10768 /// let x = ListClustersRequest::new().set_project_id("example");
10769 /// ```
10770 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10771 self.project_id = v.into();
10772 self
10773 }
10774
10775 /// Sets the value of [region][crate::model::ListClustersRequest::region].
10776 ///
10777 /// # Example
10778 /// ```ignore,no_run
10779 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10780 /// let x = ListClustersRequest::new().set_region("example");
10781 /// ```
10782 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10783 self.region = v.into();
10784 self
10785 }
10786
10787 /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
10788 ///
10789 /// # Example
10790 /// ```ignore,no_run
10791 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10792 /// let x = ListClustersRequest::new().set_filter("example");
10793 /// ```
10794 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10795 self.filter = v.into();
10796 self
10797 }
10798
10799 /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
10800 ///
10801 /// # Example
10802 /// ```ignore,no_run
10803 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10804 /// let x = ListClustersRequest::new().set_page_size(42);
10805 /// ```
10806 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10807 self.page_size = v.into();
10808 self
10809 }
10810
10811 /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
10812 ///
10813 /// # Example
10814 /// ```ignore,no_run
10815 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10816 /// let x = ListClustersRequest::new().set_page_token("example");
10817 /// ```
10818 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10819 self.page_token = v.into();
10820 self
10821 }
10822}
10823
10824impl wkt::message::Message for ListClustersRequest {
10825 fn typename() -> &'static str {
10826 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersRequest"
10827 }
10828}
10829
10830/// The list of all clusters in a project.
10831#[derive(Clone, Default, PartialEq)]
10832#[non_exhaustive]
10833pub struct ListClustersResponse {
10834 /// Output only. The clusters in the project.
10835 pub clusters: std::vec::Vec<crate::model::Cluster>,
10836
10837 /// Output only. This token is included in the response if there are more
10838 /// results to fetch. To fetch additional results, provide this value as the
10839 /// `page_token` in a subsequent `ListClustersRequest`.
10840 pub next_page_token: std::string::String,
10841
10842 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10843}
10844
10845impl ListClustersResponse {
10846 /// Creates a new default instance.
10847 pub fn new() -> Self {
10848 std::default::Default::default()
10849 }
10850
10851 /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
10852 ///
10853 /// # Example
10854 /// ```ignore,no_run
10855 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
10856 /// use google_cloud_dataproc_v1::model::Cluster;
10857 /// let x = ListClustersResponse::new()
10858 /// .set_clusters([
10859 /// Cluster::default()/* use setters */,
10860 /// Cluster::default()/* use (different) setters */,
10861 /// ]);
10862 /// ```
10863 pub fn set_clusters<T, V>(mut self, v: T) -> Self
10864 where
10865 T: std::iter::IntoIterator<Item = V>,
10866 V: std::convert::Into<crate::model::Cluster>,
10867 {
10868 use std::iter::Iterator;
10869 self.clusters = v.into_iter().map(|i| i.into()).collect();
10870 self
10871 }
10872
10873 /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
10874 ///
10875 /// # Example
10876 /// ```ignore,no_run
10877 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
10878 /// let x = ListClustersResponse::new().set_next_page_token("example");
10879 /// ```
10880 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10881 self.next_page_token = v.into();
10882 self
10883 }
10884}
10885
10886impl wkt::message::Message for ListClustersResponse {
10887 fn typename() -> &'static str {
10888 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersResponse"
10889 }
10890}
10891
10892#[doc(hidden)]
10893impl google_cloud_gax::paginator::internal::PageableResponse for ListClustersResponse {
10894 type PageItem = crate::model::Cluster;
10895
10896 fn items(self) -> std::vec::Vec<Self::PageItem> {
10897 self.clusters
10898 }
10899
10900 fn next_page_token(&self) -> std::string::String {
10901 use std::clone::Clone;
10902 self.next_page_token.clone()
10903 }
10904}
10905
10906/// A request to collect cluster diagnostic information.
10907#[derive(Clone, Default, PartialEq)]
10908#[non_exhaustive]
10909pub struct DiagnoseClusterRequest {
10910 /// Required. The ID of the Google Cloud Platform project that the cluster
10911 /// belongs to.
10912 pub project_id: std::string::String,
10913
10914 /// Required. The Dataproc region in which to handle the request.
10915 pub region: std::string::String,
10916
10917 /// Required. The cluster name.
10918 pub cluster_name: std::string::String,
10919
10920 /// Optional. (Optional) The output Cloud Storage directory for the diagnostic
10921 /// tarball. If not specified, a task-specific directory in the cluster's
10922 /// staging bucket will be used.
10923 pub tarball_gcs_dir: std::string::String,
10924
10925 /// Optional. (Optional) The access type to the diagnostic tarball. If not
10926 /// specified, falls back to default access of the bucket
10927 pub tarball_access: crate::model::diagnose_cluster_request::TarballAccess,
10928
10929 /// Optional. Time interval in which diagnosis should be carried out on the
10930 /// cluster.
10931 pub diagnosis_interval: std::option::Option<google_cloud_type::model::Interval>,
10932
10933 /// Optional. Specifies a list of jobs on which diagnosis is to be performed.
10934 /// Format: projects/{project}/regions/{region}/jobs/{job}
10935 pub jobs: std::vec::Vec<std::string::String>,
10936
10937 /// Optional. Specifies a list of yarn applications on which diagnosis is to be
10938 /// performed.
10939 pub yarn_application_ids: std::vec::Vec<std::string::String>,
10940
10941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10942}
10943
10944impl DiagnoseClusterRequest {
10945 /// Creates a new default instance.
10946 pub fn new() -> Self {
10947 std::default::Default::default()
10948 }
10949
10950 /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
10951 ///
10952 /// # Example
10953 /// ```ignore,no_run
10954 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10955 /// let x = DiagnoseClusterRequest::new().set_project_id("example");
10956 /// ```
10957 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10958 self.project_id = v.into();
10959 self
10960 }
10961
10962 /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
10963 ///
10964 /// # Example
10965 /// ```ignore,no_run
10966 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10967 /// let x = DiagnoseClusterRequest::new().set_region("example");
10968 /// ```
10969 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10970 self.region = v.into();
10971 self
10972 }
10973
10974 /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
10975 ///
10976 /// # Example
10977 /// ```ignore,no_run
10978 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10979 /// let x = DiagnoseClusterRequest::new().set_cluster_name("example");
10980 /// ```
10981 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10982 self.cluster_name = v.into();
10983 self
10984 }
10985
10986 /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
10987 ///
10988 /// # Example
10989 /// ```ignore,no_run
10990 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10991 /// let x = DiagnoseClusterRequest::new().set_tarball_gcs_dir("example");
10992 /// ```
10993 pub fn set_tarball_gcs_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10994 self.tarball_gcs_dir = v.into();
10995 self
10996 }
10997
10998 /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
10999 ///
11000 /// # Example
11001 /// ```ignore,no_run
11002 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
11003 /// use google_cloud_dataproc_v1::model::diagnose_cluster_request::TarballAccess;
11004 /// let x0 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleCloudSupport);
11005 /// let x1 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleDataprocDiagnose);
11006 /// ```
11007 pub fn set_tarball_access<
11008 T: std::convert::Into<crate::model::diagnose_cluster_request::TarballAccess>,
11009 >(
11010 mut self,
11011 v: T,
11012 ) -> Self {
11013 self.tarball_access = v.into();
11014 self
11015 }
11016
11017 /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
11018 ///
11019 /// # Example
11020 /// ```ignore,no_run
11021 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
11022 /// use google_cloud_type::model::Interval;
11023 /// let x = DiagnoseClusterRequest::new().set_diagnosis_interval(Interval::default()/* use setters */);
11024 /// ```
11025 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
11026 where
11027 T: std::convert::Into<google_cloud_type::model::Interval>,
11028 {
11029 self.diagnosis_interval = std::option::Option::Some(v.into());
11030 self
11031 }
11032
11033 /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
11034 ///
11035 /// # Example
11036 /// ```ignore,no_run
11037 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
11038 /// use google_cloud_type::model::Interval;
11039 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(Some(Interval::default()/* use setters */));
11040 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(None::<Interval>);
11041 /// ```
11042 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
11043 where
11044 T: std::convert::Into<google_cloud_type::model::Interval>,
11045 {
11046 self.diagnosis_interval = v.map(|x| x.into());
11047 self
11048 }
11049
11050 /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
11051 ///
11052 /// # Example
11053 /// ```ignore,no_run
11054 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
11055 /// let x = DiagnoseClusterRequest::new().set_jobs(["a", "b", "c"]);
11056 /// ```
11057 pub fn set_jobs<T, V>(mut self, v: T) -> Self
11058 where
11059 T: std::iter::IntoIterator<Item = V>,
11060 V: std::convert::Into<std::string::String>,
11061 {
11062 use std::iter::Iterator;
11063 self.jobs = v.into_iter().map(|i| i.into()).collect();
11064 self
11065 }
11066
11067 /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
11068 ///
11069 /// # Example
11070 /// ```ignore,no_run
11071 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
11072 /// let x = DiagnoseClusterRequest::new().set_yarn_application_ids(["a", "b", "c"]);
11073 /// ```
11074 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
11075 where
11076 T: std::iter::IntoIterator<Item = V>,
11077 V: std::convert::Into<std::string::String>,
11078 {
11079 use std::iter::Iterator;
11080 self.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
11081 self
11082 }
11083}
11084
11085impl wkt::message::Message for DiagnoseClusterRequest {
11086 fn typename() -> &'static str {
11087 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterRequest"
11088 }
11089}
11090
11091/// Defines additional types related to [DiagnoseClusterRequest].
11092pub mod diagnose_cluster_request {
11093 #[allow(unused_imports)]
11094 use super::*;
11095
11096 /// Defines who has access to the diagnostic tarball
11097 ///
11098 /// # Working with unknown values
11099 ///
11100 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11101 /// additional enum variants at any time. Adding new variants is not considered
11102 /// a breaking change. Applications should write their code in anticipation of:
11103 ///
11104 /// - New values appearing in future releases of the client library, **and**
11105 /// - New values received dynamically, without application changes.
11106 ///
11107 /// Please consult the [Working with enums] section in the user guide for some
11108 /// guidelines.
11109 ///
11110 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11111 #[derive(Clone, Debug, PartialEq)]
11112 #[non_exhaustive]
11113 pub enum TarballAccess {
11114 /// Tarball Access unspecified. Falls back to default access of the bucket
11115 Unspecified,
11116 /// Google Cloud Support group has read access to the
11117 /// diagnostic tarball
11118 GoogleCloudSupport,
11119 /// Google Cloud Dataproc Diagnose service account has read access to the
11120 /// diagnostic tarball
11121 GoogleDataprocDiagnose,
11122 /// If set, the enum was initialized with an unknown value.
11123 ///
11124 /// Applications can examine the value using [TarballAccess::value] or
11125 /// [TarballAccess::name].
11126 UnknownValue(tarball_access::UnknownValue),
11127 }
11128
11129 #[doc(hidden)]
11130 pub mod tarball_access {
11131 #[allow(unused_imports)]
11132 use super::*;
11133 #[derive(Clone, Debug, PartialEq)]
11134 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11135 }
11136
11137 impl TarballAccess {
11138 /// Gets the enum value.
11139 ///
11140 /// Returns `None` if the enum contains an unknown value deserialized from
11141 /// the string representation of enums.
11142 pub fn value(&self) -> std::option::Option<i32> {
11143 match self {
11144 Self::Unspecified => std::option::Option::Some(0),
11145 Self::GoogleCloudSupport => std::option::Option::Some(1),
11146 Self::GoogleDataprocDiagnose => std::option::Option::Some(2),
11147 Self::UnknownValue(u) => u.0.value(),
11148 }
11149 }
11150
11151 /// Gets the enum value as a string.
11152 ///
11153 /// Returns `None` if the enum contains an unknown value deserialized from
11154 /// the integer representation of enums.
11155 pub fn name(&self) -> std::option::Option<&str> {
11156 match self {
11157 Self::Unspecified => std::option::Option::Some("TARBALL_ACCESS_UNSPECIFIED"),
11158 Self::GoogleCloudSupport => std::option::Option::Some("GOOGLE_CLOUD_SUPPORT"),
11159 Self::GoogleDataprocDiagnose => {
11160 std::option::Option::Some("GOOGLE_DATAPROC_DIAGNOSE")
11161 }
11162 Self::UnknownValue(u) => u.0.name(),
11163 }
11164 }
11165 }
11166
11167 impl std::default::Default for TarballAccess {
11168 fn default() -> Self {
11169 use std::convert::From;
11170 Self::from(0)
11171 }
11172 }
11173
11174 impl std::fmt::Display for TarballAccess {
11175 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11176 wkt::internal::display_enum(f, self.name(), self.value())
11177 }
11178 }
11179
11180 impl std::convert::From<i32> for TarballAccess {
11181 fn from(value: i32) -> Self {
11182 match value {
11183 0 => Self::Unspecified,
11184 1 => Self::GoogleCloudSupport,
11185 2 => Self::GoogleDataprocDiagnose,
11186 _ => Self::UnknownValue(tarball_access::UnknownValue(
11187 wkt::internal::UnknownEnumValue::Integer(value),
11188 )),
11189 }
11190 }
11191 }
11192
11193 impl std::convert::From<&str> for TarballAccess {
11194 fn from(value: &str) -> Self {
11195 use std::string::ToString;
11196 match value {
11197 "TARBALL_ACCESS_UNSPECIFIED" => Self::Unspecified,
11198 "GOOGLE_CLOUD_SUPPORT" => Self::GoogleCloudSupport,
11199 "GOOGLE_DATAPROC_DIAGNOSE" => Self::GoogleDataprocDiagnose,
11200 _ => Self::UnknownValue(tarball_access::UnknownValue(
11201 wkt::internal::UnknownEnumValue::String(value.to_string()),
11202 )),
11203 }
11204 }
11205 }
11206
11207 impl serde::ser::Serialize for TarballAccess {
11208 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11209 where
11210 S: serde::Serializer,
11211 {
11212 match self {
11213 Self::Unspecified => serializer.serialize_i32(0),
11214 Self::GoogleCloudSupport => serializer.serialize_i32(1),
11215 Self::GoogleDataprocDiagnose => serializer.serialize_i32(2),
11216 Self::UnknownValue(u) => u.0.serialize(serializer),
11217 }
11218 }
11219 }
11220
11221 impl<'de> serde::de::Deserialize<'de> for TarballAccess {
11222 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11223 where
11224 D: serde::Deserializer<'de>,
11225 {
11226 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TarballAccess>::new(
11227 ".google.cloud.dataproc.v1.DiagnoseClusterRequest.TarballAccess",
11228 ))
11229 }
11230 }
11231}
11232
11233/// The location of diagnostic output.
11234#[derive(Clone, Default, PartialEq)]
11235#[non_exhaustive]
11236pub struct DiagnoseClusterResults {
11237 /// Output only. The Cloud Storage URI of the diagnostic output.
11238 /// The output report is a plain text file with a summary of collected
11239 /// diagnostics.
11240 pub output_uri: std::string::String,
11241
11242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11243}
11244
11245impl DiagnoseClusterResults {
11246 /// Creates a new default instance.
11247 pub fn new() -> Self {
11248 std::default::Default::default()
11249 }
11250
11251 /// Sets the value of [output_uri][crate::model::DiagnoseClusterResults::output_uri].
11252 ///
11253 /// # Example
11254 /// ```ignore,no_run
11255 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterResults;
11256 /// let x = DiagnoseClusterResults::new().set_output_uri("example");
11257 /// ```
11258 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11259 self.output_uri = v.into();
11260 self
11261 }
11262}
11263
11264impl wkt::message::Message for DiagnoseClusterResults {
11265 fn typename() -> &'static str {
11266 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterResults"
11267 }
11268}
11269
11270/// Reservation Affinity for consuming Zonal reservation.
11271#[derive(Clone, Default, PartialEq)]
11272#[non_exhaustive]
11273pub struct ReservationAffinity {
11274 /// Optional. Type of reservation to consume
11275 pub consume_reservation_type: crate::model::reservation_affinity::Type,
11276
11277 /// Optional. Corresponds to the label key of reservation resource.
11278 pub key: std::string::String,
11279
11280 /// Optional. Corresponds to the label values of reservation resource.
11281 pub values: std::vec::Vec<std::string::String>,
11282
11283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11284}
11285
11286impl ReservationAffinity {
11287 /// Creates a new default instance.
11288 pub fn new() -> Self {
11289 std::default::Default::default()
11290 }
11291
11292 /// Sets the value of [consume_reservation_type][crate::model::ReservationAffinity::consume_reservation_type].
11293 ///
11294 /// # Example
11295 /// ```ignore,no_run
11296 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
11297 /// use google_cloud_dataproc_v1::model::reservation_affinity::Type;
11298 /// let x0 = ReservationAffinity::new().set_consume_reservation_type(Type::NoReservation);
11299 /// let x1 = ReservationAffinity::new().set_consume_reservation_type(Type::AnyReservation);
11300 /// let x2 = ReservationAffinity::new().set_consume_reservation_type(Type::SpecificReservation);
11301 /// ```
11302 pub fn set_consume_reservation_type<
11303 T: std::convert::Into<crate::model::reservation_affinity::Type>,
11304 >(
11305 mut self,
11306 v: T,
11307 ) -> Self {
11308 self.consume_reservation_type = v.into();
11309 self
11310 }
11311
11312 /// Sets the value of [key][crate::model::ReservationAffinity::key].
11313 ///
11314 /// # Example
11315 /// ```ignore,no_run
11316 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
11317 /// let x = ReservationAffinity::new().set_key("example");
11318 /// ```
11319 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11320 self.key = v.into();
11321 self
11322 }
11323
11324 /// Sets the value of [values][crate::model::ReservationAffinity::values].
11325 ///
11326 /// # Example
11327 /// ```ignore,no_run
11328 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
11329 /// let x = ReservationAffinity::new().set_values(["a", "b", "c"]);
11330 /// ```
11331 pub fn set_values<T, V>(mut self, v: T) -> Self
11332 where
11333 T: std::iter::IntoIterator<Item = V>,
11334 V: std::convert::Into<std::string::String>,
11335 {
11336 use std::iter::Iterator;
11337 self.values = v.into_iter().map(|i| i.into()).collect();
11338 self
11339 }
11340}
11341
11342impl wkt::message::Message for ReservationAffinity {
11343 fn typename() -> &'static str {
11344 "type.googleapis.com/google.cloud.dataproc.v1.ReservationAffinity"
11345 }
11346}
11347
11348/// Defines additional types related to [ReservationAffinity].
11349pub mod reservation_affinity {
11350 #[allow(unused_imports)]
11351 use super::*;
11352
11353 /// Indicates whether to consume capacity from an reservation or not.
11354 ///
11355 /// # Working with unknown values
11356 ///
11357 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11358 /// additional enum variants at any time. Adding new variants is not considered
11359 /// a breaking change. Applications should write their code in anticipation of:
11360 ///
11361 /// - New values appearing in future releases of the client library, **and**
11362 /// - New values received dynamically, without application changes.
11363 ///
11364 /// Please consult the [Working with enums] section in the user guide for some
11365 /// guidelines.
11366 ///
11367 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11368 #[derive(Clone, Debug, PartialEq)]
11369 #[non_exhaustive]
11370 pub enum Type {
11371 #[allow(missing_docs)]
11372 Unspecified,
11373 /// Do not consume from any allocated capacity.
11374 NoReservation,
11375 /// Consume any reservation available.
11376 AnyReservation,
11377 /// Must consume from a specific reservation. Must specify key value fields
11378 /// for specifying the reservations.
11379 SpecificReservation,
11380 /// If set, the enum was initialized with an unknown value.
11381 ///
11382 /// Applications can examine the value using [Type::value] or
11383 /// [Type::name].
11384 UnknownValue(r#type::UnknownValue),
11385 }
11386
11387 #[doc(hidden)]
11388 pub mod r#type {
11389 #[allow(unused_imports)]
11390 use super::*;
11391 #[derive(Clone, Debug, PartialEq)]
11392 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11393 }
11394
11395 impl Type {
11396 /// Gets the enum value.
11397 ///
11398 /// Returns `None` if the enum contains an unknown value deserialized from
11399 /// the string representation of enums.
11400 pub fn value(&self) -> std::option::Option<i32> {
11401 match self {
11402 Self::Unspecified => std::option::Option::Some(0),
11403 Self::NoReservation => std::option::Option::Some(1),
11404 Self::AnyReservation => std::option::Option::Some(2),
11405 Self::SpecificReservation => std::option::Option::Some(3),
11406 Self::UnknownValue(u) => u.0.value(),
11407 }
11408 }
11409
11410 /// Gets the enum value as a string.
11411 ///
11412 /// Returns `None` if the enum contains an unknown value deserialized from
11413 /// the integer representation of enums.
11414 pub fn name(&self) -> std::option::Option<&str> {
11415 match self {
11416 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
11417 Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
11418 Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
11419 Self::SpecificReservation => std::option::Option::Some("SPECIFIC_RESERVATION"),
11420 Self::UnknownValue(u) => u.0.name(),
11421 }
11422 }
11423 }
11424
11425 impl std::default::Default for Type {
11426 fn default() -> Self {
11427 use std::convert::From;
11428 Self::from(0)
11429 }
11430 }
11431
11432 impl std::fmt::Display for Type {
11433 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11434 wkt::internal::display_enum(f, self.name(), self.value())
11435 }
11436 }
11437
11438 impl std::convert::From<i32> for Type {
11439 fn from(value: i32) -> Self {
11440 match value {
11441 0 => Self::Unspecified,
11442 1 => Self::NoReservation,
11443 2 => Self::AnyReservation,
11444 3 => Self::SpecificReservation,
11445 _ => Self::UnknownValue(r#type::UnknownValue(
11446 wkt::internal::UnknownEnumValue::Integer(value),
11447 )),
11448 }
11449 }
11450 }
11451
11452 impl std::convert::From<&str> for Type {
11453 fn from(value: &str) -> Self {
11454 use std::string::ToString;
11455 match value {
11456 "TYPE_UNSPECIFIED" => Self::Unspecified,
11457 "NO_RESERVATION" => Self::NoReservation,
11458 "ANY_RESERVATION" => Self::AnyReservation,
11459 "SPECIFIC_RESERVATION" => Self::SpecificReservation,
11460 _ => Self::UnknownValue(r#type::UnknownValue(
11461 wkt::internal::UnknownEnumValue::String(value.to_string()),
11462 )),
11463 }
11464 }
11465 }
11466
11467 impl serde::ser::Serialize for Type {
11468 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11469 where
11470 S: serde::Serializer,
11471 {
11472 match self {
11473 Self::Unspecified => serializer.serialize_i32(0),
11474 Self::NoReservation => serializer.serialize_i32(1),
11475 Self::AnyReservation => serializer.serialize_i32(2),
11476 Self::SpecificReservation => serializer.serialize_i32(3),
11477 Self::UnknownValue(u) => u.0.serialize(serializer),
11478 }
11479 }
11480 }
11481
11482 impl<'de> serde::de::Deserialize<'de> for Type {
11483 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11484 where
11485 D: serde::Deserializer<'de>,
11486 {
11487 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
11488 ".google.cloud.dataproc.v1.ReservationAffinity.Type",
11489 ))
11490 }
11491 }
11492}
11493
11494/// The runtime logging config of the job.
11495#[derive(Clone, Default, PartialEq)]
11496#[non_exhaustive]
11497pub struct LoggingConfig {
11498 /// The per-package log levels for the driver. This can include
11499 /// "root" package name to configure rootLogger.
11500 /// Examples:
11501 ///
11502 /// - 'com.google = FATAL'
11503 /// - 'root = INFO'
11504 /// - 'org.apache = DEBUG'
11505 pub driver_log_levels:
11506 std::collections::HashMap<std::string::String, crate::model::logging_config::Level>,
11507
11508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11509}
11510
11511impl LoggingConfig {
11512 /// Creates a new default instance.
11513 pub fn new() -> Self {
11514 std::default::Default::default()
11515 }
11516
11517 /// Sets the value of [driver_log_levels][crate::model::LoggingConfig::driver_log_levels].
11518 ///
11519 /// # Example
11520 /// ```ignore,no_run
11521 /// # use google_cloud_dataproc_v1::model::LoggingConfig;
11522 /// use google_cloud_dataproc_v1::model::logging_config::Level;
11523 /// let x = LoggingConfig::new().set_driver_log_levels([
11524 /// ("key0", Level::All),
11525 /// ("key1", Level::Trace),
11526 /// ("key2", Level::Debug),
11527 /// ]);
11528 /// ```
11529 pub fn set_driver_log_levels<T, K, V>(mut self, v: T) -> Self
11530 where
11531 T: std::iter::IntoIterator<Item = (K, V)>,
11532 K: std::convert::Into<std::string::String>,
11533 V: std::convert::Into<crate::model::logging_config::Level>,
11534 {
11535 use std::iter::Iterator;
11536 self.driver_log_levels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11537 self
11538 }
11539}
11540
11541impl wkt::message::Message for LoggingConfig {
11542 fn typename() -> &'static str {
11543 "type.googleapis.com/google.cloud.dataproc.v1.LoggingConfig"
11544 }
11545}
11546
11547/// Defines additional types related to [LoggingConfig].
11548pub mod logging_config {
11549 #[allow(unused_imports)]
11550 use super::*;
11551
11552 /// The Log4j level for job execution. When running an
11553 /// [Apache Hive](https://hive.apache.org/) job, Cloud
11554 /// Dataproc configures the Hive client to an equivalent verbosity level.
11555 ///
11556 /// # Working with unknown values
11557 ///
11558 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11559 /// additional enum variants at any time. Adding new variants is not considered
11560 /// a breaking change. Applications should write their code in anticipation of:
11561 ///
11562 /// - New values appearing in future releases of the client library, **and**
11563 /// - New values received dynamically, without application changes.
11564 ///
11565 /// Please consult the [Working with enums] section in the user guide for some
11566 /// guidelines.
11567 ///
11568 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11569 #[derive(Clone, Debug, PartialEq)]
11570 #[non_exhaustive]
11571 pub enum Level {
11572 /// Level is unspecified. Use default level for log4j.
11573 Unspecified,
11574 /// Use ALL level for log4j.
11575 All,
11576 /// Use TRACE level for log4j.
11577 Trace,
11578 /// Use DEBUG level for log4j.
11579 Debug,
11580 /// Use INFO level for log4j.
11581 Info,
11582 /// Use WARN level for log4j.
11583 Warn,
11584 /// Use ERROR level for log4j.
11585 Error,
11586 /// Use FATAL level for log4j.
11587 Fatal,
11588 /// Turn off log4j.
11589 Off,
11590 /// If set, the enum was initialized with an unknown value.
11591 ///
11592 /// Applications can examine the value using [Level::value] or
11593 /// [Level::name].
11594 UnknownValue(level::UnknownValue),
11595 }
11596
11597 #[doc(hidden)]
11598 pub mod level {
11599 #[allow(unused_imports)]
11600 use super::*;
11601 #[derive(Clone, Debug, PartialEq)]
11602 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11603 }
11604
11605 impl Level {
11606 /// Gets the enum value.
11607 ///
11608 /// Returns `None` if the enum contains an unknown value deserialized from
11609 /// the string representation of enums.
11610 pub fn value(&self) -> std::option::Option<i32> {
11611 match self {
11612 Self::Unspecified => std::option::Option::Some(0),
11613 Self::All => std::option::Option::Some(1),
11614 Self::Trace => std::option::Option::Some(2),
11615 Self::Debug => std::option::Option::Some(3),
11616 Self::Info => std::option::Option::Some(4),
11617 Self::Warn => std::option::Option::Some(5),
11618 Self::Error => std::option::Option::Some(6),
11619 Self::Fatal => std::option::Option::Some(7),
11620 Self::Off => std::option::Option::Some(8),
11621 Self::UnknownValue(u) => u.0.value(),
11622 }
11623 }
11624
11625 /// Gets the enum value as a string.
11626 ///
11627 /// Returns `None` if the enum contains an unknown value deserialized from
11628 /// the integer representation of enums.
11629 pub fn name(&self) -> std::option::Option<&str> {
11630 match self {
11631 Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
11632 Self::All => std::option::Option::Some("ALL"),
11633 Self::Trace => std::option::Option::Some("TRACE"),
11634 Self::Debug => std::option::Option::Some("DEBUG"),
11635 Self::Info => std::option::Option::Some("INFO"),
11636 Self::Warn => std::option::Option::Some("WARN"),
11637 Self::Error => std::option::Option::Some("ERROR"),
11638 Self::Fatal => std::option::Option::Some("FATAL"),
11639 Self::Off => std::option::Option::Some("OFF"),
11640 Self::UnknownValue(u) => u.0.name(),
11641 }
11642 }
11643 }
11644
11645 impl std::default::Default for Level {
11646 fn default() -> Self {
11647 use std::convert::From;
11648 Self::from(0)
11649 }
11650 }
11651
11652 impl std::fmt::Display for Level {
11653 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11654 wkt::internal::display_enum(f, self.name(), self.value())
11655 }
11656 }
11657
11658 impl std::convert::From<i32> for Level {
11659 fn from(value: i32) -> Self {
11660 match value {
11661 0 => Self::Unspecified,
11662 1 => Self::All,
11663 2 => Self::Trace,
11664 3 => Self::Debug,
11665 4 => Self::Info,
11666 5 => Self::Warn,
11667 6 => Self::Error,
11668 7 => Self::Fatal,
11669 8 => Self::Off,
11670 _ => Self::UnknownValue(level::UnknownValue(
11671 wkt::internal::UnknownEnumValue::Integer(value),
11672 )),
11673 }
11674 }
11675 }
11676
11677 impl std::convert::From<&str> for Level {
11678 fn from(value: &str) -> Self {
11679 use std::string::ToString;
11680 match value {
11681 "LEVEL_UNSPECIFIED" => Self::Unspecified,
11682 "ALL" => Self::All,
11683 "TRACE" => Self::Trace,
11684 "DEBUG" => Self::Debug,
11685 "INFO" => Self::Info,
11686 "WARN" => Self::Warn,
11687 "ERROR" => Self::Error,
11688 "FATAL" => Self::Fatal,
11689 "OFF" => Self::Off,
11690 _ => Self::UnknownValue(level::UnknownValue(
11691 wkt::internal::UnknownEnumValue::String(value.to_string()),
11692 )),
11693 }
11694 }
11695 }
11696
11697 impl serde::ser::Serialize for Level {
11698 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11699 where
11700 S: serde::Serializer,
11701 {
11702 match self {
11703 Self::Unspecified => serializer.serialize_i32(0),
11704 Self::All => serializer.serialize_i32(1),
11705 Self::Trace => serializer.serialize_i32(2),
11706 Self::Debug => serializer.serialize_i32(3),
11707 Self::Info => serializer.serialize_i32(4),
11708 Self::Warn => serializer.serialize_i32(5),
11709 Self::Error => serializer.serialize_i32(6),
11710 Self::Fatal => serializer.serialize_i32(7),
11711 Self::Off => serializer.serialize_i32(8),
11712 Self::UnknownValue(u) => u.0.serialize(serializer),
11713 }
11714 }
11715 }
11716
11717 impl<'de> serde::de::Deserialize<'de> for Level {
11718 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11719 where
11720 D: serde::Deserializer<'de>,
11721 {
11722 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
11723 ".google.cloud.dataproc.v1.LoggingConfig.Level",
11724 ))
11725 }
11726 }
11727}
11728
11729/// A Dataproc job for running
11730/// [Apache Hadoop
11731/// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html)
11732/// jobs on [Apache Hadoop
11733/// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
11734#[derive(Clone, Default, PartialEq)]
11735#[non_exhaustive]
11736pub struct HadoopJob {
11737 /// Optional. The arguments to pass to the driver. Do not
11738 /// include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
11739 /// job properties, since a collision might occur that causes an incorrect job
11740 /// submission.
11741 pub args: std::vec::Vec<std::string::String>,
11742
11743 /// Optional. Jar file URIs to add to the CLASSPATHs of the
11744 /// Hadoop driver and tasks.
11745 pub jar_file_uris: std::vec::Vec<std::string::String>,
11746
11747 /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied
11748 /// to the working directory of Hadoop drivers and distributed tasks. Useful
11749 /// for naively parallel tasks.
11750 pub file_uris: std::vec::Vec<std::string::String>,
11751
11752 /// Optional. HCFS URIs of archives to be extracted in the working directory of
11753 /// Hadoop drivers and tasks. Supported file types:
11754 /// .jar, .tar, .tar.gz, .tgz, or .zip.
11755 pub archive_uris: std::vec::Vec<std::string::String>,
11756
11757 /// Optional. A mapping of property names to values, used to configure Hadoop.
11758 /// Properties that conflict with values set by the Dataproc API might be
11759 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and
11760 /// classes in user code.
11761 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11762
11763 /// Optional. The runtime log config for job execution.
11764 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11765
11766 /// Required. Indicates the location of the driver's main class. Specify
11767 /// either the jar file that contains the main class or the main class name.
11768 /// To specify both, add the jar file to `jar_file_uris`, and then specify
11769 /// the main class name in this property.
11770 pub driver: std::option::Option<crate::model::hadoop_job::Driver>,
11771
11772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11773}
11774
11775impl HadoopJob {
11776 /// Creates a new default instance.
11777 pub fn new() -> Self {
11778 std::default::Default::default()
11779 }
11780
11781 /// Sets the value of [args][crate::model::HadoopJob::args].
11782 ///
11783 /// # Example
11784 /// ```ignore,no_run
11785 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11786 /// let x = HadoopJob::new().set_args(["a", "b", "c"]);
11787 /// ```
11788 pub fn set_args<T, V>(mut self, v: T) -> Self
11789 where
11790 T: std::iter::IntoIterator<Item = V>,
11791 V: std::convert::Into<std::string::String>,
11792 {
11793 use std::iter::Iterator;
11794 self.args = v.into_iter().map(|i| i.into()).collect();
11795 self
11796 }
11797
11798 /// Sets the value of [jar_file_uris][crate::model::HadoopJob::jar_file_uris].
11799 ///
11800 /// # Example
11801 /// ```ignore,no_run
11802 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11803 /// let x = HadoopJob::new().set_jar_file_uris(["a", "b", "c"]);
11804 /// ```
11805 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11806 where
11807 T: std::iter::IntoIterator<Item = V>,
11808 V: std::convert::Into<std::string::String>,
11809 {
11810 use std::iter::Iterator;
11811 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11812 self
11813 }
11814
11815 /// Sets the value of [file_uris][crate::model::HadoopJob::file_uris].
11816 ///
11817 /// # Example
11818 /// ```ignore,no_run
11819 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11820 /// let x = HadoopJob::new().set_file_uris(["a", "b", "c"]);
11821 /// ```
11822 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11823 where
11824 T: std::iter::IntoIterator<Item = V>,
11825 V: std::convert::Into<std::string::String>,
11826 {
11827 use std::iter::Iterator;
11828 self.file_uris = v.into_iter().map(|i| i.into()).collect();
11829 self
11830 }
11831
11832 /// Sets the value of [archive_uris][crate::model::HadoopJob::archive_uris].
11833 ///
11834 /// # Example
11835 /// ```ignore,no_run
11836 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11837 /// let x = HadoopJob::new().set_archive_uris(["a", "b", "c"]);
11838 /// ```
11839 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11840 where
11841 T: std::iter::IntoIterator<Item = V>,
11842 V: std::convert::Into<std::string::String>,
11843 {
11844 use std::iter::Iterator;
11845 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11846 self
11847 }
11848
11849 /// Sets the value of [properties][crate::model::HadoopJob::properties].
11850 ///
11851 /// # Example
11852 /// ```ignore,no_run
11853 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11854 /// let x = HadoopJob::new().set_properties([
11855 /// ("key0", "abc"),
11856 /// ("key1", "xyz"),
11857 /// ]);
11858 /// ```
11859 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11860 where
11861 T: std::iter::IntoIterator<Item = (K, V)>,
11862 K: std::convert::Into<std::string::String>,
11863 V: std::convert::Into<std::string::String>,
11864 {
11865 use std::iter::Iterator;
11866 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11867 self
11868 }
11869
11870 /// Sets the value of [logging_config][crate::model::HadoopJob::logging_config].
11871 ///
11872 /// # Example
11873 /// ```ignore,no_run
11874 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11875 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11876 /// let x = HadoopJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11877 /// ```
11878 pub fn set_logging_config<T>(mut self, v: T) -> Self
11879 where
11880 T: std::convert::Into<crate::model::LoggingConfig>,
11881 {
11882 self.logging_config = std::option::Option::Some(v.into());
11883 self
11884 }
11885
11886 /// Sets or clears the value of [logging_config][crate::model::HadoopJob::logging_config].
11887 ///
11888 /// # Example
11889 /// ```ignore,no_run
11890 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11891 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11892 /// let x = HadoopJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11893 /// let x = HadoopJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11894 /// ```
11895 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11896 where
11897 T: std::convert::Into<crate::model::LoggingConfig>,
11898 {
11899 self.logging_config = v.map(|x| x.into());
11900 self
11901 }
11902
11903 /// Sets the value of [driver][crate::model::HadoopJob::driver].
11904 ///
11905 /// Note that all the setters affecting `driver` are mutually
11906 /// exclusive.
11907 ///
11908 /// # Example
11909 /// ```ignore,no_run
11910 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11911 /// use google_cloud_dataproc_v1::model::hadoop_job::Driver;
11912 /// let x = HadoopJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
11913 /// ```
11914 pub fn set_driver<
11915 T: std::convert::Into<std::option::Option<crate::model::hadoop_job::Driver>>,
11916 >(
11917 mut self,
11918 v: T,
11919 ) -> Self {
11920 self.driver = v.into();
11921 self
11922 }
11923
11924 /// The value of [driver][crate::model::HadoopJob::driver]
11925 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
11926 /// holds a different branch.
11927 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
11928 #[allow(unreachable_patterns)]
11929 self.driver.as_ref().and_then(|v| match v {
11930 crate::model::hadoop_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
11931 _ => std::option::Option::None,
11932 })
11933 }
11934
11935 /// Sets the value of [driver][crate::model::HadoopJob::driver]
11936 /// to hold a `MainJarFileUri`.
11937 ///
11938 /// Note that all the setters affecting `driver` are
11939 /// mutually exclusive.
11940 ///
11941 /// # Example
11942 /// ```ignore,no_run
11943 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11944 /// let x = HadoopJob::new().set_main_jar_file_uri("example");
11945 /// assert!(x.main_jar_file_uri().is_some());
11946 /// assert!(x.main_class().is_none());
11947 /// ```
11948 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
11949 mut self,
11950 v: T,
11951 ) -> Self {
11952 self.driver =
11953 std::option::Option::Some(crate::model::hadoop_job::Driver::MainJarFileUri(v.into()));
11954 self
11955 }
11956
11957 /// The value of [driver][crate::model::HadoopJob::driver]
11958 /// if it holds a `MainClass`, `None` if the field is not set or
11959 /// holds a different branch.
11960 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
11961 #[allow(unreachable_patterns)]
11962 self.driver.as_ref().and_then(|v| match v {
11963 crate::model::hadoop_job::Driver::MainClass(v) => std::option::Option::Some(v),
11964 _ => std::option::Option::None,
11965 })
11966 }
11967
11968 /// Sets the value of [driver][crate::model::HadoopJob::driver]
11969 /// to hold a `MainClass`.
11970 ///
11971 /// Note that all the setters affecting `driver` are
11972 /// mutually exclusive.
11973 ///
11974 /// # Example
11975 /// ```ignore,no_run
11976 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11977 /// let x = HadoopJob::new().set_main_class("example");
11978 /// assert!(x.main_class().is_some());
11979 /// assert!(x.main_jar_file_uri().is_none());
11980 /// ```
11981 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11982 self.driver =
11983 std::option::Option::Some(crate::model::hadoop_job::Driver::MainClass(v.into()));
11984 self
11985 }
11986}
11987
11988impl wkt::message::Message for HadoopJob {
11989 fn typename() -> &'static str {
11990 "type.googleapis.com/google.cloud.dataproc.v1.HadoopJob"
11991 }
11992}
11993
11994/// Defines additional types related to [HadoopJob].
11995pub mod hadoop_job {
11996 #[allow(unused_imports)]
11997 use super::*;
11998
11999 /// Required. Indicates the location of the driver's main class. Specify
12000 /// either the jar file that contains the main class or the main class name.
12001 /// To specify both, add the jar file to `jar_file_uris`, and then specify
12002 /// the main class name in this property.
12003 #[derive(Clone, Debug, PartialEq)]
12004 #[non_exhaustive]
12005 pub enum Driver {
12006 /// The HCFS URI of the jar file containing the main class.
12007 /// Examples:
12008 /// 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar'
12009 /// 'hdfs:/tmp/test-samples/custom-wordcount.jar'
12010 /// 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
12011 MainJarFileUri(std::string::String),
12012 /// The name of the driver's main class. The jar file containing the class
12013 /// must be in the default CLASSPATH or specified in `jar_file_uris`.
12014 MainClass(std::string::String),
12015 }
12016}
12017
12018/// A Dataproc job for running [Apache Spark](https://spark.apache.org/)
12019/// applications on YARN.
12020#[derive(Clone, Default, PartialEq)]
12021#[non_exhaustive]
12022pub struct SparkJob {
12023 /// Optional. The arguments to pass to the driver. Do not include arguments,
12024 /// such as `--conf`, that can be set as job properties, since a collision may
12025 /// occur that causes an incorrect job submission.
12026 pub args: std::vec::Vec<std::string::String>,
12027
12028 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
12029 /// Spark driver and tasks.
12030 pub jar_file_uris: std::vec::Vec<std::string::String>,
12031
12032 /// Optional. HCFS URIs of files to be placed in the working directory of
12033 /// each executor. Useful for naively parallel tasks.
12034 pub file_uris: std::vec::Vec<std::string::String>,
12035
12036 /// Optional. HCFS URIs of archives to be extracted into the working directory
12037 /// of each executor. Supported file types:
12038 /// .jar, .tar, .tar.gz, .tgz, and .zip.
12039 pub archive_uris: std::vec::Vec<std::string::String>,
12040
12041 /// Optional. A mapping of property names to values, used to configure Spark.
12042 /// Properties that conflict with values set by the Dataproc API might be
12043 /// overwritten. Can include properties set in
12044 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
12045 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12046
12047 /// Optional. The runtime log config for job execution.
12048 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12049
12050 /// Required. The specification of the main method to call to drive the job.
12051 /// Specify either the jar file that contains the main class or the main class
12052 /// name. To pass both a main jar and a main class in that jar, add the jar to
12053 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
12054 /// specify the main class name in
12055 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
12056 ///
12057 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
12058 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
12059 pub driver: std::option::Option<crate::model::spark_job::Driver>,
12060
12061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12062}
12063
12064impl SparkJob {
12065 /// Creates a new default instance.
12066 pub fn new() -> Self {
12067 std::default::Default::default()
12068 }
12069
12070 /// Sets the value of [args][crate::model::SparkJob::args].
12071 ///
12072 /// # Example
12073 /// ```ignore,no_run
12074 /// # use google_cloud_dataproc_v1::model::SparkJob;
12075 /// let x = SparkJob::new().set_args(["a", "b", "c"]);
12076 /// ```
12077 pub fn set_args<T, V>(mut self, v: T) -> Self
12078 where
12079 T: std::iter::IntoIterator<Item = V>,
12080 V: std::convert::Into<std::string::String>,
12081 {
12082 use std::iter::Iterator;
12083 self.args = v.into_iter().map(|i| i.into()).collect();
12084 self
12085 }
12086
12087 /// Sets the value of [jar_file_uris][crate::model::SparkJob::jar_file_uris].
12088 ///
12089 /// # Example
12090 /// ```ignore,no_run
12091 /// # use google_cloud_dataproc_v1::model::SparkJob;
12092 /// let x = SparkJob::new().set_jar_file_uris(["a", "b", "c"]);
12093 /// ```
12094 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12095 where
12096 T: std::iter::IntoIterator<Item = V>,
12097 V: std::convert::Into<std::string::String>,
12098 {
12099 use std::iter::Iterator;
12100 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12101 self
12102 }
12103
12104 /// Sets the value of [file_uris][crate::model::SparkJob::file_uris].
12105 ///
12106 /// # Example
12107 /// ```ignore,no_run
12108 /// # use google_cloud_dataproc_v1::model::SparkJob;
12109 /// let x = SparkJob::new().set_file_uris(["a", "b", "c"]);
12110 /// ```
12111 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
12112 where
12113 T: std::iter::IntoIterator<Item = V>,
12114 V: std::convert::Into<std::string::String>,
12115 {
12116 use std::iter::Iterator;
12117 self.file_uris = v.into_iter().map(|i| i.into()).collect();
12118 self
12119 }
12120
12121 /// Sets the value of [archive_uris][crate::model::SparkJob::archive_uris].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_cloud_dataproc_v1::model::SparkJob;
12126 /// let x = SparkJob::new().set_archive_uris(["a", "b", "c"]);
12127 /// ```
12128 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
12129 where
12130 T: std::iter::IntoIterator<Item = V>,
12131 V: std::convert::Into<std::string::String>,
12132 {
12133 use std::iter::Iterator;
12134 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
12135 self
12136 }
12137
12138 /// Sets the value of [properties][crate::model::SparkJob::properties].
12139 ///
12140 /// # Example
12141 /// ```ignore,no_run
12142 /// # use google_cloud_dataproc_v1::model::SparkJob;
12143 /// let x = SparkJob::new().set_properties([
12144 /// ("key0", "abc"),
12145 /// ("key1", "xyz"),
12146 /// ]);
12147 /// ```
12148 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12149 where
12150 T: std::iter::IntoIterator<Item = (K, V)>,
12151 K: std::convert::Into<std::string::String>,
12152 V: std::convert::Into<std::string::String>,
12153 {
12154 use std::iter::Iterator;
12155 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12156 self
12157 }
12158
12159 /// Sets the value of [logging_config][crate::model::SparkJob::logging_config].
12160 ///
12161 /// # Example
12162 /// ```ignore,no_run
12163 /// # use google_cloud_dataproc_v1::model::SparkJob;
12164 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12165 /// let x = SparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12166 /// ```
12167 pub fn set_logging_config<T>(mut self, v: T) -> Self
12168 where
12169 T: std::convert::Into<crate::model::LoggingConfig>,
12170 {
12171 self.logging_config = std::option::Option::Some(v.into());
12172 self
12173 }
12174
12175 /// Sets or clears the value of [logging_config][crate::model::SparkJob::logging_config].
12176 ///
12177 /// # Example
12178 /// ```ignore,no_run
12179 /// # use google_cloud_dataproc_v1::model::SparkJob;
12180 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12181 /// let x = SparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12182 /// let x = SparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12183 /// ```
12184 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12185 where
12186 T: std::convert::Into<crate::model::LoggingConfig>,
12187 {
12188 self.logging_config = v.map(|x| x.into());
12189 self
12190 }
12191
12192 /// Sets the value of [driver][crate::model::SparkJob::driver].
12193 ///
12194 /// Note that all the setters affecting `driver` are mutually
12195 /// exclusive.
12196 ///
12197 /// # Example
12198 /// ```ignore,no_run
12199 /// # use google_cloud_dataproc_v1::model::SparkJob;
12200 /// use google_cloud_dataproc_v1::model::spark_job::Driver;
12201 /// let x = SparkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
12202 /// ```
12203 pub fn set_driver<
12204 T: std::convert::Into<std::option::Option<crate::model::spark_job::Driver>>,
12205 >(
12206 mut self,
12207 v: T,
12208 ) -> Self {
12209 self.driver = v.into();
12210 self
12211 }
12212
12213 /// The value of [driver][crate::model::SparkJob::driver]
12214 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
12215 /// holds a different branch.
12216 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
12217 #[allow(unreachable_patterns)]
12218 self.driver.as_ref().and_then(|v| match v {
12219 crate::model::spark_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
12220 _ => std::option::Option::None,
12221 })
12222 }
12223
12224 /// Sets the value of [driver][crate::model::SparkJob::driver]
12225 /// to hold a `MainJarFileUri`.
12226 ///
12227 /// Note that all the setters affecting `driver` are
12228 /// mutually exclusive.
12229 ///
12230 /// # Example
12231 /// ```ignore,no_run
12232 /// # use google_cloud_dataproc_v1::model::SparkJob;
12233 /// let x = SparkJob::new().set_main_jar_file_uri("example");
12234 /// assert!(x.main_jar_file_uri().is_some());
12235 /// assert!(x.main_class().is_none());
12236 /// ```
12237 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
12238 mut self,
12239 v: T,
12240 ) -> Self {
12241 self.driver =
12242 std::option::Option::Some(crate::model::spark_job::Driver::MainJarFileUri(v.into()));
12243 self
12244 }
12245
12246 /// The value of [driver][crate::model::SparkJob::driver]
12247 /// if it holds a `MainClass`, `None` if the field is not set or
12248 /// holds a different branch.
12249 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
12250 #[allow(unreachable_patterns)]
12251 self.driver.as_ref().and_then(|v| match v {
12252 crate::model::spark_job::Driver::MainClass(v) => std::option::Option::Some(v),
12253 _ => std::option::Option::None,
12254 })
12255 }
12256
12257 /// Sets the value of [driver][crate::model::SparkJob::driver]
12258 /// to hold a `MainClass`.
12259 ///
12260 /// Note that all the setters affecting `driver` are
12261 /// mutually exclusive.
12262 ///
12263 /// # Example
12264 /// ```ignore,no_run
12265 /// # use google_cloud_dataproc_v1::model::SparkJob;
12266 /// let x = SparkJob::new().set_main_class("example");
12267 /// assert!(x.main_class().is_some());
12268 /// assert!(x.main_jar_file_uri().is_none());
12269 /// ```
12270 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12271 self.driver =
12272 std::option::Option::Some(crate::model::spark_job::Driver::MainClass(v.into()));
12273 self
12274 }
12275}
12276
12277impl wkt::message::Message for SparkJob {
12278 fn typename() -> &'static str {
12279 "type.googleapis.com/google.cloud.dataproc.v1.SparkJob"
12280 }
12281}
12282
12283/// Defines additional types related to [SparkJob].
12284pub mod spark_job {
12285 #[allow(unused_imports)]
12286 use super::*;
12287
12288 /// Required. The specification of the main method to call to drive the job.
12289 /// Specify either the jar file that contains the main class or the main class
12290 /// name. To pass both a main jar and a main class in that jar, add the jar to
12291 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
12292 /// specify the main class name in
12293 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
12294 ///
12295 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
12296 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
12297 #[derive(Clone, Debug, PartialEq)]
12298 #[non_exhaustive]
12299 pub enum Driver {
12300 /// The HCFS URI of the jar file that contains the main class.
12301 MainJarFileUri(std::string::String),
12302 /// The name of the driver's main class. The jar file that contains the class
12303 /// must be in the default CLASSPATH or specified in
12304 /// SparkJob.jar_file_uris.
12305 MainClass(std::string::String),
12306 }
12307}
12308
12309/// A Dataproc job for running
12310/// [Apache
12311/// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html)
12312/// applications on YARN.
12313#[derive(Clone, Default, PartialEq)]
12314#[non_exhaustive]
12315pub struct PySparkJob {
12316 /// Required. The HCFS URI of the main Python file to use as the driver. Must
12317 /// be a .py file.
12318 pub main_python_file_uri: std::string::String,
12319
12320 /// Optional. The arguments to pass to the driver. Do not include arguments,
12321 /// such as `--conf`, that can be set as job properties, since a collision may
12322 /// occur that causes an incorrect job submission.
12323 pub args: std::vec::Vec<std::string::String>,
12324
12325 /// Optional. HCFS file URIs of Python files to pass to the PySpark
12326 /// framework. Supported file types: .py, .egg, and .zip.
12327 pub python_file_uris: std::vec::Vec<std::string::String>,
12328
12329 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
12330 /// Python driver and tasks.
12331 pub jar_file_uris: std::vec::Vec<std::string::String>,
12332
12333 /// Optional. HCFS URIs of files to be placed in the working directory of
12334 /// each executor. Useful for naively parallel tasks.
12335 pub file_uris: std::vec::Vec<std::string::String>,
12336
12337 /// Optional. HCFS URIs of archives to be extracted into the working directory
12338 /// of each executor. Supported file types:
12339 /// .jar, .tar, .tar.gz, .tgz, and .zip.
12340 pub archive_uris: std::vec::Vec<std::string::String>,
12341
12342 /// Optional. A mapping of property names to values, used to configure PySpark.
12343 /// Properties that conflict with values set by the Dataproc API might be
12344 /// overwritten. Can include properties set in
12345 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
12346 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12347
12348 /// Optional. The runtime log config for job execution.
12349 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12350
12351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12352}
12353
12354impl PySparkJob {
12355 /// Creates a new default instance.
12356 pub fn new() -> Self {
12357 std::default::Default::default()
12358 }
12359
12360 /// Sets the value of [main_python_file_uri][crate::model::PySparkJob::main_python_file_uri].
12361 ///
12362 /// # Example
12363 /// ```ignore,no_run
12364 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12365 /// let x = PySparkJob::new().set_main_python_file_uri("example");
12366 /// ```
12367 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
12368 mut self,
12369 v: T,
12370 ) -> Self {
12371 self.main_python_file_uri = v.into();
12372 self
12373 }
12374
12375 /// Sets the value of [args][crate::model::PySparkJob::args].
12376 ///
12377 /// # Example
12378 /// ```ignore,no_run
12379 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12380 /// let x = PySparkJob::new().set_args(["a", "b", "c"]);
12381 /// ```
12382 pub fn set_args<T, V>(mut self, v: T) -> Self
12383 where
12384 T: std::iter::IntoIterator<Item = V>,
12385 V: std::convert::Into<std::string::String>,
12386 {
12387 use std::iter::Iterator;
12388 self.args = v.into_iter().map(|i| i.into()).collect();
12389 self
12390 }
12391
12392 /// Sets the value of [python_file_uris][crate::model::PySparkJob::python_file_uris].
12393 ///
12394 /// # Example
12395 /// ```ignore,no_run
12396 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12397 /// let x = PySparkJob::new().set_python_file_uris(["a", "b", "c"]);
12398 /// ```
12399 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
12400 where
12401 T: std::iter::IntoIterator<Item = V>,
12402 V: std::convert::Into<std::string::String>,
12403 {
12404 use std::iter::Iterator;
12405 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
12406 self
12407 }
12408
12409 /// Sets the value of [jar_file_uris][crate::model::PySparkJob::jar_file_uris].
12410 ///
12411 /// # Example
12412 /// ```ignore,no_run
12413 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12414 /// let x = PySparkJob::new().set_jar_file_uris(["a", "b", "c"]);
12415 /// ```
12416 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12417 where
12418 T: std::iter::IntoIterator<Item = V>,
12419 V: std::convert::Into<std::string::String>,
12420 {
12421 use std::iter::Iterator;
12422 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12423 self
12424 }
12425
12426 /// Sets the value of [file_uris][crate::model::PySparkJob::file_uris].
12427 ///
12428 /// # Example
12429 /// ```ignore,no_run
12430 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12431 /// let x = PySparkJob::new().set_file_uris(["a", "b", "c"]);
12432 /// ```
12433 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
12434 where
12435 T: std::iter::IntoIterator<Item = V>,
12436 V: std::convert::Into<std::string::String>,
12437 {
12438 use std::iter::Iterator;
12439 self.file_uris = v.into_iter().map(|i| i.into()).collect();
12440 self
12441 }
12442
12443 /// Sets the value of [archive_uris][crate::model::PySparkJob::archive_uris].
12444 ///
12445 /// # Example
12446 /// ```ignore,no_run
12447 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12448 /// let x = PySparkJob::new().set_archive_uris(["a", "b", "c"]);
12449 /// ```
12450 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
12451 where
12452 T: std::iter::IntoIterator<Item = V>,
12453 V: std::convert::Into<std::string::String>,
12454 {
12455 use std::iter::Iterator;
12456 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
12457 self
12458 }
12459
12460 /// Sets the value of [properties][crate::model::PySparkJob::properties].
12461 ///
12462 /// # Example
12463 /// ```ignore,no_run
12464 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12465 /// let x = PySparkJob::new().set_properties([
12466 /// ("key0", "abc"),
12467 /// ("key1", "xyz"),
12468 /// ]);
12469 /// ```
12470 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12471 where
12472 T: std::iter::IntoIterator<Item = (K, V)>,
12473 K: std::convert::Into<std::string::String>,
12474 V: std::convert::Into<std::string::String>,
12475 {
12476 use std::iter::Iterator;
12477 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12478 self
12479 }
12480
12481 /// Sets the value of [logging_config][crate::model::PySparkJob::logging_config].
12482 ///
12483 /// # Example
12484 /// ```ignore,no_run
12485 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12486 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12487 /// let x = PySparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12488 /// ```
12489 pub fn set_logging_config<T>(mut self, v: T) -> Self
12490 where
12491 T: std::convert::Into<crate::model::LoggingConfig>,
12492 {
12493 self.logging_config = std::option::Option::Some(v.into());
12494 self
12495 }
12496
12497 /// Sets or clears the value of [logging_config][crate::model::PySparkJob::logging_config].
12498 ///
12499 /// # Example
12500 /// ```ignore,no_run
12501 /// # use google_cloud_dataproc_v1::model::PySparkJob;
12502 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12503 /// let x = PySparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12504 /// let x = PySparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12505 /// ```
12506 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12507 where
12508 T: std::convert::Into<crate::model::LoggingConfig>,
12509 {
12510 self.logging_config = v.map(|x| x.into());
12511 self
12512 }
12513}
12514
12515impl wkt::message::Message for PySparkJob {
12516 fn typename() -> &'static str {
12517 "type.googleapis.com/google.cloud.dataproc.v1.PySparkJob"
12518 }
12519}
12520
12521/// A list of queries to run on a cluster.
12522#[derive(Clone, Default, PartialEq)]
12523#[non_exhaustive]
12524pub struct QueryList {
12525 /// Required. The queries to execute. You do not need to end a query expression
12526 /// with a semicolon. Multiple queries can be specified in one
12527 /// string by separating each with a semicolon. Here is an example of a
12528 /// Dataproc API snippet that uses a QueryList to specify a HiveJob:
12529 ///
12530 /// ```norust
12531 /// "hiveJob": {
12532 /// "queryList": {
12533 /// "queries": [
12534 /// "query1",
12535 /// "query2",
12536 /// "query3;query4",
12537 /// ]
12538 /// }
12539 /// }
12540 /// ```
12541 pub queries: std::vec::Vec<std::string::String>,
12542
12543 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12544}
12545
12546impl QueryList {
12547 /// Creates a new default instance.
12548 pub fn new() -> Self {
12549 std::default::Default::default()
12550 }
12551
12552 /// Sets the value of [queries][crate::model::QueryList::queries].
12553 ///
12554 /// # Example
12555 /// ```ignore,no_run
12556 /// # use google_cloud_dataproc_v1::model::QueryList;
12557 /// let x = QueryList::new().set_queries(["a", "b", "c"]);
12558 /// ```
12559 pub fn set_queries<T, V>(mut self, v: T) -> Self
12560 where
12561 T: std::iter::IntoIterator<Item = V>,
12562 V: std::convert::Into<std::string::String>,
12563 {
12564 use std::iter::Iterator;
12565 self.queries = v.into_iter().map(|i| i.into()).collect();
12566 self
12567 }
12568}
12569
12570impl wkt::message::Message for QueryList {
12571 fn typename() -> &'static str {
12572 "type.googleapis.com/google.cloud.dataproc.v1.QueryList"
12573 }
12574}
12575
12576/// A Dataproc job for running [Apache Hive](https://hive.apache.org/)
12577/// queries on YARN.
12578#[derive(Clone, Default, PartialEq)]
12579#[non_exhaustive]
12580pub struct HiveJob {
12581 /// Optional. Whether to continue executing queries if a query fails.
12582 /// The default value is `false`. Setting to `true` can be useful when
12583 /// executing independent parallel queries.
12584 pub continue_on_failure: bool,
12585
12586 /// Optional. Mapping of query variable names to values (equivalent to the
12587 /// Hive command: `SET name="value";`).
12588 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
12589
12590 /// Optional. A mapping of property names and values, used to configure Hive.
12591 /// Properties that conflict with values set by the Dataproc API might be
12592 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
12593 /// /etc/hive/conf/hive-site.xml, and classes in user code.
12594 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12595
12596 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the
12597 /// Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes
12598 /// and UDFs.
12599 pub jar_file_uris: std::vec::Vec<std::string::String>,
12600
12601 /// Required. The sequence of Hive queries to execute, specified as either
12602 /// an HCFS file URI or a list of queries.
12603 pub queries: std::option::Option<crate::model::hive_job::Queries>,
12604
12605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12606}
12607
12608impl HiveJob {
12609 /// Creates a new default instance.
12610 pub fn new() -> Self {
12611 std::default::Default::default()
12612 }
12613
12614 /// Sets the value of [continue_on_failure][crate::model::HiveJob::continue_on_failure].
12615 ///
12616 /// # Example
12617 /// ```ignore,no_run
12618 /// # use google_cloud_dataproc_v1::model::HiveJob;
12619 /// let x = HiveJob::new().set_continue_on_failure(true);
12620 /// ```
12621 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12622 self.continue_on_failure = v.into();
12623 self
12624 }
12625
12626 /// Sets the value of [script_variables][crate::model::HiveJob::script_variables].
12627 ///
12628 /// # Example
12629 /// ```ignore,no_run
12630 /// # use google_cloud_dataproc_v1::model::HiveJob;
12631 /// let x = HiveJob::new().set_script_variables([
12632 /// ("key0", "abc"),
12633 /// ("key1", "xyz"),
12634 /// ]);
12635 /// ```
12636 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
12637 where
12638 T: std::iter::IntoIterator<Item = (K, V)>,
12639 K: std::convert::Into<std::string::String>,
12640 V: std::convert::Into<std::string::String>,
12641 {
12642 use std::iter::Iterator;
12643 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12644 self
12645 }
12646
12647 /// Sets the value of [properties][crate::model::HiveJob::properties].
12648 ///
12649 /// # Example
12650 /// ```ignore,no_run
12651 /// # use google_cloud_dataproc_v1::model::HiveJob;
12652 /// let x = HiveJob::new().set_properties([
12653 /// ("key0", "abc"),
12654 /// ("key1", "xyz"),
12655 /// ]);
12656 /// ```
12657 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12658 where
12659 T: std::iter::IntoIterator<Item = (K, V)>,
12660 K: std::convert::Into<std::string::String>,
12661 V: std::convert::Into<std::string::String>,
12662 {
12663 use std::iter::Iterator;
12664 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12665 self
12666 }
12667
12668 /// Sets the value of [jar_file_uris][crate::model::HiveJob::jar_file_uris].
12669 ///
12670 /// # Example
12671 /// ```ignore,no_run
12672 /// # use google_cloud_dataproc_v1::model::HiveJob;
12673 /// let x = HiveJob::new().set_jar_file_uris(["a", "b", "c"]);
12674 /// ```
12675 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12676 where
12677 T: std::iter::IntoIterator<Item = V>,
12678 V: std::convert::Into<std::string::String>,
12679 {
12680 use std::iter::Iterator;
12681 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12682 self
12683 }
12684
12685 /// Sets the value of [queries][crate::model::HiveJob::queries].
12686 ///
12687 /// Note that all the setters affecting `queries` are mutually
12688 /// exclusive.
12689 ///
12690 /// # Example
12691 /// ```ignore,no_run
12692 /// # use google_cloud_dataproc_v1::model::HiveJob;
12693 /// use google_cloud_dataproc_v1::model::hive_job::Queries;
12694 /// let x = HiveJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12695 /// ```
12696 pub fn set_queries<
12697 T: std::convert::Into<std::option::Option<crate::model::hive_job::Queries>>,
12698 >(
12699 mut self,
12700 v: T,
12701 ) -> Self {
12702 self.queries = v.into();
12703 self
12704 }
12705
12706 /// The value of [queries][crate::model::HiveJob::queries]
12707 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12708 /// holds a different branch.
12709 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12710 #[allow(unreachable_patterns)]
12711 self.queries.as_ref().and_then(|v| match v {
12712 crate::model::hive_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12713 _ => std::option::Option::None,
12714 })
12715 }
12716
12717 /// Sets the value of [queries][crate::model::HiveJob::queries]
12718 /// to hold a `QueryFileUri`.
12719 ///
12720 /// Note that all the setters affecting `queries` are
12721 /// mutually exclusive.
12722 ///
12723 /// # Example
12724 /// ```ignore,no_run
12725 /// # use google_cloud_dataproc_v1::model::HiveJob;
12726 /// let x = HiveJob::new().set_query_file_uri("example");
12727 /// assert!(x.query_file_uri().is_some());
12728 /// assert!(x.query_list().is_none());
12729 /// ```
12730 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12731 self.queries =
12732 std::option::Option::Some(crate::model::hive_job::Queries::QueryFileUri(v.into()));
12733 self
12734 }
12735
12736 /// The value of [queries][crate::model::HiveJob::queries]
12737 /// if it holds a `QueryList`, `None` if the field is not set or
12738 /// holds a different branch.
12739 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12740 #[allow(unreachable_patterns)]
12741 self.queries.as_ref().and_then(|v| match v {
12742 crate::model::hive_job::Queries::QueryList(v) => std::option::Option::Some(v),
12743 _ => std::option::Option::None,
12744 })
12745 }
12746
12747 /// Sets the value of [queries][crate::model::HiveJob::queries]
12748 /// to hold a `QueryList`.
12749 ///
12750 /// Note that all the setters affecting `queries` are
12751 /// mutually exclusive.
12752 ///
12753 /// # Example
12754 /// ```ignore,no_run
12755 /// # use google_cloud_dataproc_v1::model::HiveJob;
12756 /// use google_cloud_dataproc_v1::model::QueryList;
12757 /// let x = HiveJob::new().set_query_list(QueryList::default()/* use setters */);
12758 /// assert!(x.query_list().is_some());
12759 /// assert!(x.query_file_uri().is_none());
12760 /// ```
12761 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12762 mut self,
12763 v: T,
12764 ) -> Self {
12765 self.queries =
12766 std::option::Option::Some(crate::model::hive_job::Queries::QueryList(v.into()));
12767 self
12768 }
12769}
12770
12771impl wkt::message::Message for HiveJob {
12772 fn typename() -> &'static str {
12773 "type.googleapis.com/google.cloud.dataproc.v1.HiveJob"
12774 }
12775}
12776
12777/// Defines additional types related to [HiveJob].
12778pub mod hive_job {
12779 #[allow(unused_imports)]
12780 use super::*;
12781
12782 /// Required. The sequence of Hive queries to execute, specified as either
12783 /// an HCFS file URI or a list of queries.
12784 #[derive(Clone, Debug, PartialEq)]
12785 #[non_exhaustive]
12786 pub enum Queries {
12787 /// The HCFS URI of the script that contains Hive queries.
12788 QueryFileUri(std::string::String),
12789 /// A list of queries.
12790 QueryList(std::boxed::Box<crate::model::QueryList>),
12791 }
12792}
12793
12794/// A Dataproc job for running [Apache Spark
12795/// SQL](https://spark.apache.org/sql/) queries.
12796#[derive(Clone, Default, PartialEq)]
12797#[non_exhaustive]
12798pub struct SparkSqlJob {
12799 /// Optional. Mapping of query variable names to values (equivalent to the
12800 /// Spark SQL command: SET `name="value";`).
12801 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
12802
12803 /// Optional. A mapping of property names to values, used to configure
12804 /// Spark SQL's SparkConf. Properties that conflict with values set by the
12805 /// Dataproc API might be overwritten.
12806 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12807
12808 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
12809 pub jar_file_uris: std::vec::Vec<std::string::String>,
12810
12811 /// Optional. The runtime log config for job execution.
12812 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12813
12814 /// Required. The sequence of Spark SQL queries to execute, specified as
12815 /// either an HCFS file URI or as a list of queries.
12816 pub queries: std::option::Option<crate::model::spark_sql_job::Queries>,
12817
12818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12819}
12820
12821impl SparkSqlJob {
12822 /// Creates a new default instance.
12823 pub fn new() -> Self {
12824 std::default::Default::default()
12825 }
12826
12827 /// Sets the value of [script_variables][crate::model::SparkSqlJob::script_variables].
12828 ///
12829 /// # Example
12830 /// ```ignore,no_run
12831 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12832 /// let x = SparkSqlJob::new().set_script_variables([
12833 /// ("key0", "abc"),
12834 /// ("key1", "xyz"),
12835 /// ]);
12836 /// ```
12837 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
12838 where
12839 T: std::iter::IntoIterator<Item = (K, V)>,
12840 K: std::convert::Into<std::string::String>,
12841 V: std::convert::Into<std::string::String>,
12842 {
12843 use std::iter::Iterator;
12844 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12845 self
12846 }
12847
12848 /// Sets the value of [properties][crate::model::SparkSqlJob::properties].
12849 ///
12850 /// # Example
12851 /// ```ignore,no_run
12852 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12853 /// let x = SparkSqlJob::new().set_properties([
12854 /// ("key0", "abc"),
12855 /// ("key1", "xyz"),
12856 /// ]);
12857 /// ```
12858 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12859 where
12860 T: std::iter::IntoIterator<Item = (K, V)>,
12861 K: std::convert::Into<std::string::String>,
12862 V: std::convert::Into<std::string::String>,
12863 {
12864 use std::iter::Iterator;
12865 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12866 self
12867 }
12868
12869 /// Sets the value of [jar_file_uris][crate::model::SparkSqlJob::jar_file_uris].
12870 ///
12871 /// # Example
12872 /// ```ignore,no_run
12873 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12874 /// let x = SparkSqlJob::new().set_jar_file_uris(["a", "b", "c"]);
12875 /// ```
12876 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12877 where
12878 T: std::iter::IntoIterator<Item = V>,
12879 V: std::convert::Into<std::string::String>,
12880 {
12881 use std::iter::Iterator;
12882 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12883 self
12884 }
12885
12886 /// Sets the value of [logging_config][crate::model::SparkSqlJob::logging_config].
12887 ///
12888 /// # Example
12889 /// ```ignore,no_run
12890 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12891 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12892 /// let x = SparkSqlJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12893 /// ```
12894 pub fn set_logging_config<T>(mut self, v: T) -> Self
12895 where
12896 T: std::convert::Into<crate::model::LoggingConfig>,
12897 {
12898 self.logging_config = std::option::Option::Some(v.into());
12899 self
12900 }
12901
12902 /// Sets or clears the value of [logging_config][crate::model::SparkSqlJob::logging_config].
12903 ///
12904 /// # Example
12905 /// ```ignore,no_run
12906 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12907 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12908 /// let x = SparkSqlJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12909 /// let x = SparkSqlJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12910 /// ```
12911 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12912 where
12913 T: std::convert::Into<crate::model::LoggingConfig>,
12914 {
12915 self.logging_config = v.map(|x| x.into());
12916 self
12917 }
12918
12919 /// Sets the value of [queries][crate::model::SparkSqlJob::queries].
12920 ///
12921 /// Note that all the setters affecting `queries` are mutually
12922 /// exclusive.
12923 ///
12924 /// # Example
12925 /// ```ignore,no_run
12926 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12927 /// use google_cloud_dataproc_v1::model::spark_sql_job::Queries;
12928 /// let x = SparkSqlJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12929 /// ```
12930 pub fn set_queries<
12931 T: std::convert::Into<std::option::Option<crate::model::spark_sql_job::Queries>>,
12932 >(
12933 mut self,
12934 v: T,
12935 ) -> Self {
12936 self.queries = v.into();
12937 self
12938 }
12939
12940 /// The value of [queries][crate::model::SparkSqlJob::queries]
12941 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12942 /// holds a different branch.
12943 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12944 #[allow(unreachable_patterns)]
12945 self.queries.as_ref().and_then(|v| match v {
12946 crate::model::spark_sql_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12947 _ => std::option::Option::None,
12948 })
12949 }
12950
12951 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
12952 /// to hold a `QueryFileUri`.
12953 ///
12954 /// Note that all the setters affecting `queries` are
12955 /// mutually exclusive.
12956 ///
12957 /// # Example
12958 /// ```ignore,no_run
12959 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12960 /// let x = SparkSqlJob::new().set_query_file_uri("example");
12961 /// assert!(x.query_file_uri().is_some());
12962 /// assert!(x.query_list().is_none());
12963 /// ```
12964 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12965 self.queries =
12966 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryFileUri(v.into()));
12967 self
12968 }
12969
12970 /// The value of [queries][crate::model::SparkSqlJob::queries]
12971 /// if it holds a `QueryList`, `None` if the field is not set or
12972 /// holds a different branch.
12973 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12974 #[allow(unreachable_patterns)]
12975 self.queries.as_ref().and_then(|v| match v {
12976 crate::model::spark_sql_job::Queries::QueryList(v) => std::option::Option::Some(v),
12977 _ => std::option::Option::None,
12978 })
12979 }
12980
12981 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
12982 /// to hold a `QueryList`.
12983 ///
12984 /// Note that all the setters affecting `queries` are
12985 /// mutually exclusive.
12986 ///
12987 /// # Example
12988 /// ```ignore,no_run
12989 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12990 /// use google_cloud_dataproc_v1::model::QueryList;
12991 /// let x = SparkSqlJob::new().set_query_list(QueryList::default()/* use setters */);
12992 /// assert!(x.query_list().is_some());
12993 /// assert!(x.query_file_uri().is_none());
12994 /// ```
12995 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12996 mut self,
12997 v: T,
12998 ) -> Self {
12999 self.queries =
13000 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryList(v.into()));
13001 self
13002 }
13003}
13004
13005impl wkt::message::Message for SparkSqlJob {
13006 fn typename() -> &'static str {
13007 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlJob"
13008 }
13009}
13010
13011/// Defines additional types related to [SparkSqlJob].
13012pub mod spark_sql_job {
13013 #[allow(unused_imports)]
13014 use super::*;
13015
13016 /// Required. The sequence of Spark SQL queries to execute, specified as
13017 /// either an HCFS file URI or as a list of queries.
13018 #[derive(Clone, Debug, PartialEq)]
13019 #[non_exhaustive]
13020 pub enum Queries {
13021 /// The HCFS URI of the script that contains SQL queries.
13022 QueryFileUri(std::string::String),
13023 /// A list of queries.
13024 QueryList(std::boxed::Box<crate::model::QueryList>),
13025 }
13026}
13027
13028/// A Dataproc job for running [Apache Pig](https://pig.apache.org/)
13029/// queries on YARN.
13030#[derive(Clone, Default, PartialEq)]
13031#[non_exhaustive]
13032pub struct PigJob {
13033 /// Optional. Whether to continue executing queries if a query fails.
13034 /// The default value is `false`. Setting to `true` can be useful when
13035 /// executing independent parallel queries.
13036 pub continue_on_failure: bool,
13037
13038 /// Optional. Mapping of query variable names to values (equivalent to the Pig
13039 /// command: `name=[value]`).
13040 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
13041
13042 /// Optional. A mapping of property names to values, used to configure Pig.
13043 /// Properties that conflict with values set by the Dataproc API might be
13044 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
13045 /// /etc/pig/conf/pig.properties, and classes in user code.
13046 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13047
13048 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of
13049 /// the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
13050 pub jar_file_uris: std::vec::Vec<std::string::String>,
13051
13052 /// Optional. The runtime log config for job execution.
13053 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13054
13055 /// Required. The sequence of Pig queries to execute, specified as an HCFS
13056 /// file URI or a list of queries.
13057 pub queries: std::option::Option<crate::model::pig_job::Queries>,
13058
13059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13060}
13061
13062impl PigJob {
13063 /// Creates a new default instance.
13064 pub fn new() -> Self {
13065 std::default::Default::default()
13066 }
13067
13068 /// Sets the value of [continue_on_failure][crate::model::PigJob::continue_on_failure].
13069 ///
13070 /// # Example
13071 /// ```ignore,no_run
13072 /// # use google_cloud_dataproc_v1::model::PigJob;
13073 /// let x = PigJob::new().set_continue_on_failure(true);
13074 /// ```
13075 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13076 self.continue_on_failure = v.into();
13077 self
13078 }
13079
13080 /// Sets the value of [script_variables][crate::model::PigJob::script_variables].
13081 ///
13082 /// # Example
13083 /// ```ignore,no_run
13084 /// # use google_cloud_dataproc_v1::model::PigJob;
13085 /// let x = PigJob::new().set_script_variables([
13086 /// ("key0", "abc"),
13087 /// ("key1", "xyz"),
13088 /// ]);
13089 /// ```
13090 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
13091 where
13092 T: std::iter::IntoIterator<Item = (K, V)>,
13093 K: std::convert::Into<std::string::String>,
13094 V: std::convert::Into<std::string::String>,
13095 {
13096 use std::iter::Iterator;
13097 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13098 self
13099 }
13100
13101 /// Sets the value of [properties][crate::model::PigJob::properties].
13102 ///
13103 /// # Example
13104 /// ```ignore,no_run
13105 /// # use google_cloud_dataproc_v1::model::PigJob;
13106 /// let x = PigJob::new().set_properties([
13107 /// ("key0", "abc"),
13108 /// ("key1", "xyz"),
13109 /// ]);
13110 /// ```
13111 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
13112 where
13113 T: std::iter::IntoIterator<Item = (K, V)>,
13114 K: std::convert::Into<std::string::String>,
13115 V: std::convert::Into<std::string::String>,
13116 {
13117 use std::iter::Iterator;
13118 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13119 self
13120 }
13121
13122 /// Sets the value of [jar_file_uris][crate::model::PigJob::jar_file_uris].
13123 ///
13124 /// # Example
13125 /// ```ignore,no_run
13126 /// # use google_cloud_dataproc_v1::model::PigJob;
13127 /// let x = PigJob::new().set_jar_file_uris(["a", "b", "c"]);
13128 /// ```
13129 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
13130 where
13131 T: std::iter::IntoIterator<Item = V>,
13132 V: std::convert::Into<std::string::String>,
13133 {
13134 use std::iter::Iterator;
13135 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
13136 self
13137 }
13138
13139 /// Sets the value of [logging_config][crate::model::PigJob::logging_config].
13140 ///
13141 /// # Example
13142 /// ```ignore,no_run
13143 /// # use google_cloud_dataproc_v1::model::PigJob;
13144 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13145 /// let x = PigJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13146 /// ```
13147 pub fn set_logging_config<T>(mut self, v: T) -> Self
13148 where
13149 T: std::convert::Into<crate::model::LoggingConfig>,
13150 {
13151 self.logging_config = std::option::Option::Some(v.into());
13152 self
13153 }
13154
13155 /// Sets or clears the value of [logging_config][crate::model::PigJob::logging_config].
13156 ///
13157 /// # Example
13158 /// ```ignore,no_run
13159 /// # use google_cloud_dataproc_v1::model::PigJob;
13160 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13161 /// let x = PigJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13162 /// let x = PigJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13163 /// ```
13164 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13165 where
13166 T: std::convert::Into<crate::model::LoggingConfig>,
13167 {
13168 self.logging_config = v.map(|x| x.into());
13169 self
13170 }
13171
13172 /// Sets the value of [queries][crate::model::PigJob::queries].
13173 ///
13174 /// Note that all the setters affecting `queries` are mutually
13175 /// exclusive.
13176 ///
13177 /// # Example
13178 /// ```ignore,no_run
13179 /// # use google_cloud_dataproc_v1::model::PigJob;
13180 /// use google_cloud_dataproc_v1::model::pig_job::Queries;
13181 /// let x = PigJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
13182 /// ```
13183 pub fn set_queries<
13184 T: std::convert::Into<std::option::Option<crate::model::pig_job::Queries>>,
13185 >(
13186 mut self,
13187 v: T,
13188 ) -> Self {
13189 self.queries = v.into();
13190 self
13191 }
13192
13193 /// The value of [queries][crate::model::PigJob::queries]
13194 /// if it holds a `QueryFileUri`, `None` if the field is not set or
13195 /// holds a different branch.
13196 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
13197 #[allow(unreachable_patterns)]
13198 self.queries.as_ref().and_then(|v| match v {
13199 crate::model::pig_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
13200 _ => std::option::Option::None,
13201 })
13202 }
13203
13204 /// Sets the value of [queries][crate::model::PigJob::queries]
13205 /// to hold a `QueryFileUri`.
13206 ///
13207 /// Note that all the setters affecting `queries` are
13208 /// mutually exclusive.
13209 ///
13210 /// # Example
13211 /// ```ignore,no_run
13212 /// # use google_cloud_dataproc_v1::model::PigJob;
13213 /// let x = PigJob::new().set_query_file_uri("example");
13214 /// assert!(x.query_file_uri().is_some());
13215 /// assert!(x.query_list().is_none());
13216 /// ```
13217 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13218 self.queries =
13219 std::option::Option::Some(crate::model::pig_job::Queries::QueryFileUri(v.into()));
13220 self
13221 }
13222
13223 /// The value of [queries][crate::model::PigJob::queries]
13224 /// if it holds a `QueryList`, `None` if the field is not set or
13225 /// holds a different branch.
13226 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
13227 #[allow(unreachable_patterns)]
13228 self.queries.as_ref().and_then(|v| match v {
13229 crate::model::pig_job::Queries::QueryList(v) => std::option::Option::Some(v),
13230 _ => std::option::Option::None,
13231 })
13232 }
13233
13234 /// Sets the value of [queries][crate::model::PigJob::queries]
13235 /// to hold a `QueryList`.
13236 ///
13237 /// Note that all the setters affecting `queries` are
13238 /// mutually exclusive.
13239 ///
13240 /// # Example
13241 /// ```ignore,no_run
13242 /// # use google_cloud_dataproc_v1::model::PigJob;
13243 /// use google_cloud_dataproc_v1::model::QueryList;
13244 /// let x = PigJob::new().set_query_list(QueryList::default()/* use setters */);
13245 /// assert!(x.query_list().is_some());
13246 /// assert!(x.query_file_uri().is_none());
13247 /// ```
13248 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
13249 mut self,
13250 v: T,
13251 ) -> Self {
13252 self.queries =
13253 std::option::Option::Some(crate::model::pig_job::Queries::QueryList(v.into()));
13254 self
13255 }
13256}
13257
13258impl wkt::message::Message for PigJob {
13259 fn typename() -> &'static str {
13260 "type.googleapis.com/google.cloud.dataproc.v1.PigJob"
13261 }
13262}
13263
13264/// Defines additional types related to [PigJob].
13265pub mod pig_job {
13266 #[allow(unused_imports)]
13267 use super::*;
13268
13269 /// Required. The sequence of Pig queries to execute, specified as an HCFS
13270 /// file URI or a list of queries.
13271 #[derive(Clone, Debug, PartialEq)]
13272 #[non_exhaustive]
13273 pub enum Queries {
13274 /// The HCFS URI of the script that contains the Pig queries.
13275 QueryFileUri(std::string::String),
13276 /// A list of queries.
13277 QueryList(std::boxed::Box<crate::model::QueryList>),
13278 }
13279}
13280
13281/// A Dataproc job for running
13282/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
13283/// applications on YARN.
13284#[derive(Clone, Default, PartialEq)]
13285#[non_exhaustive]
13286pub struct SparkRJob {
13287 /// Required. The HCFS URI of the main R file to use as the driver.
13288 /// Must be a .R file.
13289 pub main_r_file_uri: std::string::String,
13290
13291 /// Optional. The arguments to pass to the driver. Do not include arguments,
13292 /// such as `--conf`, that can be set as job properties, since a collision may
13293 /// occur that causes an incorrect job submission.
13294 pub args: std::vec::Vec<std::string::String>,
13295
13296 /// Optional. HCFS URIs of files to be placed in the working directory of
13297 /// each executor. Useful for naively parallel tasks.
13298 pub file_uris: std::vec::Vec<std::string::String>,
13299
13300 /// Optional. HCFS URIs of archives to be extracted into the working directory
13301 /// of each executor. Supported file types:
13302 /// .jar, .tar, .tar.gz, .tgz, and .zip.
13303 pub archive_uris: std::vec::Vec<std::string::String>,
13304
13305 /// Optional. A mapping of property names to values, used to configure SparkR.
13306 /// Properties that conflict with values set by the Dataproc API might be
13307 /// overwritten. Can include properties set in
13308 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
13309 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13310
13311 /// Optional. The runtime log config for job execution.
13312 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13313
13314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13315}
13316
13317impl SparkRJob {
13318 /// Creates a new default instance.
13319 pub fn new() -> Self {
13320 std::default::Default::default()
13321 }
13322
13323 /// Sets the value of [main_r_file_uri][crate::model::SparkRJob::main_r_file_uri].
13324 ///
13325 /// # Example
13326 /// ```ignore,no_run
13327 /// # use google_cloud_dataproc_v1::model::SparkRJob;
13328 /// let x = SparkRJob::new().set_main_r_file_uri("example");
13329 /// ```
13330 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13331 self.main_r_file_uri = v.into();
13332 self
13333 }
13334
13335 /// Sets the value of [args][crate::model::SparkRJob::args].
13336 ///
13337 /// # Example
13338 /// ```ignore,no_run
13339 /// # use google_cloud_dataproc_v1::model::SparkRJob;
13340 /// let x = SparkRJob::new().set_args(["a", "b", "c"]);
13341 /// ```
13342 pub fn set_args<T, V>(mut self, v: T) -> Self
13343 where
13344 T: std::iter::IntoIterator<Item = V>,
13345 V: std::convert::Into<std::string::String>,
13346 {
13347 use std::iter::Iterator;
13348 self.args = v.into_iter().map(|i| i.into()).collect();
13349 self
13350 }
13351
13352 /// Sets the value of [file_uris][crate::model::SparkRJob::file_uris].
13353 ///
13354 /// # Example
13355 /// ```ignore,no_run
13356 /// # use google_cloud_dataproc_v1::model::SparkRJob;
13357 /// let x = SparkRJob::new().set_file_uris(["a", "b", "c"]);
13358 /// ```
13359 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
13360 where
13361 T: std::iter::IntoIterator<Item = V>,
13362 V: std::convert::Into<std::string::String>,
13363 {
13364 use std::iter::Iterator;
13365 self.file_uris = v.into_iter().map(|i| i.into()).collect();
13366 self
13367 }
13368
13369 /// Sets the value of [archive_uris][crate::model::SparkRJob::archive_uris].
13370 ///
13371 /// # Example
13372 /// ```ignore,no_run
13373 /// # use google_cloud_dataproc_v1::model::SparkRJob;
13374 /// let x = SparkRJob::new().set_archive_uris(["a", "b", "c"]);
13375 /// ```
13376 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
13377 where
13378 T: std::iter::IntoIterator<Item = V>,
13379 V: std::convert::Into<std::string::String>,
13380 {
13381 use std::iter::Iterator;
13382 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
13383 self
13384 }
13385
13386 /// Sets the value of [properties][crate::model::SparkRJob::properties].
13387 ///
13388 /// # Example
13389 /// ```ignore,no_run
13390 /// # use google_cloud_dataproc_v1::model::SparkRJob;
13391 /// let x = SparkRJob::new().set_properties([
13392 /// ("key0", "abc"),
13393 /// ("key1", "xyz"),
13394 /// ]);
13395 /// ```
13396 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
13397 where
13398 T: std::iter::IntoIterator<Item = (K, V)>,
13399 K: std::convert::Into<std::string::String>,
13400 V: std::convert::Into<std::string::String>,
13401 {
13402 use std::iter::Iterator;
13403 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13404 self
13405 }
13406
13407 /// Sets the value of [logging_config][crate::model::SparkRJob::logging_config].
13408 ///
13409 /// # Example
13410 /// ```ignore,no_run
13411 /// # use google_cloud_dataproc_v1::model::SparkRJob;
13412 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13413 /// let x = SparkRJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13414 /// ```
13415 pub fn set_logging_config<T>(mut self, v: T) -> Self
13416 where
13417 T: std::convert::Into<crate::model::LoggingConfig>,
13418 {
13419 self.logging_config = std::option::Option::Some(v.into());
13420 self
13421 }
13422
13423 /// Sets or clears the value of [logging_config][crate::model::SparkRJob::logging_config].
13424 ///
13425 /// # Example
13426 /// ```ignore,no_run
13427 /// # use google_cloud_dataproc_v1::model::SparkRJob;
13428 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13429 /// let x = SparkRJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13430 /// let x = SparkRJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13431 /// ```
13432 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13433 where
13434 T: std::convert::Into<crate::model::LoggingConfig>,
13435 {
13436 self.logging_config = v.map(|x| x.into());
13437 self
13438 }
13439}
13440
13441impl wkt::message::Message for SparkRJob {
13442 fn typename() -> &'static str {
13443 "type.googleapis.com/google.cloud.dataproc.v1.SparkRJob"
13444 }
13445}
13446
13447/// A Dataproc job for running [Presto](https://prestosql.io/) queries.
13448/// **IMPORTANT**: The [Dataproc Presto Optional
13449/// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto)
13450/// must be enabled when the cluster is created to submit a Presto job to the
13451/// cluster.
13452#[derive(Clone, Default, PartialEq)]
13453#[non_exhaustive]
13454pub struct PrestoJob {
13455 /// Optional. Whether to continue executing queries if a query fails.
13456 /// The default value is `false`. Setting to `true` can be useful when
13457 /// executing independent parallel queries.
13458 pub continue_on_failure: bool,
13459
13460 /// Optional. The format in which query output will be displayed. See the
13461 /// Presto documentation for supported output formats
13462 pub output_format: std::string::String,
13463
13464 /// Optional. Presto client tags to attach to this query
13465 pub client_tags: std::vec::Vec<std::string::String>,
13466
13467 /// Optional. A mapping of property names to values. Used to set Presto
13468 /// [session properties](https://prestodb.io/docs/current/sql/set-session.html)
13469 /// Equivalent to using the --session flag in the Presto CLI
13470 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13471
13472 /// Optional. The runtime log config for job execution.
13473 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13474
13475 /// Required. The sequence of Presto queries to execute, specified as
13476 /// either an HCFS file URI or as a list of queries.
13477 pub queries: std::option::Option<crate::model::presto_job::Queries>,
13478
13479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13480}
13481
13482impl PrestoJob {
13483 /// Creates a new default instance.
13484 pub fn new() -> Self {
13485 std::default::Default::default()
13486 }
13487
13488 /// Sets the value of [continue_on_failure][crate::model::PrestoJob::continue_on_failure].
13489 ///
13490 /// # Example
13491 /// ```ignore,no_run
13492 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13493 /// let x = PrestoJob::new().set_continue_on_failure(true);
13494 /// ```
13495 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13496 self.continue_on_failure = v.into();
13497 self
13498 }
13499
13500 /// Sets the value of [output_format][crate::model::PrestoJob::output_format].
13501 ///
13502 /// # Example
13503 /// ```ignore,no_run
13504 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13505 /// let x = PrestoJob::new().set_output_format("example");
13506 /// ```
13507 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13508 self.output_format = v.into();
13509 self
13510 }
13511
13512 /// Sets the value of [client_tags][crate::model::PrestoJob::client_tags].
13513 ///
13514 /// # Example
13515 /// ```ignore,no_run
13516 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13517 /// let x = PrestoJob::new().set_client_tags(["a", "b", "c"]);
13518 /// ```
13519 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
13520 where
13521 T: std::iter::IntoIterator<Item = V>,
13522 V: std::convert::Into<std::string::String>,
13523 {
13524 use std::iter::Iterator;
13525 self.client_tags = v.into_iter().map(|i| i.into()).collect();
13526 self
13527 }
13528
13529 /// Sets the value of [properties][crate::model::PrestoJob::properties].
13530 ///
13531 /// # Example
13532 /// ```ignore,no_run
13533 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13534 /// let x = PrestoJob::new().set_properties([
13535 /// ("key0", "abc"),
13536 /// ("key1", "xyz"),
13537 /// ]);
13538 /// ```
13539 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
13540 where
13541 T: std::iter::IntoIterator<Item = (K, V)>,
13542 K: std::convert::Into<std::string::String>,
13543 V: std::convert::Into<std::string::String>,
13544 {
13545 use std::iter::Iterator;
13546 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13547 self
13548 }
13549
13550 /// Sets the value of [logging_config][crate::model::PrestoJob::logging_config].
13551 ///
13552 /// # Example
13553 /// ```ignore,no_run
13554 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13555 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13556 /// let x = PrestoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13557 /// ```
13558 pub fn set_logging_config<T>(mut self, v: T) -> Self
13559 where
13560 T: std::convert::Into<crate::model::LoggingConfig>,
13561 {
13562 self.logging_config = std::option::Option::Some(v.into());
13563 self
13564 }
13565
13566 /// Sets or clears the value of [logging_config][crate::model::PrestoJob::logging_config].
13567 ///
13568 /// # Example
13569 /// ```ignore,no_run
13570 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13571 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13572 /// let x = PrestoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13573 /// let x = PrestoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13574 /// ```
13575 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13576 where
13577 T: std::convert::Into<crate::model::LoggingConfig>,
13578 {
13579 self.logging_config = v.map(|x| x.into());
13580 self
13581 }
13582
13583 /// Sets the value of [queries][crate::model::PrestoJob::queries].
13584 ///
13585 /// Note that all the setters affecting `queries` are mutually
13586 /// exclusive.
13587 ///
13588 /// # Example
13589 /// ```ignore,no_run
13590 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13591 /// use google_cloud_dataproc_v1::model::presto_job::Queries;
13592 /// let x = PrestoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
13593 /// ```
13594 pub fn set_queries<
13595 T: std::convert::Into<std::option::Option<crate::model::presto_job::Queries>>,
13596 >(
13597 mut self,
13598 v: T,
13599 ) -> Self {
13600 self.queries = v.into();
13601 self
13602 }
13603
13604 /// The value of [queries][crate::model::PrestoJob::queries]
13605 /// if it holds a `QueryFileUri`, `None` if the field is not set or
13606 /// holds a different branch.
13607 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
13608 #[allow(unreachable_patterns)]
13609 self.queries.as_ref().and_then(|v| match v {
13610 crate::model::presto_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
13611 _ => std::option::Option::None,
13612 })
13613 }
13614
13615 /// Sets the value of [queries][crate::model::PrestoJob::queries]
13616 /// to hold a `QueryFileUri`.
13617 ///
13618 /// Note that all the setters affecting `queries` are
13619 /// mutually exclusive.
13620 ///
13621 /// # Example
13622 /// ```ignore,no_run
13623 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13624 /// let x = PrestoJob::new().set_query_file_uri("example");
13625 /// assert!(x.query_file_uri().is_some());
13626 /// assert!(x.query_list().is_none());
13627 /// ```
13628 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13629 self.queries =
13630 std::option::Option::Some(crate::model::presto_job::Queries::QueryFileUri(v.into()));
13631 self
13632 }
13633
13634 /// The value of [queries][crate::model::PrestoJob::queries]
13635 /// if it holds a `QueryList`, `None` if the field is not set or
13636 /// holds a different branch.
13637 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
13638 #[allow(unreachable_patterns)]
13639 self.queries.as_ref().and_then(|v| match v {
13640 crate::model::presto_job::Queries::QueryList(v) => std::option::Option::Some(v),
13641 _ => std::option::Option::None,
13642 })
13643 }
13644
13645 /// Sets the value of [queries][crate::model::PrestoJob::queries]
13646 /// to hold a `QueryList`.
13647 ///
13648 /// Note that all the setters affecting `queries` are
13649 /// mutually exclusive.
13650 ///
13651 /// # Example
13652 /// ```ignore,no_run
13653 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13654 /// use google_cloud_dataproc_v1::model::QueryList;
13655 /// let x = PrestoJob::new().set_query_list(QueryList::default()/* use setters */);
13656 /// assert!(x.query_list().is_some());
13657 /// assert!(x.query_file_uri().is_none());
13658 /// ```
13659 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
13660 mut self,
13661 v: T,
13662 ) -> Self {
13663 self.queries =
13664 std::option::Option::Some(crate::model::presto_job::Queries::QueryList(v.into()));
13665 self
13666 }
13667}
13668
13669impl wkt::message::Message for PrestoJob {
13670 fn typename() -> &'static str {
13671 "type.googleapis.com/google.cloud.dataproc.v1.PrestoJob"
13672 }
13673}
13674
13675/// Defines additional types related to [PrestoJob].
13676pub mod presto_job {
13677 #[allow(unused_imports)]
13678 use super::*;
13679
13680 /// Required. The sequence of Presto queries to execute, specified as
13681 /// either an HCFS file URI or as a list of queries.
13682 #[derive(Clone, Debug, PartialEq)]
13683 #[non_exhaustive]
13684 pub enum Queries {
13685 /// The HCFS URI of the script that contains SQL queries.
13686 QueryFileUri(std::string::String),
13687 /// A list of queries.
13688 QueryList(std::boxed::Box<crate::model::QueryList>),
13689 }
13690}
13691
13692/// A Dataproc job for running [Trino](https://trino.io/) queries.
13693/// **IMPORTANT**: The [Dataproc Trino Optional
13694/// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino)
13695/// must be enabled when the cluster is created to submit a Trino job to the
13696/// cluster.
13697#[derive(Clone, Default, PartialEq)]
13698#[non_exhaustive]
13699pub struct TrinoJob {
13700 /// Optional. Whether to continue executing queries if a query fails.
13701 /// The default value is `false`. Setting to `true` can be useful when
13702 /// executing independent parallel queries.
13703 pub continue_on_failure: bool,
13704
13705 /// Optional. The format in which query output will be displayed. See the
13706 /// Trino documentation for supported output formats
13707 pub output_format: std::string::String,
13708
13709 /// Optional. Trino client tags to attach to this query
13710 pub client_tags: std::vec::Vec<std::string::String>,
13711
13712 /// Optional. A mapping of property names to values. Used to set Trino
13713 /// [session properties](https://trino.io/docs/current/sql/set-session.html)
13714 /// Equivalent to using the --session flag in the Trino CLI
13715 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13716
13717 /// Optional. The runtime log config for job execution.
13718 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13719
13720 /// Required. The sequence of Trino queries to execute, specified as
13721 /// either an HCFS file URI or as a list of queries.
13722 pub queries: std::option::Option<crate::model::trino_job::Queries>,
13723
13724 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13725}
13726
13727impl TrinoJob {
13728 /// Creates a new default instance.
13729 pub fn new() -> Self {
13730 std::default::Default::default()
13731 }
13732
13733 /// Sets the value of [continue_on_failure][crate::model::TrinoJob::continue_on_failure].
13734 ///
13735 /// # Example
13736 /// ```ignore,no_run
13737 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13738 /// let x = TrinoJob::new().set_continue_on_failure(true);
13739 /// ```
13740 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13741 self.continue_on_failure = v.into();
13742 self
13743 }
13744
13745 /// Sets the value of [output_format][crate::model::TrinoJob::output_format].
13746 ///
13747 /// # Example
13748 /// ```ignore,no_run
13749 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13750 /// let x = TrinoJob::new().set_output_format("example");
13751 /// ```
13752 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13753 self.output_format = v.into();
13754 self
13755 }
13756
13757 /// Sets the value of [client_tags][crate::model::TrinoJob::client_tags].
13758 ///
13759 /// # Example
13760 /// ```ignore,no_run
13761 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13762 /// let x = TrinoJob::new().set_client_tags(["a", "b", "c"]);
13763 /// ```
13764 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
13765 where
13766 T: std::iter::IntoIterator<Item = V>,
13767 V: std::convert::Into<std::string::String>,
13768 {
13769 use std::iter::Iterator;
13770 self.client_tags = v.into_iter().map(|i| i.into()).collect();
13771 self
13772 }
13773
13774 /// Sets the value of [properties][crate::model::TrinoJob::properties].
13775 ///
13776 /// # Example
13777 /// ```ignore,no_run
13778 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13779 /// let x = TrinoJob::new().set_properties([
13780 /// ("key0", "abc"),
13781 /// ("key1", "xyz"),
13782 /// ]);
13783 /// ```
13784 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
13785 where
13786 T: std::iter::IntoIterator<Item = (K, V)>,
13787 K: std::convert::Into<std::string::String>,
13788 V: std::convert::Into<std::string::String>,
13789 {
13790 use std::iter::Iterator;
13791 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13792 self
13793 }
13794
13795 /// Sets the value of [logging_config][crate::model::TrinoJob::logging_config].
13796 ///
13797 /// # Example
13798 /// ```ignore,no_run
13799 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13800 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13801 /// let x = TrinoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13802 /// ```
13803 pub fn set_logging_config<T>(mut self, v: T) -> Self
13804 where
13805 T: std::convert::Into<crate::model::LoggingConfig>,
13806 {
13807 self.logging_config = std::option::Option::Some(v.into());
13808 self
13809 }
13810
13811 /// Sets or clears the value of [logging_config][crate::model::TrinoJob::logging_config].
13812 ///
13813 /// # Example
13814 /// ```ignore,no_run
13815 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13816 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13817 /// let x = TrinoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13818 /// let x = TrinoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13819 /// ```
13820 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13821 where
13822 T: std::convert::Into<crate::model::LoggingConfig>,
13823 {
13824 self.logging_config = v.map(|x| x.into());
13825 self
13826 }
13827
13828 /// Sets the value of [queries][crate::model::TrinoJob::queries].
13829 ///
13830 /// Note that all the setters affecting `queries` are mutually
13831 /// exclusive.
13832 ///
13833 /// # Example
13834 /// ```ignore,no_run
13835 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13836 /// use google_cloud_dataproc_v1::model::trino_job::Queries;
13837 /// let x = TrinoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
13838 /// ```
13839 pub fn set_queries<
13840 T: std::convert::Into<std::option::Option<crate::model::trino_job::Queries>>,
13841 >(
13842 mut self,
13843 v: T,
13844 ) -> Self {
13845 self.queries = v.into();
13846 self
13847 }
13848
13849 /// The value of [queries][crate::model::TrinoJob::queries]
13850 /// if it holds a `QueryFileUri`, `None` if the field is not set or
13851 /// holds a different branch.
13852 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
13853 #[allow(unreachable_patterns)]
13854 self.queries.as_ref().and_then(|v| match v {
13855 crate::model::trino_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
13856 _ => std::option::Option::None,
13857 })
13858 }
13859
13860 /// Sets the value of [queries][crate::model::TrinoJob::queries]
13861 /// to hold a `QueryFileUri`.
13862 ///
13863 /// Note that all the setters affecting `queries` are
13864 /// mutually exclusive.
13865 ///
13866 /// # Example
13867 /// ```ignore,no_run
13868 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13869 /// let x = TrinoJob::new().set_query_file_uri("example");
13870 /// assert!(x.query_file_uri().is_some());
13871 /// assert!(x.query_list().is_none());
13872 /// ```
13873 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13874 self.queries =
13875 std::option::Option::Some(crate::model::trino_job::Queries::QueryFileUri(v.into()));
13876 self
13877 }
13878
13879 /// The value of [queries][crate::model::TrinoJob::queries]
13880 /// if it holds a `QueryList`, `None` if the field is not set or
13881 /// holds a different branch.
13882 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
13883 #[allow(unreachable_patterns)]
13884 self.queries.as_ref().and_then(|v| match v {
13885 crate::model::trino_job::Queries::QueryList(v) => std::option::Option::Some(v),
13886 _ => std::option::Option::None,
13887 })
13888 }
13889
13890 /// Sets the value of [queries][crate::model::TrinoJob::queries]
13891 /// to hold a `QueryList`.
13892 ///
13893 /// Note that all the setters affecting `queries` are
13894 /// mutually exclusive.
13895 ///
13896 /// # Example
13897 /// ```ignore,no_run
13898 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13899 /// use google_cloud_dataproc_v1::model::QueryList;
13900 /// let x = TrinoJob::new().set_query_list(QueryList::default()/* use setters */);
13901 /// assert!(x.query_list().is_some());
13902 /// assert!(x.query_file_uri().is_none());
13903 /// ```
13904 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
13905 mut self,
13906 v: T,
13907 ) -> Self {
13908 self.queries =
13909 std::option::Option::Some(crate::model::trino_job::Queries::QueryList(v.into()));
13910 self
13911 }
13912}
13913
13914impl wkt::message::Message for TrinoJob {
13915 fn typename() -> &'static str {
13916 "type.googleapis.com/google.cloud.dataproc.v1.TrinoJob"
13917 }
13918}
13919
13920/// Defines additional types related to [TrinoJob].
13921pub mod trino_job {
13922 #[allow(unused_imports)]
13923 use super::*;
13924
13925 /// Required. The sequence of Trino queries to execute, specified as
13926 /// either an HCFS file URI or as a list of queries.
13927 #[derive(Clone, Debug, PartialEq)]
13928 #[non_exhaustive]
13929 pub enum Queries {
13930 /// The HCFS URI of the script that contains SQL queries.
13931 QueryFileUri(std::string::String),
13932 /// A list of queries.
13933 QueryList(std::boxed::Box<crate::model::QueryList>),
13934 }
13935}
13936
13937/// A Dataproc job for running Apache Flink applications on YARN.
13938#[derive(Clone, Default, PartialEq)]
13939#[non_exhaustive]
13940pub struct FlinkJob {
13941 /// Optional. The arguments to pass to the driver. Do not include arguments,
13942 /// such as `--conf`, that can be set as job properties, since a collision
13943 /// might occur that causes an incorrect job submission.
13944 pub args: std::vec::Vec<std::string::String>,
13945
13946 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
13947 /// Flink driver and tasks.
13948 pub jar_file_uris: std::vec::Vec<std::string::String>,
13949
13950 /// Optional. HCFS URI of the savepoint, which contains the last saved progress
13951 /// for starting the current job.
13952 pub savepoint_uri: std::string::String,
13953
13954 /// Optional. A mapping of property names to values, used to configure Flink.
13955 /// Properties that conflict with values set by the Dataproc API might be
13956 /// overwritten. Can include properties set in
13957 /// `/etc/flink/conf/flink-defaults.conf` and classes in user code.
13958 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13959
13960 /// Optional. The runtime log config for job execution.
13961 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13962
13963 /// Required. The specification of the main method to call to drive the job.
13964 /// Specify either the jar file that contains the main class or the main class
13965 /// name. To pass both a main jar and a main class in the jar, add the jar to
13966 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
13967 /// specify the main class name in
13968 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
13969 ///
13970 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13971 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
13972 pub driver: std::option::Option<crate::model::flink_job::Driver>,
13973
13974 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13975}
13976
13977impl FlinkJob {
13978 /// Creates a new default instance.
13979 pub fn new() -> Self {
13980 std::default::Default::default()
13981 }
13982
13983 /// Sets the value of [args][crate::model::FlinkJob::args].
13984 ///
13985 /// # Example
13986 /// ```ignore,no_run
13987 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13988 /// let x = FlinkJob::new().set_args(["a", "b", "c"]);
13989 /// ```
13990 pub fn set_args<T, V>(mut self, v: T) -> Self
13991 where
13992 T: std::iter::IntoIterator<Item = V>,
13993 V: std::convert::Into<std::string::String>,
13994 {
13995 use std::iter::Iterator;
13996 self.args = v.into_iter().map(|i| i.into()).collect();
13997 self
13998 }
13999
14000 /// Sets the value of [jar_file_uris][crate::model::FlinkJob::jar_file_uris].
14001 ///
14002 /// # Example
14003 /// ```ignore,no_run
14004 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14005 /// let x = FlinkJob::new().set_jar_file_uris(["a", "b", "c"]);
14006 /// ```
14007 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
14008 where
14009 T: std::iter::IntoIterator<Item = V>,
14010 V: std::convert::Into<std::string::String>,
14011 {
14012 use std::iter::Iterator;
14013 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
14014 self
14015 }
14016
14017 /// Sets the value of [savepoint_uri][crate::model::FlinkJob::savepoint_uri].
14018 ///
14019 /// # Example
14020 /// ```ignore,no_run
14021 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14022 /// let x = FlinkJob::new().set_savepoint_uri("example");
14023 /// ```
14024 pub fn set_savepoint_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14025 self.savepoint_uri = v.into();
14026 self
14027 }
14028
14029 /// Sets the value of [properties][crate::model::FlinkJob::properties].
14030 ///
14031 /// # Example
14032 /// ```ignore,no_run
14033 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14034 /// let x = FlinkJob::new().set_properties([
14035 /// ("key0", "abc"),
14036 /// ("key1", "xyz"),
14037 /// ]);
14038 /// ```
14039 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
14040 where
14041 T: std::iter::IntoIterator<Item = (K, V)>,
14042 K: std::convert::Into<std::string::String>,
14043 V: std::convert::Into<std::string::String>,
14044 {
14045 use std::iter::Iterator;
14046 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14047 self
14048 }
14049
14050 /// Sets the value of [logging_config][crate::model::FlinkJob::logging_config].
14051 ///
14052 /// # Example
14053 /// ```ignore,no_run
14054 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14055 /// use google_cloud_dataproc_v1::model::LoggingConfig;
14056 /// let x = FlinkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
14057 /// ```
14058 pub fn set_logging_config<T>(mut self, v: T) -> Self
14059 where
14060 T: std::convert::Into<crate::model::LoggingConfig>,
14061 {
14062 self.logging_config = std::option::Option::Some(v.into());
14063 self
14064 }
14065
14066 /// Sets or clears the value of [logging_config][crate::model::FlinkJob::logging_config].
14067 ///
14068 /// # Example
14069 /// ```ignore,no_run
14070 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14071 /// use google_cloud_dataproc_v1::model::LoggingConfig;
14072 /// let x = FlinkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
14073 /// let x = FlinkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
14074 /// ```
14075 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
14076 where
14077 T: std::convert::Into<crate::model::LoggingConfig>,
14078 {
14079 self.logging_config = v.map(|x| x.into());
14080 self
14081 }
14082
14083 /// Sets the value of [driver][crate::model::FlinkJob::driver].
14084 ///
14085 /// Note that all the setters affecting `driver` are mutually
14086 /// exclusive.
14087 ///
14088 /// # Example
14089 /// ```ignore,no_run
14090 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14091 /// use google_cloud_dataproc_v1::model::flink_job::Driver;
14092 /// let x = FlinkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
14093 /// ```
14094 pub fn set_driver<
14095 T: std::convert::Into<std::option::Option<crate::model::flink_job::Driver>>,
14096 >(
14097 mut self,
14098 v: T,
14099 ) -> Self {
14100 self.driver = v.into();
14101 self
14102 }
14103
14104 /// The value of [driver][crate::model::FlinkJob::driver]
14105 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
14106 /// holds a different branch.
14107 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
14108 #[allow(unreachable_patterns)]
14109 self.driver.as_ref().and_then(|v| match v {
14110 crate::model::flink_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
14111 _ => std::option::Option::None,
14112 })
14113 }
14114
14115 /// Sets the value of [driver][crate::model::FlinkJob::driver]
14116 /// to hold a `MainJarFileUri`.
14117 ///
14118 /// Note that all the setters affecting `driver` are
14119 /// mutually exclusive.
14120 ///
14121 /// # Example
14122 /// ```ignore,no_run
14123 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14124 /// let x = FlinkJob::new().set_main_jar_file_uri("example");
14125 /// assert!(x.main_jar_file_uri().is_some());
14126 /// assert!(x.main_class().is_none());
14127 /// ```
14128 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
14129 mut self,
14130 v: T,
14131 ) -> Self {
14132 self.driver =
14133 std::option::Option::Some(crate::model::flink_job::Driver::MainJarFileUri(v.into()));
14134 self
14135 }
14136
14137 /// The value of [driver][crate::model::FlinkJob::driver]
14138 /// if it holds a `MainClass`, `None` if the field is not set or
14139 /// holds a different branch.
14140 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
14141 #[allow(unreachable_patterns)]
14142 self.driver.as_ref().and_then(|v| match v {
14143 crate::model::flink_job::Driver::MainClass(v) => std::option::Option::Some(v),
14144 _ => std::option::Option::None,
14145 })
14146 }
14147
14148 /// Sets the value of [driver][crate::model::FlinkJob::driver]
14149 /// to hold a `MainClass`.
14150 ///
14151 /// Note that all the setters affecting `driver` are
14152 /// mutually exclusive.
14153 ///
14154 /// # Example
14155 /// ```ignore,no_run
14156 /// # use google_cloud_dataproc_v1::model::FlinkJob;
14157 /// let x = FlinkJob::new().set_main_class("example");
14158 /// assert!(x.main_class().is_some());
14159 /// assert!(x.main_jar_file_uri().is_none());
14160 /// ```
14161 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14162 self.driver =
14163 std::option::Option::Some(crate::model::flink_job::Driver::MainClass(v.into()));
14164 self
14165 }
14166}
14167
14168impl wkt::message::Message for FlinkJob {
14169 fn typename() -> &'static str {
14170 "type.googleapis.com/google.cloud.dataproc.v1.FlinkJob"
14171 }
14172}
14173
14174/// Defines additional types related to [FlinkJob].
14175pub mod flink_job {
14176 #[allow(unused_imports)]
14177 use super::*;
14178
14179 /// Required. The specification of the main method to call to drive the job.
14180 /// Specify either the jar file that contains the main class or the main class
14181 /// name. To pass both a main jar and a main class in the jar, add the jar to
14182 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
14183 /// specify the main class name in
14184 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
14185 ///
14186 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
14187 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
14188 #[derive(Clone, Debug, PartialEq)]
14189 #[non_exhaustive]
14190 pub enum Driver {
14191 /// The HCFS URI of the jar file that contains the main class.
14192 MainJarFileUri(std::string::String),
14193 /// The name of the driver's main class. The jar file that contains the class
14194 /// must be in the default CLASSPATH or specified in
14195 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris].
14196 ///
14197 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
14198 MainClass(std::string::String),
14199 }
14200}
14201
14202/// Dataproc job config.
14203#[derive(Clone, Default, PartialEq)]
14204#[non_exhaustive]
14205pub struct JobPlacement {
14206 /// Required. The name of the cluster where the job will be submitted.
14207 pub cluster_name: std::string::String,
14208
14209 /// Output only. A cluster UUID generated by the Dataproc service when
14210 /// the job is submitted.
14211 pub cluster_uuid: std::string::String,
14212
14213 /// Optional. Cluster labels to identify a cluster where the job will be
14214 /// submitted.
14215 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
14216
14217 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14218}
14219
14220impl JobPlacement {
14221 /// Creates a new default instance.
14222 pub fn new() -> Self {
14223 std::default::Default::default()
14224 }
14225
14226 /// Sets the value of [cluster_name][crate::model::JobPlacement::cluster_name].
14227 ///
14228 /// # Example
14229 /// ```ignore,no_run
14230 /// # use google_cloud_dataproc_v1::model::JobPlacement;
14231 /// let x = JobPlacement::new().set_cluster_name("example");
14232 /// ```
14233 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14234 self.cluster_name = v.into();
14235 self
14236 }
14237
14238 /// Sets the value of [cluster_uuid][crate::model::JobPlacement::cluster_uuid].
14239 ///
14240 /// # Example
14241 /// ```ignore,no_run
14242 /// # use google_cloud_dataproc_v1::model::JobPlacement;
14243 /// let x = JobPlacement::new().set_cluster_uuid("example");
14244 /// ```
14245 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14246 self.cluster_uuid = v.into();
14247 self
14248 }
14249
14250 /// Sets the value of [cluster_labels][crate::model::JobPlacement::cluster_labels].
14251 ///
14252 /// # Example
14253 /// ```ignore,no_run
14254 /// # use google_cloud_dataproc_v1::model::JobPlacement;
14255 /// let x = JobPlacement::new().set_cluster_labels([
14256 /// ("key0", "abc"),
14257 /// ("key1", "xyz"),
14258 /// ]);
14259 /// ```
14260 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
14261 where
14262 T: std::iter::IntoIterator<Item = (K, V)>,
14263 K: std::convert::Into<std::string::String>,
14264 V: std::convert::Into<std::string::String>,
14265 {
14266 use std::iter::Iterator;
14267 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14268 self
14269 }
14270}
14271
14272impl wkt::message::Message for JobPlacement {
14273 fn typename() -> &'static str {
14274 "type.googleapis.com/google.cloud.dataproc.v1.JobPlacement"
14275 }
14276}
14277
14278/// Dataproc job status.
14279#[derive(Clone, Default, PartialEq)]
14280#[non_exhaustive]
14281pub struct JobStatus {
14282 /// Output only. A state message specifying the overall job state.
14283 pub state: crate::model::job_status::State,
14284
14285 /// Optional. Output only. Job state details, such as an error
14286 /// description if the state is `ERROR`.
14287 pub details: std::string::String,
14288
14289 /// Output only. The time when this state was entered.
14290 pub state_start_time: std::option::Option<wkt::Timestamp>,
14291
14292 /// Output only. Additional state information, which includes
14293 /// status reported by the agent.
14294 pub substate: crate::model::job_status::Substate,
14295
14296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14297}
14298
14299impl JobStatus {
14300 /// Creates a new default instance.
14301 pub fn new() -> Self {
14302 std::default::Default::default()
14303 }
14304
14305 /// Sets the value of [state][crate::model::JobStatus::state].
14306 ///
14307 /// # Example
14308 /// ```ignore,no_run
14309 /// # use google_cloud_dataproc_v1::model::JobStatus;
14310 /// use google_cloud_dataproc_v1::model::job_status::State;
14311 /// let x0 = JobStatus::new().set_state(State::Pending);
14312 /// let x1 = JobStatus::new().set_state(State::SetupDone);
14313 /// let x2 = JobStatus::new().set_state(State::Running);
14314 /// ```
14315 pub fn set_state<T: std::convert::Into<crate::model::job_status::State>>(
14316 mut self,
14317 v: T,
14318 ) -> Self {
14319 self.state = v.into();
14320 self
14321 }
14322
14323 /// Sets the value of [details][crate::model::JobStatus::details].
14324 ///
14325 /// # Example
14326 /// ```ignore,no_run
14327 /// # use google_cloud_dataproc_v1::model::JobStatus;
14328 /// let x = JobStatus::new().set_details("example");
14329 /// ```
14330 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14331 self.details = v.into();
14332 self
14333 }
14334
14335 /// Sets the value of [state_start_time][crate::model::JobStatus::state_start_time].
14336 ///
14337 /// # Example
14338 /// ```ignore,no_run
14339 /// # use google_cloud_dataproc_v1::model::JobStatus;
14340 /// use wkt::Timestamp;
14341 /// let x = JobStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
14342 /// ```
14343 pub fn set_state_start_time<T>(mut self, v: T) -> Self
14344 where
14345 T: std::convert::Into<wkt::Timestamp>,
14346 {
14347 self.state_start_time = std::option::Option::Some(v.into());
14348 self
14349 }
14350
14351 /// Sets or clears the value of [state_start_time][crate::model::JobStatus::state_start_time].
14352 ///
14353 /// # Example
14354 /// ```ignore,no_run
14355 /// # use google_cloud_dataproc_v1::model::JobStatus;
14356 /// use wkt::Timestamp;
14357 /// let x = JobStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
14358 /// let x = JobStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
14359 /// ```
14360 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
14361 where
14362 T: std::convert::Into<wkt::Timestamp>,
14363 {
14364 self.state_start_time = v.map(|x| x.into());
14365 self
14366 }
14367
14368 /// Sets the value of [substate][crate::model::JobStatus::substate].
14369 ///
14370 /// # Example
14371 /// ```ignore,no_run
14372 /// # use google_cloud_dataproc_v1::model::JobStatus;
14373 /// use google_cloud_dataproc_v1::model::job_status::Substate;
14374 /// let x0 = JobStatus::new().set_substate(Substate::Submitted);
14375 /// let x1 = JobStatus::new().set_substate(Substate::Queued);
14376 /// let x2 = JobStatus::new().set_substate(Substate::StaleStatus);
14377 /// ```
14378 pub fn set_substate<T: std::convert::Into<crate::model::job_status::Substate>>(
14379 mut self,
14380 v: T,
14381 ) -> Self {
14382 self.substate = v.into();
14383 self
14384 }
14385}
14386
14387impl wkt::message::Message for JobStatus {
14388 fn typename() -> &'static str {
14389 "type.googleapis.com/google.cloud.dataproc.v1.JobStatus"
14390 }
14391}
14392
14393/// Defines additional types related to [JobStatus].
14394pub mod job_status {
14395 #[allow(unused_imports)]
14396 use super::*;
14397
14398 /// The job state.
14399 ///
14400 /// # Working with unknown values
14401 ///
14402 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14403 /// additional enum variants at any time. Adding new variants is not considered
14404 /// a breaking change. Applications should write their code in anticipation of:
14405 ///
14406 /// - New values appearing in future releases of the client library, **and**
14407 /// - New values received dynamically, without application changes.
14408 ///
14409 /// Please consult the [Working with enums] section in the user guide for some
14410 /// guidelines.
14411 ///
14412 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14413 #[derive(Clone, Debug, PartialEq)]
14414 #[non_exhaustive]
14415 pub enum State {
14416 /// The job state is unknown.
14417 Unspecified,
14418 /// The job is pending; it has been submitted, but is not yet running.
14419 Pending,
14420 /// Job has been received by the service and completed initial setup;
14421 /// it will soon be submitted to the cluster.
14422 SetupDone,
14423 /// The job is running on the cluster.
14424 Running,
14425 /// A CancelJob request has been received, but is pending.
14426 CancelPending,
14427 /// Transient in-flight resources have been canceled, and the request to
14428 /// cancel the running job has been issued to the cluster.
14429 CancelStarted,
14430 /// The job cancellation was successful.
14431 Cancelled,
14432 /// The job has completed successfully.
14433 Done,
14434 /// The job has completed, but encountered an error.
14435 Error,
14436 /// Job attempt has failed. The detail field contains failure details for
14437 /// this attempt.
14438 ///
14439 /// Applies to restartable jobs only.
14440 AttemptFailure,
14441 /// If set, the enum was initialized with an unknown value.
14442 ///
14443 /// Applications can examine the value using [State::value] or
14444 /// [State::name].
14445 UnknownValue(state::UnknownValue),
14446 }
14447
14448 #[doc(hidden)]
14449 pub mod state {
14450 #[allow(unused_imports)]
14451 use super::*;
14452 #[derive(Clone, Debug, PartialEq)]
14453 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14454 }
14455
14456 impl State {
14457 /// Gets the enum value.
14458 ///
14459 /// Returns `None` if the enum contains an unknown value deserialized from
14460 /// the string representation of enums.
14461 pub fn value(&self) -> std::option::Option<i32> {
14462 match self {
14463 Self::Unspecified => std::option::Option::Some(0),
14464 Self::Pending => std::option::Option::Some(1),
14465 Self::SetupDone => std::option::Option::Some(8),
14466 Self::Running => std::option::Option::Some(2),
14467 Self::CancelPending => std::option::Option::Some(3),
14468 Self::CancelStarted => std::option::Option::Some(7),
14469 Self::Cancelled => std::option::Option::Some(4),
14470 Self::Done => std::option::Option::Some(5),
14471 Self::Error => std::option::Option::Some(6),
14472 Self::AttemptFailure => std::option::Option::Some(9),
14473 Self::UnknownValue(u) => u.0.value(),
14474 }
14475 }
14476
14477 /// Gets the enum value as a string.
14478 ///
14479 /// Returns `None` if the enum contains an unknown value deserialized from
14480 /// the integer representation of enums.
14481 pub fn name(&self) -> std::option::Option<&str> {
14482 match self {
14483 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
14484 Self::Pending => std::option::Option::Some("PENDING"),
14485 Self::SetupDone => std::option::Option::Some("SETUP_DONE"),
14486 Self::Running => std::option::Option::Some("RUNNING"),
14487 Self::CancelPending => std::option::Option::Some("CANCEL_PENDING"),
14488 Self::CancelStarted => std::option::Option::Some("CANCEL_STARTED"),
14489 Self::Cancelled => std::option::Option::Some("CANCELLED"),
14490 Self::Done => std::option::Option::Some("DONE"),
14491 Self::Error => std::option::Option::Some("ERROR"),
14492 Self::AttemptFailure => std::option::Option::Some("ATTEMPT_FAILURE"),
14493 Self::UnknownValue(u) => u.0.name(),
14494 }
14495 }
14496 }
14497
14498 impl std::default::Default for State {
14499 fn default() -> Self {
14500 use std::convert::From;
14501 Self::from(0)
14502 }
14503 }
14504
14505 impl std::fmt::Display for State {
14506 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14507 wkt::internal::display_enum(f, self.name(), self.value())
14508 }
14509 }
14510
14511 impl std::convert::From<i32> for State {
14512 fn from(value: i32) -> Self {
14513 match value {
14514 0 => Self::Unspecified,
14515 1 => Self::Pending,
14516 2 => Self::Running,
14517 3 => Self::CancelPending,
14518 4 => Self::Cancelled,
14519 5 => Self::Done,
14520 6 => Self::Error,
14521 7 => Self::CancelStarted,
14522 8 => Self::SetupDone,
14523 9 => Self::AttemptFailure,
14524 _ => Self::UnknownValue(state::UnknownValue(
14525 wkt::internal::UnknownEnumValue::Integer(value),
14526 )),
14527 }
14528 }
14529 }
14530
14531 impl std::convert::From<&str> for State {
14532 fn from(value: &str) -> Self {
14533 use std::string::ToString;
14534 match value {
14535 "STATE_UNSPECIFIED" => Self::Unspecified,
14536 "PENDING" => Self::Pending,
14537 "SETUP_DONE" => Self::SetupDone,
14538 "RUNNING" => Self::Running,
14539 "CANCEL_PENDING" => Self::CancelPending,
14540 "CANCEL_STARTED" => Self::CancelStarted,
14541 "CANCELLED" => Self::Cancelled,
14542 "DONE" => Self::Done,
14543 "ERROR" => Self::Error,
14544 "ATTEMPT_FAILURE" => Self::AttemptFailure,
14545 _ => Self::UnknownValue(state::UnknownValue(
14546 wkt::internal::UnknownEnumValue::String(value.to_string()),
14547 )),
14548 }
14549 }
14550 }
14551
14552 impl serde::ser::Serialize for State {
14553 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14554 where
14555 S: serde::Serializer,
14556 {
14557 match self {
14558 Self::Unspecified => serializer.serialize_i32(0),
14559 Self::Pending => serializer.serialize_i32(1),
14560 Self::SetupDone => serializer.serialize_i32(8),
14561 Self::Running => serializer.serialize_i32(2),
14562 Self::CancelPending => serializer.serialize_i32(3),
14563 Self::CancelStarted => serializer.serialize_i32(7),
14564 Self::Cancelled => serializer.serialize_i32(4),
14565 Self::Done => serializer.serialize_i32(5),
14566 Self::Error => serializer.serialize_i32(6),
14567 Self::AttemptFailure => serializer.serialize_i32(9),
14568 Self::UnknownValue(u) => u.0.serialize(serializer),
14569 }
14570 }
14571 }
14572
14573 impl<'de> serde::de::Deserialize<'de> for State {
14574 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14575 where
14576 D: serde::Deserializer<'de>,
14577 {
14578 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
14579 ".google.cloud.dataproc.v1.JobStatus.State",
14580 ))
14581 }
14582 }
14583
14584 /// The job substate.
14585 ///
14586 /// # Working with unknown values
14587 ///
14588 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14589 /// additional enum variants at any time. Adding new variants is not considered
14590 /// a breaking change. Applications should write their code in anticipation of:
14591 ///
14592 /// - New values appearing in future releases of the client library, **and**
14593 /// - New values received dynamically, without application changes.
14594 ///
14595 /// Please consult the [Working with enums] section in the user guide for some
14596 /// guidelines.
14597 ///
14598 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14599 #[derive(Clone, Debug, PartialEq)]
14600 #[non_exhaustive]
14601 pub enum Substate {
14602 /// The job substate is unknown.
14603 Unspecified,
14604 /// The Job is submitted to the agent.
14605 ///
14606 /// Applies to RUNNING state.
14607 Submitted,
14608 /// The Job has been received and is awaiting execution (it might be waiting
14609 /// for a condition to be met). See the "details" field for the reason for
14610 /// the delay.
14611 ///
14612 /// Applies to RUNNING state.
14613 Queued,
14614 /// The agent-reported status is out of date, which can be caused by a
14615 /// loss of communication between the agent and Dataproc. If the
14616 /// agent does not send a timely update, the job will fail.
14617 ///
14618 /// Applies to RUNNING state.
14619 StaleStatus,
14620 /// If set, the enum was initialized with an unknown value.
14621 ///
14622 /// Applications can examine the value using [Substate::value] or
14623 /// [Substate::name].
14624 UnknownValue(substate::UnknownValue),
14625 }
14626
14627 #[doc(hidden)]
14628 pub mod substate {
14629 #[allow(unused_imports)]
14630 use super::*;
14631 #[derive(Clone, Debug, PartialEq)]
14632 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14633 }
14634
14635 impl Substate {
14636 /// Gets the enum value.
14637 ///
14638 /// Returns `None` if the enum contains an unknown value deserialized from
14639 /// the string representation of enums.
14640 pub fn value(&self) -> std::option::Option<i32> {
14641 match self {
14642 Self::Unspecified => std::option::Option::Some(0),
14643 Self::Submitted => std::option::Option::Some(1),
14644 Self::Queued => std::option::Option::Some(2),
14645 Self::StaleStatus => std::option::Option::Some(3),
14646 Self::UnknownValue(u) => u.0.value(),
14647 }
14648 }
14649
14650 /// Gets the enum value as a string.
14651 ///
14652 /// Returns `None` if the enum contains an unknown value deserialized from
14653 /// the integer representation of enums.
14654 pub fn name(&self) -> std::option::Option<&str> {
14655 match self {
14656 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
14657 Self::Submitted => std::option::Option::Some("SUBMITTED"),
14658 Self::Queued => std::option::Option::Some("QUEUED"),
14659 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
14660 Self::UnknownValue(u) => u.0.name(),
14661 }
14662 }
14663 }
14664
14665 impl std::default::Default for Substate {
14666 fn default() -> Self {
14667 use std::convert::From;
14668 Self::from(0)
14669 }
14670 }
14671
14672 impl std::fmt::Display for Substate {
14673 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14674 wkt::internal::display_enum(f, self.name(), self.value())
14675 }
14676 }
14677
14678 impl std::convert::From<i32> for Substate {
14679 fn from(value: i32) -> Self {
14680 match value {
14681 0 => Self::Unspecified,
14682 1 => Self::Submitted,
14683 2 => Self::Queued,
14684 3 => Self::StaleStatus,
14685 _ => Self::UnknownValue(substate::UnknownValue(
14686 wkt::internal::UnknownEnumValue::Integer(value),
14687 )),
14688 }
14689 }
14690 }
14691
14692 impl std::convert::From<&str> for Substate {
14693 fn from(value: &str) -> Self {
14694 use std::string::ToString;
14695 match value {
14696 "UNSPECIFIED" => Self::Unspecified,
14697 "SUBMITTED" => Self::Submitted,
14698 "QUEUED" => Self::Queued,
14699 "STALE_STATUS" => Self::StaleStatus,
14700 _ => Self::UnknownValue(substate::UnknownValue(
14701 wkt::internal::UnknownEnumValue::String(value.to_string()),
14702 )),
14703 }
14704 }
14705 }
14706
14707 impl serde::ser::Serialize for Substate {
14708 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14709 where
14710 S: serde::Serializer,
14711 {
14712 match self {
14713 Self::Unspecified => serializer.serialize_i32(0),
14714 Self::Submitted => serializer.serialize_i32(1),
14715 Self::Queued => serializer.serialize_i32(2),
14716 Self::StaleStatus => serializer.serialize_i32(3),
14717 Self::UnknownValue(u) => u.0.serialize(serializer),
14718 }
14719 }
14720 }
14721
14722 impl<'de> serde::de::Deserialize<'de> for Substate {
14723 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14724 where
14725 D: serde::Deserializer<'de>,
14726 {
14727 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
14728 ".google.cloud.dataproc.v1.JobStatus.Substate",
14729 ))
14730 }
14731 }
14732}
14733
14734/// Encapsulates the full scoping used to reference a job.
14735#[derive(Clone, Default, PartialEq)]
14736#[non_exhaustive]
14737pub struct JobReference {
14738 /// Optional. The ID of the Google Cloud Platform project that the job belongs
14739 /// to. If specified, must match the request project ID.
14740 pub project_id: std::string::String,
14741
14742 /// Optional. The job ID, which must be unique within the project.
14743 ///
14744 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
14745 /// underscores (_), or hyphens (-). The maximum length is 100 characters.
14746 ///
14747 /// If not specified by the caller, the job ID will be provided by the server.
14748 pub job_id: std::string::String,
14749
14750 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14751}
14752
14753impl JobReference {
14754 /// Creates a new default instance.
14755 pub fn new() -> Self {
14756 std::default::Default::default()
14757 }
14758
14759 /// Sets the value of [project_id][crate::model::JobReference::project_id].
14760 ///
14761 /// # Example
14762 /// ```ignore,no_run
14763 /// # use google_cloud_dataproc_v1::model::JobReference;
14764 /// let x = JobReference::new().set_project_id("example");
14765 /// ```
14766 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14767 self.project_id = v.into();
14768 self
14769 }
14770
14771 /// Sets the value of [job_id][crate::model::JobReference::job_id].
14772 ///
14773 /// # Example
14774 /// ```ignore,no_run
14775 /// # use google_cloud_dataproc_v1::model::JobReference;
14776 /// let x = JobReference::new().set_job_id("example");
14777 /// ```
14778 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14779 self.job_id = v.into();
14780 self
14781 }
14782}
14783
14784impl wkt::message::Message for JobReference {
14785 fn typename() -> &'static str {
14786 "type.googleapis.com/google.cloud.dataproc.v1.JobReference"
14787 }
14788}
14789
14790/// A YARN application created by a job. Application information is a subset of
14791/// \<code\>org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto\</code\>.
14792///
14793/// **Beta Feature**: This report is available for testing purposes only. It may
14794/// be changed before final release.
14795#[derive(Clone, Default, PartialEq)]
14796#[non_exhaustive]
14797pub struct YarnApplication {
14798 /// Required. The application name.
14799 pub name: std::string::String,
14800
14801 /// Required. The application state.
14802 pub state: crate::model::yarn_application::State,
14803
14804 /// Required. The numerical progress of the application, from 1 to 100.
14805 pub progress: f32,
14806
14807 /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or
14808 /// TimelineServer that provides application-specific information. The URL uses
14809 /// the internal hostname, and requires a proxy server for resolution and,
14810 /// possibly, access.
14811 pub tracking_url: std::string::String,
14812
14813 /// Optional. The cumulative CPU time consumed by the application for a job,
14814 /// measured in vcore-seconds.
14815 pub vcore_seconds: i64,
14816
14817 /// Optional. The cumulative memory usage of the application for a job,
14818 /// measured in mb-seconds.
14819 pub memory_mb_seconds: i64,
14820
14821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14822}
14823
14824impl YarnApplication {
14825 /// Creates a new default instance.
14826 pub fn new() -> Self {
14827 std::default::Default::default()
14828 }
14829
14830 /// Sets the value of [name][crate::model::YarnApplication::name].
14831 ///
14832 /// # Example
14833 /// ```ignore,no_run
14834 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14835 /// let x = YarnApplication::new().set_name("example");
14836 /// ```
14837 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14838 self.name = v.into();
14839 self
14840 }
14841
14842 /// Sets the value of [state][crate::model::YarnApplication::state].
14843 ///
14844 /// # Example
14845 /// ```ignore,no_run
14846 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14847 /// use google_cloud_dataproc_v1::model::yarn_application::State;
14848 /// let x0 = YarnApplication::new().set_state(State::New);
14849 /// let x1 = YarnApplication::new().set_state(State::NewSaving);
14850 /// let x2 = YarnApplication::new().set_state(State::Submitted);
14851 /// ```
14852 pub fn set_state<T: std::convert::Into<crate::model::yarn_application::State>>(
14853 mut self,
14854 v: T,
14855 ) -> Self {
14856 self.state = v.into();
14857 self
14858 }
14859
14860 /// Sets the value of [progress][crate::model::YarnApplication::progress].
14861 ///
14862 /// # Example
14863 /// ```ignore,no_run
14864 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14865 /// let x = YarnApplication::new().set_progress(42.0);
14866 /// ```
14867 pub fn set_progress<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
14868 self.progress = v.into();
14869 self
14870 }
14871
14872 /// Sets the value of [tracking_url][crate::model::YarnApplication::tracking_url].
14873 ///
14874 /// # Example
14875 /// ```ignore,no_run
14876 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14877 /// let x = YarnApplication::new().set_tracking_url("example");
14878 /// ```
14879 pub fn set_tracking_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14880 self.tracking_url = v.into();
14881 self
14882 }
14883
14884 /// Sets the value of [vcore_seconds][crate::model::YarnApplication::vcore_seconds].
14885 ///
14886 /// # Example
14887 /// ```ignore,no_run
14888 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14889 /// let x = YarnApplication::new().set_vcore_seconds(42);
14890 /// ```
14891 pub fn set_vcore_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14892 self.vcore_seconds = v.into();
14893 self
14894 }
14895
14896 /// Sets the value of [memory_mb_seconds][crate::model::YarnApplication::memory_mb_seconds].
14897 ///
14898 /// # Example
14899 /// ```ignore,no_run
14900 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14901 /// let x = YarnApplication::new().set_memory_mb_seconds(42);
14902 /// ```
14903 pub fn set_memory_mb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14904 self.memory_mb_seconds = v.into();
14905 self
14906 }
14907}
14908
14909impl wkt::message::Message for YarnApplication {
14910 fn typename() -> &'static str {
14911 "type.googleapis.com/google.cloud.dataproc.v1.YarnApplication"
14912 }
14913}
14914
14915/// Defines additional types related to [YarnApplication].
14916pub mod yarn_application {
14917 #[allow(unused_imports)]
14918 use super::*;
14919
14920 /// The application state, corresponding to
14921 /// \<code\>YarnProtos.YarnApplicationStateProto\</code\>.
14922 ///
14923 /// # Working with unknown values
14924 ///
14925 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14926 /// additional enum variants at any time. Adding new variants is not considered
14927 /// a breaking change. Applications should write their code in anticipation of:
14928 ///
14929 /// - New values appearing in future releases of the client library, **and**
14930 /// - New values received dynamically, without application changes.
14931 ///
14932 /// Please consult the [Working with enums] section in the user guide for some
14933 /// guidelines.
14934 ///
14935 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14936 #[derive(Clone, Debug, PartialEq)]
14937 #[non_exhaustive]
14938 pub enum State {
14939 /// Status is unspecified.
14940 Unspecified,
14941 /// Status is NEW.
14942 New,
14943 /// Status is NEW_SAVING.
14944 NewSaving,
14945 /// Status is SUBMITTED.
14946 Submitted,
14947 /// Status is ACCEPTED.
14948 Accepted,
14949 /// Status is RUNNING.
14950 Running,
14951 /// Status is FINISHED.
14952 Finished,
14953 /// Status is FAILED.
14954 Failed,
14955 /// Status is KILLED.
14956 Killed,
14957 /// If set, the enum was initialized with an unknown value.
14958 ///
14959 /// Applications can examine the value using [State::value] or
14960 /// [State::name].
14961 UnknownValue(state::UnknownValue),
14962 }
14963
14964 #[doc(hidden)]
14965 pub mod state {
14966 #[allow(unused_imports)]
14967 use super::*;
14968 #[derive(Clone, Debug, PartialEq)]
14969 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14970 }
14971
14972 impl State {
14973 /// Gets the enum value.
14974 ///
14975 /// Returns `None` if the enum contains an unknown value deserialized from
14976 /// the string representation of enums.
14977 pub fn value(&self) -> std::option::Option<i32> {
14978 match self {
14979 Self::Unspecified => std::option::Option::Some(0),
14980 Self::New => std::option::Option::Some(1),
14981 Self::NewSaving => std::option::Option::Some(2),
14982 Self::Submitted => std::option::Option::Some(3),
14983 Self::Accepted => std::option::Option::Some(4),
14984 Self::Running => std::option::Option::Some(5),
14985 Self::Finished => std::option::Option::Some(6),
14986 Self::Failed => std::option::Option::Some(7),
14987 Self::Killed => std::option::Option::Some(8),
14988 Self::UnknownValue(u) => u.0.value(),
14989 }
14990 }
14991
14992 /// Gets the enum value as a string.
14993 ///
14994 /// Returns `None` if the enum contains an unknown value deserialized from
14995 /// the integer representation of enums.
14996 pub fn name(&self) -> std::option::Option<&str> {
14997 match self {
14998 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
14999 Self::New => std::option::Option::Some("NEW"),
15000 Self::NewSaving => std::option::Option::Some("NEW_SAVING"),
15001 Self::Submitted => std::option::Option::Some("SUBMITTED"),
15002 Self::Accepted => std::option::Option::Some("ACCEPTED"),
15003 Self::Running => std::option::Option::Some("RUNNING"),
15004 Self::Finished => std::option::Option::Some("FINISHED"),
15005 Self::Failed => std::option::Option::Some("FAILED"),
15006 Self::Killed => std::option::Option::Some("KILLED"),
15007 Self::UnknownValue(u) => u.0.name(),
15008 }
15009 }
15010 }
15011
15012 impl std::default::Default for State {
15013 fn default() -> Self {
15014 use std::convert::From;
15015 Self::from(0)
15016 }
15017 }
15018
15019 impl std::fmt::Display for State {
15020 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15021 wkt::internal::display_enum(f, self.name(), self.value())
15022 }
15023 }
15024
15025 impl std::convert::From<i32> for State {
15026 fn from(value: i32) -> Self {
15027 match value {
15028 0 => Self::Unspecified,
15029 1 => Self::New,
15030 2 => Self::NewSaving,
15031 3 => Self::Submitted,
15032 4 => Self::Accepted,
15033 5 => Self::Running,
15034 6 => Self::Finished,
15035 7 => Self::Failed,
15036 8 => Self::Killed,
15037 _ => Self::UnknownValue(state::UnknownValue(
15038 wkt::internal::UnknownEnumValue::Integer(value),
15039 )),
15040 }
15041 }
15042 }
15043
15044 impl std::convert::From<&str> for State {
15045 fn from(value: &str) -> Self {
15046 use std::string::ToString;
15047 match value {
15048 "STATE_UNSPECIFIED" => Self::Unspecified,
15049 "NEW" => Self::New,
15050 "NEW_SAVING" => Self::NewSaving,
15051 "SUBMITTED" => Self::Submitted,
15052 "ACCEPTED" => Self::Accepted,
15053 "RUNNING" => Self::Running,
15054 "FINISHED" => Self::Finished,
15055 "FAILED" => Self::Failed,
15056 "KILLED" => Self::Killed,
15057 _ => Self::UnknownValue(state::UnknownValue(
15058 wkt::internal::UnknownEnumValue::String(value.to_string()),
15059 )),
15060 }
15061 }
15062 }
15063
15064 impl serde::ser::Serialize for State {
15065 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15066 where
15067 S: serde::Serializer,
15068 {
15069 match self {
15070 Self::Unspecified => serializer.serialize_i32(0),
15071 Self::New => serializer.serialize_i32(1),
15072 Self::NewSaving => serializer.serialize_i32(2),
15073 Self::Submitted => serializer.serialize_i32(3),
15074 Self::Accepted => serializer.serialize_i32(4),
15075 Self::Running => serializer.serialize_i32(5),
15076 Self::Finished => serializer.serialize_i32(6),
15077 Self::Failed => serializer.serialize_i32(7),
15078 Self::Killed => serializer.serialize_i32(8),
15079 Self::UnknownValue(u) => u.0.serialize(serializer),
15080 }
15081 }
15082 }
15083
15084 impl<'de> serde::de::Deserialize<'de> for State {
15085 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15086 where
15087 D: serde::Deserializer<'de>,
15088 {
15089 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
15090 ".google.cloud.dataproc.v1.YarnApplication.State",
15091 ))
15092 }
15093 }
15094}
15095
15096/// A Dataproc job resource.
15097#[derive(Clone, Default, PartialEq)]
15098#[non_exhaustive]
15099pub struct Job {
15100 /// Optional. The fully qualified reference to the job, which can be used to
15101 /// obtain the equivalent REST path of the job resource. If this property
15102 /// is not specified when a job is created, the server generates a
15103 /// \<code\>job_id\</code\>.
15104 pub reference: std::option::Option<crate::model::JobReference>,
15105
15106 /// Required. Job information, including how, when, and where to
15107 /// run the job.
15108 pub placement: std::option::Option<crate::model::JobPlacement>,
15109
15110 /// Output only. The job status. Additional application-specific
15111 /// status information might be contained in the \<code\>type_job\</code\>
15112 /// and \<code\>yarn_applications\</code\> fields.
15113 pub status: std::option::Option<crate::model::JobStatus>,
15114
15115 /// Output only. The previous job status.
15116 pub status_history: std::vec::Vec<crate::model::JobStatus>,
15117
15118 /// Output only. The collection of YARN applications spun up by this job.
15119 ///
15120 /// **Beta** Feature: This report is available for testing purposes only. It
15121 /// might be changed before final release.
15122 pub yarn_applications: std::vec::Vec<crate::model::YarnApplication>,
15123
15124 /// Output only. A URI pointing to the location of the stdout of the job's
15125 /// driver program.
15126 pub driver_output_resource_uri: std::string::String,
15127
15128 /// Output only. If present, the location of miscellaneous control files
15129 /// which can be used as part of job setup and handling. If not present,
15130 /// control files might be placed in the same location as `driver_output_uri`.
15131 pub driver_control_files_uri: std::string::String,
15132
15133 /// Optional. The labels to associate with this job.
15134 /// Label **keys** must contain 1 to 63 characters, and must conform to
15135 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
15136 /// Label **values** can be empty, but, if present, must contain 1 to 63
15137 /// characters, and must conform to [RFC
15138 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
15139 /// associated with a job.
15140 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15141
15142 /// Optional. Job scheduling configuration.
15143 pub scheduling: std::option::Option<crate::model::JobScheduling>,
15144
15145 /// Output only. A UUID that uniquely identifies a job within the project
15146 /// over time. This is in contrast to a user-settable reference.job_id that
15147 /// might be reused over time.
15148 pub job_uuid: std::string::String,
15149
15150 /// Output only. Indicates whether the job is completed. If the value is
15151 /// `false`, the job is still in progress. If `true`, the job is completed, and
15152 /// `status.state` field will indicate if it was successful, failed,
15153 /// or cancelled.
15154 pub done: bool,
15155
15156 /// Optional. Driver scheduling configuration.
15157 pub driver_scheduling_config: std::option::Option<crate::model::DriverSchedulingConfig>,
15158
15159 /// Required. The application/framework-specific portion of the job.
15160 pub type_job: std::option::Option<crate::model::job::TypeJob>,
15161
15162 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15163}
15164
15165impl Job {
15166 /// Creates a new default instance.
15167 pub fn new() -> Self {
15168 std::default::Default::default()
15169 }
15170
15171 /// Sets the value of [reference][crate::model::Job::reference].
15172 ///
15173 /// # Example
15174 /// ```ignore,no_run
15175 /// # use google_cloud_dataproc_v1::model::Job;
15176 /// use google_cloud_dataproc_v1::model::JobReference;
15177 /// let x = Job::new().set_reference(JobReference::default()/* use setters */);
15178 /// ```
15179 pub fn set_reference<T>(mut self, v: T) -> Self
15180 where
15181 T: std::convert::Into<crate::model::JobReference>,
15182 {
15183 self.reference = std::option::Option::Some(v.into());
15184 self
15185 }
15186
15187 /// Sets or clears the value of [reference][crate::model::Job::reference].
15188 ///
15189 /// # Example
15190 /// ```ignore,no_run
15191 /// # use google_cloud_dataproc_v1::model::Job;
15192 /// use google_cloud_dataproc_v1::model::JobReference;
15193 /// let x = Job::new().set_or_clear_reference(Some(JobReference::default()/* use setters */));
15194 /// let x = Job::new().set_or_clear_reference(None::<JobReference>);
15195 /// ```
15196 pub fn set_or_clear_reference<T>(mut self, v: std::option::Option<T>) -> Self
15197 where
15198 T: std::convert::Into<crate::model::JobReference>,
15199 {
15200 self.reference = v.map(|x| x.into());
15201 self
15202 }
15203
15204 /// Sets the value of [placement][crate::model::Job::placement].
15205 ///
15206 /// # Example
15207 /// ```ignore,no_run
15208 /// # use google_cloud_dataproc_v1::model::Job;
15209 /// use google_cloud_dataproc_v1::model::JobPlacement;
15210 /// let x = Job::new().set_placement(JobPlacement::default()/* use setters */);
15211 /// ```
15212 pub fn set_placement<T>(mut self, v: T) -> Self
15213 where
15214 T: std::convert::Into<crate::model::JobPlacement>,
15215 {
15216 self.placement = std::option::Option::Some(v.into());
15217 self
15218 }
15219
15220 /// Sets or clears the value of [placement][crate::model::Job::placement].
15221 ///
15222 /// # Example
15223 /// ```ignore,no_run
15224 /// # use google_cloud_dataproc_v1::model::Job;
15225 /// use google_cloud_dataproc_v1::model::JobPlacement;
15226 /// let x = Job::new().set_or_clear_placement(Some(JobPlacement::default()/* use setters */));
15227 /// let x = Job::new().set_or_clear_placement(None::<JobPlacement>);
15228 /// ```
15229 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
15230 where
15231 T: std::convert::Into<crate::model::JobPlacement>,
15232 {
15233 self.placement = v.map(|x| x.into());
15234 self
15235 }
15236
15237 /// Sets the value of [status][crate::model::Job::status].
15238 ///
15239 /// # Example
15240 /// ```ignore,no_run
15241 /// # use google_cloud_dataproc_v1::model::Job;
15242 /// use google_cloud_dataproc_v1::model::JobStatus;
15243 /// let x = Job::new().set_status(JobStatus::default()/* use setters */);
15244 /// ```
15245 pub fn set_status<T>(mut self, v: T) -> Self
15246 where
15247 T: std::convert::Into<crate::model::JobStatus>,
15248 {
15249 self.status = std::option::Option::Some(v.into());
15250 self
15251 }
15252
15253 /// Sets or clears the value of [status][crate::model::Job::status].
15254 ///
15255 /// # Example
15256 /// ```ignore,no_run
15257 /// # use google_cloud_dataproc_v1::model::Job;
15258 /// use google_cloud_dataproc_v1::model::JobStatus;
15259 /// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
15260 /// let x = Job::new().set_or_clear_status(None::<JobStatus>);
15261 /// ```
15262 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
15263 where
15264 T: std::convert::Into<crate::model::JobStatus>,
15265 {
15266 self.status = v.map(|x| x.into());
15267 self
15268 }
15269
15270 /// Sets the value of [status_history][crate::model::Job::status_history].
15271 ///
15272 /// # Example
15273 /// ```ignore,no_run
15274 /// # use google_cloud_dataproc_v1::model::Job;
15275 /// use google_cloud_dataproc_v1::model::JobStatus;
15276 /// let x = Job::new()
15277 /// .set_status_history([
15278 /// JobStatus::default()/* use setters */,
15279 /// JobStatus::default()/* use (different) setters */,
15280 /// ]);
15281 /// ```
15282 pub fn set_status_history<T, V>(mut self, v: T) -> Self
15283 where
15284 T: std::iter::IntoIterator<Item = V>,
15285 V: std::convert::Into<crate::model::JobStatus>,
15286 {
15287 use std::iter::Iterator;
15288 self.status_history = v.into_iter().map(|i| i.into()).collect();
15289 self
15290 }
15291
15292 /// Sets the value of [yarn_applications][crate::model::Job::yarn_applications].
15293 ///
15294 /// # Example
15295 /// ```ignore,no_run
15296 /// # use google_cloud_dataproc_v1::model::Job;
15297 /// use google_cloud_dataproc_v1::model::YarnApplication;
15298 /// let x = Job::new()
15299 /// .set_yarn_applications([
15300 /// YarnApplication::default()/* use setters */,
15301 /// YarnApplication::default()/* use (different) setters */,
15302 /// ]);
15303 /// ```
15304 pub fn set_yarn_applications<T, V>(mut self, v: T) -> Self
15305 where
15306 T: std::iter::IntoIterator<Item = V>,
15307 V: std::convert::Into<crate::model::YarnApplication>,
15308 {
15309 use std::iter::Iterator;
15310 self.yarn_applications = v.into_iter().map(|i| i.into()).collect();
15311 self
15312 }
15313
15314 /// Sets the value of [driver_output_resource_uri][crate::model::Job::driver_output_resource_uri].
15315 ///
15316 /// # Example
15317 /// ```ignore,no_run
15318 /// # use google_cloud_dataproc_v1::model::Job;
15319 /// let x = Job::new().set_driver_output_resource_uri("example");
15320 /// ```
15321 pub fn set_driver_output_resource_uri<T: std::convert::Into<std::string::String>>(
15322 mut self,
15323 v: T,
15324 ) -> Self {
15325 self.driver_output_resource_uri = v.into();
15326 self
15327 }
15328
15329 /// Sets the value of [driver_control_files_uri][crate::model::Job::driver_control_files_uri].
15330 ///
15331 /// # Example
15332 /// ```ignore,no_run
15333 /// # use google_cloud_dataproc_v1::model::Job;
15334 /// let x = Job::new().set_driver_control_files_uri("example");
15335 /// ```
15336 pub fn set_driver_control_files_uri<T: std::convert::Into<std::string::String>>(
15337 mut self,
15338 v: T,
15339 ) -> Self {
15340 self.driver_control_files_uri = v.into();
15341 self
15342 }
15343
15344 /// Sets the value of [labels][crate::model::Job::labels].
15345 ///
15346 /// # Example
15347 /// ```ignore,no_run
15348 /// # use google_cloud_dataproc_v1::model::Job;
15349 /// let x = Job::new().set_labels([
15350 /// ("key0", "abc"),
15351 /// ("key1", "xyz"),
15352 /// ]);
15353 /// ```
15354 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15355 where
15356 T: std::iter::IntoIterator<Item = (K, V)>,
15357 K: std::convert::Into<std::string::String>,
15358 V: std::convert::Into<std::string::String>,
15359 {
15360 use std::iter::Iterator;
15361 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15362 self
15363 }
15364
15365 /// Sets the value of [scheduling][crate::model::Job::scheduling].
15366 ///
15367 /// # Example
15368 /// ```ignore,no_run
15369 /// # use google_cloud_dataproc_v1::model::Job;
15370 /// use google_cloud_dataproc_v1::model::JobScheduling;
15371 /// let x = Job::new().set_scheduling(JobScheduling::default()/* use setters */);
15372 /// ```
15373 pub fn set_scheduling<T>(mut self, v: T) -> Self
15374 where
15375 T: std::convert::Into<crate::model::JobScheduling>,
15376 {
15377 self.scheduling = std::option::Option::Some(v.into());
15378 self
15379 }
15380
15381 /// Sets or clears the value of [scheduling][crate::model::Job::scheduling].
15382 ///
15383 /// # Example
15384 /// ```ignore,no_run
15385 /// # use google_cloud_dataproc_v1::model::Job;
15386 /// use google_cloud_dataproc_v1::model::JobScheduling;
15387 /// let x = Job::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
15388 /// let x = Job::new().set_or_clear_scheduling(None::<JobScheduling>);
15389 /// ```
15390 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
15391 where
15392 T: std::convert::Into<crate::model::JobScheduling>,
15393 {
15394 self.scheduling = v.map(|x| x.into());
15395 self
15396 }
15397
15398 /// Sets the value of [job_uuid][crate::model::Job::job_uuid].
15399 ///
15400 /// # Example
15401 /// ```ignore,no_run
15402 /// # use google_cloud_dataproc_v1::model::Job;
15403 /// let x = Job::new().set_job_uuid("example");
15404 /// ```
15405 pub fn set_job_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15406 self.job_uuid = v.into();
15407 self
15408 }
15409
15410 /// Sets the value of [done][crate::model::Job::done].
15411 ///
15412 /// # Example
15413 /// ```ignore,no_run
15414 /// # use google_cloud_dataproc_v1::model::Job;
15415 /// let x = Job::new().set_done(true);
15416 /// ```
15417 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15418 self.done = v.into();
15419 self
15420 }
15421
15422 /// Sets the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
15423 ///
15424 /// # Example
15425 /// ```ignore,no_run
15426 /// # use google_cloud_dataproc_v1::model::Job;
15427 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15428 /// let x = Job::new().set_driver_scheduling_config(DriverSchedulingConfig::default()/* use setters */);
15429 /// ```
15430 pub fn set_driver_scheduling_config<T>(mut self, v: T) -> Self
15431 where
15432 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
15433 {
15434 self.driver_scheduling_config = std::option::Option::Some(v.into());
15435 self
15436 }
15437
15438 /// Sets or clears the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
15439 ///
15440 /// # Example
15441 /// ```ignore,no_run
15442 /// # use google_cloud_dataproc_v1::model::Job;
15443 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15444 /// let x = Job::new().set_or_clear_driver_scheduling_config(Some(DriverSchedulingConfig::default()/* use setters */));
15445 /// let x = Job::new().set_or_clear_driver_scheduling_config(None::<DriverSchedulingConfig>);
15446 /// ```
15447 pub fn set_or_clear_driver_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
15448 where
15449 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
15450 {
15451 self.driver_scheduling_config = v.map(|x| x.into());
15452 self
15453 }
15454
15455 /// Sets the value of [type_job][crate::model::Job::type_job].
15456 ///
15457 /// Note that all the setters affecting `type_job` are mutually
15458 /// exclusive.
15459 ///
15460 /// # Example
15461 /// ```ignore,no_run
15462 /// # use google_cloud_dataproc_v1::model::Job;
15463 /// use google_cloud_dataproc_v1::model::HadoopJob;
15464 /// let x = Job::new().set_type_job(Some(
15465 /// google_cloud_dataproc_v1::model::job::TypeJob::HadoopJob(HadoopJob::default().into())));
15466 /// ```
15467 pub fn set_type_job<T: std::convert::Into<std::option::Option<crate::model::job::TypeJob>>>(
15468 mut self,
15469 v: T,
15470 ) -> Self {
15471 self.type_job = v.into();
15472 self
15473 }
15474
15475 /// The value of [type_job][crate::model::Job::type_job]
15476 /// if it holds a `HadoopJob`, `None` if the field is not set or
15477 /// holds a different branch.
15478 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
15479 #[allow(unreachable_patterns)]
15480 self.type_job.as_ref().and_then(|v| match v {
15481 crate::model::job::TypeJob::HadoopJob(v) => std::option::Option::Some(v),
15482 _ => std::option::Option::None,
15483 })
15484 }
15485
15486 /// Sets the value of [type_job][crate::model::Job::type_job]
15487 /// to hold a `HadoopJob`.
15488 ///
15489 /// Note that all the setters affecting `type_job` are
15490 /// mutually exclusive.
15491 ///
15492 /// # Example
15493 /// ```ignore,no_run
15494 /// # use google_cloud_dataproc_v1::model::Job;
15495 /// use google_cloud_dataproc_v1::model::HadoopJob;
15496 /// let x = Job::new().set_hadoop_job(HadoopJob::default()/* use setters */);
15497 /// assert!(x.hadoop_job().is_some());
15498 /// assert!(x.spark_job().is_none());
15499 /// assert!(x.pyspark_job().is_none());
15500 /// assert!(x.hive_job().is_none());
15501 /// assert!(x.pig_job().is_none());
15502 /// assert!(x.spark_r_job().is_none());
15503 /// assert!(x.spark_sql_job().is_none());
15504 /// assert!(x.presto_job().is_none());
15505 /// assert!(x.trino_job().is_none());
15506 /// assert!(x.flink_job().is_none());
15507 /// ```
15508 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
15509 mut self,
15510 v: T,
15511 ) -> Self {
15512 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HadoopJob(v.into()));
15513 self
15514 }
15515
15516 /// The value of [type_job][crate::model::Job::type_job]
15517 /// if it holds a `SparkJob`, `None` if the field is not set or
15518 /// holds a different branch.
15519 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
15520 #[allow(unreachable_patterns)]
15521 self.type_job.as_ref().and_then(|v| match v {
15522 crate::model::job::TypeJob::SparkJob(v) => std::option::Option::Some(v),
15523 _ => std::option::Option::None,
15524 })
15525 }
15526
15527 /// Sets the value of [type_job][crate::model::Job::type_job]
15528 /// to hold a `SparkJob`.
15529 ///
15530 /// Note that all the setters affecting `type_job` are
15531 /// mutually exclusive.
15532 ///
15533 /// # Example
15534 /// ```ignore,no_run
15535 /// # use google_cloud_dataproc_v1::model::Job;
15536 /// use google_cloud_dataproc_v1::model::SparkJob;
15537 /// let x = Job::new().set_spark_job(SparkJob::default()/* use setters */);
15538 /// assert!(x.spark_job().is_some());
15539 /// assert!(x.hadoop_job().is_none());
15540 /// assert!(x.pyspark_job().is_none());
15541 /// assert!(x.hive_job().is_none());
15542 /// assert!(x.pig_job().is_none());
15543 /// assert!(x.spark_r_job().is_none());
15544 /// assert!(x.spark_sql_job().is_none());
15545 /// assert!(x.presto_job().is_none());
15546 /// assert!(x.trino_job().is_none());
15547 /// assert!(x.flink_job().is_none());
15548 /// ```
15549 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
15550 mut self,
15551 v: T,
15552 ) -> Self {
15553 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkJob(v.into()));
15554 self
15555 }
15556
15557 /// The value of [type_job][crate::model::Job::type_job]
15558 /// if it holds a `PysparkJob`, `None` if the field is not set or
15559 /// holds a different branch.
15560 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
15561 #[allow(unreachable_patterns)]
15562 self.type_job.as_ref().and_then(|v| match v {
15563 crate::model::job::TypeJob::PysparkJob(v) => std::option::Option::Some(v),
15564 _ => std::option::Option::None,
15565 })
15566 }
15567
15568 /// Sets the value of [type_job][crate::model::Job::type_job]
15569 /// to hold a `PysparkJob`.
15570 ///
15571 /// Note that all the setters affecting `type_job` are
15572 /// mutually exclusive.
15573 ///
15574 /// # Example
15575 /// ```ignore,no_run
15576 /// # use google_cloud_dataproc_v1::model::Job;
15577 /// use google_cloud_dataproc_v1::model::PySparkJob;
15578 /// let x = Job::new().set_pyspark_job(PySparkJob::default()/* use setters */);
15579 /// assert!(x.pyspark_job().is_some());
15580 /// assert!(x.hadoop_job().is_none());
15581 /// assert!(x.spark_job().is_none());
15582 /// assert!(x.hive_job().is_none());
15583 /// assert!(x.pig_job().is_none());
15584 /// assert!(x.spark_r_job().is_none());
15585 /// assert!(x.spark_sql_job().is_none());
15586 /// assert!(x.presto_job().is_none());
15587 /// assert!(x.trino_job().is_none());
15588 /// assert!(x.flink_job().is_none());
15589 /// ```
15590 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
15591 mut self,
15592 v: T,
15593 ) -> Self {
15594 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PysparkJob(v.into()));
15595 self
15596 }
15597
15598 /// The value of [type_job][crate::model::Job::type_job]
15599 /// if it holds a `HiveJob`, `None` if the field is not set or
15600 /// holds a different branch.
15601 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
15602 #[allow(unreachable_patterns)]
15603 self.type_job.as_ref().and_then(|v| match v {
15604 crate::model::job::TypeJob::HiveJob(v) => std::option::Option::Some(v),
15605 _ => std::option::Option::None,
15606 })
15607 }
15608
15609 /// Sets the value of [type_job][crate::model::Job::type_job]
15610 /// to hold a `HiveJob`.
15611 ///
15612 /// Note that all the setters affecting `type_job` are
15613 /// mutually exclusive.
15614 ///
15615 /// # Example
15616 /// ```ignore,no_run
15617 /// # use google_cloud_dataproc_v1::model::Job;
15618 /// use google_cloud_dataproc_v1::model::HiveJob;
15619 /// let x = Job::new().set_hive_job(HiveJob::default()/* use setters */);
15620 /// assert!(x.hive_job().is_some());
15621 /// assert!(x.hadoop_job().is_none());
15622 /// assert!(x.spark_job().is_none());
15623 /// assert!(x.pyspark_job().is_none());
15624 /// assert!(x.pig_job().is_none());
15625 /// assert!(x.spark_r_job().is_none());
15626 /// assert!(x.spark_sql_job().is_none());
15627 /// assert!(x.presto_job().is_none());
15628 /// assert!(x.trino_job().is_none());
15629 /// assert!(x.flink_job().is_none());
15630 /// ```
15631 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
15632 mut self,
15633 v: T,
15634 ) -> Self {
15635 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HiveJob(v.into()));
15636 self
15637 }
15638
15639 /// The value of [type_job][crate::model::Job::type_job]
15640 /// if it holds a `PigJob`, `None` if the field is not set or
15641 /// holds a different branch.
15642 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
15643 #[allow(unreachable_patterns)]
15644 self.type_job.as_ref().and_then(|v| match v {
15645 crate::model::job::TypeJob::PigJob(v) => std::option::Option::Some(v),
15646 _ => std::option::Option::None,
15647 })
15648 }
15649
15650 /// Sets the value of [type_job][crate::model::Job::type_job]
15651 /// to hold a `PigJob`.
15652 ///
15653 /// Note that all the setters affecting `type_job` are
15654 /// mutually exclusive.
15655 ///
15656 /// # Example
15657 /// ```ignore,no_run
15658 /// # use google_cloud_dataproc_v1::model::Job;
15659 /// use google_cloud_dataproc_v1::model::PigJob;
15660 /// let x = Job::new().set_pig_job(PigJob::default()/* use setters */);
15661 /// assert!(x.pig_job().is_some());
15662 /// assert!(x.hadoop_job().is_none());
15663 /// assert!(x.spark_job().is_none());
15664 /// assert!(x.pyspark_job().is_none());
15665 /// assert!(x.hive_job().is_none());
15666 /// assert!(x.spark_r_job().is_none());
15667 /// assert!(x.spark_sql_job().is_none());
15668 /// assert!(x.presto_job().is_none());
15669 /// assert!(x.trino_job().is_none());
15670 /// assert!(x.flink_job().is_none());
15671 /// ```
15672 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
15673 mut self,
15674 v: T,
15675 ) -> Self {
15676 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PigJob(v.into()));
15677 self
15678 }
15679
15680 /// The value of [type_job][crate::model::Job::type_job]
15681 /// if it holds a `SparkRJob`, `None` if the field is not set or
15682 /// holds a different branch.
15683 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
15684 #[allow(unreachable_patterns)]
15685 self.type_job.as_ref().and_then(|v| match v {
15686 crate::model::job::TypeJob::SparkRJob(v) => std::option::Option::Some(v),
15687 _ => std::option::Option::None,
15688 })
15689 }
15690
15691 /// Sets the value of [type_job][crate::model::Job::type_job]
15692 /// to hold a `SparkRJob`.
15693 ///
15694 /// Note that all the setters affecting `type_job` are
15695 /// mutually exclusive.
15696 ///
15697 /// # Example
15698 /// ```ignore,no_run
15699 /// # use google_cloud_dataproc_v1::model::Job;
15700 /// use google_cloud_dataproc_v1::model::SparkRJob;
15701 /// let x = Job::new().set_spark_r_job(SparkRJob::default()/* use setters */);
15702 /// assert!(x.spark_r_job().is_some());
15703 /// assert!(x.hadoop_job().is_none());
15704 /// assert!(x.spark_job().is_none());
15705 /// assert!(x.pyspark_job().is_none());
15706 /// assert!(x.hive_job().is_none());
15707 /// assert!(x.pig_job().is_none());
15708 /// assert!(x.spark_sql_job().is_none());
15709 /// assert!(x.presto_job().is_none());
15710 /// assert!(x.trino_job().is_none());
15711 /// assert!(x.flink_job().is_none());
15712 /// ```
15713 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
15714 mut self,
15715 v: T,
15716 ) -> Self {
15717 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkRJob(v.into()));
15718 self
15719 }
15720
15721 /// The value of [type_job][crate::model::Job::type_job]
15722 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
15723 /// holds a different branch.
15724 pub fn spark_sql_job(
15725 &self,
15726 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
15727 #[allow(unreachable_patterns)]
15728 self.type_job.as_ref().and_then(|v| match v {
15729 crate::model::job::TypeJob::SparkSqlJob(v) => std::option::Option::Some(v),
15730 _ => std::option::Option::None,
15731 })
15732 }
15733
15734 /// Sets the value of [type_job][crate::model::Job::type_job]
15735 /// to hold a `SparkSqlJob`.
15736 ///
15737 /// Note that all the setters affecting `type_job` are
15738 /// mutually exclusive.
15739 ///
15740 /// # Example
15741 /// ```ignore,no_run
15742 /// # use google_cloud_dataproc_v1::model::Job;
15743 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
15744 /// let x = Job::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
15745 /// assert!(x.spark_sql_job().is_some());
15746 /// assert!(x.hadoop_job().is_none());
15747 /// assert!(x.spark_job().is_none());
15748 /// assert!(x.pyspark_job().is_none());
15749 /// assert!(x.hive_job().is_none());
15750 /// assert!(x.pig_job().is_none());
15751 /// assert!(x.spark_r_job().is_none());
15752 /// assert!(x.presto_job().is_none());
15753 /// assert!(x.trino_job().is_none());
15754 /// assert!(x.flink_job().is_none());
15755 /// ```
15756 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
15757 mut self,
15758 v: T,
15759 ) -> Self {
15760 self.type_job =
15761 std::option::Option::Some(crate::model::job::TypeJob::SparkSqlJob(v.into()));
15762 self
15763 }
15764
15765 /// The value of [type_job][crate::model::Job::type_job]
15766 /// if it holds a `PrestoJob`, `None` if the field is not set or
15767 /// holds a different branch.
15768 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
15769 #[allow(unreachable_patterns)]
15770 self.type_job.as_ref().and_then(|v| match v {
15771 crate::model::job::TypeJob::PrestoJob(v) => std::option::Option::Some(v),
15772 _ => std::option::Option::None,
15773 })
15774 }
15775
15776 /// Sets the value of [type_job][crate::model::Job::type_job]
15777 /// to hold a `PrestoJob`.
15778 ///
15779 /// Note that all the setters affecting `type_job` are
15780 /// mutually exclusive.
15781 ///
15782 /// # Example
15783 /// ```ignore,no_run
15784 /// # use google_cloud_dataproc_v1::model::Job;
15785 /// use google_cloud_dataproc_v1::model::PrestoJob;
15786 /// let x = Job::new().set_presto_job(PrestoJob::default()/* use setters */);
15787 /// assert!(x.presto_job().is_some());
15788 /// assert!(x.hadoop_job().is_none());
15789 /// assert!(x.spark_job().is_none());
15790 /// assert!(x.pyspark_job().is_none());
15791 /// assert!(x.hive_job().is_none());
15792 /// assert!(x.pig_job().is_none());
15793 /// assert!(x.spark_r_job().is_none());
15794 /// assert!(x.spark_sql_job().is_none());
15795 /// assert!(x.trino_job().is_none());
15796 /// assert!(x.flink_job().is_none());
15797 /// ```
15798 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
15799 mut self,
15800 v: T,
15801 ) -> Self {
15802 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PrestoJob(v.into()));
15803 self
15804 }
15805
15806 /// The value of [type_job][crate::model::Job::type_job]
15807 /// if it holds a `TrinoJob`, `None` if the field is not set or
15808 /// holds a different branch.
15809 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
15810 #[allow(unreachable_patterns)]
15811 self.type_job.as_ref().and_then(|v| match v {
15812 crate::model::job::TypeJob::TrinoJob(v) => std::option::Option::Some(v),
15813 _ => std::option::Option::None,
15814 })
15815 }
15816
15817 /// Sets the value of [type_job][crate::model::Job::type_job]
15818 /// to hold a `TrinoJob`.
15819 ///
15820 /// Note that all the setters affecting `type_job` are
15821 /// mutually exclusive.
15822 ///
15823 /// # Example
15824 /// ```ignore,no_run
15825 /// # use google_cloud_dataproc_v1::model::Job;
15826 /// use google_cloud_dataproc_v1::model::TrinoJob;
15827 /// let x = Job::new().set_trino_job(TrinoJob::default()/* use setters */);
15828 /// assert!(x.trino_job().is_some());
15829 /// assert!(x.hadoop_job().is_none());
15830 /// assert!(x.spark_job().is_none());
15831 /// assert!(x.pyspark_job().is_none());
15832 /// assert!(x.hive_job().is_none());
15833 /// assert!(x.pig_job().is_none());
15834 /// assert!(x.spark_r_job().is_none());
15835 /// assert!(x.spark_sql_job().is_none());
15836 /// assert!(x.presto_job().is_none());
15837 /// assert!(x.flink_job().is_none());
15838 /// ```
15839 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
15840 mut self,
15841 v: T,
15842 ) -> Self {
15843 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::TrinoJob(v.into()));
15844 self
15845 }
15846
15847 /// The value of [type_job][crate::model::Job::type_job]
15848 /// if it holds a `FlinkJob`, `None` if the field is not set or
15849 /// holds a different branch.
15850 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
15851 #[allow(unreachable_patterns)]
15852 self.type_job.as_ref().and_then(|v| match v {
15853 crate::model::job::TypeJob::FlinkJob(v) => std::option::Option::Some(v),
15854 _ => std::option::Option::None,
15855 })
15856 }
15857
15858 /// Sets the value of [type_job][crate::model::Job::type_job]
15859 /// to hold a `FlinkJob`.
15860 ///
15861 /// Note that all the setters affecting `type_job` are
15862 /// mutually exclusive.
15863 ///
15864 /// # Example
15865 /// ```ignore,no_run
15866 /// # use google_cloud_dataproc_v1::model::Job;
15867 /// use google_cloud_dataproc_v1::model::FlinkJob;
15868 /// let x = Job::new().set_flink_job(FlinkJob::default()/* use setters */);
15869 /// assert!(x.flink_job().is_some());
15870 /// assert!(x.hadoop_job().is_none());
15871 /// assert!(x.spark_job().is_none());
15872 /// assert!(x.pyspark_job().is_none());
15873 /// assert!(x.hive_job().is_none());
15874 /// assert!(x.pig_job().is_none());
15875 /// assert!(x.spark_r_job().is_none());
15876 /// assert!(x.spark_sql_job().is_none());
15877 /// assert!(x.presto_job().is_none());
15878 /// assert!(x.trino_job().is_none());
15879 /// ```
15880 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
15881 mut self,
15882 v: T,
15883 ) -> Self {
15884 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::FlinkJob(v.into()));
15885 self
15886 }
15887}
15888
15889impl wkt::message::Message for Job {
15890 fn typename() -> &'static str {
15891 "type.googleapis.com/google.cloud.dataproc.v1.Job"
15892 }
15893}
15894
15895/// Defines additional types related to [Job].
15896pub mod job {
15897 #[allow(unused_imports)]
15898 use super::*;
15899
15900 /// Required. The application/framework-specific portion of the job.
15901 #[derive(Clone, Debug, PartialEq)]
15902 #[non_exhaustive]
15903 pub enum TypeJob {
15904 /// Optional. Job is a Hadoop job.
15905 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
15906 /// Optional. Job is a Spark job.
15907 SparkJob(std::boxed::Box<crate::model::SparkJob>),
15908 /// Optional. Job is a PySpark job.
15909 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
15910 /// Optional. Job is a Hive job.
15911 HiveJob(std::boxed::Box<crate::model::HiveJob>),
15912 /// Optional. Job is a Pig job.
15913 PigJob(std::boxed::Box<crate::model::PigJob>),
15914 /// Optional. Job is a SparkR job.
15915 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
15916 /// Optional. Job is a SparkSql job.
15917 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
15918 /// Optional. Job is a Presto job.
15919 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
15920 /// Optional. Job is a Trino job.
15921 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
15922 /// Optional. Job is a Flink job.
15923 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
15924 }
15925}
15926
15927/// Driver scheduling configuration.
15928#[derive(Clone, Default, PartialEq)]
15929#[non_exhaustive]
15930pub struct DriverSchedulingConfig {
15931 /// Required. The amount of memory in MB the driver is requesting.
15932 pub memory_mb: i32,
15933
15934 /// Required. The number of vCPUs the driver is requesting.
15935 pub vcores: i32,
15936
15937 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15938}
15939
15940impl DriverSchedulingConfig {
15941 /// Creates a new default instance.
15942 pub fn new() -> Self {
15943 std::default::Default::default()
15944 }
15945
15946 /// Sets the value of [memory_mb][crate::model::DriverSchedulingConfig::memory_mb].
15947 ///
15948 /// # Example
15949 /// ```ignore,no_run
15950 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15951 /// let x = DriverSchedulingConfig::new().set_memory_mb(42);
15952 /// ```
15953 pub fn set_memory_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15954 self.memory_mb = v.into();
15955 self
15956 }
15957
15958 /// Sets the value of [vcores][crate::model::DriverSchedulingConfig::vcores].
15959 ///
15960 /// # Example
15961 /// ```ignore,no_run
15962 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15963 /// let x = DriverSchedulingConfig::new().set_vcores(42);
15964 /// ```
15965 pub fn set_vcores<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15966 self.vcores = v.into();
15967 self
15968 }
15969}
15970
15971impl wkt::message::Message for DriverSchedulingConfig {
15972 fn typename() -> &'static str {
15973 "type.googleapis.com/google.cloud.dataproc.v1.DriverSchedulingConfig"
15974 }
15975}
15976
15977/// Job scheduling options.
15978#[derive(Clone, Default, PartialEq)]
15979#[non_exhaustive]
15980pub struct JobScheduling {
15981 /// Optional. Maximum number of times per hour a driver can be restarted as
15982 /// a result of driver exiting with non-zero code before job is
15983 /// reported failed.
15984 ///
15985 /// A job might be reported as thrashing if the driver exits with a non-zero
15986 /// code four times within a 10-minute window.
15987 ///
15988 /// Maximum value is 10.
15989 ///
15990 /// **Note:** This restartable job option is not supported in Dataproc
15991 /// [workflow templates]
15992 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template>).
15993 pub max_failures_per_hour: i32,
15994
15995 /// Optional. Maximum total number of times a driver can be restarted as a
15996 /// result of the driver exiting with a non-zero code. After the maximum number
15997 /// is reached, the job will be reported as failed.
15998 ///
15999 /// Maximum value is 240.
16000 ///
16001 /// **Note:** Currently, this restartable job option is
16002 /// not supported in Dataproc
16003 /// [workflow
16004 /// templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
16005 pub max_failures_total: i32,
16006
16007 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16008}
16009
16010impl JobScheduling {
16011 /// Creates a new default instance.
16012 pub fn new() -> Self {
16013 std::default::Default::default()
16014 }
16015
16016 /// Sets the value of [max_failures_per_hour][crate::model::JobScheduling::max_failures_per_hour].
16017 ///
16018 /// # Example
16019 /// ```ignore,no_run
16020 /// # use google_cloud_dataproc_v1::model::JobScheduling;
16021 /// let x = JobScheduling::new().set_max_failures_per_hour(42);
16022 /// ```
16023 pub fn set_max_failures_per_hour<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16024 self.max_failures_per_hour = v.into();
16025 self
16026 }
16027
16028 /// Sets the value of [max_failures_total][crate::model::JobScheduling::max_failures_total].
16029 ///
16030 /// # Example
16031 /// ```ignore,no_run
16032 /// # use google_cloud_dataproc_v1::model::JobScheduling;
16033 /// let x = JobScheduling::new().set_max_failures_total(42);
16034 /// ```
16035 pub fn set_max_failures_total<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16036 self.max_failures_total = v.into();
16037 self
16038 }
16039}
16040
16041impl wkt::message::Message for JobScheduling {
16042 fn typename() -> &'static str {
16043 "type.googleapis.com/google.cloud.dataproc.v1.JobScheduling"
16044 }
16045}
16046
16047/// A request to submit a job.
16048#[derive(Clone, Default, PartialEq)]
16049#[non_exhaustive]
16050pub struct SubmitJobRequest {
16051 /// Required. The ID of the Google Cloud Platform project that the job
16052 /// belongs to.
16053 pub project_id: std::string::String,
16054
16055 /// Required. The Dataproc region in which to handle the request.
16056 pub region: std::string::String,
16057
16058 /// Required. The job resource.
16059 pub job: std::option::Option<crate::model::Job>,
16060
16061 /// Optional. A unique id used to identify the request. If the server
16062 /// receives two
16063 /// [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
16064 /// with the same id, then the second request will be ignored and the
16065 /// first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend
16066 /// is returned.
16067 ///
16068 /// It is recommended to always set this value to a
16069 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
16070 ///
16071 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
16072 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
16073 ///
16074 /// [google.cloud.dataproc.v1.Job]: crate::model::Job
16075 pub request_id: std::string::String,
16076
16077 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16078}
16079
16080impl SubmitJobRequest {
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::SubmitJobRequest::project_id].
16087 ///
16088 /// # Example
16089 /// ```ignore,no_run
16090 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
16091 /// let x = SubmitJobRequest::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::SubmitJobRequest::region].
16099 ///
16100 /// # Example
16101 /// ```ignore,no_run
16102 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
16103 /// let x = SubmitJobRequest::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][crate::model::SubmitJobRequest::job].
16111 ///
16112 /// # Example
16113 /// ```ignore,no_run
16114 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
16115 /// use google_cloud_dataproc_v1::model::Job;
16116 /// let x = SubmitJobRequest::new().set_job(Job::default()/* use setters */);
16117 /// ```
16118 pub fn set_job<T>(mut self, v: T) -> Self
16119 where
16120 T: std::convert::Into<crate::model::Job>,
16121 {
16122 self.job = std::option::Option::Some(v.into());
16123 self
16124 }
16125
16126 /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
16127 ///
16128 /// # Example
16129 /// ```ignore,no_run
16130 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
16131 /// use google_cloud_dataproc_v1::model::Job;
16132 /// let x = SubmitJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
16133 /// let x = SubmitJobRequest::new().set_or_clear_job(None::<Job>);
16134 /// ```
16135 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
16136 where
16137 T: std::convert::Into<crate::model::Job>,
16138 {
16139 self.job = v.map(|x| x.into());
16140 self
16141 }
16142
16143 /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
16144 ///
16145 /// # Example
16146 /// ```ignore,no_run
16147 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
16148 /// let x = SubmitJobRequest::new().set_request_id("example");
16149 /// ```
16150 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16151 self.request_id = v.into();
16152 self
16153 }
16154}
16155
16156impl wkt::message::Message for SubmitJobRequest {
16157 fn typename() -> &'static str {
16158 "type.googleapis.com/google.cloud.dataproc.v1.SubmitJobRequest"
16159 }
16160}
16161
16162/// Job Operation metadata.
16163#[derive(Clone, Default, PartialEq)]
16164#[non_exhaustive]
16165pub struct JobMetadata {
16166 /// Output only. The job id.
16167 pub job_id: std::string::String,
16168
16169 /// Output only. Most recent job status.
16170 pub status: std::option::Option<crate::model::JobStatus>,
16171
16172 /// Output only. Operation type.
16173 pub operation_type: std::string::String,
16174
16175 /// Output only. Job submission time.
16176 pub start_time: std::option::Option<wkt::Timestamp>,
16177
16178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16179}
16180
16181impl JobMetadata {
16182 /// Creates a new default instance.
16183 pub fn new() -> Self {
16184 std::default::Default::default()
16185 }
16186
16187 /// Sets the value of [job_id][crate::model::JobMetadata::job_id].
16188 ///
16189 /// # Example
16190 /// ```ignore,no_run
16191 /// # use google_cloud_dataproc_v1::model::JobMetadata;
16192 /// let x = JobMetadata::new().set_job_id("example");
16193 /// ```
16194 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16195 self.job_id = v.into();
16196 self
16197 }
16198
16199 /// Sets the value of [status][crate::model::JobMetadata::status].
16200 ///
16201 /// # Example
16202 /// ```ignore,no_run
16203 /// # use google_cloud_dataproc_v1::model::JobMetadata;
16204 /// use google_cloud_dataproc_v1::model::JobStatus;
16205 /// let x = JobMetadata::new().set_status(JobStatus::default()/* use setters */);
16206 /// ```
16207 pub fn set_status<T>(mut self, v: T) -> Self
16208 where
16209 T: std::convert::Into<crate::model::JobStatus>,
16210 {
16211 self.status = std::option::Option::Some(v.into());
16212 self
16213 }
16214
16215 /// Sets or clears the value of [status][crate::model::JobMetadata::status].
16216 ///
16217 /// # Example
16218 /// ```ignore,no_run
16219 /// # use google_cloud_dataproc_v1::model::JobMetadata;
16220 /// use google_cloud_dataproc_v1::model::JobStatus;
16221 /// let x = JobMetadata::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
16222 /// let x = JobMetadata::new().set_or_clear_status(None::<JobStatus>);
16223 /// ```
16224 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
16225 where
16226 T: std::convert::Into<crate::model::JobStatus>,
16227 {
16228 self.status = v.map(|x| x.into());
16229 self
16230 }
16231
16232 /// Sets the value of [operation_type][crate::model::JobMetadata::operation_type].
16233 ///
16234 /// # Example
16235 /// ```ignore,no_run
16236 /// # use google_cloud_dataproc_v1::model::JobMetadata;
16237 /// let x = JobMetadata::new().set_operation_type("example");
16238 /// ```
16239 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16240 self.operation_type = v.into();
16241 self
16242 }
16243
16244 /// Sets the value of [start_time][crate::model::JobMetadata::start_time].
16245 ///
16246 /// # Example
16247 /// ```ignore,no_run
16248 /// # use google_cloud_dataproc_v1::model::JobMetadata;
16249 /// use wkt::Timestamp;
16250 /// let x = JobMetadata::new().set_start_time(Timestamp::default()/* use setters */);
16251 /// ```
16252 pub fn set_start_time<T>(mut self, v: T) -> Self
16253 where
16254 T: std::convert::Into<wkt::Timestamp>,
16255 {
16256 self.start_time = std::option::Option::Some(v.into());
16257 self
16258 }
16259
16260 /// Sets or clears the value of [start_time][crate::model::JobMetadata::start_time].
16261 ///
16262 /// # Example
16263 /// ```ignore,no_run
16264 /// # use google_cloud_dataproc_v1::model::JobMetadata;
16265 /// use wkt::Timestamp;
16266 /// let x = JobMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
16267 /// let x = JobMetadata::new().set_or_clear_start_time(None::<Timestamp>);
16268 /// ```
16269 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16270 where
16271 T: std::convert::Into<wkt::Timestamp>,
16272 {
16273 self.start_time = v.map(|x| x.into());
16274 self
16275 }
16276}
16277
16278impl wkt::message::Message for JobMetadata {
16279 fn typename() -> &'static str {
16280 "type.googleapis.com/google.cloud.dataproc.v1.JobMetadata"
16281 }
16282}
16283
16284/// A request to get the resource representation for a job in a project.
16285#[derive(Clone, Default, PartialEq)]
16286#[non_exhaustive]
16287pub struct GetJobRequest {
16288 /// Required. The ID of the Google Cloud Platform project that the job
16289 /// belongs to.
16290 pub project_id: std::string::String,
16291
16292 /// Required. The Dataproc region in which to handle the request.
16293 pub region: std::string::String,
16294
16295 /// Required. The job ID.
16296 pub job_id: std::string::String,
16297
16298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16299}
16300
16301impl GetJobRequest {
16302 /// Creates a new default instance.
16303 pub fn new() -> Self {
16304 std::default::Default::default()
16305 }
16306
16307 /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
16308 ///
16309 /// # Example
16310 /// ```ignore,no_run
16311 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
16312 /// let x = GetJobRequest::new().set_project_id("example");
16313 /// ```
16314 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16315 self.project_id = v.into();
16316 self
16317 }
16318
16319 /// Sets the value of [region][crate::model::GetJobRequest::region].
16320 ///
16321 /// # Example
16322 /// ```ignore,no_run
16323 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
16324 /// let x = GetJobRequest::new().set_region("example");
16325 /// ```
16326 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16327 self.region = v.into();
16328 self
16329 }
16330
16331 /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
16332 ///
16333 /// # Example
16334 /// ```ignore,no_run
16335 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
16336 /// let x = GetJobRequest::new().set_job_id("example");
16337 /// ```
16338 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16339 self.job_id = v.into();
16340 self
16341 }
16342}
16343
16344impl wkt::message::Message for GetJobRequest {
16345 fn typename() -> &'static str {
16346 "type.googleapis.com/google.cloud.dataproc.v1.GetJobRequest"
16347 }
16348}
16349
16350/// A request to list jobs in a project.
16351#[derive(Clone, Default, PartialEq)]
16352#[non_exhaustive]
16353pub struct ListJobsRequest {
16354 /// Required. The ID of the Google Cloud Platform project that the job
16355 /// belongs to.
16356 pub project_id: std::string::String,
16357
16358 /// Required. The Dataproc region in which to handle the request.
16359 pub region: std::string::String,
16360
16361 /// Optional. The number of results to return in each response.
16362 pub page_size: i32,
16363
16364 /// Optional. The page token, returned by a previous call, to request the
16365 /// next page of results.
16366 pub page_token: std::string::String,
16367
16368 /// Optional. If set, the returned jobs list includes only jobs that were
16369 /// submitted to the named cluster.
16370 pub cluster_name: std::string::String,
16371
16372 /// Optional. Specifies enumerated categories of jobs to list.
16373 /// (default = match ALL jobs).
16374 ///
16375 /// If `filter` is provided, `jobStateMatcher` will be ignored.
16376 pub job_state_matcher: crate::model::list_jobs_request::JobStateMatcher,
16377
16378 /// Optional. A filter constraining the jobs to list. Filters are
16379 /// case-sensitive and have the following syntax:
16380 ///
16381 /// [field = value] AND [field [= value]] ...
16382 ///
16383 /// where **field** is `status.state` or `insertTime`, or `labels.[KEY]`, and
16384 /// `[KEY]` is a label key. **value** can be `*` to match all values.
16385 /// `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
16386 /// Allows `insertTime` to be a timestamp in RFC 3339 format in double quotes,
16387 /// such as `2025-01-01T00:00:00Z`. Only the logical `AND` operator is
16388 /// supported; space-separated items are treated as having an implicit `AND`
16389 /// operator.
16390 ///
16391 /// Example filter:
16392 ///
16393 /// status.state = ACTIVE AND labels.env = staging AND labels.starred = * AND
16394 /// insertTime <= "2025-01-01T00:00:00Z"
16395 pub filter: std::string::String,
16396
16397 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16398}
16399
16400impl ListJobsRequest {
16401 /// Creates a new default instance.
16402 pub fn new() -> Self {
16403 std::default::Default::default()
16404 }
16405
16406 /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
16407 ///
16408 /// # Example
16409 /// ```ignore,no_run
16410 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
16411 /// let x = ListJobsRequest::new().set_project_id("example");
16412 /// ```
16413 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16414 self.project_id = v.into();
16415 self
16416 }
16417
16418 /// Sets the value of [region][crate::model::ListJobsRequest::region].
16419 ///
16420 /// # Example
16421 /// ```ignore,no_run
16422 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
16423 /// let x = ListJobsRequest::new().set_region("example");
16424 /// ```
16425 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16426 self.region = v.into();
16427 self
16428 }
16429
16430 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
16431 ///
16432 /// # Example
16433 /// ```ignore,no_run
16434 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
16435 /// let x = ListJobsRequest::new().set_page_size(42);
16436 /// ```
16437 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16438 self.page_size = v.into();
16439 self
16440 }
16441
16442 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
16443 ///
16444 /// # Example
16445 /// ```ignore,no_run
16446 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
16447 /// let x = ListJobsRequest::new().set_page_token("example");
16448 /// ```
16449 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16450 self.page_token = v.into();
16451 self
16452 }
16453
16454 /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
16455 ///
16456 /// # Example
16457 /// ```ignore,no_run
16458 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
16459 /// let x = ListJobsRequest::new().set_cluster_name("example");
16460 /// ```
16461 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16462 self.cluster_name = v.into();
16463 self
16464 }
16465
16466 /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
16467 ///
16468 /// # Example
16469 /// ```ignore,no_run
16470 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
16471 /// use google_cloud_dataproc_v1::model::list_jobs_request::JobStateMatcher;
16472 /// let x0 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::Active);
16473 /// let x1 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::NonActive);
16474 /// ```
16475 pub fn set_job_state_matcher<
16476 T: std::convert::Into<crate::model::list_jobs_request::JobStateMatcher>,
16477 >(
16478 mut self,
16479 v: T,
16480 ) -> Self {
16481 self.job_state_matcher = v.into();
16482 self
16483 }
16484
16485 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
16486 ///
16487 /// # Example
16488 /// ```ignore,no_run
16489 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
16490 /// let x = ListJobsRequest::new().set_filter("example");
16491 /// ```
16492 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16493 self.filter = v.into();
16494 self
16495 }
16496}
16497
16498impl wkt::message::Message for ListJobsRequest {
16499 fn typename() -> &'static str {
16500 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsRequest"
16501 }
16502}
16503
16504/// Defines additional types related to [ListJobsRequest].
16505pub mod list_jobs_request {
16506 #[allow(unused_imports)]
16507 use super::*;
16508
16509 /// A matcher that specifies categories of job states.
16510 ///
16511 /// # Working with unknown values
16512 ///
16513 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16514 /// additional enum variants at any time. Adding new variants is not considered
16515 /// a breaking change. Applications should write their code in anticipation of:
16516 ///
16517 /// - New values appearing in future releases of the client library, **and**
16518 /// - New values received dynamically, without application changes.
16519 ///
16520 /// Please consult the [Working with enums] section in the user guide for some
16521 /// guidelines.
16522 ///
16523 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16524 #[derive(Clone, Debug, PartialEq)]
16525 #[non_exhaustive]
16526 pub enum JobStateMatcher {
16527 /// Match all jobs, regardless of state.
16528 All,
16529 /// Only match jobs in non-terminal states: PENDING, RUNNING, or
16530 /// CANCEL_PENDING.
16531 Active,
16532 /// Only match jobs in terminal states: CANCELLED, DONE, or ERROR.
16533 NonActive,
16534 /// If set, the enum was initialized with an unknown value.
16535 ///
16536 /// Applications can examine the value using [JobStateMatcher::value] or
16537 /// [JobStateMatcher::name].
16538 UnknownValue(job_state_matcher::UnknownValue),
16539 }
16540
16541 #[doc(hidden)]
16542 pub mod job_state_matcher {
16543 #[allow(unused_imports)]
16544 use super::*;
16545 #[derive(Clone, Debug, PartialEq)]
16546 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16547 }
16548
16549 impl JobStateMatcher {
16550 /// Gets the enum value.
16551 ///
16552 /// Returns `None` if the enum contains an unknown value deserialized from
16553 /// the string representation of enums.
16554 pub fn value(&self) -> std::option::Option<i32> {
16555 match self {
16556 Self::All => std::option::Option::Some(0),
16557 Self::Active => std::option::Option::Some(1),
16558 Self::NonActive => std::option::Option::Some(2),
16559 Self::UnknownValue(u) => u.0.value(),
16560 }
16561 }
16562
16563 /// Gets the enum value as a string.
16564 ///
16565 /// Returns `None` if the enum contains an unknown value deserialized from
16566 /// the integer representation of enums.
16567 pub fn name(&self) -> std::option::Option<&str> {
16568 match self {
16569 Self::All => std::option::Option::Some("ALL"),
16570 Self::Active => std::option::Option::Some("ACTIVE"),
16571 Self::NonActive => std::option::Option::Some("NON_ACTIVE"),
16572 Self::UnknownValue(u) => u.0.name(),
16573 }
16574 }
16575 }
16576
16577 impl std::default::Default for JobStateMatcher {
16578 fn default() -> Self {
16579 use std::convert::From;
16580 Self::from(0)
16581 }
16582 }
16583
16584 impl std::fmt::Display for JobStateMatcher {
16585 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16586 wkt::internal::display_enum(f, self.name(), self.value())
16587 }
16588 }
16589
16590 impl std::convert::From<i32> for JobStateMatcher {
16591 fn from(value: i32) -> Self {
16592 match value {
16593 0 => Self::All,
16594 1 => Self::Active,
16595 2 => Self::NonActive,
16596 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
16597 wkt::internal::UnknownEnumValue::Integer(value),
16598 )),
16599 }
16600 }
16601 }
16602
16603 impl std::convert::From<&str> for JobStateMatcher {
16604 fn from(value: &str) -> Self {
16605 use std::string::ToString;
16606 match value {
16607 "ALL" => Self::All,
16608 "ACTIVE" => Self::Active,
16609 "NON_ACTIVE" => Self::NonActive,
16610 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
16611 wkt::internal::UnknownEnumValue::String(value.to_string()),
16612 )),
16613 }
16614 }
16615 }
16616
16617 impl serde::ser::Serialize for JobStateMatcher {
16618 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16619 where
16620 S: serde::Serializer,
16621 {
16622 match self {
16623 Self::All => serializer.serialize_i32(0),
16624 Self::Active => serializer.serialize_i32(1),
16625 Self::NonActive => serializer.serialize_i32(2),
16626 Self::UnknownValue(u) => u.0.serialize(serializer),
16627 }
16628 }
16629 }
16630
16631 impl<'de> serde::de::Deserialize<'de> for JobStateMatcher {
16632 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16633 where
16634 D: serde::Deserializer<'de>,
16635 {
16636 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobStateMatcher>::new(
16637 ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher",
16638 ))
16639 }
16640 }
16641}
16642
16643/// A request to update a job.
16644#[derive(Clone, Default, PartialEq)]
16645#[non_exhaustive]
16646pub struct UpdateJobRequest {
16647 /// Required. The ID of the Google Cloud Platform project that the job
16648 /// belongs to.
16649 pub project_id: std::string::String,
16650
16651 /// Required. The Dataproc region in which to handle the request.
16652 pub region: std::string::String,
16653
16654 /// Required. The job ID.
16655 pub job_id: std::string::String,
16656
16657 /// Required. The changes to the job.
16658 pub job: std::option::Option<crate::model::Job>,
16659
16660 /// Required. Specifies the path, relative to \<code\>Job\</code\>, of
16661 /// the field to update. For example, to update the labels of a Job the
16662 /// \<code\>update_mask\</code\> parameter would be specified as
16663 /// \<code\>labels\</code\>, and the `PATCH` request body would specify the new
16664 /// value. \<strong\>Note:\</strong\> Currently, \<code\>labels\</code\> is the only
16665 /// field that can be updated.
16666 pub update_mask: std::option::Option<wkt::FieldMask>,
16667
16668 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16669}
16670
16671impl UpdateJobRequest {
16672 /// Creates a new default instance.
16673 pub fn new() -> Self {
16674 std::default::Default::default()
16675 }
16676
16677 /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
16678 ///
16679 /// # Example
16680 /// ```ignore,no_run
16681 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16682 /// let x = UpdateJobRequest::new().set_project_id("example");
16683 /// ```
16684 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16685 self.project_id = v.into();
16686 self
16687 }
16688
16689 /// Sets the value of [region][crate::model::UpdateJobRequest::region].
16690 ///
16691 /// # Example
16692 /// ```ignore,no_run
16693 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16694 /// let x = UpdateJobRequest::new().set_region("example");
16695 /// ```
16696 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16697 self.region = v.into();
16698 self
16699 }
16700
16701 /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
16702 ///
16703 /// # Example
16704 /// ```ignore,no_run
16705 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16706 /// let x = UpdateJobRequest::new().set_job_id("example");
16707 /// ```
16708 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16709 self.job_id = v.into();
16710 self
16711 }
16712
16713 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
16714 ///
16715 /// # Example
16716 /// ```ignore,no_run
16717 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16718 /// use google_cloud_dataproc_v1::model::Job;
16719 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
16720 /// ```
16721 pub fn set_job<T>(mut self, v: T) -> Self
16722 where
16723 T: std::convert::Into<crate::model::Job>,
16724 {
16725 self.job = std::option::Option::Some(v.into());
16726 self
16727 }
16728
16729 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
16730 ///
16731 /// # Example
16732 /// ```ignore,no_run
16733 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16734 /// use google_cloud_dataproc_v1::model::Job;
16735 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
16736 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
16737 /// ```
16738 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
16739 where
16740 T: std::convert::Into<crate::model::Job>,
16741 {
16742 self.job = v.map(|x| x.into());
16743 self
16744 }
16745
16746 /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
16747 ///
16748 /// # Example
16749 /// ```ignore,no_run
16750 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16751 /// use wkt::FieldMask;
16752 /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
16753 /// ```
16754 pub fn set_update_mask<T>(mut self, v: T) -> Self
16755 where
16756 T: std::convert::Into<wkt::FieldMask>,
16757 {
16758 self.update_mask = std::option::Option::Some(v.into());
16759 self
16760 }
16761
16762 /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
16763 ///
16764 /// # Example
16765 /// ```ignore,no_run
16766 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16767 /// use wkt::FieldMask;
16768 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
16769 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
16770 /// ```
16771 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16772 where
16773 T: std::convert::Into<wkt::FieldMask>,
16774 {
16775 self.update_mask = v.map(|x| x.into());
16776 self
16777 }
16778}
16779
16780impl wkt::message::Message for UpdateJobRequest {
16781 fn typename() -> &'static str {
16782 "type.googleapis.com/google.cloud.dataproc.v1.UpdateJobRequest"
16783 }
16784}
16785
16786/// A list of jobs in a project.
16787#[derive(Clone, Default, PartialEq)]
16788#[non_exhaustive]
16789pub struct ListJobsResponse {
16790 /// Output only. Jobs list.
16791 pub jobs: std::vec::Vec<crate::model::Job>,
16792
16793 /// Optional. This token is included in the response if there are more results
16794 /// to fetch. To fetch additional results, provide this value as the
16795 /// `page_token` in a subsequent \<code\>ListJobsRequest\</code\>.
16796 pub next_page_token: std::string::String,
16797
16798 /// Output only. List of jobs with
16799 /// [kms_key][google.cloud.dataproc.v1.EncryptionConfig.kms_key]-encrypted
16800 /// parameters that could not be decrypted. A response to a `jobs.get` request
16801 /// may indicate the reason for the decryption failure for a specific job.
16802 ///
16803 /// [google.cloud.dataproc.v1.EncryptionConfig.kms_key]: crate::model::EncryptionConfig::kms_key
16804 pub unreachable: std::vec::Vec<std::string::String>,
16805
16806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16807}
16808
16809impl ListJobsResponse {
16810 /// Creates a new default instance.
16811 pub fn new() -> Self {
16812 std::default::Default::default()
16813 }
16814
16815 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
16816 ///
16817 /// # Example
16818 /// ```ignore,no_run
16819 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16820 /// use google_cloud_dataproc_v1::model::Job;
16821 /// let x = ListJobsResponse::new()
16822 /// .set_jobs([
16823 /// Job::default()/* use setters */,
16824 /// Job::default()/* use (different) setters */,
16825 /// ]);
16826 /// ```
16827 pub fn set_jobs<T, V>(mut self, v: T) -> Self
16828 where
16829 T: std::iter::IntoIterator<Item = V>,
16830 V: std::convert::Into<crate::model::Job>,
16831 {
16832 use std::iter::Iterator;
16833 self.jobs = v.into_iter().map(|i| i.into()).collect();
16834 self
16835 }
16836
16837 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
16838 ///
16839 /// # Example
16840 /// ```ignore,no_run
16841 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16842 /// let x = ListJobsResponse::new().set_next_page_token("example");
16843 /// ```
16844 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16845 self.next_page_token = v.into();
16846 self
16847 }
16848
16849 /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
16850 ///
16851 /// # Example
16852 /// ```ignore,no_run
16853 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16854 /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
16855 /// ```
16856 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
16857 where
16858 T: std::iter::IntoIterator<Item = V>,
16859 V: std::convert::Into<std::string::String>,
16860 {
16861 use std::iter::Iterator;
16862 self.unreachable = v.into_iter().map(|i| i.into()).collect();
16863 self
16864 }
16865}
16866
16867impl wkt::message::Message for ListJobsResponse {
16868 fn typename() -> &'static str {
16869 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsResponse"
16870 }
16871}
16872
16873#[doc(hidden)]
16874impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
16875 type PageItem = crate::model::Job;
16876
16877 fn items(self) -> std::vec::Vec<Self::PageItem> {
16878 self.jobs
16879 }
16880
16881 fn next_page_token(&self) -> std::string::String {
16882 use std::clone::Clone;
16883 self.next_page_token.clone()
16884 }
16885}
16886
16887/// A request to cancel a job.
16888#[derive(Clone, Default, PartialEq)]
16889#[non_exhaustive]
16890pub struct CancelJobRequest {
16891 /// Required. The ID of the Google Cloud Platform project that the job
16892 /// belongs to.
16893 pub project_id: std::string::String,
16894
16895 /// Required. The Dataproc region in which to handle the request.
16896 pub region: std::string::String,
16897
16898 /// Required. The job ID.
16899 pub job_id: std::string::String,
16900
16901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16902}
16903
16904impl CancelJobRequest {
16905 /// Creates a new default instance.
16906 pub fn new() -> Self {
16907 std::default::Default::default()
16908 }
16909
16910 /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
16911 ///
16912 /// # Example
16913 /// ```ignore,no_run
16914 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16915 /// let x = CancelJobRequest::new().set_project_id("example");
16916 /// ```
16917 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16918 self.project_id = v.into();
16919 self
16920 }
16921
16922 /// Sets the value of [region][crate::model::CancelJobRequest::region].
16923 ///
16924 /// # Example
16925 /// ```ignore,no_run
16926 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16927 /// let x = CancelJobRequest::new().set_region("example");
16928 /// ```
16929 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16930 self.region = v.into();
16931 self
16932 }
16933
16934 /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
16935 ///
16936 /// # Example
16937 /// ```ignore,no_run
16938 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16939 /// let x = CancelJobRequest::new().set_job_id("example");
16940 /// ```
16941 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16942 self.job_id = v.into();
16943 self
16944 }
16945}
16946
16947impl wkt::message::Message for CancelJobRequest {
16948 fn typename() -> &'static str {
16949 "type.googleapis.com/google.cloud.dataproc.v1.CancelJobRequest"
16950 }
16951}
16952
16953/// A request to delete a job.
16954#[derive(Clone, Default, PartialEq)]
16955#[non_exhaustive]
16956pub struct DeleteJobRequest {
16957 /// Required. The ID of the Google Cloud Platform project that the job
16958 /// belongs to.
16959 pub project_id: std::string::String,
16960
16961 /// Required. The Dataproc region in which to handle the request.
16962 pub region: std::string::String,
16963
16964 /// Required. The job ID.
16965 pub job_id: std::string::String,
16966
16967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16968}
16969
16970impl DeleteJobRequest {
16971 /// Creates a new default instance.
16972 pub fn new() -> Self {
16973 std::default::Default::default()
16974 }
16975
16976 /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
16977 ///
16978 /// # Example
16979 /// ```ignore,no_run
16980 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16981 /// let x = DeleteJobRequest::new().set_project_id("example");
16982 /// ```
16983 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16984 self.project_id = v.into();
16985 self
16986 }
16987
16988 /// Sets the value of [region][crate::model::DeleteJobRequest::region].
16989 ///
16990 /// # Example
16991 /// ```ignore,no_run
16992 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16993 /// let x = DeleteJobRequest::new().set_region("example");
16994 /// ```
16995 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16996 self.region = v.into();
16997 self
16998 }
16999
17000 /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
17001 ///
17002 /// # Example
17003 /// ```ignore,no_run
17004 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
17005 /// let x = DeleteJobRequest::new().set_job_id("example");
17006 /// ```
17007 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17008 self.job_id = v.into();
17009 self
17010 }
17011}
17012
17013impl wkt::message::Message for DeleteJobRequest {
17014 fn typename() -> &'static str {
17015 "type.googleapis.com/google.cloud.dataproc.v1.DeleteJobRequest"
17016 }
17017}
17018
17019/// A request to create a node group.
17020#[derive(Clone, Default, PartialEq)]
17021#[non_exhaustive]
17022pub struct CreateNodeGroupRequest {
17023 /// Required. The parent resource where this node group will be created.
17024 /// Format: `projects/{project}/regions/{region}/clusters/{cluster}`
17025 pub parent: std::string::String,
17026
17027 /// Required. The node group to create.
17028 pub node_group: std::option::Option<crate::model::NodeGroup>,
17029
17030 /// Optional. An optional node group ID. Generated if not specified.
17031 ///
17032 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
17033 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
17034 /// or hyphen. Must consist of from 3 to 33 characters.
17035 pub node_group_id: std::string::String,
17036
17037 /// Optional. A unique ID used to identify the request. If the server receives
17038 /// two
17039 /// [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
17040 /// with the same ID, the second request is ignored and the
17041 /// first [google.longrunning.Operation][google.longrunning.Operation] created
17042 /// and stored in the backend is returned.
17043 ///
17044 /// Recommendation: Set this value to a
17045 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
17046 ///
17047 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
17048 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
17049 ///
17050 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
17051 pub request_id: std::string::String,
17052
17053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17054}
17055
17056impl CreateNodeGroupRequest {
17057 /// Creates a new default instance.
17058 pub fn new() -> Self {
17059 std::default::Default::default()
17060 }
17061
17062 /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
17063 ///
17064 /// # Example
17065 /// ```ignore,no_run
17066 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
17067 /// # let project_id = "project_id";
17068 /// # let region_id = "region_id";
17069 /// # let cluster_id = "cluster_id";
17070 /// let x = CreateNodeGroupRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}/clusters/{cluster_id}"));
17071 /// ```
17072 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17073 self.parent = v.into();
17074 self
17075 }
17076
17077 /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
17078 ///
17079 /// # Example
17080 /// ```ignore,no_run
17081 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
17082 /// use google_cloud_dataproc_v1::model::NodeGroup;
17083 /// let x = CreateNodeGroupRequest::new().set_node_group(NodeGroup::default()/* use setters */);
17084 /// ```
17085 pub fn set_node_group<T>(mut self, v: T) -> Self
17086 where
17087 T: std::convert::Into<crate::model::NodeGroup>,
17088 {
17089 self.node_group = std::option::Option::Some(v.into());
17090 self
17091 }
17092
17093 /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
17094 ///
17095 /// # Example
17096 /// ```ignore,no_run
17097 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
17098 /// use google_cloud_dataproc_v1::model::NodeGroup;
17099 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
17100 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(None::<NodeGroup>);
17101 /// ```
17102 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
17103 where
17104 T: std::convert::Into<crate::model::NodeGroup>,
17105 {
17106 self.node_group = v.map(|x| x.into());
17107 self
17108 }
17109
17110 /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
17111 ///
17112 /// # Example
17113 /// ```ignore,no_run
17114 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
17115 /// let x = CreateNodeGroupRequest::new().set_node_group_id("example");
17116 /// ```
17117 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17118 self.node_group_id = v.into();
17119 self
17120 }
17121
17122 /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
17123 ///
17124 /// # Example
17125 /// ```ignore,no_run
17126 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
17127 /// let x = CreateNodeGroupRequest::new().set_request_id("example");
17128 /// ```
17129 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17130 self.request_id = v.into();
17131 self
17132 }
17133}
17134
17135impl wkt::message::Message for CreateNodeGroupRequest {
17136 fn typename() -> &'static str {
17137 "type.googleapis.com/google.cloud.dataproc.v1.CreateNodeGroupRequest"
17138 }
17139}
17140
17141/// A request to resize a node group.
17142#[derive(Clone, Default, PartialEq)]
17143#[non_exhaustive]
17144pub struct ResizeNodeGroupRequest {
17145 /// Required. The name of the node group to resize.
17146 /// Format:
17147 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
17148 pub name: std::string::String,
17149
17150 /// Required. The number of running instances for the node group to maintain.
17151 /// The group adds or removes instances to maintain the number of instances
17152 /// specified by this parameter.
17153 pub size: i32,
17154
17155 /// Optional. A unique ID used to identify the request. If the server receives
17156 /// two
17157 /// [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
17158 /// with the same ID, the second request is ignored and the
17159 /// first [google.longrunning.Operation][google.longrunning.Operation] created
17160 /// and stored in the backend is returned.
17161 ///
17162 /// Recommendation: Set this value to a
17163 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
17164 ///
17165 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
17166 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
17167 ///
17168 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
17169 pub request_id: std::string::String,
17170
17171 /// Optional. Timeout for graceful YARN decommissioning. [Graceful
17172 /// decommissioning]
17173 /// (<https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning>)
17174 /// allows the removal of nodes from the Compute Engine node group
17175 /// without interrupting jobs in progress. This timeout specifies how long to
17176 /// wait for jobs in progress to finish before forcefully removing nodes (and
17177 /// potentially interrupting jobs). Default timeout is 0 (for forceful
17178 /// decommission), and the maximum allowed timeout is 1 day. (see JSON
17179 /// representation of
17180 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
17181 ///
17182 /// Only supported on Dataproc image versions 1.2 and higher.
17183 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
17184
17185 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17186}
17187
17188impl ResizeNodeGroupRequest {
17189 /// Creates a new default instance.
17190 pub fn new() -> Self {
17191 std::default::Default::default()
17192 }
17193
17194 /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
17195 ///
17196 /// # Example
17197 /// ```ignore,no_run
17198 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
17199 /// let x = ResizeNodeGroupRequest::new().set_name("example");
17200 /// ```
17201 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17202 self.name = v.into();
17203 self
17204 }
17205
17206 /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
17207 ///
17208 /// # Example
17209 /// ```ignore,no_run
17210 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
17211 /// let x = ResizeNodeGroupRequest::new().set_size(42);
17212 /// ```
17213 pub fn set_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17214 self.size = v.into();
17215 self
17216 }
17217
17218 /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
17219 ///
17220 /// # Example
17221 /// ```ignore,no_run
17222 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
17223 /// let x = ResizeNodeGroupRequest::new().set_request_id("example");
17224 /// ```
17225 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17226 self.request_id = v.into();
17227 self
17228 }
17229
17230 /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
17231 ///
17232 /// # Example
17233 /// ```ignore,no_run
17234 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
17235 /// use wkt::Duration;
17236 /// let x = ResizeNodeGroupRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
17237 /// ```
17238 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
17239 where
17240 T: std::convert::Into<wkt::Duration>,
17241 {
17242 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
17243 self
17244 }
17245
17246 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
17247 ///
17248 /// # Example
17249 /// ```ignore,no_run
17250 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
17251 /// use wkt::Duration;
17252 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
17253 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
17254 /// ```
17255 pub fn set_or_clear_graceful_decommission_timeout<T>(
17256 mut self,
17257 v: std::option::Option<T>,
17258 ) -> Self
17259 where
17260 T: std::convert::Into<wkt::Duration>,
17261 {
17262 self.graceful_decommission_timeout = v.map(|x| x.into());
17263 self
17264 }
17265}
17266
17267impl wkt::message::Message for ResizeNodeGroupRequest {
17268 fn typename() -> &'static str {
17269 "type.googleapis.com/google.cloud.dataproc.v1.ResizeNodeGroupRequest"
17270 }
17271}
17272
17273/// A request to get a node group .
17274#[derive(Clone, Default, PartialEq)]
17275#[non_exhaustive]
17276pub struct GetNodeGroupRequest {
17277 /// Required. The name of the node group to retrieve.
17278 /// Format:
17279 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
17280 pub name: std::string::String,
17281
17282 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17283}
17284
17285impl GetNodeGroupRequest {
17286 /// Creates a new default instance.
17287 pub fn new() -> Self {
17288 std::default::Default::default()
17289 }
17290
17291 /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
17292 ///
17293 /// # Example
17294 /// ```ignore,no_run
17295 /// # use google_cloud_dataproc_v1::model::GetNodeGroupRequest;
17296 /// # let project_id = "project_id";
17297 /// # let region_id = "region_id";
17298 /// # let cluster_id = "cluster_id";
17299 /// # let node_group_id = "node_group_id";
17300 /// let x = GetNodeGroupRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/clusters/{cluster_id}/nodeGroups/{node_group_id}"));
17301 /// ```
17302 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17303 self.name = v.into();
17304 self
17305 }
17306}
17307
17308impl wkt::message::Message for GetNodeGroupRequest {
17309 fn typename() -> &'static str {
17310 "type.googleapis.com/google.cloud.dataproc.v1.GetNodeGroupRequest"
17311 }
17312}
17313
17314/// Metadata describing the Batch operation.
17315#[derive(Clone, Default, PartialEq)]
17316#[non_exhaustive]
17317pub struct BatchOperationMetadata {
17318 /// Name of the batch for the operation.
17319 pub batch: std::string::String,
17320
17321 /// Batch UUID for the operation.
17322 pub batch_uuid: std::string::String,
17323
17324 /// The time when the operation was created.
17325 pub create_time: std::option::Option<wkt::Timestamp>,
17326
17327 /// The time when the operation finished.
17328 pub done_time: std::option::Option<wkt::Timestamp>,
17329
17330 /// The operation type.
17331 pub operation_type: crate::model::batch_operation_metadata::BatchOperationType,
17332
17333 /// Short description of the operation.
17334 pub description: std::string::String,
17335
17336 /// Labels associated with the operation.
17337 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17338
17339 /// Warnings encountered during operation execution.
17340 pub warnings: std::vec::Vec<std::string::String>,
17341
17342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17343}
17344
17345impl BatchOperationMetadata {
17346 /// Creates a new default instance.
17347 pub fn new() -> Self {
17348 std::default::Default::default()
17349 }
17350
17351 /// Sets the value of [batch][crate::model::BatchOperationMetadata::batch].
17352 ///
17353 /// # Example
17354 /// ```ignore,no_run
17355 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17356 /// let x = BatchOperationMetadata::new().set_batch("example");
17357 /// ```
17358 pub fn set_batch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17359 self.batch = v.into();
17360 self
17361 }
17362
17363 /// Sets the value of [batch_uuid][crate::model::BatchOperationMetadata::batch_uuid].
17364 ///
17365 /// # Example
17366 /// ```ignore,no_run
17367 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17368 /// let x = BatchOperationMetadata::new().set_batch_uuid("example");
17369 /// ```
17370 pub fn set_batch_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17371 self.batch_uuid = v.into();
17372 self
17373 }
17374
17375 /// Sets the value of [create_time][crate::model::BatchOperationMetadata::create_time].
17376 ///
17377 /// # Example
17378 /// ```ignore,no_run
17379 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17380 /// use wkt::Timestamp;
17381 /// let x = BatchOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
17382 /// ```
17383 pub fn set_create_time<T>(mut self, v: T) -> Self
17384 where
17385 T: std::convert::Into<wkt::Timestamp>,
17386 {
17387 self.create_time = std::option::Option::Some(v.into());
17388 self
17389 }
17390
17391 /// Sets or clears the value of [create_time][crate::model::BatchOperationMetadata::create_time].
17392 ///
17393 /// # Example
17394 /// ```ignore,no_run
17395 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17396 /// use wkt::Timestamp;
17397 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17398 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
17399 /// ```
17400 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17401 where
17402 T: std::convert::Into<wkt::Timestamp>,
17403 {
17404 self.create_time = v.map(|x| x.into());
17405 self
17406 }
17407
17408 /// Sets the value of [done_time][crate::model::BatchOperationMetadata::done_time].
17409 ///
17410 /// # Example
17411 /// ```ignore,no_run
17412 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17413 /// use wkt::Timestamp;
17414 /// let x = BatchOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
17415 /// ```
17416 pub fn set_done_time<T>(mut self, v: T) -> Self
17417 where
17418 T: std::convert::Into<wkt::Timestamp>,
17419 {
17420 self.done_time = std::option::Option::Some(v.into());
17421 self
17422 }
17423
17424 /// Sets or clears the value of [done_time][crate::model::BatchOperationMetadata::done_time].
17425 ///
17426 /// # Example
17427 /// ```ignore,no_run
17428 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17429 /// use wkt::Timestamp;
17430 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
17431 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
17432 /// ```
17433 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
17434 where
17435 T: std::convert::Into<wkt::Timestamp>,
17436 {
17437 self.done_time = v.map(|x| x.into());
17438 self
17439 }
17440
17441 /// Sets the value of [operation_type][crate::model::BatchOperationMetadata::operation_type].
17442 ///
17443 /// # Example
17444 /// ```ignore,no_run
17445 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17446 /// use google_cloud_dataproc_v1::model::batch_operation_metadata::BatchOperationType;
17447 /// let x0 = BatchOperationMetadata::new().set_operation_type(BatchOperationType::Batch);
17448 /// ```
17449 pub fn set_operation_type<
17450 T: std::convert::Into<crate::model::batch_operation_metadata::BatchOperationType>,
17451 >(
17452 mut self,
17453 v: T,
17454 ) -> Self {
17455 self.operation_type = v.into();
17456 self
17457 }
17458
17459 /// Sets the value of [description][crate::model::BatchOperationMetadata::description].
17460 ///
17461 /// # Example
17462 /// ```ignore,no_run
17463 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17464 /// let x = BatchOperationMetadata::new().set_description("example");
17465 /// ```
17466 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17467 self.description = v.into();
17468 self
17469 }
17470
17471 /// Sets the value of [labels][crate::model::BatchOperationMetadata::labels].
17472 ///
17473 /// # Example
17474 /// ```ignore,no_run
17475 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17476 /// let x = BatchOperationMetadata::new().set_labels([
17477 /// ("key0", "abc"),
17478 /// ("key1", "xyz"),
17479 /// ]);
17480 /// ```
17481 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17482 where
17483 T: std::iter::IntoIterator<Item = (K, V)>,
17484 K: std::convert::Into<std::string::String>,
17485 V: std::convert::Into<std::string::String>,
17486 {
17487 use std::iter::Iterator;
17488 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17489 self
17490 }
17491
17492 /// Sets the value of [warnings][crate::model::BatchOperationMetadata::warnings].
17493 ///
17494 /// # Example
17495 /// ```ignore,no_run
17496 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
17497 /// let x = BatchOperationMetadata::new().set_warnings(["a", "b", "c"]);
17498 /// ```
17499 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17500 where
17501 T: std::iter::IntoIterator<Item = V>,
17502 V: std::convert::Into<std::string::String>,
17503 {
17504 use std::iter::Iterator;
17505 self.warnings = v.into_iter().map(|i| i.into()).collect();
17506 self
17507 }
17508}
17509
17510impl wkt::message::Message for BatchOperationMetadata {
17511 fn typename() -> &'static str {
17512 "type.googleapis.com/google.cloud.dataproc.v1.BatchOperationMetadata"
17513 }
17514}
17515
17516/// Defines additional types related to [BatchOperationMetadata].
17517pub mod batch_operation_metadata {
17518 #[allow(unused_imports)]
17519 use super::*;
17520
17521 /// Operation type for Batch resources
17522 ///
17523 /// # Working with unknown values
17524 ///
17525 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17526 /// additional enum variants at any time. Adding new variants is not considered
17527 /// a breaking change. Applications should write their code in anticipation of:
17528 ///
17529 /// - New values appearing in future releases of the client library, **and**
17530 /// - New values received dynamically, without application changes.
17531 ///
17532 /// Please consult the [Working with enums] section in the user guide for some
17533 /// guidelines.
17534 ///
17535 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17536 #[derive(Clone, Debug, PartialEq)]
17537 #[non_exhaustive]
17538 pub enum BatchOperationType {
17539 /// Batch operation type is unknown.
17540 Unspecified,
17541 /// Batch operation type.
17542 Batch,
17543 /// If set, the enum was initialized with an unknown value.
17544 ///
17545 /// Applications can examine the value using [BatchOperationType::value] or
17546 /// [BatchOperationType::name].
17547 UnknownValue(batch_operation_type::UnknownValue),
17548 }
17549
17550 #[doc(hidden)]
17551 pub mod batch_operation_type {
17552 #[allow(unused_imports)]
17553 use super::*;
17554 #[derive(Clone, Debug, PartialEq)]
17555 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17556 }
17557
17558 impl BatchOperationType {
17559 /// Gets the enum value.
17560 ///
17561 /// Returns `None` if the enum contains an unknown value deserialized from
17562 /// the string representation of enums.
17563 pub fn value(&self) -> std::option::Option<i32> {
17564 match self {
17565 Self::Unspecified => std::option::Option::Some(0),
17566 Self::Batch => std::option::Option::Some(1),
17567 Self::UnknownValue(u) => u.0.value(),
17568 }
17569 }
17570
17571 /// Gets the enum value as a string.
17572 ///
17573 /// Returns `None` if the enum contains an unknown value deserialized from
17574 /// the integer representation of enums.
17575 pub fn name(&self) -> std::option::Option<&str> {
17576 match self {
17577 Self::Unspecified => std::option::Option::Some("BATCH_OPERATION_TYPE_UNSPECIFIED"),
17578 Self::Batch => std::option::Option::Some("BATCH"),
17579 Self::UnknownValue(u) => u.0.name(),
17580 }
17581 }
17582 }
17583
17584 impl std::default::Default for BatchOperationType {
17585 fn default() -> Self {
17586 use std::convert::From;
17587 Self::from(0)
17588 }
17589 }
17590
17591 impl std::fmt::Display for BatchOperationType {
17592 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17593 wkt::internal::display_enum(f, self.name(), self.value())
17594 }
17595 }
17596
17597 impl std::convert::From<i32> for BatchOperationType {
17598 fn from(value: i32) -> Self {
17599 match value {
17600 0 => Self::Unspecified,
17601 1 => Self::Batch,
17602 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
17603 wkt::internal::UnknownEnumValue::Integer(value),
17604 )),
17605 }
17606 }
17607 }
17608
17609 impl std::convert::From<&str> for BatchOperationType {
17610 fn from(value: &str) -> Self {
17611 use std::string::ToString;
17612 match value {
17613 "BATCH_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17614 "BATCH" => Self::Batch,
17615 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
17616 wkt::internal::UnknownEnumValue::String(value.to_string()),
17617 )),
17618 }
17619 }
17620 }
17621
17622 impl serde::ser::Serialize for BatchOperationType {
17623 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17624 where
17625 S: serde::Serializer,
17626 {
17627 match self {
17628 Self::Unspecified => serializer.serialize_i32(0),
17629 Self::Batch => serializer.serialize_i32(1),
17630 Self::UnknownValue(u) => u.0.serialize(serializer),
17631 }
17632 }
17633 }
17634
17635 impl<'de> serde::de::Deserialize<'de> for BatchOperationType {
17636 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17637 where
17638 D: serde::Deserializer<'de>,
17639 {
17640 deserializer.deserialize_any(wkt::internal::EnumVisitor::<BatchOperationType>::new(
17641 ".google.cloud.dataproc.v1.BatchOperationMetadata.BatchOperationType",
17642 ))
17643 }
17644 }
17645}
17646
17647/// Metadata describing the Session operation.
17648#[derive(Clone, Default, PartialEq)]
17649#[non_exhaustive]
17650pub struct SessionOperationMetadata {
17651 /// Name of the session for the operation.
17652 pub session: std::string::String,
17653
17654 /// Session UUID for the operation.
17655 pub session_uuid: std::string::String,
17656
17657 /// The time when the operation was created.
17658 pub create_time: std::option::Option<wkt::Timestamp>,
17659
17660 /// The time when the operation was finished.
17661 pub done_time: std::option::Option<wkt::Timestamp>,
17662
17663 /// The operation type.
17664 pub operation_type: crate::model::session_operation_metadata::SessionOperationType,
17665
17666 /// Short description of the operation.
17667 pub description: std::string::String,
17668
17669 /// Labels associated with the operation.
17670 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17671
17672 /// Warnings encountered during operation execution.
17673 pub warnings: std::vec::Vec<std::string::String>,
17674
17675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17676}
17677
17678impl SessionOperationMetadata {
17679 /// Creates a new default instance.
17680 pub fn new() -> Self {
17681 std::default::Default::default()
17682 }
17683
17684 /// Sets the value of [session][crate::model::SessionOperationMetadata::session].
17685 ///
17686 /// # Example
17687 /// ```ignore,no_run
17688 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17689 /// let x = SessionOperationMetadata::new().set_session("example");
17690 /// ```
17691 pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17692 self.session = v.into();
17693 self
17694 }
17695
17696 /// Sets the value of [session_uuid][crate::model::SessionOperationMetadata::session_uuid].
17697 ///
17698 /// # Example
17699 /// ```ignore,no_run
17700 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17701 /// let x = SessionOperationMetadata::new().set_session_uuid("example");
17702 /// ```
17703 pub fn set_session_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17704 self.session_uuid = v.into();
17705 self
17706 }
17707
17708 /// Sets the value of [create_time][crate::model::SessionOperationMetadata::create_time].
17709 ///
17710 /// # Example
17711 /// ```ignore,no_run
17712 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17713 /// use wkt::Timestamp;
17714 /// let x = SessionOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
17715 /// ```
17716 pub fn set_create_time<T>(mut self, v: T) -> Self
17717 where
17718 T: std::convert::Into<wkt::Timestamp>,
17719 {
17720 self.create_time = std::option::Option::Some(v.into());
17721 self
17722 }
17723
17724 /// Sets or clears the value of [create_time][crate::model::SessionOperationMetadata::create_time].
17725 ///
17726 /// # Example
17727 /// ```ignore,no_run
17728 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17729 /// use wkt::Timestamp;
17730 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17731 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
17732 /// ```
17733 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17734 where
17735 T: std::convert::Into<wkt::Timestamp>,
17736 {
17737 self.create_time = v.map(|x| x.into());
17738 self
17739 }
17740
17741 /// Sets the value of [done_time][crate::model::SessionOperationMetadata::done_time].
17742 ///
17743 /// # Example
17744 /// ```ignore,no_run
17745 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17746 /// use wkt::Timestamp;
17747 /// let x = SessionOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
17748 /// ```
17749 pub fn set_done_time<T>(mut self, v: T) -> Self
17750 where
17751 T: std::convert::Into<wkt::Timestamp>,
17752 {
17753 self.done_time = std::option::Option::Some(v.into());
17754 self
17755 }
17756
17757 /// Sets or clears the value of [done_time][crate::model::SessionOperationMetadata::done_time].
17758 ///
17759 /// # Example
17760 /// ```ignore,no_run
17761 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17762 /// use wkt::Timestamp;
17763 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
17764 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
17765 /// ```
17766 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
17767 where
17768 T: std::convert::Into<wkt::Timestamp>,
17769 {
17770 self.done_time = v.map(|x| x.into());
17771 self
17772 }
17773
17774 /// Sets the value of [operation_type][crate::model::SessionOperationMetadata::operation_type].
17775 ///
17776 /// # Example
17777 /// ```ignore,no_run
17778 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17779 /// use google_cloud_dataproc_v1::model::session_operation_metadata::SessionOperationType;
17780 /// let x0 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Create);
17781 /// let x1 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Terminate);
17782 /// let x2 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Delete);
17783 /// ```
17784 pub fn set_operation_type<
17785 T: std::convert::Into<crate::model::session_operation_metadata::SessionOperationType>,
17786 >(
17787 mut self,
17788 v: T,
17789 ) -> Self {
17790 self.operation_type = v.into();
17791 self
17792 }
17793
17794 /// Sets the value of [description][crate::model::SessionOperationMetadata::description].
17795 ///
17796 /// # Example
17797 /// ```ignore,no_run
17798 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17799 /// let x = SessionOperationMetadata::new().set_description("example");
17800 /// ```
17801 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17802 self.description = v.into();
17803 self
17804 }
17805
17806 /// Sets the value of [labels][crate::model::SessionOperationMetadata::labels].
17807 ///
17808 /// # Example
17809 /// ```ignore,no_run
17810 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17811 /// let x = SessionOperationMetadata::new().set_labels([
17812 /// ("key0", "abc"),
17813 /// ("key1", "xyz"),
17814 /// ]);
17815 /// ```
17816 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17817 where
17818 T: std::iter::IntoIterator<Item = (K, V)>,
17819 K: std::convert::Into<std::string::String>,
17820 V: std::convert::Into<std::string::String>,
17821 {
17822 use std::iter::Iterator;
17823 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17824 self
17825 }
17826
17827 /// Sets the value of [warnings][crate::model::SessionOperationMetadata::warnings].
17828 ///
17829 /// # Example
17830 /// ```ignore,no_run
17831 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17832 /// let x = SessionOperationMetadata::new().set_warnings(["a", "b", "c"]);
17833 /// ```
17834 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17835 where
17836 T: std::iter::IntoIterator<Item = V>,
17837 V: std::convert::Into<std::string::String>,
17838 {
17839 use std::iter::Iterator;
17840 self.warnings = v.into_iter().map(|i| i.into()).collect();
17841 self
17842 }
17843}
17844
17845impl wkt::message::Message for SessionOperationMetadata {
17846 fn typename() -> &'static str {
17847 "type.googleapis.com/google.cloud.dataproc.v1.SessionOperationMetadata"
17848 }
17849}
17850
17851/// Defines additional types related to [SessionOperationMetadata].
17852pub mod session_operation_metadata {
17853 #[allow(unused_imports)]
17854 use super::*;
17855
17856 /// Operation type for Session resources
17857 ///
17858 /// # Working with unknown values
17859 ///
17860 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17861 /// additional enum variants at any time. Adding new variants is not considered
17862 /// a breaking change. Applications should write their code in anticipation of:
17863 ///
17864 /// - New values appearing in future releases of the client library, **and**
17865 /// - New values received dynamically, without application changes.
17866 ///
17867 /// Please consult the [Working with enums] section in the user guide for some
17868 /// guidelines.
17869 ///
17870 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17871 #[derive(Clone, Debug, PartialEq)]
17872 #[non_exhaustive]
17873 pub enum SessionOperationType {
17874 /// Session operation type is unknown.
17875 Unspecified,
17876 /// Create Session operation type.
17877 Create,
17878 /// Terminate Session operation type.
17879 Terminate,
17880 /// Delete Session operation type.
17881 Delete,
17882 /// If set, the enum was initialized with an unknown value.
17883 ///
17884 /// Applications can examine the value using [SessionOperationType::value] or
17885 /// [SessionOperationType::name].
17886 UnknownValue(session_operation_type::UnknownValue),
17887 }
17888
17889 #[doc(hidden)]
17890 pub mod session_operation_type {
17891 #[allow(unused_imports)]
17892 use super::*;
17893 #[derive(Clone, Debug, PartialEq)]
17894 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17895 }
17896
17897 impl SessionOperationType {
17898 /// Gets the enum value.
17899 ///
17900 /// Returns `None` if the enum contains an unknown value deserialized from
17901 /// the string representation of enums.
17902 pub fn value(&self) -> std::option::Option<i32> {
17903 match self {
17904 Self::Unspecified => std::option::Option::Some(0),
17905 Self::Create => std::option::Option::Some(1),
17906 Self::Terminate => std::option::Option::Some(2),
17907 Self::Delete => std::option::Option::Some(3),
17908 Self::UnknownValue(u) => u.0.value(),
17909 }
17910 }
17911
17912 /// Gets the enum value as a string.
17913 ///
17914 /// Returns `None` if the enum contains an unknown value deserialized from
17915 /// the integer representation of enums.
17916 pub fn name(&self) -> std::option::Option<&str> {
17917 match self {
17918 Self::Unspecified => {
17919 std::option::Option::Some("SESSION_OPERATION_TYPE_UNSPECIFIED")
17920 }
17921 Self::Create => std::option::Option::Some("CREATE"),
17922 Self::Terminate => std::option::Option::Some("TERMINATE"),
17923 Self::Delete => std::option::Option::Some("DELETE"),
17924 Self::UnknownValue(u) => u.0.name(),
17925 }
17926 }
17927 }
17928
17929 impl std::default::Default for SessionOperationType {
17930 fn default() -> Self {
17931 use std::convert::From;
17932 Self::from(0)
17933 }
17934 }
17935
17936 impl std::fmt::Display for SessionOperationType {
17937 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17938 wkt::internal::display_enum(f, self.name(), self.value())
17939 }
17940 }
17941
17942 impl std::convert::From<i32> for SessionOperationType {
17943 fn from(value: i32) -> Self {
17944 match value {
17945 0 => Self::Unspecified,
17946 1 => Self::Create,
17947 2 => Self::Terminate,
17948 3 => Self::Delete,
17949 _ => Self::UnknownValue(session_operation_type::UnknownValue(
17950 wkt::internal::UnknownEnumValue::Integer(value),
17951 )),
17952 }
17953 }
17954 }
17955
17956 impl std::convert::From<&str> for SessionOperationType {
17957 fn from(value: &str) -> Self {
17958 use std::string::ToString;
17959 match value {
17960 "SESSION_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17961 "CREATE" => Self::Create,
17962 "TERMINATE" => Self::Terminate,
17963 "DELETE" => Self::Delete,
17964 _ => Self::UnknownValue(session_operation_type::UnknownValue(
17965 wkt::internal::UnknownEnumValue::String(value.to_string()),
17966 )),
17967 }
17968 }
17969 }
17970
17971 impl serde::ser::Serialize for SessionOperationType {
17972 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17973 where
17974 S: serde::Serializer,
17975 {
17976 match self {
17977 Self::Unspecified => serializer.serialize_i32(0),
17978 Self::Create => serializer.serialize_i32(1),
17979 Self::Terminate => serializer.serialize_i32(2),
17980 Self::Delete => serializer.serialize_i32(3),
17981 Self::UnknownValue(u) => u.0.serialize(serializer),
17982 }
17983 }
17984 }
17985
17986 impl<'de> serde::de::Deserialize<'de> for SessionOperationType {
17987 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17988 where
17989 D: serde::Deserializer<'de>,
17990 {
17991 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionOperationType>::new(
17992 ".google.cloud.dataproc.v1.SessionOperationMetadata.SessionOperationType",
17993 ))
17994 }
17995 }
17996}
17997
17998/// The status of the operation.
17999#[derive(Clone, Default, PartialEq)]
18000#[non_exhaustive]
18001pub struct ClusterOperationStatus {
18002 /// Output only. A message containing the operation state.
18003 pub state: crate::model::cluster_operation_status::State,
18004
18005 /// Output only. A message containing the detailed operation state.
18006 pub inner_state: std::string::String,
18007
18008 /// Output only. A message containing any operation metadata details.
18009 pub details: std::string::String,
18010
18011 /// Output only. The time this state was entered.
18012 pub state_start_time: std::option::Option<wkt::Timestamp>,
18013
18014 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18015}
18016
18017impl ClusterOperationStatus {
18018 /// Creates a new default instance.
18019 pub fn new() -> Self {
18020 std::default::Default::default()
18021 }
18022
18023 /// Sets the value of [state][crate::model::ClusterOperationStatus::state].
18024 ///
18025 /// # Example
18026 /// ```ignore,no_run
18027 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18028 /// use google_cloud_dataproc_v1::model::cluster_operation_status::State;
18029 /// let x0 = ClusterOperationStatus::new().set_state(State::Pending);
18030 /// let x1 = ClusterOperationStatus::new().set_state(State::Running);
18031 /// let x2 = ClusterOperationStatus::new().set_state(State::Done);
18032 /// ```
18033 pub fn set_state<T: std::convert::Into<crate::model::cluster_operation_status::State>>(
18034 mut self,
18035 v: T,
18036 ) -> Self {
18037 self.state = v.into();
18038 self
18039 }
18040
18041 /// Sets the value of [inner_state][crate::model::ClusterOperationStatus::inner_state].
18042 ///
18043 /// # Example
18044 /// ```ignore,no_run
18045 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18046 /// let x = ClusterOperationStatus::new().set_inner_state("example");
18047 /// ```
18048 pub fn set_inner_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18049 self.inner_state = v.into();
18050 self
18051 }
18052
18053 /// Sets the value of [details][crate::model::ClusterOperationStatus::details].
18054 ///
18055 /// # Example
18056 /// ```ignore,no_run
18057 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18058 /// let x = ClusterOperationStatus::new().set_details("example");
18059 /// ```
18060 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18061 self.details = v.into();
18062 self
18063 }
18064
18065 /// Sets the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
18066 ///
18067 /// # Example
18068 /// ```ignore,no_run
18069 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18070 /// use wkt::Timestamp;
18071 /// let x = ClusterOperationStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
18072 /// ```
18073 pub fn set_state_start_time<T>(mut self, v: T) -> Self
18074 where
18075 T: std::convert::Into<wkt::Timestamp>,
18076 {
18077 self.state_start_time = std::option::Option::Some(v.into());
18078 self
18079 }
18080
18081 /// Sets or clears the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
18082 ///
18083 /// # Example
18084 /// ```ignore,no_run
18085 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18086 /// use wkt::Timestamp;
18087 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
18088 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
18089 /// ```
18090 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
18091 where
18092 T: std::convert::Into<wkt::Timestamp>,
18093 {
18094 self.state_start_time = v.map(|x| x.into());
18095 self
18096 }
18097}
18098
18099impl wkt::message::Message for ClusterOperationStatus {
18100 fn typename() -> &'static str {
18101 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationStatus"
18102 }
18103}
18104
18105/// Defines additional types related to [ClusterOperationStatus].
18106pub mod cluster_operation_status {
18107 #[allow(unused_imports)]
18108 use super::*;
18109
18110 /// The operation state.
18111 ///
18112 /// # Working with unknown values
18113 ///
18114 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18115 /// additional enum variants at any time. Adding new variants is not considered
18116 /// a breaking change. Applications should write their code in anticipation of:
18117 ///
18118 /// - New values appearing in future releases of the client library, **and**
18119 /// - New values received dynamically, without application changes.
18120 ///
18121 /// Please consult the [Working with enums] section in the user guide for some
18122 /// guidelines.
18123 ///
18124 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18125 #[derive(Clone, Debug, PartialEq)]
18126 #[non_exhaustive]
18127 pub enum State {
18128 /// Unused.
18129 Unknown,
18130 /// The operation has been created.
18131 Pending,
18132 /// The operation is running.
18133 Running,
18134 /// The operation is done; either cancelled or completed.
18135 Done,
18136 /// If set, the enum was initialized with an unknown value.
18137 ///
18138 /// Applications can examine the value using [State::value] or
18139 /// [State::name].
18140 UnknownValue(state::UnknownValue),
18141 }
18142
18143 #[doc(hidden)]
18144 pub mod state {
18145 #[allow(unused_imports)]
18146 use super::*;
18147 #[derive(Clone, Debug, PartialEq)]
18148 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18149 }
18150
18151 impl State {
18152 /// Gets the enum value.
18153 ///
18154 /// Returns `None` if the enum contains an unknown value deserialized from
18155 /// the string representation of enums.
18156 pub fn value(&self) -> std::option::Option<i32> {
18157 match self {
18158 Self::Unknown => std::option::Option::Some(0),
18159 Self::Pending => std::option::Option::Some(1),
18160 Self::Running => std::option::Option::Some(2),
18161 Self::Done => std::option::Option::Some(3),
18162 Self::UnknownValue(u) => u.0.value(),
18163 }
18164 }
18165
18166 /// Gets the enum value as a string.
18167 ///
18168 /// Returns `None` if the enum contains an unknown value deserialized from
18169 /// the integer representation of enums.
18170 pub fn name(&self) -> std::option::Option<&str> {
18171 match self {
18172 Self::Unknown => std::option::Option::Some("UNKNOWN"),
18173 Self::Pending => std::option::Option::Some("PENDING"),
18174 Self::Running => std::option::Option::Some("RUNNING"),
18175 Self::Done => std::option::Option::Some("DONE"),
18176 Self::UnknownValue(u) => u.0.name(),
18177 }
18178 }
18179 }
18180
18181 impl std::default::Default for State {
18182 fn default() -> Self {
18183 use std::convert::From;
18184 Self::from(0)
18185 }
18186 }
18187
18188 impl std::fmt::Display for State {
18189 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18190 wkt::internal::display_enum(f, self.name(), self.value())
18191 }
18192 }
18193
18194 impl std::convert::From<i32> for State {
18195 fn from(value: i32) -> Self {
18196 match value {
18197 0 => Self::Unknown,
18198 1 => Self::Pending,
18199 2 => Self::Running,
18200 3 => Self::Done,
18201 _ => Self::UnknownValue(state::UnknownValue(
18202 wkt::internal::UnknownEnumValue::Integer(value),
18203 )),
18204 }
18205 }
18206 }
18207
18208 impl std::convert::From<&str> for State {
18209 fn from(value: &str) -> Self {
18210 use std::string::ToString;
18211 match value {
18212 "UNKNOWN" => Self::Unknown,
18213 "PENDING" => Self::Pending,
18214 "RUNNING" => Self::Running,
18215 "DONE" => Self::Done,
18216 _ => Self::UnknownValue(state::UnknownValue(
18217 wkt::internal::UnknownEnumValue::String(value.to_string()),
18218 )),
18219 }
18220 }
18221 }
18222
18223 impl serde::ser::Serialize for State {
18224 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18225 where
18226 S: serde::Serializer,
18227 {
18228 match self {
18229 Self::Unknown => serializer.serialize_i32(0),
18230 Self::Pending => serializer.serialize_i32(1),
18231 Self::Running => serializer.serialize_i32(2),
18232 Self::Done => serializer.serialize_i32(3),
18233 Self::UnknownValue(u) => u.0.serialize(serializer),
18234 }
18235 }
18236 }
18237
18238 impl<'de> serde::de::Deserialize<'de> for State {
18239 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18240 where
18241 D: serde::Deserializer<'de>,
18242 {
18243 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
18244 ".google.cloud.dataproc.v1.ClusterOperationStatus.State",
18245 ))
18246 }
18247 }
18248}
18249
18250/// Metadata describing the operation.
18251#[derive(Clone, Default, PartialEq)]
18252#[non_exhaustive]
18253pub struct ClusterOperationMetadata {
18254 /// Output only. Name of the cluster for the operation.
18255 pub cluster_name: std::string::String,
18256
18257 /// Output only. Cluster UUID for the operation.
18258 pub cluster_uuid: std::string::String,
18259
18260 /// Output only. Current operation status.
18261 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
18262
18263 /// Output only. The previous operation status.
18264 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
18265
18266 /// Output only. The operation type.
18267 pub operation_type: std::string::String,
18268
18269 /// Output only. Short description of operation.
18270 pub description: std::string::String,
18271
18272 /// Output only. Labels associated with the operation
18273 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18274
18275 /// Output only. Errors encountered during operation execution.
18276 pub warnings: std::vec::Vec<std::string::String>,
18277
18278 /// Output only. Child operation ids
18279 pub child_operation_ids: std::vec::Vec<std::string::String>,
18280
18281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18282}
18283
18284impl ClusterOperationMetadata {
18285 /// Creates a new default instance.
18286 pub fn new() -> Self {
18287 std::default::Default::default()
18288 }
18289
18290 /// Sets the value of [cluster_name][crate::model::ClusterOperationMetadata::cluster_name].
18291 ///
18292 /// # Example
18293 /// ```ignore,no_run
18294 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18295 /// let x = ClusterOperationMetadata::new().set_cluster_name("example");
18296 /// ```
18297 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18298 self.cluster_name = v.into();
18299 self
18300 }
18301
18302 /// Sets the value of [cluster_uuid][crate::model::ClusterOperationMetadata::cluster_uuid].
18303 ///
18304 /// # Example
18305 /// ```ignore,no_run
18306 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18307 /// let x = ClusterOperationMetadata::new().set_cluster_uuid("example");
18308 /// ```
18309 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18310 self.cluster_uuid = v.into();
18311 self
18312 }
18313
18314 /// Sets the value of [status][crate::model::ClusterOperationMetadata::status].
18315 ///
18316 /// # Example
18317 /// ```ignore,no_run
18318 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18319 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18320 /// let x = ClusterOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
18321 /// ```
18322 pub fn set_status<T>(mut self, v: T) -> Self
18323 where
18324 T: std::convert::Into<crate::model::ClusterOperationStatus>,
18325 {
18326 self.status = std::option::Option::Some(v.into());
18327 self
18328 }
18329
18330 /// Sets or clears the value of [status][crate::model::ClusterOperationMetadata::status].
18331 ///
18332 /// # Example
18333 /// ```ignore,no_run
18334 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18335 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18336 /// let x = ClusterOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
18337 /// let x = ClusterOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
18338 /// ```
18339 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
18340 where
18341 T: std::convert::Into<crate::model::ClusterOperationStatus>,
18342 {
18343 self.status = v.map(|x| x.into());
18344 self
18345 }
18346
18347 /// Sets the value of [status_history][crate::model::ClusterOperationMetadata::status_history].
18348 ///
18349 /// # Example
18350 /// ```ignore,no_run
18351 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18352 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18353 /// let x = ClusterOperationMetadata::new()
18354 /// .set_status_history([
18355 /// ClusterOperationStatus::default()/* use setters */,
18356 /// ClusterOperationStatus::default()/* use (different) setters */,
18357 /// ]);
18358 /// ```
18359 pub fn set_status_history<T, V>(mut self, v: T) -> Self
18360 where
18361 T: std::iter::IntoIterator<Item = V>,
18362 V: std::convert::Into<crate::model::ClusterOperationStatus>,
18363 {
18364 use std::iter::Iterator;
18365 self.status_history = v.into_iter().map(|i| i.into()).collect();
18366 self
18367 }
18368
18369 /// Sets the value of [operation_type][crate::model::ClusterOperationMetadata::operation_type].
18370 ///
18371 /// # Example
18372 /// ```ignore,no_run
18373 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18374 /// let x = ClusterOperationMetadata::new().set_operation_type("example");
18375 /// ```
18376 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18377 self.operation_type = v.into();
18378 self
18379 }
18380
18381 /// Sets the value of [description][crate::model::ClusterOperationMetadata::description].
18382 ///
18383 /// # Example
18384 /// ```ignore,no_run
18385 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18386 /// let x = ClusterOperationMetadata::new().set_description("example");
18387 /// ```
18388 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18389 self.description = v.into();
18390 self
18391 }
18392
18393 /// Sets the value of [labels][crate::model::ClusterOperationMetadata::labels].
18394 ///
18395 /// # Example
18396 /// ```ignore,no_run
18397 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18398 /// let x = ClusterOperationMetadata::new().set_labels([
18399 /// ("key0", "abc"),
18400 /// ("key1", "xyz"),
18401 /// ]);
18402 /// ```
18403 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18404 where
18405 T: std::iter::IntoIterator<Item = (K, V)>,
18406 K: std::convert::Into<std::string::String>,
18407 V: std::convert::Into<std::string::String>,
18408 {
18409 use std::iter::Iterator;
18410 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18411 self
18412 }
18413
18414 /// Sets the value of [warnings][crate::model::ClusterOperationMetadata::warnings].
18415 ///
18416 /// # Example
18417 /// ```ignore,no_run
18418 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18419 /// let x = ClusterOperationMetadata::new().set_warnings(["a", "b", "c"]);
18420 /// ```
18421 pub fn set_warnings<T, V>(mut self, v: T) -> Self
18422 where
18423 T: std::iter::IntoIterator<Item = V>,
18424 V: std::convert::Into<std::string::String>,
18425 {
18426 use std::iter::Iterator;
18427 self.warnings = v.into_iter().map(|i| i.into()).collect();
18428 self
18429 }
18430
18431 /// Sets the value of [child_operation_ids][crate::model::ClusterOperationMetadata::child_operation_ids].
18432 ///
18433 /// # Example
18434 /// ```ignore,no_run
18435 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
18436 /// let x = ClusterOperationMetadata::new().set_child_operation_ids(["a", "b", "c"]);
18437 /// ```
18438 pub fn set_child_operation_ids<T, V>(mut self, v: T) -> Self
18439 where
18440 T: std::iter::IntoIterator<Item = V>,
18441 V: std::convert::Into<std::string::String>,
18442 {
18443 use std::iter::Iterator;
18444 self.child_operation_ids = v.into_iter().map(|i| i.into()).collect();
18445 self
18446 }
18447}
18448
18449impl wkt::message::Message for ClusterOperationMetadata {
18450 fn typename() -> &'static str {
18451 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationMetadata"
18452 }
18453}
18454
18455/// Metadata describing the node group operation.
18456#[derive(Clone, Default, PartialEq)]
18457#[non_exhaustive]
18458pub struct NodeGroupOperationMetadata {
18459 /// Output only. Node group ID for the operation.
18460 pub node_group_id: std::string::String,
18461
18462 /// Output only. Cluster UUID associated with the node group operation.
18463 pub cluster_uuid: std::string::String,
18464
18465 /// Output only. Current operation status.
18466 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
18467
18468 /// Output only. The previous operation status.
18469 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
18470
18471 /// The operation type.
18472 pub operation_type: crate::model::node_group_operation_metadata::NodeGroupOperationType,
18473
18474 /// Output only. Short description of operation.
18475 pub description: std::string::String,
18476
18477 /// Output only. Labels associated with the operation.
18478 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18479
18480 /// Output only. Errors encountered during operation execution.
18481 pub warnings: std::vec::Vec<std::string::String>,
18482
18483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18484}
18485
18486impl NodeGroupOperationMetadata {
18487 /// Creates a new default instance.
18488 pub fn new() -> Self {
18489 std::default::Default::default()
18490 }
18491
18492 /// Sets the value of [node_group_id][crate::model::NodeGroupOperationMetadata::node_group_id].
18493 ///
18494 /// # Example
18495 /// ```ignore,no_run
18496 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18497 /// let x = NodeGroupOperationMetadata::new().set_node_group_id("example");
18498 /// ```
18499 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18500 self.node_group_id = v.into();
18501 self
18502 }
18503
18504 /// Sets the value of [cluster_uuid][crate::model::NodeGroupOperationMetadata::cluster_uuid].
18505 ///
18506 /// # Example
18507 /// ```ignore,no_run
18508 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18509 /// let x = NodeGroupOperationMetadata::new().set_cluster_uuid("example");
18510 /// ```
18511 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18512 self.cluster_uuid = v.into();
18513 self
18514 }
18515
18516 /// Sets the value of [status][crate::model::NodeGroupOperationMetadata::status].
18517 ///
18518 /// # Example
18519 /// ```ignore,no_run
18520 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18521 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18522 /// let x = NodeGroupOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
18523 /// ```
18524 pub fn set_status<T>(mut self, v: T) -> Self
18525 where
18526 T: std::convert::Into<crate::model::ClusterOperationStatus>,
18527 {
18528 self.status = std::option::Option::Some(v.into());
18529 self
18530 }
18531
18532 /// Sets or clears the value of [status][crate::model::NodeGroupOperationMetadata::status].
18533 ///
18534 /// # Example
18535 /// ```ignore,no_run
18536 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18537 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18538 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
18539 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
18540 /// ```
18541 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
18542 where
18543 T: std::convert::Into<crate::model::ClusterOperationStatus>,
18544 {
18545 self.status = v.map(|x| x.into());
18546 self
18547 }
18548
18549 /// Sets the value of [status_history][crate::model::NodeGroupOperationMetadata::status_history].
18550 ///
18551 /// # Example
18552 /// ```ignore,no_run
18553 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18554 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
18555 /// let x = NodeGroupOperationMetadata::new()
18556 /// .set_status_history([
18557 /// ClusterOperationStatus::default()/* use setters */,
18558 /// ClusterOperationStatus::default()/* use (different) setters */,
18559 /// ]);
18560 /// ```
18561 pub fn set_status_history<T, V>(mut self, v: T) -> Self
18562 where
18563 T: std::iter::IntoIterator<Item = V>,
18564 V: std::convert::Into<crate::model::ClusterOperationStatus>,
18565 {
18566 use std::iter::Iterator;
18567 self.status_history = v.into_iter().map(|i| i.into()).collect();
18568 self
18569 }
18570
18571 /// Sets the value of [operation_type][crate::model::NodeGroupOperationMetadata::operation_type].
18572 ///
18573 /// # Example
18574 /// ```ignore,no_run
18575 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18576 /// use google_cloud_dataproc_v1::model::node_group_operation_metadata::NodeGroupOperationType;
18577 /// let x0 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Create);
18578 /// let x1 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Update);
18579 /// let x2 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Delete);
18580 /// ```
18581 pub fn set_operation_type<
18582 T: std::convert::Into<crate::model::node_group_operation_metadata::NodeGroupOperationType>,
18583 >(
18584 mut self,
18585 v: T,
18586 ) -> Self {
18587 self.operation_type = v.into();
18588 self
18589 }
18590
18591 /// Sets the value of [description][crate::model::NodeGroupOperationMetadata::description].
18592 ///
18593 /// # Example
18594 /// ```ignore,no_run
18595 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18596 /// let x = NodeGroupOperationMetadata::new().set_description("example");
18597 /// ```
18598 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18599 self.description = v.into();
18600 self
18601 }
18602
18603 /// Sets the value of [labels][crate::model::NodeGroupOperationMetadata::labels].
18604 ///
18605 /// # Example
18606 /// ```ignore,no_run
18607 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18608 /// let x = NodeGroupOperationMetadata::new().set_labels([
18609 /// ("key0", "abc"),
18610 /// ("key1", "xyz"),
18611 /// ]);
18612 /// ```
18613 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18614 where
18615 T: std::iter::IntoIterator<Item = (K, V)>,
18616 K: std::convert::Into<std::string::String>,
18617 V: std::convert::Into<std::string::String>,
18618 {
18619 use std::iter::Iterator;
18620 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18621 self
18622 }
18623
18624 /// Sets the value of [warnings][crate::model::NodeGroupOperationMetadata::warnings].
18625 ///
18626 /// # Example
18627 /// ```ignore,no_run
18628 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18629 /// let x = NodeGroupOperationMetadata::new().set_warnings(["a", "b", "c"]);
18630 /// ```
18631 pub fn set_warnings<T, V>(mut self, v: T) -> Self
18632 where
18633 T: std::iter::IntoIterator<Item = V>,
18634 V: std::convert::Into<std::string::String>,
18635 {
18636 use std::iter::Iterator;
18637 self.warnings = v.into_iter().map(|i| i.into()).collect();
18638 self
18639 }
18640}
18641
18642impl wkt::message::Message for NodeGroupOperationMetadata {
18643 fn typename() -> &'static str {
18644 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupOperationMetadata"
18645 }
18646}
18647
18648/// Defines additional types related to [NodeGroupOperationMetadata].
18649pub mod node_group_operation_metadata {
18650 #[allow(unused_imports)]
18651 use super::*;
18652
18653 /// Operation type for node group resources.
18654 ///
18655 /// # Working with unknown values
18656 ///
18657 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18658 /// additional enum variants at any time. Adding new variants is not considered
18659 /// a breaking change. Applications should write their code in anticipation of:
18660 ///
18661 /// - New values appearing in future releases of the client library, **and**
18662 /// - New values received dynamically, without application changes.
18663 ///
18664 /// Please consult the [Working with enums] section in the user guide for some
18665 /// guidelines.
18666 ///
18667 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18668 #[derive(Clone, Debug, PartialEq)]
18669 #[non_exhaustive]
18670 pub enum NodeGroupOperationType {
18671 /// Node group operation type is unknown.
18672 Unspecified,
18673 /// Create node group operation type.
18674 Create,
18675 /// Update node group operation type.
18676 Update,
18677 /// Delete node group operation type.
18678 Delete,
18679 /// Resize node group operation type.
18680 Resize,
18681 /// If set, the enum was initialized with an unknown value.
18682 ///
18683 /// Applications can examine the value using [NodeGroupOperationType::value] or
18684 /// [NodeGroupOperationType::name].
18685 UnknownValue(node_group_operation_type::UnknownValue),
18686 }
18687
18688 #[doc(hidden)]
18689 pub mod node_group_operation_type {
18690 #[allow(unused_imports)]
18691 use super::*;
18692 #[derive(Clone, Debug, PartialEq)]
18693 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18694 }
18695
18696 impl NodeGroupOperationType {
18697 /// Gets the enum value.
18698 ///
18699 /// Returns `None` if the enum contains an unknown value deserialized from
18700 /// the string representation of enums.
18701 pub fn value(&self) -> std::option::Option<i32> {
18702 match self {
18703 Self::Unspecified => std::option::Option::Some(0),
18704 Self::Create => std::option::Option::Some(1),
18705 Self::Update => std::option::Option::Some(2),
18706 Self::Delete => std::option::Option::Some(3),
18707 Self::Resize => std::option::Option::Some(4),
18708 Self::UnknownValue(u) => u.0.value(),
18709 }
18710 }
18711
18712 /// Gets the enum value as a string.
18713 ///
18714 /// Returns `None` if the enum contains an unknown value deserialized from
18715 /// the integer representation of enums.
18716 pub fn name(&self) -> std::option::Option<&str> {
18717 match self {
18718 Self::Unspecified => {
18719 std::option::Option::Some("NODE_GROUP_OPERATION_TYPE_UNSPECIFIED")
18720 }
18721 Self::Create => std::option::Option::Some("CREATE"),
18722 Self::Update => std::option::Option::Some("UPDATE"),
18723 Self::Delete => std::option::Option::Some("DELETE"),
18724 Self::Resize => std::option::Option::Some("RESIZE"),
18725 Self::UnknownValue(u) => u.0.name(),
18726 }
18727 }
18728 }
18729
18730 impl std::default::Default for NodeGroupOperationType {
18731 fn default() -> Self {
18732 use std::convert::From;
18733 Self::from(0)
18734 }
18735 }
18736
18737 impl std::fmt::Display for NodeGroupOperationType {
18738 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18739 wkt::internal::display_enum(f, self.name(), self.value())
18740 }
18741 }
18742
18743 impl std::convert::From<i32> for NodeGroupOperationType {
18744 fn from(value: i32) -> Self {
18745 match value {
18746 0 => Self::Unspecified,
18747 1 => Self::Create,
18748 2 => Self::Update,
18749 3 => Self::Delete,
18750 4 => Self::Resize,
18751 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
18752 wkt::internal::UnknownEnumValue::Integer(value),
18753 )),
18754 }
18755 }
18756 }
18757
18758 impl std::convert::From<&str> for NodeGroupOperationType {
18759 fn from(value: &str) -> Self {
18760 use std::string::ToString;
18761 match value {
18762 "NODE_GROUP_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
18763 "CREATE" => Self::Create,
18764 "UPDATE" => Self::Update,
18765 "DELETE" => Self::Delete,
18766 "RESIZE" => Self::Resize,
18767 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
18768 wkt::internal::UnknownEnumValue::String(value.to_string()),
18769 )),
18770 }
18771 }
18772 }
18773
18774 impl serde::ser::Serialize for NodeGroupOperationType {
18775 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18776 where
18777 S: serde::Serializer,
18778 {
18779 match self {
18780 Self::Unspecified => serializer.serialize_i32(0),
18781 Self::Create => serializer.serialize_i32(1),
18782 Self::Update => serializer.serialize_i32(2),
18783 Self::Delete => serializer.serialize_i32(3),
18784 Self::Resize => serializer.serialize_i32(4),
18785 Self::UnknownValue(u) => u.0.serialize(serializer),
18786 }
18787 }
18788 }
18789
18790 impl<'de> serde::de::Deserialize<'de> for NodeGroupOperationType {
18791 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18792 where
18793 D: serde::Deserializer<'de>,
18794 {
18795 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeGroupOperationType>::new(
18796 ".google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType",
18797 ))
18798 }
18799 }
18800}
18801
18802/// A request to create a session template.
18803#[derive(Clone, Default, PartialEq)]
18804#[non_exhaustive]
18805pub struct CreateSessionTemplateRequest {
18806 /// Required. The parent resource where this session template will be created.
18807 pub parent: std::string::String,
18808
18809 /// Required. The session template to create.
18810 pub session_template: std::option::Option<crate::model::SessionTemplate>,
18811
18812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18813}
18814
18815impl CreateSessionTemplateRequest {
18816 /// Creates a new default instance.
18817 pub fn new() -> Self {
18818 std::default::Default::default()
18819 }
18820
18821 /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
18822 ///
18823 /// # Example
18824 /// ```ignore,no_run
18825 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18826 /// # let project_id = "project_id";
18827 /// # let location_id = "location_id";
18828 /// let x = CreateSessionTemplateRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
18829 /// ```
18830 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18831 self.parent = v.into();
18832 self
18833 }
18834
18835 /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
18836 ///
18837 /// # Example
18838 /// ```ignore,no_run
18839 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18840 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18841 /// let x = CreateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
18842 /// ```
18843 pub fn set_session_template<T>(mut self, v: T) -> Self
18844 where
18845 T: std::convert::Into<crate::model::SessionTemplate>,
18846 {
18847 self.session_template = std::option::Option::Some(v.into());
18848 self
18849 }
18850
18851 /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
18852 ///
18853 /// # Example
18854 /// ```ignore,no_run
18855 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18856 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18857 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
18858 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
18859 /// ```
18860 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
18861 where
18862 T: std::convert::Into<crate::model::SessionTemplate>,
18863 {
18864 self.session_template = v.map(|x| x.into());
18865 self
18866 }
18867}
18868
18869impl wkt::message::Message for CreateSessionTemplateRequest {
18870 fn typename() -> &'static str {
18871 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionTemplateRequest"
18872 }
18873}
18874
18875/// A request to update a session template.
18876#[derive(Clone, Default, PartialEq)]
18877#[non_exhaustive]
18878pub struct UpdateSessionTemplateRequest {
18879 /// Required. The updated session template.
18880 pub session_template: std::option::Option<crate::model::SessionTemplate>,
18881
18882 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18883}
18884
18885impl UpdateSessionTemplateRequest {
18886 /// Creates a new default instance.
18887 pub fn new() -> Self {
18888 std::default::Default::default()
18889 }
18890
18891 /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
18892 ///
18893 /// # Example
18894 /// ```ignore,no_run
18895 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
18896 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18897 /// let x = UpdateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
18898 /// ```
18899 pub fn set_session_template<T>(mut self, v: T) -> Self
18900 where
18901 T: std::convert::Into<crate::model::SessionTemplate>,
18902 {
18903 self.session_template = std::option::Option::Some(v.into());
18904 self
18905 }
18906
18907 /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
18908 ///
18909 /// # Example
18910 /// ```ignore,no_run
18911 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
18912 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18913 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
18914 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
18915 /// ```
18916 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
18917 where
18918 T: std::convert::Into<crate::model::SessionTemplate>,
18919 {
18920 self.session_template = v.map(|x| x.into());
18921 self
18922 }
18923}
18924
18925impl wkt::message::Message for UpdateSessionTemplateRequest {
18926 fn typename() -> &'static str {
18927 "type.googleapis.com/google.cloud.dataproc.v1.UpdateSessionTemplateRequest"
18928 }
18929}
18930
18931/// A request to get the resource representation for a session template.
18932#[derive(Clone, Default, PartialEq)]
18933#[non_exhaustive]
18934pub struct GetSessionTemplateRequest {
18935 /// Required. The name of the session template to retrieve.
18936 pub name: std::string::String,
18937
18938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18939}
18940
18941impl GetSessionTemplateRequest {
18942 /// Creates a new default instance.
18943 pub fn new() -> Self {
18944 std::default::Default::default()
18945 }
18946
18947 /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
18948 ///
18949 /// # Example
18950 /// ```ignore,no_run
18951 /// # use google_cloud_dataproc_v1::model::GetSessionTemplateRequest;
18952 /// # let project_id = "project_id";
18953 /// # let location_id = "location_id";
18954 /// # let template_id = "template_id";
18955 /// let x = GetSessionTemplateRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
18956 /// ```
18957 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18958 self.name = v.into();
18959 self
18960 }
18961}
18962
18963impl wkt::message::Message for GetSessionTemplateRequest {
18964 fn typename() -> &'static str {
18965 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionTemplateRequest"
18966 }
18967}
18968
18969/// A request to list session templates in a project.
18970#[derive(Clone, Default, PartialEq)]
18971#[non_exhaustive]
18972pub struct ListSessionTemplatesRequest {
18973 /// Required. The parent that owns this collection of session templates.
18974 pub parent: std::string::String,
18975
18976 /// Optional. The maximum number of sessions to return in each response.
18977 /// The service may return fewer than this value.
18978 pub page_size: i32,
18979
18980 /// Optional. A page token received from a previous `ListSessions` call.
18981 /// Provide this token to retrieve the subsequent page.
18982 pub page_token: std::string::String,
18983
18984 /// Optional. A filter for the session templates to return in the response.
18985 /// Filters are case sensitive and have the following syntax:
18986 ///
18987 /// [field = value] AND [field [= value]] ...
18988 pub filter: std::string::String,
18989
18990 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18991}
18992
18993impl ListSessionTemplatesRequest {
18994 /// Creates a new default instance.
18995 pub fn new() -> Self {
18996 std::default::Default::default()
18997 }
18998
18999 /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
19000 ///
19001 /// # Example
19002 /// ```ignore,no_run
19003 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
19004 /// # let project_id = "project_id";
19005 /// # let location_id = "location_id";
19006 /// let x = ListSessionTemplatesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
19007 /// ```
19008 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19009 self.parent = v.into();
19010 self
19011 }
19012
19013 /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
19014 ///
19015 /// # Example
19016 /// ```ignore,no_run
19017 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
19018 /// let x = ListSessionTemplatesRequest::new().set_page_size(42);
19019 /// ```
19020 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19021 self.page_size = v.into();
19022 self
19023 }
19024
19025 /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
19026 ///
19027 /// # Example
19028 /// ```ignore,no_run
19029 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
19030 /// let x = ListSessionTemplatesRequest::new().set_page_token("example");
19031 /// ```
19032 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19033 self.page_token = v.into();
19034 self
19035 }
19036
19037 /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
19038 ///
19039 /// # Example
19040 /// ```ignore,no_run
19041 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
19042 /// let x = ListSessionTemplatesRequest::new().set_filter("example");
19043 /// ```
19044 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19045 self.filter = v.into();
19046 self
19047 }
19048}
19049
19050impl wkt::message::Message for ListSessionTemplatesRequest {
19051 fn typename() -> &'static str {
19052 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesRequest"
19053 }
19054}
19055
19056/// A list of session templates.
19057#[derive(Clone, Default, PartialEq)]
19058#[non_exhaustive]
19059pub struct ListSessionTemplatesResponse {
19060 /// Output only. Session template list
19061 pub session_templates: std::vec::Vec<crate::model::SessionTemplate>,
19062
19063 /// A token, which can be sent as `page_token` to retrieve the next page.
19064 /// If this field is omitted, there are no subsequent pages.
19065 pub next_page_token: std::string::String,
19066
19067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19068}
19069
19070impl ListSessionTemplatesResponse {
19071 /// Creates a new default instance.
19072 pub fn new() -> Self {
19073 std::default::Default::default()
19074 }
19075
19076 /// Sets the value of [session_templates][crate::model::ListSessionTemplatesResponse::session_templates].
19077 ///
19078 /// # Example
19079 /// ```ignore,no_run
19080 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
19081 /// use google_cloud_dataproc_v1::model::SessionTemplate;
19082 /// let x = ListSessionTemplatesResponse::new()
19083 /// .set_session_templates([
19084 /// SessionTemplate::default()/* use setters */,
19085 /// SessionTemplate::default()/* use (different) setters */,
19086 /// ]);
19087 /// ```
19088 pub fn set_session_templates<T, V>(mut self, v: T) -> Self
19089 where
19090 T: std::iter::IntoIterator<Item = V>,
19091 V: std::convert::Into<crate::model::SessionTemplate>,
19092 {
19093 use std::iter::Iterator;
19094 self.session_templates = v.into_iter().map(|i| i.into()).collect();
19095 self
19096 }
19097
19098 /// Sets the value of [next_page_token][crate::model::ListSessionTemplatesResponse::next_page_token].
19099 ///
19100 /// # Example
19101 /// ```ignore,no_run
19102 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
19103 /// let x = ListSessionTemplatesResponse::new().set_next_page_token("example");
19104 /// ```
19105 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19106 self.next_page_token = v.into();
19107 self
19108 }
19109}
19110
19111impl wkt::message::Message for ListSessionTemplatesResponse {
19112 fn typename() -> &'static str {
19113 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesResponse"
19114 }
19115}
19116
19117#[doc(hidden)]
19118impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionTemplatesResponse {
19119 type PageItem = crate::model::SessionTemplate;
19120
19121 fn items(self) -> std::vec::Vec<Self::PageItem> {
19122 self.session_templates
19123 }
19124
19125 fn next_page_token(&self) -> std::string::String {
19126 use std::clone::Clone;
19127 self.next_page_token.clone()
19128 }
19129}
19130
19131/// A request to delete a session template.
19132#[derive(Clone, Default, PartialEq)]
19133#[non_exhaustive]
19134pub struct DeleteSessionTemplateRequest {
19135 /// Required. The name of the session template resource to delete.
19136 pub name: std::string::String,
19137
19138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19139}
19140
19141impl DeleteSessionTemplateRequest {
19142 /// Creates a new default instance.
19143 pub fn new() -> Self {
19144 std::default::Default::default()
19145 }
19146
19147 /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
19148 ///
19149 /// # Example
19150 /// ```ignore,no_run
19151 /// # use google_cloud_dataproc_v1::model::DeleteSessionTemplateRequest;
19152 /// # let project_id = "project_id";
19153 /// # let location_id = "location_id";
19154 /// # let template_id = "template_id";
19155 /// let x = DeleteSessionTemplateRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
19156 /// ```
19157 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19158 self.name = v.into();
19159 self
19160 }
19161}
19162
19163impl wkt::message::Message for DeleteSessionTemplateRequest {
19164 fn typename() -> &'static str {
19165 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionTemplateRequest"
19166 }
19167}
19168
19169/// A representation of a session template.
19170#[derive(Clone, Default, PartialEq)]
19171#[non_exhaustive]
19172pub struct SessionTemplate {
19173 /// Required. Identifier. The resource name of the session template.
19174 pub name: std::string::String,
19175
19176 /// Optional. Brief description of the template.
19177 pub description: std::string::String,
19178
19179 /// Output only. The time when the template was created.
19180 pub create_time: std::option::Option<wkt::Timestamp>,
19181
19182 /// Output only. The email address of the user who created the template.
19183 pub creator: std::string::String,
19184
19185 /// Optional. Labels to associate with sessions created using this template.
19186 /// Label **keys** must contain 1 to 63 characters, and must conform to
19187 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
19188 /// Label **values** can be empty, but, if present, must contain 1 to 63
19189 /// characters and conform to [RFC
19190 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
19191 /// associated with a session.
19192 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
19193
19194 /// Optional. Runtime configuration for session execution.
19195 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
19196
19197 /// Optional. Environment configuration for session execution.
19198 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
19199
19200 /// Output only. The time the template was last updated.
19201 pub update_time: std::option::Option<wkt::Timestamp>,
19202
19203 /// Output only. A session template UUID (Unique Universal Identifier). The
19204 /// service generates this value when it creates the session template.
19205 pub uuid: std::string::String,
19206
19207 /// The session configuration.
19208 pub session_config: std::option::Option<crate::model::session_template::SessionConfig>,
19209
19210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19211}
19212
19213impl SessionTemplate {
19214 /// Creates a new default instance.
19215 pub fn new() -> Self {
19216 std::default::Default::default()
19217 }
19218
19219 /// Sets the value of [name][crate::model::SessionTemplate::name].
19220 ///
19221 /// # Example
19222 /// ```ignore,no_run
19223 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19224 /// # let project_id = "project_id";
19225 /// # let location_id = "location_id";
19226 /// # let template_id = "template_id";
19227 /// let x = SessionTemplate::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
19228 /// ```
19229 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19230 self.name = v.into();
19231 self
19232 }
19233
19234 /// Sets the value of [description][crate::model::SessionTemplate::description].
19235 ///
19236 /// # Example
19237 /// ```ignore,no_run
19238 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19239 /// let x = SessionTemplate::new().set_description("example");
19240 /// ```
19241 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19242 self.description = v.into();
19243 self
19244 }
19245
19246 /// Sets the value of [create_time][crate::model::SessionTemplate::create_time].
19247 ///
19248 /// # Example
19249 /// ```ignore,no_run
19250 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19251 /// use wkt::Timestamp;
19252 /// let x = SessionTemplate::new().set_create_time(Timestamp::default()/* use setters */);
19253 /// ```
19254 pub fn set_create_time<T>(mut self, v: T) -> Self
19255 where
19256 T: std::convert::Into<wkt::Timestamp>,
19257 {
19258 self.create_time = std::option::Option::Some(v.into());
19259 self
19260 }
19261
19262 /// Sets or clears the value of [create_time][crate::model::SessionTemplate::create_time].
19263 ///
19264 /// # Example
19265 /// ```ignore,no_run
19266 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19267 /// use wkt::Timestamp;
19268 /// let x = SessionTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19269 /// let x = SessionTemplate::new().set_or_clear_create_time(None::<Timestamp>);
19270 /// ```
19271 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19272 where
19273 T: std::convert::Into<wkt::Timestamp>,
19274 {
19275 self.create_time = v.map(|x| x.into());
19276 self
19277 }
19278
19279 /// Sets the value of [creator][crate::model::SessionTemplate::creator].
19280 ///
19281 /// # Example
19282 /// ```ignore,no_run
19283 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19284 /// let x = SessionTemplate::new().set_creator("example");
19285 /// ```
19286 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19287 self.creator = v.into();
19288 self
19289 }
19290
19291 /// Sets the value of [labels][crate::model::SessionTemplate::labels].
19292 ///
19293 /// # Example
19294 /// ```ignore,no_run
19295 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19296 /// let x = SessionTemplate::new().set_labels([
19297 /// ("key0", "abc"),
19298 /// ("key1", "xyz"),
19299 /// ]);
19300 /// ```
19301 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
19302 where
19303 T: std::iter::IntoIterator<Item = (K, V)>,
19304 K: std::convert::Into<std::string::String>,
19305 V: std::convert::Into<std::string::String>,
19306 {
19307 use std::iter::Iterator;
19308 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
19309 self
19310 }
19311
19312 /// Sets the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
19313 ///
19314 /// # Example
19315 /// ```ignore,no_run
19316 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19317 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19318 /// let x = SessionTemplate::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
19319 /// ```
19320 pub fn set_runtime_config<T>(mut self, v: T) -> Self
19321 where
19322 T: std::convert::Into<crate::model::RuntimeConfig>,
19323 {
19324 self.runtime_config = std::option::Option::Some(v.into());
19325 self
19326 }
19327
19328 /// Sets or clears the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
19329 ///
19330 /// # Example
19331 /// ```ignore,no_run
19332 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19333 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19334 /// let x = SessionTemplate::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
19335 /// let x = SessionTemplate::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
19336 /// ```
19337 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
19338 where
19339 T: std::convert::Into<crate::model::RuntimeConfig>,
19340 {
19341 self.runtime_config = v.map(|x| x.into());
19342 self
19343 }
19344
19345 /// Sets the value of [environment_config][crate::model::SessionTemplate::environment_config].
19346 ///
19347 /// # Example
19348 /// ```ignore,no_run
19349 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19350 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19351 /// let x = SessionTemplate::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
19352 /// ```
19353 pub fn set_environment_config<T>(mut self, v: T) -> Self
19354 where
19355 T: std::convert::Into<crate::model::EnvironmentConfig>,
19356 {
19357 self.environment_config = std::option::Option::Some(v.into());
19358 self
19359 }
19360
19361 /// Sets or clears the value of [environment_config][crate::model::SessionTemplate::environment_config].
19362 ///
19363 /// # Example
19364 /// ```ignore,no_run
19365 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19366 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19367 /// let x = SessionTemplate::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
19368 /// let x = SessionTemplate::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
19369 /// ```
19370 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
19371 where
19372 T: std::convert::Into<crate::model::EnvironmentConfig>,
19373 {
19374 self.environment_config = v.map(|x| x.into());
19375 self
19376 }
19377
19378 /// Sets the value of [update_time][crate::model::SessionTemplate::update_time].
19379 ///
19380 /// # Example
19381 /// ```ignore,no_run
19382 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19383 /// use wkt::Timestamp;
19384 /// let x = SessionTemplate::new().set_update_time(Timestamp::default()/* use setters */);
19385 /// ```
19386 pub fn set_update_time<T>(mut self, v: T) -> Self
19387 where
19388 T: std::convert::Into<wkt::Timestamp>,
19389 {
19390 self.update_time = std::option::Option::Some(v.into());
19391 self
19392 }
19393
19394 /// Sets or clears the value of [update_time][crate::model::SessionTemplate::update_time].
19395 ///
19396 /// # Example
19397 /// ```ignore,no_run
19398 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19399 /// use wkt::Timestamp;
19400 /// let x = SessionTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19401 /// let x = SessionTemplate::new().set_or_clear_update_time(None::<Timestamp>);
19402 /// ```
19403 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19404 where
19405 T: std::convert::Into<wkt::Timestamp>,
19406 {
19407 self.update_time = v.map(|x| x.into());
19408 self
19409 }
19410
19411 /// Sets the value of [uuid][crate::model::SessionTemplate::uuid].
19412 ///
19413 /// # Example
19414 /// ```ignore,no_run
19415 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19416 /// let x = SessionTemplate::new().set_uuid("example");
19417 /// ```
19418 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19419 self.uuid = v.into();
19420 self
19421 }
19422
19423 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config].
19424 ///
19425 /// Note that all the setters affecting `session_config` are mutually
19426 /// exclusive.
19427 ///
19428 /// # Example
19429 /// ```ignore,no_run
19430 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19431 /// use google_cloud_dataproc_v1::model::JupyterConfig;
19432 /// let x = SessionTemplate::new().set_session_config(Some(
19433 /// google_cloud_dataproc_v1::model::session_template::SessionConfig::JupyterSession(JupyterConfig::default().into())));
19434 /// ```
19435 pub fn set_session_config<
19436 T: std::convert::Into<std::option::Option<crate::model::session_template::SessionConfig>>,
19437 >(
19438 mut self,
19439 v: T,
19440 ) -> Self {
19441 self.session_config = v.into();
19442 self
19443 }
19444
19445 /// The value of [session_config][crate::model::SessionTemplate::session_config]
19446 /// if it holds a `JupyterSession`, `None` if the field is not set or
19447 /// holds a different branch.
19448 pub fn jupyter_session(
19449 &self,
19450 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
19451 #[allow(unreachable_patterns)]
19452 self.session_config.as_ref().and_then(|v| match v {
19453 crate::model::session_template::SessionConfig::JupyterSession(v) => {
19454 std::option::Option::Some(v)
19455 }
19456 _ => std::option::Option::None,
19457 })
19458 }
19459
19460 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
19461 /// to hold a `JupyterSession`.
19462 ///
19463 /// Note that all the setters affecting `session_config` are
19464 /// mutually exclusive.
19465 ///
19466 /// # Example
19467 /// ```ignore,no_run
19468 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19469 /// use google_cloud_dataproc_v1::model::JupyterConfig;
19470 /// let x = SessionTemplate::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
19471 /// assert!(x.jupyter_session().is_some());
19472 /// assert!(x.spark_connect_session().is_none());
19473 /// ```
19474 pub fn set_jupyter_session<
19475 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
19476 >(
19477 mut self,
19478 v: T,
19479 ) -> Self {
19480 self.session_config = std::option::Option::Some(
19481 crate::model::session_template::SessionConfig::JupyterSession(v.into()),
19482 );
19483 self
19484 }
19485
19486 /// The value of [session_config][crate::model::SessionTemplate::session_config]
19487 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
19488 /// holds a different branch.
19489 pub fn spark_connect_session(
19490 &self,
19491 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
19492 #[allow(unreachable_patterns)]
19493 self.session_config.as_ref().and_then(|v| match v {
19494 crate::model::session_template::SessionConfig::SparkConnectSession(v) => {
19495 std::option::Option::Some(v)
19496 }
19497 _ => std::option::Option::None,
19498 })
19499 }
19500
19501 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
19502 /// to hold a `SparkConnectSession`.
19503 ///
19504 /// Note that all the setters affecting `session_config` are
19505 /// mutually exclusive.
19506 ///
19507 /// # Example
19508 /// ```ignore,no_run
19509 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
19510 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
19511 /// let x = SessionTemplate::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
19512 /// assert!(x.spark_connect_session().is_some());
19513 /// assert!(x.jupyter_session().is_none());
19514 /// ```
19515 pub fn set_spark_connect_session<
19516 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
19517 >(
19518 mut self,
19519 v: T,
19520 ) -> Self {
19521 self.session_config = std::option::Option::Some(
19522 crate::model::session_template::SessionConfig::SparkConnectSession(v.into()),
19523 );
19524 self
19525 }
19526}
19527
19528impl wkt::message::Message for SessionTemplate {
19529 fn typename() -> &'static str {
19530 "type.googleapis.com/google.cloud.dataproc.v1.SessionTemplate"
19531 }
19532}
19533
19534/// Defines additional types related to [SessionTemplate].
19535pub mod session_template {
19536 #[allow(unused_imports)]
19537 use super::*;
19538
19539 /// The session configuration.
19540 #[derive(Clone, Debug, PartialEq)]
19541 #[non_exhaustive]
19542 pub enum SessionConfig {
19543 /// Optional. Jupyter session config.
19544 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
19545 /// Optional. Spark connect session config.
19546 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
19547 }
19548}
19549
19550/// A request to create a session.
19551#[derive(Clone, Default, PartialEq)]
19552#[non_exhaustive]
19553pub struct CreateSessionRequest {
19554 /// Required. The parent resource where this session will be created.
19555 pub parent: std::string::String,
19556
19557 /// Required. The interactive session to create.
19558 pub session: std::option::Option<crate::model::Session>,
19559
19560 /// Required. The ID to use for the session, which becomes the final component
19561 /// of the session's resource name.
19562 ///
19563 /// This value must be 4-63 characters. Valid characters
19564 /// are /[a-z][0-9]-/.
19565 pub session_id: std::string::String,
19566
19567 /// Optional. A unique ID used to identify the request. If the service
19568 /// receives two
19569 /// [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
19570 /// with the same ID, the second request is ignored, and the
19571 /// first [Session][google.cloud.dataproc.v1.Session] is created and stored in
19572 /// the backend.
19573 ///
19574 /// Recommendation: Set this value to a
19575 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19576 ///
19577 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19578 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19579 ///
19580 /// [google.cloud.dataproc.v1.Session]: crate::model::Session
19581 pub request_id: std::string::String,
19582
19583 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19584}
19585
19586impl CreateSessionRequest {
19587 /// Creates a new default instance.
19588 pub fn new() -> Self {
19589 std::default::Default::default()
19590 }
19591
19592 /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
19593 ///
19594 /// # Example
19595 /// ```ignore,no_run
19596 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19597 /// # let project_id = "project_id";
19598 /// # let location_id = "location_id";
19599 /// let x = CreateSessionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
19600 /// ```
19601 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19602 self.parent = v.into();
19603 self
19604 }
19605
19606 /// Sets the value of [session][crate::model::CreateSessionRequest::session].
19607 ///
19608 /// # Example
19609 /// ```ignore,no_run
19610 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19611 /// use google_cloud_dataproc_v1::model::Session;
19612 /// let x = CreateSessionRequest::new().set_session(Session::default()/* use setters */);
19613 /// ```
19614 pub fn set_session<T>(mut self, v: T) -> Self
19615 where
19616 T: std::convert::Into<crate::model::Session>,
19617 {
19618 self.session = std::option::Option::Some(v.into());
19619 self
19620 }
19621
19622 /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
19623 ///
19624 /// # Example
19625 /// ```ignore,no_run
19626 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19627 /// use google_cloud_dataproc_v1::model::Session;
19628 /// let x = CreateSessionRequest::new().set_or_clear_session(Some(Session::default()/* use setters */));
19629 /// let x = CreateSessionRequest::new().set_or_clear_session(None::<Session>);
19630 /// ```
19631 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
19632 where
19633 T: std::convert::Into<crate::model::Session>,
19634 {
19635 self.session = v.map(|x| x.into());
19636 self
19637 }
19638
19639 /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
19640 ///
19641 /// # Example
19642 /// ```ignore,no_run
19643 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19644 /// let x = CreateSessionRequest::new().set_session_id("example");
19645 /// ```
19646 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19647 self.session_id = v.into();
19648 self
19649 }
19650
19651 /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
19652 ///
19653 /// # Example
19654 /// ```ignore,no_run
19655 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19656 /// let x = CreateSessionRequest::new().set_request_id("example");
19657 /// ```
19658 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19659 self.request_id = v.into();
19660 self
19661 }
19662}
19663
19664impl wkt::message::Message for CreateSessionRequest {
19665 fn typename() -> &'static str {
19666 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionRequest"
19667 }
19668}
19669
19670/// A request to get the resource representation for a session.
19671#[derive(Clone, Default, PartialEq)]
19672#[non_exhaustive]
19673pub struct GetSessionRequest {
19674 /// Required. The name of the session to retrieve.
19675 pub name: std::string::String,
19676
19677 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19678}
19679
19680impl GetSessionRequest {
19681 /// Creates a new default instance.
19682 pub fn new() -> Self {
19683 std::default::Default::default()
19684 }
19685
19686 /// Sets the value of [name][crate::model::GetSessionRequest::name].
19687 ///
19688 /// # Example
19689 /// ```ignore,no_run
19690 /// # use google_cloud_dataproc_v1::model::GetSessionRequest;
19691 /// # let project_id = "project_id";
19692 /// # let location_id = "location_id";
19693 /// # let session_id = "session_id";
19694 /// let x = GetSessionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
19695 /// ```
19696 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19697 self.name = v.into();
19698 self
19699 }
19700}
19701
19702impl wkt::message::Message for GetSessionRequest {
19703 fn typename() -> &'static str {
19704 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionRequest"
19705 }
19706}
19707
19708/// A request to list sessions in a project.
19709#[derive(Clone, Default, PartialEq)]
19710#[non_exhaustive]
19711pub struct ListSessionsRequest {
19712 /// Required. The parent, which owns this collection of sessions.
19713 pub parent: std::string::String,
19714
19715 /// Optional. The maximum number of sessions to return in each response.
19716 /// The service may return fewer than this value.
19717 pub page_size: i32,
19718
19719 /// Optional. A page token received from a previous `ListSessions` call.
19720 /// Provide this token to retrieve the subsequent page.
19721 pub page_token: std::string::String,
19722
19723 /// Optional. A filter for the sessions to return in the response.
19724 ///
19725 /// A filter is a logical expression constraining the values of various fields
19726 /// in each session resource. Filters are case sensitive, and may contain
19727 /// multiple clauses combined with logical operators (AND, OR).
19728 /// Supported fields are `session_id`, `session_uuid`, `state`, `create_time`,
19729 /// and `labels`.
19730 ///
19731 /// Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
19732 /// is a filter for sessions in an ACTIVE state that were created before
19733 /// 2023-01-01. `state = ACTIVE and labels.environment=production` is a filter
19734 /// for sessions in an ACTIVE state that have a production environment label.
19735 ///
19736 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
19737 /// description of the filter syntax and a list of supported comparators.
19738 pub filter: std::string::String,
19739
19740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19741}
19742
19743impl ListSessionsRequest {
19744 /// Creates a new default instance.
19745 pub fn new() -> Self {
19746 std::default::Default::default()
19747 }
19748
19749 /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
19750 ///
19751 /// # Example
19752 /// ```ignore,no_run
19753 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19754 /// # let project_id = "project_id";
19755 /// # let location_id = "location_id";
19756 /// let x = ListSessionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
19757 /// ```
19758 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19759 self.parent = v.into();
19760 self
19761 }
19762
19763 /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
19764 ///
19765 /// # Example
19766 /// ```ignore,no_run
19767 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19768 /// let x = ListSessionsRequest::new().set_page_size(42);
19769 /// ```
19770 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19771 self.page_size = v.into();
19772 self
19773 }
19774
19775 /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
19776 ///
19777 /// # Example
19778 /// ```ignore,no_run
19779 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19780 /// let x = ListSessionsRequest::new().set_page_token("example");
19781 /// ```
19782 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19783 self.page_token = v.into();
19784 self
19785 }
19786
19787 /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
19788 ///
19789 /// # Example
19790 /// ```ignore,no_run
19791 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19792 /// let x = ListSessionsRequest::new().set_filter("example");
19793 /// ```
19794 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19795 self.filter = v.into();
19796 self
19797 }
19798}
19799
19800impl wkt::message::Message for ListSessionsRequest {
19801 fn typename() -> &'static str {
19802 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsRequest"
19803 }
19804}
19805
19806/// A list of interactive sessions.
19807#[derive(Clone, Default, PartialEq)]
19808#[non_exhaustive]
19809pub struct ListSessionsResponse {
19810 /// Output only. The sessions from the specified collection.
19811 pub sessions: std::vec::Vec<crate::model::Session>,
19812
19813 /// A token, which can be sent as `page_token`, to retrieve the next page.
19814 /// If this field is omitted, there are no subsequent pages.
19815 pub next_page_token: std::string::String,
19816
19817 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19818}
19819
19820impl ListSessionsResponse {
19821 /// Creates a new default instance.
19822 pub fn new() -> Self {
19823 std::default::Default::default()
19824 }
19825
19826 /// Sets the value of [sessions][crate::model::ListSessionsResponse::sessions].
19827 ///
19828 /// # Example
19829 /// ```ignore,no_run
19830 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
19831 /// use google_cloud_dataproc_v1::model::Session;
19832 /// let x = ListSessionsResponse::new()
19833 /// .set_sessions([
19834 /// Session::default()/* use setters */,
19835 /// Session::default()/* use (different) setters */,
19836 /// ]);
19837 /// ```
19838 pub fn set_sessions<T, V>(mut self, v: T) -> Self
19839 where
19840 T: std::iter::IntoIterator<Item = V>,
19841 V: std::convert::Into<crate::model::Session>,
19842 {
19843 use std::iter::Iterator;
19844 self.sessions = v.into_iter().map(|i| i.into()).collect();
19845 self
19846 }
19847
19848 /// Sets the value of [next_page_token][crate::model::ListSessionsResponse::next_page_token].
19849 ///
19850 /// # Example
19851 /// ```ignore,no_run
19852 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
19853 /// let x = ListSessionsResponse::new().set_next_page_token("example");
19854 /// ```
19855 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19856 self.next_page_token = v.into();
19857 self
19858 }
19859}
19860
19861impl wkt::message::Message for ListSessionsResponse {
19862 fn typename() -> &'static str {
19863 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsResponse"
19864 }
19865}
19866
19867#[doc(hidden)]
19868impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionsResponse {
19869 type PageItem = crate::model::Session;
19870
19871 fn items(self) -> std::vec::Vec<Self::PageItem> {
19872 self.sessions
19873 }
19874
19875 fn next_page_token(&self) -> std::string::String {
19876 use std::clone::Clone;
19877 self.next_page_token.clone()
19878 }
19879}
19880
19881/// A request to terminate an interactive session.
19882#[derive(Clone, Default, PartialEq)]
19883#[non_exhaustive]
19884pub struct TerminateSessionRequest {
19885 /// Required. The name of the session resource to terminate.
19886 pub name: std::string::String,
19887
19888 /// Optional. A unique ID used to identify the request. If the service
19889 /// receives two
19890 /// [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
19891 /// with the same ID, the second request is ignored.
19892 ///
19893 /// Recommendation: Set this value to a
19894 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19895 ///
19896 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19897 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19898 pub request_id: std::string::String,
19899
19900 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19901}
19902
19903impl TerminateSessionRequest {
19904 /// Creates a new default instance.
19905 pub fn new() -> Self {
19906 std::default::Default::default()
19907 }
19908
19909 /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
19910 ///
19911 /// # Example
19912 /// ```ignore,no_run
19913 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
19914 /// # let project_id = "project_id";
19915 /// # let location_id = "location_id";
19916 /// # let session_id = "session_id";
19917 /// let x = TerminateSessionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
19918 /// ```
19919 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19920 self.name = v.into();
19921 self
19922 }
19923
19924 /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
19925 ///
19926 /// # Example
19927 /// ```ignore,no_run
19928 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
19929 /// let x = TerminateSessionRequest::new().set_request_id("example");
19930 /// ```
19931 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19932 self.request_id = v.into();
19933 self
19934 }
19935}
19936
19937impl wkt::message::Message for TerminateSessionRequest {
19938 fn typename() -> &'static str {
19939 "type.googleapis.com/google.cloud.dataproc.v1.TerminateSessionRequest"
19940 }
19941}
19942
19943/// A request to delete a session.
19944#[derive(Clone, Default, PartialEq)]
19945#[non_exhaustive]
19946pub struct DeleteSessionRequest {
19947 /// Required. The name of the session resource to delete.
19948 pub name: std::string::String,
19949
19950 /// Optional. A unique ID used to identify the request. If the service
19951 /// receives two
19952 /// [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
19953 /// with the same ID, the second request is ignored.
19954 ///
19955 /// Recommendation: Set this value to a
19956 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19957 ///
19958 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19959 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19960 pub request_id: std::string::String,
19961
19962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19963}
19964
19965impl DeleteSessionRequest {
19966 /// Creates a new default instance.
19967 pub fn new() -> Self {
19968 std::default::Default::default()
19969 }
19970
19971 /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
19972 ///
19973 /// # Example
19974 /// ```ignore,no_run
19975 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
19976 /// # let project_id = "project_id";
19977 /// # let location_id = "location_id";
19978 /// # let session_id = "session_id";
19979 /// let x = DeleteSessionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
19980 /// ```
19981 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19982 self.name = v.into();
19983 self
19984 }
19985
19986 /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
19987 ///
19988 /// # Example
19989 /// ```ignore,no_run
19990 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
19991 /// let x = DeleteSessionRequest::new().set_request_id("example");
19992 /// ```
19993 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19994 self.request_id = v.into();
19995 self
19996 }
19997}
19998
19999impl wkt::message::Message for DeleteSessionRequest {
20000 fn typename() -> &'static str {
20001 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionRequest"
20002 }
20003}
20004
20005/// A representation of a session.
20006#[derive(Clone, Default, PartialEq)]
20007#[non_exhaustive]
20008pub struct Session {
20009 /// Identifier. The resource name of the session.
20010 pub name: std::string::String,
20011
20012 /// Output only. A session UUID (Unique Universal Identifier). The service
20013 /// generates this value when it creates the session.
20014 pub uuid: std::string::String,
20015
20016 /// Output only. The time when the session was created.
20017 pub create_time: std::option::Option<wkt::Timestamp>,
20018
20019 /// Output only. Runtime information about session execution.
20020 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
20021
20022 /// Output only. A state of the session.
20023 pub state: crate::model::session::State,
20024
20025 /// Output only. Session state details, such as the failure
20026 /// description if the state is `FAILED`.
20027 pub state_message: std::string::String,
20028
20029 /// Output only. The time when the session entered the current state.
20030 pub state_time: std::option::Option<wkt::Timestamp>,
20031
20032 /// Output only. The email address of the user who created the session.
20033 pub creator: std::string::String,
20034
20035 /// Optional. The labels to associate with the session.
20036 /// Label **keys** must contain 1 to 63 characters, and must conform to
20037 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
20038 /// Label **values** may be empty, but, if present, must contain 1 to 63
20039 /// characters, and must conform to [RFC
20040 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
20041 /// associated with a session.
20042 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
20043
20044 /// Optional. Runtime configuration for the session execution.
20045 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
20046
20047 /// Optional. Environment configuration for the session execution.
20048 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
20049
20050 /// Optional. The email address of the user who owns the session.
20051 pub user: std::string::String,
20052
20053 /// Output only. Historical state information for the session.
20054 pub state_history: std::vec::Vec<crate::model::session::SessionStateHistory>,
20055
20056 /// Optional. The session template used by the session.
20057 ///
20058 /// Only resource names, including project ID and location, are valid.
20059 ///
20060 /// Example:
20061 ///
20062 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
20063 /// * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
20064 ///
20065 /// The template must be in the same project and Dataproc region as the
20066 /// session.
20067 pub session_template: std::string::String,
20068
20069 /// The session configuration.
20070 pub session_config: std::option::Option<crate::model::session::SessionConfig>,
20071
20072 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20073}
20074
20075impl Session {
20076 /// Creates a new default instance.
20077 pub fn new() -> Self {
20078 std::default::Default::default()
20079 }
20080
20081 /// Sets the value of [name][crate::model::Session::name].
20082 ///
20083 /// # Example
20084 /// ```ignore,no_run
20085 /// # use google_cloud_dataproc_v1::model::Session;
20086 /// # let project_id = "project_id";
20087 /// # let location_id = "location_id";
20088 /// # let session_id = "session_id";
20089 /// let x = Session::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
20090 /// ```
20091 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20092 self.name = v.into();
20093 self
20094 }
20095
20096 /// Sets the value of [uuid][crate::model::Session::uuid].
20097 ///
20098 /// # Example
20099 /// ```ignore,no_run
20100 /// # use google_cloud_dataproc_v1::model::Session;
20101 /// let x = Session::new().set_uuid("example");
20102 /// ```
20103 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20104 self.uuid = v.into();
20105 self
20106 }
20107
20108 /// Sets the value of [create_time][crate::model::Session::create_time].
20109 ///
20110 /// # Example
20111 /// ```ignore,no_run
20112 /// # use google_cloud_dataproc_v1::model::Session;
20113 /// use wkt::Timestamp;
20114 /// let x = Session::new().set_create_time(Timestamp::default()/* use setters */);
20115 /// ```
20116 pub fn set_create_time<T>(mut self, v: T) -> Self
20117 where
20118 T: std::convert::Into<wkt::Timestamp>,
20119 {
20120 self.create_time = std::option::Option::Some(v.into());
20121 self
20122 }
20123
20124 /// Sets or clears the value of [create_time][crate::model::Session::create_time].
20125 ///
20126 /// # Example
20127 /// ```ignore,no_run
20128 /// # use google_cloud_dataproc_v1::model::Session;
20129 /// use wkt::Timestamp;
20130 /// let x = Session::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
20131 /// let x = Session::new().set_or_clear_create_time(None::<Timestamp>);
20132 /// ```
20133 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
20134 where
20135 T: std::convert::Into<wkt::Timestamp>,
20136 {
20137 self.create_time = v.map(|x| x.into());
20138 self
20139 }
20140
20141 /// Sets the value of [runtime_info][crate::model::Session::runtime_info].
20142 ///
20143 /// # Example
20144 /// ```ignore,no_run
20145 /// # use google_cloud_dataproc_v1::model::Session;
20146 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
20147 /// let x = Session::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
20148 /// ```
20149 pub fn set_runtime_info<T>(mut self, v: T) -> Self
20150 where
20151 T: std::convert::Into<crate::model::RuntimeInfo>,
20152 {
20153 self.runtime_info = std::option::Option::Some(v.into());
20154 self
20155 }
20156
20157 /// Sets or clears the value of [runtime_info][crate::model::Session::runtime_info].
20158 ///
20159 /// # Example
20160 /// ```ignore,no_run
20161 /// # use google_cloud_dataproc_v1::model::Session;
20162 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
20163 /// let x = Session::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
20164 /// let x = Session::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
20165 /// ```
20166 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
20167 where
20168 T: std::convert::Into<crate::model::RuntimeInfo>,
20169 {
20170 self.runtime_info = v.map(|x| x.into());
20171 self
20172 }
20173
20174 /// Sets the value of [state][crate::model::Session::state].
20175 ///
20176 /// # Example
20177 /// ```ignore,no_run
20178 /// # use google_cloud_dataproc_v1::model::Session;
20179 /// use google_cloud_dataproc_v1::model::session::State;
20180 /// let x0 = Session::new().set_state(State::Creating);
20181 /// let x1 = Session::new().set_state(State::Active);
20182 /// let x2 = Session::new().set_state(State::Terminating);
20183 /// ```
20184 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(mut self, v: T) -> Self {
20185 self.state = v.into();
20186 self
20187 }
20188
20189 /// Sets the value of [state_message][crate::model::Session::state_message].
20190 ///
20191 /// # Example
20192 /// ```ignore,no_run
20193 /// # use google_cloud_dataproc_v1::model::Session;
20194 /// let x = Session::new().set_state_message("example");
20195 /// ```
20196 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20197 self.state_message = v.into();
20198 self
20199 }
20200
20201 /// Sets the value of [state_time][crate::model::Session::state_time].
20202 ///
20203 /// # Example
20204 /// ```ignore,no_run
20205 /// # use google_cloud_dataproc_v1::model::Session;
20206 /// use wkt::Timestamp;
20207 /// let x = Session::new().set_state_time(Timestamp::default()/* use setters */);
20208 /// ```
20209 pub fn set_state_time<T>(mut self, v: T) -> Self
20210 where
20211 T: std::convert::Into<wkt::Timestamp>,
20212 {
20213 self.state_time = std::option::Option::Some(v.into());
20214 self
20215 }
20216
20217 /// Sets or clears the value of [state_time][crate::model::Session::state_time].
20218 ///
20219 /// # Example
20220 /// ```ignore,no_run
20221 /// # use google_cloud_dataproc_v1::model::Session;
20222 /// use wkt::Timestamp;
20223 /// let x = Session::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
20224 /// let x = Session::new().set_or_clear_state_time(None::<Timestamp>);
20225 /// ```
20226 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
20227 where
20228 T: std::convert::Into<wkt::Timestamp>,
20229 {
20230 self.state_time = v.map(|x| x.into());
20231 self
20232 }
20233
20234 /// Sets the value of [creator][crate::model::Session::creator].
20235 ///
20236 /// # Example
20237 /// ```ignore,no_run
20238 /// # use google_cloud_dataproc_v1::model::Session;
20239 /// let x = Session::new().set_creator("example");
20240 /// ```
20241 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20242 self.creator = v.into();
20243 self
20244 }
20245
20246 /// Sets the value of [labels][crate::model::Session::labels].
20247 ///
20248 /// # Example
20249 /// ```ignore,no_run
20250 /// # use google_cloud_dataproc_v1::model::Session;
20251 /// let x = Session::new().set_labels([
20252 /// ("key0", "abc"),
20253 /// ("key1", "xyz"),
20254 /// ]);
20255 /// ```
20256 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
20257 where
20258 T: std::iter::IntoIterator<Item = (K, V)>,
20259 K: std::convert::Into<std::string::String>,
20260 V: std::convert::Into<std::string::String>,
20261 {
20262 use std::iter::Iterator;
20263 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20264 self
20265 }
20266
20267 /// Sets the value of [runtime_config][crate::model::Session::runtime_config].
20268 ///
20269 /// # Example
20270 /// ```ignore,no_run
20271 /// # use google_cloud_dataproc_v1::model::Session;
20272 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
20273 /// let x = Session::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
20274 /// ```
20275 pub fn set_runtime_config<T>(mut self, v: T) -> Self
20276 where
20277 T: std::convert::Into<crate::model::RuntimeConfig>,
20278 {
20279 self.runtime_config = std::option::Option::Some(v.into());
20280 self
20281 }
20282
20283 /// Sets or clears the value of [runtime_config][crate::model::Session::runtime_config].
20284 ///
20285 /// # Example
20286 /// ```ignore,no_run
20287 /// # use google_cloud_dataproc_v1::model::Session;
20288 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
20289 /// let x = Session::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
20290 /// let x = Session::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
20291 /// ```
20292 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
20293 where
20294 T: std::convert::Into<crate::model::RuntimeConfig>,
20295 {
20296 self.runtime_config = v.map(|x| x.into());
20297 self
20298 }
20299
20300 /// Sets the value of [environment_config][crate::model::Session::environment_config].
20301 ///
20302 /// # Example
20303 /// ```ignore,no_run
20304 /// # use google_cloud_dataproc_v1::model::Session;
20305 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
20306 /// let x = Session::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
20307 /// ```
20308 pub fn set_environment_config<T>(mut self, v: T) -> Self
20309 where
20310 T: std::convert::Into<crate::model::EnvironmentConfig>,
20311 {
20312 self.environment_config = std::option::Option::Some(v.into());
20313 self
20314 }
20315
20316 /// Sets or clears the value of [environment_config][crate::model::Session::environment_config].
20317 ///
20318 /// # Example
20319 /// ```ignore,no_run
20320 /// # use google_cloud_dataproc_v1::model::Session;
20321 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
20322 /// let x = Session::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
20323 /// let x = Session::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
20324 /// ```
20325 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
20326 where
20327 T: std::convert::Into<crate::model::EnvironmentConfig>,
20328 {
20329 self.environment_config = v.map(|x| x.into());
20330 self
20331 }
20332
20333 /// Sets the value of [user][crate::model::Session::user].
20334 ///
20335 /// # Example
20336 /// ```ignore,no_run
20337 /// # use google_cloud_dataproc_v1::model::Session;
20338 /// let x = Session::new().set_user("example");
20339 /// ```
20340 pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20341 self.user = v.into();
20342 self
20343 }
20344
20345 /// Sets the value of [state_history][crate::model::Session::state_history].
20346 ///
20347 /// # Example
20348 /// ```ignore,no_run
20349 /// # use google_cloud_dataproc_v1::model::Session;
20350 /// use google_cloud_dataproc_v1::model::session::SessionStateHistory;
20351 /// let x = Session::new()
20352 /// .set_state_history([
20353 /// SessionStateHistory::default()/* use setters */,
20354 /// SessionStateHistory::default()/* use (different) setters */,
20355 /// ]);
20356 /// ```
20357 pub fn set_state_history<T, V>(mut self, v: T) -> Self
20358 where
20359 T: std::iter::IntoIterator<Item = V>,
20360 V: std::convert::Into<crate::model::session::SessionStateHistory>,
20361 {
20362 use std::iter::Iterator;
20363 self.state_history = v.into_iter().map(|i| i.into()).collect();
20364 self
20365 }
20366
20367 /// Sets the value of [session_template][crate::model::Session::session_template].
20368 ///
20369 /// # Example
20370 /// ```ignore,no_run
20371 /// # use google_cloud_dataproc_v1::model::Session;
20372 /// # let project_id = "project_id";
20373 /// # let location_id = "location_id";
20374 /// # let template_id = "template_id";
20375 /// let x = Session::new().set_session_template(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
20376 /// ```
20377 pub fn set_session_template<T: std::convert::Into<std::string::String>>(
20378 mut self,
20379 v: T,
20380 ) -> Self {
20381 self.session_template = v.into();
20382 self
20383 }
20384
20385 /// Sets the value of [session_config][crate::model::Session::session_config].
20386 ///
20387 /// Note that all the setters affecting `session_config` are mutually
20388 /// exclusive.
20389 ///
20390 /// # Example
20391 /// ```ignore,no_run
20392 /// # use google_cloud_dataproc_v1::model::Session;
20393 /// use google_cloud_dataproc_v1::model::JupyterConfig;
20394 /// let x = Session::new().set_session_config(Some(
20395 /// google_cloud_dataproc_v1::model::session::SessionConfig::JupyterSession(JupyterConfig::default().into())));
20396 /// ```
20397 pub fn set_session_config<
20398 T: std::convert::Into<std::option::Option<crate::model::session::SessionConfig>>,
20399 >(
20400 mut self,
20401 v: T,
20402 ) -> Self {
20403 self.session_config = v.into();
20404 self
20405 }
20406
20407 /// The value of [session_config][crate::model::Session::session_config]
20408 /// if it holds a `JupyterSession`, `None` if the field is not set or
20409 /// holds a different branch.
20410 pub fn jupyter_session(
20411 &self,
20412 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
20413 #[allow(unreachable_patterns)]
20414 self.session_config.as_ref().and_then(|v| match v {
20415 crate::model::session::SessionConfig::JupyterSession(v) => std::option::Option::Some(v),
20416 _ => std::option::Option::None,
20417 })
20418 }
20419
20420 /// Sets the value of [session_config][crate::model::Session::session_config]
20421 /// to hold a `JupyterSession`.
20422 ///
20423 /// Note that all the setters affecting `session_config` are
20424 /// mutually exclusive.
20425 ///
20426 /// # Example
20427 /// ```ignore,no_run
20428 /// # use google_cloud_dataproc_v1::model::Session;
20429 /// use google_cloud_dataproc_v1::model::JupyterConfig;
20430 /// let x = Session::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
20431 /// assert!(x.jupyter_session().is_some());
20432 /// assert!(x.spark_connect_session().is_none());
20433 /// ```
20434 pub fn set_jupyter_session<
20435 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
20436 >(
20437 mut self,
20438 v: T,
20439 ) -> Self {
20440 self.session_config = std::option::Option::Some(
20441 crate::model::session::SessionConfig::JupyterSession(v.into()),
20442 );
20443 self
20444 }
20445
20446 /// The value of [session_config][crate::model::Session::session_config]
20447 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
20448 /// holds a different branch.
20449 pub fn spark_connect_session(
20450 &self,
20451 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
20452 #[allow(unreachable_patterns)]
20453 self.session_config.as_ref().and_then(|v| match v {
20454 crate::model::session::SessionConfig::SparkConnectSession(v) => {
20455 std::option::Option::Some(v)
20456 }
20457 _ => std::option::Option::None,
20458 })
20459 }
20460
20461 /// Sets the value of [session_config][crate::model::Session::session_config]
20462 /// to hold a `SparkConnectSession`.
20463 ///
20464 /// Note that all the setters affecting `session_config` are
20465 /// mutually exclusive.
20466 ///
20467 /// # Example
20468 /// ```ignore,no_run
20469 /// # use google_cloud_dataproc_v1::model::Session;
20470 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
20471 /// let x = Session::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
20472 /// assert!(x.spark_connect_session().is_some());
20473 /// assert!(x.jupyter_session().is_none());
20474 /// ```
20475 pub fn set_spark_connect_session<
20476 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
20477 >(
20478 mut self,
20479 v: T,
20480 ) -> Self {
20481 self.session_config = std::option::Option::Some(
20482 crate::model::session::SessionConfig::SparkConnectSession(v.into()),
20483 );
20484 self
20485 }
20486}
20487
20488impl wkt::message::Message for Session {
20489 fn typename() -> &'static str {
20490 "type.googleapis.com/google.cloud.dataproc.v1.Session"
20491 }
20492}
20493
20494/// Defines additional types related to [Session].
20495pub mod session {
20496 #[allow(unused_imports)]
20497 use super::*;
20498
20499 /// Historical state information.
20500 #[derive(Clone, Default, PartialEq)]
20501 #[non_exhaustive]
20502 pub struct SessionStateHistory {
20503 /// Output only. The state of the session at this point in the session
20504 /// history.
20505 pub state: crate::model::session::State,
20506
20507 /// Output only. Details about the state at this point in the session
20508 /// history.
20509 pub state_message: std::string::String,
20510
20511 /// Output only. The time when the session entered the historical state.
20512 pub state_start_time: std::option::Option<wkt::Timestamp>,
20513
20514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20515 }
20516
20517 impl SessionStateHistory {
20518 /// Creates a new default instance.
20519 pub fn new() -> Self {
20520 std::default::Default::default()
20521 }
20522
20523 /// Sets the value of [state][crate::model::session::SessionStateHistory::state].
20524 ///
20525 /// # Example
20526 /// ```ignore,no_run
20527 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
20528 /// use google_cloud_dataproc_v1::model::session::State;
20529 /// let x0 = SessionStateHistory::new().set_state(State::Creating);
20530 /// let x1 = SessionStateHistory::new().set_state(State::Active);
20531 /// let x2 = SessionStateHistory::new().set_state(State::Terminating);
20532 /// ```
20533 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(
20534 mut self,
20535 v: T,
20536 ) -> Self {
20537 self.state = v.into();
20538 self
20539 }
20540
20541 /// Sets the value of [state_message][crate::model::session::SessionStateHistory::state_message].
20542 ///
20543 /// # Example
20544 /// ```ignore,no_run
20545 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
20546 /// let x = SessionStateHistory::new().set_state_message("example");
20547 /// ```
20548 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
20549 mut self,
20550 v: T,
20551 ) -> Self {
20552 self.state_message = v.into();
20553 self
20554 }
20555
20556 /// Sets the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
20557 ///
20558 /// # Example
20559 /// ```ignore,no_run
20560 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
20561 /// use wkt::Timestamp;
20562 /// let x = SessionStateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
20563 /// ```
20564 pub fn set_state_start_time<T>(mut self, v: T) -> Self
20565 where
20566 T: std::convert::Into<wkt::Timestamp>,
20567 {
20568 self.state_start_time = std::option::Option::Some(v.into());
20569 self
20570 }
20571
20572 /// Sets or clears the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
20573 ///
20574 /// # Example
20575 /// ```ignore,no_run
20576 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
20577 /// use wkt::Timestamp;
20578 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
20579 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
20580 /// ```
20581 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
20582 where
20583 T: std::convert::Into<wkt::Timestamp>,
20584 {
20585 self.state_start_time = v.map(|x| x.into());
20586 self
20587 }
20588 }
20589
20590 impl wkt::message::Message for SessionStateHistory {
20591 fn typename() -> &'static str {
20592 "type.googleapis.com/google.cloud.dataproc.v1.Session.SessionStateHistory"
20593 }
20594 }
20595
20596 /// The session state.
20597 ///
20598 /// # Working with unknown values
20599 ///
20600 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20601 /// additional enum variants at any time. Adding new variants is not considered
20602 /// a breaking change. Applications should write their code in anticipation of:
20603 ///
20604 /// - New values appearing in future releases of the client library, **and**
20605 /// - New values received dynamically, without application changes.
20606 ///
20607 /// Please consult the [Working with enums] section in the user guide for some
20608 /// guidelines.
20609 ///
20610 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
20611 #[derive(Clone, Debug, PartialEq)]
20612 #[non_exhaustive]
20613 pub enum State {
20614 /// The session state is unknown.
20615 Unspecified,
20616 /// The session is created prior to running.
20617 Creating,
20618 /// The session is running.
20619 Active,
20620 /// The session is terminating.
20621 Terminating,
20622 /// The session is terminated successfully.
20623 Terminated,
20624 /// The session is no longer running due to an error.
20625 Failed,
20626 /// If set, the enum was initialized with an unknown value.
20627 ///
20628 /// Applications can examine the value using [State::value] or
20629 /// [State::name].
20630 UnknownValue(state::UnknownValue),
20631 }
20632
20633 #[doc(hidden)]
20634 pub mod state {
20635 #[allow(unused_imports)]
20636 use super::*;
20637 #[derive(Clone, Debug, PartialEq)]
20638 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20639 }
20640
20641 impl State {
20642 /// Gets the enum value.
20643 ///
20644 /// Returns `None` if the enum contains an unknown value deserialized from
20645 /// the string representation of enums.
20646 pub fn value(&self) -> std::option::Option<i32> {
20647 match self {
20648 Self::Unspecified => std::option::Option::Some(0),
20649 Self::Creating => std::option::Option::Some(1),
20650 Self::Active => std::option::Option::Some(2),
20651 Self::Terminating => std::option::Option::Some(3),
20652 Self::Terminated => std::option::Option::Some(4),
20653 Self::Failed => std::option::Option::Some(5),
20654 Self::UnknownValue(u) => u.0.value(),
20655 }
20656 }
20657
20658 /// Gets the enum value as a string.
20659 ///
20660 /// Returns `None` if the enum contains an unknown value deserialized from
20661 /// the integer representation of enums.
20662 pub fn name(&self) -> std::option::Option<&str> {
20663 match self {
20664 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
20665 Self::Creating => std::option::Option::Some("CREATING"),
20666 Self::Active => std::option::Option::Some("ACTIVE"),
20667 Self::Terminating => std::option::Option::Some("TERMINATING"),
20668 Self::Terminated => std::option::Option::Some("TERMINATED"),
20669 Self::Failed => std::option::Option::Some("FAILED"),
20670 Self::UnknownValue(u) => u.0.name(),
20671 }
20672 }
20673 }
20674
20675 impl std::default::Default for State {
20676 fn default() -> Self {
20677 use std::convert::From;
20678 Self::from(0)
20679 }
20680 }
20681
20682 impl std::fmt::Display for State {
20683 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20684 wkt::internal::display_enum(f, self.name(), self.value())
20685 }
20686 }
20687
20688 impl std::convert::From<i32> for State {
20689 fn from(value: i32) -> Self {
20690 match value {
20691 0 => Self::Unspecified,
20692 1 => Self::Creating,
20693 2 => Self::Active,
20694 3 => Self::Terminating,
20695 4 => Self::Terminated,
20696 5 => Self::Failed,
20697 _ => Self::UnknownValue(state::UnknownValue(
20698 wkt::internal::UnknownEnumValue::Integer(value),
20699 )),
20700 }
20701 }
20702 }
20703
20704 impl std::convert::From<&str> for State {
20705 fn from(value: &str) -> Self {
20706 use std::string::ToString;
20707 match value {
20708 "STATE_UNSPECIFIED" => Self::Unspecified,
20709 "CREATING" => Self::Creating,
20710 "ACTIVE" => Self::Active,
20711 "TERMINATING" => Self::Terminating,
20712 "TERMINATED" => Self::Terminated,
20713 "FAILED" => Self::Failed,
20714 _ => Self::UnknownValue(state::UnknownValue(
20715 wkt::internal::UnknownEnumValue::String(value.to_string()),
20716 )),
20717 }
20718 }
20719 }
20720
20721 impl serde::ser::Serialize for State {
20722 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20723 where
20724 S: serde::Serializer,
20725 {
20726 match self {
20727 Self::Unspecified => serializer.serialize_i32(0),
20728 Self::Creating => serializer.serialize_i32(1),
20729 Self::Active => serializer.serialize_i32(2),
20730 Self::Terminating => serializer.serialize_i32(3),
20731 Self::Terminated => serializer.serialize_i32(4),
20732 Self::Failed => serializer.serialize_i32(5),
20733 Self::UnknownValue(u) => u.0.serialize(serializer),
20734 }
20735 }
20736 }
20737
20738 impl<'de> serde::de::Deserialize<'de> for State {
20739 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20740 where
20741 D: serde::Deserializer<'de>,
20742 {
20743 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
20744 ".google.cloud.dataproc.v1.Session.State",
20745 ))
20746 }
20747 }
20748
20749 /// The session configuration.
20750 #[derive(Clone, Debug, PartialEq)]
20751 #[non_exhaustive]
20752 pub enum SessionConfig {
20753 /// Optional. Jupyter session config.
20754 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
20755 /// Optional. Spark connect session config.
20756 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
20757 }
20758}
20759
20760/// Jupyter configuration for an interactive session.
20761#[derive(Clone, Default, PartialEq)]
20762#[non_exhaustive]
20763pub struct JupyterConfig {
20764 /// Optional. Kernel
20765 pub kernel: crate::model::jupyter_config::Kernel,
20766
20767 /// Optional. Display name, shown in the Jupyter kernelspec card.
20768 pub display_name: std::string::String,
20769
20770 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20771}
20772
20773impl JupyterConfig {
20774 /// Creates a new default instance.
20775 pub fn new() -> Self {
20776 std::default::Default::default()
20777 }
20778
20779 /// Sets the value of [kernel][crate::model::JupyterConfig::kernel].
20780 ///
20781 /// # Example
20782 /// ```ignore,no_run
20783 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
20784 /// use google_cloud_dataproc_v1::model::jupyter_config::Kernel;
20785 /// let x0 = JupyterConfig::new().set_kernel(Kernel::Python);
20786 /// let x1 = JupyterConfig::new().set_kernel(Kernel::Scala);
20787 /// ```
20788 pub fn set_kernel<T: std::convert::Into<crate::model::jupyter_config::Kernel>>(
20789 mut self,
20790 v: T,
20791 ) -> Self {
20792 self.kernel = v.into();
20793 self
20794 }
20795
20796 /// Sets the value of [display_name][crate::model::JupyterConfig::display_name].
20797 ///
20798 /// # Example
20799 /// ```ignore,no_run
20800 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
20801 /// let x = JupyterConfig::new().set_display_name("example");
20802 /// ```
20803 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20804 self.display_name = v.into();
20805 self
20806 }
20807}
20808
20809impl wkt::message::Message for JupyterConfig {
20810 fn typename() -> &'static str {
20811 "type.googleapis.com/google.cloud.dataproc.v1.JupyterConfig"
20812 }
20813}
20814
20815/// Defines additional types related to [JupyterConfig].
20816pub mod jupyter_config {
20817 #[allow(unused_imports)]
20818 use super::*;
20819
20820 /// Jupyter kernel types.
20821 ///
20822 /// # Working with unknown values
20823 ///
20824 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20825 /// additional enum variants at any time. Adding new variants is not considered
20826 /// a breaking change. Applications should write their code in anticipation of:
20827 ///
20828 /// - New values appearing in future releases of the client library, **and**
20829 /// - New values received dynamically, without application changes.
20830 ///
20831 /// Please consult the [Working with enums] section in the user guide for some
20832 /// guidelines.
20833 ///
20834 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
20835 #[derive(Clone, Debug, PartialEq)]
20836 #[non_exhaustive]
20837 pub enum Kernel {
20838 /// The kernel is unknown.
20839 Unspecified,
20840 /// Python kernel.
20841 Python,
20842 /// Scala kernel.
20843 Scala,
20844 /// If set, the enum was initialized with an unknown value.
20845 ///
20846 /// Applications can examine the value using [Kernel::value] or
20847 /// [Kernel::name].
20848 UnknownValue(kernel::UnknownValue),
20849 }
20850
20851 #[doc(hidden)]
20852 pub mod kernel {
20853 #[allow(unused_imports)]
20854 use super::*;
20855 #[derive(Clone, Debug, PartialEq)]
20856 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20857 }
20858
20859 impl Kernel {
20860 /// Gets the enum value.
20861 ///
20862 /// Returns `None` if the enum contains an unknown value deserialized from
20863 /// the string representation of enums.
20864 pub fn value(&self) -> std::option::Option<i32> {
20865 match self {
20866 Self::Unspecified => std::option::Option::Some(0),
20867 Self::Python => std::option::Option::Some(1),
20868 Self::Scala => std::option::Option::Some(2),
20869 Self::UnknownValue(u) => u.0.value(),
20870 }
20871 }
20872
20873 /// Gets the enum value as a string.
20874 ///
20875 /// Returns `None` if the enum contains an unknown value deserialized from
20876 /// the integer representation of enums.
20877 pub fn name(&self) -> std::option::Option<&str> {
20878 match self {
20879 Self::Unspecified => std::option::Option::Some("KERNEL_UNSPECIFIED"),
20880 Self::Python => std::option::Option::Some("PYTHON"),
20881 Self::Scala => std::option::Option::Some("SCALA"),
20882 Self::UnknownValue(u) => u.0.name(),
20883 }
20884 }
20885 }
20886
20887 impl std::default::Default for Kernel {
20888 fn default() -> Self {
20889 use std::convert::From;
20890 Self::from(0)
20891 }
20892 }
20893
20894 impl std::fmt::Display for Kernel {
20895 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20896 wkt::internal::display_enum(f, self.name(), self.value())
20897 }
20898 }
20899
20900 impl std::convert::From<i32> for Kernel {
20901 fn from(value: i32) -> Self {
20902 match value {
20903 0 => Self::Unspecified,
20904 1 => Self::Python,
20905 2 => Self::Scala,
20906 _ => Self::UnknownValue(kernel::UnknownValue(
20907 wkt::internal::UnknownEnumValue::Integer(value),
20908 )),
20909 }
20910 }
20911 }
20912
20913 impl std::convert::From<&str> for Kernel {
20914 fn from(value: &str) -> Self {
20915 use std::string::ToString;
20916 match value {
20917 "KERNEL_UNSPECIFIED" => Self::Unspecified,
20918 "PYTHON" => Self::Python,
20919 "SCALA" => Self::Scala,
20920 _ => Self::UnknownValue(kernel::UnknownValue(
20921 wkt::internal::UnknownEnumValue::String(value.to_string()),
20922 )),
20923 }
20924 }
20925 }
20926
20927 impl serde::ser::Serialize for Kernel {
20928 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20929 where
20930 S: serde::Serializer,
20931 {
20932 match self {
20933 Self::Unspecified => serializer.serialize_i32(0),
20934 Self::Python => serializer.serialize_i32(1),
20935 Self::Scala => serializer.serialize_i32(2),
20936 Self::UnknownValue(u) => u.0.serialize(serializer),
20937 }
20938 }
20939 }
20940
20941 impl<'de> serde::de::Deserialize<'de> for Kernel {
20942 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20943 where
20944 D: serde::Deserializer<'de>,
20945 {
20946 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kernel>::new(
20947 ".google.cloud.dataproc.v1.JupyterConfig.Kernel",
20948 ))
20949 }
20950 }
20951}
20952
20953/// Spark connect configuration for an interactive session.
20954#[derive(Clone, Default, PartialEq)]
20955#[non_exhaustive]
20956pub struct SparkConnectConfig {
20957 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20958}
20959
20960impl SparkConnectConfig {
20961 /// Creates a new default instance.
20962 pub fn new() -> Self {
20963 std::default::Default::default()
20964 }
20965}
20966
20967impl wkt::message::Message for SparkConnectConfig {
20968 fn typename() -> &'static str {
20969 "type.googleapis.com/google.cloud.dataproc.v1.SparkConnectConfig"
20970 }
20971}
20972
20973/// Runtime configuration for a workload.
20974#[derive(Clone, Default, PartialEq)]
20975#[non_exhaustive]
20976pub struct RuntimeConfig {
20977 /// Optional. Version of the batch runtime.
20978 pub version: std::string::String,
20979
20980 /// Optional. Optional custom container image for the job runtime environment.
20981 /// If not specified, a default container image will be used.
20982 pub container_image: std::string::String,
20983
20984 /// Optional. A mapping of property names to values, which are used to
20985 /// configure workload execution.
20986 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
20987
20988 /// Optional. Dependency repository configuration.
20989 pub repository_config: std::option::Option<crate::model::RepositoryConfig>,
20990
20991 /// Optional. Autotuning configuration of the workload.
20992 pub autotuning_config: std::option::Option<crate::model::AutotuningConfig>,
20993
20994 /// Optional. Cohort identifier. Identifies families of the workloads that have
20995 /// the same shape, for example, daily ETL jobs.
20996 pub cohort: std::string::String,
20997
20998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20999}
21000
21001impl RuntimeConfig {
21002 /// Creates a new default instance.
21003 pub fn new() -> Self {
21004 std::default::Default::default()
21005 }
21006
21007 /// Sets the value of [version][crate::model::RuntimeConfig::version].
21008 ///
21009 /// # Example
21010 /// ```ignore,no_run
21011 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21012 /// let x = RuntimeConfig::new().set_version("example");
21013 /// ```
21014 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21015 self.version = v.into();
21016 self
21017 }
21018
21019 /// Sets the value of [container_image][crate::model::RuntimeConfig::container_image].
21020 ///
21021 /// # Example
21022 /// ```ignore,no_run
21023 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21024 /// let x = RuntimeConfig::new().set_container_image("example");
21025 /// ```
21026 pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21027 self.container_image = v.into();
21028 self
21029 }
21030
21031 /// Sets the value of [properties][crate::model::RuntimeConfig::properties].
21032 ///
21033 /// # Example
21034 /// ```ignore,no_run
21035 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21036 /// let x = RuntimeConfig::new().set_properties([
21037 /// ("key0", "abc"),
21038 /// ("key1", "xyz"),
21039 /// ]);
21040 /// ```
21041 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
21042 where
21043 T: std::iter::IntoIterator<Item = (K, V)>,
21044 K: std::convert::Into<std::string::String>,
21045 V: std::convert::Into<std::string::String>,
21046 {
21047 use std::iter::Iterator;
21048 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21049 self
21050 }
21051
21052 /// Sets the value of [repository_config][crate::model::RuntimeConfig::repository_config].
21053 ///
21054 /// # Example
21055 /// ```ignore,no_run
21056 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21057 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
21058 /// let x = RuntimeConfig::new().set_repository_config(RepositoryConfig::default()/* use setters */);
21059 /// ```
21060 pub fn set_repository_config<T>(mut self, v: T) -> Self
21061 where
21062 T: std::convert::Into<crate::model::RepositoryConfig>,
21063 {
21064 self.repository_config = std::option::Option::Some(v.into());
21065 self
21066 }
21067
21068 /// Sets or clears the value of [repository_config][crate::model::RuntimeConfig::repository_config].
21069 ///
21070 /// # Example
21071 /// ```ignore,no_run
21072 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21073 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
21074 /// let x = RuntimeConfig::new().set_or_clear_repository_config(Some(RepositoryConfig::default()/* use setters */));
21075 /// let x = RuntimeConfig::new().set_or_clear_repository_config(None::<RepositoryConfig>);
21076 /// ```
21077 pub fn set_or_clear_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
21078 where
21079 T: std::convert::Into<crate::model::RepositoryConfig>,
21080 {
21081 self.repository_config = v.map(|x| x.into());
21082 self
21083 }
21084
21085 /// Sets the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
21086 ///
21087 /// # Example
21088 /// ```ignore,no_run
21089 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21090 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
21091 /// let x = RuntimeConfig::new().set_autotuning_config(AutotuningConfig::default()/* use setters */);
21092 /// ```
21093 pub fn set_autotuning_config<T>(mut self, v: T) -> Self
21094 where
21095 T: std::convert::Into<crate::model::AutotuningConfig>,
21096 {
21097 self.autotuning_config = std::option::Option::Some(v.into());
21098 self
21099 }
21100
21101 /// Sets or clears the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
21102 ///
21103 /// # Example
21104 /// ```ignore,no_run
21105 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21106 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
21107 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(Some(AutotuningConfig::default()/* use setters */));
21108 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(None::<AutotuningConfig>);
21109 /// ```
21110 pub fn set_or_clear_autotuning_config<T>(mut self, v: std::option::Option<T>) -> Self
21111 where
21112 T: std::convert::Into<crate::model::AutotuningConfig>,
21113 {
21114 self.autotuning_config = v.map(|x| x.into());
21115 self
21116 }
21117
21118 /// Sets the value of [cohort][crate::model::RuntimeConfig::cohort].
21119 ///
21120 /// # Example
21121 /// ```ignore,no_run
21122 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
21123 /// let x = RuntimeConfig::new().set_cohort("example");
21124 /// ```
21125 pub fn set_cohort<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21126 self.cohort = v.into();
21127 self
21128 }
21129}
21130
21131impl wkt::message::Message for RuntimeConfig {
21132 fn typename() -> &'static str {
21133 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeConfig"
21134 }
21135}
21136
21137/// Environment configuration for a workload.
21138#[derive(Clone, Default, PartialEq)]
21139#[non_exhaustive]
21140pub struct EnvironmentConfig {
21141 /// Optional. Execution configuration for a workload.
21142 pub execution_config: std::option::Option<crate::model::ExecutionConfig>,
21143
21144 /// Optional. Peripherals configuration that workload has access to.
21145 pub peripherals_config: std::option::Option<crate::model::PeripheralsConfig>,
21146
21147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21148}
21149
21150impl EnvironmentConfig {
21151 /// Creates a new default instance.
21152 pub fn new() -> Self {
21153 std::default::Default::default()
21154 }
21155
21156 /// Sets the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
21157 ///
21158 /// # Example
21159 /// ```ignore,no_run
21160 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
21161 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
21162 /// let x = EnvironmentConfig::new().set_execution_config(ExecutionConfig::default()/* use setters */);
21163 /// ```
21164 pub fn set_execution_config<T>(mut self, v: T) -> Self
21165 where
21166 T: std::convert::Into<crate::model::ExecutionConfig>,
21167 {
21168 self.execution_config = std::option::Option::Some(v.into());
21169 self
21170 }
21171
21172 /// Sets or clears the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
21173 ///
21174 /// # Example
21175 /// ```ignore,no_run
21176 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
21177 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
21178 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(Some(ExecutionConfig::default()/* use setters */));
21179 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(None::<ExecutionConfig>);
21180 /// ```
21181 pub fn set_or_clear_execution_config<T>(mut self, v: std::option::Option<T>) -> Self
21182 where
21183 T: std::convert::Into<crate::model::ExecutionConfig>,
21184 {
21185 self.execution_config = v.map(|x| x.into());
21186 self
21187 }
21188
21189 /// Sets the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
21190 ///
21191 /// # Example
21192 /// ```ignore,no_run
21193 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
21194 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
21195 /// let x = EnvironmentConfig::new().set_peripherals_config(PeripheralsConfig::default()/* use setters */);
21196 /// ```
21197 pub fn set_peripherals_config<T>(mut self, v: T) -> Self
21198 where
21199 T: std::convert::Into<crate::model::PeripheralsConfig>,
21200 {
21201 self.peripherals_config = std::option::Option::Some(v.into());
21202 self
21203 }
21204
21205 /// Sets or clears the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
21206 ///
21207 /// # Example
21208 /// ```ignore,no_run
21209 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
21210 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
21211 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(Some(PeripheralsConfig::default()/* use setters */));
21212 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(None::<PeripheralsConfig>);
21213 /// ```
21214 pub fn set_or_clear_peripherals_config<T>(mut self, v: std::option::Option<T>) -> Self
21215 where
21216 T: std::convert::Into<crate::model::PeripheralsConfig>,
21217 {
21218 self.peripherals_config = v.map(|x| x.into());
21219 self
21220 }
21221}
21222
21223impl wkt::message::Message for EnvironmentConfig {
21224 fn typename() -> &'static str {
21225 "type.googleapis.com/google.cloud.dataproc.v1.EnvironmentConfig"
21226 }
21227}
21228
21229/// Execution configuration for a workload.
21230#[derive(Clone, Default, PartialEq)]
21231#[non_exhaustive]
21232pub struct ExecutionConfig {
21233 /// Optional. Service account that used to execute workload.
21234 pub service_account: std::string::String,
21235
21236 /// Optional. Tags used for network traffic control.
21237 pub network_tags: std::vec::Vec<std::string::String>,
21238
21239 /// Optional. The Cloud KMS key to use for encryption.
21240 pub kms_key: std::string::String,
21241
21242 /// Optional. Applies to sessions only. The duration to keep the session alive
21243 /// while it's idling. Exceeding this threshold causes the session to
21244 /// terminate. This field cannot be set on a batch workload. Minimum value is
21245 /// 10 minutes; maximum value is 14 days (see JSON representation of
21246 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
21247 /// Defaults to 1 hour if not set.
21248 /// If both `ttl` and `idle_ttl` are specified for an interactive session,
21249 /// the conditions are treated as `OR` conditions: the workload will be
21250 /// terminated when it has been idle for `idle_ttl` or when `ttl` has been
21251 /// exceeded, whichever occurs first.
21252 pub idle_ttl: std::option::Option<wkt::Duration>,
21253
21254 /// Optional. The duration after which the workload will be terminated,
21255 /// specified as the JSON representation for
21256 /// [Duration](https://protobuf.dev/programming-guides/proto3/#json).
21257 /// When the workload exceeds this duration, it will be unconditionally
21258 /// terminated without waiting for ongoing work to finish. If `ttl` is not
21259 /// specified for a batch workload, the workload will be allowed to run until
21260 /// it exits naturally (or run forever without exiting). If `ttl` is not
21261 /// specified for an interactive session, it defaults to 24 hours. If `ttl` is
21262 /// not specified for a batch that uses 2.1+ runtime version, it defaults to 4
21263 /// hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl`
21264 /// and `idle_ttl` are specified (for an interactive session), the conditions
21265 /// are treated as `OR` conditions: the workload will be terminated when it has
21266 /// been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs
21267 /// first.
21268 pub ttl: std::option::Option<wkt::Duration>,
21269
21270 /// Optional. A Cloud Storage bucket used to stage workload dependencies,
21271 /// config files, and store workload output and other ephemeral data, such as
21272 /// Spark history files. If you do not specify a staging bucket, Cloud Dataproc
21273 /// will determine a Cloud Storage location according to the region where your
21274 /// workload is running, and then create and manage project-level, per-location
21275 /// staging and temporary buckets.
21276 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
21277 /// a Cloud Storage bucket.**
21278 pub staging_bucket: std::string::String,
21279
21280 /// Optional. Authentication configuration used to set the default identity for
21281 /// the workload execution. The config specifies the type of identity
21282 /// (service account or user) that will be used by workloads to access
21283 /// resources on the project(s).
21284 pub authentication_config: std::option::Option<crate::model::AuthenticationConfig>,
21285
21286 /// Optional. Associates Resource Manager tags with the workload nodes.
21287 /// There is a max limit of 30 tags.
21288 /// Keys and values can be either in numeric format, such as
21289 /// `tagKeys/{tag_key_id}` and `tagValues/{tag_value_id}`, or in namespaced
21290 /// format, such as `{org_id|project_id}/{tag_key_short_name}` and
21291 /// `{tag_value_short_name}`.
21292 pub resource_manager_tags: std::collections::HashMap<std::string::String, std::string::String>,
21293
21294 /// Network configuration for workload execution.
21295 pub network: std::option::Option<crate::model::execution_config::Network>,
21296
21297 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21298}
21299
21300impl ExecutionConfig {
21301 /// Creates a new default instance.
21302 pub fn new() -> Self {
21303 std::default::Default::default()
21304 }
21305
21306 /// Sets the value of [service_account][crate::model::ExecutionConfig::service_account].
21307 ///
21308 /// # Example
21309 /// ```ignore,no_run
21310 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21311 /// let x = ExecutionConfig::new().set_service_account("example");
21312 /// ```
21313 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21314 self.service_account = v.into();
21315 self
21316 }
21317
21318 /// Sets the value of [network_tags][crate::model::ExecutionConfig::network_tags].
21319 ///
21320 /// # Example
21321 /// ```ignore,no_run
21322 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21323 /// let x = ExecutionConfig::new().set_network_tags(["a", "b", "c"]);
21324 /// ```
21325 pub fn set_network_tags<T, V>(mut self, v: T) -> Self
21326 where
21327 T: std::iter::IntoIterator<Item = V>,
21328 V: std::convert::Into<std::string::String>,
21329 {
21330 use std::iter::Iterator;
21331 self.network_tags = v.into_iter().map(|i| i.into()).collect();
21332 self
21333 }
21334
21335 /// Sets the value of [kms_key][crate::model::ExecutionConfig::kms_key].
21336 ///
21337 /// # Example
21338 /// ```ignore,no_run
21339 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21340 /// let x = ExecutionConfig::new().set_kms_key("example");
21341 /// ```
21342 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21343 self.kms_key = v.into();
21344 self
21345 }
21346
21347 /// Sets the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
21348 ///
21349 /// # Example
21350 /// ```ignore,no_run
21351 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21352 /// use wkt::Duration;
21353 /// let x = ExecutionConfig::new().set_idle_ttl(Duration::default()/* use setters */);
21354 /// ```
21355 pub fn set_idle_ttl<T>(mut self, v: T) -> Self
21356 where
21357 T: std::convert::Into<wkt::Duration>,
21358 {
21359 self.idle_ttl = std::option::Option::Some(v.into());
21360 self
21361 }
21362
21363 /// Sets or clears the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
21364 ///
21365 /// # Example
21366 /// ```ignore,no_run
21367 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21368 /// use wkt::Duration;
21369 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(Some(Duration::default()/* use setters */));
21370 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(None::<Duration>);
21371 /// ```
21372 pub fn set_or_clear_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
21373 where
21374 T: std::convert::Into<wkt::Duration>,
21375 {
21376 self.idle_ttl = v.map(|x| x.into());
21377 self
21378 }
21379
21380 /// Sets the value of [ttl][crate::model::ExecutionConfig::ttl].
21381 ///
21382 /// # Example
21383 /// ```ignore,no_run
21384 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21385 /// use wkt::Duration;
21386 /// let x = ExecutionConfig::new().set_ttl(Duration::default()/* use setters */);
21387 /// ```
21388 pub fn set_ttl<T>(mut self, v: T) -> Self
21389 where
21390 T: std::convert::Into<wkt::Duration>,
21391 {
21392 self.ttl = std::option::Option::Some(v.into());
21393 self
21394 }
21395
21396 /// Sets or clears the value of [ttl][crate::model::ExecutionConfig::ttl].
21397 ///
21398 /// # Example
21399 /// ```ignore,no_run
21400 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21401 /// use wkt::Duration;
21402 /// let x = ExecutionConfig::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
21403 /// let x = ExecutionConfig::new().set_or_clear_ttl(None::<Duration>);
21404 /// ```
21405 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
21406 where
21407 T: std::convert::Into<wkt::Duration>,
21408 {
21409 self.ttl = v.map(|x| x.into());
21410 self
21411 }
21412
21413 /// Sets the value of [staging_bucket][crate::model::ExecutionConfig::staging_bucket].
21414 ///
21415 /// # Example
21416 /// ```ignore,no_run
21417 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21418 /// let x = ExecutionConfig::new().set_staging_bucket("example");
21419 /// ```
21420 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21421 self.staging_bucket = v.into();
21422 self
21423 }
21424
21425 /// Sets the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
21426 ///
21427 /// # Example
21428 /// ```ignore,no_run
21429 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21430 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
21431 /// let x = ExecutionConfig::new().set_authentication_config(AuthenticationConfig::default()/* use setters */);
21432 /// ```
21433 pub fn set_authentication_config<T>(mut self, v: T) -> Self
21434 where
21435 T: std::convert::Into<crate::model::AuthenticationConfig>,
21436 {
21437 self.authentication_config = std::option::Option::Some(v.into());
21438 self
21439 }
21440
21441 /// Sets or clears the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
21442 ///
21443 /// # Example
21444 /// ```ignore,no_run
21445 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21446 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
21447 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(Some(AuthenticationConfig::default()/* use setters */));
21448 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(None::<AuthenticationConfig>);
21449 /// ```
21450 pub fn set_or_clear_authentication_config<T>(mut self, v: std::option::Option<T>) -> Self
21451 where
21452 T: std::convert::Into<crate::model::AuthenticationConfig>,
21453 {
21454 self.authentication_config = v.map(|x| x.into());
21455 self
21456 }
21457
21458 /// Sets the value of [resource_manager_tags][crate::model::ExecutionConfig::resource_manager_tags].
21459 ///
21460 /// # Example
21461 /// ```ignore,no_run
21462 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21463 /// let x = ExecutionConfig::new().set_resource_manager_tags([
21464 /// ("key0", "abc"),
21465 /// ("key1", "xyz"),
21466 /// ]);
21467 /// ```
21468 pub fn set_resource_manager_tags<T, K, V>(mut self, v: T) -> Self
21469 where
21470 T: std::iter::IntoIterator<Item = (K, V)>,
21471 K: std::convert::Into<std::string::String>,
21472 V: std::convert::Into<std::string::String>,
21473 {
21474 use std::iter::Iterator;
21475 self.resource_manager_tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21476 self
21477 }
21478
21479 /// Sets the value of [network][crate::model::ExecutionConfig::network].
21480 ///
21481 /// Note that all the setters affecting `network` are mutually
21482 /// exclusive.
21483 ///
21484 /// # Example
21485 /// ```ignore,no_run
21486 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21487 /// use google_cloud_dataproc_v1::model::execution_config::Network;
21488 /// let x = ExecutionConfig::new().set_network(Some(Network::NetworkUri("example".to_string())));
21489 /// ```
21490 pub fn set_network<
21491 T: std::convert::Into<std::option::Option<crate::model::execution_config::Network>>,
21492 >(
21493 mut self,
21494 v: T,
21495 ) -> Self {
21496 self.network = v.into();
21497 self
21498 }
21499
21500 /// The value of [network][crate::model::ExecutionConfig::network]
21501 /// if it holds a `NetworkUri`, `None` if the field is not set or
21502 /// holds a different branch.
21503 pub fn network_uri(&self) -> std::option::Option<&std::string::String> {
21504 #[allow(unreachable_patterns)]
21505 self.network.as_ref().and_then(|v| match v {
21506 crate::model::execution_config::Network::NetworkUri(v) => std::option::Option::Some(v),
21507 _ => std::option::Option::None,
21508 })
21509 }
21510
21511 /// Sets the value of [network][crate::model::ExecutionConfig::network]
21512 /// to hold a `NetworkUri`.
21513 ///
21514 /// Note that all the setters affecting `network` are
21515 /// mutually exclusive.
21516 ///
21517 /// # Example
21518 /// ```ignore,no_run
21519 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21520 /// let x = ExecutionConfig::new().set_network_uri("example");
21521 /// assert!(x.network_uri().is_some());
21522 /// assert!(x.subnetwork_uri().is_none());
21523 /// ```
21524 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21525 self.network = std::option::Option::Some(
21526 crate::model::execution_config::Network::NetworkUri(v.into()),
21527 );
21528 self
21529 }
21530
21531 /// The value of [network][crate::model::ExecutionConfig::network]
21532 /// if it holds a `SubnetworkUri`, `None` if the field is not set or
21533 /// holds a different branch.
21534 pub fn subnetwork_uri(&self) -> std::option::Option<&std::string::String> {
21535 #[allow(unreachable_patterns)]
21536 self.network.as_ref().and_then(|v| match v {
21537 crate::model::execution_config::Network::SubnetworkUri(v) => {
21538 std::option::Option::Some(v)
21539 }
21540 _ => std::option::Option::None,
21541 })
21542 }
21543
21544 /// Sets the value of [network][crate::model::ExecutionConfig::network]
21545 /// to hold a `SubnetworkUri`.
21546 ///
21547 /// Note that all the setters affecting `network` are
21548 /// mutually exclusive.
21549 ///
21550 /// # Example
21551 /// ```ignore,no_run
21552 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
21553 /// let x = ExecutionConfig::new().set_subnetwork_uri("example");
21554 /// assert!(x.subnetwork_uri().is_some());
21555 /// assert!(x.network_uri().is_none());
21556 /// ```
21557 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21558 self.network = std::option::Option::Some(
21559 crate::model::execution_config::Network::SubnetworkUri(v.into()),
21560 );
21561 self
21562 }
21563}
21564
21565impl wkt::message::Message for ExecutionConfig {
21566 fn typename() -> &'static str {
21567 "type.googleapis.com/google.cloud.dataproc.v1.ExecutionConfig"
21568 }
21569}
21570
21571/// Defines additional types related to [ExecutionConfig].
21572pub mod execution_config {
21573 #[allow(unused_imports)]
21574 use super::*;
21575
21576 /// Network configuration for workload execution.
21577 #[derive(Clone, Debug, PartialEq)]
21578 #[non_exhaustive]
21579 pub enum Network {
21580 /// Optional. Network URI to connect workload to.
21581 NetworkUri(std::string::String),
21582 /// Optional. Subnetwork URI to connect workload to.
21583 SubnetworkUri(std::string::String),
21584 }
21585}
21586
21587/// Spark History Server configuration for the workload.
21588#[derive(Clone, Default, PartialEq)]
21589#[non_exhaustive]
21590pub struct SparkHistoryServerConfig {
21591 /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark
21592 /// History Server for the workload.
21593 ///
21594 /// Example:
21595 ///
21596 /// * `projects/[project_id]/regions/[region]/clusters/[cluster_name]`
21597 pub dataproc_cluster: std::string::String,
21598
21599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21600}
21601
21602impl SparkHistoryServerConfig {
21603 /// Creates a new default instance.
21604 pub fn new() -> Self {
21605 std::default::Default::default()
21606 }
21607
21608 /// Sets the value of [dataproc_cluster][crate::model::SparkHistoryServerConfig::dataproc_cluster].
21609 ///
21610 /// # Example
21611 /// ```ignore,no_run
21612 /// # use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
21613 /// let x = SparkHistoryServerConfig::new().set_dataproc_cluster("example");
21614 /// ```
21615 pub fn set_dataproc_cluster<T: std::convert::Into<std::string::String>>(
21616 mut self,
21617 v: T,
21618 ) -> Self {
21619 self.dataproc_cluster = v.into();
21620 self
21621 }
21622}
21623
21624impl wkt::message::Message for SparkHistoryServerConfig {
21625 fn typename() -> &'static str {
21626 "type.googleapis.com/google.cloud.dataproc.v1.SparkHistoryServerConfig"
21627 }
21628}
21629
21630/// Auxiliary services configuration for a workload.
21631#[derive(Clone, Default, PartialEq)]
21632#[non_exhaustive]
21633pub struct PeripheralsConfig {
21634 /// Optional. Resource name of an existing Dataproc Metastore service.
21635 ///
21636 /// Example:
21637 ///
21638 /// * `projects/[project_id]/locations/[region]/services/[service_id]`
21639 pub metastore_service: std::string::String,
21640
21641 /// Optional. The Spark History Server configuration for the workload.
21642 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
21643
21644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21645}
21646
21647impl PeripheralsConfig {
21648 /// Creates a new default instance.
21649 pub fn new() -> Self {
21650 std::default::Default::default()
21651 }
21652
21653 /// Sets the value of [metastore_service][crate::model::PeripheralsConfig::metastore_service].
21654 ///
21655 /// # Example
21656 /// ```ignore,no_run
21657 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
21658 /// let x = PeripheralsConfig::new().set_metastore_service("example");
21659 /// ```
21660 pub fn set_metastore_service<T: std::convert::Into<std::string::String>>(
21661 mut self,
21662 v: T,
21663 ) -> Self {
21664 self.metastore_service = v.into();
21665 self
21666 }
21667
21668 /// Sets the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
21669 ///
21670 /// # Example
21671 /// ```ignore,no_run
21672 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
21673 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
21674 /// let x = PeripheralsConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
21675 /// ```
21676 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
21677 where
21678 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
21679 {
21680 self.spark_history_server_config = std::option::Option::Some(v.into());
21681 self
21682 }
21683
21684 /// Sets or clears the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
21685 ///
21686 /// # Example
21687 /// ```ignore,no_run
21688 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
21689 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
21690 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
21691 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
21692 /// ```
21693 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
21694 where
21695 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
21696 {
21697 self.spark_history_server_config = v.map(|x| x.into());
21698 self
21699 }
21700}
21701
21702impl wkt::message::Message for PeripheralsConfig {
21703 fn typename() -> &'static str {
21704 "type.googleapis.com/google.cloud.dataproc.v1.PeripheralsConfig"
21705 }
21706}
21707
21708/// Runtime information about workload execution.
21709#[derive(Clone, Default, PartialEq)]
21710#[non_exhaustive]
21711pub struct RuntimeInfo {
21712 /// Output only. Map of remote access endpoints (such as web interfaces and
21713 /// APIs) to their URIs.
21714 pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
21715
21716 /// Output only. A URI pointing to the location of the stdout and stderr of the
21717 /// workload.
21718 pub output_uri: std::string::String,
21719
21720 /// Output only. A URI pointing to the location of the diagnostics tarball.
21721 pub diagnostic_output_uri: std::string::String,
21722
21723 /// Output only. Approximate workload resource usage, calculated when
21724 /// the workload completes (see [Dataproc Serverless pricing]
21725 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21726 ///
21727 /// **Note:** This metric calculation may change in the future, for
21728 /// example, to capture cumulative workload resource
21729 /// consumption during workload execution (see the
21730 /// [Dataproc Serverless release notes]
21731 /// (<https://cloud.google.com/dataproc-serverless/docs/release-notes>)
21732 /// for announcements, changes, fixes
21733 /// and other Dataproc developments).
21734 pub approximate_usage: std::option::Option<crate::model::UsageMetrics>,
21735
21736 /// Output only. Snapshot of current workload resource usage.
21737 pub current_usage: std::option::Option<crate::model::UsageSnapshot>,
21738
21739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21740}
21741
21742impl RuntimeInfo {
21743 /// Creates a new default instance.
21744 pub fn new() -> Self {
21745 std::default::Default::default()
21746 }
21747
21748 /// Sets the value of [endpoints][crate::model::RuntimeInfo::endpoints].
21749 ///
21750 /// # Example
21751 /// ```ignore,no_run
21752 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21753 /// let x = RuntimeInfo::new().set_endpoints([
21754 /// ("key0", "abc"),
21755 /// ("key1", "xyz"),
21756 /// ]);
21757 /// ```
21758 pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
21759 where
21760 T: std::iter::IntoIterator<Item = (K, V)>,
21761 K: std::convert::Into<std::string::String>,
21762 V: std::convert::Into<std::string::String>,
21763 {
21764 use std::iter::Iterator;
21765 self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21766 self
21767 }
21768
21769 /// Sets the value of [output_uri][crate::model::RuntimeInfo::output_uri].
21770 ///
21771 /// # Example
21772 /// ```ignore,no_run
21773 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21774 /// let x = RuntimeInfo::new().set_output_uri("example");
21775 /// ```
21776 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21777 self.output_uri = v.into();
21778 self
21779 }
21780
21781 /// Sets the value of [diagnostic_output_uri][crate::model::RuntimeInfo::diagnostic_output_uri].
21782 ///
21783 /// # Example
21784 /// ```ignore,no_run
21785 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21786 /// let x = RuntimeInfo::new().set_diagnostic_output_uri("example");
21787 /// ```
21788 pub fn set_diagnostic_output_uri<T: std::convert::Into<std::string::String>>(
21789 mut self,
21790 v: T,
21791 ) -> Self {
21792 self.diagnostic_output_uri = v.into();
21793 self
21794 }
21795
21796 /// Sets the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
21797 ///
21798 /// # Example
21799 /// ```ignore,no_run
21800 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21801 /// use google_cloud_dataproc_v1::model::UsageMetrics;
21802 /// let x = RuntimeInfo::new().set_approximate_usage(UsageMetrics::default()/* use setters */);
21803 /// ```
21804 pub fn set_approximate_usage<T>(mut self, v: T) -> Self
21805 where
21806 T: std::convert::Into<crate::model::UsageMetrics>,
21807 {
21808 self.approximate_usage = std::option::Option::Some(v.into());
21809 self
21810 }
21811
21812 /// Sets or clears the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
21813 ///
21814 /// # Example
21815 /// ```ignore,no_run
21816 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21817 /// use google_cloud_dataproc_v1::model::UsageMetrics;
21818 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(Some(UsageMetrics::default()/* use setters */));
21819 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(None::<UsageMetrics>);
21820 /// ```
21821 pub fn set_or_clear_approximate_usage<T>(mut self, v: std::option::Option<T>) -> Self
21822 where
21823 T: std::convert::Into<crate::model::UsageMetrics>,
21824 {
21825 self.approximate_usage = v.map(|x| x.into());
21826 self
21827 }
21828
21829 /// Sets the value of [current_usage][crate::model::RuntimeInfo::current_usage].
21830 ///
21831 /// # Example
21832 /// ```ignore,no_run
21833 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21834 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
21835 /// let x = RuntimeInfo::new().set_current_usage(UsageSnapshot::default()/* use setters */);
21836 /// ```
21837 pub fn set_current_usage<T>(mut self, v: T) -> Self
21838 where
21839 T: std::convert::Into<crate::model::UsageSnapshot>,
21840 {
21841 self.current_usage = std::option::Option::Some(v.into());
21842 self
21843 }
21844
21845 /// Sets or clears the value of [current_usage][crate::model::RuntimeInfo::current_usage].
21846 ///
21847 /// # Example
21848 /// ```ignore,no_run
21849 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21850 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
21851 /// let x = RuntimeInfo::new().set_or_clear_current_usage(Some(UsageSnapshot::default()/* use setters */));
21852 /// let x = RuntimeInfo::new().set_or_clear_current_usage(None::<UsageSnapshot>);
21853 /// ```
21854 pub fn set_or_clear_current_usage<T>(mut self, v: std::option::Option<T>) -> Self
21855 where
21856 T: std::convert::Into<crate::model::UsageSnapshot>,
21857 {
21858 self.current_usage = v.map(|x| x.into());
21859 self
21860 }
21861}
21862
21863impl wkt::message::Message for RuntimeInfo {
21864 fn typename() -> &'static str {
21865 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeInfo"
21866 }
21867}
21868
21869/// Usage metrics represent approximate total resources consumed by a workload.
21870#[derive(Clone, Default, PartialEq)]
21871#[non_exhaustive]
21872pub struct UsageMetrics {
21873 /// Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`)
21874 /// (see [Dataproc Serverless pricing]
21875 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21876 pub milli_dcu_seconds: i64,
21877
21878 /// Optional. Shuffle storage usage in (`GB` x `seconds`) (see
21879 /// [Dataproc Serverless pricing]
21880 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21881 pub shuffle_storage_gb_seconds: i64,
21882
21883 /// Optional. [DEPRECATED] Accelerator usage in (`milliAccelerator` x
21884 /// `seconds`) (see [Dataproc Serverless pricing]
21885 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21886 pub milli_accelerator_seconds: i64,
21887
21888 /// Optional. [DEPRECATED] Accelerator type being used, if any
21889 pub accelerator_type: std::string::String,
21890
21891 /// Optional. The timestamp of the usage metrics.
21892 pub update_time: std::option::Option<wkt::Timestamp>,
21893
21894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21895}
21896
21897impl UsageMetrics {
21898 /// Creates a new default instance.
21899 pub fn new() -> Self {
21900 std::default::Default::default()
21901 }
21902
21903 /// Sets the value of [milli_dcu_seconds][crate::model::UsageMetrics::milli_dcu_seconds].
21904 ///
21905 /// # Example
21906 /// ```ignore,no_run
21907 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21908 /// let x = UsageMetrics::new().set_milli_dcu_seconds(42);
21909 /// ```
21910 pub fn set_milli_dcu_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21911 self.milli_dcu_seconds = v.into();
21912 self
21913 }
21914
21915 /// Sets the value of [shuffle_storage_gb_seconds][crate::model::UsageMetrics::shuffle_storage_gb_seconds].
21916 ///
21917 /// # Example
21918 /// ```ignore,no_run
21919 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21920 /// let x = UsageMetrics::new().set_shuffle_storage_gb_seconds(42);
21921 /// ```
21922 pub fn set_shuffle_storage_gb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21923 self.shuffle_storage_gb_seconds = v.into();
21924 self
21925 }
21926
21927 /// Sets the value of [milli_accelerator_seconds][crate::model::UsageMetrics::milli_accelerator_seconds].
21928 ///
21929 /// # Example
21930 /// ```ignore,no_run
21931 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21932 /// let x = UsageMetrics::new().set_milli_accelerator_seconds(42);
21933 /// ```
21934 pub fn set_milli_accelerator_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21935 self.milli_accelerator_seconds = v.into();
21936 self
21937 }
21938
21939 /// Sets the value of [accelerator_type][crate::model::UsageMetrics::accelerator_type].
21940 ///
21941 /// # Example
21942 /// ```ignore,no_run
21943 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21944 /// let x = UsageMetrics::new().set_accelerator_type("example");
21945 /// ```
21946 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21947 mut self,
21948 v: T,
21949 ) -> Self {
21950 self.accelerator_type = v.into();
21951 self
21952 }
21953
21954 /// Sets the value of [update_time][crate::model::UsageMetrics::update_time].
21955 ///
21956 /// # Example
21957 /// ```ignore,no_run
21958 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21959 /// use wkt::Timestamp;
21960 /// let x = UsageMetrics::new().set_update_time(Timestamp::default()/* use setters */);
21961 /// ```
21962 pub fn set_update_time<T>(mut self, v: T) -> Self
21963 where
21964 T: std::convert::Into<wkt::Timestamp>,
21965 {
21966 self.update_time = std::option::Option::Some(v.into());
21967 self
21968 }
21969
21970 /// Sets or clears the value of [update_time][crate::model::UsageMetrics::update_time].
21971 ///
21972 /// # Example
21973 /// ```ignore,no_run
21974 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21975 /// use wkt::Timestamp;
21976 /// let x = UsageMetrics::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
21977 /// let x = UsageMetrics::new().set_or_clear_update_time(None::<Timestamp>);
21978 /// ```
21979 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
21980 where
21981 T: std::convert::Into<wkt::Timestamp>,
21982 {
21983 self.update_time = v.map(|x| x.into());
21984 self
21985 }
21986}
21987
21988impl wkt::message::Message for UsageMetrics {
21989 fn typename() -> &'static str {
21990 "type.googleapis.com/google.cloud.dataproc.v1.UsageMetrics"
21991 }
21992}
21993
21994/// The usage snapshot represents the resources consumed by a workload at a
21995/// specified time.
21996#[derive(Clone, Default, PartialEq)]
21997#[non_exhaustive]
21998pub struct UsageSnapshot {
21999 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see
22000 /// [Dataproc Serverless pricing]
22001 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
22002 pub milli_dcu: i64,
22003
22004 /// Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless
22005 /// pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
22006 pub shuffle_storage_gb: i64,
22007
22008 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at
22009 /// premium tier (see [Dataproc Serverless pricing]
22010 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
22011 pub milli_dcu_premium: i64,
22012
22013 /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see
22014 /// [Dataproc Serverless pricing]
22015 /// (<https://cloud.google.com/dataproc-serverless/pricing>))
22016 pub shuffle_storage_gb_premium: i64,
22017
22018 /// Optional. Milli (one-thousandth) accelerator. (see [Dataproc
22019 /// Serverless pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
22020 pub milli_accelerator: i64,
22021
22022 /// Optional. Accelerator type being used, if any
22023 pub accelerator_type: std::string::String,
22024
22025 /// Optional. The timestamp of the usage snapshot.
22026 pub snapshot_time: std::option::Option<wkt::Timestamp>,
22027
22028 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22029}
22030
22031impl UsageSnapshot {
22032 /// Creates a new default instance.
22033 pub fn new() -> Self {
22034 std::default::Default::default()
22035 }
22036
22037 /// Sets the value of [milli_dcu][crate::model::UsageSnapshot::milli_dcu].
22038 ///
22039 /// # Example
22040 /// ```ignore,no_run
22041 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22042 /// let x = UsageSnapshot::new().set_milli_dcu(42);
22043 /// ```
22044 pub fn set_milli_dcu<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22045 self.milli_dcu = v.into();
22046 self
22047 }
22048
22049 /// Sets the value of [shuffle_storage_gb][crate::model::UsageSnapshot::shuffle_storage_gb].
22050 ///
22051 /// # Example
22052 /// ```ignore,no_run
22053 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22054 /// let x = UsageSnapshot::new().set_shuffle_storage_gb(42);
22055 /// ```
22056 pub fn set_shuffle_storage_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22057 self.shuffle_storage_gb = v.into();
22058 self
22059 }
22060
22061 /// Sets the value of [milli_dcu_premium][crate::model::UsageSnapshot::milli_dcu_premium].
22062 ///
22063 /// # Example
22064 /// ```ignore,no_run
22065 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22066 /// let x = UsageSnapshot::new().set_milli_dcu_premium(42);
22067 /// ```
22068 pub fn set_milli_dcu_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22069 self.milli_dcu_premium = v.into();
22070 self
22071 }
22072
22073 /// Sets the value of [shuffle_storage_gb_premium][crate::model::UsageSnapshot::shuffle_storage_gb_premium].
22074 ///
22075 /// # Example
22076 /// ```ignore,no_run
22077 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22078 /// let x = UsageSnapshot::new().set_shuffle_storage_gb_premium(42);
22079 /// ```
22080 pub fn set_shuffle_storage_gb_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22081 self.shuffle_storage_gb_premium = v.into();
22082 self
22083 }
22084
22085 /// Sets the value of [milli_accelerator][crate::model::UsageSnapshot::milli_accelerator].
22086 ///
22087 /// # Example
22088 /// ```ignore,no_run
22089 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22090 /// let x = UsageSnapshot::new().set_milli_accelerator(42);
22091 /// ```
22092 pub fn set_milli_accelerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22093 self.milli_accelerator = v.into();
22094 self
22095 }
22096
22097 /// Sets the value of [accelerator_type][crate::model::UsageSnapshot::accelerator_type].
22098 ///
22099 /// # Example
22100 /// ```ignore,no_run
22101 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22102 /// let x = UsageSnapshot::new().set_accelerator_type("example");
22103 /// ```
22104 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
22105 mut self,
22106 v: T,
22107 ) -> Self {
22108 self.accelerator_type = v.into();
22109 self
22110 }
22111
22112 /// Sets the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
22113 ///
22114 /// # Example
22115 /// ```ignore,no_run
22116 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22117 /// use wkt::Timestamp;
22118 /// let x = UsageSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
22119 /// ```
22120 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
22121 where
22122 T: std::convert::Into<wkt::Timestamp>,
22123 {
22124 self.snapshot_time = std::option::Option::Some(v.into());
22125 self
22126 }
22127
22128 /// Sets or clears the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
22129 ///
22130 /// # Example
22131 /// ```ignore,no_run
22132 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
22133 /// use wkt::Timestamp;
22134 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
22135 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
22136 /// ```
22137 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
22138 where
22139 T: std::convert::Into<wkt::Timestamp>,
22140 {
22141 self.snapshot_time = v.map(|x| x.into());
22142 self
22143 }
22144}
22145
22146impl wkt::message::Message for UsageSnapshot {
22147 fn typename() -> &'static str {
22148 "type.googleapis.com/google.cloud.dataproc.v1.UsageSnapshot"
22149 }
22150}
22151
22152/// The cluster's GKE config.
22153#[derive(Clone, Default, PartialEq)]
22154#[non_exhaustive]
22155pub struct GkeClusterConfig {
22156 /// Optional. A target GKE cluster to deploy to. It must be in the same project
22157 /// and region as the Dataproc cluster (the GKE cluster can be zonal or
22158 /// regional). Format:
22159 /// 'projects/{project}/locations/{location}/clusters/{cluster_id}'
22160 pub gke_cluster_target: std::string::String,
22161
22162 /// Optional. GKE node pools where workloads will be scheduled. At least one
22163 /// node pool must be assigned the `DEFAULT`
22164 /// [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role].
22165 /// If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT`
22166 /// `GkeNodePoolTarget`. Each role can be given to only one
22167 /// `GkeNodePoolTarget`. All node pools must have the same location settings.
22168 ///
22169 /// [google.cloud.dataproc.v1.GkeNodePoolTarget.Role]: crate::model::gke_node_pool_target::Role
22170 pub node_pool_target: std::vec::Vec<crate::model::GkeNodePoolTarget>,
22171
22172 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22173}
22174
22175impl GkeClusterConfig {
22176 /// Creates a new default instance.
22177 pub fn new() -> Self {
22178 std::default::Default::default()
22179 }
22180
22181 /// Sets the value of [gke_cluster_target][crate::model::GkeClusterConfig::gke_cluster_target].
22182 ///
22183 /// # Example
22184 /// ```ignore,no_run
22185 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
22186 /// let x = GkeClusterConfig::new().set_gke_cluster_target("example");
22187 /// ```
22188 pub fn set_gke_cluster_target<T: std::convert::Into<std::string::String>>(
22189 mut self,
22190 v: T,
22191 ) -> Self {
22192 self.gke_cluster_target = v.into();
22193 self
22194 }
22195
22196 /// Sets the value of [node_pool_target][crate::model::GkeClusterConfig::node_pool_target].
22197 ///
22198 /// # Example
22199 /// ```ignore,no_run
22200 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
22201 /// use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
22202 /// let x = GkeClusterConfig::new()
22203 /// .set_node_pool_target([
22204 /// GkeNodePoolTarget::default()/* use setters */,
22205 /// GkeNodePoolTarget::default()/* use (different) setters */,
22206 /// ]);
22207 /// ```
22208 pub fn set_node_pool_target<T, V>(mut self, v: T) -> Self
22209 where
22210 T: std::iter::IntoIterator<Item = V>,
22211 V: std::convert::Into<crate::model::GkeNodePoolTarget>,
22212 {
22213 use std::iter::Iterator;
22214 self.node_pool_target = v.into_iter().map(|i| i.into()).collect();
22215 self
22216 }
22217}
22218
22219impl wkt::message::Message for GkeClusterConfig {
22220 fn typename() -> &'static str {
22221 "type.googleapis.com/google.cloud.dataproc.v1.GkeClusterConfig"
22222 }
22223}
22224
22225/// The configuration for running the Dataproc cluster on Kubernetes.
22226#[derive(Clone, Default, PartialEq)]
22227#[non_exhaustive]
22228pub struct KubernetesClusterConfig {
22229 /// Optional. A namespace within the Kubernetes cluster to deploy into. If this
22230 /// namespace does not exist, it is created. If it exists, Dataproc verifies
22231 /// that another Dataproc VirtualCluster is not installed into it. If not
22232 /// specified, the name of the Dataproc Cluster is used.
22233 pub kubernetes_namespace: std::string::String,
22234
22235 /// Optional. The software configuration for this Dataproc cluster running on
22236 /// Kubernetes.
22237 pub kubernetes_software_config: std::option::Option<crate::model::KubernetesSoftwareConfig>,
22238
22239 #[allow(missing_docs)]
22240 pub config: std::option::Option<crate::model::kubernetes_cluster_config::Config>,
22241
22242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22243}
22244
22245impl KubernetesClusterConfig {
22246 /// Creates a new default instance.
22247 pub fn new() -> Self {
22248 std::default::Default::default()
22249 }
22250
22251 /// Sets the value of [kubernetes_namespace][crate::model::KubernetesClusterConfig::kubernetes_namespace].
22252 ///
22253 /// # Example
22254 /// ```ignore,no_run
22255 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
22256 /// let x = KubernetesClusterConfig::new().set_kubernetes_namespace("example");
22257 /// ```
22258 pub fn set_kubernetes_namespace<T: std::convert::Into<std::string::String>>(
22259 mut self,
22260 v: T,
22261 ) -> Self {
22262 self.kubernetes_namespace = v.into();
22263 self
22264 }
22265
22266 /// Sets the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
22267 ///
22268 /// # Example
22269 /// ```ignore,no_run
22270 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
22271 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
22272 /// let x = KubernetesClusterConfig::new().set_kubernetes_software_config(KubernetesSoftwareConfig::default()/* use setters */);
22273 /// ```
22274 pub fn set_kubernetes_software_config<T>(mut self, v: T) -> Self
22275 where
22276 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
22277 {
22278 self.kubernetes_software_config = std::option::Option::Some(v.into());
22279 self
22280 }
22281
22282 /// Sets or clears the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
22283 ///
22284 /// # Example
22285 /// ```ignore,no_run
22286 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
22287 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
22288 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(Some(KubernetesSoftwareConfig::default()/* use setters */));
22289 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(None::<KubernetesSoftwareConfig>);
22290 /// ```
22291 pub fn set_or_clear_kubernetes_software_config<T>(mut self, v: std::option::Option<T>) -> Self
22292 where
22293 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
22294 {
22295 self.kubernetes_software_config = v.map(|x| x.into());
22296 self
22297 }
22298
22299 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config].
22300 ///
22301 /// Note that all the setters affecting `config` are mutually
22302 /// exclusive.
22303 ///
22304 /// # Example
22305 /// ```ignore,no_run
22306 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
22307 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
22308 /// let x = KubernetesClusterConfig::new().set_config(Some(
22309 /// google_cloud_dataproc_v1::model::kubernetes_cluster_config::Config::GkeClusterConfig(GkeClusterConfig::default().into())));
22310 /// ```
22311 pub fn set_config<
22312 T: std::convert::Into<std::option::Option<crate::model::kubernetes_cluster_config::Config>>,
22313 >(
22314 mut self,
22315 v: T,
22316 ) -> Self {
22317 self.config = v.into();
22318 self
22319 }
22320
22321 /// The value of [config][crate::model::KubernetesClusterConfig::config]
22322 /// if it holds a `GkeClusterConfig`, `None` if the field is not set or
22323 /// holds a different branch.
22324 pub fn gke_cluster_config(
22325 &self,
22326 ) -> std::option::Option<&std::boxed::Box<crate::model::GkeClusterConfig>> {
22327 #[allow(unreachable_patterns)]
22328 self.config.as_ref().and_then(|v| match v {
22329 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v) => {
22330 std::option::Option::Some(v)
22331 }
22332 _ => std::option::Option::None,
22333 })
22334 }
22335
22336 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config]
22337 /// to hold a `GkeClusterConfig`.
22338 ///
22339 /// Note that all the setters affecting `config` are
22340 /// mutually exclusive.
22341 ///
22342 /// # Example
22343 /// ```ignore,no_run
22344 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
22345 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
22346 /// let x = KubernetesClusterConfig::new().set_gke_cluster_config(GkeClusterConfig::default()/* use setters */);
22347 /// assert!(x.gke_cluster_config().is_some());
22348 /// ```
22349 pub fn set_gke_cluster_config<
22350 T: std::convert::Into<std::boxed::Box<crate::model::GkeClusterConfig>>,
22351 >(
22352 mut self,
22353 v: T,
22354 ) -> Self {
22355 self.config = std::option::Option::Some(
22356 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v.into()),
22357 );
22358 self
22359 }
22360}
22361
22362impl wkt::message::Message for KubernetesClusterConfig {
22363 fn typename() -> &'static str {
22364 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesClusterConfig"
22365 }
22366}
22367
22368/// Defines additional types related to [KubernetesClusterConfig].
22369pub mod kubernetes_cluster_config {
22370 #[allow(unused_imports)]
22371 use super::*;
22372
22373 #[allow(missing_docs)]
22374 #[derive(Clone, Debug, PartialEq)]
22375 #[non_exhaustive]
22376 pub enum Config {
22377 /// Required. The configuration for running the Dataproc cluster on GKE.
22378 GkeClusterConfig(std::boxed::Box<crate::model::GkeClusterConfig>),
22379 }
22380}
22381
22382/// The software configuration for this Dataproc cluster running on Kubernetes.
22383#[derive(Clone, Default, PartialEq)]
22384#[non_exhaustive]
22385pub struct KubernetesSoftwareConfig {
22386 /// The components that should be installed in this Dataproc cluster. The key
22387 /// must be a string from the KubernetesComponent enumeration. The value is
22388 /// the version of the software to be installed.
22389 /// At least one entry must be specified.
22390 pub component_version: std::collections::HashMap<std::string::String, std::string::String>,
22391
22392 /// The properties to set on daemon config files.
22393 ///
22394 /// Property keys are specified in `prefix:property` format, for example
22395 /// `spark:spark.kubernetes.container.image`. The following are supported
22396 /// prefixes and their mappings:
22397 ///
22398 /// * spark: `spark-defaults.conf`
22399 ///
22400 /// For more information, see [Cluster
22401 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
22402 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
22403
22404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22405}
22406
22407impl KubernetesSoftwareConfig {
22408 /// Creates a new default instance.
22409 pub fn new() -> Self {
22410 std::default::Default::default()
22411 }
22412
22413 /// Sets the value of [component_version][crate::model::KubernetesSoftwareConfig::component_version].
22414 ///
22415 /// # Example
22416 /// ```ignore,no_run
22417 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
22418 /// let x = KubernetesSoftwareConfig::new().set_component_version([
22419 /// ("key0", "abc"),
22420 /// ("key1", "xyz"),
22421 /// ]);
22422 /// ```
22423 pub fn set_component_version<T, K, V>(mut self, v: T) -> Self
22424 where
22425 T: std::iter::IntoIterator<Item = (K, V)>,
22426 K: std::convert::Into<std::string::String>,
22427 V: std::convert::Into<std::string::String>,
22428 {
22429 use std::iter::Iterator;
22430 self.component_version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22431 self
22432 }
22433
22434 /// Sets the value of [properties][crate::model::KubernetesSoftwareConfig::properties].
22435 ///
22436 /// # Example
22437 /// ```ignore,no_run
22438 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
22439 /// let x = KubernetesSoftwareConfig::new().set_properties([
22440 /// ("key0", "abc"),
22441 /// ("key1", "xyz"),
22442 /// ]);
22443 /// ```
22444 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
22445 where
22446 T: std::iter::IntoIterator<Item = (K, V)>,
22447 K: std::convert::Into<std::string::String>,
22448 V: std::convert::Into<std::string::String>,
22449 {
22450 use std::iter::Iterator;
22451 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22452 self
22453 }
22454}
22455
22456impl wkt::message::Message for KubernetesSoftwareConfig {
22457 fn typename() -> &'static str {
22458 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesSoftwareConfig"
22459 }
22460}
22461
22462/// GKE node pools that Dataproc workloads run on.
22463#[derive(Clone, Default, PartialEq)]
22464#[non_exhaustive]
22465pub struct GkeNodePoolTarget {
22466 /// Required. The target GKE node pool.
22467 /// Format:
22468 /// 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
22469 pub node_pool: std::string::String,
22470
22471 /// Required. The roles associated with the GKE node pool.
22472 pub roles: std::vec::Vec<crate::model::gke_node_pool_target::Role>,
22473
22474 /// Input only. The configuration for the GKE node pool.
22475 ///
22476 /// If specified, Dataproc attempts to create a node pool with the
22477 /// specified shape. If one with the same name already exists, it is
22478 /// verified against all specified fields. If a field differs, the
22479 /// virtual cluster creation will fail.
22480 ///
22481 /// If omitted, any node pool with the specified name is used. If a
22482 /// node pool with the specified name does not exist, Dataproc create a
22483 /// node pool with default values.
22484 ///
22485 /// This is an input only field. It will not be returned by the API.
22486 pub node_pool_config: std::option::Option<crate::model::GkeNodePoolConfig>,
22487
22488 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22489}
22490
22491impl GkeNodePoolTarget {
22492 /// Creates a new default instance.
22493 pub fn new() -> Self {
22494 std::default::Default::default()
22495 }
22496
22497 /// Sets the value of [node_pool][crate::model::GkeNodePoolTarget::node_pool].
22498 ///
22499 /// # Example
22500 /// ```ignore,no_run
22501 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
22502 /// let x = GkeNodePoolTarget::new().set_node_pool("example");
22503 /// ```
22504 pub fn set_node_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22505 self.node_pool = v.into();
22506 self
22507 }
22508
22509 /// Sets the value of [roles][crate::model::GkeNodePoolTarget::roles].
22510 ///
22511 /// # Example
22512 /// ```ignore,no_run
22513 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
22514 /// use google_cloud_dataproc_v1::model::gke_node_pool_target::Role;
22515 /// let x = GkeNodePoolTarget::new().set_roles([
22516 /// Role::Default,
22517 /// Role::Controller,
22518 /// Role::SparkDriver,
22519 /// ]);
22520 /// ```
22521 pub fn set_roles<T, V>(mut self, v: T) -> Self
22522 where
22523 T: std::iter::IntoIterator<Item = V>,
22524 V: std::convert::Into<crate::model::gke_node_pool_target::Role>,
22525 {
22526 use std::iter::Iterator;
22527 self.roles = v.into_iter().map(|i| i.into()).collect();
22528 self
22529 }
22530
22531 /// Sets the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
22532 ///
22533 /// # Example
22534 /// ```ignore,no_run
22535 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
22536 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22537 /// let x = GkeNodePoolTarget::new().set_node_pool_config(GkeNodePoolConfig::default()/* use setters */);
22538 /// ```
22539 pub fn set_node_pool_config<T>(mut self, v: T) -> Self
22540 where
22541 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
22542 {
22543 self.node_pool_config = std::option::Option::Some(v.into());
22544 self
22545 }
22546
22547 /// Sets or clears the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
22548 ///
22549 /// # Example
22550 /// ```ignore,no_run
22551 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
22552 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22553 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(Some(GkeNodePoolConfig::default()/* use setters */));
22554 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(None::<GkeNodePoolConfig>);
22555 /// ```
22556 pub fn set_or_clear_node_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
22557 where
22558 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
22559 {
22560 self.node_pool_config = v.map(|x| x.into());
22561 self
22562 }
22563}
22564
22565impl wkt::message::Message for GkeNodePoolTarget {
22566 fn typename() -> &'static str {
22567 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolTarget"
22568 }
22569}
22570
22571/// Defines additional types related to [GkeNodePoolTarget].
22572pub mod gke_node_pool_target {
22573 #[allow(unused_imports)]
22574 use super::*;
22575
22576 /// `Role` specifies the tasks that will run on the node pool. Roles can be
22577 /// specific to workloads. Exactly one
22578 /// [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the
22579 /// virtual cluster must have the `DEFAULT` role, which is used to run all
22580 /// workloads that are not associated with a node pool.
22581 ///
22582 /// [google.cloud.dataproc.v1.GkeNodePoolTarget]: crate::model::GkeNodePoolTarget
22583 ///
22584 /// # Working with unknown values
22585 ///
22586 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22587 /// additional enum variants at any time. Adding new variants is not considered
22588 /// a breaking change. Applications should write their code in anticipation of:
22589 ///
22590 /// - New values appearing in future releases of the client library, **and**
22591 /// - New values received dynamically, without application changes.
22592 ///
22593 /// Please consult the [Working with enums] section in the user guide for some
22594 /// guidelines.
22595 ///
22596 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22597 #[derive(Clone, Debug, PartialEq)]
22598 #[non_exhaustive]
22599 pub enum Role {
22600 /// Role is unspecified.
22601 Unspecified,
22602 /// At least one node pool must have the `DEFAULT` role.
22603 /// Work assigned to a role that is not associated with a node pool
22604 /// is assigned to the node pool with the `DEFAULT` role. For example,
22605 /// work assigned to the `CONTROLLER` role will be assigned to the node pool
22606 /// with the `DEFAULT` role if no node pool has the `CONTROLLER` role.
22607 Default,
22608 /// Run work associated with the Dataproc control plane (for example,
22609 /// controllers and webhooks). Very low resource requirements.
22610 Controller,
22611 /// Run work associated with a Spark driver of a job.
22612 SparkDriver,
22613 /// Run work associated with a Spark executor of a job.
22614 SparkExecutor,
22615 /// If set, the enum was initialized with an unknown value.
22616 ///
22617 /// Applications can examine the value using [Role::value] or
22618 /// [Role::name].
22619 UnknownValue(role::UnknownValue),
22620 }
22621
22622 #[doc(hidden)]
22623 pub mod role {
22624 #[allow(unused_imports)]
22625 use super::*;
22626 #[derive(Clone, Debug, PartialEq)]
22627 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22628 }
22629
22630 impl Role {
22631 /// Gets the enum value.
22632 ///
22633 /// Returns `None` if the enum contains an unknown value deserialized from
22634 /// the string representation of enums.
22635 pub fn value(&self) -> std::option::Option<i32> {
22636 match self {
22637 Self::Unspecified => std::option::Option::Some(0),
22638 Self::Default => std::option::Option::Some(1),
22639 Self::Controller => std::option::Option::Some(2),
22640 Self::SparkDriver => std::option::Option::Some(3),
22641 Self::SparkExecutor => std::option::Option::Some(4),
22642 Self::UnknownValue(u) => u.0.value(),
22643 }
22644 }
22645
22646 /// Gets the enum value as a string.
22647 ///
22648 /// Returns `None` if the enum contains an unknown value deserialized from
22649 /// the integer representation of enums.
22650 pub fn name(&self) -> std::option::Option<&str> {
22651 match self {
22652 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
22653 Self::Default => std::option::Option::Some("DEFAULT"),
22654 Self::Controller => std::option::Option::Some("CONTROLLER"),
22655 Self::SparkDriver => std::option::Option::Some("SPARK_DRIVER"),
22656 Self::SparkExecutor => std::option::Option::Some("SPARK_EXECUTOR"),
22657 Self::UnknownValue(u) => u.0.name(),
22658 }
22659 }
22660 }
22661
22662 impl std::default::Default for Role {
22663 fn default() -> Self {
22664 use std::convert::From;
22665 Self::from(0)
22666 }
22667 }
22668
22669 impl std::fmt::Display for Role {
22670 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22671 wkt::internal::display_enum(f, self.name(), self.value())
22672 }
22673 }
22674
22675 impl std::convert::From<i32> for Role {
22676 fn from(value: i32) -> Self {
22677 match value {
22678 0 => Self::Unspecified,
22679 1 => Self::Default,
22680 2 => Self::Controller,
22681 3 => Self::SparkDriver,
22682 4 => Self::SparkExecutor,
22683 _ => Self::UnknownValue(role::UnknownValue(
22684 wkt::internal::UnknownEnumValue::Integer(value),
22685 )),
22686 }
22687 }
22688 }
22689
22690 impl std::convert::From<&str> for Role {
22691 fn from(value: &str) -> Self {
22692 use std::string::ToString;
22693 match value {
22694 "ROLE_UNSPECIFIED" => Self::Unspecified,
22695 "DEFAULT" => Self::Default,
22696 "CONTROLLER" => Self::Controller,
22697 "SPARK_DRIVER" => Self::SparkDriver,
22698 "SPARK_EXECUTOR" => Self::SparkExecutor,
22699 _ => Self::UnknownValue(role::UnknownValue(
22700 wkt::internal::UnknownEnumValue::String(value.to_string()),
22701 )),
22702 }
22703 }
22704 }
22705
22706 impl serde::ser::Serialize for Role {
22707 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22708 where
22709 S: serde::Serializer,
22710 {
22711 match self {
22712 Self::Unspecified => serializer.serialize_i32(0),
22713 Self::Default => serializer.serialize_i32(1),
22714 Self::Controller => serializer.serialize_i32(2),
22715 Self::SparkDriver => serializer.serialize_i32(3),
22716 Self::SparkExecutor => serializer.serialize_i32(4),
22717 Self::UnknownValue(u) => u.0.serialize(serializer),
22718 }
22719 }
22720 }
22721
22722 impl<'de> serde::de::Deserialize<'de> for Role {
22723 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22724 where
22725 D: serde::Deserializer<'de>,
22726 {
22727 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
22728 ".google.cloud.dataproc.v1.GkeNodePoolTarget.Role",
22729 ))
22730 }
22731 }
22732}
22733
22734/// The configuration of a GKE node pool used by a [Dataproc-on-GKE
22735/// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
22736#[derive(Clone, Default, PartialEq)]
22737#[non_exhaustive]
22738pub struct GkeNodePoolConfig {
22739 /// Optional. The node pool configuration.
22740 pub config: std::option::Option<crate::model::gke_node_pool_config::GkeNodeConfig>,
22741
22742 /// Optional. The list of Compute Engine
22743 /// [zones](https://cloud.google.com/compute/docs/zones#available) where
22744 /// node pool nodes associated with a Dataproc on GKE virtual cluster
22745 /// will be located.
22746 ///
22747 /// **Note:** All node pools associated with a virtual cluster
22748 /// must be located in the same region as the virtual cluster, and they must
22749 /// be located in the same zone within that region.
22750 ///
22751 /// If a location is not specified during node pool creation, Dataproc on GKE
22752 /// will choose the zone.
22753 pub locations: std::vec::Vec<std::string::String>,
22754
22755 /// Optional. The autoscaler configuration for this node pool. The autoscaler
22756 /// is enabled only when a valid configuration is present.
22757 pub autoscaling:
22758 std::option::Option<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
22759
22760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22761}
22762
22763impl GkeNodePoolConfig {
22764 /// Creates a new default instance.
22765 pub fn new() -> Self {
22766 std::default::Default::default()
22767 }
22768
22769 /// Sets the value of [config][crate::model::GkeNodePoolConfig::config].
22770 ///
22771 /// # Example
22772 /// ```ignore,no_run
22773 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22774 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22775 /// let x = GkeNodePoolConfig::new().set_config(GkeNodeConfig::default()/* use setters */);
22776 /// ```
22777 pub fn set_config<T>(mut self, v: T) -> Self
22778 where
22779 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
22780 {
22781 self.config = std::option::Option::Some(v.into());
22782 self
22783 }
22784
22785 /// Sets or clears the value of [config][crate::model::GkeNodePoolConfig::config].
22786 ///
22787 /// # Example
22788 /// ```ignore,no_run
22789 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22790 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22791 /// let x = GkeNodePoolConfig::new().set_or_clear_config(Some(GkeNodeConfig::default()/* use setters */));
22792 /// let x = GkeNodePoolConfig::new().set_or_clear_config(None::<GkeNodeConfig>);
22793 /// ```
22794 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
22795 where
22796 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
22797 {
22798 self.config = v.map(|x| x.into());
22799 self
22800 }
22801
22802 /// Sets the value of [locations][crate::model::GkeNodePoolConfig::locations].
22803 ///
22804 /// # Example
22805 /// ```ignore,no_run
22806 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22807 /// let x = GkeNodePoolConfig::new().set_locations(["a", "b", "c"]);
22808 /// ```
22809 pub fn set_locations<T, V>(mut self, v: T) -> Self
22810 where
22811 T: std::iter::IntoIterator<Item = V>,
22812 V: std::convert::Into<std::string::String>,
22813 {
22814 use std::iter::Iterator;
22815 self.locations = v.into_iter().map(|i| i.into()).collect();
22816 self
22817 }
22818
22819 /// Sets the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
22820 ///
22821 /// # Example
22822 /// ```ignore,no_run
22823 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22824 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22825 /// let x = GkeNodePoolConfig::new().set_autoscaling(GkeNodePoolAutoscalingConfig::default()/* use setters */);
22826 /// ```
22827 pub fn set_autoscaling<T>(mut self, v: T) -> Self
22828 where
22829 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
22830 {
22831 self.autoscaling = std::option::Option::Some(v.into());
22832 self
22833 }
22834
22835 /// Sets or clears the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
22836 ///
22837 /// # Example
22838 /// ```ignore,no_run
22839 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22840 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22841 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(Some(GkeNodePoolAutoscalingConfig::default()/* use setters */));
22842 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(None::<GkeNodePoolAutoscalingConfig>);
22843 /// ```
22844 pub fn set_or_clear_autoscaling<T>(mut self, v: std::option::Option<T>) -> Self
22845 where
22846 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
22847 {
22848 self.autoscaling = v.map(|x| x.into());
22849 self
22850 }
22851}
22852
22853impl wkt::message::Message for GkeNodePoolConfig {
22854 fn typename() -> &'static str {
22855 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig"
22856 }
22857}
22858
22859/// Defines additional types related to [GkeNodePoolConfig].
22860pub mod gke_node_pool_config {
22861 #[allow(unused_imports)]
22862 use super::*;
22863
22864 /// Parameters that describe cluster nodes.
22865 #[derive(Clone, Default, PartialEq)]
22866 #[non_exhaustive]
22867 pub struct GkeNodeConfig {
22868 /// Optional. The name of a Compute Engine [machine
22869 /// type](https://cloud.google.com/compute/docs/machine-types).
22870 pub machine_type: std::string::String,
22871
22872 /// Optional. The number of local SSD disks to attach to the node, which is
22873 /// limited by the maximum number of disks allowable per zone (see [Adding
22874 /// Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)).
22875 pub local_ssd_count: i32,
22876
22877 /// Optional. Whether the nodes are created as legacy [preemptible VM
22878 /// instances] (<https://cloud.google.com/compute/docs/instances/preemptible>).
22879 /// Also see
22880 /// [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]
22881 /// VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot
22882 /// preemptible nodes cannot be used in a node pool with the `CONTROLLER`
22883 /// [role]
22884 /// (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
22885 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
22886 /// DEFAULT node pool will assume the CONTROLLER role).
22887 ///
22888 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]: crate::model::gke_node_pool_config::GkeNodeConfig::spot
22889 pub preemptible: bool,
22890
22891 /// Optional. A list of [hardware
22892 /// accelerators](https://cloud.google.com/compute/docs/gpus) to attach to
22893 /// each node.
22894 pub accelerators:
22895 std::vec::Vec<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
22896
22897 /// Optional. [Minimum CPU
22898 /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
22899 /// to be used by this instance. The instance may be scheduled on the
22900 /// specified or a newer CPU platform. Specify the friendly names of CPU
22901 /// platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
22902 pub min_cpu_platform: std::string::String,
22903
22904 /// Optional. The [Customer Managed Encryption Key (CMEK)]
22905 /// (<https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek>)
22906 /// used to encrypt the boot disk attached to each node in the node pool.
22907 /// Specify the key using the following format:
22908 /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`
22909 pub boot_disk_kms_key: std::string::String,
22910
22911 /// Optional. Whether the nodes are created as [Spot VM instances]
22912 /// (<https://cloud.google.com/compute/docs/instances/spot>).
22913 /// Spot VMs are the latest update to legacy
22914 /// [preemptible
22915 /// VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible].
22916 /// Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible
22917 /// nodes cannot be used in a node pool with the `CONTROLLER`
22918 /// [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
22919 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
22920 /// DEFAULT node pool will assume the CONTROLLER role).
22921 ///
22922 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]: crate::model::gke_node_pool_config::GkeNodeConfig::preemptible
22923 pub spot: bool,
22924
22925 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22926 }
22927
22928 impl GkeNodeConfig {
22929 /// Creates a new default instance.
22930 pub fn new() -> Self {
22931 std::default::Default::default()
22932 }
22933
22934 /// Sets the value of [machine_type][crate::model::gke_node_pool_config::GkeNodeConfig::machine_type].
22935 ///
22936 /// # Example
22937 /// ```ignore,no_run
22938 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22939 /// let x = GkeNodeConfig::new().set_machine_type("example");
22940 /// ```
22941 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
22942 mut self,
22943 v: T,
22944 ) -> Self {
22945 self.machine_type = v.into();
22946 self
22947 }
22948
22949 /// Sets the value of [local_ssd_count][crate::model::gke_node_pool_config::GkeNodeConfig::local_ssd_count].
22950 ///
22951 /// # Example
22952 /// ```ignore,no_run
22953 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22954 /// let x = GkeNodeConfig::new().set_local_ssd_count(42);
22955 /// ```
22956 pub fn set_local_ssd_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22957 self.local_ssd_count = v.into();
22958 self
22959 }
22960
22961 /// Sets the value of [preemptible][crate::model::gke_node_pool_config::GkeNodeConfig::preemptible].
22962 ///
22963 /// # Example
22964 /// ```ignore,no_run
22965 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22966 /// let x = GkeNodeConfig::new().set_preemptible(true);
22967 /// ```
22968 pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22969 self.preemptible = v.into();
22970 self
22971 }
22972
22973 /// Sets the value of [accelerators][crate::model::gke_node_pool_config::GkeNodeConfig::accelerators].
22974 ///
22975 /// # Example
22976 /// ```ignore,no_run
22977 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22978 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22979 /// let x = GkeNodeConfig::new()
22980 /// .set_accelerators([
22981 /// GkeNodePoolAcceleratorConfig::default()/* use setters */,
22982 /// GkeNodePoolAcceleratorConfig::default()/* use (different) setters */,
22983 /// ]);
22984 /// ```
22985 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
22986 where
22987 T: std::iter::IntoIterator<Item = V>,
22988 V: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
22989 {
22990 use std::iter::Iterator;
22991 self.accelerators = v.into_iter().map(|i| i.into()).collect();
22992 self
22993 }
22994
22995 /// Sets the value of [min_cpu_platform][crate::model::gke_node_pool_config::GkeNodeConfig::min_cpu_platform].
22996 ///
22997 /// # Example
22998 /// ```ignore,no_run
22999 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
23000 /// let x = GkeNodeConfig::new().set_min_cpu_platform("example");
23001 /// ```
23002 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
23003 mut self,
23004 v: T,
23005 ) -> Self {
23006 self.min_cpu_platform = v.into();
23007 self
23008 }
23009
23010 /// Sets the value of [boot_disk_kms_key][crate::model::gke_node_pool_config::GkeNodeConfig::boot_disk_kms_key].
23011 ///
23012 /// # Example
23013 /// ```ignore,no_run
23014 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
23015 /// let x = GkeNodeConfig::new().set_boot_disk_kms_key("example");
23016 /// ```
23017 pub fn set_boot_disk_kms_key<T: std::convert::Into<std::string::String>>(
23018 mut self,
23019 v: T,
23020 ) -> Self {
23021 self.boot_disk_kms_key = v.into();
23022 self
23023 }
23024
23025 /// Sets the value of [spot][crate::model::gke_node_pool_config::GkeNodeConfig::spot].
23026 ///
23027 /// # Example
23028 /// ```ignore,no_run
23029 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
23030 /// let x = GkeNodeConfig::new().set_spot(true);
23031 /// ```
23032 pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23033 self.spot = v.into();
23034 self
23035 }
23036 }
23037
23038 impl wkt::message::Message for GkeNodeConfig {
23039 fn typename() -> &'static str {
23040 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig"
23041 }
23042 }
23043
23044 /// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request
23045 /// for a node pool.
23046 #[derive(Clone, Default, PartialEq)]
23047 #[non_exhaustive]
23048 pub struct GkeNodePoolAcceleratorConfig {
23049 /// The number of accelerator cards exposed to an instance.
23050 pub accelerator_count: i64,
23051
23052 /// The accelerator type resource namename (see GPUs on Compute Engine).
23053 pub accelerator_type: std::string::String,
23054
23055 /// Size of partitions to create on the GPU. Valid values are described in
23056 /// the NVIDIA [mig user
23057 /// guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
23058 pub gpu_partition_size: std::string::String,
23059
23060 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23061 }
23062
23063 impl GkeNodePoolAcceleratorConfig {
23064 /// Creates a new default instance.
23065 pub fn new() -> Self {
23066 std::default::Default::default()
23067 }
23068
23069 /// Sets the value of [accelerator_count][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_count].
23070 ///
23071 /// # Example
23072 /// ```ignore,no_run
23073 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
23074 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_count(42);
23075 /// ```
23076 pub fn set_accelerator_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
23077 self.accelerator_count = v.into();
23078 self
23079 }
23080
23081 /// Sets the value of [accelerator_type][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_type].
23082 ///
23083 /// # Example
23084 /// ```ignore,no_run
23085 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
23086 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_type("example");
23087 /// ```
23088 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
23089 mut self,
23090 v: T,
23091 ) -> Self {
23092 self.accelerator_type = v.into();
23093 self
23094 }
23095
23096 /// Sets the value of [gpu_partition_size][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::gpu_partition_size].
23097 ///
23098 /// # Example
23099 /// ```ignore,no_run
23100 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
23101 /// let x = GkeNodePoolAcceleratorConfig::new().set_gpu_partition_size("example");
23102 /// ```
23103 pub fn set_gpu_partition_size<T: std::convert::Into<std::string::String>>(
23104 mut self,
23105 v: T,
23106 ) -> Self {
23107 self.gpu_partition_size = v.into();
23108 self
23109 }
23110 }
23111
23112 impl wkt::message::Message for GkeNodePoolAcceleratorConfig {
23113 fn typename() -> &'static str {
23114 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAcceleratorConfig"
23115 }
23116 }
23117
23118 /// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to
23119 /// adjust the size of the node pool to the current cluster usage.
23120 #[derive(Clone, Default, PartialEq)]
23121 #[non_exhaustive]
23122 pub struct GkeNodePoolAutoscalingConfig {
23123 /// The minimum number of nodes in the node pool. Must be >= 0 and <=
23124 /// max_node_count.
23125 pub min_node_count: i32,
23126
23127 /// The maximum number of nodes in the node pool. Must be >= min_node_count,
23128 /// and must be > 0.
23129 /// **Note:** Quota must be sufficient to scale up the cluster.
23130 pub max_node_count: i32,
23131
23132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23133 }
23134
23135 impl GkeNodePoolAutoscalingConfig {
23136 /// Creates a new default instance.
23137 pub fn new() -> Self {
23138 std::default::Default::default()
23139 }
23140
23141 /// Sets the value of [min_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::min_node_count].
23142 ///
23143 /// # Example
23144 /// ```ignore,no_run
23145 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
23146 /// let x = GkeNodePoolAutoscalingConfig::new().set_min_node_count(42);
23147 /// ```
23148 pub fn set_min_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23149 self.min_node_count = v.into();
23150 self
23151 }
23152
23153 /// Sets the value of [max_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::max_node_count].
23154 ///
23155 /// # Example
23156 /// ```ignore,no_run
23157 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
23158 /// let x = GkeNodePoolAutoscalingConfig::new().set_max_node_count(42);
23159 /// ```
23160 pub fn set_max_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23161 self.max_node_count = v.into();
23162 self
23163 }
23164 }
23165
23166 impl wkt::message::Message for GkeNodePoolAutoscalingConfig {
23167 fn typename() -> &'static str {
23168 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAutoscalingConfig"
23169 }
23170 }
23171}
23172
23173/// Authentication configuration for a workload is used to set the default
23174/// identity for the workload execution.
23175/// The config specifies the type of identity (service account or user) that
23176/// will be used by workloads to access resources on the project(s).
23177#[derive(Clone, Default, PartialEq)]
23178#[non_exhaustive]
23179pub struct AuthenticationConfig {
23180 /// Optional. Authentication type for the user workload running in containers.
23181 pub user_workload_authentication_type: crate::model::authentication_config::AuthenticationType,
23182
23183 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23184}
23185
23186impl AuthenticationConfig {
23187 /// Creates a new default instance.
23188 pub fn new() -> Self {
23189 std::default::Default::default()
23190 }
23191
23192 /// Sets the value of [user_workload_authentication_type][crate::model::AuthenticationConfig::user_workload_authentication_type].
23193 ///
23194 /// # Example
23195 /// ```ignore,no_run
23196 /// # use google_cloud_dataproc_v1::model::AuthenticationConfig;
23197 /// use google_cloud_dataproc_v1::model::authentication_config::AuthenticationType;
23198 /// let x0 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::ServiceAccount);
23199 /// let x1 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::EndUserCredentials);
23200 /// ```
23201 pub fn set_user_workload_authentication_type<
23202 T: std::convert::Into<crate::model::authentication_config::AuthenticationType>,
23203 >(
23204 mut self,
23205 v: T,
23206 ) -> Self {
23207 self.user_workload_authentication_type = v.into();
23208 self
23209 }
23210}
23211
23212impl wkt::message::Message for AuthenticationConfig {
23213 fn typename() -> &'static str {
23214 "type.googleapis.com/google.cloud.dataproc.v1.AuthenticationConfig"
23215 }
23216}
23217
23218/// Defines additional types related to [AuthenticationConfig].
23219pub mod authentication_config {
23220 #[allow(unused_imports)]
23221 use super::*;
23222
23223 /// Authentication types for workload execution.
23224 ///
23225 /// # Working with unknown values
23226 ///
23227 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23228 /// additional enum variants at any time. Adding new variants is not considered
23229 /// a breaking change. Applications should write their code in anticipation of:
23230 ///
23231 /// - New values appearing in future releases of the client library, **and**
23232 /// - New values received dynamically, without application changes.
23233 ///
23234 /// Please consult the [Working with enums] section in the user guide for some
23235 /// guidelines.
23236 ///
23237 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
23238 #[derive(Clone, Debug, PartialEq)]
23239 #[non_exhaustive]
23240 pub enum AuthenticationType {
23241 /// If AuthenticationType is unspecified then END_USER_CREDENTIALS is used
23242 /// for 3.0 and newer runtimes, and SERVICE_ACCOUNT is used for older
23243 /// runtimes.
23244 Unspecified,
23245 /// Use service account credentials for authenticating to other services.
23246 ServiceAccount,
23247 /// Use OAuth credentials associated with the workload creator/user for
23248 /// authenticating to other services.
23249 EndUserCredentials,
23250 /// If set, the enum was initialized with an unknown value.
23251 ///
23252 /// Applications can examine the value using [AuthenticationType::value] or
23253 /// [AuthenticationType::name].
23254 UnknownValue(authentication_type::UnknownValue),
23255 }
23256
23257 #[doc(hidden)]
23258 pub mod authentication_type {
23259 #[allow(unused_imports)]
23260 use super::*;
23261 #[derive(Clone, Debug, PartialEq)]
23262 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23263 }
23264
23265 impl AuthenticationType {
23266 /// Gets the enum value.
23267 ///
23268 /// Returns `None` if the enum contains an unknown value deserialized from
23269 /// the string representation of enums.
23270 pub fn value(&self) -> std::option::Option<i32> {
23271 match self {
23272 Self::Unspecified => std::option::Option::Some(0),
23273 Self::ServiceAccount => std::option::Option::Some(1),
23274 Self::EndUserCredentials => std::option::Option::Some(2),
23275 Self::UnknownValue(u) => u.0.value(),
23276 }
23277 }
23278
23279 /// Gets the enum value as a string.
23280 ///
23281 /// Returns `None` if the enum contains an unknown value deserialized from
23282 /// the integer representation of enums.
23283 pub fn name(&self) -> std::option::Option<&str> {
23284 match self {
23285 Self::Unspecified => std::option::Option::Some("AUTHENTICATION_TYPE_UNSPECIFIED"),
23286 Self::ServiceAccount => std::option::Option::Some("SERVICE_ACCOUNT"),
23287 Self::EndUserCredentials => std::option::Option::Some("END_USER_CREDENTIALS"),
23288 Self::UnknownValue(u) => u.0.name(),
23289 }
23290 }
23291 }
23292
23293 impl std::default::Default for AuthenticationType {
23294 fn default() -> Self {
23295 use std::convert::From;
23296 Self::from(0)
23297 }
23298 }
23299
23300 impl std::fmt::Display for AuthenticationType {
23301 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23302 wkt::internal::display_enum(f, self.name(), self.value())
23303 }
23304 }
23305
23306 impl std::convert::From<i32> for AuthenticationType {
23307 fn from(value: i32) -> Self {
23308 match value {
23309 0 => Self::Unspecified,
23310 1 => Self::ServiceAccount,
23311 2 => Self::EndUserCredentials,
23312 _ => Self::UnknownValue(authentication_type::UnknownValue(
23313 wkt::internal::UnknownEnumValue::Integer(value),
23314 )),
23315 }
23316 }
23317 }
23318
23319 impl std::convert::From<&str> for AuthenticationType {
23320 fn from(value: &str) -> Self {
23321 use std::string::ToString;
23322 match value {
23323 "AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
23324 "SERVICE_ACCOUNT" => Self::ServiceAccount,
23325 "END_USER_CREDENTIALS" => Self::EndUserCredentials,
23326 _ => Self::UnknownValue(authentication_type::UnknownValue(
23327 wkt::internal::UnknownEnumValue::String(value.to_string()),
23328 )),
23329 }
23330 }
23331 }
23332
23333 impl serde::ser::Serialize for AuthenticationType {
23334 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23335 where
23336 S: serde::Serializer,
23337 {
23338 match self {
23339 Self::Unspecified => serializer.serialize_i32(0),
23340 Self::ServiceAccount => serializer.serialize_i32(1),
23341 Self::EndUserCredentials => serializer.serialize_i32(2),
23342 Self::UnknownValue(u) => u.0.serialize(serializer),
23343 }
23344 }
23345 }
23346
23347 impl<'de> serde::de::Deserialize<'de> for AuthenticationType {
23348 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23349 where
23350 D: serde::Deserializer<'de>,
23351 {
23352 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthenticationType>::new(
23353 ".google.cloud.dataproc.v1.AuthenticationConfig.AuthenticationType",
23354 ))
23355 }
23356 }
23357}
23358
23359/// Autotuning configuration of the workload.
23360#[derive(Clone, Default, PartialEq)]
23361#[non_exhaustive]
23362pub struct AutotuningConfig {
23363 /// Optional. Scenarios for which tunings are applied.
23364 pub scenarios: std::vec::Vec<crate::model::autotuning_config::Scenario>,
23365
23366 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23367}
23368
23369impl AutotuningConfig {
23370 /// Creates a new default instance.
23371 pub fn new() -> Self {
23372 std::default::Default::default()
23373 }
23374
23375 /// Sets the value of [scenarios][crate::model::AutotuningConfig::scenarios].
23376 ///
23377 /// # Example
23378 /// ```ignore,no_run
23379 /// # use google_cloud_dataproc_v1::model::AutotuningConfig;
23380 /// use google_cloud_dataproc_v1::model::autotuning_config::Scenario;
23381 /// let x = AutotuningConfig::new().set_scenarios([
23382 /// Scenario::Scaling,
23383 /// Scenario::BroadcastHashJoin,
23384 /// Scenario::Memory,
23385 /// ]);
23386 /// ```
23387 pub fn set_scenarios<T, V>(mut self, v: T) -> Self
23388 where
23389 T: std::iter::IntoIterator<Item = V>,
23390 V: std::convert::Into<crate::model::autotuning_config::Scenario>,
23391 {
23392 use std::iter::Iterator;
23393 self.scenarios = v.into_iter().map(|i| i.into()).collect();
23394 self
23395 }
23396}
23397
23398impl wkt::message::Message for AutotuningConfig {
23399 fn typename() -> &'static str {
23400 "type.googleapis.com/google.cloud.dataproc.v1.AutotuningConfig"
23401 }
23402}
23403
23404/// Defines additional types related to [AutotuningConfig].
23405pub mod autotuning_config {
23406 #[allow(unused_imports)]
23407 use super::*;
23408
23409 /// Scenario represents a specific goal that autotuning will attempt to achieve
23410 /// by modifying workloads.
23411 ///
23412 /// # Working with unknown values
23413 ///
23414 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23415 /// additional enum variants at any time. Adding new variants is not considered
23416 /// a breaking change. Applications should write their code in anticipation of:
23417 ///
23418 /// - New values appearing in future releases of the client library, **and**
23419 /// - New values received dynamically, without application changes.
23420 ///
23421 /// Please consult the [Working with enums] section in the user guide for some
23422 /// guidelines.
23423 ///
23424 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
23425 #[derive(Clone, Debug, PartialEq)]
23426 #[non_exhaustive]
23427 pub enum Scenario {
23428 /// Default value.
23429 Unspecified,
23430 /// Scaling recommendations such as initialExecutors.
23431 Scaling,
23432 /// Adding hints for potential relation broadcasts.
23433 BroadcastHashJoin,
23434 /// Memory management for workloads.
23435 Memory,
23436 /// No autotuning.
23437 None,
23438 /// Automatic selection of scenarios.
23439 Auto,
23440 /// If set, the enum was initialized with an unknown value.
23441 ///
23442 /// Applications can examine the value using [Scenario::value] or
23443 /// [Scenario::name].
23444 UnknownValue(scenario::UnknownValue),
23445 }
23446
23447 #[doc(hidden)]
23448 pub mod scenario {
23449 #[allow(unused_imports)]
23450 use super::*;
23451 #[derive(Clone, Debug, PartialEq)]
23452 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23453 }
23454
23455 impl Scenario {
23456 /// Gets the enum value.
23457 ///
23458 /// Returns `None` if the enum contains an unknown value deserialized from
23459 /// the string representation of enums.
23460 pub fn value(&self) -> std::option::Option<i32> {
23461 match self {
23462 Self::Unspecified => std::option::Option::Some(0),
23463 Self::Scaling => std::option::Option::Some(2),
23464 Self::BroadcastHashJoin => std::option::Option::Some(3),
23465 Self::Memory => std::option::Option::Some(4),
23466 Self::None => std::option::Option::Some(5),
23467 Self::Auto => std::option::Option::Some(6),
23468 Self::UnknownValue(u) => u.0.value(),
23469 }
23470 }
23471
23472 /// Gets the enum value as a string.
23473 ///
23474 /// Returns `None` if the enum contains an unknown value deserialized from
23475 /// the integer representation of enums.
23476 pub fn name(&self) -> std::option::Option<&str> {
23477 match self {
23478 Self::Unspecified => std::option::Option::Some("SCENARIO_UNSPECIFIED"),
23479 Self::Scaling => std::option::Option::Some("SCALING"),
23480 Self::BroadcastHashJoin => std::option::Option::Some("BROADCAST_HASH_JOIN"),
23481 Self::Memory => std::option::Option::Some("MEMORY"),
23482 Self::None => std::option::Option::Some("NONE"),
23483 Self::Auto => std::option::Option::Some("AUTO"),
23484 Self::UnknownValue(u) => u.0.name(),
23485 }
23486 }
23487 }
23488
23489 impl std::default::Default for Scenario {
23490 fn default() -> Self {
23491 use std::convert::From;
23492 Self::from(0)
23493 }
23494 }
23495
23496 impl std::fmt::Display for Scenario {
23497 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23498 wkt::internal::display_enum(f, self.name(), self.value())
23499 }
23500 }
23501
23502 impl std::convert::From<i32> for Scenario {
23503 fn from(value: i32) -> Self {
23504 match value {
23505 0 => Self::Unspecified,
23506 2 => Self::Scaling,
23507 3 => Self::BroadcastHashJoin,
23508 4 => Self::Memory,
23509 5 => Self::None,
23510 6 => Self::Auto,
23511 _ => Self::UnknownValue(scenario::UnknownValue(
23512 wkt::internal::UnknownEnumValue::Integer(value),
23513 )),
23514 }
23515 }
23516 }
23517
23518 impl std::convert::From<&str> for Scenario {
23519 fn from(value: &str) -> Self {
23520 use std::string::ToString;
23521 match value {
23522 "SCENARIO_UNSPECIFIED" => Self::Unspecified,
23523 "SCALING" => Self::Scaling,
23524 "BROADCAST_HASH_JOIN" => Self::BroadcastHashJoin,
23525 "MEMORY" => Self::Memory,
23526 "NONE" => Self::None,
23527 "AUTO" => Self::Auto,
23528 _ => Self::UnknownValue(scenario::UnknownValue(
23529 wkt::internal::UnknownEnumValue::String(value.to_string()),
23530 )),
23531 }
23532 }
23533 }
23534
23535 impl serde::ser::Serialize for Scenario {
23536 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23537 where
23538 S: serde::Serializer,
23539 {
23540 match self {
23541 Self::Unspecified => serializer.serialize_i32(0),
23542 Self::Scaling => serializer.serialize_i32(2),
23543 Self::BroadcastHashJoin => serializer.serialize_i32(3),
23544 Self::Memory => serializer.serialize_i32(4),
23545 Self::None => serializer.serialize_i32(5),
23546 Self::Auto => serializer.serialize_i32(6),
23547 Self::UnknownValue(u) => u.0.serialize(serializer),
23548 }
23549 }
23550 }
23551
23552 impl<'de> serde::de::Deserialize<'de> for Scenario {
23553 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23554 where
23555 D: serde::Deserializer<'de>,
23556 {
23557 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scenario>::new(
23558 ".google.cloud.dataproc.v1.AutotuningConfig.Scenario",
23559 ))
23560 }
23561 }
23562}
23563
23564/// Configuration for dependency repositories
23565#[derive(Clone, Default, PartialEq)]
23566#[non_exhaustive]
23567pub struct RepositoryConfig {
23568 /// Optional. Configuration for PyPi repository.
23569 pub pypi_repository_config: std::option::Option<crate::model::PyPiRepositoryConfig>,
23570
23571 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23572}
23573
23574impl RepositoryConfig {
23575 /// Creates a new default instance.
23576 pub fn new() -> Self {
23577 std::default::Default::default()
23578 }
23579
23580 /// Sets the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
23581 ///
23582 /// # Example
23583 /// ```ignore,no_run
23584 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
23585 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
23586 /// let x = RepositoryConfig::new().set_pypi_repository_config(PyPiRepositoryConfig::default()/* use setters */);
23587 /// ```
23588 pub fn set_pypi_repository_config<T>(mut self, v: T) -> Self
23589 where
23590 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
23591 {
23592 self.pypi_repository_config = std::option::Option::Some(v.into());
23593 self
23594 }
23595
23596 /// Sets or clears the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
23597 ///
23598 /// # Example
23599 /// ```ignore,no_run
23600 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
23601 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
23602 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(Some(PyPiRepositoryConfig::default()/* use setters */));
23603 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(None::<PyPiRepositoryConfig>);
23604 /// ```
23605 pub fn set_or_clear_pypi_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
23606 where
23607 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
23608 {
23609 self.pypi_repository_config = v.map(|x| x.into());
23610 self
23611 }
23612}
23613
23614impl wkt::message::Message for RepositoryConfig {
23615 fn typename() -> &'static str {
23616 "type.googleapis.com/google.cloud.dataproc.v1.RepositoryConfig"
23617 }
23618}
23619
23620/// Configuration for PyPi repository
23621#[derive(Clone, Default, PartialEq)]
23622#[non_exhaustive]
23623pub struct PyPiRepositoryConfig {
23624 /// Optional. The PyPi repository address. **Note: This field is not available
23625 /// for batch workloads.**
23626 pub pypi_repository: std::string::String,
23627
23628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23629}
23630
23631impl PyPiRepositoryConfig {
23632 /// Creates a new default instance.
23633 pub fn new() -> Self {
23634 std::default::Default::default()
23635 }
23636
23637 /// Sets the value of [pypi_repository][crate::model::PyPiRepositoryConfig::pypi_repository].
23638 ///
23639 /// # Example
23640 /// ```ignore,no_run
23641 /// # use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
23642 /// let x = PyPiRepositoryConfig::new().set_pypi_repository("example");
23643 /// ```
23644 pub fn set_pypi_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23645 self.pypi_repository = v.into();
23646 self
23647 }
23648}
23649
23650impl wkt::message::Message for PyPiRepositoryConfig {
23651 fn typename() -> &'static str {
23652 "type.googleapis.com/google.cloud.dataproc.v1.PyPiRepositoryConfig"
23653 }
23654}
23655
23656/// A Dataproc workflow template resource.
23657#[derive(Clone, Default, PartialEq)]
23658#[non_exhaustive]
23659pub struct WorkflowTemplate {
23660 #[allow(missing_docs)]
23661 pub id: std::string::String,
23662
23663 /// Output only. The resource name of the workflow template, as described
23664 /// in <https://cloud.google.com/apis/design/resource_names>.
23665 ///
23666 /// * For `projects.regions.workflowTemplates`, the resource name of the
23667 /// template has the following format:
23668 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
23669 ///
23670 /// * For `projects.locations.workflowTemplates`, the resource name of the
23671 /// template has the following format:
23672 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
23673 ///
23674 pub name: std::string::String,
23675
23676 /// Optional. Used to perform a consistent read-modify-write.
23677 ///
23678 /// This field should be left blank for a `CreateWorkflowTemplate` request. It
23679 /// is required for an `UpdateWorkflowTemplate` request, and must match the
23680 /// current server version. A typical update template flow would fetch the
23681 /// current template with a `GetWorkflowTemplate` request, which will return
23682 /// the current template with the `version` field filled in with the
23683 /// current server version. The user updates other fields in the template,
23684 /// then returns it as part of the `UpdateWorkflowTemplate` request.
23685 pub version: i32,
23686
23687 /// Output only. The time template was created.
23688 pub create_time: std::option::Option<wkt::Timestamp>,
23689
23690 /// Output only. The time template was last updated.
23691 pub update_time: std::option::Option<wkt::Timestamp>,
23692
23693 /// Optional. The labels to associate with this template. These labels
23694 /// will be propagated to all jobs and clusters created by the workflow
23695 /// instance.
23696 ///
23697 /// Label **keys** must contain 1 to 63 characters, and must conform to
23698 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
23699 ///
23700 /// Label **values** may be empty, but, if present, must contain 1 to 63
23701 /// characters, and must conform to
23702 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
23703 ///
23704 /// No more than 32 labels can be associated with a template.
23705 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23706
23707 /// Required. WorkflowTemplate scheduling information.
23708 pub placement: std::option::Option<crate::model::WorkflowTemplatePlacement>,
23709
23710 /// Required. The Directed Acyclic Graph of Jobs to submit.
23711 pub jobs: std::vec::Vec<crate::model::OrderedJob>,
23712
23713 /// Optional. Template parameters whose values are substituted into the
23714 /// template. Values for parameters must be provided when the template is
23715 /// instantiated.
23716 pub parameters: std::vec::Vec<crate::model::TemplateParameter>,
23717
23718 /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
23719 /// [JSON representation of
23720 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
23721 /// The timeout duration must be from 10 minutes ("600s") to 24 hours
23722 /// ("86400s"). The timer begins when the first job is submitted. If the
23723 /// workflow is running at the end of the timeout period, any remaining jobs
23724 /// are cancelled, the workflow is ended, and if the workflow was running on a
23725 /// [managed
23726 /// cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
23727 /// the cluster is deleted.
23728 pub dag_timeout: std::option::Option<wkt::Duration>,
23729
23730 /// Optional. Encryption settings for encrypting workflow template job
23731 /// arguments.
23732 pub encryption_config: std::option::Option<crate::model::workflow_template::EncryptionConfig>,
23733
23734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23735}
23736
23737impl WorkflowTemplate {
23738 /// Creates a new default instance.
23739 pub fn new() -> Self {
23740 std::default::Default::default()
23741 }
23742
23743 /// Sets the value of [id][crate::model::WorkflowTemplate::id].
23744 ///
23745 /// # Example
23746 /// ```ignore,no_run
23747 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23748 /// let x = WorkflowTemplate::new().set_id("example");
23749 /// ```
23750 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23751 self.id = v.into();
23752 self
23753 }
23754
23755 /// Sets the value of [name][crate::model::WorkflowTemplate::name].
23756 ///
23757 /// # Example
23758 /// ```ignore,no_run
23759 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23760 /// # let project_id = "project_id";
23761 /// # let region_id = "region_id";
23762 /// # let workflow_template_id = "workflow_template_id";
23763 /// let x = WorkflowTemplate::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
23764 /// ```
23765 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23766 self.name = v.into();
23767 self
23768 }
23769
23770 /// Sets the value of [version][crate::model::WorkflowTemplate::version].
23771 ///
23772 /// # Example
23773 /// ```ignore,no_run
23774 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23775 /// let x = WorkflowTemplate::new().set_version(42);
23776 /// ```
23777 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23778 self.version = v.into();
23779 self
23780 }
23781
23782 /// Sets the value of [create_time][crate::model::WorkflowTemplate::create_time].
23783 ///
23784 /// # Example
23785 /// ```ignore,no_run
23786 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23787 /// use wkt::Timestamp;
23788 /// let x = WorkflowTemplate::new().set_create_time(Timestamp::default()/* use setters */);
23789 /// ```
23790 pub fn set_create_time<T>(mut self, v: T) -> Self
23791 where
23792 T: std::convert::Into<wkt::Timestamp>,
23793 {
23794 self.create_time = std::option::Option::Some(v.into());
23795 self
23796 }
23797
23798 /// Sets or clears the value of [create_time][crate::model::WorkflowTemplate::create_time].
23799 ///
23800 /// # Example
23801 /// ```ignore,no_run
23802 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23803 /// use wkt::Timestamp;
23804 /// let x = WorkflowTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
23805 /// let x = WorkflowTemplate::new().set_or_clear_create_time(None::<Timestamp>);
23806 /// ```
23807 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
23808 where
23809 T: std::convert::Into<wkt::Timestamp>,
23810 {
23811 self.create_time = v.map(|x| x.into());
23812 self
23813 }
23814
23815 /// Sets the value of [update_time][crate::model::WorkflowTemplate::update_time].
23816 ///
23817 /// # Example
23818 /// ```ignore,no_run
23819 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23820 /// use wkt::Timestamp;
23821 /// let x = WorkflowTemplate::new().set_update_time(Timestamp::default()/* use setters */);
23822 /// ```
23823 pub fn set_update_time<T>(mut self, v: T) -> Self
23824 where
23825 T: std::convert::Into<wkt::Timestamp>,
23826 {
23827 self.update_time = std::option::Option::Some(v.into());
23828 self
23829 }
23830
23831 /// Sets or clears the value of [update_time][crate::model::WorkflowTemplate::update_time].
23832 ///
23833 /// # Example
23834 /// ```ignore,no_run
23835 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23836 /// use wkt::Timestamp;
23837 /// let x = WorkflowTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
23838 /// let x = WorkflowTemplate::new().set_or_clear_update_time(None::<Timestamp>);
23839 /// ```
23840 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
23841 where
23842 T: std::convert::Into<wkt::Timestamp>,
23843 {
23844 self.update_time = v.map(|x| x.into());
23845 self
23846 }
23847
23848 /// Sets the value of [labels][crate::model::WorkflowTemplate::labels].
23849 ///
23850 /// # Example
23851 /// ```ignore,no_run
23852 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23853 /// let x = WorkflowTemplate::new().set_labels([
23854 /// ("key0", "abc"),
23855 /// ("key1", "xyz"),
23856 /// ]);
23857 /// ```
23858 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23859 where
23860 T: std::iter::IntoIterator<Item = (K, V)>,
23861 K: std::convert::Into<std::string::String>,
23862 V: std::convert::Into<std::string::String>,
23863 {
23864 use std::iter::Iterator;
23865 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23866 self
23867 }
23868
23869 /// Sets the value of [placement][crate::model::WorkflowTemplate::placement].
23870 ///
23871 /// # Example
23872 /// ```ignore,no_run
23873 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23874 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23875 /// let x = WorkflowTemplate::new().set_placement(WorkflowTemplatePlacement::default()/* use setters */);
23876 /// ```
23877 pub fn set_placement<T>(mut self, v: T) -> Self
23878 where
23879 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
23880 {
23881 self.placement = std::option::Option::Some(v.into());
23882 self
23883 }
23884
23885 /// Sets or clears the value of [placement][crate::model::WorkflowTemplate::placement].
23886 ///
23887 /// # Example
23888 /// ```ignore,no_run
23889 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23890 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23891 /// let x = WorkflowTemplate::new().set_or_clear_placement(Some(WorkflowTemplatePlacement::default()/* use setters */));
23892 /// let x = WorkflowTemplate::new().set_or_clear_placement(None::<WorkflowTemplatePlacement>);
23893 /// ```
23894 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
23895 where
23896 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
23897 {
23898 self.placement = v.map(|x| x.into());
23899 self
23900 }
23901
23902 /// Sets the value of [jobs][crate::model::WorkflowTemplate::jobs].
23903 ///
23904 /// # Example
23905 /// ```ignore,no_run
23906 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23907 /// use google_cloud_dataproc_v1::model::OrderedJob;
23908 /// let x = WorkflowTemplate::new()
23909 /// .set_jobs([
23910 /// OrderedJob::default()/* use setters */,
23911 /// OrderedJob::default()/* use (different) setters */,
23912 /// ]);
23913 /// ```
23914 pub fn set_jobs<T, V>(mut self, v: T) -> Self
23915 where
23916 T: std::iter::IntoIterator<Item = V>,
23917 V: std::convert::Into<crate::model::OrderedJob>,
23918 {
23919 use std::iter::Iterator;
23920 self.jobs = v.into_iter().map(|i| i.into()).collect();
23921 self
23922 }
23923
23924 /// Sets the value of [parameters][crate::model::WorkflowTemplate::parameters].
23925 ///
23926 /// # Example
23927 /// ```ignore,no_run
23928 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23929 /// use google_cloud_dataproc_v1::model::TemplateParameter;
23930 /// let x = WorkflowTemplate::new()
23931 /// .set_parameters([
23932 /// TemplateParameter::default()/* use setters */,
23933 /// TemplateParameter::default()/* use (different) setters */,
23934 /// ]);
23935 /// ```
23936 pub fn set_parameters<T, V>(mut self, v: T) -> Self
23937 where
23938 T: std::iter::IntoIterator<Item = V>,
23939 V: std::convert::Into<crate::model::TemplateParameter>,
23940 {
23941 use std::iter::Iterator;
23942 self.parameters = v.into_iter().map(|i| i.into()).collect();
23943 self
23944 }
23945
23946 /// Sets the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
23947 ///
23948 /// # Example
23949 /// ```ignore,no_run
23950 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23951 /// use wkt::Duration;
23952 /// let x = WorkflowTemplate::new().set_dag_timeout(Duration::default()/* use setters */);
23953 /// ```
23954 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
23955 where
23956 T: std::convert::Into<wkt::Duration>,
23957 {
23958 self.dag_timeout = std::option::Option::Some(v.into());
23959 self
23960 }
23961
23962 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
23963 ///
23964 /// # Example
23965 /// ```ignore,no_run
23966 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23967 /// use wkt::Duration;
23968 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
23969 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(None::<Duration>);
23970 /// ```
23971 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
23972 where
23973 T: std::convert::Into<wkt::Duration>,
23974 {
23975 self.dag_timeout = v.map(|x| x.into());
23976 self
23977 }
23978
23979 /// Sets the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
23980 ///
23981 /// # Example
23982 /// ```ignore,no_run
23983 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23984 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
23985 /// let x = WorkflowTemplate::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
23986 /// ```
23987 pub fn set_encryption_config<T>(mut self, v: T) -> Self
23988 where
23989 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
23990 {
23991 self.encryption_config = std::option::Option::Some(v.into());
23992 self
23993 }
23994
23995 /// Sets or clears the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
23996 ///
23997 /// # Example
23998 /// ```ignore,no_run
23999 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
24000 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
24001 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
24002 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
24003 /// ```
24004 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
24005 where
24006 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
24007 {
24008 self.encryption_config = v.map(|x| x.into());
24009 self
24010 }
24011}
24012
24013impl wkt::message::Message for WorkflowTemplate {
24014 fn typename() -> &'static str {
24015 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate"
24016 }
24017}
24018
24019/// Defines additional types related to [WorkflowTemplate].
24020pub mod workflow_template {
24021 #[allow(unused_imports)]
24022 use super::*;
24023
24024 /// Encryption settings for encrypting workflow template job arguments.
24025 #[derive(Clone, Default, PartialEq)]
24026 #[non_exhaustive]
24027 pub struct EncryptionConfig {
24028 /// Optional. The Cloud KMS key name to use for encrypting
24029 /// workflow template job arguments.
24030 ///
24031 /// When this this key is provided, the following workflow template
24032 /// [job arguments]
24033 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template>),
24034 /// if present, are
24035 /// [CMEK
24036 /// encrypted](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data):
24037 ///
24038 /// * [FlinkJob
24039 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
24040 /// * [HadoopJob
24041 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
24042 /// * [SparkJob
24043 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
24044 /// * [SparkRJob
24045 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
24046 /// * [PySparkJob
24047 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
24048 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
24049 /// scriptVariables and queryList.queries
24050 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
24051 /// scriptVariables and queryList.queries
24052 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
24053 /// scriptVariables and queryList.queries
24054 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
24055 /// scriptVariables and queryList.queries
24056 pub kms_key: std::string::String,
24057
24058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24059 }
24060
24061 impl EncryptionConfig {
24062 /// Creates a new default instance.
24063 pub fn new() -> Self {
24064 std::default::Default::default()
24065 }
24066
24067 /// Sets the value of [kms_key][crate::model::workflow_template::EncryptionConfig::kms_key].
24068 ///
24069 /// # Example
24070 /// ```ignore,no_run
24071 /// # use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
24072 /// let x = EncryptionConfig::new().set_kms_key("example");
24073 /// ```
24074 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24075 self.kms_key = v.into();
24076 self
24077 }
24078 }
24079
24080 impl wkt::message::Message for EncryptionConfig {
24081 fn typename() -> &'static str {
24082 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate.EncryptionConfig"
24083 }
24084 }
24085}
24086
24087/// Specifies workflow execution target.
24088///
24089/// Either `managed_cluster` or `cluster_selector` is required.
24090#[derive(Clone, Default, PartialEq)]
24091#[non_exhaustive]
24092pub struct WorkflowTemplatePlacement {
24093 /// Required. Specifies where workflow executes; either on a managed
24094 /// cluster or an existing cluster chosen by labels.
24095 pub placement: std::option::Option<crate::model::workflow_template_placement::Placement>,
24096
24097 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24098}
24099
24100impl WorkflowTemplatePlacement {
24101 /// Creates a new default instance.
24102 pub fn new() -> Self {
24103 std::default::Default::default()
24104 }
24105
24106 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement].
24107 ///
24108 /// Note that all the setters affecting `placement` are mutually
24109 /// exclusive.
24110 ///
24111 /// # Example
24112 /// ```ignore,no_run
24113 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
24114 /// use google_cloud_dataproc_v1::model::ManagedCluster;
24115 /// let x = WorkflowTemplatePlacement::new().set_placement(Some(
24116 /// google_cloud_dataproc_v1::model::workflow_template_placement::Placement::ManagedCluster(ManagedCluster::default().into())));
24117 /// ```
24118 pub fn set_placement<
24119 T: std::convert::Into<
24120 std::option::Option<crate::model::workflow_template_placement::Placement>,
24121 >,
24122 >(
24123 mut self,
24124 v: T,
24125 ) -> Self {
24126 self.placement = v.into();
24127 self
24128 }
24129
24130 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
24131 /// if it holds a `ManagedCluster`, `None` if the field is not set or
24132 /// holds a different branch.
24133 pub fn managed_cluster(
24134 &self,
24135 ) -> std::option::Option<&std::boxed::Box<crate::model::ManagedCluster>> {
24136 #[allow(unreachable_patterns)]
24137 self.placement.as_ref().and_then(|v| match v {
24138 crate::model::workflow_template_placement::Placement::ManagedCluster(v) => {
24139 std::option::Option::Some(v)
24140 }
24141 _ => std::option::Option::None,
24142 })
24143 }
24144
24145 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
24146 /// to hold a `ManagedCluster`.
24147 ///
24148 /// Note that all the setters affecting `placement` are
24149 /// mutually exclusive.
24150 ///
24151 /// # Example
24152 /// ```ignore,no_run
24153 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
24154 /// use google_cloud_dataproc_v1::model::ManagedCluster;
24155 /// let x = WorkflowTemplatePlacement::new().set_managed_cluster(ManagedCluster::default()/* use setters */);
24156 /// assert!(x.managed_cluster().is_some());
24157 /// assert!(x.cluster_selector().is_none());
24158 /// ```
24159 pub fn set_managed_cluster<
24160 T: std::convert::Into<std::boxed::Box<crate::model::ManagedCluster>>,
24161 >(
24162 mut self,
24163 v: T,
24164 ) -> Self {
24165 self.placement = std::option::Option::Some(
24166 crate::model::workflow_template_placement::Placement::ManagedCluster(v.into()),
24167 );
24168 self
24169 }
24170
24171 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
24172 /// if it holds a `ClusterSelector`, `None` if the field is not set or
24173 /// holds a different branch.
24174 pub fn cluster_selector(
24175 &self,
24176 ) -> std::option::Option<&std::boxed::Box<crate::model::ClusterSelector>> {
24177 #[allow(unreachable_patterns)]
24178 self.placement.as_ref().and_then(|v| match v {
24179 crate::model::workflow_template_placement::Placement::ClusterSelector(v) => {
24180 std::option::Option::Some(v)
24181 }
24182 _ => std::option::Option::None,
24183 })
24184 }
24185
24186 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
24187 /// to hold a `ClusterSelector`.
24188 ///
24189 /// Note that all the setters affecting `placement` are
24190 /// mutually exclusive.
24191 ///
24192 /// # Example
24193 /// ```ignore,no_run
24194 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
24195 /// use google_cloud_dataproc_v1::model::ClusterSelector;
24196 /// let x = WorkflowTemplatePlacement::new().set_cluster_selector(ClusterSelector::default()/* use setters */);
24197 /// assert!(x.cluster_selector().is_some());
24198 /// assert!(x.managed_cluster().is_none());
24199 /// ```
24200 pub fn set_cluster_selector<
24201 T: std::convert::Into<std::boxed::Box<crate::model::ClusterSelector>>,
24202 >(
24203 mut self,
24204 v: T,
24205 ) -> Self {
24206 self.placement = std::option::Option::Some(
24207 crate::model::workflow_template_placement::Placement::ClusterSelector(v.into()),
24208 );
24209 self
24210 }
24211}
24212
24213impl wkt::message::Message for WorkflowTemplatePlacement {
24214 fn typename() -> &'static str {
24215 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplatePlacement"
24216 }
24217}
24218
24219/// Defines additional types related to [WorkflowTemplatePlacement].
24220pub mod workflow_template_placement {
24221 #[allow(unused_imports)]
24222 use super::*;
24223
24224 /// Required. Specifies where workflow executes; either on a managed
24225 /// cluster or an existing cluster chosen by labels.
24226 #[derive(Clone, Debug, PartialEq)]
24227 #[non_exhaustive]
24228 pub enum Placement {
24229 /// A cluster that is managed by the workflow.
24230 ManagedCluster(std::boxed::Box<crate::model::ManagedCluster>),
24231 /// Optional. A selector that chooses target cluster for jobs based
24232 /// on metadata.
24233 ///
24234 /// The selector is evaluated at the time each job is submitted.
24235 ClusterSelector(std::boxed::Box<crate::model::ClusterSelector>),
24236 }
24237}
24238
24239/// Cluster that is managed by the workflow.
24240#[derive(Clone, Default, PartialEq)]
24241#[non_exhaustive]
24242pub struct ManagedCluster {
24243 /// Required. The cluster name prefix. A unique cluster name will be formed by
24244 /// appending a random suffix.
24245 ///
24246 /// The name must contain only lower-case letters (a-z), numbers (0-9),
24247 /// and hyphens (-). Must begin with a letter. Cannot begin or end with
24248 /// hyphen. Must consist of between 2 and 35 characters.
24249 pub cluster_name: std::string::String,
24250
24251 /// Required. The cluster configuration.
24252 pub config: std::option::Option<crate::model::ClusterConfig>,
24253
24254 /// Optional. The labels to associate with this cluster.
24255 ///
24256 /// Label keys must be between 1 and 63 characters long, and must conform to
24257 /// the following PCRE regular expression:
24258 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
24259 ///
24260 /// Label values must be between 1 and 63 characters long, and must conform to
24261 /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
24262 ///
24263 /// No more than 32 labels can be associated with a given cluster.
24264 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
24265
24266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24267}
24268
24269impl ManagedCluster {
24270 /// Creates a new default instance.
24271 pub fn new() -> Self {
24272 std::default::Default::default()
24273 }
24274
24275 /// Sets the value of [cluster_name][crate::model::ManagedCluster::cluster_name].
24276 ///
24277 /// # Example
24278 /// ```ignore,no_run
24279 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
24280 /// let x = ManagedCluster::new().set_cluster_name("example");
24281 /// ```
24282 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24283 self.cluster_name = v.into();
24284 self
24285 }
24286
24287 /// Sets the value of [config][crate::model::ManagedCluster::config].
24288 ///
24289 /// # Example
24290 /// ```ignore,no_run
24291 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
24292 /// use google_cloud_dataproc_v1::model::ClusterConfig;
24293 /// let x = ManagedCluster::new().set_config(ClusterConfig::default()/* use setters */);
24294 /// ```
24295 pub fn set_config<T>(mut self, v: T) -> Self
24296 where
24297 T: std::convert::Into<crate::model::ClusterConfig>,
24298 {
24299 self.config = std::option::Option::Some(v.into());
24300 self
24301 }
24302
24303 /// Sets or clears the value of [config][crate::model::ManagedCluster::config].
24304 ///
24305 /// # Example
24306 /// ```ignore,no_run
24307 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
24308 /// use google_cloud_dataproc_v1::model::ClusterConfig;
24309 /// let x = ManagedCluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
24310 /// let x = ManagedCluster::new().set_or_clear_config(None::<ClusterConfig>);
24311 /// ```
24312 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
24313 where
24314 T: std::convert::Into<crate::model::ClusterConfig>,
24315 {
24316 self.config = v.map(|x| x.into());
24317 self
24318 }
24319
24320 /// Sets the value of [labels][crate::model::ManagedCluster::labels].
24321 ///
24322 /// # Example
24323 /// ```ignore,no_run
24324 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
24325 /// let x = ManagedCluster::new().set_labels([
24326 /// ("key0", "abc"),
24327 /// ("key1", "xyz"),
24328 /// ]);
24329 /// ```
24330 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
24331 where
24332 T: std::iter::IntoIterator<Item = (K, V)>,
24333 K: std::convert::Into<std::string::String>,
24334 V: std::convert::Into<std::string::String>,
24335 {
24336 use std::iter::Iterator;
24337 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24338 self
24339 }
24340}
24341
24342impl wkt::message::Message for ManagedCluster {
24343 fn typename() -> &'static str {
24344 "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
24345 }
24346}
24347
24348/// A selector that chooses target cluster for jobs based on metadata.
24349#[derive(Clone, Default, PartialEq)]
24350#[non_exhaustive]
24351pub struct ClusterSelector {
24352 /// Optional. The zone where workflow process executes. This parameter does not
24353 /// affect the selection of the cluster.
24354 ///
24355 /// If unspecified, the zone of the first cluster matching the selector
24356 /// is used.
24357 pub zone: std::string::String,
24358
24359 /// Required. The cluster labels. Cluster must have all labels
24360 /// to match.
24361 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
24362
24363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24364}
24365
24366impl ClusterSelector {
24367 /// Creates a new default instance.
24368 pub fn new() -> Self {
24369 std::default::Default::default()
24370 }
24371
24372 /// Sets the value of [zone][crate::model::ClusterSelector::zone].
24373 ///
24374 /// # Example
24375 /// ```ignore,no_run
24376 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
24377 /// let x = ClusterSelector::new().set_zone("example");
24378 /// ```
24379 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24380 self.zone = v.into();
24381 self
24382 }
24383
24384 /// Sets the value of [cluster_labels][crate::model::ClusterSelector::cluster_labels].
24385 ///
24386 /// # Example
24387 /// ```ignore,no_run
24388 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
24389 /// let x = ClusterSelector::new().set_cluster_labels([
24390 /// ("key0", "abc"),
24391 /// ("key1", "xyz"),
24392 /// ]);
24393 /// ```
24394 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
24395 where
24396 T: std::iter::IntoIterator<Item = (K, V)>,
24397 K: std::convert::Into<std::string::String>,
24398 V: std::convert::Into<std::string::String>,
24399 {
24400 use std::iter::Iterator;
24401 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24402 self
24403 }
24404}
24405
24406impl wkt::message::Message for ClusterSelector {
24407 fn typename() -> &'static str {
24408 "type.googleapis.com/google.cloud.dataproc.v1.ClusterSelector"
24409 }
24410}
24411
24412/// A job executed by the workflow.
24413#[derive(Clone, Default, PartialEq)]
24414#[non_exhaustive]
24415pub struct OrderedJob {
24416 /// Required. The step id. The id must be unique among all jobs
24417 /// within the template.
24418 ///
24419 /// The step id is used as prefix for job id, as job
24420 /// `goog-dataproc-workflow-step-id` label, and in
24421 /// [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
24422 /// field from other steps.
24423 ///
24424 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
24425 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
24426 /// or hyphen. Must consist of between 3 and 50 characters.
24427 ///
24428 /// [google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]: crate::model::OrderedJob::prerequisite_step_ids
24429 pub step_id: std::string::String,
24430
24431 /// Optional. The labels to associate with this job.
24432 ///
24433 /// Label keys must be between 1 and 63 characters long, and must conform to
24434 /// the following regular expression:
24435 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
24436 ///
24437 /// Label values must be between 1 and 63 characters long, and must conform to
24438 /// the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
24439 ///
24440 /// No more than 32 labels can be associated with a given job.
24441 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
24442
24443 /// Optional. Job scheduling configuration.
24444 pub scheduling: std::option::Option<crate::model::JobScheduling>,
24445
24446 /// Optional. The optional list of prerequisite job step_ids.
24447 /// If not specified, the job will start at the beginning of workflow.
24448 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
24449
24450 /// Required. The job definition.
24451 pub job_type: std::option::Option<crate::model::ordered_job::JobType>,
24452
24453 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24454}
24455
24456impl OrderedJob {
24457 /// Creates a new default instance.
24458 pub fn new() -> Self {
24459 std::default::Default::default()
24460 }
24461
24462 /// Sets the value of [step_id][crate::model::OrderedJob::step_id].
24463 ///
24464 /// # Example
24465 /// ```ignore,no_run
24466 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24467 /// let x = OrderedJob::new().set_step_id("example");
24468 /// ```
24469 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24470 self.step_id = v.into();
24471 self
24472 }
24473
24474 /// Sets the value of [labels][crate::model::OrderedJob::labels].
24475 ///
24476 /// # Example
24477 /// ```ignore,no_run
24478 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24479 /// let x = OrderedJob::new().set_labels([
24480 /// ("key0", "abc"),
24481 /// ("key1", "xyz"),
24482 /// ]);
24483 /// ```
24484 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
24485 where
24486 T: std::iter::IntoIterator<Item = (K, V)>,
24487 K: std::convert::Into<std::string::String>,
24488 V: std::convert::Into<std::string::String>,
24489 {
24490 use std::iter::Iterator;
24491 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24492 self
24493 }
24494
24495 /// Sets the value of [scheduling][crate::model::OrderedJob::scheduling].
24496 ///
24497 /// # Example
24498 /// ```ignore,no_run
24499 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24500 /// use google_cloud_dataproc_v1::model::JobScheduling;
24501 /// let x = OrderedJob::new().set_scheduling(JobScheduling::default()/* use setters */);
24502 /// ```
24503 pub fn set_scheduling<T>(mut self, v: T) -> Self
24504 where
24505 T: std::convert::Into<crate::model::JobScheduling>,
24506 {
24507 self.scheduling = std::option::Option::Some(v.into());
24508 self
24509 }
24510
24511 /// Sets or clears the value of [scheduling][crate::model::OrderedJob::scheduling].
24512 ///
24513 /// # Example
24514 /// ```ignore,no_run
24515 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24516 /// use google_cloud_dataproc_v1::model::JobScheduling;
24517 /// let x = OrderedJob::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
24518 /// let x = OrderedJob::new().set_or_clear_scheduling(None::<JobScheduling>);
24519 /// ```
24520 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
24521 where
24522 T: std::convert::Into<crate::model::JobScheduling>,
24523 {
24524 self.scheduling = v.map(|x| x.into());
24525 self
24526 }
24527
24528 /// Sets the value of [prerequisite_step_ids][crate::model::OrderedJob::prerequisite_step_ids].
24529 ///
24530 /// # Example
24531 /// ```ignore,no_run
24532 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24533 /// let x = OrderedJob::new().set_prerequisite_step_ids(["a", "b", "c"]);
24534 /// ```
24535 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
24536 where
24537 T: std::iter::IntoIterator<Item = V>,
24538 V: std::convert::Into<std::string::String>,
24539 {
24540 use std::iter::Iterator;
24541 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
24542 self
24543 }
24544
24545 /// Sets the value of [job_type][crate::model::OrderedJob::job_type].
24546 ///
24547 /// Note that all the setters affecting `job_type` are mutually
24548 /// exclusive.
24549 ///
24550 /// # Example
24551 /// ```ignore,no_run
24552 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24553 /// use google_cloud_dataproc_v1::model::HadoopJob;
24554 /// let x = OrderedJob::new().set_job_type(Some(
24555 /// google_cloud_dataproc_v1::model::ordered_job::JobType::HadoopJob(HadoopJob::default().into())));
24556 /// ```
24557 pub fn set_job_type<
24558 T: std::convert::Into<std::option::Option<crate::model::ordered_job::JobType>>,
24559 >(
24560 mut self,
24561 v: T,
24562 ) -> Self {
24563 self.job_type = v.into();
24564 self
24565 }
24566
24567 /// The value of [job_type][crate::model::OrderedJob::job_type]
24568 /// if it holds a `HadoopJob`, `None` if the field is not set or
24569 /// holds a different branch.
24570 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
24571 #[allow(unreachable_patterns)]
24572 self.job_type.as_ref().and_then(|v| match v {
24573 crate::model::ordered_job::JobType::HadoopJob(v) => std::option::Option::Some(v),
24574 _ => std::option::Option::None,
24575 })
24576 }
24577
24578 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24579 /// to hold a `HadoopJob`.
24580 ///
24581 /// Note that all the setters affecting `job_type` are
24582 /// mutually exclusive.
24583 ///
24584 /// # Example
24585 /// ```ignore,no_run
24586 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24587 /// use google_cloud_dataproc_v1::model::HadoopJob;
24588 /// let x = OrderedJob::new().set_hadoop_job(HadoopJob::default()/* use setters */);
24589 /// assert!(x.hadoop_job().is_some());
24590 /// assert!(x.spark_job().is_none());
24591 /// assert!(x.pyspark_job().is_none());
24592 /// assert!(x.hive_job().is_none());
24593 /// assert!(x.pig_job().is_none());
24594 /// assert!(x.spark_r_job().is_none());
24595 /// assert!(x.spark_sql_job().is_none());
24596 /// assert!(x.presto_job().is_none());
24597 /// assert!(x.trino_job().is_none());
24598 /// assert!(x.flink_job().is_none());
24599 /// ```
24600 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
24601 mut self,
24602 v: T,
24603 ) -> Self {
24604 self.job_type =
24605 std::option::Option::Some(crate::model::ordered_job::JobType::HadoopJob(v.into()));
24606 self
24607 }
24608
24609 /// The value of [job_type][crate::model::OrderedJob::job_type]
24610 /// if it holds a `SparkJob`, `None` if the field is not set or
24611 /// holds a different branch.
24612 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
24613 #[allow(unreachable_patterns)]
24614 self.job_type.as_ref().and_then(|v| match v {
24615 crate::model::ordered_job::JobType::SparkJob(v) => std::option::Option::Some(v),
24616 _ => std::option::Option::None,
24617 })
24618 }
24619
24620 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24621 /// to hold a `SparkJob`.
24622 ///
24623 /// Note that all the setters affecting `job_type` are
24624 /// mutually exclusive.
24625 ///
24626 /// # Example
24627 /// ```ignore,no_run
24628 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24629 /// use google_cloud_dataproc_v1::model::SparkJob;
24630 /// let x = OrderedJob::new().set_spark_job(SparkJob::default()/* use setters */);
24631 /// assert!(x.spark_job().is_some());
24632 /// assert!(x.hadoop_job().is_none());
24633 /// assert!(x.pyspark_job().is_none());
24634 /// assert!(x.hive_job().is_none());
24635 /// assert!(x.pig_job().is_none());
24636 /// assert!(x.spark_r_job().is_none());
24637 /// assert!(x.spark_sql_job().is_none());
24638 /// assert!(x.presto_job().is_none());
24639 /// assert!(x.trino_job().is_none());
24640 /// assert!(x.flink_job().is_none());
24641 /// ```
24642 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
24643 mut self,
24644 v: T,
24645 ) -> Self {
24646 self.job_type =
24647 std::option::Option::Some(crate::model::ordered_job::JobType::SparkJob(v.into()));
24648 self
24649 }
24650
24651 /// The value of [job_type][crate::model::OrderedJob::job_type]
24652 /// if it holds a `PysparkJob`, `None` if the field is not set or
24653 /// holds a different branch.
24654 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
24655 #[allow(unreachable_patterns)]
24656 self.job_type.as_ref().and_then(|v| match v {
24657 crate::model::ordered_job::JobType::PysparkJob(v) => std::option::Option::Some(v),
24658 _ => std::option::Option::None,
24659 })
24660 }
24661
24662 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24663 /// to hold a `PysparkJob`.
24664 ///
24665 /// Note that all the setters affecting `job_type` are
24666 /// mutually exclusive.
24667 ///
24668 /// # Example
24669 /// ```ignore,no_run
24670 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24671 /// use google_cloud_dataproc_v1::model::PySparkJob;
24672 /// let x = OrderedJob::new().set_pyspark_job(PySparkJob::default()/* use setters */);
24673 /// assert!(x.pyspark_job().is_some());
24674 /// assert!(x.hadoop_job().is_none());
24675 /// assert!(x.spark_job().is_none());
24676 /// assert!(x.hive_job().is_none());
24677 /// assert!(x.pig_job().is_none());
24678 /// assert!(x.spark_r_job().is_none());
24679 /// assert!(x.spark_sql_job().is_none());
24680 /// assert!(x.presto_job().is_none());
24681 /// assert!(x.trino_job().is_none());
24682 /// assert!(x.flink_job().is_none());
24683 /// ```
24684 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
24685 mut self,
24686 v: T,
24687 ) -> Self {
24688 self.job_type =
24689 std::option::Option::Some(crate::model::ordered_job::JobType::PysparkJob(v.into()));
24690 self
24691 }
24692
24693 /// The value of [job_type][crate::model::OrderedJob::job_type]
24694 /// if it holds a `HiveJob`, `None` if the field is not set or
24695 /// holds a different branch.
24696 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
24697 #[allow(unreachable_patterns)]
24698 self.job_type.as_ref().and_then(|v| match v {
24699 crate::model::ordered_job::JobType::HiveJob(v) => std::option::Option::Some(v),
24700 _ => std::option::Option::None,
24701 })
24702 }
24703
24704 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24705 /// to hold a `HiveJob`.
24706 ///
24707 /// Note that all the setters affecting `job_type` are
24708 /// mutually exclusive.
24709 ///
24710 /// # Example
24711 /// ```ignore,no_run
24712 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24713 /// use google_cloud_dataproc_v1::model::HiveJob;
24714 /// let x = OrderedJob::new().set_hive_job(HiveJob::default()/* use setters */);
24715 /// assert!(x.hive_job().is_some());
24716 /// assert!(x.hadoop_job().is_none());
24717 /// assert!(x.spark_job().is_none());
24718 /// assert!(x.pyspark_job().is_none());
24719 /// assert!(x.pig_job().is_none());
24720 /// assert!(x.spark_r_job().is_none());
24721 /// assert!(x.spark_sql_job().is_none());
24722 /// assert!(x.presto_job().is_none());
24723 /// assert!(x.trino_job().is_none());
24724 /// assert!(x.flink_job().is_none());
24725 /// ```
24726 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
24727 mut self,
24728 v: T,
24729 ) -> Self {
24730 self.job_type =
24731 std::option::Option::Some(crate::model::ordered_job::JobType::HiveJob(v.into()));
24732 self
24733 }
24734
24735 /// The value of [job_type][crate::model::OrderedJob::job_type]
24736 /// if it holds a `PigJob`, `None` if the field is not set or
24737 /// holds a different branch.
24738 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
24739 #[allow(unreachable_patterns)]
24740 self.job_type.as_ref().and_then(|v| match v {
24741 crate::model::ordered_job::JobType::PigJob(v) => std::option::Option::Some(v),
24742 _ => std::option::Option::None,
24743 })
24744 }
24745
24746 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24747 /// to hold a `PigJob`.
24748 ///
24749 /// Note that all the setters affecting `job_type` are
24750 /// mutually exclusive.
24751 ///
24752 /// # Example
24753 /// ```ignore,no_run
24754 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24755 /// use google_cloud_dataproc_v1::model::PigJob;
24756 /// let x = OrderedJob::new().set_pig_job(PigJob::default()/* use setters */);
24757 /// assert!(x.pig_job().is_some());
24758 /// assert!(x.hadoop_job().is_none());
24759 /// assert!(x.spark_job().is_none());
24760 /// assert!(x.pyspark_job().is_none());
24761 /// assert!(x.hive_job().is_none());
24762 /// assert!(x.spark_r_job().is_none());
24763 /// assert!(x.spark_sql_job().is_none());
24764 /// assert!(x.presto_job().is_none());
24765 /// assert!(x.trino_job().is_none());
24766 /// assert!(x.flink_job().is_none());
24767 /// ```
24768 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
24769 mut self,
24770 v: T,
24771 ) -> Self {
24772 self.job_type =
24773 std::option::Option::Some(crate::model::ordered_job::JobType::PigJob(v.into()));
24774 self
24775 }
24776
24777 /// The value of [job_type][crate::model::OrderedJob::job_type]
24778 /// if it holds a `SparkRJob`, `None` if the field is not set or
24779 /// holds a different branch.
24780 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
24781 #[allow(unreachable_patterns)]
24782 self.job_type.as_ref().and_then(|v| match v {
24783 crate::model::ordered_job::JobType::SparkRJob(v) => std::option::Option::Some(v),
24784 _ => std::option::Option::None,
24785 })
24786 }
24787
24788 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24789 /// to hold a `SparkRJob`.
24790 ///
24791 /// Note that all the setters affecting `job_type` are
24792 /// mutually exclusive.
24793 ///
24794 /// # Example
24795 /// ```ignore,no_run
24796 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24797 /// use google_cloud_dataproc_v1::model::SparkRJob;
24798 /// let x = OrderedJob::new().set_spark_r_job(SparkRJob::default()/* use setters */);
24799 /// assert!(x.spark_r_job().is_some());
24800 /// assert!(x.hadoop_job().is_none());
24801 /// assert!(x.spark_job().is_none());
24802 /// assert!(x.pyspark_job().is_none());
24803 /// assert!(x.hive_job().is_none());
24804 /// assert!(x.pig_job().is_none());
24805 /// assert!(x.spark_sql_job().is_none());
24806 /// assert!(x.presto_job().is_none());
24807 /// assert!(x.trino_job().is_none());
24808 /// assert!(x.flink_job().is_none());
24809 /// ```
24810 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
24811 mut self,
24812 v: T,
24813 ) -> Self {
24814 self.job_type =
24815 std::option::Option::Some(crate::model::ordered_job::JobType::SparkRJob(v.into()));
24816 self
24817 }
24818
24819 /// The value of [job_type][crate::model::OrderedJob::job_type]
24820 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
24821 /// holds a different branch.
24822 pub fn spark_sql_job(
24823 &self,
24824 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
24825 #[allow(unreachable_patterns)]
24826 self.job_type.as_ref().and_then(|v| match v {
24827 crate::model::ordered_job::JobType::SparkSqlJob(v) => std::option::Option::Some(v),
24828 _ => std::option::Option::None,
24829 })
24830 }
24831
24832 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24833 /// to hold a `SparkSqlJob`.
24834 ///
24835 /// Note that all the setters affecting `job_type` are
24836 /// mutually exclusive.
24837 ///
24838 /// # Example
24839 /// ```ignore,no_run
24840 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24841 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
24842 /// let x = OrderedJob::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
24843 /// assert!(x.spark_sql_job().is_some());
24844 /// assert!(x.hadoop_job().is_none());
24845 /// assert!(x.spark_job().is_none());
24846 /// assert!(x.pyspark_job().is_none());
24847 /// assert!(x.hive_job().is_none());
24848 /// assert!(x.pig_job().is_none());
24849 /// assert!(x.spark_r_job().is_none());
24850 /// assert!(x.presto_job().is_none());
24851 /// assert!(x.trino_job().is_none());
24852 /// assert!(x.flink_job().is_none());
24853 /// ```
24854 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
24855 mut self,
24856 v: T,
24857 ) -> Self {
24858 self.job_type =
24859 std::option::Option::Some(crate::model::ordered_job::JobType::SparkSqlJob(v.into()));
24860 self
24861 }
24862
24863 /// The value of [job_type][crate::model::OrderedJob::job_type]
24864 /// if it holds a `PrestoJob`, `None` if the field is not set or
24865 /// holds a different branch.
24866 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
24867 #[allow(unreachable_patterns)]
24868 self.job_type.as_ref().and_then(|v| match v {
24869 crate::model::ordered_job::JobType::PrestoJob(v) => std::option::Option::Some(v),
24870 _ => std::option::Option::None,
24871 })
24872 }
24873
24874 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24875 /// to hold a `PrestoJob`.
24876 ///
24877 /// Note that all the setters affecting `job_type` are
24878 /// mutually exclusive.
24879 ///
24880 /// # Example
24881 /// ```ignore,no_run
24882 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24883 /// use google_cloud_dataproc_v1::model::PrestoJob;
24884 /// let x = OrderedJob::new().set_presto_job(PrestoJob::default()/* use setters */);
24885 /// assert!(x.presto_job().is_some());
24886 /// assert!(x.hadoop_job().is_none());
24887 /// assert!(x.spark_job().is_none());
24888 /// assert!(x.pyspark_job().is_none());
24889 /// assert!(x.hive_job().is_none());
24890 /// assert!(x.pig_job().is_none());
24891 /// assert!(x.spark_r_job().is_none());
24892 /// assert!(x.spark_sql_job().is_none());
24893 /// assert!(x.trino_job().is_none());
24894 /// assert!(x.flink_job().is_none());
24895 /// ```
24896 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
24897 mut self,
24898 v: T,
24899 ) -> Self {
24900 self.job_type =
24901 std::option::Option::Some(crate::model::ordered_job::JobType::PrestoJob(v.into()));
24902 self
24903 }
24904
24905 /// The value of [job_type][crate::model::OrderedJob::job_type]
24906 /// if it holds a `TrinoJob`, `None` if the field is not set or
24907 /// holds a different branch.
24908 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
24909 #[allow(unreachable_patterns)]
24910 self.job_type.as_ref().and_then(|v| match v {
24911 crate::model::ordered_job::JobType::TrinoJob(v) => std::option::Option::Some(v),
24912 _ => std::option::Option::None,
24913 })
24914 }
24915
24916 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24917 /// to hold a `TrinoJob`.
24918 ///
24919 /// Note that all the setters affecting `job_type` are
24920 /// mutually exclusive.
24921 ///
24922 /// # Example
24923 /// ```ignore,no_run
24924 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24925 /// use google_cloud_dataproc_v1::model::TrinoJob;
24926 /// let x = OrderedJob::new().set_trino_job(TrinoJob::default()/* use setters */);
24927 /// assert!(x.trino_job().is_some());
24928 /// assert!(x.hadoop_job().is_none());
24929 /// assert!(x.spark_job().is_none());
24930 /// assert!(x.pyspark_job().is_none());
24931 /// assert!(x.hive_job().is_none());
24932 /// assert!(x.pig_job().is_none());
24933 /// assert!(x.spark_r_job().is_none());
24934 /// assert!(x.spark_sql_job().is_none());
24935 /// assert!(x.presto_job().is_none());
24936 /// assert!(x.flink_job().is_none());
24937 /// ```
24938 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
24939 mut self,
24940 v: T,
24941 ) -> Self {
24942 self.job_type =
24943 std::option::Option::Some(crate::model::ordered_job::JobType::TrinoJob(v.into()));
24944 self
24945 }
24946
24947 /// The value of [job_type][crate::model::OrderedJob::job_type]
24948 /// if it holds a `FlinkJob`, `None` if the field is not set or
24949 /// holds a different branch.
24950 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
24951 #[allow(unreachable_patterns)]
24952 self.job_type.as_ref().and_then(|v| match v {
24953 crate::model::ordered_job::JobType::FlinkJob(v) => std::option::Option::Some(v),
24954 _ => std::option::Option::None,
24955 })
24956 }
24957
24958 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24959 /// to hold a `FlinkJob`.
24960 ///
24961 /// Note that all the setters affecting `job_type` are
24962 /// mutually exclusive.
24963 ///
24964 /// # Example
24965 /// ```ignore,no_run
24966 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24967 /// use google_cloud_dataproc_v1::model::FlinkJob;
24968 /// let x = OrderedJob::new().set_flink_job(FlinkJob::default()/* use setters */);
24969 /// assert!(x.flink_job().is_some());
24970 /// assert!(x.hadoop_job().is_none());
24971 /// assert!(x.spark_job().is_none());
24972 /// assert!(x.pyspark_job().is_none());
24973 /// assert!(x.hive_job().is_none());
24974 /// assert!(x.pig_job().is_none());
24975 /// assert!(x.spark_r_job().is_none());
24976 /// assert!(x.spark_sql_job().is_none());
24977 /// assert!(x.presto_job().is_none());
24978 /// assert!(x.trino_job().is_none());
24979 /// ```
24980 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
24981 mut self,
24982 v: T,
24983 ) -> Self {
24984 self.job_type =
24985 std::option::Option::Some(crate::model::ordered_job::JobType::FlinkJob(v.into()));
24986 self
24987 }
24988}
24989
24990impl wkt::message::Message for OrderedJob {
24991 fn typename() -> &'static str {
24992 "type.googleapis.com/google.cloud.dataproc.v1.OrderedJob"
24993 }
24994}
24995
24996/// Defines additional types related to [OrderedJob].
24997pub mod ordered_job {
24998 #[allow(unused_imports)]
24999 use super::*;
25000
25001 /// Required. The job definition.
25002 #[derive(Clone, Debug, PartialEq)]
25003 #[non_exhaustive]
25004 pub enum JobType {
25005 /// Optional. Job is a Hadoop job.
25006 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
25007 /// Optional. Job is a Spark job.
25008 SparkJob(std::boxed::Box<crate::model::SparkJob>),
25009 /// Optional. Job is a PySpark job.
25010 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
25011 /// Optional. Job is a Hive job.
25012 HiveJob(std::boxed::Box<crate::model::HiveJob>),
25013 /// Optional. Job is a Pig job.
25014 PigJob(std::boxed::Box<crate::model::PigJob>),
25015 /// Optional. Job is a SparkR job.
25016 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
25017 /// Optional. Job is a SparkSql job.
25018 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
25019 /// Optional. Job is a Presto job.
25020 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
25021 /// Optional. Job is a Trino job.
25022 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
25023 /// Optional. Job is a Flink job.
25024 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
25025 }
25026}
25027
25028/// A configurable parameter that replaces one or more fields in the template.
25029/// Parameterizable fields:
25030///
25031/// - Labels
25032/// - File uris
25033/// - Job properties
25034/// - Job arguments
25035/// - Script variables
25036/// - Main class (in HadoopJob and SparkJob)
25037/// - Zone (in ClusterSelector)
25038#[derive(Clone, Default, PartialEq)]
25039#[non_exhaustive]
25040pub struct TemplateParameter {
25041 /// Required. Parameter name.
25042 /// The parameter name is used as the key, and paired with the
25043 /// parameter value, which are passed to the template when the template
25044 /// is instantiated.
25045 /// The name must contain only capital letters (A-Z), numbers (0-9), and
25046 /// underscores (_), and must not start with a number. The maximum length is
25047 /// 40 characters.
25048 pub name: std::string::String,
25049
25050 /// Required. Paths to all fields that the parameter replaces.
25051 /// A field is allowed to appear in at most one parameter's list of field
25052 /// paths.
25053 ///
25054 /// A field path is similar in syntax to a
25055 /// [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
25056 /// field path that references the zone field of a workflow template's cluster
25057 /// selector would be specified as `placement.clusterSelector.zone`.
25058 ///
25059 /// Also, field paths can reference fields using the following syntax:
25060 ///
25061 /// * Values in maps can be referenced by key:
25062 ///
25063 /// * labels['key']
25064 /// * placement.clusterSelector.clusterLabels['key']
25065 /// * placement.managedCluster.labels['key']
25066 /// * placement.clusterSelector.clusterLabels['key']
25067 /// * jobs['step-id'].labels['key']
25068 /// * Jobs in the jobs list can be referenced by step-id:
25069 ///
25070 /// * jobs['step-id'].hadoopJob.mainJarFileUri
25071 /// * jobs['step-id'].hiveJob.queryFileUri
25072 /// * jobs['step-id'].pySparkJob.mainPythonFileUri
25073 /// * jobs['step-id'].hadoopJob.jarFileUris[0]
25074 /// * jobs['step-id'].hadoopJob.archiveUris[0]
25075 /// * jobs['step-id'].hadoopJob.fileUris[0]
25076 /// * jobs['step-id'].pySparkJob.pythonFileUris[0]
25077 /// * Items in repeated fields can be referenced by a zero-based index:
25078 ///
25079 /// * jobs['step-id'].sparkJob.args[0]
25080 /// * Other examples:
25081 ///
25082 /// * jobs['step-id'].hadoopJob.properties['key']
25083 /// * jobs['step-id'].hadoopJob.args[0]
25084 /// * jobs['step-id'].hiveJob.scriptVariables['key']
25085 /// * jobs['step-id'].hadoopJob.mainJarFileUri
25086 /// * placement.clusterSelector.zone
25087 ///
25088 /// It may not be possible to parameterize maps and repeated fields in their
25089 /// entirety since only individual map values and individual items in repeated
25090 /// fields can be referenced. For example, the following field paths are
25091 /// invalid:
25092 ///
25093 /// - placement.clusterSelector.clusterLabels
25094 /// - jobs['step-id'].sparkJob.args
25095 ///
25096 /// [google.protobuf.FieldMask]: wkt::FieldMask
25097 pub fields: std::vec::Vec<std::string::String>,
25098
25099 /// Optional. Brief description of the parameter.
25100 /// Must not exceed 1024 characters.
25101 pub description: std::string::String,
25102
25103 /// Optional. Validation rules to be applied to this parameter's value.
25104 pub validation: std::option::Option<crate::model::ParameterValidation>,
25105
25106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25107}
25108
25109impl TemplateParameter {
25110 /// Creates a new default instance.
25111 pub fn new() -> Self {
25112 std::default::Default::default()
25113 }
25114
25115 /// Sets the value of [name][crate::model::TemplateParameter::name].
25116 ///
25117 /// # Example
25118 /// ```ignore,no_run
25119 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
25120 /// let x = TemplateParameter::new().set_name("example");
25121 /// ```
25122 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25123 self.name = v.into();
25124 self
25125 }
25126
25127 /// Sets the value of [fields][crate::model::TemplateParameter::fields].
25128 ///
25129 /// # Example
25130 /// ```ignore,no_run
25131 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
25132 /// let x = TemplateParameter::new().set_fields(["a", "b", "c"]);
25133 /// ```
25134 pub fn set_fields<T, V>(mut self, v: T) -> Self
25135 where
25136 T: std::iter::IntoIterator<Item = V>,
25137 V: std::convert::Into<std::string::String>,
25138 {
25139 use std::iter::Iterator;
25140 self.fields = v.into_iter().map(|i| i.into()).collect();
25141 self
25142 }
25143
25144 /// Sets the value of [description][crate::model::TemplateParameter::description].
25145 ///
25146 /// # Example
25147 /// ```ignore,no_run
25148 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
25149 /// let x = TemplateParameter::new().set_description("example");
25150 /// ```
25151 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25152 self.description = v.into();
25153 self
25154 }
25155
25156 /// Sets the value of [validation][crate::model::TemplateParameter::validation].
25157 ///
25158 /// # Example
25159 /// ```ignore,no_run
25160 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
25161 /// use google_cloud_dataproc_v1::model::ParameterValidation;
25162 /// let x = TemplateParameter::new().set_validation(ParameterValidation::default()/* use setters */);
25163 /// ```
25164 pub fn set_validation<T>(mut self, v: T) -> Self
25165 where
25166 T: std::convert::Into<crate::model::ParameterValidation>,
25167 {
25168 self.validation = std::option::Option::Some(v.into());
25169 self
25170 }
25171
25172 /// Sets or clears the value of [validation][crate::model::TemplateParameter::validation].
25173 ///
25174 /// # Example
25175 /// ```ignore,no_run
25176 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
25177 /// use google_cloud_dataproc_v1::model::ParameterValidation;
25178 /// let x = TemplateParameter::new().set_or_clear_validation(Some(ParameterValidation::default()/* use setters */));
25179 /// let x = TemplateParameter::new().set_or_clear_validation(None::<ParameterValidation>);
25180 /// ```
25181 pub fn set_or_clear_validation<T>(mut self, v: std::option::Option<T>) -> Self
25182 where
25183 T: std::convert::Into<crate::model::ParameterValidation>,
25184 {
25185 self.validation = v.map(|x| x.into());
25186 self
25187 }
25188}
25189
25190impl wkt::message::Message for TemplateParameter {
25191 fn typename() -> &'static str {
25192 "type.googleapis.com/google.cloud.dataproc.v1.TemplateParameter"
25193 }
25194}
25195
25196/// Configuration for parameter validation.
25197#[derive(Clone, Default, PartialEq)]
25198#[non_exhaustive]
25199pub struct ParameterValidation {
25200 /// Required. The type of validation to be performed.
25201 pub validation_type: std::option::Option<crate::model::parameter_validation::ValidationType>,
25202
25203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25204}
25205
25206impl ParameterValidation {
25207 /// Creates a new default instance.
25208 pub fn new() -> Self {
25209 std::default::Default::default()
25210 }
25211
25212 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type].
25213 ///
25214 /// Note that all the setters affecting `validation_type` are mutually
25215 /// exclusive.
25216 ///
25217 /// # Example
25218 /// ```ignore,no_run
25219 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
25220 /// use google_cloud_dataproc_v1::model::RegexValidation;
25221 /// let x = ParameterValidation::new().set_validation_type(Some(
25222 /// google_cloud_dataproc_v1::model::parameter_validation::ValidationType::Regex(RegexValidation::default().into())));
25223 /// ```
25224 pub fn set_validation_type<
25225 T: std::convert::Into<std::option::Option<crate::model::parameter_validation::ValidationType>>,
25226 >(
25227 mut self,
25228 v: T,
25229 ) -> Self {
25230 self.validation_type = v.into();
25231 self
25232 }
25233
25234 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
25235 /// if it holds a `Regex`, `None` if the field is not set or
25236 /// holds a different branch.
25237 pub fn regex(&self) -> std::option::Option<&std::boxed::Box<crate::model::RegexValidation>> {
25238 #[allow(unreachable_patterns)]
25239 self.validation_type.as_ref().and_then(|v| match v {
25240 crate::model::parameter_validation::ValidationType::Regex(v) => {
25241 std::option::Option::Some(v)
25242 }
25243 _ => std::option::Option::None,
25244 })
25245 }
25246
25247 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
25248 /// to hold a `Regex`.
25249 ///
25250 /// Note that all the setters affecting `validation_type` are
25251 /// mutually exclusive.
25252 ///
25253 /// # Example
25254 /// ```ignore,no_run
25255 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
25256 /// use google_cloud_dataproc_v1::model::RegexValidation;
25257 /// let x = ParameterValidation::new().set_regex(RegexValidation::default()/* use setters */);
25258 /// assert!(x.regex().is_some());
25259 /// assert!(x.values().is_none());
25260 /// ```
25261 pub fn set_regex<T: std::convert::Into<std::boxed::Box<crate::model::RegexValidation>>>(
25262 mut self,
25263 v: T,
25264 ) -> Self {
25265 self.validation_type = std::option::Option::Some(
25266 crate::model::parameter_validation::ValidationType::Regex(v.into()),
25267 );
25268 self
25269 }
25270
25271 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
25272 /// if it holds a `Values`, `None` if the field is not set or
25273 /// holds a different branch.
25274 pub fn values(&self) -> std::option::Option<&std::boxed::Box<crate::model::ValueValidation>> {
25275 #[allow(unreachable_patterns)]
25276 self.validation_type.as_ref().and_then(|v| match v {
25277 crate::model::parameter_validation::ValidationType::Values(v) => {
25278 std::option::Option::Some(v)
25279 }
25280 _ => std::option::Option::None,
25281 })
25282 }
25283
25284 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
25285 /// to hold a `Values`.
25286 ///
25287 /// Note that all the setters affecting `validation_type` are
25288 /// mutually exclusive.
25289 ///
25290 /// # Example
25291 /// ```ignore,no_run
25292 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
25293 /// use google_cloud_dataproc_v1::model::ValueValidation;
25294 /// let x = ParameterValidation::new().set_values(ValueValidation::default()/* use setters */);
25295 /// assert!(x.values().is_some());
25296 /// assert!(x.regex().is_none());
25297 /// ```
25298 pub fn set_values<T: std::convert::Into<std::boxed::Box<crate::model::ValueValidation>>>(
25299 mut self,
25300 v: T,
25301 ) -> Self {
25302 self.validation_type = std::option::Option::Some(
25303 crate::model::parameter_validation::ValidationType::Values(v.into()),
25304 );
25305 self
25306 }
25307}
25308
25309impl wkt::message::Message for ParameterValidation {
25310 fn typename() -> &'static str {
25311 "type.googleapis.com/google.cloud.dataproc.v1.ParameterValidation"
25312 }
25313}
25314
25315/// Defines additional types related to [ParameterValidation].
25316pub mod parameter_validation {
25317 #[allow(unused_imports)]
25318 use super::*;
25319
25320 /// Required. The type of validation to be performed.
25321 #[derive(Clone, Debug, PartialEq)]
25322 #[non_exhaustive]
25323 pub enum ValidationType {
25324 /// Validation based on regular expressions.
25325 Regex(std::boxed::Box<crate::model::RegexValidation>),
25326 /// Validation based on a list of allowed values.
25327 Values(std::boxed::Box<crate::model::ValueValidation>),
25328 }
25329}
25330
25331/// Validation based on regular expressions.
25332#[derive(Clone, Default, PartialEq)]
25333#[non_exhaustive]
25334pub struct RegexValidation {
25335 /// Required. RE2 regular expressions used to validate the parameter's value.
25336 /// The value must match the regex in its entirety (substring
25337 /// matches are not sufficient).
25338 pub regexes: std::vec::Vec<std::string::String>,
25339
25340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25341}
25342
25343impl RegexValidation {
25344 /// Creates a new default instance.
25345 pub fn new() -> Self {
25346 std::default::Default::default()
25347 }
25348
25349 /// Sets the value of [regexes][crate::model::RegexValidation::regexes].
25350 ///
25351 /// # Example
25352 /// ```ignore,no_run
25353 /// # use google_cloud_dataproc_v1::model::RegexValidation;
25354 /// let x = RegexValidation::new().set_regexes(["a", "b", "c"]);
25355 /// ```
25356 pub fn set_regexes<T, V>(mut self, v: T) -> Self
25357 where
25358 T: std::iter::IntoIterator<Item = V>,
25359 V: std::convert::Into<std::string::String>,
25360 {
25361 use std::iter::Iterator;
25362 self.regexes = v.into_iter().map(|i| i.into()).collect();
25363 self
25364 }
25365}
25366
25367impl wkt::message::Message for RegexValidation {
25368 fn typename() -> &'static str {
25369 "type.googleapis.com/google.cloud.dataproc.v1.RegexValidation"
25370 }
25371}
25372
25373/// Validation based on a list of allowed values.
25374#[derive(Clone, Default, PartialEq)]
25375#[non_exhaustive]
25376pub struct ValueValidation {
25377 /// Required. List of allowed values for the parameter.
25378 pub values: std::vec::Vec<std::string::String>,
25379
25380 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25381}
25382
25383impl ValueValidation {
25384 /// Creates a new default instance.
25385 pub fn new() -> Self {
25386 std::default::Default::default()
25387 }
25388
25389 /// Sets the value of [values][crate::model::ValueValidation::values].
25390 ///
25391 /// # Example
25392 /// ```ignore,no_run
25393 /// # use google_cloud_dataproc_v1::model::ValueValidation;
25394 /// let x = ValueValidation::new().set_values(["a", "b", "c"]);
25395 /// ```
25396 pub fn set_values<T, V>(mut self, v: T) -> Self
25397 where
25398 T: std::iter::IntoIterator<Item = V>,
25399 V: std::convert::Into<std::string::String>,
25400 {
25401 use std::iter::Iterator;
25402 self.values = v.into_iter().map(|i| i.into()).collect();
25403 self
25404 }
25405}
25406
25407impl wkt::message::Message for ValueValidation {
25408 fn typename() -> &'static str {
25409 "type.googleapis.com/google.cloud.dataproc.v1.ValueValidation"
25410 }
25411}
25412
25413/// A Dataproc workflow template resource.
25414#[derive(Clone, Default, PartialEq)]
25415#[non_exhaustive]
25416pub struct WorkflowMetadata {
25417 /// Output only. The resource name of the workflow template as described
25418 /// in <https://cloud.google.com/apis/design/resource_names>.
25419 ///
25420 /// * For `projects.regions.workflowTemplates`, the resource name of the
25421 /// template has the following format:
25422 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25423 ///
25424 /// * For `projects.locations.workflowTemplates`, the resource name of the
25425 /// template has the following format:
25426 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25427 ///
25428 pub template: std::string::String,
25429
25430 /// Output only. The version of template at the time of
25431 /// workflow instantiation.
25432 pub version: i32,
25433
25434 /// Output only. The create cluster operation metadata.
25435 pub create_cluster: std::option::Option<crate::model::ClusterOperation>,
25436
25437 /// Output only. The workflow graph.
25438 pub graph: std::option::Option<crate::model::WorkflowGraph>,
25439
25440 /// Output only. The delete cluster operation metadata.
25441 pub delete_cluster: std::option::Option<crate::model::ClusterOperation>,
25442
25443 /// Output only. The workflow state.
25444 pub state: crate::model::workflow_metadata::State,
25445
25446 /// Output only. The name of the target cluster.
25447 pub cluster_name: std::string::String,
25448
25449 /// Map from parameter names to values that were used for those parameters.
25450 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
25451
25452 /// Output only. Workflow start time.
25453 pub start_time: std::option::Option<wkt::Timestamp>,
25454
25455 /// Output only. Workflow end time.
25456 pub end_time: std::option::Option<wkt::Timestamp>,
25457
25458 /// Output only. The UUID of target cluster.
25459 pub cluster_uuid: std::string::String,
25460
25461 /// Output only. The timeout duration for the DAG of jobs, expressed in seconds
25462 /// (see [JSON representation of
25463 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
25464 pub dag_timeout: std::option::Option<wkt::Duration>,
25465
25466 /// Output only. DAG start time, only set for workflows with
25467 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
25468 /// DAG begins.
25469 ///
25470 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
25471 pub dag_start_time: std::option::Option<wkt::Timestamp>,
25472
25473 /// Output only. DAG end time, only set for workflows with
25474 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
25475 /// DAG ends.
25476 ///
25477 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
25478 pub dag_end_time: std::option::Option<wkt::Timestamp>,
25479
25480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25481}
25482
25483impl WorkflowMetadata {
25484 /// Creates a new default instance.
25485 pub fn new() -> Self {
25486 std::default::Default::default()
25487 }
25488
25489 /// Sets the value of [template][crate::model::WorkflowMetadata::template].
25490 ///
25491 /// # Example
25492 /// ```ignore,no_run
25493 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25494 /// let x = WorkflowMetadata::new().set_template("example");
25495 /// ```
25496 pub fn set_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25497 self.template = v.into();
25498 self
25499 }
25500
25501 /// Sets the value of [version][crate::model::WorkflowMetadata::version].
25502 ///
25503 /// # Example
25504 /// ```ignore,no_run
25505 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25506 /// let x = WorkflowMetadata::new().set_version(42);
25507 /// ```
25508 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25509 self.version = v.into();
25510 self
25511 }
25512
25513 /// Sets the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
25514 ///
25515 /// # Example
25516 /// ```ignore,no_run
25517 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25518 /// use google_cloud_dataproc_v1::model::ClusterOperation;
25519 /// let x = WorkflowMetadata::new().set_create_cluster(ClusterOperation::default()/* use setters */);
25520 /// ```
25521 pub fn set_create_cluster<T>(mut self, v: T) -> Self
25522 where
25523 T: std::convert::Into<crate::model::ClusterOperation>,
25524 {
25525 self.create_cluster = std::option::Option::Some(v.into());
25526 self
25527 }
25528
25529 /// Sets or clears the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
25530 ///
25531 /// # Example
25532 /// ```ignore,no_run
25533 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25534 /// use google_cloud_dataproc_v1::model::ClusterOperation;
25535 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(Some(ClusterOperation::default()/* use setters */));
25536 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(None::<ClusterOperation>);
25537 /// ```
25538 pub fn set_or_clear_create_cluster<T>(mut self, v: std::option::Option<T>) -> Self
25539 where
25540 T: std::convert::Into<crate::model::ClusterOperation>,
25541 {
25542 self.create_cluster = v.map(|x| x.into());
25543 self
25544 }
25545
25546 /// Sets the value of [graph][crate::model::WorkflowMetadata::graph].
25547 ///
25548 /// # Example
25549 /// ```ignore,no_run
25550 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25551 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
25552 /// let x = WorkflowMetadata::new().set_graph(WorkflowGraph::default()/* use setters */);
25553 /// ```
25554 pub fn set_graph<T>(mut self, v: T) -> Self
25555 where
25556 T: std::convert::Into<crate::model::WorkflowGraph>,
25557 {
25558 self.graph = std::option::Option::Some(v.into());
25559 self
25560 }
25561
25562 /// Sets or clears the value of [graph][crate::model::WorkflowMetadata::graph].
25563 ///
25564 /// # Example
25565 /// ```ignore,no_run
25566 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25567 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
25568 /// let x = WorkflowMetadata::new().set_or_clear_graph(Some(WorkflowGraph::default()/* use setters */));
25569 /// let x = WorkflowMetadata::new().set_or_clear_graph(None::<WorkflowGraph>);
25570 /// ```
25571 pub fn set_or_clear_graph<T>(mut self, v: std::option::Option<T>) -> Self
25572 where
25573 T: std::convert::Into<crate::model::WorkflowGraph>,
25574 {
25575 self.graph = v.map(|x| x.into());
25576 self
25577 }
25578
25579 /// Sets the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
25580 ///
25581 /// # Example
25582 /// ```ignore,no_run
25583 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25584 /// use google_cloud_dataproc_v1::model::ClusterOperation;
25585 /// let x = WorkflowMetadata::new().set_delete_cluster(ClusterOperation::default()/* use setters */);
25586 /// ```
25587 pub fn set_delete_cluster<T>(mut self, v: T) -> Self
25588 where
25589 T: std::convert::Into<crate::model::ClusterOperation>,
25590 {
25591 self.delete_cluster = std::option::Option::Some(v.into());
25592 self
25593 }
25594
25595 /// Sets or clears the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
25596 ///
25597 /// # Example
25598 /// ```ignore,no_run
25599 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25600 /// use google_cloud_dataproc_v1::model::ClusterOperation;
25601 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(Some(ClusterOperation::default()/* use setters */));
25602 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(None::<ClusterOperation>);
25603 /// ```
25604 pub fn set_or_clear_delete_cluster<T>(mut self, v: std::option::Option<T>) -> Self
25605 where
25606 T: std::convert::Into<crate::model::ClusterOperation>,
25607 {
25608 self.delete_cluster = v.map(|x| x.into());
25609 self
25610 }
25611
25612 /// Sets the value of [state][crate::model::WorkflowMetadata::state].
25613 ///
25614 /// # Example
25615 /// ```ignore,no_run
25616 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25617 /// use google_cloud_dataproc_v1::model::workflow_metadata::State;
25618 /// let x0 = WorkflowMetadata::new().set_state(State::Pending);
25619 /// let x1 = WorkflowMetadata::new().set_state(State::Running);
25620 /// let x2 = WorkflowMetadata::new().set_state(State::Done);
25621 /// ```
25622 pub fn set_state<T: std::convert::Into<crate::model::workflow_metadata::State>>(
25623 mut self,
25624 v: T,
25625 ) -> Self {
25626 self.state = v.into();
25627 self
25628 }
25629
25630 /// Sets the value of [cluster_name][crate::model::WorkflowMetadata::cluster_name].
25631 ///
25632 /// # Example
25633 /// ```ignore,no_run
25634 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25635 /// let x = WorkflowMetadata::new().set_cluster_name("example");
25636 /// ```
25637 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25638 self.cluster_name = v.into();
25639 self
25640 }
25641
25642 /// Sets the value of [parameters][crate::model::WorkflowMetadata::parameters].
25643 ///
25644 /// # Example
25645 /// ```ignore,no_run
25646 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25647 /// let x = WorkflowMetadata::new().set_parameters([
25648 /// ("key0", "abc"),
25649 /// ("key1", "xyz"),
25650 /// ]);
25651 /// ```
25652 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
25653 where
25654 T: std::iter::IntoIterator<Item = (K, V)>,
25655 K: std::convert::Into<std::string::String>,
25656 V: std::convert::Into<std::string::String>,
25657 {
25658 use std::iter::Iterator;
25659 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
25660 self
25661 }
25662
25663 /// Sets the value of [start_time][crate::model::WorkflowMetadata::start_time].
25664 ///
25665 /// # Example
25666 /// ```ignore,no_run
25667 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25668 /// use wkt::Timestamp;
25669 /// let x = WorkflowMetadata::new().set_start_time(Timestamp::default()/* use setters */);
25670 /// ```
25671 pub fn set_start_time<T>(mut self, v: T) -> Self
25672 where
25673 T: std::convert::Into<wkt::Timestamp>,
25674 {
25675 self.start_time = std::option::Option::Some(v.into());
25676 self
25677 }
25678
25679 /// Sets or clears the value of [start_time][crate::model::WorkflowMetadata::start_time].
25680 ///
25681 /// # Example
25682 /// ```ignore,no_run
25683 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25684 /// use wkt::Timestamp;
25685 /// let x = WorkflowMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
25686 /// let x = WorkflowMetadata::new().set_or_clear_start_time(None::<Timestamp>);
25687 /// ```
25688 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
25689 where
25690 T: std::convert::Into<wkt::Timestamp>,
25691 {
25692 self.start_time = v.map(|x| x.into());
25693 self
25694 }
25695
25696 /// Sets the value of [end_time][crate::model::WorkflowMetadata::end_time].
25697 ///
25698 /// # Example
25699 /// ```ignore,no_run
25700 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25701 /// use wkt::Timestamp;
25702 /// let x = WorkflowMetadata::new().set_end_time(Timestamp::default()/* use setters */);
25703 /// ```
25704 pub fn set_end_time<T>(mut self, v: T) -> Self
25705 where
25706 T: std::convert::Into<wkt::Timestamp>,
25707 {
25708 self.end_time = std::option::Option::Some(v.into());
25709 self
25710 }
25711
25712 /// Sets or clears the value of [end_time][crate::model::WorkflowMetadata::end_time].
25713 ///
25714 /// # Example
25715 /// ```ignore,no_run
25716 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25717 /// use wkt::Timestamp;
25718 /// let x = WorkflowMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
25719 /// let x = WorkflowMetadata::new().set_or_clear_end_time(None::<Timestamp>);
25720 /// ```
25721 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
25722 where
25723 T: std::convert::Into<wkt::Timestamp>,
25724 {
25725 self.end_time = v.map(|x| x.into());
25726 self
25727 }
25728
25729 /// Sets the value of [cluster_uuid][crate::model::WorkflowMetadata::cluster_uuid].
25730 ///
25731 /// # Example
25732 /// ```ignore,no_run
25733 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25734 /// let x = WorkflowMetadata::new().set_cluster_uuid("example");
25735 /// ```
25736 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25737 self.cluster_uuid = v.into();
25738 self
25739 }
25740
25741 /// Sets the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
25742 ///
25743 /// # Example
25744 /// ```ignore,no_run
25745 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25746 /// use wkt::Duration;
25747 /// let x = WorkflowMetadata::new().set_dag_timeout(Duration::default()/* use setters */);
25748 /// ```
25749 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
25750 where
25751 T: std::convert::Into<wkt::Duration>,
25752 {
25753 self.dag_timeout = std::option::Option::Some(v.into());
25754 self
25755 }
25756
25757 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
25758 ///
25759 /// # Example
25760 /// ```ignore,no_run
25761 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25762 /// use wkt::Duration;
25763 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
25764 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(None::<Duration>);
25765 /// ```
25766 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
25767 where
25768 T: std::convert::Into<wkt::Duration>,
25769 {
25770 self.dag_timeout = v.map(|x| x.into());
25771 self
25772 }
25773
25774 /// Sets the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
25775 ///
25776 /// # Example
25777 /// ```ignore,no_run
25778 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25779 /// use wkt::Timestamp;
25780 /// let x = WorkflowMetadata::new().set_dag_start_time(Timestamp::default()/* use setters */);
25781 /// ```
25782 pub fn set_dag_start_time<T>(mut self, v: T) -> Self
25783 where
25784 T: std::convert::Into<wkt::Timestamp>,
25785 {
25786 self.dag_start_time = std::option::Option::Some(v.into());
25787 self
25788 }
25789
25790 /// Sets or clears the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
25791 ///
25792 /// # Example
25793 /// ```ignore,no_run
25794 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25795 /// use wkt::Timestamp;
25796 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(Some(Timestamp::default()/* use setters */));
25797 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(None::<Timestamp>);
25798 /// ```
25799 pub fn set_or_clear_dag_start_time<T>(mut self, v: std::option::Option<T>) -> Self
25800 where
25801 T: std::convert::Into<wkt::Timestamp>,
25802 {
25803 self.dag_start_time = v.map(|x| x.into());
25804 self
25805 }
25806
25807 /// Sets the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
25808 ///
25809 /// # Example
25810 /// ```ignore,no_run
25811 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25812 /// use wkt::Timestamp;
25813 /// let x = WorkflowMetadata::new().set_dag_end_time(Timestamp::default()/* use setters */);
25814 /// ```
25815 pub fn set_dag_end_time<T>(mut self, v: T) -> Self
25816 where
25817 T: std::convert::Into<wkt::Timestamp>,
25818 {
25819 self.dag_end_time = std::option::Option::Some(v.into());
25820 self
25821 }
25822
25823 /// Sets or clears the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
25824 ///
25825 /// # Example
25826 /// ```ignore,no_run
25827 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25828 /// use wkt::Timestamp;
25829 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(Some(Timestamp::default()/* use setters */));
25830 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(None::<Timestamp>);
25831 /// ```
25832 pub fn set_or_clear_dag_end_time<T>(mut self, v: std::option::Option<T>) -> Self
25833 where
25834 T: std::convert::Into<wkt::Timestamp>,
25835 {
25836 self.dag_end_time = v.map(|x| x.into());
25837 self
25838 }
25839}
25840
25841impl wkt::message::Message for WorkflowMetadata {
25842 fn typename() -> &'static str {
25843 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowMetadata"
25844 }
25845}
25846
25847/// Defines additional types related to [WorkflowMetadata].
25848pub mod workflow_metadata {
25849 #[allow(unused_imports)]
25850 use super::*;
25851
25852 /// The operation state.
25853 ///
25854 /// # Working with unknown values
25855 ///
25856 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25857 /// additional enum variants at any time. Adding new variants is not considered
25858 /// a breaking change. Applications should write their code in anticipation of:
25859 ///
25860 /// - New values appearing in future releases of the client library, **and**
25861 /// - New values received dynamically, without application changes.
25862 ///
25863 /// Please consult the [Working with enums] section in the user guide for some
25864 /// guidelines.
25865 ///
25866 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25867 #[derive(Clone, Debug, PartialEq)]
25868 #[non_exhaustive]
25869 pub enum State {
25870 /// Unused.
25871 Unknown,
25872 /// The operation has been created.
25873 Pending,
25874 /// The operation is running.
25875 Running,
25876 /// The operation is done; either cancelled or completed.
25877 Done,
25878 /// If set, the enum was initialized with an unknown value.
25879 ///
25880 /// Applications can examine the value using [State::value] or
25881 /// [State::name].
25882 UnknownValue(state::UnknownValue),
25883 }
25884
25885 #[doc(hidden)]
25886 pub mod state {
25887 #[allow(unused_imports)]
25888 use super::*;
25889 #[derive(Clone, Debug, PartialEq)]
25890 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25891 }
25892
25893 impl State {
25894 /// Gets the enum value.
25895 ///
25896 /// Returns `None` if the enum contains an unknown value deserialized from
25897 /// the string representation of enums.
25898 pub fn value(&self) -> std::option::Option<i32> {
25899 match self {
25900 Self::Unknown => std::option::Option::Some(0),
25901 Self::Pending => std::option::Option::Some(1),
25902 Self::Running => std::option::Option::Some(2),
25903 Self::Done => std::option::Option::Some(3),
25904 Self::UnknownValue(u) => u.0.value(),
25905 }
25906 }
25907
25908 /// Gets the enum value as a string.
25909 ///
25910 /// Returns `None` if the enum contains an unknown value deserialized from
25911 /// the integer representation of enums.
25912 pub fn name(&self) -> std::option::Option<&str> {
25913 match self {
25914 Self::Unknown => std::option::Option::Some("UNKNOWN"),
25915 Self::Pending => std::option::Option::Some("PENDING"),
25916 Self::Running => std::option::Option::Some("RUNNING"),
25917 Self::Done => std::option::Option::Some("DONE"),
25918 Self::UnknownValue(u) => u.0.name(),
25919 }
25920 }
25921 }
25922
25923 impl std::default::Default for State {
25924 fn default() -> Self {
25925 use std::convert::From;
25926 Self::from(0)
25927 }
25928 }
25929
25930 impl std::fmt::Display for State {
25931 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25932 wkt::internal::display_enum(f, self.name(), self.value())
25933 }
25934 }
25935
25936 impl std::convert::From<i32> for State {
25937 fn from(value: i32) -> Self {
25938 match value {
25939 0 => Self::Unknown,
25940 1 => Self::Pending,
25941 2 => Self::Running,
25942 3 => Self::Done,
25943 _ => Self::UnknownValue(state::UnknownValue(
25944 wkt::internal::UnknownEnumValue::Integer(value),
25945 )),
25946 }
25947 }
25948 }
25949
25950 impl std::convert::From<&str> for State {
25951 fn from(value: &str) -> Self {
25952 use std::string::ToString;
25953 match value {
25954 "UNKNOWN" => Self::Unknown,
25955 "PENDING" => Self::Pending,
25956 "RUNNING" => Self::Running,
25957 "DONE" => Self::Done,
25958 _ => Self::UnknownValue(state::UnknownValue(
25959 wkt::internal::UnknownEnumValue::String(value.to_string()),
25960 )),
25961 }
25962 }
25963 }
25964
25965 impl serde::ser::Serialize for State {
25966 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25967 where
25968 S: serde::Serializer,
25969 {
25970 match self {
25971 Self::Unknown => serializer.serialize_i32(0),
25972 Self::Pending => serializer.serialize_i32(1),
25973 Self::Running => serializer.serialize_i32(2),
25974 Self::Done => serializer.serialize_i32(3),
25975 Self::UnknownValue(u) => u.0.serialize(serializer),
25976 }
25977 }
25978 }
25979
25980 impl<'de> serde::de::Deserialize<'de> for State {
25981 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25982 where
25983 D: serde::Deserializer<'de>,
25984 {
25985 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
25986 ".google.cloud.dataproc.v1.WorkflowMetadata.State",
25987 ))
25988 }
25989 }
25990}
25991
25992/// The cluster operation triggered by a workflow.
25993#[derive(Clone, Default, PartialEq)]
25994#[non_exhaustive]
25995pub struct ClusterOperation {
25996 /// Output only. The id of the cluster operation.
25997 pub operation_id: std::string::String,
25998
25999 /// Output only. Error, if operation failed.
26000 pub error: std::string::String,
26001
26002 /// Output only. Indicates the operation is done.
26003 pub done: bool,
26004
26005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26006}
26007
26008impl ClusterOperation {
26009 /// Creates a new default instance.
26010 pub fn new() -> Self {
26011 std::default::Default::default()
26012 }
26013
26014 /// Sets the value of [operation_id][crate::model::ClusterOperation::operation_id].
26015 ///
26016 /// # Example
26017 /// ```ignore,no_run
26018 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
26019 /// let x = ClusterOperation::new().set_operation_id("example");
26020 /// ```
26021 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26022 self.operation_id = v.into();
26023 self
26024 }
26025
26026 /// Sets the value of [error][crate::model::ClusterOperation::error].
26027 ///
26028 /// # Example
26029 /// ```ignore,no_run
26030 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
26031 /// let x = ClusterOperation::new().set_error("example");
26032 /// ```
26033 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26034 self.error = v.into();
26035 self
26036 }
26037
26038 /// Sets the value of [done][crate::model::ClusterOperation::done].
26039 ///
26040 /// # Example
26041 /// ```ignore,no_run
26042 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
26043 /// let x = ClusterOperation::new().set_done(true);
26044 /// ```
26045 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
26046 self.done = v.into();
26047 self
26048 }
26049}
26050
26051impl wkt::message::Message for ClusterOperation {
26052 fn typename() -> &'static str {
26053 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperation"
26054 }
26055}
26056
26057/// The workflow graph.
26058#[derive(Clone, Default, PartialEq)]
26059#[non_exhaustive]
26060pub struct WorkflowGraph {
26061 /// Output only. The workflow nodes.
26062 pub nodes: std::vec::Vec<crate::model::WorkflowNode>,
26063
26064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26065}
26066
26067impl WorkflowGraph {
26068 /// Creates a new default instance.
26069 pub fn new() -> Self {
26070 std::default::Default::default()
26071 }
26072
26073 /// Sets the value of [nodes][crate::model::WorkflowGraph::nodes].
26074 ///
26075 /// # Example
26076 /// ```ignore,no_run
26077 /// # use google_cloud_dataproc_v1::model::WorkflowGraph;
26078 /// use google_cloud_dataproc_v1::model::WorkflowNode;
26079 /// let x = WorkflowGraph::new()
26080 /// .set_nodes([
26081 /// WorkflowNode::default()/* use setters */,
26082 /// WorkflowNode::default()/* use (different) setters */,
26083 /// ]);
26084 /// ```
26085 pub fn set_nodes<T, V>(mut self, v: T) -> Self
26086 where
26087 T: std::iter::IntoIterator<Item = V>,
26088 V: std::convert::Into<crate::model::WorkflowNode>,
26089 {
26090 use std::iter::Iterator;
26091 self.nodes = v.into_iter().map(|i| i.into()).collect();
26092 self
26093 }
26094}
26095
26096impl wkt::message::Message for WorkflowGraph {
26097 fn typename() -> &'static str {
26098 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowGraph"
26099 }
26100}
26101
26102/// The workflow node.
26103#[derive(Clone, Default, PartialEq)]
26104#[non_exhaustive]
26105pub struct WorkflowNode {
26106 /// Output only. The name of the node.
26107 pub step_id: std::string::String,
26108
26109 /// Output only. Node's prerequisite nodes.
26110 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
26111
26112 /// Output only. The job id; populated after the node enters RUNNING state.
26113 pub job_id: std::string::String,
26114
26115 /// Output only. The node state.
26116 pub state: crate::model::workflow_node::NodeState,
26117
26118 /// Output only. The error detail.
26119 pub error: std::string::String,
26120
26121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26122}
26123
26124impl WorkflowNode {
26125 /// Creates a new default instance.
26126 pub fn new() -> Self {
26127 std::default::Default::default()
26128 }
26129
26130 /// Sets the value of [step_id][crate::model::WorkflowNode::step_id].
26131 ///
26132 /// # Example
26133 /// ```ignore,no_run
26134 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
26135 /// let x = WorkflowNode::new().set_step_id("example");
26136 /// ```
26137 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26138 self.step_id = v.into();
26139 self
26140 }
26141
26142 /// Sets the value of [prerequisite_step_ids][crate::model::WorkflowNode::prerequisite_step_ids].
26143 ///
26144 /// # Example
26145 /// ```ignore,no_run
26146 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
26147 /// let x = WorkflowNode::new().set_prerequisite_step_ids(["a", "b", "c"]);
26148 /// ```
26149 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
26150 where
26151 T: std::iter::IntoIterator<Item = V>,
26152 V: std::convert::Into<std::string::String>,
26153 {
26154 use std::iter::Iterator;
26155 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
26156 self
26157 }
26158
26159 /// Sets the value of [job_id][crate::model::WorkflowNode::job_id].
26160 ///
26161 /// # Example
26162 /// ```ignore,no_run
26163 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
26164 /// let x = WorkflowNode::new().set_job_id("example");
26165 /// ```
26166 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26167 self.job_id = v.into();
26168 self
26169 }
26170
26171 /// Sets the value of [state][crate::model::WorkflowNode::state].
26172 ///
26173 /// # Example
26174 /// ```ignore,no_run
26175 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
26176 /// use google_cloud_dataproc_v1::model::workflow_node::NodeState;
26177 /// let x0 = WorkflowNode::new().set_state(NodeState::Blocked);
26178 /// let x1 = WorkflowNode::new().set_state(NodeState::Runnable);
26179 /// let x2 = WorkflowNode::new().set_state(NodeState::Running);
26180 /// ```
26181 pub fn set_state<T: std::convert::Into<crate::model::workflow_node::NodeState>>(
26182 mut self,
26183 v: T,
26184 ) -> Self {
26185 self.state = v.into();
26186 self
26187 }
26188
26189 /// Sets the value of [error][crate::model::WorkflowNode::error].
26190 ///
26191 /// # Example
26192 /// ```ignore,no_run
26193 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
26194 /// let x = WorkflowNode::new().set_error("example");
26195 /// ```
26196 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26197 self.error = v.into();
26198 self
26199 }
26200}
26201
26202impl wkt::message::Message for WorkflowNode {
26203 fn typename() -> &'static str {
26204 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowNode"
26205 }
26206}
26207
26208/// Defines additional types related to [WorkflowNode].
26209pub mod workflow_node {
26210 #[allow(unused_imports)]
26211 use super::*;
26212
26213 /// The workflow node state.
26214 ///
26215 /// # Working with unknown values
26216 ///
26217 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26218 /// additional enum variants at any time. Adding new variants is not considered
26219 /// a breaking change. Applications should write their code in anticipation of:
26220 ///
26221 /// - New values appearing in future releases of the client library, **and**
26222 /// - New values received dynamically, without application changes.
26223 ///
26224 /// Please consult the [Working with enums] section in the user guide for some
26225 /// guidelines.
26226 ///
26227 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
26228 #[derive(Clone, Debug, PartialEq)]
26229 #[non_exhaustive]
26230 pub enum NodeState {
26231 /// State is unspecified.
26232 Unspecified,
26233 /// The node is awaiting prerequisite node to finish.
26234 Blocked,
26235 /// The node is runnable but not running.
26236 Runnable,
26237 /// The node is running.
26238 Running,
26239 /// The node completed successfully.
26240 Completed,
26241 /// The node failed. A node can be marked FAILED because
26242 /// its ancestor or peer failed.
26243 Failed,
26244 /// If set, the enum was initialized with an unknown value.
26245 ///
26246 /// Applications can examine the value using [NodeState::value] or
26247 /// [NodeState::name].
26248 UnknownValue(node_state::UnknownValue),
26249 }
26250
26251 #[doc(hidden)]
26252 pub mod node_state {
26253 #[allow(unused_imports)]
26254 use super::*;
26255 #[derive(Clone, Debug, PartialEq)]
26256 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26257 }
26258
26259 impl NodeState {
26260 /// Gets the enum value.
26261 ///
26262 /// Returns `None` if the enum contains an unknown value deserialized from
26263 /// the string representation of enums.
26264 pub fn value(&self) -> std::option::Option<i32> {
26265 match self {
26266 Self::Unspecified => std::option::Option::Some(0),
26267 Self::Blocked => std::option::Option::Some(1),
26268 Self::Runnable => std::option::Option::Some(2),
26269 Self::Running => std::option::Option::Some(3),
26270 Self::Completed => std::option::Option::Some(4),
26271 Self::Failed => std::option::Option::Some(5),
26272 Self::UnknownValue(u) => u.0.value(),
26273 }
26274 }
26275
26276 /// Gets the enum value as a string.
26277 ///
26278 /// Returns `None` if the enum contains an unknown value deserialized from
26279 /// the integer representation of enums.
26280 pub fn name(&self) -> std::option::Option<&str> {
26281 match self {
26282 Self::Unspecified => std::option::Option::Some("NODE_STATE_UNSPECIFIED"),
26283 Self::Blocked => std::option::Option::Some("BLOCKED"),
26284 Self::Runnable => std::option::Option::Some("RUNNABLE"),
26285 Self::Running => std::option::Option::Some("RUNNING"),
26286 Self::Completed => std::option::Option::Some("COMPLETED"),
26287 Self::Failed => std::option::Option::Some("FAILED"),
26288 Self::UnknownValue(u) => u.0.name(),
26289 }
26290 }
26291 }
26292
26293 impl std::default::Default for NodeState {
26294 fn default() -> Self {
26295 use std::convert::From;
26296 Self::from(0)
26297 }
26298 }
26299
26300 impl std::fmt::Display for NodeState {
26301 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26302 wkt::internal::display_enum(f, self.name(), self.value())
26303 }
26304 }
26305
26306 impl std::convert::From<i32> for NodeState {
26307 fn from(value: i32) -> Self {
26308 match value {
26309 0 => Self::Unspecified,
26310 1 => Self::Blocked,
26311 2 => Self::Runnable,
26312 3 => Self::Running,
26313 4 => Self::Completed,
26314 5 => Self::Failed,
26315 _ => Self::UnknownValue(node_state::UnknownValue(
26316 wkt::internal::UnknownEnumValue::Integer(value),
26317 )),
26318 }
26319 }
26320 }
26321
26322 impl std::convert::From<&str> for NodeState {
26323 fn from(value: &str) -> Self {
26324 use std::string::ToString;
26325 match value {
26326 "NODE_STATE_UNSPECIFIED" => Self::Unspecified,
26327 "BLOCKED" => Self::Blocked,
26328 "RUNNABLE" => Self::Runnable,
26329 "RUNNING" => Self::Running,
26330 "COMPLETED" => Self::Completed,
26331 "FAILED" => Self::Failed,
26332 _ => Self::UnknownValue(node_state::UnknownValue(
26333 wkt::internal::UnknownEnumValue::String(value.to_string()),
26334 )),
26335 }
26336 }
26337 }
26338
26339 impl serde::ser::Serialize for NodeState {
26340 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26341 where
26342 S: serde::Serializer,
26343 {
26344 match self {
26345 Self::Unspecified => serializer.serialize_i32(0),
26346 Self::Blocked => serializer.serialize_i32(1),
26347 Self::Runnable => serializer.serialize_i32(2),
26348 Self::Running => serializer.serialize_i32(3),
26349 Self::Completed => serializer.serialize_i32(4),
26350 Self::Failed => serializer.serialize_i32(5),
26351 Self::UnknownValue(u) => u.0.serialize(serializer),
26352 }
26353 }
26354 }
26355
26356 impl<'de> serde::de::Deserialize<'de> for NodeState {
26357 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26358 where
26359 D: serde::Deserializer<'de>,
26360 {
26361 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeState>::new(
26362 ".google.cloud.dataproc.v1.WorkflowNode.NodeState",
26363 ))
26364 }
26365 }
26366}
26367
26368/// A request to create a workflow template.
26369#[derive(Clone, Default, PartialEq)]
26370#[non_exhaustive]
26371pub struct CreateWorkflowTemplateRequest {
26372 /// Required. The resource name of the region or location, as described
26373 /// in <https://cloud.google.com/apis/design/resource_names>.
26374 ///
26375 /// * For `projects.regions.workflowTemplates.create`, the resource name of the
26376 /// region has the following format:
26377 /// `projects/{project_id}/regions/{region}`
26378 ///
26379 /// * For `projects.locations.workflowTemplates.create`, the resource name of
26380 /// the location has the following format:
26381 /// `projects/{project_id}/locations/{location}`
26382 ///
26383 pub parent: std::string::String,
26384
26385 /// Required. The Dataproc workflow template to create.
26386 pub template: std::option::Option<crate::model::WorkflowTemplate>,
26387
26388 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26389}
26390
26391impl CreateWorkflowTemplateRequest {
26392 /// Creates a new default instance.
26393 pub fn new() -> Self {
26394 std::default::Default::default()
26395 }
26396
26397 /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
26398 ///
26399 /// # Example
26400 /// ```ignore,no_run
26401 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
26402 /// # let project_id = "project_id";
26403 /// # let region_id = "region_id";
26404 /// let x = CreateWorkflowTemplateRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}"));
26405 /// ```
26406 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26407 self.parent = v.into();
26408 self
26409 }
26410
26411 /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
26412 ///
26413 /// # Example
26414 /// ```ignore,no_run
26415 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
26416 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26417 /// let x = CreateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
26418 /// ```
26419 pub fn set_template<T>(mut self, v: T) -> Self
26420 where
26421 T: std::convert::Into<crate::model::WorkflowTemplate>,
26422 {
26423 self.template = std::option::Option::Some(v.into());
26424 self
26425 }
26426
26427 /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
26428 ///
26429 /// # Example
26430 /// ```ignore,no_run
26431 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
26432 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26433 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
26434 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
26435 /// ```
26436 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
26437 where
26438 T: std::convert::Into<crate::model::WorkflowTemplate>,
26439 {
26440 self.template = v.map(|x| x.into());
26441 self
26442 }
26443}
26444
26445impl wkt::message::Message for CreateWorkflowTemplateRequest {
26446 fn typename() -> &'static str {
26447 "type.googleapis.com/google.cloud.dataproc.v1.CreateWorkflowTemplateRequest"
26448 }
26449}
26450
26451/// A request to fetch a workflow template.
26452#[derive(Clone, Default, PartialEq)]
26453#[non_exhaustive]
26454pub struct GetWorkflowTemplateRequest {
26455 /// Required. The resource name of the workflow template, as described
26456 /// in <https://cloud.google.com/apis/design/resource_names>.
26457 ///
26458 /// * For `projects.regions.workflowTemplates.get`, the resource name of the
26459 /// template has the following format:
26460 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
26461 ///
26462 /// * For `projects.locations.workflowTemplates.get`, the resource name of the
26463 /// template has the following format:
26464 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
26465 ///
26466 pub name: std::string::String,
26467
26468 /// Optional. The version of workflow template to retrieve. Only previously
26469 /// instantiated versions can be retrieved.
26470 ///
26471 /// If unspecified, retrieves the current version.
26472 pub version: i32,
26473
26474 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26475}
26476
26477impl GetWorkflowTemplateRequest {
26478 /// Creates a new default instance.
26479 pub fn new() -> Self {
26480 std::default::Default::default()
26481 }
26482
26483 /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
26484 ///
26485 /// # Example
26486 /// ```ignore,no_run
26487 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
26488 /// # let project_id = "project_id";
26489 /// # let region_id = "region_id";
26490 /// # let workflow_template_id = "workflow_template_id";
26491 /// let x = GetWorkflowTemplateRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
26492 /// ```
26493 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26494 self.name = v.into();
26495 self
26496 }
26497
26498 /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
26499 ///
26500 /// # Example
26501 /// ```ignore,no_run
26502 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
26503 /// let x = GetWorkflowTemplateRequest::new().set_version(42);
26504 /// ```
26505 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26506 self.version = v.into();
26507 self
26508 }
26509}
26510
26511impl wkt::message::Message for GetWorkflowTemplateRequest {
26512 fn typename() -> &'static str {
26513 "type.googleapis.com/google.cloud.dataproc.v1.GetWorkflowTemplateRequest"
26514 }
26515}
26516
26517/// A request to instantiate a workflow template.
26518#[derive(Clone, Default, PartialEq)]
26519#[non_exhaustive]
26520pub struct InstantiateWorkflowTemplateRequest {
26521 /// Required. The resource name of the workflow template, as described
26522 /// in <https://cloud.google.com/apis/design/resource_names>.
26523 ///
26524 /// * For `projects.regions.workflowTemplates.instantiate`, the resource name
26525 /// of the template has the following format:
26526 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
26527 ///
26528 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
26529 /// of the template has the following format:
26530 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
26531 ///
26532 pub name: std::string::String,
26533
26534 /// Optional. The version of workflow template to instantiate. If specified,
26535 /// the workflow will be instantiated only if the current version of
26536 /// the workflow template has the supplied version.
26537 ///
26538 /// This option cannot be used to instantiate a previous version of
26539 /// workflow template.
26540 pub version: i32,
26541
26542 /// Optional. A tag that prevents multiple concurrent workflow
26543 /// instances with the same tag from running. This mitigates risk of
26544 /// concurrent instances started due to retries.
26545 ///
26546 /// It is recommended to always set this value to a
26547 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
26548 ///
26549 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
26550 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
26551 pub request_id: std::string::String,
26552
26553 /// Optional. Map from parameter names to values that should be used for those
26554 /// parameters. Values may not exceed 1000 characters.
26555 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
26556
26557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26558}
26559
26560impl InstantiateWorkflowTemplateRequest {
26561 /// Creates a new default instance.
26562 pub fn new() -> Self {
26563 std::default::Default::default()
26564 }
26565
26566 /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
26567 ///
26568 /// # Example
26569 /// ```ignore,no_run
26570 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26571 /// # let project_id = "project_id";
26572 /// # let region_id = "region_id";
26573 /// # let workflow_template_id = "workflow_template_id";
26574 /// let x = InstantiateWorkflowTemplateRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
26575 /// ```
26576 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26577 self.name = v.into();
26578 self
26579 }
26580
26581 /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
26582 ///
26583 /// # Example
26584 /// ```ignore,no_run
26585 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26586 /// let x = InstantiateWorkflowTemplateRequest::new().set_version(42);
26587 /// ```
26588 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26589 self.version = v.into();
26590 self
26591 }
26592
26593 /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
26594 ///
26595 /// # Example
26596 /// ```ignore,no_run
26597 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26598 /// let x = InstantiateWorkflowTemplateRequest::new().set_request_id("example");
26599 /// ```
26600 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26601 self.request_id = v.into();
26602 self
26603 }
26604
26605 /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
26606 ///
26607 /// # Example
26608 /// ```ignore,no_run
26609 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26610 /// let x = InstantiateWorkflowTemplateRequest::new().set_parameters([
26611 /// ("key0", "abc"),
26612 /// ("key1", "xyz"),
26613 /// ]);
26614 /// ```
26615 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
26616 where
26617 T: std::iter::IntoIterator<Item = (K, V)>,
26618 K: std::convert::Into<std::string::String>,
26619 V: std::convert::Into<std::string::String>,
26620 {
26621 use std::iter::Iterator;
26622 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26623 self
26624 }
26625}
26626
26627impl wkt::message::Message for InstantiateWorkflowTemplateRequest {
26628 fn typename() -> &'static str {
26629 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest"
26630 }
26631}
26632
26633/// A request to instantiate an inline workflow template.
26634#[derive(Clone, Default, PartialEq)]
26635#[non_exhaustive]
26636pub struct InstantiateInlineWorkflowTemplateRequest {
26637 /// Required. The resource name of the region or location, as described
26638 /// in <https://cloud.google.com/apis/design/resource_names>.
26639 ///
26640 /// * For `projects.regions.workflowTemplates,instantiateinline`, the resource
26641 /// name of the region has the following format:
26642 /// `projects/{project_id}/regions/{region}`
26643 ///
26644 /// * For `projects.locations.workflowTemplates.instantiateinline`, the
26645 /// resource name of the location has the following format:
26646 /// `projects/{project_id}/locations/{location}`
26647 ///
26648 pub parent: std::string::String,
26649
26650 /// Required. The workflow template to instantiate.
26651 pub template: std::option::Option<crate::model::WorkflowTemplate>,
26652
26653 /// Optional. A tag that prevents multiple concurrent workflow
26654 /// instances with the same tag from running. This mitigates risk of
26655 /// concurrent instances started due to retries.
26656 ///
26657 /// It is recommended to always set this value to a
26658 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
26659 ///
26660 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
26661 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
26662 pub request_id: std::string::String,
26663
26664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26665}
26666
26667impl InstantiateInlineWorkflowTemplateRequest {
26668 /// Creates a new default instance.
26669 pub fn new() -> Self {
26670 std::default::Default::default()
26671 }
26672
26673 /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
26674 ///
26675 /// # Example
26676 /// ```ignore,no_run
26677 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26678 /// # let project_id = "project_id";
26679 /// # let region_id = "region_id";
26680 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}"));
26681 /// ```
26682 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26683 self.parent = v.into();
26684 self
26685 }
26686
26687 /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
26688 ///
26689 /// # Example
26690 /// ```ignore,no_run
26691 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26692 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26693 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
26694 /// ```
26695 pub fn set_template<T>(mut self, v: T) -> Self
26696 where
26697 T: std::convert::Into<crate::model::WorkflowTemplate>,
26698 {
26699 self.template = std::option::Option::Some(v.into());
26700 self
26701 }
26702
26703 /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
26704 ///
26705 /// # Example
26706 /// ```ignore,no_run
26707 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26708 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26709 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
26710 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
26711 /// ```
26712 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
26713 where
26714 T: std::convert::Into<crate::model::WorkflowTemplate>,
26715 {
26716 self.template = v.map(|x| x.into());
26717 self
26718 }
26719
26720 /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
26721 ///
26722 /// # Example
26723 /// ```ignore,no_run
26724 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26725 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_request_id("example");
26726 /// ```
26727 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26728 self.request_id = v.into();
26729 self
26730 }
26731}
26732
26733impl wkt::message::Message for InstantiateInlineWorkflowTemplateRequest {
26734 fn typename() -> &'static str {
26735 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest"
26736 }
26737}
26738
26739/// A request to update a workflow template.
26740#[derive(Clone, Default, PartialEq)]
26741#[non_exhaustive]
26742pub struct UpdateWorkflowTemplateRequest {
26743 /// Required. The updated workflow template.
26744 ///
26745 /// The `template.version` field must match the current version.
26746 pub template: std::option::Option<crate::model::WorkflowTemplate>,
26747
26748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26749}
26750
26751impl UpdateWorkflowTemplateRequest {
26752 /// Creates a new default instance.
26753 pub fn new() -> Self {
26754 std::default::Default::default()
26755 }
26756
26757 /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
26758 ///
26759 /// # Example
26760 /// ```ignore,no_run
26761 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
26762 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26763 /// let x = UpdateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
26764 /// ```
26765 pub fn set_template<T>(mut self, v: T) -> Self
26766 where
26767 T: std::convert::Into<crate::model::WorkflowTemplate>,
26768 {
26769 self.template = std::option::Option::Some(v.into());
26770 self
26771 }
26772
26773 /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
26774 ///
26775 /// # Example
26776 /// ```ignore,no_run
26777 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
26778 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26779 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
26780 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
26781 /// ```
26782 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
26783 where
26784 T: std::convert::Into<crate::model::WorkflowTemplate>,
26785 {
26786 self.template = v.map(|x| x.into());
26787 self
26788 }
26789}
26790
26791impl wkt::message::Message for UpdateWorkflowTemplateRequest {
26792 fn typename() -> &'static str {
26793 "type.googleapis.com/google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest"
26794 }
26795}
26796
26797/// A request to list workflow templates in a project.
26798#[derive(Clone, Default, PartialEq)]
26799#[non_exhaustive]
26800pub struct ListWorkflowTemplatesRequest {
26801 /// Required. The resource name of the region or location, as described
26802 /// in <https://cloud.google.com/apis/design/resource_names>.
26803 ///
26804 /// * For `projects.regions.workflowTemplates,list`, the resource
26805 /// name of the region has the following format:
26806 /// `projects/{project_id}/regions/{region}`
26807 ///
26808 /// * For `projects.locations.workflowTemplates.list`, the
26809 /// resource name of the location has the following format:
26810 /// `projects/{project_id}/locations/{location}`
26811 ///
26812 pub parent: std::string::String,
26813
26814 /// Optional. The maximum number of results to return in each response.
26815 pub page_size: i32,
26816
26817 /// Optional. The page token, returned by a previous call, to request the
26818 /// next page of results.
26819 pub page_token: std::string::String,
26820
26821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26822}
26823
26824impl ListWorkflowTemplatesRequest {
26825 /// Creates a new default instance.
26826 pub fn new() -> Self {
26827 std::default::Default::default()
26828 }
26829
26830 /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
26831 ///
26832 /// # Example
26833 /// ```ignore,no_run
26834 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
26835 /// # let project_id = "project_id";
26836 /// # let region_id = "region_id";
26837 /// let x = ListWorkflowTemplatesRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}"));
26838 /// ```
26839 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26840 self.parent = v.into();
26841 self
26842 }
26843
26844 /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
26845 ///
26846 /// # Example
26847 /// ```ignore,no_run
26848 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
26849 /// let x = ListWorkflowTemplatesRequest::new().set_page_size(42);
26850 /// ```
26851 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26852 self.page_size = v.into();
26853 self
26854 }
26855
26856 /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
26857 ///
26858 /// # Example
26859 /// ```ignore,no_run
26860 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
26861 /// let x = ListWorkflowTemplatesRequest::new().set_page_token("example");
26862 /// ```
26863 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26864 self.page_token = v.into();
26865 self
26866 }
26867}
26868
26869impl wkt::message::Message for ListWorkflowTemplatesRequest {
26870 fn typename() -> &'static str {
26871 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesRequest"
26872 }
26873}
26874
26875/// A response to a request to list workflow templates in a project.
26876#[derive(Clone, Default, PartialEq)]
26877#[non_exhaustive]
26878pub struct ListWorkflowTemplatesResponse {
26879 /// Output only. WorkflowTemplates list.
26880 pub templates: std::vec::Vec<crate::model::WorkflowTemplate>,
26881
26882 /// Output only. This token is included in the response if there are more
26883 /// results to fetch. To fetch additional results, provide this value as the
26884 /// page_token in a subsequent \<code\>ListWorkflowTemplatesRequest\</code\>.
26885 pub next_page_token: std::string::String,
26886
26887 /// Output only. List of workflow templates that could not be included in the
26888 /// response. Attempting to get one of these resources may indicate why it was
26889 /// not included in the list response.
26890 pub unreachable: std::vec::Vec<std::string::String>,
26891
26892 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26893}
26894
26895impl ListWorkflowTemplatesResponse {
26896 /// Creates a new default instance.
26897 pub fn new() -> Self {
26898 std::default::Default::default()
26899 }
26900
26901 /// Sets the value of [templates][crate::model::ListWorkflowTemplatesResponse::templates].
26902 ///
26903 /// # Example
26904 /// ```ignore,no_run
26905 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
26906 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26907 /// let x = ListWorkflowTemplatesResponse::new()
26908 /// .set_templates([
26909 /// WorkflowTemplate::default()/* use setters */,
26910 /// WorkflowTemplate::default()/* use (different) setters */,
26911 /// ]);
26912 /// ```
26913 pub fn set_templates<T, V>(mut self, v: T) -> Self
26914 where
26915 T: std::iter::IntoIterator<Item = V>,
26916 V: std::convert::Into<crate::model::WorkflowTemplate>,
26917 {
26918 use std::iter::Iterator;
26919 self.templates = v.into_iter().map(|i| i.into()).collect();
26920 self
26921 }
26922
26923 /// Sets the value of [next_page_token][crate::model::ListWorkflowTemplatesResponse::next_page_token].
26924 ///
26925 /// # Example
26926 /// ```ignore,no_run
26927 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
26928 /// let x = ListWorkflowTemplatesResponse::new().set_next_page_token("example");
26929 /// ```
26930 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26931 self.next_page_token = v.into();
26932 self
26933 }
26934
26935 /// Sets the value of [unreachable][crate::model::ListWorkflowTemplatesResponse::unreachable].
26936 ///
26937 /// # Example
26938 /// ```ignore,no_run
26939 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
26940 /// let x = ListWorkflowTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
26941 /// ```
26942 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
26943 where
26944 T: std::iter::IntoIterator<Item = V>,
26945 V: std::convert::Into<std::string::String>,
26946 {
26947 use std::iter::Iterator;
26948 self.unreachable = v.into_iter().map(|i| i.into()).collect();
26949 self
26950 }
26951}
26952
26953impl wkt::message::Message for ListWorkflowTemplatesResponse {
26954 fn typename() -> &'static str {
26955 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesResponse"
26956 }
26957}
26958
26959#[doc(hidden)]
26960impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowTemplatesResponse {
26961 type PageItem = crate::model::WorkflowTemplate;
26962
26963 fn items(self) -> std::vec::Vec<Self::PageItem> {
26964 self.templates
26965 }
26966
26967 fn next_page_token(&self) -> std::string::String {
26968 use std::clone::Clone;
26969 self.next_page_token.clone()
26970 }
26971}
26972
26973/// A request to delete a workflow template.
26974///
26975/// Currently started workflows will remain running.
26976#[derive(Clone, Default, PartialEq)]
26977#[non_exhaustive]
26978pub struct DeleteWorkflowTemplateRequest {
26979 /// Required. The resource name of the workflow template, as described
26980 /// in <https://cloud.google.com/apis/design/resource_names>.
26981 ///
26982 /// * For `projects.regions.workflowTemplates.delete`, the resource name
26983 /// of the template has the following format:
26984 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
26985 ///
26986 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
26987 /// of the template has the following format:
26988 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
26989 ///
26990 pub name: std::string::String,
26991
26992 /// Optional. The version of workflow template to delete. If specified,
26993 /// will only delete the template if the current server version matches
26994 /// specified version.
26995 pub version: i32,
26996
26997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26998}
26999
27000impl DeleteWorkflowTemplateRequest {
27001 /// Creates a new default instance.
27002 pub fn new() -> Self {
27003 std::default::Default::default()
27004 }
27005
27006 /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
27007 ///
27008 /// # Example
27009 /// ```ignore,no_run
27010 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
27011 /// # let project_id = "project_id";
27012 /// # let region_id = "region_id";
27013 /// # let workflow_template_id = "workflow_template_id";
27014 /// let x = DeleteWorkflowTemplateRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
27015 /// ```
27016 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27017 self.name = v.into();
27018 self
27019 }
27020
27021 /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
27022 ///
27023 /// # Example
27024 /// ```ignore,no_run
27025 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
27026 /// let x = DeleteWorkflowTemplateRequest::new().set_version(42);
27027 /// ```
27028 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
27029 self.version = v.into();
27030 self
27031 }
27032}
27033
27034impl wkt::message::Message for DeleteWorkflowTemplateRequest {
27035 fn typename() -> &'static str {
27036 "type.googleapis.com/google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest"
27037 }
27038}
27039
27040/// Cluster components that can be activated.
27041///
27042/// # Working with unknown values
27043///
27044/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27045/// additional enum variants at any time. Adding new variants is not considered
27046/// a breaking change. Applications should write their code in anticipation of:
27047///
27048/// - New values appearing in future releases of the client library, **and**
27049/// - New values received dynamically, without application changes.
27050///
27051/// Please consult the [Working with enums] section in the user guide for some
27052/// guidelines.
27053///
27054/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27055#[derive(Clone, Debug, PartialEq)]
27056#[non_exhaustive]
27057pub enum Component {
27058 /// Unspecified component. Specifying this will cause Cluster creation to fail.
27059 Unspecified,
27060 /// The Anaconda component is no longer supported or applicable to
27061 /// [supported Dataproc on Compute Engine image versions]
27062 /// (<https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-version-clusters#supported-dataproc-image-versions>).
27063 /// It cannot be activated on clusters created with supported Dataproc on
27064 /// Compute Engine image versions.
27065 Anaconda,
27066 /// Delta Lake.
27067 Delta,
27068 /// Docker
27069 Docker,
27070 /// The Druid query engine. (alpha)
27071 Druid,
27072 /// Flink
27073 Flink,
27074 /// HBase. (beta)
27075 Hbase,
27076 /// The Hive Web HCatalog (the REST service for accessing HCatalog).
27077 HiveWebhcat,
27078 /// Hudi.
27079 Hudi,
27080 /// Iceberg.
27081 Iceberg,
27082 /// The Jupyter Notebook.
27083 Jupyter,
27084 /// The Pig component.
27085 Pig,
27086 /// The Presto query engine.
27087 Presto,
27088 /// The Trino query engine.
27089 Trino,
27090 /// The Ranger service.
27091 Ranger,
27092 /// The Solr service.
27093 Solr,
27094 /// The Zeppelin notebook.
27095 Zeppelin,
27096 /// The Zookeeper service.
27097 Zookeeper,
27098 /// The Jupyter Kernel Gateway.
27099 JupyterKernelGateway,
27100 /// If set, the enum was initialized with an unknown value.
27101 ///
27102 /// Applications can examine the value using [Component::value] or
27103 /// [Component::name].
27104 UnknownValue(component::UnknownValue),
27105}
27106
27107#[doc(hidden)]
27108pub mod component {
27109 #[allow(unused_imports)]
27110 use super::*;
27111 #[derive(Clone, Debug, PartialEq)]
27112 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27113}
27114
27115impl Component {
27116 /// Gets the enum value.
27117 ///
27118 /// Returns `None` if the enum contains an unknown value deserialized from
27119 /// the string representation of enums.
27120 pub fn value(&self) -> std::option::Option<i32> {
27121 match self {
27122 Self::Unspecified => std::option::Option::Some(0),
27123 Self::Anaconda => std::option::Option::Some(5),
27124 Self::Delta => std::option::Option::Some(20),
27125 Self::Docker => std::option::Option::Some(13),
27126 Self::Druid => std::option::Option::Some(9),
27127 Self::Flink => std::option::Option::Some(14),
27128 Self::Hbase => std::option::Option::Some(11),
27129 Self::HiveWebhcat => std::option::Option::Some(3),
27130 Self::Hudi => std::option::Option::Some(18),
27131 Self::Iceberg => std::option::Option::Some(19),
27132 Self::Jupyter => std::option::Option::Some(1),
27133 Self::Pig => std::option::Option::Some(21),
27134 Self::Presto => std::option::Option::Some(6),
27135 Self::Trino => std::option::Option::Some(17),
27136 Self::Ranger => std::option::Option::Some(12),
27137 Self::Solr => std::option::Option::Some(10),
27138 Self::Zeppelin => std::option::Option::Some(4),
27139 Self::Zookeeper => std::option::Option::Some(8),
27140 Self::JupyterKernelGateway => std::option::Option::Some(22),
27141 Self::UnknownValue(u) => u.0.value(),
27142 }
27143 }
27144
27145 /// Gets the enum value as a string.
27146 ///
27147 /// Returns `None` if the enum contains an unknown value deserialized from
27148 /// the integer representation of enums.
27149 pub fn name(&self) -> std::option::Option<&str> {
27150 match self {
27151 Self::Unspecified => std::option::Option::Some("COMPONENT_UNSPECIFIED"),
27152 Self::Anaconda => std::option::Option::Some("ANACONDA"),
27153 Self::Delta => std::option::Option::Some("DELTA"),
27154 Self::Docker => std::option::Option::Some("DOCKER"),
27155 Self::Druid => std::option::Option::Some("DRUID"),
27156 Self::Flink => std::option::Option::Some("FLINK"),
27157 Self::Hbase => std::option::Option::Some("HBASE"),
27158 Self::HiveWebhcat => std::option::Option::Some("HIVE_WEBHCAT"),
27159 Self::Hudi => std::option::Option::Some("HUDI"),
27160 Self::Iceberg => std::option::Option::Some("ICEBERG"),
27161 Self::Jupyter => std::option::Option::Some("JUPYTER"),
27162 Self::Pig => std::option::Option::Some("PIG"),
27163 Self::Presto => std::option::Option::Some("PRESTO"),
27164 Self::Trino => std::option::Option::Some("TRINO"),
27165 Self::Ranger => std::option::Option::Some("RANGER"),
27166 Self::Solr => std::option::Option::Some("SOLR"),
27167 Self::Zeppelin => std::option::Option::Some("ZEPPELIN"),
27168 Self::Zookeeper => std::option::Option::Some("ZOOKEEPER"),
27169 Self::JupyterKernelGateway => std::option::Option::Some("JUPYTER_KERNEL_GATEWAY"),
27170 Self::UnknownValue(u) => u.0.name(),
27171 }
27172 }
27173}
27174
27175impl std::default::Default for Component {
27176 fn default() -> Self {
27177 use std::convert::From;
27178 Self::from(0)
27179 }
27180}
27181
27182impl std::fmt::Display for Component {
27183 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27184 wkt::internal::display_enum(f, self.name(), self.value())
27185 }
27186}
27187
27188impl std::convert::From<i32> for Component {
27189 fn from(value: i32) -> Self {
27190 match value {
27191 0 => Self::Unspecified,
27192 1 => Self::Jupyter,
27193 3 => Self::HiveWebhcat,
27194 4 => Self::Zeppelin,
27195 5 => Self::Anaconda,
27196 6 => Self::Presto,
27197 8 => Self::Zookeeper,
27198 9 => Self::Druid,
27199 10 => Self::Solr,
27200 11 => Self::Hbase,
27201 12 => Self::Ranger,
27202 13 => Self::Docker,
27203 14 => Self::Flink,
27204 17 => Self::Trino,
27205 18 => Self::Hudi,
27206 19 => Self::Iceberg,
27207 20 => Self::Delta,
27208 21 => Self::Pig,
27209 22 => Self::JupyterKernelGateway,
27210 _ => Self::UnknownValue(component::UnknownValue(
27211 wkt::internal::UnknownEnumValue::Integer(value),
27212 )),
27213 }
27214 }
27215}
27216
27217impl std::convert::From<&str> for Component {
27218 fn from(value: &str) -> Self {
27219 use std::string::ToString;
27220 match value {
27221 "COMPONENT_UNSPECIFIED" => Self::Unspecified,
27222 "ANACONDA" => Self::Anaconda,
27223 "DELTA" => Self::Delta,
27224 "DOCKER" => Self::Docker,
27225 "DRUID" => Self::Druid,
27226 "FLINK" => Self::Flink,
27227 "HBASE" => Self::Hbase,
27228 "HIVE_WEBHCAT" => Self::HiveWebhcat,
27229 "HUDI" => Self::Hudi,
27230 "ICEBERG" => Self::Iceberg,
27231 "JUPYTER" => Self::Jupyter,
27232 "PIG" => Self::Pig,
27233 "PRESTO" => Self::Presto,
27234 "TRINO" => Self::Trino,
27235 "RANGER" => Self::Ranger,
27236 "SOLR" => Self::Solr,
27237 "ZEPPELIN" => Self::Zeppelin,
27238 "ZOOKEEPER" => Self::Zookeeper,
27239 "JUPYTER_KERNEL_GATEWAY" => Self::JupyterKernelGateway,
27240 _ => Self::UnknownValue(component::UnknownValue(
27241 wkt::internal::UnknownEnumValue::String(value.to_string()),
27242 )),
27243 }
27244 }
27245}
27246
27247impl serde::ser::Serialize for Component {
27248 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27249 where
27250 S: serde::Serializer,
27251 {
27252 match self {
27253 Self::Unspecified => serializer.serialize_i32(0),
27254 Self::Anaconda => serializer.serialize_i32(5),
27255 Self::Delta => serializer.serialize_i32(20),
27256 Self::Docker => serializer.serialize_i32(13),
27257 Self::Druid => serializer.serialize_i32(9),
27258 Self::Flink => serializer.serialize_i32(14),
27259 Self::Hbase => serializer.serialize_i32(11),
27260 Self::HiveWebhcat => serializer.serialize_i32(3),
27261 Self::Hudi => serializer.serialize_i32(18),
27262 Self::Iceberg => serializer.serialize_i32(19),
27263 Self::Jupyter => serializer.serialize_i32(1),
27264 Self::Pig => serializer.serialize_i32(21),
27265 Self::Presto => serializer.serialize_i32(6),
27266 Self::Trino => serializer.serialize_i32(17),
27267 Self::Ranger => serializer.serialize_i32(12),
27268 Self::Solr => serializer.serialize_i32(10),
27269 Self::Zeppelin => serializer.serialize_i32(4),
27270 Self::Zookeeper => serializer.serialize_i32(8),
27271 Self::JupyterKernelGateway => serializer.serialize_i32(22),
27272 Self::UnknownValue(u) => u.0.serialize(serializer),
27273 }
27274 }
27275}
27276
27277impl<'de> serde::de::Deserialize<'de> for Component {
27278 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27279 where
27280 D: serde::Deserializer<'de>,
27281 {
27282 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Component>::new(
27283 ".google.cloud.dataproc.v1.Component",
27284 ))
27285 }
27286}
27287
27288/// Actions in response to failure of a resource associated with a cluster.
27289///
27290/// # Working with unknown values
27291///
27292/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27293/// additional enum variants at any time. Adding new variants is not considered
27294/// a breaking change. Applications should write their code in anticipation of:
27295///
27296/// - New values appearing in future releases of the client library, **and**
27297/// - New values received dynamically, without application changes.
27298///
27299/// Please consult the [Working with enums] section in the user guide for some
27300/// guidelines.
27301///
27302/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27303#[derive(Clone, Debug, PartialEq)]
27304#[non_exhaustive]
27305pub enum FailureAction {
27306 /// When FailureAction is unspecified, failure action defaults to NO_ACTION.
27307 Unspecified,
27308 /// Take no action on failure to create a cluster resource. NO_ACTION is the
27309 /// default.
27310 NoAction,
27311 /// Delete the failed cluster resource.
27312 Delete,
27313 /// If set, the enum was initialized with an unknown value.
27314 ///
27315 /// Applications can examine the value using [FailureAction::value] or
27316 /// [FailureAction::name].
27317 UnknownValue(failure_action::UnknownValue),
27318}
27319
27320#[doc(hidden)]
27321pub mod failure_action {
27322 #[allow(unused_imports)]
27323 use super::*;
27324 #[derive(Clone, Debug, PartialEq)]
27325 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27326}
27327
27328impl FailureAction {
27329 /// Gets the enum value.
27330 ///
27331 /// Returns `None` if the enum contains an unknown value deserialized from
27332 /// the string representation of enums.
27333 pub fn value(&self) -> std::option::Option<i32> {
27334 match self {
27335 Self::Unspecified => std::option::Option::Some(0),
27336 Self::NoAction => std::option::Option::Some(1),
27337 Self::Delete => std::option::Option::Some(2),
27338 Self::UnknownValue(u) => u.0.value(),
27339 }
27340 }
27341
27342 /// Gets the enum value as a string.
27343 ///
27344 /// Returns `None` if the enum contains an unknown value deserialized from
27345 /// the integer representation of enums.
27346 pub fn name(&self) -> std::option::Option<&str> {
27347 match self {
27348 Self::Unspecified => std::option::Option::Some("FAILURE_ACTION_UNSPECIFIED"),
27349 Self::NoAction => std::option::Option::Some("NO_ACTION"),
27350 Self::Delete => std::option::Option::Some("DELETE"),
27351 Self::UnknownValue(u) => u.0.name(),
27352 }
27353 }
27354}
27355
27356impl std::default::Default for FailureAction {
27357 fn default() -> Self {
27358 use std::convert::From;
27359 Self::from(0)
27360 }
27361}
27362
27363impl std::fmt::Display for FailureAction {
27364 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27365 wkt::internal::display_enum(f, self.name(), self.value())
27366 }
27367}
27368
27369impl std::convert::From<i32> for FailureAction {
27370 fn from(value: i32) -> Self {
27371 match value {
27372 0 => Self::Unspecified,
27373 1 => Self::NoAction,
27374 2 => Self::Delete,
27375 _ => Self::UnknownValue(failure_action::UnknownValue(
27376 wkt::internal::UnknownEnumValue::Integer(value),
27377 )),
27378 }
27379 }
27380}
27381
27382impl std::convert::From<&str> for FailureAction {
27383 fn from(value: &str) -> Self {
27384 use std::string::ToString;
27385 match value {
27386 "FAILURE_ACTION_UNSPECIFIED" => Self::Unspecified,
27387 "NO_ACTION" => Self::NoAction,
27388 "DELETE" => Self::Delete,
27389 _ => Self::UnknownValue(failure_action::UnknownValue(
27390 wkt::internal::UnknownEnumValue::String(value.to_string()),
27391 )),
27392 }
27393 }
27394}
27395
27396impl serde::ser::Serialize for FailureAction {
27397 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27398 where
27399 S: serde::Serializer,
27400 {
27401 match self {
27402 Self::Unspecified => serializer.serialize_i32(0),
27403 Self::NoAction => serializer.serialize_i32(1),
27404 Self::Delete => serializer.serialize_i32(2),
27405 Self::UnknownValue(u) => u.0.serialize(serializer),
27406 }
27407 }
27408}
27409
27410impl<'de> serde::de::Deserialize<'de> for FailureAction {
27411 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27412 where
27413 D: serde::Deserializer<'de>,
27414 {
27415 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureAction>::new(
27416 ".google.cloud.dataproc.v1.FailureAction",
27417 ))
27418 }
27419}