google_cloud_dataproc_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_type;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Describes an autoscaling policy for Dataproc cluster autoscaler.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct AutoscalingPolicy {
43 /// Required. The policy id.
44 ///
45 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
46 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
47 /// or hyphen. Must consist of between 3 and 50 characters.
48 pub id: std::string::String,
49
50 /// Output only. The "resource name" of the autoscaling policy, as described
51 /// in <https://cloud.google.com/apis/design/resource_names>.
52 ///
53 /// * For `projects.regions.autoscalingPolicies`, the resource name of the
54 /// policy has the following format:
55 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
56 ///
57 /// * For `projects.locations.autoscalingPolicies`, the resource name of the
58 /// policy has the following format:
59 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
60 ///
61 pub name: std::string::String,
62
63 /// Required. Describes how the autoscaler will operate for primary workers.
64 pub worker_config: std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
65
66 /// Optional. Describes how the autoscaler will operate for secondary workers.
67 pub secondary_worker_config:
68 std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
69
70 /// Optional. The labels to associate with this autoscaling policy.
71 /// Label **keys** must contain 1 to 63 characters, and must conform to
72 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
73 /// Label **values** may be empty, but, if present, must contain 1 to 63
74 /// characters, and must conform to [RFC
75 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
76 /// associated with an autoscaling policy.
77 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
78
79 /// Optional. The type of the clusters for which this autoscaling policy is to
80 /// be configured.
81 pub cluster_type: crate::model::autoscaling_policy::ClusterType,
82
83 /// Autoscaling algorithm for policy.
84 pub algorithm: std::option::Option<crate::model::autoscaling_policy::Algorithm>,
85
86 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl AutoscalingPolicy {
90 /// Creates a new default instance.
91 pub fn new() -> Self {
92 std::default::Default::default()
93 }
94
95 /// Sets the value of [id][crate::model::AutoscalingPolicy::id].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
100 /// let x = AutoscalingPolicy::new().set_id("example");
101 /// ```
102 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103 self.id = v.into();
104 self
105 }
106
107 /// Sets the value of [name][crate::model::AutoscalingPolicy::name].
108 ///
109 /// # Example
110 /// ```ignore,no_run
111 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
112 /// # let project_id = "project_id";
113 /// # let location_id = "location_id";
114 /// # let autoscaling_policy_id = "autoscaling_policy_id";
115 /// let x = AutoscalingPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/autoscalingPolicies/{autoscaling_policy_id}"));
116 /// ```
117 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
118 self.name = v.into();
119 self
120 }
121
122 /// Sets the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
123 ///
124 /// # Example
125 /// ```ignore,no_run
126 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
127 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
128 /// let x = AutoscalingPolicy::new().set_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
129 /// ```
130 pub fn set_worker_config<T>(mut self, v: T) -> Self
131 where
132 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
133 {
134 self.worker_config = std::option::Option::Some(v.into());
135 self
136 }
137
138 /// Sets or clears the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
139 ///
140 /// # Example
141 /// ```ignore,no_run
142 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
143 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
144 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
145 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
146 /// ```
147 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
148 where
149 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
150 {
151 self.worker_config = v.map(|x| x.into());
152 self
153 }
154
155 /// Sets the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
156 ///
157 /// # Example
158 /// ```ignore,no_run
159 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
160 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
161 /// let x = AutoscalingPolicy::new().set_secondary_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
162 /// ```
163 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
164 where
165 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
166 {
167 self.secondary_worker_config = std::option::Option::Some(v.into());
168 self
169 }
170
171 /// Sets or clears the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
176 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
177 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
178 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
179 /// ```
180 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
181 where
182 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
183 {
184 self.secondary_worker_config = v.map(|x| x.into());
185 self
186 }
187
188 /// Sets the value of [labels][crate::model::AutoscalingPolicy::labels].
189 ///
190 /// # Example
191 /// ```ignore,no_run
192 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
193 /// let x = AutoscalingPolicy::new().set_labels([
194 /// ("key0", "abc"),
195 /// ("key1", "xyz"),
196 /// ]);
197 /// ```
198 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
199 where
200 T: std::iter::IntoIterator<Item = (K, V)>,
201 K: std::convert::Into<std::string::String>,
202 V: std::convert::Into<std::string::String>,
203 {
204 use std::iter::Iterator;
205 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
206 self
207 }
208
209 /// Sets the value of [cluster_type][crate::model::AutoscalingPolicy::cluster_type].
210 ///
211 /// # Example
212 /// ```ignore,no_run
213 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
214 /// use google_cloud_dataproc_v1::model::autoscaling_policy::ClusterType;
215 /// let x0 = AutoscalingPolicy::new().set_cluster_type(ClusterType::Standard);
216 /// let x1 = AutoscalingPolicy::new().set_cluster_type(ClusterType::ZeroScale);
217 /// ```
218 pub fn set_cluster_type<
219 T: std::convert::Into<crate::model::autoscaling_policy::ClusterType>,
220 >(
221 mut self,
222 v: T,
223 ) -> Self {
224 self.cluster_type = v.into();
225 self
226 }
227
228 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm].
229 ///
230 /// Note that all the setters affecting `algorithm` are mutually
231 /// exclusive.
232 ///
233 /// # Example
234 /// ```ignore,no_run
235 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
236 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
237 /// let x = AutoscalingPolicy::new().set_algorithm(Some(
238 /// google_cloud_dataproc_v1::model::autoscaling_policy::Algorithm::BasicAlgorithm(BasicAutoscalingAlgorithm::default().into())));
239 /// ```
240 pub fn set_algorithm<
241 T: std::convert::Into<std::option::Option<crate::model::autoscaling_policy::Algorithm>>,
242 >(
243 mut self,
244 v: T,
245 ) -> Self {
246 self.algorithm = v.into();
247 self
248 }
249
250 /// The value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
251 /// if it holds a `BasicAlgorithm`, `None` if the field is not set or
252 /// holds a different branch.
253 pub fn basic_algorithm(
254 &self,
255 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>> {
256 #[allow(unreachable_patterns)]
257 self.algorithm.as_ref().and_then(|v| match v {
258 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v) => {
259 std::option::Option::Some(v)
260 }
261 _ => std::option::Option::None,
262 })
263 }
264
265 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
266 /// to hold a `BasicAlgorithm`.
267 ///
268 /// Note that all the setters affecting `algorithm` are
269 /// mutually exclusive.
270 ///
271 /// # Example
272 /// ```ignore,no_run
273 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
274 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
275 /// let x = AutoscalingPolicy::new().set_basic_algorithm(BasicAutoscalingAlgorithm::default()/* use setters */);
276 /// assert!(x.basic_algorithm().is_some());
277 /// ```
278 pub fn set_basic_algorithm<
279 T: std::convert::Into<std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>>,
280 >(
281 mut self,
282 v: T,
283 ) -> Self {
284 self.algorithm = std::option::Option::Some(
285 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v.into()),
286 );
287 self
288 }
289}
290
291impl wkt::message::Message for AutoscalingPolicy {
292 fn typename() -> &'static str {
293 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingPolicy"
294 }
295}
296
297/// Defines additional types related to [AutoscalingPolicy].
298pub mod autoscaling_policy {
299 #[allow(unused_imports)]
300 use super::*;
301
302 /// The type of the clusters for which this autoscaling policy is to be
303 /// configured.
304 ///
305 /// # Working with unknown values
306 ///
307 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
308 /// additional enum variants at any time. Adding new variants is not considered
309 /// a breaking change. Applications should write their code in anticipation of:
310 ///
311 /// - New values appearing in future releases of the client library, **and**
312 /// - New values received dynamically, without application changes.
313 ///
314 /// Please consult the [Working with enums] section in the user guide for some
315 /// guidelines.
316 ///
317 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
318 #[derive(Clone, Debug, PartialEq)]
319 #[non_exhaustive]
320 pub enum ClusterType {
321 /// Not set.
322 Unspecified,
323 /// Standard dataproc cluster with a minimum of two primary workers.
324 Standard,
325 /// Clusters that can use only secondary workers and be scaled down to zero
326 /// secondary worker nodes.
327 ZeroScale,
328 /// If set, the enum was initialized with an unknown value.
329 ///
330 /// Applications can examine the value using [ClusterType::value] or
331 /// [ClusterType::name].
332 UnknownValue(cluster_type::UnknownValue),
333 }
334
335 #[doc(hidden)]
336 pub mod cluster_type {
337 #[allow(unused_imports)]
338 use super::*;
339 #[derive(Clone, Debug, PartialEq)]
340 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
341 }
342
343 impl ClusterType {
344 /// Gets the enum value.
345 ///
346 /// Returns `None` if the enum contains an unknown value deserialized from
347 /// the string representation of enums.
348 pub fn value(&self) -> std::option::Option<i32> {
349 match self {
350 Self::Unspecified => std::option::Option::Some(0),
351 Self::Standard => std::option::Option::Some(1),
352 Self::ZeroScale => std::option::Option::Some(2),
353 Self::UnknownValue(u) => u.0.value(),
354 }
355 }
356
357 /// Gets the enum value as a string.
358 ///
359 /// Returns `None` if the enum contains an unknown value deserialized from
360 /// the integer representation of enums.
361 pub fn name(&self) -> std::option::Option<&str> {
362 match self {
363 Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
364 Self::Standard => std::option::Option::Some("STANDARD"),
365 Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
366 Self::UnknownValue(u) => u.0.name(),
367 }
368 }
369 }
370
371 impl std::default::Default for ClusterType {
372 fn default() -> Self {
373 use std::convert::From;
374 Self::from(0)
375 }
376 }
377
378 impl std::fmt::Display for ClusterType {
379 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
380 wkt::internal::display_enum(f, self.name(), self.value())
381 }
382 }
383
384 impl std::convert::From<i32> for ClusterType {
385 fn from(value: i32) -> Self {
386 match value {
387 0 => Self::Unspecified,
388 1 => Self::Standard,
389 2 => Self::ZeroScale,
390 _ => Self::UnknownValue(cluster_type::UnknownValue(
391 wkt::internal::UnknownEnumValue::Integer(value),
392 )),
393 }
394 }
395 }
396
397 impl std::convert::From<&str> for ClusterType {
398 fn from(value: &str) -> Self {
399 use std::string::ToString;
400 match value {
401 "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
402 "STANDARD" => Self::Standard,
403 "ZERO_SCALE" => Self::ZeroScale,
404 _ => Self::UnknownValue(cluster_type::UnknownValue(
405 wkt::internal::UnknownEnumValue::String(value.to_string()),
406 )),
407 }
408 }
409 }
410
411 impl serde::ser::Serialize for ClusterType {
412 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
413 where
414 S: serde::Serializer,
415 {
416 match self {
417 Self::Unspecified => serializer.serialize_i32(0),
418 Self::Standard => serializer.serialize_i32(1),
419 Self::ZeroScale => serializer.serialize_i32(2),
420 Self::UnknownValue(u) => u.0.serialize(serializer),
421 }
422 }
423 }
424
425 impl<'de> serde::de::Deserialize<'de> for ClusterType {
426 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
427 where
428 D: serde::Deserializer<'de>,
429 {
430 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
431 ".google.cloud.dataproc.v1.AutoscalingPolicy.ClusterType",
432 ))
433 }
434 }
435
436 /// Autoscaling algorithm for policy.
437 #[derive(Clone, Debug, PartialEq)]
438 #[non_exhaustive]
439 pub enum Algorithm {
440 #[allow(missing_docs)]
441 BasicAlgorithm(std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>),
442 }
443}
444
445/// Basic algorithm for autoscaling.
446#[derive(Clone, Default, PartialEq)]
447#[non_exhaustive]
448pub struct BasicAutoscalingAlgorithm {
449 /// Optional. Duration between scaling events. A scaling period starts after
450 /// the update operation from the previous event has completed.
451 ///
452 /// Bounds: [2m, 1d]. Default: 2m.
453 pub cooldown_period: std::option::Option<wkt::Duration>,
454
455 #[allow(missing_docs)]
456 pub config: std::option::Option<crate::model::basic_autoscaling_algorithm::Config>,
457
458 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
459}
460
461impl BasicAutoscalingAlgorithm {
462 /// Creates a new default instance.
463 pub fn new() -> Self {
464 std::default::Default::default()
465 }
466
467 /// Sets the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
468 ///
469 /// # Example
470 /// ```ignore,no_run
471 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
472 /// use wkt::Duration;
473 /// let x = BasicAutoscalingAlgorithm::new().set_cooldown_period(Duration::default()/* use setters */);
474 /// ```
475 pub fn set_cooldown_period<T>(mut self, v: T) -> Self
476 where
477 T: std::convert::Into<wkt::Duration>,
478 {
479 self.cooldown_period = std::option::Option::Some(v.into());
480 self
481 }
482
483 /// Sets or clears the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
484 ///
485 /// # Example
486 /// ```ignore,no_run
487 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
488 /// use wkt::Duration;
489 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(Some(Duration::default()/* use setters */));
490 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(None::<Duration>);
491 /// ```
492 pub fn set_or_clear_cooldown_period<T>(mut self, v: std::option::Option<T>) -> Self
493 where
494 T: std::convert::Into<wkt::Duration>,
495 {
496 self.cooldown_period = v.map(|x| x.into());
497 self
498 }
499
500 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config].
501 ///
502 /// Note that all the setters affecting `config` are mutually
503 /// exclusive.
504 ///
505 /// # Example
506 /// ```ignore,no_run
507 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
508 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
509 /// let x = BasicAutoscalingAlgorithm::new().set_config(Some(
510 /// google_cloud_dataproc_v1::model::basic_autoscaling_algorithm::Config::YarnConfig(BasicYarnAutoscalingConfig::default().into())));
511 /// ```
512 pub fn set_config<
513 T: std::convert::Into<std::option::Option<crate::model::basic_autoscaling_algorithm::Config>>,
514 >(
515 mut self,
516 v: T,
517 ) -> Self {
518 self.config = v.into();
519 self
520 }
521
522 /// The value of [config][crate::model::BasicAutoscalingAlgorithm::config]
523 /// if it holds a `YarnConfig`, `None` if the field is not set or
524 /// holds a different branch.
525 pub fn yarn_config(
526 &self,
527 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>> {
528 #[allow(unreachable_patterns)]
529 self.config.as_ref().and_then(|v| match v {
530 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v) => {
531 std::option::Option::Some(v)
532 }
533 _ => std::option::Option::None,
534 })
535 }
536
537 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config]
538 /// to hold a `YarnConfig`.
539 ///
540 /// Note that all the setters affecting `config` are
541 /// mutually exclusive.
542 ///
543 /// # Example
544 /// ```ignore,no_run
545 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
546 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
547 /// let x = BasicAutoscalingAlgorithm::new().set_yarn_config(BasicYarnAutoscalingConfig::default()/* use setters */);
548 /// assert!(x.yarn_config().is_some());
549 /// ```
550 pub fn set_yarn_config<
551 T: std::convert::Into<std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>>,
552 >(
553 mut self,
554 v: T,
555 ) -> Self {
556 self.config = std::option::Option::Some(
557 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v.into()),
558 );
559 self
560 }
561}
562
563impl wkt::message::Message for BasicAutoscalingAlgorithm {
564 fn typename() -> &'static str {
565 "type.googleapis.com/google.cloud.dataproc.v1.BasicAutoscalingAlgorithm"
566 }
567}
568
569/// Defines additional types related to [BasicAutoscalingAlgorithm].
570pub mod basic_autoscaling_algorithm {
571 #[allow(unused_imports)]
572 use super::*;
573
574 #[allow(missing_docs)]
575 #[derive(Clone, Debug, PartialEq)]
576 #[non_exhaustive]
577 pub enum Config {
578 /// Required. YARN autoscaling configuration.
579 YarnConfig(std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>),
580 }
581}
582
583/// Basic autoscaling configurations for YARN.
584#[derive(Clone, Default, PartialEq)]
585#[non_exhaustive]
586pub struct BasicYarnAutoscalingConfig {
587 /// Required. Timeout for YARN graceful decommissioning of Node Managers.
588 /// Specifies the duration to wait for jobs to complete before forcefully
589 /// removing workers (and potentially interrupting jobs). Only applicable to
590 /// downscaling operations.
591 ///
592 /// Bounds: [0s, 1d].
593 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
594
595 /// Required. Fraction of average YARN pending memory in the last cooldown
596 /// period for which to add workers. A scale-up factor of 1.0 will result in
597 /// scaling up so that there is no pending memory remaining after the update
598 /// (more aggressive scaling). A scale-up factor closer to 0 will result in a
599 /// smaller magnitude of scaling up (less aggressive scaling). See [How
600 /// autoscaling
601 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
602 /// for more information.
603 ///
604 /// Bounds: [0.0, 1.0].
605 pub scale_up_factor: f64,
606
607 /// Required. Fraction of average YARN pending memory in the last cooldown
608 /// period for which to remove workers. A scale-down factor of 1 will result in
609 /// scaling down so that there is no available memory remaining after the
610 /// update (more aggressive scaling). A scale-down factor of 0 disables
611 /// removing workers, which can be beneficial for autoscaling a single job.
612 /// See [How autoscaling
613 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
614 /// for more information.
615 ///
616 /// Bounds: [0.0, 1.0].
617 pub scale_down_factor: f64,
618
619 /// Optional. Minimum scale-up threshold as a fraction of total cluster size
620 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
621 /// 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
622 /// the cluster to scale. A threshold of 0 means the autoscaler will scale up
623 /// on any recommended change.
624 ///
625 /// Bounds: [0.0, 1.0]. Default: 0.0.
626 pub scale_up_min_worker_fraction: f64,
627
628 /// Optional. Minimum scale-down threshold as a fraction of total cluster size
629 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
630 /// 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
631 /// the cluster to scale. A threshold of 0 means the autoscaler will scale down
632 /// on any recommended change.
633 ///
634 /// Bounds: [0.0, 1.0]. Default: 0.0.
635 pub scale_down_min_worker_fraction: f64,
636
637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
638}
639
640impl BasicYarnAutoscalingConfig {
641 /// Creates a new default instance.
642 pub fn new() -> Self {
643 std::default::Default::default()
644 }
645
646 /// Sets the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
647 ///
648 /// # Example
649 /// ```ignore,no_run
650 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
651 /// use wkt::Duration;
652 /// let x = BasicYarnAutoscalingConfig::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
653 /// ```
654 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
655 where
656 T: std::convert::Into<wkt::Duration>,
657 {
658 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
659 self
660 }
661
662 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
663 ///
664 /// # Example
665 /// ```ignore,no_run
666 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
667 /// use wkt::Duration;
668 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
669 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
670 /// ```
671 pub fn set_or_clear_graceful_decommission_timeout<T>(
672 mut self,
673 v: std::option::Option<T>,
674 ) -> Self
675 where
676 T: std::convert::Into<wkt::Duration>,
677 {
678 self.graceful_decommission_timeout = v.map(|x| x.into());
679 self
680 }
681
682 /// Sets the value of [scale_up_factor][crate::model::BasicYarnAutoscalingConfig::scale_up_factor].
683 ///
684 /// # Example
685 /// ```ignore,no_run
686 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
687 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_factor(42.0);
688 /// ```
689 pub fn set_scale_up_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
690 self.scale_up_factor = v.into();
691 self
692 }
693
694 /// Sets the value of [scale_down_factor][crate::model::BasicYarnAutoscalingConfig::scale_down_factor].
695 ///
696 /// # Example
697 /// ```ignore,no_run
698 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
699 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_factor(42.0);
700 /// ```
701 pub fn set_scale_down_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
702 self.scale_down_factor = v.into();
703 self
704 }
705
706 /// Sets the value of [scale_up_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_up_min_worker_fraction].
707 ///
708 /// # Example
709 /// ```ignore,no_run
710 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
711 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_min_worker_fraction(42.0);
712 /// ```
713 pub fn set_scale_up_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
714 self.scale_up_min_worker_fraction = v.into();
715 self
716 }
717
718 /// Sets the value of [scale_down_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_down_min_worker_fraction].
719 ///
720 /// # Example
721 /// ```ignore,no_run
722 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
723 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_min_worker_fraction(42.0);
724 /// ```
725 pub fn set_scale_down_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
726 self.scale_down_min_worker_fraction = v.into();
727 self
728 }
729}
730
731impl wkt::message::Message for BasicYarnAutoscalingConfig {
732 fn typename() -> &'static str {
733 "type.googleapis.com/google.cloud.dataproc.v1.BasicYarnAutoscalingConfig"
734 }
735}
736
737/// Configuration for the size bounds of an instance group, including its
738/// proportional size to other groups.
739#[derive(Clone, Default, PartialEq)]
740#[non_exhaustive]
741pub struct InstanceGroupAutoscalingPolicyConfig {
742 /// Optional. Minimum number of instances for this group.
743 ///
744 /// Primary workers - Bounds: [2, max_instances]. Default: 2.
745 /// Secondary workers - Bounds: [0, max_instances]. Default: 0.
746 pub min_instances: i32,
747
748 /// Required. Maximum number of instances for this group. Required for primary
749 /// workers. Note that by default, clusters will not use secondary workers.
750 /// Required for secondary workers if the minimum secondary instances is set.
751 ///
752 /// Primary workers - Bounds: [min_instances, ).
753 /// Secondary workers - Bounds: [min_instances, ). Default: 0.
754 pub max_instances: i32,
755
756 /// Optional. Weight for the instance group, which is used to determine the
757 /// fraction of total workers in the cluster from this instance group.
758 /// For example, if primary workers have weight 2, and secondary workers have
759 /// weight 1, the cluster will have approximately 2 primary workers for each
760 /// secondary worker.
761 ///
762 /// The cluster may not reach the specified balance if constrained
763 /// by min/max bounds or other autoscaling settings. For example, if
764 /// `max_instances` for secondary workers is 0, then only primary workers will
765 /// be added. The cluster can also be out of balance when created.
766 ///
767 /// If weight is not set on any instance group, the cluster will default to
768 /// equal weight for all groups: the cluster will attempt to maintain an equal
769 /// number of workers in each group within the configured size bounds for each
770 /// group. If weight is set for one group only, the cluster will default to
771 /// zero weight on the unset group. For example if weight is set only on
772 /// primary workers, the cluster will use primary workers only and no
773 /// secondary workers.
774 pub weight: i32,
775
776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
777}
778
779impl InstanceGroupAutoscalingPolicyConfig {
780 /// Creates a new default instance.
781 pub fn new() -> Self {
782 std::default::Default::default()
783 }
784
785 /// Sets the value of [min_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::min_instances].
786 ///
787 /// # Example
788 /// ```ignore,no_run
789 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
790 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_min_instances(42);
791 /// ```
792 pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
793 self.min_instances = v.into();
794 self
795 }
796
797 /// Sets the value of [max_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::max_instances].
798 ///
799 /// # Example
800 /// ```ignore,no_run
801 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
802 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_max_instances(42);
803 /// ```
804 pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
805 self.max_instances = v.into();
806 self
807 }
808
809 /// Sets the value of [weight][crate::model::InstanceGroupAutoscalingPolicyConfig::weight].
810 ///
811 /// # Example
812 /// ```ignore,no_run
813 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
814 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_weight(42);
815 /// ```
816 pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
817 self.weight = v.into();
818 self
819 }
820}
821
822impl wkt::message::Message for InstanceGroupAutoscalingPolicyConfig {
823 fn typename() -> &'static str {
824 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig"
825 }
826}
827
828/// A request to create an autoscaling policy.
829#[derive(Clone, Default, PartialEq)]
830#[non_exhaustive]
831pub struct CreateAutoscalingPolicyRequest {
832 /// Required. The "resource name" of the region or location, as described
833 /// in <https://cloud.google.com/apis/design/resource_names>.
834 ///
835 /// * For `projects.regions.autoscalingPolicies.create`, the resource name
836 /// of the region has the following format:
837 /// `projects/{project_id}/regions/{region}`
838 ///
839 /// * For `projects.locations.autoscalingPolicies.create`, the resource name
840 /// of the location has the following format:
841 /// `projects/{project_id}/locations/{location}`
842 ///
843 pub parent: std::string::String,
844
845 /// Required. The autoscaling policy to create.
846 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
847
848 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
849}
850
851impl CreateAutoscalingPolicyRequest {
852 /// Creates a new default instance.
853 pub fn new() -> Self {
854 std::default::Default::default()
855 }
856
857 /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
858 ///
859 /// # Example
860 /// ```ignore,no_run
861 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
862 /// # let project_id = "project_id";
863 /// # let location_id = "location_id";
864 /// let x = CreateAutoscalingPolicyRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
865 /// ```
866 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
867 self.parent = v.into();
868 self
869 }
870
871 /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
872 ///
873 /// # Example
874 /// ```ignore,no_run
875 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
876 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
877 /// let x = CreateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
878 /// ```
879 pub fn set_policy<T>(mut self, v: T) -> Self
880 where
881 T: std::convert::Into<crate::model::AutoscalingPolicy>,
882 {
883 self.policy = std::option::Option::Some(v.into());
884 self
885 }
886
887 /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
888 ///
889 /// # Example
890 /// ```ignore,no_run
891 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
892 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
893 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
894 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
895 /// ```
896 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
897 where
898 T: std::convert::Into<crate::model::AutoscalingPolicy>,
899 {
900 self.policy = v.map(|x| x.into());
901 self
902 }
903}
904
905impl wkt::message::Message for CreateAutoscalingPolicyRequest {
906 fn typename() -> &'static str {
907 "type.googleapis.com/google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest"
908 }
909}
910
911/// A request to fetch an autoscaling policy.
912#[derive(Clone, Default, PartialEq)]
913#[non_exhaustive]
914pub struct GetAutoscalingPolicyRequest {
915 /// Required. The "resource name" of the autoscaling policy, as described
916 /// in <https://cloud.google.com/apis/design/resource_names>.
917 ///
918 /// * For `projects.regions.autoscalingPolicies.get`, the resource name
919 /// of the policy has the following format:
920 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
921 ///
922 /// * For `projects.locations.autoscalingPolicies.get`, the resource name
923 /// of the policy has the following format:
924 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
925 ///
926 pub name: std::string::String,
927
928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
929}
930
931impl GetAutoscalingPolicyRequest {
932 /// Creates a new default instance.
933 pub fn new() -> Self {
934 std::default::Default::default()
935 }
936
937 /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
938 ///
939 /// # Example
940 /// ```ignore,no_run
941 /// # use google_cloud_dataproc_v1::model::GetAutoscalingPolicyRequest;
942 /// # let project_id = "project_id";
943 /// # let location_id = "location_id";
944 /// # let autoscaling_policy_id = "autoscaling_policy_id";
945 /// let x = GetAutoscalingPolicyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/autoscalingPolicies/{autoscaling_policy_id}"));
946 /// ```
947 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
948 self.name = v.into();
949 self
950 }
951}
952
953impl wkt::message::Message for GetAutoscalingPolicyRequest {
954 fn typename() -> &'static str {
955 "type.googleapis.com/google.cloud.dataproc.v1.GetAutoscalingPolicyRequest"
956 }
957}
958
959/// A request to update an autoscaling policy.
960#[derive(Clone, Default, PartialEq)]
961#[non_exhaustive]
962pub struct UpdateAutoscalingPolicyRequest {
963 /// Required. The updated autoscaling policy.
964 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
965
966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
967}
968
969impl UpdateAutoscalingPolicyRequest {
970 /// Creates a new default instance.
971 pub fn new() -> Self {
972 std::default::Default::default()
973 }
974
975 /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
976 ///
977 /// # Example
978 /// ```ignore,no_run
979 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
980 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
981 /// let x = UpdateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
982 /// ```
983 pub fn set_policy<T>(mut self, v: T) -> Self
984 where
985 T: std::convert::Into<crate::model::AutoscalingPolicy>,
986 {
987 self.policy = std::option::Option::Some(v.into());
988 self
989 }
990
991 /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
992 ///
993 /// # Example
994 /// ```ignore,no_run
995 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
996 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
997 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
998 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
999 /// ```
1000 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1001 where
1002 T: std::convert::Into<crate::model::AutoscalingPolicy>,
1003 {
1004 self.policy = v.map(|x| x.into());
1005 self
1006 }
1007}
1008
1009impl wkt::message::Message for UpdateAutoscalingPolicyRequest {
1010 fn typename() -> &'static str {
1011 "type.googleapis.com/google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest"
1012 }
1013}
1014
1015/// A request to delete an autoscaling policy.
1016///
1017/// Autoscaling policies in use by one or more clusters will not be deleted.
1018#[derive(Clone, Default, PartialEq)]
1019#[non_exhaustive]
1020pub struct DeleteAutoscalingPolicyRequest {
1021 /// Required. The "resource name" of the autoscaling policy, as described
1022 /// in <https://cloud.google.com/apis/design/resource_names>.
1023 ///
1024 /// * For `projects.regions.autoscalingPolicies.delete`, the resource name
1025 /// of the policy has the following format:
1026 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
1027 ///
1028 /// * For `projects.locations.autoscalingPolicies.delete`, the resource name
1029 /// of the policy has the following format:
1030 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
1031 ///
1032 pub name: std::string::String,
1033
1034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1035}
1036
1037impl DeleteAutoscalingPolicyRequest {
1038 /// Creates a new default instance.
1039 pub fn new() -> Self {
1040 std::default::Default::default()
1041 }
1042
1043 /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
1044 ///
1045 /// # Example
1046 /// ```ignore,no_run
1047 /// # use google_cloud_dataproc_v1::model::DeleteAutoscalingPolicyRequest;
1048 /// # let project_id = "project_id";
1049 /// # let location_id = "location_id";
1050 /// # let autoscaling_policy_id = "autoscaling_policy_id";
1051 /// let x = DeleteAutoscalingPolicyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/autoscalingPolicies/{autoscaling_policy_id}"));
1052 /// ```
1053 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1054 self.name = v.into();
1055 self
1056 }
1057}
1058
1059impl wkt::message::Message for DeleteAutoscalingPolicyRequest {
1060 fn typename() -> &'static str {
1061 "type.googleapis.com/google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest"
1062 }
1063}
1064
1065/// A request to list autoscaling policies in a project.
1066#[derive(Clone, Default, PartialEq)]
1067#[non_exhaustive]
1068pub struct ListAutoscalingPoliciesRequest {
1069 /// Required. The "resource name" of the region or location, as described
1070 /// in <https://cloud.google.com/apis/design/resource_names>.
1071 ///
1072 /// * For `projects.regions.autoscalingPolicies.list`, the resource name
1073 /// of the region has the following format:
1074 /// `projects/{project_id}/regions/{region}`
1075 ///
1076 /// * For `projects.locations.autoscalingPolicies.list`, the resource name
1077 /// of the location has the following format:
1078 /// `projects/{project_id}/locations/{location}`
1079 ///
1080 pub parent: std::string::String,
1081
1082 /// Optional. The maximum number of results to return in each response.
1083 /// Must be less than or equal to 1000. Defaults to 100.
1084 pub page_size: i32,
1085
1086 /// Optional. The page token, returned by a previous call, to request the
1087 /// next page of results.
1088 pub page_token: std::string::String,
1089
1090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1091}
1092
1093impl ListAutoscalingPoliciesRequest {
1094 /// Creates a new default instance.
1095 pub fn new() -> Self {
1096 std::default::Default::default()
1097 }
1098
1099 /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
1100 ///
1101 /// # Example
1102 /// ```ignore,no_run
1103 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1104 /// # let project_id = "project_id";
1105 /// # let location_id = "location_id";
1106 /// let x = ListAutoscalingPoliciesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1107 /// ```
1108 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1109 self.parent = v.into();
1110 self
1111 }
1112
1113 /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
1114 ///
1115 /// # Example
1116 /// ```ignore,no_run
1117 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1118 /// let x = ListAutoscalingPoliciesRequest::new().set_page_size(42);
1119 /// ```
1120 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1121 self.page_size = v.into();
1122 self
1123 }
1124
1125 /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
1126 ///
1127 /// # Example
1128 /// ```ignore,no_run
1129 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1130 /// let x = ListAutoscalingPoliciesRequest::new().set_page_token("example");
1131 /// ```
1132 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1133 self.page_token = v.into();
1134 self
1135 }
1136}
1137
1138impl wkt::message::Message for ListAutoscalingPoliciesRequest {
1139 fn typename() -> &'static str {
1140 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest"
1141 }
1142}
1143
1144/// A response to a request to list autoscaling policies in a project.
1145#[derive(Clone, Default, PartialEq)]
1146#[non_exhaustive]
1147pub struct ListAutoscalingPoliciesResponse {
1148 /// Output only. Autoscaling policies list.
1149 pub policies: std::vec::Vec<crate::model::AutoscalingPolicy>,
1150
1151 /// Output only. This token is included in the response if there are more
1152 /// results to fetch.
1153 pub next_page_token: std::string::String,
1154
1155 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1156}
1157
1158impl ListAutoscalingPoliciesResponse {
1159 /// Creates a new default instance.
1160 pub fn new() -> Self {
1161 std::default::Default::default()
1162 }
1163
1164 /// Sets the value of [policies][crate::model::ListAutoscalingPoliciesResponse::policies].
1165 ///
1166 /// # Example
1167 /// ```ignore,no_run
1168 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1169 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
1170 /// let x = ListAutoscalingPoliciesResponse::new()
1171 /// .set_policies([
1172 /// AutoscalingPolicy::default()/* use setters */,
1173 /// AutoscalingPolicy::default()/* use (different) setters */,
1174 /// ]);
1175 /// ```
1176 pub fn set_policies<T, V>(mut self, v: T) -> Self
1177 where
1178 T: std::iter::IntoIterator<Item = V>,
1179 V: std::convert::Into<crate::model::AutoscalingPolicy>,
1180 {
1181 use std::iter::Iterator;
1182 self.policies = v.into_iter().map(|i| i.into()).collect();
1183 self
1184 }
1185
1186 /// Sets the value of [next_page_token][crate::model::ListAutoscalingPoliciesResponse::next_page_token].
1187 ///
1188 /// # Example
1189 /// ```ignore,no_run
1190 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1191 /// let x = ListAutoscalingPoliciesResponse::new().set_next_page_token("example");
1192 /// ```
1193 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1194 self.next_page_token = v.into();
1195 self
1196 }
1197}
1198
1199impl wkt::message::Message for ListAutoscalingPoliciesResponse {
1200 fn typename() -> &'static str {
1201 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse"
1202 }
1203}
1204
1205#[doc(hidden)]
1206impl google_cloud_gax::paginator::internal::PageableResponse for ListAutoscalingPoliciesResponse {
1207 type PageItem = crate::model::AutoscalingPolicy;
1208
1209 fn items(self) -> std::vec::Vec<Self::PageItem> {
1210 self.policies
1211 }
1212
1213 fn next_page_token(&self) -> std::string::String {
1214 use std::clone::Clone;
1215 self.next_page_token.clone()
1216 }
1217}
1218
1219/// A request to create a batch workload.
1220#[derive(Clone, Default, PartialEq)]
1221#[non_exhaustive]
1222pub struct CreateBatchRequest {
1223 /// Required. The parent resource where this batch will be created.
1224 pub parent: std::string::String,
1225
1226 /// Required. The batch to create.
1227 pub batch: std::option::Option<crate::model::Batch>,
1228
1229 /// Optional. The ID to use for the batch, which will become the final
1230 /// component of the batch's resource name.
1231 ///
1232 /// This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
1233 pub batch_id: std::string::String,
1234
1235 /// Optional. A unique ID used to identify the request. If the service
1236 /// receives two
1237 /// `CreateBatchRequests` with the same `request_id`, the second request is
1238 /// ignored and the operation that corresponds to the first Batch created and
1239 /// stored in the backend is returned.
1240 ///
1241 /// Recommendation: Set this value to a
1242 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
1243 ///
1244 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
1245 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
1246 pub request_id: std::string::String,
1247
1248 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1249}
1250
1251impl CreateBatchRequest {
1252 /// Creates a new default instance.
1253 pub fn new() -> Self {
1254 std::default::Default::default()
1255 }
1256
1257 /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1258 ///
1259 /// # Example
1260 /// ```ignore,no_run
1261 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1262 /// # let project_id = "project_id";
1263 /// # let location_id = "location_id";
1264 /// let x = CreateBatchRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1265 /// ```
1266 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1267 self.parent = v.into();
1268 self
1269 }
1270
1271 /// Sets the value of [batch][crate::model::CreateBatchRequest::batch].
1272 ///
1273 /// # Example
1274 /// ```ignore,no_run
1275 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1276 /// use google_cloud_dataproc_v1::model::Batch;
1277 /// let x = CreateBatchRequest::new().set_batch(Batch::default()/* use setters */);
1278 /// ```
1279 pub fn set_batch<T>(mut self, v: T) -> Self
1280 where
1281 T: std::convert::Into<crate::model::Batch>,
1282 {
1283 self.batch = std::option::Option::Some(v.into());
1284 self
1285 }
1286
1287 /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1288 ///
1289 /// # Example
1290 /// ```ignore,no_run
1291 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1292 /// use google_cloud_dataproc_v1::model::Batch;
1293 /// let x = CreateBatchRequest::new().set_or_clear_batch(Some(Batch::default()/* use setters */));
1294 /// let x = CreateBatchRequest::new().set_or_clear_batch(None::<Batch>);
1295 /// ```
1296 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1297 where
1298 T: std::convert::Into<crate::model::Batch>,
1299 {
1300 self.batch = v.map(|x| x.into());
1301 self
1302 }
1303
1304 /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1305 ///
1306 /// # Example
1307 /// ```ignore,no_run
1308 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1309 /// let x = CreateBatchRequest::new().set_batch_id("example");
1310 /// ```
1311 pub fn set_batch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1312 self.batch_id = v.into();
1313 self
1314 }
1315
1316 /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1317 ///
1318 /// # Example
1319 /// ```ignore,no_run
1320 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1321 /// let x = CreateBatchRequest::new().set_request_id("example");
1322 /// ```
1323 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1324 self.request_id = v.into();
1325 self
1326 }
1327}
1328
1329impl wkt::message::Message for CreateBatchRequest {
1330 fn typename() -> &'static str {
1331 "type.googleapis.com/google.cloud.dataproc.v1.CreateBatchRequest"
1332 }
1333}
1334
1335/// A request to get the resource representation for a batch workload.
1336#[derive(Clone, Default, PartialEq)]
1337#[non_exhaustive]
1338pub struct GetBatchRequest {
1339 /// Required. The fully qualified name of the batch to retrieve
1340 /// in the format
1341 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1342 pub name: std::string::String,
1343
1344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1345}
1346
1347impl GetBatchRequest {
1348 /// Creates a new default instance.
1349 pub fn new() -> Self {
1350 std::default::Default::default()
1351 }
1352
1353 /// Sets the value of [name][crate::model::GetBatchRequest::name].
1354 ///
1355 /// # Example
1356 /// ```ignore,no_run
1357 /// # use google_cloud_dataproc_v1::model::GetBatchRequest;
1358 /// # let project_id = "project_id";
1359 /// # let location_id = "location_id";
1360 /// # let batch_id = "batch_id";
1361 /// let x = GetBatchRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/batches/{batch_id}"));
1362 /// ```
1363 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1364 self.name = v.into();
1365 self
1366 }
1367}
1368
1369impl wkt::message::Message for GetBatchRequest {
1370 fn typename() -> &'static str {
1371 "type.googleapis.com/google.cloud.dataproc.v1.GetBatchRequest"
1372 }
1373}
1374
1375/// A request to list batch workloads in a project.
1376#[derive(Clone, Default, PartialEq)]
1377#[non_exhaustive]
1378pub struct ListBatchesRequest {
1379 /// Required. The parent, which owns this collection of batches.
1380 pub parent: std::string::String,
1381
1382 /// Optional. The maximum number of batches to return in each response.
1383 /// The service may return fewer than this value.
1384 /// The default page size is 20; the maximum page size is 1000.
1385 pub page_size: i32,
1386
1387 /// Optional. A page token received from a previous `ListBatches` call.
1388 /// Provide this token to retrieve the subsequent page.
1389 pub page_token: std::string::String,
1390
1391 /// Optional. A filter for the batches to return in the response.
1392 ///
1393 /// A filter is a logical expression constraining the values of various fields
1394 /// in each batch resource. Filters are case sensitive, and may contain
1395 /// multiple clauses combined with logical operators (AND/OR).
1396 /// Supported fields are `batch_id`, `batch_uuid`, `state`, `create_time`, and
1397 /// `labels`.
1398 ///
1399 /// e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"`
1400 /// filters for batches in state RUNNING that were created before 2023-01-01.
1401 /// `state = RUNNING and labels.environment=production` filters for batches in
1402 /// state in a RUNNING state that have a production environment label.
1403 ///
1404 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
1405 /// description of the filter syntax and a list of supported comparisons.
1406 pub filter: std::string::String,
1407
1408 /// Optional. Field(s) on which to sort the list of batches.
1409 ///
1410 /// Currently the only supported sort orders are unspecified (empty) and
1411 /// `create_time desc` to sort by most recently created batches first.
1412 ///
1413 /// See <https://google.aip.dev/132#ordering> for more details.
1414 pub order_by: std::string::String,
1415
1416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1417}
1418
1419impl ListBatchesRequest {
1420 /// Creates a new default instance.
1421 pub fn new() -> Self {
1422 std::default::Default::default()
1423 }
1424
1425 /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1426 ///
1427 /// # Example
1428 /// ```ignore,no_run
1429 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1430 /// # let project_id = "project_id";
1431 /// # let location_id = "location_id";
1432 /// let x = ListBatchesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1433 /// ```
1434 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1435 self.parent = v.into();
1436 self
1437 }
1438
1439 /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1440 ///
1441 /// # Example
1442 /// ```ignore,no_run
1443 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1444 /// let x = ListBatchesRequest::new().set_page_size(42);
1445 /// ```
1446 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1447 self.page_size = v.into();
1448 self
1449 }
1450
1451 /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1452 ///
1453 /// # Example
1454 /// ```ignore,no_run
1455 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1456 /// let x = ListBatchesRequest::new().set_page_token("example");
1457 /// ```
1458 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1459 self.page_token = v.into();
1460 self
1461 }
1462
1463 /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1464 ///
1465 /// # Example
1466 /// ```ignore,no_run
1467 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1468 /// let x = ListBatchesRequest::new().set_filter("example");
1469 /// ```
1470 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1471 self.filter = v.into();
1472 self
1473 }
1474
1475 /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1476 ///
1477 /// # Example
1478 /// ```ignore,no_run
1479 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1480 /// let x = ListBatchesRequest::new().set_order_by("example");
1481 /// ```
1482 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1483 self.order_by = v.into();
1484 self
1485 }
1486}
1487
1488impl wkt::message::Message for ListBatchesRequest {
1489 fn typename() -> &'static str {
1490 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesRequest"
1491 }
1492}
1493
1494/// A list of batch workloads.
1495#[derive(Clone, Default, PartialEq)]
1496#[non_exhaustive]
1497pub struct ListBatchesResponse {
1498 /// Output only. The batches from the specified collection.
1499 pub batches: std::vec::Vec<crate::model::Batch>,
1500
1501 /// A token, which can be sent as `page_token` to retrieve the next page.
1502 /// If this field is omitted, there are no subsequent pages.
1503 pub next_page_token: std::string::String,
1504
1505 /// Output only. List of Batches that could not be included in the response.
1506 /// Attempting to get one of these resources may indicate why it was not
1507 /// included in the list response.
1508 pub unreachable: std::vec::Vec<std::string::String>,
1509
1510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1511}
1512
1513impl ListBatchesResponse {
1514 /// Creates a new default instance.
1515 pub fn new() -> Self {
1516 std::default::Default::default()
1517 }
1518
1519 /// Sets the value of [batches][crate::model::ListBatchesResponse::batches].
1520 ///
1521 /// # Example
1522 /// ```ignore,no_run
1523 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1524 /// use google_cloud_dataproc_v1::model::Batch;
1525 /// let x = ListBatchesResponse::new()
1526 /// .set_batches([
1527 /// Batch::default()/* use setters */,
1528 /// Batch::default()/* use (different) setters */,
1529 /// ]);
1530 /// ```
1531 pub fn set_batches<T, V>(mut self, v: T) -> Self
1532 where
1533 T: std::iter::IntoIterator<Item = V>,
1534 V: std::convert::Into<crate::model::Batch>,
1535 {
1536 use std::iter::Iterator;
1537 self.batches = v.into_iter().map(|i| i.into()).collect();
1538 self
1539 }
1540
1541 /// Sets the value of [next_page_token][crate::model::ListBatchesResponse::next_page_token].
1542 ///
1543 /// # Example
1544 /// ```ignore,no_run
1545 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1546 /// let x = ListBatchesResponse::new().set_next_page_token("example");
1547 /// ```
1548 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1549 self.next_page_token = v.into();
1550 self
1551 }
1552
1553 /// Sets the value of [unreachable][crate::model::ListBatchesResponse::unreachable].
1554 ///
1555 /// # Example
1556 /// ```ignore,no_run
1557 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1558 /// let x = ListBatchesResponse::new().set_unreachable(["a", "b", "c"]);
1559 /// ```
1560 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1561 where
1562 T: std::iter::IntoIterator<Item = V>,
1563 V: std::convert::Into<std::string::String>,
1564 {
1565 use std::iter::Iterator;
1566 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1567 self
1568 }
1569}
1570
1571impl wkt::message::Message for ListBatchesResponse {
1572 fn typename() -> &'static str {
1573 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesResponse"
1574 }
1575}
1576
1577#[doc(hidden)]
1578impl google_cloud_gax::paginator::internal::PageableResponse for ListBatchesResponse {
1579 type PageItem = crate::model::Batch;
1580
1581 fn items(self) -> std::vec::Vec<Self::PageItem> {
1582 self.batches
1583 }
1584
1585 fn next_page_token(&self) -> std::string::String {
1586 use std::clone::Clone;
1587 self.next_page_token.clone()
1588 }
1589}
1590
1591/// A request to delete a batch workload.
1592#[derive(Clone, Default, PartialEq)]
1593#[non_exhaustive]
1594pub struct DeleteBatchRequest {
1595 /// Required. The fully qualified name of the batch to retrieve
1596 /// in the format
1597 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1598 pub name: std::string::String,
1599
1600 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1601}
1602
1603impl DeleteBatchRequest {
1604 /// Creates a new default instance.
1605 pub fn new() -> Self {
1606 std::default::Default::default()
1607 }
1608
1609 /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1610 ///
1611 /// # Example
1612 /// ```ignore,no_run
1613 /// # use google_cloud_dataproc_v1::model::DeleteBatchRequest;
1614 /// # let project_id = "project_id";
1615 /// # let location_id = "location_id";
1616 /// # let batch_id = "batch_id";
1617 /// let x = DeleteBatchRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/batches/{batch_id}"));
1618 /// ```
1619 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1620 self.name = v.into();
1621 self
1622 }
1623}
1624
1625impl wkt::message::Message for DeleteBatchRequest {
1626 fn typename() -> &'static str {
1627 "type.googleapis.com/google.cloud.dataproc.v1.DeleteBatchRequest"
1628 }
1629}
1630
1631/// A representation of a batch workload in the service.
1632#[derive(Clone, Default, PartialEq)]
1633#[non_exhaustive]
1634pub struct Batch {
1635 /// Output only. The resource name of the batch.
1636 pub name: std::string::String,
1637
1638 /// Output only. A batch UUID (Unique Universal Identifier). The service
1639 /// generates this value when it creates the batch.
1640 pub uuid: std::string::String,
1641
1642 /// Output only. The time when the batch was created.
1643 pub create_time: std::option::Option<wkt::Timestamp>,
1644
1645 /// Output only. Runtime information about batch execution.
1646 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
1647
1648 /// Output only. The state of the batch.
1649 pub state: crate::model::batch::State,
1650
1651 /// Output only. Batch state details, such as a failure
1652 /// description if the state is `FAILED`.
1653 pub state_message: std::string::String,
1654
1655 /// Output only. The time when the batch entered a current state.
1656 pub state_time: std::option::Option<wkt::Timestamp>,
1657
1658 /// Output only. The email address of the user who created the batch.
1659 pub creator: std::string::String,
1660
1661 /// Optional. The labels to associate with this batch.
1662 /// Label **keys** must contain 1 to 63 characters, and must conform to
1663 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
1664 /// Label **values** may be empty, but, if present, must contain 1 to 63
1665 /// characters, and must conform to [RFC
1666 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
1667 /// associated with a batch.
1668 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1669
1670 /// Optional. Runtime configuration for the batch execution.
1671 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
1672
1673 /// Optional. Environment configuration for the batch execution.
1674 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
1675
1676 /// Output only. The resource name of the operation associated with this batch.
1677 pub operation: std::string::String,
1678
1679 /// Output only. Historical state information for the batch.
1680 pub state_history: std::vec::Vec<crate::model::batch::StateHistory>,
1681
1682 /// The application/framework-specific portion of the batch configuration.
1683 pub batch_config: std::option::Option<crate::model::batch::BatchConfig>,
1684
1685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1686}
1687
1688impl Batch {
1689 /// Creates a new default instance.
1690 pub fn new() -> Self {
1691 std::default::Default::default()
1692 }
1693
1694 /// Sets the value of [name][crate::model::Batch::name].
1695 ///
1696 /// # Example
1697 /// ```ignore,no_run
1698 /// # use google_cloud_dataproc_v1::model::Batch;
1699 /// # let project_id = "project_id";
1700 /// # let location_id = "location_id";
1701 /// # let batch_id = "batch_id";
1702 /// let x = Batch::new().set_name(format!("projects/{project_id}/locations/{location_id}/batches/{batch_id}"));
1703 /// ```
1704 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1705 self.name = v.into();
1706 self
1707 }
1708
1709 /// Sets the value of [uuid][crate::model::Batch::uuid].
1710 ///
1711 /// # Example
1712 /// ```ignore,no_run
1713 /// # use google_cloud_dataproc_v1::model::Batch;
1714 /// let x = Batch::new().set_uuid("example");
1715 /// ```
1716 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1717 self.uuid = v.into();
1718 self
1719 }
1720
1721 /// Sets the value of [create_time][crate::model::Batch::create_time].
1722 ///
1723 /// # Example
1724 /// ```ignore,no_run
1725 /// # use google_cloud_dataproc_v1::model::Batch;
1726 /// use wkt::Timestamp;
1727 /// let x = Batch::new().set_create_time(Timestamp::default()/* use setters */);
1728 /// ```
1729 pub fn set_create_time<T>(mut self, v: T) -> Self
1730 where
1731 T: std::convert::Into<wkt::Timestamp>,
1732 {
1733 self.create_time = std::option::Option::Some(v.into());
1734 self
1735 }
1736
1737 /// Sets or clears the value of [create_time][crate::model::Batch::create_time].
1738 ///
1739 /// # Example
1740 /// ```ignore,no_run
1741 /// # use google_cloud_dataproc_v1::model::Batch;
1742 /// use wkt::Timestamp;
1743 /// let x = Batch::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1744 /// let x = Batch::new().set_or_clear_create_time(None::<Timestamp>);
1745 /// ```
1746 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1747 where
1748 T: std::convert::Into<wkt::Timestamp>,
1749 {
1750 self.create_time = v.map(|x| x.into());
1751 self
1752 }
1753
1754 /// Sets the value of [runtime_info][crate::model::Batch::runtime_info].
1755 ///
1756 /// # Example
1757 /// ```ignore,no_run
1758 /// # use google_cloud_dataproc_v1::model::Batch;
1759 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1760 /// let x = Batch::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
1761 /// ```
1762 pub fn set_runtime_info<T>(mut self, v: T) -> Self
1763 where
1764 T: std::convert::Into<crate::model::RuntimeInfo>,
1765 {
1766 self.runtime_info = std::option::Option::Some(v.into());
1767 self
1768 }
1769
1770 /// Sets or clears the value of [runtime_info][crate::model::Batch::runtime_info].
1771 ///
1772 /// # Example
1773 /// ```ignore,no_run
1774 /// # use google_cloud_dataproc_v1::model::Batch;
1775 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1776 /// let x = Batch::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
1777 /// let x = Batch::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
1778 /// ```
1779 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
1780 where
1781 T: std::convert::Into<crate::model::RuntimeInfo>,
1782 {
1783 self.runtime_info = v.map(|x| x.into());
1784 self
1785 }
1786
1787 /// Sets the value of [state][crate::model::Batch::state].
1788 ///
1789 /// # Example
1790 /// ```ignore,no_run
1791 /// # use google_cloud_dataproc_v1::model::Batch;
1792 /// use google_cloud_dataproc_v1::model::batch::State;
1793 /// let x0 = Batch::new().set_state(State::Pending);
1794 /// let x1 = Batch::new().set_state(State::Running);
1795 /// let x2 = Batch::new().set_state(State::Cancelling);
1796 /// ```
1797 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(mut self, v: T) -> Self {
1798 self.state = v.into();
1799 self
1800 }
1801
1802 /// Sets the value of [state_message][crate::model::Batch::state_message].
1803 ///
1804 /// # Example
1805 /// ```ignore,no_run
1806 /// # use google_cloud_dataproc_v1::model::Batch;
1807 /// let x = Batch::new().set_state_message("example");
1808 /// ```
1809 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1810 self.state_message = v.into();
1811 self
1812 }
1813
1814 /// Sets the value of [state_time][crate::model::Batch::state_time].
1815 ///
1816 /// # Example
1817 /// ```ignore,no_run
1818 /// # use google_cloud_dataproc_v1::model::Batch;
1819 /// use wkt::Timestamp;
1820 /// let x = Batch::new().set_state_time(Timestamp::default()/* use setters */);
1821 /// ```
1822 pub fn set_state_time<T>(mut self, v: T) -> Self
1823 where
1824 T: std::convert::Into<wkt::Timestamp>,
1825 {
1826 self.state_time = std::option::Option::Some(v.into());
1827 self
1828 }
1829
1830 /// Sets or clears the value of [state_time][crate::model::Batch::state_time].
1831 ///
1832 /// # Example
1833 /// ```ignore,no_run
1834 /// # use google_cloud_dataproc_v1::model::Batch;
1835 /// use wkt::Timestamp;
1836 /// let x = Batch::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
1837 /// let x = Batch::new().set_or_clear_state_time(None::<Timestamp>);
1838 /// ```
1839 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
1840 where
1841 T: std::convert::Into<wkt::Timestamp>,
1842 {
1843 self.state_time = v.map(|x| x.into());
1844 self
1845 }
1846
1847 /// Sets the value of [creator][crate::model::Batch::creator].
1848 ///
1849 /// # Example
1850 /// ```ignore,no_run
1851 /// # use google_cloud_dataproc_v1::model::Batch;
1852 /// let x = Batch::new().set_creator("example");
1853 /// ```
1854 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1855 self.creator = v.into();
1856 self
1857 }
1858
1859 /// Sets the value of [labels][crate::model::Batch::labels].
1860 ///
1861 /// # Example
1862 /// ```ignore,no_run
1863 /// # use google_cloud_dataproc_v1::model::Batch;
1864 /// let x = Batch::new().set_labels([
1865 /// ("key0", "abc"),
1866 /// ("key1", "xyz"),
1867 /// ]);
1868 /// ```
1869 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1870 where
1871 T: std::iter::IntoIterator<Item = (K, V)>,
1872 K: std::convert::Into<std::string::String>,
1873 V: std::convert::Into<std::string::String>,
1874 {
1875 use std::iter::Iterator;
1876 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1877 self
1878 }
1879
1880 /// Sets the value of [runtime_config][crate::model::Batch::runtime_config].
1881 ///
1882 /// # Example
1883 /// ```ignore,no_run
1884 /// # use google_cloud_dataproc_v1::model::Batch;
1885 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1886 /// let x = Batch::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
1887 /// ```
1888 pub fn set_runtime_config<T>(mut self, v: T) -> Self
1889 where
1890 T: std::convert::Into<crate::model::RuntimeConfig>,
1891 {
1892 self.runtime_config = std::option::Option::Some(v.into());
1893 self
1894 }
1895
1896 /// Sets or clears the value of [runtime_config][crate::model::Batch::runtime_config].
1897 ///
1898 /// # Example
1899 /// ```ignore,no_run
1900 /// # use google_cloud_dataproc_v1::model::Batch;
1901 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1902 /// let x = Batch::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
1903 /// let x = Batch::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
1904 /// ```
1905 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
1906 where
1907 T: std::convert::Into<crate::model::RuntimeConfig>,
1908 {
1909 self.runtime_config = v.map(|x| x.into());
1910 self
1911 }
1912
1913 /// Sets the value of [environment_config][crate::model::Batch::environment_config].
1914 ///
1915 /// # Example
1916 /// ```ignore,no_run
1917 /// # use google_cloud_dataproc_v1::model::Batch;
1918 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1919 /// let x = Batch::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
1920 /// ```
1921 pub fn set_environment_config<T>(mut self, v: T) -> Self
1922 where
1923 T: std::convert::Into<crate::model::EnvironmentConfig>,
1924 {
1925 self.environment_config = std::option::Option::Some(v.into());
1926 self
1927 }
1928
1929 /// Sets or clears the value of [environment_config][crate::model::Batch::environment_config].
1930 ///
1931 /// # Example
1932 /// ```ignore,no_run
1933 /// # use google_cloud_dataproc_v1::model::Batch;
1934 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1935 /// let x = Batch::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
1936 /// let x = Batch::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
1937 /// ```
1938 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
1939 where
1940 T: std::convert::Into<crate::model::EnvironmentConfig>,
1941 {
1942 self.environment_config = v.map(|x| x.into());
1943 self
1944 }
1945
1946 /// Sets the value of [operation][crate::model::Batch::operation].
1947 ///
1948 /// # Example
1949 /// ```ignore,no_run
1950 /// # use google_cloud_dataproc_v1::model::Batch;
1951 /// let x = Batch::new().set_operation("example");
1952 /// ```
1953 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1954 self.operation = v.into();
1955 self
1956 }
1957
1958 /// Sets the value of [state_history][crate::model::Batch::state_history].
1959 ///
1960 /// # Example
1961 /// ```ignore,no_run
1962 /// # use google_cloud_dataproc_v1::model::Batch;
1963 /// use google_cloud_dataproc_v1::model::batch::StateHistory;
1964 /// let x = Batch::new()
1965 /// .set_state_history([
1966 /// StateHistory::default()/* use setters */,
1967 /// StateHistory::default()/* use (different) setters */,
1968 /// ]);
1969 /// ```
1970 pub fn set_state_history<T, V>(mut self, v: T) -> Self
1971 where
1972 T: std::iter::IntoIterator<Item = V>,
1973 V: std::convert::Into<crate::model::batch::StateHistory>,
1974 {
1975 use std::iter::Iterator;
1976 self.state_history = v.into_iter().map(|i| i.into()).collect();
1977 self
1978 }
1979
1980 /// Sets the value of [batch_config][crate::model::Batch::batch_config].
1981 ///
1982 /// Note that all the setters affecting `batch_config` are mutually
1983 /// exclusive.
1984 ///
1985 /// # Example
1986 /// ```ignore,no_run
1987 /// # use google_cloud_dataproc_v1::model::Batch;
1988 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1989 /// let x = Batch::new().set_batch_config(Some(
1990 /// google_cloud_dataproc_v1::model::batch::BatchConfig::PysparkBatch(PySparkBatch::default().into())));
1991 /// ```
1992 pub fn set_batch_config<
1993 T: std::convert::Into<std::option::Option<crate::model::batch::BatchConfig>>,
1994 >(
1995 mut self,
1996 v: T,
1997 ) -> Self {
1998 self.batch_config = v.into();
1999 self
2000 }
2001
2002 /// The value of [batch_config][crate::model::Batch::batch_config]
2003 /// if it holds a `PysparkBatch`, `None` if the field is not set or
2004 /// holds a different branch.
2005 pub fn pyspark_batch(
2006 &self,
2007 ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkBatch>> {
2008 #[allow(unreachable_patterns)]
2009 self.batch_config.as_ref().and_then(|v| match v {
2010 crate::model::batch::BatchConfig::PysparkBatch(v) => std::option::Option::Some(v),
2011 _ => std::option::Option::None,
2012 })
2013 }
2014
2015 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2016 /// to hold a `PysparkBatch`.
2017 ///
2018 /// Note that all the setters affecting `batch_config` are
2019 /// mutually exclusive.
2020 ///
2021 /// # Example
2022 /// ```ignore,no_run
2023 /// # use google_cloud_dataproc_v1::model::Batch;
2024 /// use google_cloud_dataproc_v1::model::PySparkBatch;
2025 /// let x = Batch::new().set_pyspark_batch(PySparkBatch::default()/* use setters */);
2026 /// assert!(x.pyspark_batch().is_some());
2027 /// assert!(x.spark_batch().is_none());
2028 /// assert!(x.spark_r_batch().is_none());
2029 /// assert!(x.spark_sql_batch().is_none());
2030 /// assert!(x.pyspark_notebook_batch().is_none());
2031 /// ```
2032 pub fn set_pyspark_batch<T: std::convert::Into<std::boxed::Box<crate::model::PySparkBatch>>>(
2033 mut self,
2034 v: T,
2035 ) -> Self {
2036 self.batch_config =
2037 std::option::Option::Some(crate::model::batch::BatchConfig::PysparkBatch(v.into()));
2038 self
2039 }
2040
2041 /// The value of [batch_config][crate::model::Batch::batch_config]
2042 /// if it holds a `SparkBatch`, `None` if the field is not set or
2043 /// holds a different branch.
2044 pub fn spark_batch(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkBatch>> {
2045 #[allow(unreachable_patterns)]
2046 self.batch_config.as_ref().and_then(|v| match v {
2047 crate::model::batch::BatchConfig::SparkBatch(v) => std::option::Option::Some(v),
2048 _ => std::option::Option::None,
2049 })
2050 }
2051
2052 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2053 /// to hold a `SparkBatch`.
2054 ///
2055 /// Note that all the setters affecting `batch_config` are
2056 /// mutually exclusive.
2057 ///
2058 /// # Example
2059 /// ```ignore,no_run
2060 /// # use google_cloud_dataproc_v1::model::Batch;
2061 /// use google_cloud_dataproc_v1::model::SparkBatch;
2062 /// let x = Batch::new().set_spark_batch(SparkBatch::default()/* use setters */);
2063 /// assert!(x.spark_batch().is_some());
2064 /// assert!(x.pyspark_batch().is_none());
2065 /// assert!(x.spark_r_batch().is_none());
2066 /// assert!(x.spark_sql_batch().is_none());
2067 /// assert!(x.pyspark_notebook_batch().is_none());
2068 /// ```
2069 pub fn set_spark_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkBatch>>>(
2070 mut self,
2071 v: T,
2072 ) -> Self {
2073 self.batch_config =
2074 std::option::Option::Some(crate::model::batch::BatchConfig::SparkBatch(v.into()));
2075 self
2076 }
2077
2078 /// The value of [batch_config][crate::model::Batch::batch_config]
2079 /// if it holds a `SparkRBatch`, `None` if the field is not set or
2080 /// holds a different branch.
2081 pub fn spark_r_batch(
2082 &self,
2083 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkRBatch>> {
2084 #[allow(unreachable_patterns)]
2085 self.batch_config.as_ref().and_then(|v| match v {
2086 crate::model::batch::BatchConfig::SparkRBatch(v) => std::option::Option::Some(v),
2087 _ => std::option::Option::None,
2088 })
2089 }
2090
2091 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2092 /// to hold a `SparkRBatch`.
2093 ///
2094 /// Note that all the setters affecting `batch_config` are
2095 /// mutually exclusive.
2096 ///
2097 /// # Example
2098 /// ```ignore,no_run
2099 /// # use google_cloud_dataproc_v1::model::Batch;
2100 /// use google_cloud_dataproc_v1::model::SparkRBatch;
2101 /// let x = Batch::new().set_spark_r_batch(SparkRBatch::default()/* use setters */);
2102 /// assert!(x.spark_r_batch().is_some());
2103 /// assert!(x.pyspark_batch().is_none());
2104 /// assert!(x.spark_batch().is_none());
2105 /// assert!(x.spark_sql_batch().is_none());
2106 /// assert!(x.pyspark_notebook_batch().is_none());
2107 /// ```
2108 pub fn set_spark_r_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkRBatch>>>(
2109 mut self,
2110 v: T,
2111 ) -> Self {
2112 self.batch_config =
2113 std::option::Option::Some(crate::model::batch::BatchConfig::SparkRBatch(v.into()));
2114 self
2115 }
2116
2117 /// The value of [batch_config][crate::model::Batch::batch_config]
2118 /// if it holds a `SparkSqlBatch`, `None` if the field is not set or
2119 /// holds a different branch.
2120 pub fn spark_sql_batch(
2121 &self,
2122 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlBatch>> {
2123 #[allow(unreachable_patterns)]
2124 self.batch_config.as_ref().and_then(|v| match v {
2125 crate::model::batch::BatchConfig::SparkSqlBatch(v) => std::option::Option::Some(v),
2126 _ => std::option::Option::None,
2127 })
2128 }
2129
2130 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2131 /// to hold a `SparkSqlBatch`.
2132 ///
2133 /// Note that all the setters affecting `batch_config` are
2134 /// mutually exclusive.
2135 ///
2136 /// # Example
2137 /// ```ignore,no_run
2138 /// # use google_cloud_dataproc_v1::model::Batch;
2139 /// use google_cloud_dataproc_v1::model::SparkSqlBatch;
2140 /// let x = Batch::new().set_spark_sql_batch(SparkSqlBatch::default()/* use setters */);
2141 /// assert!(x.spark_sql_batch().is_some());
2142 /// assert!(x.pyspark_batch().is_none());
2143 /// assert!(x.spark_batch().is_none());
2144 /// assert!(x.spark_r_batch().is_none());
2145 /// assert!(x.pyspark_notebook_batch().is_none());
2146 /// ```
2147 pub fn set_spark_sql_batch<
2148 T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlBatch>>,
2149 >(
2150 mut self,
2151 v: T,
2152 ) -> Self {
2153 self.batch_config =
2154 std::option::Option::Some(crate::model::batch::BatchConfig::SparkSqlBatch(v.into()));
2155 self
2156 }
2157
2158 /// The value of [batch_config][crate::model::Batch::batch_config]
2159 /// if it holds a `PysparkNotebookBatch`, `None` if the field is not set or
2160 /// holds a different branch.
2161 pub fn pyspark_notebook_batch(
2162 &self,
2163 ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkNotebookBatch>> {
2164 #[allow(unreachable_patterns)]
2165 self.batch_config.as_ref().and_then(|v| match v {
2166 crate::model::batch::BatchConfig::PysparkNotebookBatch(v) => {
2167 std::option::Option::Some(v)
2168 }
2169 _ => std::option::Option::None,
2170 })
2171 }
2172
2173 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2174 /// to hold a `PysparkNotebookBatch`.
2175 ///
2176 /// Note that all the setters affecting `batch_config` are
2177 /// mutually exclusive.
2178 ///
2179 /// # Example
2180 /// ```ignore,no_run
2181 /// # use google_cloud_dataproc_v1::model::Batch;
2182 /// use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
2183 /// let x = Batch::new().set_pyspark_notebook_batch(PySparkNotebookBatch::default()/* use setters */);
2184 /// assert!(x.pyspark_notebook_batch().is_some());
2185 /// assert!(x.pyspark_batch().is_none());
2186 /// assert!(x.spark_batch().is_none());
2187 /// assert!(x.spark_r_batch().is_none());
2188 /// assert!(x.spark_sql_batch().is_none());
2189 /// ```
2190 pub fn set_pyspark_notebook_batch<
2191 T: std::convert::Into<std::boxed::Box<crate::model::PySparkNotebookBatch>>,
2192 >(
2193 mut self,
2194 v: T,
2195 ) -> Self {
2196 self.batch_config = std::option::Option::Some(
2197 crate::model::batch::BatchConfig::PysparkNotebookBatch(v.into()),
2198 );
2199 self
2200 }
2201}
2202
2203impl wkt::message::Message for Batch {
2204 fn typename() -> &'static str {
2205 "type.googleapis.com/google.cloud.dataproc.v1.Batch"
2206 }
2207}
2208
2209/// Defines additional types related to [Batch].
2210pub mod batch {
2211 #[allow(unused_imports)]
2212 use super::*;
2213
2214 /// Historical state information.
2215 #[derive(Clone, Default, PartialEq)]
2216 #[non_exhaustive]
2217 pub struct StateHistory {
2218 /// Output only. The state of the batch at this point in history.
2219 pub state: crate::model::batch::State,
2220
2221 /// Output only. Details about the state at this point in history.
2222 pub state_message: std::string::String,
2223
2224 /// Output only. The time when the batch entered the historical state.
2225 pub state_start_time: std::option::Option<wkt::Timestamp>,
2226
2227 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2228 }
2229
2230 impl StateHistory {
2231 /// Creates a new default instance.
2232 pub fn new() -> Self {
2233 std::default::Default::default()
2234 }
2235
2236 /// Sets the value of [state][crate::model::batch::StateHistory::state].
2237 ///
2238 /// # Example
2239 /// ```ignore,no_run
2240 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2241 /// use google_cloud_dataproc_v1::model::batch::State;
2242 /// let x0 = StateHistory::new().set_state(State::Pending);
2243 /// let x1 = StateHistory::new().set_state(State::Running);
2244 /// let x2 = StateHistory::new().set_state(State::Cancelling);
2245 /// ```
2246 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(
2247 mut self,
2248 v: T,
2249 ) -> Self {
2250 self.state = v.into();
2251 self
2252 }
2253
2254 /// Sets the value of [state_message][crate::model::batch::StateHistory::state_message].
2255 ///
2256 /// # Example
2257 /// ```ignore,no_run
2258 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2259 /// let x = StateHistory::new().set_state_message("example");
2260 /// ```
2261 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
2262 mut self,
2263 v: T,
2264 ) -> Self {
2265 self.state_message = v.into();
2266 self
2267 }
2268
2269 /// Sets the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2270 ///
2271 /// # Example
2272 /// ```ignore,no_run
2273 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2274 /// use wkt::Timestamp;
2275 /// let x = StateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
2276 /// ```
2277 pub fn set_state_start_time<T>(mut self, v: T) -> Self
2278 where
2279 T: std::convert::Into<wkt::Timestamp>,
2280 {
2281 self.state_start_time = std::option::Option::Some(v.into());
2282 self
2283 }
2284
2285 /// Sets or clears the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2286 ///
2287 /// # Example
2288 /// ```ignore,no_run
2289 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2290 /// use wkt::Timestamp;
2291 /// let x = StateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
2292 /// let x = StateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
2293 /// ```
2294 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2295 where
2296 T: std::convert::Into<wkt::Timestamp>,
2297 {
2298 self.state_start_time = v.map(|x| x.into());
2299 self
2300 }
2301 }
2302
2303 impl wkt::message::Message for StateHistory {
2304 fn typename() -> &'static str {
2305 "type.googleapis.com/google.cloud.dataproc.v1.Batch.StateHistory"
2306 }
2307 }
2308
2309 /// The batch state.
2310 ///
2311 /// # Working with unknown values
2312 ///
2313 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2314 /// additional enum variants at any time. Adding new variants is not considered
2315 /// a breaking change. Applications should write their code in anticipation of:
2316 ///
2317 /// - New values appearing in future releases of the client library, **and**
2318 /// - New values received dynamically, without application changes.
2319 ///
2320 /// Please consult the [Working with enums] section in the user guide for some
2321 /// guidelines.
2322 ///
2323 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2324 #[derive(Clone, Debug, PartialEq)]
2325 #[non_exhaustive]
2326 pub enum State {
2327 /// The batch state is unknown.
2328 Unspecified,
2329 /// The batch is created before running.
2330 Pending,
2331 /// The batch is running.
2332 Running,
2333 /// The batch is cancelling.
2334 Cancelling,
2335 /// The batch cancellation was successful.
2336 Cancelled,
2337 /// The batch completed successfully.
2338 Succeeded,
2339 /// The batch is no longer running due to an error.
2340 Failed,
2341 /// If set, the enum was initialized with an unknown value.
2342 ///
2343 /// Applications can examine the value using [State::value] or
2344 /// [State::name].
2345 UnknownValue(state::UnknownValue),
2346 }
2347
2348 #[doc(hidden)]
2349 pub mod state {
2350 #[allow(unused_imports)]
2351 use super::*;
2352 #[derive(Clone, Debug, PartialEq)]
2353 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2354 }
2355
2356 impl State {
2357 /// Gets the enum value.
2358 ///
2359 /// Returns `None` if the enum contains an unknown value deserialized from
2360 /// the string representation of enums.
2361 pub fn value(&self) -> std::option::Option<i32> {
2362 match self {
2363 Self::Unspecified => std::option::Option::Some(0),
2364 Self::Pending => std::option::Option::Some(1),
2365 Self::Running => std::option::Option::Some(2),
2366 Self::Cancelling => std::option::Option::Some(3),
2367 Self::Cancelled => std::option::Option::Some(4),
2368 Self::Succeeded => std::option::Option::Some(5),
2369 Self::Failed => std::option::Option::Some(6),
2370 Self::UnknownValue(u) => u.0.value(),
2371 }
2372 }
2373
2374 /// Gets the enum value as a string.
2375 ///
2376 /// Returns `None` if the enum contains an unknown value deserialized from
2377 /// the integer representation of enums.
2378 pub fn name(&self) -> std::option::Option<&str> {
2379 match self {
2380 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2381 Self::Pending => std::option::Option::Some("PENDING"),
2382 Self::Running => std::option::Option::Some("RUNNING"),
2383 Self::Cancelling => std::option::Option::Some("CANCELLING"),
2384 Self::Cancelled => std::option::Option::Some("CANCELLED"),
2385 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2386 Self::Failed => std::option::Option::Some("FAILED"),
2387 Self::UnknownValue(u) => u.0.name(),
2388 }
2389 }
2390 }
2391
2392 impl std::default::Default for State {
2393 fn default() -> Self {
2394 use std::convert::From;
2395 Self::from(0)
2396 }
2397 }
2398
2399 impl std::fmt::Display for State {
2400 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2401 wkt::internal::display_enum(f, self.name(), self.value())
2402 }
2403 }
2404
2405 impl std::convert::From<i32> for State {
2406 fn from(value: i32) -> Self {
2407 match value {
2408 0 => Self::Unspecified,
2409 1 => Self::Pending,
2410 2 => Self::Running,
2411 3 => Self::Cancelling,
2412 4 => Self::Cancelled,
2413 5 => Self::Succeeded,
2414 6 => Self::Failed,
2415 _ => Self::UnknownValue(state::UnknownValue(
2416 wkt::internal::UnknownEnumValue::Integer(value),
2417 )),
2418 }
2419 }
2420 }
2421
2422 impl std::convert::From<&str> for State {
2423 fn from(value: &str) -> Self {
2424 use std::string::ToString;
2425 match value {
2426 "STATE_UNSPECIFIED" => Self::Unspecified,
2427 "PENDING" => Self::Pending,
2428 "RUNNING" => Self::Running,
2429 "CANCELLING" => Self::Cancelling,
2430 "CANCELLED" => Self::Cancelled,
2431 "SUCCEEDED" => Self::Succeeded,
2432 "FAILED" => Self::Failed,
2433 _ => Self::UnknownValue(state::UnknownValue(
2434 wkt::internal::UnknownEnumValue::String(value.to_string()),
2435 )),
2436 }
2437 }
2438 }
2439
2440 impl serde::ser::Serialize for State {
2441 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2442 where
2443 S: serde::Serializer,
2444 {
2445 match self {
2446 Self::Unspecified => serializer.serialize_i32(0),
2447 Self::Pending => serializer.serialize_i32(1),
2448 Self::Running => serializer.serialize_i32(2),
2449 Self::Cancelling => serializer.serialize_i32(3),
2450 Self::Cancelled => serializer.serialize_i32(4),
2451 Self::Succeeded => serializer.serialize_i32(5),
2452 Self::Failed => serializer.serialize_i32(6),
2453 Self::UnknownValue(u) => u.0.serialize(serializer),
2454 }
2455 }
2456 }
2457
2458 impl<'de> serde::de::Deserialize<'de> for State {
2459 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2460 where
2461 D: serde::Deserializer<'de>,
2462 {
2463 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2464 ".google.cloud.dataproc.v1.Batch.State",
2465 ))
2466 }
2467 }
2468
2469 /// The application/framework-specific portion of the batch configuration.
2470 #[derive(Clone, Debug, PartialEq)]
2471 #[non_exhaustive]
2472 pub enum BatchConfig {
2473 /// Optional. PySpark batch config.
2474 PysparkBatch(std::boxed::Box<crate::model::PySparkBatch>),
2475 /// Optional. Spark batch config.
2476 SparkBatch(std::boxed::Box<crate::model::SparkBatch>),
2477 /// Optional. SparkR batch config.
2478 SparkRBatch(std::boxed::Box<crate::model::SparkRBatch>),
2479 /// Optional. SparkSql batch config.
2480 SparkSqlBatch(std::boxed::Box<crate::model::SparkSqlBatch>),
2481 /// Optional. PySpark notebook batch config.
2482 PysparkNotebookBatch(std::boxed::Box<crate::model::PySparkNotebookBatch>),
2483 }
2484}
2485
2486/// A configuration for running an
2487/// [Apache
2488/// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html)
2489/// batch workload.
2490#[derive(Clone, Default, PartialEq)]
2491#[non_exhaustive]
2492pub struct PySparkBatch {
2493 /// Required. The HCFS URI of the main Python file to use as the Spark driver.
2494 /// Must be a .py file.
2495 pub main_python_file_uri: std::string::String,
2496
2497 /// Optional. The arguments to pass to the driver. Do not include arguments
2498 /// that can be set as batch properties, such as `--conf`, since a collision
2499 /// can occur that causes an incorrect batch submission.
2500 pub args: std::vec::Vec<std::string::String>,
2501
2502 /// Optional. HCFS file URIs of Python files to pass to the PySpark
2503 /// framework. Supported file types: `.py`, `.egg`, and `.zip`.
2504 pub python_file_uris: std::vec::Vec<std::string::String>,
2505
2506 /// Optional. HCFS URIs of jar files to add to the classpath of the
2507 /// Spark driver and tasks.
2508 pub jar_file_uris: std::vec::Vec<std::string::String>,
2509
2510 /// Optional. HCFS URIs of files to be placed in the working directory of
2511 /// each executor.
2512 pub file_uris: std::vec::Vec<std::string::String>,
2513
2514 /// Optional. HCFS URIs of archives to be extracted into the working directory
2515 /// of each executor. Supported file types:
2516 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2517 pub archive_uris: std::vec::Vec<std::string::String>,
2518
2519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2520}
2521
2522impl PySparkBatch {
2523 /// Creates a new default instance.
2524 pub fn new() -> Self {
2525 std::default::Default::default()
2526 }
2527
2528 /// Sets the value of [main_python_file_uri][crate::model::PySparkBatch::main_python_file_uri].
2529 ///
2530 /// # Example
2531 /// ```ignore,no_run
2532 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2533 /// let x = PySparkBatch::new().set_main_python_file_uri("example");
2534 /// ```
2535 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
2536 mut self,
2537 v: T,
2538 ) -> Self {
2539 self.main_python_file_uri = v.into();
2540 self
2541 }
2542
2543 /// Sets the value of [args][crate::model::PySparkBatch::args].
2544 ///
2545 /// # Example
2546 /// ```ignore,no_run
2547 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2548 /// let x = PySparkBatch::new().set_args(["a", "b", "c"]);
2549 /// ```
2550 pub fn set_args<T, V>(mut self, v: T) -> Self
2551 where
2552 T: std::iter::IntoIterator<Item = V>,
2553 V: std::convert::Into<std::string::String>,
2554 {
2555 use std::iter::Iterator;
2556 self.args = v.into_iter().map(|i| i.into()).collect();
2557 self
2558 }
2559
2560 /// Sets the value of [python_file_uris][crate::model::PySparkBatch::python_file_uris].
2561 ///
2562 /// # Example
2563 /// ```ignore,no_run
2564 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2565 /// let x = PySparkBatch::new().set_python_file_uris(["a", "b", "c"]);
2566 /// ```
2567 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
2568 where
2569 T: std::iter::IntoIterator<Item = V>,
2570 V: std::convert::Into<std::string::String>,
2571 {
2572 use std::iter::Iterator;
2573 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
2574 self
2575 }
2576
2577 /// Sets the value of [jar_file_uris][crate::model::PySparkBatch::jar_file_uris].
2578 ///
2579 /// # Example
2580 /// ```ignore,no_run
2581 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2582 /// let x = PySparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2583 /// ```
2584 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2585 where
2586 T: std::iter::IntoIterator<Item = V>,
2587 V: std::convert::Into<std::string::String>,
2588 {
2589 use std::iter::Iterator;
2590 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2591 self
2592 }
2593
2594 /// Sets the value of [file_uris][crate::model::PySparkBatch::file_uris].
2595 ///
2596 /// # Example
2597 /// ```ignore,no_run
2598 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2599 /// let x = PySparkBatch::new().set_file_uris(["a", "b", "c"]);
2600 /// ```
2601 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2602 where
2603 T: std::iter::IntoIterator<Item = V>,
2604 V: std::convert::Into<std::string::String>,
2605 {
2606 use std::iter::Iterator;
2607 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2608 self
2609 }
2610
2611 /// Sets the value of [archive_uris][crate::model::PySparkBatch::archive_uris].
2612 ///
2613 /// # Example
2614 /// ```ignore,no_run
2615 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2616 /// let x = PySparkBatch::new().set_archive_uris(["a", "b", "c"]);
2617 /// ```
2618 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2619 where
2620 T: std::iter::IntoIterator<Item = V>,
2621 V: std::convert::Into<std::string::String>,
2622 {
2623 use std::iter::Iterator;
2624 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2625 self
2626 }
2627}
2628
2629impl wkt::message::Message for PySparkBatch {
2630 fn typename() -> &'static str {
2631 "type.googleapis.com/google.cloud.dataproc.v1.PySparkBatch"
2632 }
2633}
2634
2635/// A configuration for running an [Apache Spark](https://spark.apache.org/)
2636/// batch workload.
2637#[derive(Clone, Default, PartialEq)]
2638#[non_exhaustive]
2639pub struct SparkBatch {
2640 /// Optional. The arguments to pass to the driver. Do not include arguments
2641 /// that can be set as batch properties, such as `--conf`, since a collision
2642 /// can occur that causes an incorrect batch submission.
2643 pub args: std::vec::Vec<std::string::String>,
2644
2645 /// Optional. HCFS URIs of jar files to add to the classpath of the
2646 /// Spark driver and tasks.
2647 pub jar_file_uris: std::vec::Vec<std::string::String>,
2648
2649 /// Optional. HCFS URIs of files to be placed in the working directory of
2650 /// each executor.
2651 pub file_uris: std::vec::Vec<std::string::String>,
2652
2653 /// Optional. HCFS URIs of archives to be extracted into the working directory
2654 /// of each executor. Supported file types:
2655 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2656 pub archive_uris: std::vec::Vec<std::string::String>,
2657
2658 /// The specification of the main method to call to drive the Spark
2659 /// workload. Specify either the jar file that contains the main class or the
2660 /// main class name. To pass both a main jar and a main class in that jar, add
2661 /// the jar to `jar_file_uris`, and then specify the main class
2662 /// name in `main_class`.
2663 pub driver: std::option::Option<crate::model::spark_batch::Driver>,
2664
2665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2666}
2667
2668impl SparkBatch {
2669 /// Creates a new default instance.
2670 pub fn new() -> Self {
2671 std::default::Default::default()
2672 }
2673
2674 /// Sets the value of [args][crate::model::SparkBatch::args].
2675 ///
2676 /// # Example
2677 /// ```ignore,no_run
2678 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2679 /// let x = SparkBatch::new().set_args(["a", "b", "c"]);
2680 /// ```
2681 pub fn set_args<T, V>(mut self, v: T) -> Self
2682 where
2683 T: std::iter::IntoIterator<Item = V>,
2684 V: std::convert::Into<std::string::String>,
2685 {
2686 use std::iter::Iterator;
2687 self.args = v.into_iter().map(|i| i.into()).collect();
2688 self
2689 }
2690
2691 /// Sets the value of [jar_file_uris][crate::model::SparkBatch::jar_file_uris].
2692 ///
2693 /// # Example
2694 /// ```ignore,no_run
2695 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2696 /// let x = SparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2697 /// ```
2698 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2699 where
2700 T: std::iter::IntoIterator<Item = V>,
2701 V: std::convert::Into<std::string::String>,
2702 {
2703 use std::iter::Iterator;
2704 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2705 self
2706 }
2707
2708 /// Sets the value of [file_uris][crate::model::SparkBatch::file_uris].
2709 ///
2710 /// # Example
2711 /// ```ignore,no_run
2712 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2713 /// let x = SparkBatch::new().set_file_uris(["a", "b", "c"]);
2714 /// ```
2715 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2716 where
2717 T: std::iter::IntoIterator<Item = V>,
2718 V: std::convert::Into<std::string::String>,
2719 {
2720 use std::iter::Iterator;
2721 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2722 self
2723 }
2724
2725 /// Sets the value of [archive_uris][crate::model::SparkBatch::archive_uris].
2726 ///
2727 /// # Example
2728 /// ```ignore,no_run
2729 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2730 /// let x = SparkBatch::new().set_archive_uris(["a", "b", "c"]);
2731 /// ```
2732 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2733 where
2734 T: std::iter::IntoIterator<Item = V>,
2735 V: std::convert::Into<std::string::String>,
2736 {
2737 use std::iter::Iterator;
2738 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2739 self
2740 }
2741
2742 /// Sets the value of [driver][crate::model::SparkBatch::driver].
2743 ///
2744 /// Note that all the setters affecting `driver` are mutually
2745 /// exclusive.
2746 ///
2747 /// # Example
2748 /// ```ignore,no_run
2749 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2750 /// use google_cloud_dataproc_v1::model::spark_batch::Driver;
2751 /// let x = SparkBatch::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
2752 /// ```
2753 pub fn set_driver<
2754 T: std::convert::Into<std::option::Option<crate::model::spark_batch::Driver>>,
2755 >(
2756 mut self,
2757 v: T,
2758 ) -> Self {
2759 self.driver = v.into();
2760 self
2761 }
2762
2763 /// The value of [driver][crate::model::SparkBatch::driver]
2764 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
2765 /// holds a different branch.
2766 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
2767 #[allow(unreachable_patterns)]
2768 self.driver.as_ref().and_then(|v| match v {
2769 crate::model::spark_batch::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
2770 _ => std::option::Option::None,
2771 })
2772 }
2773
2774 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2775 /// to hold a `MainJarFileUri`.
2776 ///
2777 /// Note that all the setters affecting `driver` are
2778 /// mutually exclusive.
2779 ///
2780 /// # Example
2781 /// ```ignore,no_run
2782 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2783 /// let x = SparkBatch::new().set_main_jar_file_uri("example");
2784 /// assert!(x.main_jar_file_uri().is_some());
2785 /// assert!(x.main_class().is_none());
2786 /// ```
2787 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
2788 mut self,
2789 v: T,
2790 ) -> Self {
2791 self.driver =
2792 std::option::Option::Some(crate::model::spark_batch::Driver::MainJarFileUri(v.into()));
2793 self
2794 }
2795
2796 /// The value of [driver][crate::model::SparkBatch::driver]
2797 /// if it holds a `MainClass`, `None` if the field is not set or
2798 /// holds a different branch.
2799 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
2800 #[allow(unreachable_patterns)]
2801 self.driver.as_ref().and_then(|v| match v {
2802 crate::model::spark_batch::Driver::MainClass(v) => std::option::Option::Some(v),
2803 _ => std::option::Option::None,
2804 })
2805 }
2806
2807 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2808 /// to hold a `MainClass`.
2809 ///
2810 /// Note that all the setters affecting `driver` are
2811 /// mutually exclusive.
2812 ///
2813 /// # Example
2814 /// ```ignore,no_run
2815 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2816 /// let x = SparkBatch::new().set_main_class("example");
2817 /// assert!(x.main_class().is_some());
2818 /// assert!(x.main_jar_file_uri().is_none());
2819 /// ```
2820 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2821 self.driver =
2822 std::option::Option::Some(crate::model::spark_batch::Driver::MainClass(v.into()));
2823 self
2824 }
2825}
2826
2827impl wkt::message::Message for SparkBatch {
2828 fn typename() -> &'static str {
2829 "type.googleapis.com/google.cloud.dataproc.v1.SparkBatch"
2830 }
2831}
2832
2833/// Defines additional types related to [SparkBatch].
2834pub mod spark_batch {
2835 #[allow(unused_imports)]
2836 use super::*;
2837
2838 /// The specification of the main method to call to drive the Spark
2839 /// workload. Specify either the jar file that contains the main class or the
2840 /// main class name. To pass both a main jar and a main class in that jar, add
2841 /// the jar to `jar_file_uris`, and then specify the main class
2842 /// name in `main_class`.
2843 #[derive(Clone, Debug, PartialEq)]
2844 #[non_exhaustive]
2845 pub enum Driver {
2846 /// Optional. The HCFS URI of the jar file that contains the main class.
2847 MainJarFileUri(std::string::String),
2848 /// Optional. The name of the driver main class. The jar file that contains
2849 /// the class must be in the classpath or specified in `jar_file_uris`.
2850 MainClass(std::string::String),
2851 }
2852}
2853
2854/// A configuration for running an
2855/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
2856/// batch workload.
2857#[derive(Clone, Default, PartialEq)]
2858#[non_exhaustive]
2859pub struct SparkRBatch {
2860 /// Required. The HCFS URI of the main R file to use as the driver.
2861 /// Must be a `.R` or `.r` file.
2862 pub main_r_file_uri: std::string::String,
2863
2864 /// Optional. The arguments to pass to the Spark driver. Do not include
2865 /// arguments that can be set as batch properties, such as `--conf`, since a
2866 /// collision can occur that causes an incorrect batch submission.
2867 pub args: std::vec::Vec<std::string::String>,
2868
2869 /// Optional. HCFS URIs of files to be placed in the working directory of
2870 /// each executor.
2871 pub file_uris: std::vec::Vec<std::string::String>,
2872
2873 /// Optional. HCFS URIs of archives to be extracted into the working directory
2874 /// of each executor. Supported file types:
2875 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2876 pub archive_uris: std::vec::Vec<std::string::String>,
2877
2878 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2879}
2880
2881impl SparkRBatch {
2882 /// Creates a new default instance.
2883 pub fn new() -> Self {
2884 std::default::Default::default()
2885 }
2886
2887 /// Sets the value of [main_r_file_uri][crate::model::SparkRBatch::main_r_file_uri].
2888 ///
2889 /// # Example
2890 /// ```ignore,no_run
2891 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2892 /// let x = SparkRBatch::new().set_main_r_file_uri("example");
2893 /// ```
2894 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2895 self.main_r_file_uri = v.into();
2896 self
2897 }
2898
2899 /// Sets the value of [args][crate::model::SparkRBatch::args].
2900 ///
2901 /// # Example
2902 /// ```ignore,no_run
2903 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2904 /// let x = SparkRBatch::new().set_args(["a", "b", "c"]);
2905 /// ```
2906 pub fn set_args<T, V>(mut self, v: T) -> Self
2907 where
2908 T: std::iter::IntoIterator<Item = V>,
2909 V: std::convert::Into<std::string::String>,
2910 {
2911 use std::iter::Iterator;
2912 self.args = v.into_iter().map(|i| i.into()).collect();
2913 self
2914 }
2915
2916 /// Sets the value of [file_uris][crate::model::SparkRBatch::file_uris].
2917 ///
2918 /// # Example
2919 /// ```ignore,no_run
2920 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2921 /// let x = SparkRBatch::new().set_file_uris(["a", "b", "c"]);
2922 /// ```
2923 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2924 where
2925 T: std::iter::IntoIterator<Item = V>,
2926 V: std::convert::Into<std::string::String>,
2927 {
2928 use std::iter::Iterator;
2929 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2930 self
2931 }
2932
2933 /// Sets the value of [archive_uris][crate::model::SparkRBatch::archive_uris].
2934 ///
2935 /// # Example
2936 /// ```ignore,no_run
2937 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2938 /// let x = SparkRBatch::new().set_archive_uris(["a", "b", "c"]);
2939 /// ```
2940 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2941 where
2942 T: std::iter::IntoIterator<Item = V>,
2943 V: std::convert::Into<std::string::String>,
2944 {
2945 use std::iter::Iterator;
2946 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2947 self
2948 }
2949}
2950
2951impl wkt::message::Message for SparkRBatch {
2952 fn typename() -> &'static str {
2953 "type.googleapis.com/google.cloud.dataproc.v1.SparkRBatch"
2954 }
2955}
2956
2957/// A configuration for running
2958/// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch
2959/// workload.
2960#[derive(Clone, Default, PartialEq)]
2961#[non_exhaustive]
2962pub struct SparkSqlBatch {
2963 /// Required. The HCFS URI of the script that contains Spark SQL queries to
2964 /// execute.
2965 pub query_file_uri: std::string::String,
2966
2967 /// Optional. Mapping of query variable names to values (equivalent to the
2968 /// Spark SQL command: `SET name="value";`).
2969 pub query_variables: std::collections::HashMap<std::string::String, std::string::String>,
2970
2971 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2972 pub jar_file_uris: std::vec::Vec<std::string::String>,
2973
2974 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2975}
2976
2977impl SparkSqlBatch {
2978 /// Creates a new default instance.
2979 pub fn new() -> Self {
2980 std::default::Default::default()
2981 }
2982
2983 /// Sets the value of [query_file_uri][crate::model::SparkSqlBatch::query_file_uri].
2984 ///
2985 /// # Example
2986 /// ```ignore,no_run
2987 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2988 /// let x = SparkSqlBatch::new().set_query_file_uri("example");
2989 /// ```
2990 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2991 self.query_file_uri = v.into();
2992 self
2993 }
2994
2995 /// Sets the value of [query_variables][crate::model::SparkSqlBatch::query_variables].
2996 ///
2997 /// # Example
2998 /// ```ignore,no_run
2999 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
3000 /// let x = SparkSqlBatch::new().set_query_variables([
3001 /// ("key0", "abc"),
3002 /// ("key1", "xyz"),
3003 /// ]);
3004 /// ```
3005 pub fn set_query_variables<T, K, V>(mut self, v: T) -> Self
3006 where
3007 T: std::iter::IntoIterator<Item = (K, V)>,
3008 K: std::convert::Into<std::string::String>,
3009 V: std::convert::Into<std::string::String>,
3010 {
3011 use std::iter::Iterator;
3012 self.query_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3013 self
3014 }
3015
3016 /// Sets the value of [jar_file_uris][crate::model::SparkSqlBatch::jar_file_uris].
3017 ///
3018 /// # Example
3019 /// ```ignore,no_run
3020 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
3021 /// let x = SparkSqlBatch::new().set_jar_file_uris(["a", "b", "c"]);
3022 /// ```
3023 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
3024 where
3025 T: std::iter::IntoIterator<Item = V>,
3026 V: std::convert::Into<std::string::String>,
3027 {
3028 use std::iter::Iterator;
3029 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
3030 self
3031 }
3032}
3033
3034impl wkt::message::Message for SparkSqlBatch {
3035 fn typename() -> &'static str {
3036 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlBatch"
3037 }
3038}
3039
3040/// A configuration for running a PySpark Notebook batch workload.
3041#[derive(Clone, Default, PartialEq)]
3042#[non_exhaustive]
3043pub struct PySparkNotebookBatch {
3044 /// Required. The HCFS URI of the notebook file to execute.
3045 pub notebook_file_uri: std::string::String,
3046
3047 /// Optional. The parameters to pass to the notebook.
3048 pub params: std::collections::HashMap<std::string::String, std::string::String>,
3049
3050 /// Optional. HCFS URIs of Python files to pass to the PySpark framework.
3051 pub python_file_uris: std::vec::Vec<std::string::String>,
3052
3053 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
3054 pub jar_file_uris: std::vec::Vec<std::string::String>,
3055
3056 /// Optional. HCFS URIs of files to be placed in the working directory of
3057 /// each executor
3058 pub file_uris: std::vec::Vec<std::string::String>,
3059
3060 /// Optional. HCFS URIs of archives to be extracted into the working directory
3061 /// of each executor. Supported file types:
3062 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
3063 pub archive_uris: std::vec::Vec<std::string::String>,
3064
3065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3066}
3067
3068impl PySparkNotebookBatch {
3069 /// Creates a new default instance.
3070 pub fn new() -> Self {
3071 std::default::Default::default()
3072 }
3073
3074 /// Sets the value of [notebook_file_uri][crate::model::PySparkNotebookBatch::notebook_file_uri].
3075 ///
3076 /// # Example
3077 /// ```ignore,no_run
3078 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3079 /// let x = PySparkNotebookBatch::new().set_notebook_file_uri("example");
3080 /// ```
3081 pub fn set_notebook_file_uri<T: std::convert::Into<std::string::String>>(
3082 mut self,
3083 v: T,
3084 ) -> Self {
3085 self.notebook_file_uri = v.into();
3086 self
3087 }
3088
3089 /// Sets the value of [params][crate::model::PySparkNotebookBatch::params].
3090 ///
3091 /// # Example
3092 /// ```ignore,no_run
3093 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3094 /// let x = PySparkNotebookBatch::new().set_params([
3095 /// ("key0", "abc"),
3096 /// ("key1", "xyz"),
3097 /// ]);
3098 /// ```
3099 pub fn set_params<T, K, V>(mut self, v: T) -> Self
3100 where
3101 T: std::iter::IntoIterator<Item = (K, V)>,
3102 K: std::convert::Into<std::string::String>,
3103 V: std::convert::Into<std::string::String>,
3104 {
3105 use std::iter::Iterator;
3106 self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3107 self
3108 }
3109
3110 /// Sets the value of [python_file_uris][crate::model::PySparkNotebookBatch::python_file_uris].
3111 ///
3112 /// # Example
3113 /// ```ignore,no_run
3114 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3115 /// let x = PySparkNotebookBatch::new().set_python_file_uris(["a", "b", "c"]);
3116 /// ```
3117 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
3118 where
3119 T: std::iter::IntoIterator<Item = V>,
3120 V: std::convert::Into<std::string::String>,
3121 {
3122 use std::iter::Iterator;
3123 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
3124 self
3125 }
3126
3127 /// Sets the value of [jar_file_uris][crate::model::PySparkNotebookBatch::jar_file_uris].
3128 ///
3129 /// # Example
3130 /// ```ignore,no_run
3131 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3132 /// let x = PySparkNotebookBatch::new().set_jar_file_uris(["a", "b", "c"]);
3133 /// ```
3134 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
3135 where
3136 T: std::iter::IntoIterator<Item = V>,
3137 V: std::convert::Into<std::string::String>,
3138 {
3139 use std::iter::Iterator;
3140 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
3141 self
3142 }
3143
3144 /// Sets the value of [file_uris][crate::model::PySparkNotebookBatch::file_uris].
3145 ///
3146 /// # Example
3147 /// ```ignore,no_run
3148 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3149 /// let x = PySparkNotebookBatch::new().set_file_uris(["a", "b", "c"]);
3150 /// ```
3151 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
3152 where
3153 T: std::iter::IntoIterator<Item = V>,
3154 V: std::convert::Into<std::string::String>,
3155 {
3156 use std::iter::Iterator;
3157 self.file_uris = v.into_iter().map(|i| i.into()).collect();
3158 self
3159 }
3160
3161 /// Sets the value of [archive_uris][crate::model::PySparkNotebookBatch::archive_uris].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_dataproc_v1::model::PySparkNotebookBatch;
3166 /// let x = PySparkNotebookBatch::new().set_archive_uris(["a", "b", "c"]);
3167 /// ```
3168 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
3169 where
3170 T: std::iter::IntoIterator<Item = V>,
3171 V: std::convert::Into<std::string::String>,
3172 {
3173 use std::iter::Iterator;
3174 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
3175 self
3176 }
3177}
3178
3179impl wkt::message::Message for PySparkNotebookBatch {
3180 fn typename() -> &'static str {
3181 "type.googleapis.com/google.cloud.dataproc.v1.PySparkNotebookBatch"
3182 }
3183}
3184
3185/// Describes the identifying information, config, and status of
3186/// a Dataproc cluster
3187#[derive(Clone, Default, PartialEq)]
3188#[non_exhaustive]
3189pub struct Cluster {
3190 /// Required. The Google Cloud Platform project ID that the cluster belongs to.
3191 pub project_id: std::string::String,
3192
3193 /// Required. The cluster name, which must be unique within a project.
3194 /// The name must start with a lowercase letter, and can contain
3195 /// up to 51 lowercase letters, numbers, and hyphens. It cannot end
3196 /// with a hyphen. The name of a deleted cluster can be reused.
3197 pub cluster_name: std::string::String,
3198
3199 /// Optional. The cluster config for a cluster of Compute Engine Instances.
3200 /// Note that Dataproc may set default values, and values may change
3201 /// when clusters are updated.
3202 ///
3203 /// Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
3204 pub config: std::option::Option<crate::model::ClusterConfig>,
3205
3206 /// Optional. The virtual cluster config is used when creating a Dataproc
3207 /// cluster that does not directly control the underlying compute resources,
3208 /// for example, when creating a [Dataproc-on-GKE
3209 /// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
3210 /// Dataproc may set default values, and values may change when
3211 /// clusters are updated. Exactly one of
3212 /// [config][google.cloud.dataproc.v1.Cluster.config] or
3213 /// [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config]
3214 /// must be specified.
3215 ///
3216 /// [google.cloud.dataproc.v1.Cluster.config]: crate::model::Cluster::config
3217 /// [google.cloud.dataproc.v1.Cluster.virtual_cluster_config]: crate::model::Cluster::virtual_cluster_config
3218 pub virtual_cluster_config: std::option::Option<crate::model::VirtualClusterConfig>,
3219
3220 /// Optional. The labels to associate with this cluster.
3221 /// Label **keys** must contain 1 to 63 characters, and must conform to
3222 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
3223 /// Label **values** may be empty, but, if present, must contain 1 to 63
3224 /// characters, and must conform to [RFC
3225 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
3226 /// associated with a cluster.
3227 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3228
3229 /// Output only. Cluster status.
3230 pub status: std::option::Option<crate::model::ClusterStatus>,
3231
3232 /// Output only. The previous cluster status.
3233 pub status_history: std::vec::Vec<crate::model::ClusterStatus>,
3234
3235 /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc
3236 /// generates this value when it creates the cluster.
3237 pub cluster_uuid: std::string::String,
3238
3239 /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.
3240 ///
3241 /// **Beta Feature**: This report is available for testing purposes only. It
3242 /// may be changed before final release.
3243 pub metrics: std::option::Option<crate::model::ClusterMetrics>,
3244
3245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3246}
3247
3248impl Cluster {
3249 /// Creates a new default instance.
3250 pub fn new() -> Self {
3251 std::default::Default::default()
3252 }
3253
3254 /// Sets the value of [project_id][crate::model::Cluster::project_id].
3255 ///
3256 /// # Example
3257 /// ```ignore,no_run
3258 /// # use google_cloud_dataproc_v1::model::Cluster;
3259 /// let x = Cluster::new().set_project_id("example");
3260 /// ```
3261 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3262 self.project_id = v.into();
3263 self
3264 }
3265
3266 /// Sets the value of [cluster_name][crate::model::Cluster::cluster_name].
3267 ///
3268 /// # Example
3269 /// ```ignore,no_run
3270 /// # use google_cloud_dataproc_v1::model::Cluster;
3271 /// let x = Cluster::new().set_cluster_name("example");
3272 /// ```
3273 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3274 self.cluster_name = v.into();
3275 self
3276 }
3277
3278 /// Sets the value of [config][crate::model::Cluster::config].
3279 ///
3280 /// # Example
3281 /// ```ignore,no_run
3282 /// # use google_cloud_dataproc_v1::model::Cluster;
3283 /// use google_cloud_dataproc_v1::model::ClusterConfig;
3284 /// let x = Cluster::new().set_config(ClusterConfig::default()/* use setters */);
3285 /// ```
3286 pub fn set_config<T>(mut self, v: T) -> Self
3287 where
3288 T: std::convert::Into<crate::model::ClusterConfig>,
3289 {
3290 self.config = std::option::Option::Some(v.into());
3291 self
3292 }
3293
3294 /// Sets or clears the value of [config][crate::model::Cluster::config].
3295 ///
3296 /// # Example
3297 /// ```ignore,no_run
3298 /// # use google_cloud_dataproc_v1::model::Cluster;
3299 /// use google_cloud_dataproc_v1::model::ClusterConfig;
3300 /// let x = Cluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
3301 /// let x = Cluster::new().set_or_clear_config(None::<ClusterConfig>);
3302 /// ```
3303 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
3304 where
3305 T: std::convert::Into<crate::model::ClusterConfig>,
3306 {
3307 self.config = v.map(|x| x.into());
3308 self
3309 }
3310
3311 /// Sets the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3312 ///
3313 /// # Example
3314 /// ```ignore,no_run
3315 /// # use google_cloud_dataproc_v1::model::Cluster;
3316 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3317 /// let x = Cluster::new().set_virtual_cluster_config(VirtualClusterConfig::default()/* use setters */);
3318 /// ```
3319 pub fn set_virtual_cluster_config<T>(mut self, v: T) -> Self
3320 where
3321 T: std::convert::Into<crate::model::VirtualClusterConfig>,
3322 {
3323 self.virtual_cluster_config = std::option::Option::Some(v.into());
3324 self
3325 }
3326
3327 /// Sets or clears the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3328 ///
3329 /// # Example
3330 /// ```ignore,no_run
3331 /// # use google_cloud_dataproc_v1::model::Cluster;
3332 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3333 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(Some(VirtualClusterConfig::default()/* use setters */));
3334 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(None::<VirtualClusterConfig>);
3335 /// ```
3336 pub fn set_or_clear_virtual_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3337 where
3338 T: std::convert::Into<crate::model::VirtualClusterConfig>,
3339 {
3340 self.virtual_cluster_config = v.map(|x| x.into());
3341 self
3342 }
3343
3344 /// Sets the value of [labels][crate::model::Cluster::labels].
3345 ///
3346 /// # Example
3347 /// ```ignore,no_run
3348 /// # use google_cloud_dataproc_v1::model::Cluster;
3349 /// let x = Cluster::new().set_labels([
3350 /// ("key0", "abc"),
3351 /// ("key1", "xyz"),
3352 /// ]);
3353 /// ```
3354 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3355 where
3356 T: std::iter::IntoIterator<Item = (K, V)>,
3357 K: std::convert::Into<std::string::String>,
3358 V: std::convert::Into<std::string::String>,
3359 {
3360 use std::iter::Iterator;
3361 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3362 self
3363 }
3364
3365 /// Sets the value of [status][crate::model::Cluster::status].
3366 ///
3367 /// # Example
3368 /// ```ignore,no_run
3369 /// # use google_cloud_dataproc_v1::model::Cluster;
3370 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3371 /// let x = Cluster::new().set_status(ClusterStatus::default()/* use setters */);
3372 /// ```
3373 pub fn set_status<T>(mut self, v: T) -> Self
3374 where
3375 T: std::convert::Into<crate::model::ClusterStatus>,
3376 {
3377 self.status = std::option::Option::Some(v.into());
3378 self
3379 }
3380
3381 /// Sets or clears the value of [status][crate::model::Cluster::status].
3382 ///
3383 /// # Example
3384 /// ```ignore,no_run
3385 /// # use google_cloud_dataproc_v1::model::Cluster;
3386 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3387 /// let x = Cluster::new().set_or_clear_status(Some(ClusterStatus::default()/* use setters */));
3388 /// let x = Cluster::new().set_or_clear_status(None::<ClusterStatus>);
3389 /// ```
3390 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
3391 where
3392 T: std::convert::Into<crate::model::ClusterStatus>,
3393 {
3394 self.status = v.map(|x| x.into());
3395 self
3396 }
3397
3398 /// Sets the value of [status_history][crate::model::Cluster::status_history].
3399 ///
3400 /// # Example
3401 /// ```ignore,no_run
3402 /// # use google_cloud_dataproc_v1::model::Cluster;
3403 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3404 /// let x = Cluster::new()
3405 /// .set_status_history([
3406 /// ClusterStatus::default()/* use setters */,
3407 /// ClusterStatus::default()/* use (different) setters */,
3408 /// ]);
3409 /// ```
3410 pub fn set_status_history<T, V>(mut self, v: T) -> Self
3411 where
3412 T: std::iter::IntoIterator<Item = V>,
3413 V: std::convert::Into<crate::model::ClusterStatus>,
3414 {
3415 use std::iter::Iterator;
3416 self.status_history = v.into_iter().map(|i| i.into()).collect();
3417 self
3418 }
3419
3420 /// Sets the value of [cluster_uuid][crate::model::Cluster::cluster_uuid].
3421 ///
3422 /// # Example
3423 /// ```ignore,no_run
3424 /// # use google_cloud_dataproc_v1::model::Cluster;
3425 /// let x = Cluster::new().set_cluster_uuid("example");
3426 /// ```
3427 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3428 self.cluster_uuid = v.into();
3429 self
3430 }
3431
3432 /// Sets the value of [metrics][crate::model::Cluster::metrics].
3433 ///
3434 /// # Example
3435 /// ```ignore,no_run
3436 /// # use google_cloud_dataproc_v1::model::Cluster;
3437 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3438 /// let x = Cluster::new().set_metrics(ClusterMetrics::default()/* use setters */);
3439 /// ```
3440 pub fn set_metrics<T>(mut self, v: T) -> Self
3441 where
3442 T: std::convert::Into<crate::model::ClusterMetrics>,
3443 {
3444 self.metrics = std::option::Option::Some(v.into());
3445 self
3446 }
3447
3448 /// Sets or clears the value of [metrics][crate::model::Cluster::metrics].
3449 ///
3450 /// # Example
3451 /// ```ignore,no_run
3452 /// # use google_cloud_dataproc_v1::model::Cluster;
3453 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3454 /// let x = Cluster::new().set_or_clear_metrics(Some(ClusterMetrics::default()/* use setters */));
3455 /// let x = Cluster::new().set_or_clear_metrics(None::<ClusterMetrics>);
3456 /// ```
3457 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
3458 where
3459 T: std::convert::Into<crate::model::ClusterMetrics>,
3460 {
3461 self.metrics = v.map(|x| x.into());
3462 self
3463 }
3464}
3465
3466impl wkt::message::Message for Cluster {
3467 fn typename() -> &'static str {
3468 "type.googleapis.com/google.cloud.dataproc.v1.Cluster"
3469 }
3470}
3471
3472/// The cluster config.
3473#[derive(Clone, Default, PartialEq)]
3474#[non_exhaustive]
3475pub struct ClusterConfig {
3476 /// Optional. The type of the cluster.
3477 pub cluster_type: crate::model::cluster_config::ClusterType,
3478
3479 /// Optional. The cluster tier.
3480 pub cluster_tier: crate::model::cluster_config::ClusterTier,
3481
3482 /// Optional. The cluster engine.
3483 pub engine: crate::model::cluster_config::Engine,
3484
3485 /// Optional. A Cloud Storage bucket used to stage job
3486 /// dependencies, config files, and job driver console output.
3487 /// If you do not specify a staging bucket, Cloud
3488 /// Dataproc will determine a Cloud Storage location (US,
3489 /// ASIA, or EU) for your cluster's staging bucket according to the
3490 /// Compute Engine zone where your cluster is deployed, and then create
3491 /// and manage this project-level, per-location bucket (see
3492 /// [Dataproc staging and temp
3493 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3494 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3495 /// a Cloud Storage bucket.**
3496 pub config_bucket: std::string::String,
3497
3498 /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs
3499 /// data, such as Spark and MapReduce history files. If you do not specify a
3500 /// temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or
3501 /// EU) for your cluster's temp bucket according to the Compute Engine zone
3502 /// where your cluster is deployed, and then create and manage this
3503 /// project-level, per-location bucket. The default bucket has a TTL of 90
3504 /// days, but you can use any TTL (or none) if you specify a bucket (see
3505 /// [Dataproc staging and temp
3506 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3507 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3508 /// a Cloud Storage bucket.**
3509 pub temp_bucket: std::string::String,
3510
3511 /// Optional. The shared Compute Engine config settings for
3512 /// all instances in a cluster.
3513 pub gce_cluster_config: std::option::Option<crate::model::GceClusterConfig>,
3514
3515 /// Optional. The Compute Engine config settings for
3516 /// the cluster's master instance.
3517 pub master_config: std::option::Option<crate::model::InstanceGroupConfig>,
3518
3519 /// Optional. The Compute Engine config settings for
3520 /// the cluster's worker instances.
3521 pub worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3522
3523 /// Optional. The Compute Engine config settings for
3524 /// a cluster's secondary worker instances
3525 pub secondary_worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3526
3527 /// Optional. The config settings for cluster software.
3528 pub software_config: std::option::Option<crate::model::SoftwareConfig>,
3529
3530 /// Optional. Commands to execute on each node after config is
3531 /// completed. By default, executables are run on master and all worker nodes.
3532 /// You can test a node's `role` metadata to run an executable on
3533 /// a master or worker node, as shown below using `curl` (you can also use
3534 /// `wget`):
3535 ///
3536 /// ```norust
3537 /// ROLE=$(curl -H Metadata-Flavor:Google
3538 /// http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
3539 /// if [[ "${ROLE}" == 'Master' ]]; then
3540 /// ... master specific actions ...
3541 /// else
3542 /// ... worker specific actions ...
3543 /// fi
3544 /// ```
3545 pub initialization_actions: std::vec::Vec<crate::model::NodeInitializationAction>,
3546
3547 /// Optional. Encryption settings for the cluster.
3548 pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
3549
3550 /// Optional. Autoscaling config for the policy associated with the cluster.
3551 /// Cluster does not autoscale if this field is unset.
3552 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
3553
3554 /// Optional. Security settings for the cluster.
3555 pub security_config: std::option::Option<crate::model::SecurityConfig>,
3556
3557 /// Optional. Lifecycle setting for the cluster.
3558 pub lifecycle_config: std::option::Option<crate::model::LifecycleConfig>,
3559
3560 /// Optional. Port/endpoint configuration for this cluster
3561 pub endpoint_config: std::option::Option<crate::model::EndpointConfig>,
3562
3563 /// Optional. Metastore configuration.
3564 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3565
3566 /// Optional. The config for Dataproc metrics.
3567 pub dataproc_metric_config: std::option::Option<crate::model::DataprocMetricConfig>,
3568
3569 /// Optional. The node group settings.
3570 pub auxiliary_node_groups: std::vec::Vec<crate::model::AuxiliaryNodeGroup>,
3571
3572 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3573}
3574
3575impl ClusterConfig {
3576 /// Creates a new default instance.
3577 pub fn new() -> Self {
3578 std::default::Default::default()
3579 }
3580
3581 /// Sets the value of [cluster_type][crate::model::ClusterConfig::cluster_type].
3582 ///
3583 /// # Example
3584 /// ```ignore,no_run
3585 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3586 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterType;
3587 /// let x0 = ClusterConfig::new().set_cluster_type(ClusterType::Standard);
3588 /// let x1 = ClusterConfig::new().set_cluster_type(ClusterType::SingleNode);
3589 /// let x2 = ClusterConfig::new().set_cluster_type(ClusterType::ZeroScale);
3590 /// ```
3591 pub fn set_cluster_type<T: std::convert::Into<crate::model::cluster_config::ClusterType>>(
3592 mut self,
3593 v: T,
3594 ) -> Self {
3595 self.cluster_type = v.into();
3596 self
3597 }
3598
3599 /// Sets the value of [cluster_tier][crate::model::ClusterConfig::cluster_tier].
3600 ///
3601 /// # Example
3602 /// ```ignore,no_run
3603 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3604 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterTier;
3605 /// let x0 = ClusterConfig::new().set_cluster_tier(ClusterTier::Standard);
3606 /// let x1 = ClusterConfig::new().set_cluster_tier(ClusterTier::Premium);
3607 /// ```
3608 pub fn set_cluster_tier<T: std::convert::Into<crate::model::cluster_config::ClusterTier>>(
3609 mut self,
3610 v: T,
3611 ) -> Self {
3612 self.cluster_tier = v.into();
3613 self
3614 }
3615
3616 /// Sets the value of [engine][crate::model::ClusterConfig::engine].
3617 ///
3618 /// # Example
3619 /// ```ignore,no_run
3620 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3621 /// use google_cloud_dataproc_v1::model::cluster_config::Engine;
3622 /// let x0 = ClusterConfig::new().set_engine(Engine::Default);
3623 /// let x1 = ClusterConfig::new().set_engine(Engine::Lightning);
3624 /// ```
3625 pub fn set_engine<T: std::convert::Into<crate::model::cluster_config::Engine>>(
3626 mut self,
3627 v: T,
3628 ) -> Self {
3629 self.engine = v.into();
3630 self
3631 }
3632
3633 /// Sets the value of [config_bucket][crate::model::ClusterConfig::config_bucket].
3634 ///
3635 /// # Example
3636 /// ```ignore,no_run
3637 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3638 /// let x = ClusterConfig::new().set_config_bucket("example");
3639 /// ```
3640 pub fn set_config_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3641 self.config_bucket = v.into();
3642 self
3643 }
3644
3645 /// Sets the value of [temp_bucket][crate::model::ClusterConfig::temp_bucket].
3646 ///
3647 /// # Example
3648 /// ```ignore,no_run
3649 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3650 /// let x = ClusterConfig::new().set_temp_bucket("example");
3651 /// ```
3652 pub fn set_temp_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3653 self.temp_bucket = v.into();
3654 self
3655 }
3656
3657 /// Sets the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3658 ///
3659 /// # Example
3660 /// ```ignore,no_run
3661 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3662 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3663 /// let x = ClusterConfig::new().set_gce_cluster_config(GceClusterConfig::default()/* use setters */);
3664 /// ```
3665 pub fn set_gce_cluster_config<T>(mut self, v: T) -> Self
3666 where
3667 T: std::convert::Into<crate::model::GceClusterConfig>,
3668 {
3669 self.gce_cluster_config = std::option::Option::Some(v.into());
3670 self
3671 }
3672
3673 /// Sets or clears the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3674 ///
3675 /// # Example
3676 /// ```ignore,no_run
3677 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3678 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3679 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(Some(GceClusterConfig::default()/* use setters */));
3680 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(None::<GceClusterConfig>);
3681 /// ```
3682 pub fn set_or_clear_gce_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3683 where
3684 T: std::convert::Into<crate::model::GceClusterConfig>,
3685 {
3686 self.gce_cluster_config = v.map(|x| x.into());
3687 self
3688 }
3689
3690 /// Sets the value of [master_config][crate::model::ClusterConfig::master_config].
3691 ///
3692 /// # Example
3693 /// ```ignore,no_run
3694 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3695 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3696 /// let x = ClusterConfig::new().set_master_config(InstanceGroupConfig::default()/* use setters */);
3697 /// ```
3698 pub fn set_master_config<T>(mut self, v: T) -> Self
3699 where
3700 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3701 {
3702 self.master_config = std::option::Option::Some(v.into());
3703 self
3704 }
3705
3706 /// Sets or clears the value of [master_config][crate::model::ClusterConfig::master_config].
3707 ///
3708 /// # Example
3709 /// ```ignore,no_run
3710 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3711 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3712 /// let x = ClusterConfig::new().set_or_clear_master_config(Some(InstanceGroupConfig::default()/* use setters */));
3713 /// let x = ClusterConfig::new().set_or_clear_master_config(None::<InstanceGroupConfig>);
3714 /// ```
3715 pub fn set_or_clear_master_config<T>(mut self, v: std::option::Option<T>) -> Self
3716 where
3717 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3718 {
3719 self.master_config = v.map(|x| x.into());
3720 self
3721 }
3722
3723 /// Sets the value of [worker_config][crate::model::ClusterConfig::worker_config].
3724 ///
3725 /// # Example
3726 /// ```ignore,no_run
3727 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3728 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3729 /// let x = ClusterConfig::new().set_worker_config(InstanceGroupConfig::default()/* use setters */);
3730 /// ```
3731 pub fn set_worker_config<T>(mut self, v: T) -> Self
3732 where
3733 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3734 {
3735 self.worker_config = std::option::Option::Some(v.into());
3736 self
3737 }
3738
3739 /// Sets or clears the value of [worker_config][crate::model::ClusterConfig::worker_config].
3740 ///
3741 /// # Example
3742 /// ```ignore,no_run
3743 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3744 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3745 /// let x = ClusterConfig::new().set_or_clear_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3746 /// let x = ClusterConfig::new().set_or_clear_worker_config(None::<InstanceGroupConfig>);
3747 /// ```
3748 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3749 where
3750 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3751 {
3752 self.worker_config = v.map(|x| x.into());
3753 self
3754 }
3755
3756 /// Sets the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3757 ///
3758 /// # Example
3759 /// ```ignore,no_run
3760 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3761 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3762 /// let x = ClusterConfig::new().set_secondary_worker_config(InstanceGroupConfig::default()/* use setters */);
3763 /// ```
3764 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
3765 where
3766 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3767 {
3768 self.secondary_worker_config = std::option::Option::Some(v.into());
3769 self
3770 }
3771
3772 /// Sets or clears the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3773 ///
3774 /// # Example
3775 /// ```ignore,no_run
3776 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3777 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3778 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3779 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(None::<InstanceGroupConfig>);
3780 /// ```
3781 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3782 where
3783 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3784 {
3785 self.secondary_worker_config = v.map(|x| x.into());
3786 self
3787 }
3788
3789 /// Sets the value of [software_config][crate::model::ClusterConfig::software_config].
3790 ///
3791 /// # Example
3792 /// ```ignore,no_run
3793 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3794 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3795 /// let x = ClusterConfig::new().set_software_config(SoftwareConfig::default()/* use setters */);
3796 /// ```
3797 pub fn set_software_config<T>(mut self, v: T) -> Self
3798 where
3799 T: std::convert::Into<crate::model::SoftwareConfig>,
3800 {
3801 self.software_config = std::option::Option::Some(v.into());
3802 self
3803 }
3804
3805 /// Sets or clears the value of [software_config][crate::model::ClusterConfig::software_config].
3806 ///
3807 /// # Example
3808 /// ```ignore,no_run
3809 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3810 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3811 /// let x = ClusterConfig::new().set_or_clear_software_config(Some(SoftwareConfig::default()/* use setters */));
3812 /// let x = ClusterConfig::new().set_or_clear_software_config(None::<SoftwareConfig>);
3813 /// ```
3814 pub fn set_or_clear_software_config<T>(mut self, v: std::option::Option<T>) -> Self
3815 where
3816 T: std::convert::Into<crate::model::SoftwareConfig>,
3817 {
3818 self.software_config = v.map(|x| x.into());
3819 self
3820 }
3821
3822 /// Sets the value of [initialization_actions][crate::model::ClusterConfig::initialization_actions].
3823 ///
3824 /// # Example
3825 /// ```ignore,no_run
3826 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3827 /// use google_cloud_dataproc_v1::model::NodeInitializationAction;
3828 /// let x = ClusterConfig::new()
3829 /// .set_initialization_actions([
3830 /// NodeInitializationAction::default()/* use setters */,
3831 /// NodeInitializationAction::default()/* use (different) setters */,
3832 /// ]);
3833 /// ```
3834 pub fn set_initialization_actions<T, V>(mut self, v: T) -> Self
3835 where
3836 T: std::iter::IntoIterator<Item = V>,
3837 V: std::convert::Into<crate::model::NodeInitializationAction>,
3838 {
3839 use std::iter::Iterator;
3840 self.initialization_actions = v.into_iter().map(|i| i.into()).collect();
3841 self
3842 }
3843
3844 /// Sets the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3845 ///
3846 /// # Example
3847 /// ```ignore,no_run
3848 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3849 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3850 /// let x = ClusterConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3851 /// ```
3852 pub fn set_encryption_config<T>(mut self, v: T) -> Self
3853 where
3854 T: std::convert::Into<crate::model::EncryptionConfig>,
3855 {
3856 self.encryption_config = std::option::Option::Some(v.into());
3857 self
3858 }
3859
3860 /// Sets or clears the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3861 ///
3862 /// # Example
3863 /// ```ignore,no_run
3864 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3865 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3866 /// let x = ClusterConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3867 /// let x = ClusterConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3868 /// ```
3869 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3870 where
3871 T: std::convert::Into<crate::model::EncryptionConfig>,
3872 {
3873 self.encryption_config = v.map(|x| x.into());
3874 self
3875 }
3876
3877 /// Sets the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3878 ///
3879 /// # Example
3880 /// ```ignore,no_run
3881 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3882 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3883 /// let x = ClusterConfig::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
3884 /// ```
3885 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
3886 where
3887 T: std::convert::Into<crate::model::AutoscalingConfig>,
3888 {
3889 self.autoscaling_config = std::option::Option::Some(v.into());
3890 self
3891 }
3892
3893 /// Sets or clears the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3894 ///
3895 /// # Example
3896 /// ```ignore,no_run
3897 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3898 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3899 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
3900 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
3901 /// ```
3902 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
3903 where
3904 T: std::convert::Into<crate::model::AutoscalingConfig>,
3905 {
3906 self.autoscaling_config = v.map(|x| x.into());
3907 self
3908 }
3909
3910 /// Sets the value of [security_config][crate::model::ClusterConfig::security_config].
3911 ///
3912 /// # Example
3913 /// ```ignore,no_run
3914 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3915 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3916 /// let x = ClusterConfig::new().set_security_config(SecurityConfig::default()/* use setters */);
3917 /// ```
3918 pub fn set_security_config<T>(mut self, v: T) -> Self
3919 where
3920 T: std::convert::Into<crate::model::SecurityConfig>,
3921 {
3922 self.security_config = std::option::Option::Some(v.into());
3923 self
3924 }
3925
3926 /// Sets or clears the value of [security_config][crate::model::ClusterConfig::security_config].
3927 ///
3928 /// # Example
3929 /// ```ignore,no_run
3930 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3931 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3932 /// let x = ClusterConfig::new().set_or_clear_security_config(Some(SecurityConfig::default()/* use setters */));
3933 /// let x = ClusterConfig::new().set_or_clear_security_config(None::<SecurityConfig>);
3934 /// ```
3935 pub fn set_or_clear_security_config<T>(mut self, v: std::option::Option<T>) -> Self
3936 where
3937 T: std::convert::Into<crate::model::SecurityConfig>,
3938 {
3939 self.security_config = v.map(|x| x.into());
3940 self
3941 }
3942
3943 /// Sets the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3944 ///
3945 /// # Example
3946 /// ```ignore,no_run
3947 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3948 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3949 /// let x = ClusterConfig::new().set_lifecycle_config(LifecycleConfig::default()/* use setters */);
3950 /// ```
3951 pub fn set_lifecycle_config<T>(mut self, v: T) -> Self
3952 where
3953 T: std::convert::Into<crate::model::LifecycleConfig>,
3954 {
3955 self.lifecycle_config = std::option::Option::Some(v.into());
3956 self
3957 }
3958
3959 /// Sets or clears the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3960 ///
3961 /// # Example
3962 /// ```ignore,no_run
3963 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3964 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3965 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(Some(LifecycleConfig::default()/* use setters */));
3966 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(None::<LifecycleConfig>);
3967 /// ```
3968 pub fn set_or_clear_lifecycle_config<T>(mut self, v: std::option::Option<T>) -> Self
3969 where
3970 T: std::convert::Into<crate::model::LifecycleConfig>,
3971 {
3972 self.lifecycle_config = v.map(|x| x.into());
3973 self
3974 }
3975
3976 /// Sets the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3977 ///
3978 /// # Example
3979 /// ```ignore,no_run
3980 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3981 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3982 /// let x = ClusterConfig::new().set_endpoint_config(EndpointConfig::default()/* use setters */);
3983 /// ```
3984 pub fn set_endpoint_config<T>(mut self, v: T) -> Self
3985 where
3986 T: std::convert::Into<crate::model::EndpointConfig>,
3987 {
3988 self.endpoint_config = std::option::Option::Some(v.into());
3989 self
3990 }
3991
3992 /// Sets or clears the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3993 ///
3994 /// # Example
3995 /// ```ignore,no_run
3996 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3997 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3998 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(Some(EndpointConfig::default()/* use setters */));
3999 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(None::<EndpointConfig>);
4000 /// ```
4001 pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
4002 where
4003 T: std::convert::Into<crate::model::EndpointConfig>,
4004 {
4005 self.endpoint_config = v.map(|x| x.into());
4006 self
4007 }
4008
4009 /// Sets the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
4010 ///
4011 /// # Example
4012 /// ```ignore,no_run
4013 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4014 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4015 /// let x = ClusterConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
4016 /// ```
4017 pub fn set_metastore_config<T>(mut self, v: T) -> Self
4018 where
4019 T: std::convert::Into<crate::model::MetastoreConfig>,
4020 {
4021 self.metastore_config = std::option::Option::Some(v.into());
4022 self
4023 }
4024
4025 /// Sets or clears the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
4026 ///
4027 /// # Example
4028 /// ```ignore,no_run
4029 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4030 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4031 /// let x = ClusterConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4032 /// let x = ClusterConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4033 /// ```
4034 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4035 where
4036 T: std::convert::Into<crate::model::MetastoreConfig>,
4037 {
4038 self.metastore_config = v.map(|x| x.into());
4039 self
4040 }
4041
4042 /// Sets the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
4043 ///
4044 /// # Example
4045 /// ```ignore,no_run
4046 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4047 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
4048 /// let x = ClusterConfig::new().set_dataproc_metric_config(DataprocMetricConfig::default()/* use setters */);
4049 /// ```
4050 pub fn set_dataproc_metric_config<T>(mut self, v: T) -> Self
4051 where
4052 T: std::convert::Into<crate::model::DataprocMetricConfig>,
4053 {
4054 self.dataproc_metric_config = std::option::Option::Some(v.into());
4055 self
4056 }
4057
4058 /// Sets or clears the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
4059 ///
4060 /// # Example
4061 /// ```ignore,no_run
4062 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4063 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
4064 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(Some(DataprocMetricConfig::default()/* use setters */));
4065 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(None::<DataprocMetricConfig>);
4066 /// ```
4067 pub fn set_or_clear_dataproc_metric_config<T>(mut self, v: std::option::Option<T>) -> Self
4068 where
4069 T: std::convert::Into<crate::model::DataprocMetricConfig>,
4070 {
4071 self.dataproc_metric_config = v.map(|x| x.into());
4072 self
4073 }
4074
4075 /// Sets the value of [auxiliary_node_groups][crate::model::ClusterConfig::auxiliary_node_groups].
4076 ///
4077 /// # Example
4078 /// ```ignore,no_run
4079 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
4080 /// use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
4081 /// let x = ClusterConfig::new()
4082 /// .set_auxiliary_node_groups([
4083 /// AuxiliaryNodeGroup::default()/* use setters */,
4084 /// AuxiliaryNodeGroup::default()/* use (different) setters */,
4085 /// ]);
4086 /// ```
4087 pub fn set_auxiliary_node_groups<T, V>(mut self, v: T) -> Self
4088 where
4089 T: std::iter::IntoIterator<Item = V>,
4090 V: std::convert::Into<crate::model::AuxiliaryNodeGroup>,
4091 {
4092 use std::iter::Iterator;
4093 self.auxiliary_node_groups = v.into_iter().map(|i| i.into()).collect();
4094 self
4095 }
4096}
4097
4098impl wkt::message::Message for ClusterConfig {
4099 fn typename() -> &'static str {
4100 "type.googleapis.com/google.cloud.dataproc.v1.ClusterConfig"
4101 }
4102}
4103
4104/// Defines additional types related to [ClusterConfig].
4105pub mod cluster_config {
4106 #[allow(unused_imports)]
4107 use super::*;
4108
4109 /// The type of the cluster.
4110 ///
4111 /// # Working with unknown values
4112 ///
4113 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4114 /// additional enum variants at any time. Adding new variants is not considered
4115 /// a breaking change. Applications should write their code in anticipation of:
4116 ///
4117 /// - New values appearing in future releases of the client library, **and**
4118 /// - New values received dynamically, without application changes.
4119 ///
4120 /// Please consult the [Working with enums] section in the user guide for some
4121 /// guidelines.
4122 ///
4123 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4124 #[derive(Clone, Debug, PartialEq)]
4125 #[non_exhaustive]
4126 pub enum ClusterType {
4127 /// Not set.
4128 Unspecified,
4129 /// Standard dataproc cluster with a minimum of two primary workers.
4130 Standard,
4131 /// <https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/single-node-clusters>
4132 SingleNode,
4133 /// Clusters that can use only secondary workers and be scaled down to zero
4134 /// secondary worker nodes.
4135 ZeroScale,
4136 /// If set, the enum was initialized with an unknown value.
4137 ///
4138 /// Applications can examine the value using [ClusterType::value] or
4139 /// [ClusterType::name].
4140 UnknownValue(cluster_type::UnknownValue),
4141 }
4142
4143 #[doc(hidden)]
4144 pub mod cluster_type {
4145 #[allow(unused_imports)]
4146 use super::*;
4147 #[derive(Clone, Debug, PartialEq)]
4148 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4149 }
4150
4151 impl ClusterType {
4152 /// Gets the enum value.
4153 ///
4154 /// Returns `None` if the enum contains an unknown value deserialized from
4155 /// the string representation of enums.
4156 pub fn value(&self) -> std::option::Option<i32> {
4157 match self {
4158 Self::Unspecified => std::option::Option::Some(0),
4159 Self::Standard => std::option::Option::Some(1),
4160 Self::SingleNode => std::option::Option::Some(2),
4161 Self::ZeroScale => std::option::Option::Some(3),
4162 Self::UnknownValue(u) => u.0.value(),
4163 }
4164 }
4165
4166 /// Gets the enum value as a string.
4167 ///
4168 /// Returns `None` if the enum contains an unknown value deserialized from
4169 /// the integer representation of enums.
4170 pub fn name(&self) -> std::option::Option<&str> {
4171 match self {
4172 Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
4173 Self::Standard => std::option::Option::Some("STANDARD"),
4174 Self::SingleNode => std::option::Option::Some("SINGLE_NODE"),
4175 Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
4176 Self::UnknownValue(u) => u.0.name(),
4177 }
4178 }
4179 }
4180
4181 impl std::default::Default for ClusterType {
4182 fn default() -> Self {
4183 use std::convert::From;
4184 Self::from(0)
4185 }
4186 }
4187
4188 impl std::fmt::Display for ClusterType {
4189 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4190 wkt::internal::display_enum(f, self.name(), self.value())
4191 }
4192 }
4193
4194 impl std::convert::From<i32> for ClusterType {
4195 fn from(value: i32) -> Self {
4196 match value {
4197 0 => Self::Unspecified,
4198 1 => Self::Standard,
4199 2 => Self::SingleNode,
4200 3 => Self::ZeroScale,
4201 _ => Self::UnknownValue(cluster_type::UnknownValue(
4202 wkt::internal::UnknownEnumValue::Integer(value),
4203 )),
4204 }
4205 }
4206 }
4207
4208 impl std::convert::From<&str> for ClusterType {
4209 fn from(value: &str) -> Self {
4210 use std::string::ToString;
4211 match value {
4212 "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
4213 "STANDARD" => Self::Standard,
4214 "SINGLE_NODE" => Self::SingleNode,
4215 "ZERO_SCALE" => Self::ZeroScale,
4216 _ => Self::UnknownValue(cluster_type::UnknownValue(
4217 wkt::internal::UnknownEnumValue::String(value.to_string()),
4218 )),
4219 }
4220 }
4221 }
4222
4223 impl serde::ser::Serialize for ClusterType {
4224 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4225 where
4226 S: serde::Serializer,
4227 {
4228 match self {
4229 Self::Unspecified => serializer.serialize_i32(0),
4230 Self::Standard => serializer.serialize_i32(1),
4231 Self::SingleNode => serializer.serialize_i32(2),
4232 Self::ZeroScale => serializer.serialize_i32(3),
4233 Self::UnknownValue(u) => u.0.serialize(serializer),
4234 }
4235 }
4236 }
4237
4238 impl<'de> serde::de::Deserialize<'de> for ClusterType {
4239 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4240 where
4241 D: serde::Deserializer<'de>,
4242 {
4243 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
4244 ".google.cloud.dataproc.v1.ClusterConfig.ClusterType",
4245 ))
4246 }
4247 }
4248
4249 /// The cluster tier.
4250 ///
4251 /// # Working with unknown values
4252 ///
4253 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4254 /// additional enum variants at any time. Adding new variants is not considered
4255 /// a breaking change. Applications should write their code in anticipation of:
4256 ///
4257 /// - New values appearing in future releases of the client library, **and**
4258 /// - New values received dynamically, without application changes.
4259 ///
4260 /// Please consult the [Working with enums] section in the user guide for some
4261 /// guidelines.
4262 ///
4263 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4264 #[derive(Clone, Debug, PartialEq)]
4265 #[non_exhaustive]
4266 pub enum ClusterTier {
4267 /// Not set. Works the same as CLUSTER_TIER_STANDARD.
4268 Unspecified,
4269 /// Standard Dataproc cluster.
4270 Standard,
4271 /// Premium Dataproc cluster.
4272 Premium,
4273 /// If set, the enum was initialized with an unknown value.
4274 ///
4275 /// Applications can examine the value using [ClusterTier::value] or
4276 /// [ClusterTier::name].
4277 UnknownValue(cluster_tier::UnknownValue),
4278 }
4279
4280 #[doc(hidden)]
4281 pub mod cluster_tier {
4282 #[allow(unused_imports)]
4283 use super::*;
4284 #[derive(Clone, Debug, PartialEq)]
4285 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4286 }
4287
4288 impl ClusterTier {
4289 /// Gets the enum value.
4290 ///
4291 /// Returns `None` if the enum contains an unknown value deserialized from
4292 /// the string representation of enums.
4293 pub fn value(&self) -> std::option::Option<i32> {
4294 match self {
4295 Self::Unspecified => std::option::Option::Some(0),
4296 Self::Standard => std::option::Option::Some(1),
4297 Self::Premium => std::option::Option::Some(2),
4298 Self::UnknownValue(u) => u.0.value(),
4299 }
4300 }
4301
4302 /// Gets the enum value as a string.
4303 ///
4304 /// Returns `None` if the enum contains an unknown value deserialized from
4305 /// the integer representation of enums.
4306 pub fn name(&self) -> std::option::Option<&str> {
4307 match self {
4308 Self::Unspecified => std::option::Option::Some("CLUSTER_TIER_UNSPECIFIED"),
4309 Self::Standard => std::option::Option::Some("CLUSTER_TIER_STANDARD"),
4310 Self::Premium => std::option::Option::Some("CLUSTER_TIER_PREMIUM"),
4311 Self::UnknownValue(u) => u.0.name(),
4312 }
4313 }
4314 }
4315
4316 impl std::default::Default for ClusterTier {
4317 fn default() -> Self {
4318 use std::convert::From;
4319 Self::from(0)
4320 }
4321 }
4322
4323 impl std::fmt::Display for ClusterTier {
4324 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4325 wkt::internal::display_enum(f, self.name(), self.value())
4326 }
4327 }
4328
4329 impl std::convert::From<i32> for ClusterTier {
4330 fn from(value: i32) -> Self {
4331 match value {
4332 0 => Self::Unspecified,
4333 1 => Self::Standard,
4334 2 => Self::Premium,
4335 _ => Self::UnknownValue(cluster_tier::UnknownValue(
4336 wkt::internal::UnknownEnumValue::Integer(value),
4337 )),
4338 }
4339 }
4340 }
4341
4342 impl std::convert::From<&str> for ClusterTier {
4343 fn from(value: &str) -> Self {
4344 use std::string::ToString;
4345 match value {
4346 "CLUSTER_TIER_UNSPECIFIED" => Self::Unspecified,
4347 "CLUSTER_TIER_STANDARD" => Self::Standard,
4348 "CLUSTER_TIER_PREMIUM" => Self::Premium,
4349 _ => Self::UnknownValue(cluster_tier::UnknownValue(
4350 wkt::internal::UnknownEnumValue::String(value.to_string()),
4351 )),
4352 }
4353 }
4354 }
4355
4356 impl serde::ser::Serialize for ClusterTier {
4357 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4358 where
4359 S: serde::Serializer,
4360 {
4361 match self {
4362 Self::Unspecified => serializer.serialize_i32(0),
4363 Self::Standard => serializer.serialize_i32(1),
4364 Self::Premium => serializer.serialize_i32(2),
4365 Self::UnknownValue(u) => u.0.serialize(serializer),
4366 }
4367 }
4368 }
4369
4370 impl<'de> serde::de::Deserialize<'de> for ClusterTier {
4371 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4372 where
4373 D: serde::Deserializer<'de>,
4374 {
4375 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterTier>::new(
4376 ".google.cloud.dataproc.v1.ClusterConfig.ClusterTier",
4377 ))
4378 }
4379 }
4380
4381 /// The cluster engine.
4382 ///
4383 /// # Working with unknown values
4384 ///
4385 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4386 /// additional enum variants at any time. Adding new variants is not considered
4387 /// a breaking change. Applications should write their code in anticipation of:
4388 ///
4389 /// - New values appearing in future releases of the client library, **and**
4390 /// - New values received dynamically, without application changes.
4391 ///
4392 /// Please consult the [Working with enums] section in the user guide for some
4393 /// guidelines.
4394 ///
4395 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4396 #[derive(Clone, Debug, PartialEq)]
4397 #[non_exhaustive]
4398 pub enum Engine {
4399 /// The engine is not specified. Works the same as ENGINE_DEFAULT.
4400 Unspecified,
4401 /// The cluster is a default engine cluster.
4402 Default,
4403 /// The cluster is a lightning engine cluster.
4404 Lightning,
4405 /// If set, the enum was initialized with an unknown value.
4406 ///
4407 /// Applications can examine the value using [Engine::value] or
4408 /// [Engine::name].
4409 UnknownValue(engine::UnknownValue),
4410 }
4411
4412 #[doc(hidden)]
4413 pub mod engine {
4414 #[allow(unused_imports)]
4415 use super::*;
4416 #[derive(Clone, Debug, PartialEq)]
4417 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4418 }
4419
4420 impl Engine {
4421 /// Gets the enum value.
4422 ///
4423 /// Returns `None` if the enum contains an unknown value deserialized from
4424 /// the string representation of enums.
4425 pub fn value(&self) -> std::option::Option<i32> {
4426 match self {
4427 Self::Unspecified => std::option::Option::Some(0),
4428 Self::Default => std::option::Option::Some(1),
4429 Self::Lightning => std::option::Option::Some(2),
4430 Self::UnknownValue(u) => u.0.value(),
4431 }
4432 }
4433
4434 /// Gets the enum value as a string.
4435 ///
4436 /// Returns `None` if the enum contains an unknown value deserialized from
4437 /// the integer representation of enums.
4438 pub fn name(&self) -> std::option::Option<&str> {
4439 match self {
4440 Self::Unspecified => std::option::Option::Some("ENGINE_UNSPECIFIED"),
4441 Self::Default => std::option::Option::Some("DEFAULT"),
4442 Self::Lightning => std::option::Option::Some("LIGHTNING"),
4443 Self::UnknownValue(u) => u.0.name(),
4444 }
4445 }
4446 }
4447
4448 impl std::default::Default for Engine {
4449 fn default() -> Self {
4450 use std::convert::From;
4451 Self::from(0)
4452 }
4453 }
4454
4455 impl std::fmt::Display for Engine {
4456 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4457 wkt::internal::display_enum(f, self.name(), self.value())
4458 }
4459 }
4460
4461 impl std::convert::From<i32> for Engine {
4462 fn from(value: i32) -> Self {
4463 match value {
4464 0 => Self::Unspecified,
4465 1 => Self::Default,
4466 2 => Self::Lightning,
4467 _ => Self::UnknownValue(engine::UnknownValue(
4468 wkt::internal::UnknownEnumValue::Integer(value),
4469 )),
4470 }
4471 }
4472 }
4473
4474 impl std::convert::From<&str> for Engine {
4475 fn from(value: &str) -> Self {
4476 use std::string::ToString;
4477 match value {
4478 "ENGINE_UNSPECIFIED" => Self::Unspecified,
4479 "DEFAULT" => Self::Default,
4480 "LIGHTNING" => Self::Lightning,
4481 _ => Self::UnknownValue(engine::UnknownValue(
4482 wkt::internal::UnknownEnumValue::String(value.to_string()),
4483 )),
4484 }
4485 }
4486 }
4487
4488 impl serde::ser::Serialize for Engine {
4489 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4490 where
4491 S: serde::Serializer,
4492 {
4493 match self {
4494 Self::Unspecified => serializer.serialize_i32(0),
4495 Self::Default => serializer.serialize_i32(1),
4496 Self::Lightning => serializer.serialize_i32(2),
4497 Self::UnknownValue(u) => u.0.serialize(serializer),
4498 }
4499 }
4500 }
4501
4502 impl<'de> serde::de::Deserialize<'de> for Engine {
4503 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4504 where
4505 D: serde::Deserializer<'de>,
4506 {
4507 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Engine>::new(
4508 ".google.cloud.dataproc.v1.ClusterConfig.Engine",
4509 ))
4510 }
4511 }
4512}
4513
4514/// The Dataproc cluster config for a cluster that does not directly control the
4515/// underlying compute resources, such as a [Dataproc-on-GKE
4516/// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
4517#[derive(Clone, Default, PartialEq)]
4518#[non_exhaustive]
4519pub struct VirtualClusterConfig {
4520 /// Optional. A Cloud Storage bucket used to stage job
4521 /// dependencies, config files, and job driver console output.
4522 /// If you do not specify a staging bucket, Cloud
4523 /// Dataproc will determine a Cloud Storage location (US,
4524 /// ASIA, or EU) for your cluster's staging bucket according to the
4525 /// Compute Engine zone where your cluster is deployed, and then create
4526 /// and manage this project-level, per-location bucket (see
4527 /// [Dataproc staging and temp
4528 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
4529 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
4530 /// a Cloud Storage bucket.**
4531 pub staging_bucket: std::string::String,
4532
4533 /// Optional. Configuration of auxiliary services used by this cluster.
4534 pub auxiliary_services_config: std::option::Option<crate::model::AuxiliaryServicesConfig>,
4535
4536 #[allow(missing_docs)]
4537 pub infrastructure_config:
4538 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4539
4540 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4541}
4542
4543impl VirtualClusterConfig {
4544 /// Creates a new default instance.
4545 pub fn new() -> Self {
4546 std::default::Default::default()
4547 }
4548
4549 /// Sets the value of [staging_bucket][crate::model::VirtualClusterConfig::staging_bucket].
4550 ///
4551 /// # Example
4552 /// ```ignore,no_run
4553 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4554 /// let x = VirtualClusterConfig::new().set_staging_bucket("example");
4555 /// ```
4556 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4557 self.staging_bucket = v.into();
4558 self
4559 }
4560
4561 /// Sets the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4562 ///
4563 /// # Example
4564 /// ```ignore,no_run
4565 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4566 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4567 /// let x = VirtualClusterConfig::new().set_auxiliary_services_config(AuxiliaryServicesConfig::default()/* use setters */);
4568 /// ```
4569 pub fn set_auxiliary_services_config<T>(mut self, v: T) -> Self
4570 where
4571 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4572 {
4573 self.auxiliary_services_config = std::option::Option::Some(v.into());
4574 self
4575 }
4576
4577 /// Sets or clears the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4578 ///
4579 /// # Example
4580 /// ```ignore,no_run
4581 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4582 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4583 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(Some(AuxiliaryServicesConfig::default()/* use setters */));
4584 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(None::<AuxiliaryServicesConfig>);
4585 /// ```
4586 pub fn set_or_clear_auxiliary_services_config<T>(mut self, v: std::option::Option<T>) -> Self
4587 where
4588 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4589 {
4590 self.auxiliary_services_config = v.map(|x| x.into());
4591 self
4592 }
4593
4594 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config].
4595 ///
4596 /// Note that all the setters affecting `infrastructure_config` are mutually
4597 /// exclusive.
4598 ///
4599 /// # Example
4600 /// ```ignore,no_run
4601 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4602 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4603 /// let x = VirtualClusterConfig::new().set_infrastructure_config(Some(
4604 /// google_cloud_dataproc_v1::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(KubernetesClusterConfig::default().into())));
4605 /// ```
4606 pub fn set_infrastructure_config<
4607 T: std::convert::Into<
4608 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4609 >,
4610 >(
4611 mut self,
4612 v: T,
4613 ) -> Self {
4614 self.infrastructure_config = v.into();
4615 self
4616 }
4617
4618 /// The value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4619 /// if it holds a `KubernetesClusterConfig`, `None` if the field is not set or
4620 /// holds a different branch.
4621 pub fn kubernetes_cluster_config(
4622 &self,
4623 ) -> std::option::Option<&std::boxed::Box<crate::model::KubernetesClusterConfig>> {
4624 #[allow(unreachable_patterns)]
4625 self.infrastructure_config.as_ref().and_then(|v| match v {
4626 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4627 v,
4628 ) => std::option::Option::Some(v),
4629 _ => std::option::Option::None,
4630 })
4631 }
4632
4633 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4634 /// to hold a `KubernetesClusterConfig`.
4635 ///
4636 /// Note that all the setters affecting `infrastructure_config` are
4637 /// mutually exclusive.
4638 ///
4639 /// # Example
4640 /// ```ignore,no_run
4641 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4642 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4643 /// let x = VirtualClusterConfig::new().set_kubernetes_cluster_config(KubernetesClusterConfig::default()/* use setters */);
4644 /// assert!(x.kubernetes_cluster_config().is_some());
4645 /// ```
4646 pub fn set_kubernetes_cluster_config<
4647 T: std::convert::Into<std::boxed::Box<crate::model::KubernetesClusterConfig>>,
4648 >(
4649 mut self,
4650 v: T,
4651 ) -> Self {
4652 self.infrastructure_config = std::option::Option::Some(
4653 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4654 v.into(),
4655 ),
4656 );
4657 self
4658 }
4659}
4660
4661impl wkt::message::Message for VirtualClusterConfig {
4662 fn typename() -> &'static str {
4663 "type.googleapis.com/google.cloud.dataproc.v1.VirtualClusterConfig"
4664 }
4665}
4666
4667/// Defines additional types related to [VirtualClusterConfig].
4668pub mod virtual_cluster_config {
4669 #[allow(unused_imports)]
4670 use super::*;
4671
4672 #[allow(missing_docs)]
4673 #[derive(Clone, Debug, PartialEq)]
4674 #[non_exhaustive]
4675 pub enum InfrastructureConfig {
4676 /// Required. The configuration for running the Dataproc cluster on
4677 /// Kubernetes.
4678 KubernetesClusterConfig(std::boxed::Box<crate::model::KubernetesClusterConfig>),
4679 }
4680}
4681
4682/// Auxiliary services configuration for a Cluster.
4683#[derive(Clone, Default, PartialEq)]
4684#[non_exhaustive]
4685pub struct AuxiliaryServicesConfig {
4686 /// Optional. The Hive Metastore configuration for this workload.
4687 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
4688
4689 /// Optional. The Spark History Server configuration for the workload.
4690 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
4691
4692 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4693}
4694
4695impl AuxiliaryServicesConfig {
4696 /// Creates a new default instance.
4697 pub fn new() -> Self {
4698 std::default::Default::default()
4699 }
4700
4701 /// Sets the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4702 ///
4703 /// # Example
4704 /// ```ignore,no_run
4705 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4706 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4707 /// let x = AuxiliaryServicesConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
4708 /// ```
4709 pub fn set_metastore_config<T>(mut self, v: T) -> Self
4710 where
4711 T: std::convert::Into<crate::model::MetastoreConfig>,
4712 {
4713 self.metastore_config = std::option::Option::Some(v.into());
4714 self
4715 }
4716
4717 /// Sets or clears the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4718 ///
4719 /// # Example
4720 /// ```ignore,no_run
4721 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4722 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4723 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4724 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4725 /// ```
4726 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4727 where
4728 T: std::convert::Into<crate::model::MetastoreConfig>,
4729 {
4730 self.metastore_config = v.map(|x| x.into());
4731 self
4732 }
4733
4734 /// Sets the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4735 ///
4736 /// # Example
4737 /// ```ignore,no_run
4738 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4739 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4740 /// let x = AuxiliaryServicesConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
4741 /// ```
4742 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
4743 where
4744 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4745 {
4746 self.spark_history_server_config = std::option::Option::Some(v.into());
4747 self
4748 }
4749
4750 /// Sets or clears the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4751 ///
4752 /// # Example
4753 /// ```ignore,no_run
4754 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4755 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4756 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
4757 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
4758 /// ```
4759 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
4760 where
4761 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4762 {
4763 self.spark_history_server_config = v.map(|x| x.into());
4764 self
4765 }
4766}
4767
4768impl wkt::message::Message for AuxiliaryServicesConfig {
4769 fn typename() -> &'static str {
4770 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryServicesConfig"
4771 }
4772}
4773
4774/// Endpoint config for this cluster
4775#[derive(Clone, Default, PartialEq)]
4776#[non_exhaustive]
4777pub struct EndpointConfig {
4778 /// Output only. The map of port descriptions to URLs. Will only be populated
4779 /// if enable_http_port_access is true.
4780 pub http_ports: std::collections::HashMap<std::string::String, std::string::String>,
4781
4782 /// Optional. If true, enable http access to specific ports on the cluster
4783 /// from external sources. Defaults to false.
4784 pub enable_http_port_access: bool,
4785
4786 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4787}
4788
4789impl EndpointConfig {
4790 /// Creates a new default instance.
4791 pub fn new() -> Self {
4792 std::default::Default::default()
4793 }
4794
4795 /// Sets the value of [http_ports][crate::model::EndpointConfig::http_ports].
4796 ///
4797 /// # Example
4798 /// ```ignore,no_run
4799 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4800 /// let x = EndpointConfig::new().set_http_ports([
4801 /// ("key0", "abc"),
4802 /// ("key1", "xyz"),
4803 /// ]);
4804 /// ```
4805 pub fn set_http_ports<T, K, V>(mut self, v: T) -> Self
4806 where
4807 T: std::iter::IntoIterator<Item = (K, V)>,
4808 K: std::convert::Into<std::string::String>,
4809 V: std::convert::Into<std::string::String>,
4810 {
4811 use std::iter::Iterator;
4812 self.http_ports = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4813 self
4814 }
4815
4816 /// Sets the value of [enable_http_port_access][crate::model::EndpointConfig::enable_http_port_access].
4817 ///
4818 /// # Example
4819 /// ```ignore,no_run
4820 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4821 /// let x = EndpointConfig::new().set_enable_http_port_access(true);
4822 /// ```
4823 pub fn set_enable_http_port_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4824 self.enable_http_port_access = v.into();
4825 self
4826 }
4827}
4828
4829impl wkt::message::Message for EndpointConfig {
4830 fn typename() -> &'static str {
4831 "type.googleapis.com/google.cloud.dataproc.v1.EndpointConfig"
4832 }
4833}
4834
4835/// Autoscaling Policy config associated with the cluster.
4836#[derive(Clone, Default, PartialEq)]
4837#[non_exhaustive]
4838pub struct AutoscalingConfig {
4839 /// Optional. The autoscaling policy used by the cluster.
4840 ///
4841 /// Only resource names including projectid and location (region) are valid.
4842 /// Examples:
4843 ///
4844 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4845 /// * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4846 ///
4847 /// Note that the policy must be in the same project and Dataproc region.
4848 pub policy_uri: std::string::String,
4849
4850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4851}
4852
4853impl AutoscalingConfig {
4854 /// Creates a new default instance.
4855 pub fn new() -> Self {
4856 std::default::Default::default()
4857 }
4858
4859 /// Sets the value of [policy_uri][crate::model::AutoscalingConfig::policy_uri].
4860 ///
4861 /// # Example
4862 /// ```ignore,no_run
4863 /// # use google_cloud_dataproc_v1::model::AutoscalingConfig;
4864 /// let x = AutoscalingConfig::new().set_policy_uri("example");
4865 /// ```
4866 pub fn set_policy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4867 self.policy_uri = v.into();
4868 self
4869 }
4870}
4871
4872impl wkt::message::Message for AutoscalingConfig {
4873 fn typename() -> &'static str {
4874 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingConfig"
4875 }
4876}
4877
4878/// Encryption settings for the cluster.
4879#[derive(Clone, Default, PartialEq)]
4880#[non_exhaustive]
4881pub struct EncryptionConfig {
4882 /// Optional. The Cloud KMS key resource name to use for persistent disk
4883 /// encryption for all instances in the cluster. See [Use CMEK with cluster
4884 /// data]
4885 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4886 /// for more information.
4887 pub gce_pd_kms_key_name: std::string::String,
4888
4889 /// Optional. The Cloud KMS key resource name to use for cluster persistent
4890 /// disk and job argument encryption. See [Use CMEK with cluster data]
4891 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4892 /// for more information.
4893 ///
4894 /// When this key resource name is provided, the following job arguments of
4895 /// the following job types submitted to the cluster are encrypted using CMEK:
4896 ///
4897 /// * [FlinkJob
4898 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
4899 /// * [HadoopJob
4900 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
4901 /// * [SparkJob
4902 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
4903 /// * [SparkRJob
4904 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
4905 /// * [PySparkJob
4906 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
4907 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
4908 /// scriptVariables and queryList.queries
4909 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
4910 /// scriptVariables and queryList.queries
4911 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
4912 /// scriptVariables and queryList.queries
4913 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
4914 /// scriptVariables and queryList.queries
4915 pub kms_key: std::string::String,
4916
4917 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4918}
4919
4920impl EncryptionConfig {
4921 /// Creates a new default instance.
4922 pub fn new() -> Self {
4923 std::default::Default::default()
4924 }
4925
4926 /// Sets the value of [gce_pd_kms_key_name][crate::model::EncryptionConfig::gce_pd_kms_key_name].
4927 ///
4928 /// # Example
4929 /// ```ignore,no_run
4930 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4931 /// let x = EncryptionConfig::new().set_gce_pd_kms_key_name("example");
4932 /// ```
4933 pub fn set_gce_pd_kms_key_name<T: std::convert::Into<std::string::String>>(
4934 mut self,
4935 v: T,
4936 ) -> Self {
4937 self.gce_pd_kms_key_name = v.into();
4938 self
4939 }
4940
4941 /// Sets the value of [kms_key][crate::model::EncryptionConfig::kms_key].
4942 ///
4943 /// # Example
4944 /// ```ignore,no_run
4945 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4946 /// let x = EncryptionConfig::new().set_kms_key("example");
4947 /// ```
4948 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4949 self.kms_key = v.into();
4950 self
4951 }
4952}
4953
4954impl wkt::message::Message for EncryptionConfig {
4955 fn typename() -> &'static str {
4956 "type.googleapis.com/google.cloud.dataproc.v1.EncryptionConfig"
4957 }
4958}
4959
4960/// Common config settings for resources of Compute Engine cluster
4961/// instances, applicable to all instances in the cluster.
4962#[derive(Clone, Default, PartialEq)]
4963#[non_exhaustive]
4964pub struct GceClusterConfig {
4965 /// Optional. The Compute Engine zone where the Dataproc cluster will be
4966 /// located. If omitted, the service will pick a zone in the cluster's Compute
4967 /// Engine region. On a get request, zone will always be present.
4968 ///
4969 /// A full URL, partial URI, or short name are valid. Examples:
4970 ///
4971 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]`
4972 /// * `projects/[project_id]/zones/[zone]`
4973 /// * `[zone]`
4974 pub zone_uri: std::string::String,
4975
4976 /// Optional. The Compute Engine network to be used for machine
4977 /// communications. Cannot be specified with subnetwork_uri. If neither
4978 /// `network_uri` nor `subnetwork_uri` is specified, the "default" network of
4979 /// the project is used, if it exists. Cannot be a "Custom Subnet Network" (see
4980 /// [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for
4981 /// more information).
4982 ///
4983 /// A full URL, partial URI, or short name are valid. Examples:
4984 ///
4985 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/networks/default`
4986 /// * `projects/[project_id]/global/networks/default`
4987 /// * `default`
4988 pub network_uri: std::string::String,
4989
4990 /// Optional. The Compute Engine subnetwork to be used for machine
4991 /// communications. Cannot be specified with network_uri.
4992 ///
4993 /// A full URL, partial URI, or short name are valid. Examples:
4994 ///
4995 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/regions/[region]/subnetworks/sub0`
4996 /// * `projects/[project_id]/regions/[region]/subnetworks/sub0`
4997 /// * `sub0`
4998 pub subnetwork_uri: std::string::String,
4999
5000 /// Optional. This setting applies to subnetwork-enabled networks. It is set to
5001 /// `true` by default in clusters created with image versions 2.2.x.
5002 ///
5003 /// When set to `true`:
5004 ///
5005 /// * All cluster VMs have internal IP addresses.
5006 /// * [Google Private Access]
5007 /// (<https://cloud.google.com/vpc/docs/private-google-access>)
5008 /// must be enabled to access Dataproc and other Google Cloud APIs.
5009 /// * Off-cluster dependencies must be configured to be accessible
5010 /// without external IP addresses.
5011 ///
5012 /// When set to `false`:
5013 ///
5014 /// * Cluster VMs are not restricted to internal IP addresses.
5015 /// * Ephemeral external IP addresses are assigned to each cluster VM.
5016 pub internal_ip_only: std::option::Option<bool>,
5017
5018 /// Optional. The type of IPv6 access for a cluster.
5019 pub private_ipv6_google_access: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess,
5020
5021 /// Optional. The [Dataproc service
5022 /// account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc)
5023 /// (also see [VM Data Plane
5024 /// identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity))
5025 /// used by Dataproc cluster VM instances to access Google Cloud Platform
5026 /// services.
5027 ///
5028 /// If not specified, the
5029 /// [Compute Engine default service
5030 /// account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
5031 /// is used.
5032 pub service_account: std::string::String,
5033
5034 /// Optional. The URIs of service account scopes to be included in
5035 /// Compute Engine instances. The following base set of scopes is always
5036 /// included:
5037 ///
5038 /// * <https://www.googleapis.com/auth/cloud.useraccounts.readonly>
5039 /// * <https://www.googleapis.com/auth/devstorage.read_write>
5040 /// * <https://www.googleapis.com/auth/logging.write>
5041 ///
5042 /// If no scopes are specified, the following defaults are also provided:
5043 ///
5044 /// * <https://www.googleapis.com/auth/bigquery>
5045 /// * <https://www.googleapis.com/auth/bigtable.admin.table>
5046 /// * <https://www.googleapis.com/auth/bigtable.data>
5047 /// * <https://www.googleapis.com/auth/devstorage.full_control>
5048 pub service_account_scopes: std::vec::Vec<std::string::String>,
5049
5050 /// The Compute Engine network tags to add to all instances (see [Tagging
5051 /// instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
5052 pub tags: std::vec::Vec<std::string::String>,
5053
5054 /// Optional. The Compute Engine metadata entries to add to all instances (see
5055 /// [Project and instance
5056 /// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
5057 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
5058
5059 /// Optional. Reservation Affinity for consuming Zonal reservation.
5060 pub reservation_affinity: std::option::Option<crate::model::ReservationAffinity>,
5061
5062 /// Optional. Node Group Affinity for sole-tenant clusters.
5063 pub node_group_affinity: std::option::Option<crate::model::NodeGroupAffinity>,
5064
5065 /// Optional. Shielded Instance Config for clusters using [Compute Engine
5066 /// Shielded
5067 /// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
5068 pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
5069
5070 /// Optional. Confidential Instance Config for clusters using [Confidential
5071 /// VMs](https://cloud.google.com/compute/confidential-vm/docs).
5072 pub confidential_instance_config: std::option::Option<crate::model::ConfidentialInstanceConfig>,
5073
5074 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5075}
5076
5077impl GceClusterConfig {
5078 /// Creates a new default instance.
5079 pub fn new() -> Self {
5080 std::default::Default::default()
5081 }
5082
5083 /// Sets the value of [zone_uri][crate::model::GceClusterConfig::zone_uri].
5084 ///
5085 /// # Example
5086 /// ```ignore,no_run
5087 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5088 /// let x = GceClusterConfig::new().set_zone_uri("example");
5089 /// ```
5090 pub fn set_zone_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5091 self.zone_uri = v.into();
5092 self
5093 }
5094
5095 /// Sets the value of [network_uri][crate::model::GceClusterConfig::network_uri].
5096 ///
5097 /// # Example
5098 /// ```ignore,no_run
5099 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5100 /// let x = GceClusterConfig::new().set_network_uri("example");
5101 /// ```
5102 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5103 self.network_uri = v.into();
5104 self
5105 }
5106
5107 /// Sets the value of [subnetwork_uri][crate::model::GceClusterConfig::subnetwork_uri].
5108 ///
5109 /// # Example
5110 /// ```ignore,no_run
5111 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5112 /// let x = GceClusterConfig::new().set_subnetwork_uri("example");
5113 /// ```
5114 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5115 self.subnetwork_uri = v.into();
5116 self
5117 }
5118
5119 /// Sets the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
5120 ///
5121 /// # Example
5122 /// ```ignore,no_run
5123 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5124 /// let x = GceClusterConfig::new().set_internal_ip_only(true);
5125 /// ```
5126 pub fn set_internal_ip_only<T>(mut self, v: T) -> Self
5127 where
5128 T: std::convert::Into<bool>,
5129 {
5130 self.internal_ip_only = std::option::Option::Some(v.into());
5131 self
5132 }
5133
5134 /// Sets or clears the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
5135 ///
5136 /// # Example
5137 /// ```ignore,no_run
5138 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5139 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(Some(false));
5140 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(None::<bool>);
5141 /// ```
5142 pub fn set_or_clear_internal_ip_only<T>(mut self, v: std::option::Option<T>) -> Self
5143 where
5144 T: std::convert::Into<bool>,
5145 {
5146 self.internal_ip_only = v.map(|x| x.into());
5147 self
5148 }
5149
5150 /// Sets the value of [private_ipv6_google_access][crate::model::GceClusterConfig::private_ipv6_google_access].
5151 ///
5152 /// # Example
5153 /// ```ignore,no_run
5154 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5155 /// use google_cloud_dataproc_v1::model::gce_cluster_config::PrivateIpv6GoogleAccess;
5156 /// let x0 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::InheritFromSubnetwork);
5157 /// let x1 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Outbound);
5158 /// let x2 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Bidirectional);
5159 /// ```
5160 pub fn set_private_ipv6_google_access<
5161 T: std::convert::Into<crate::model::gce_cluster_config::PrivateIpv6GoogleAccess>,
5162 >(
5163 mut self,
5164 v: T,
5165 ) -> Self {
5166 self.private_ipv6_google_access = v.into();
5167 self
5168 }
5169
5170 /// Sets the value of [service_account][crate::model::GceClusterConfig::service_account].
5171 ///
5172 /// # Example
5173 /// ```ignore,no_run
5174 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5175 /// let x = GceClusterConfig::new().set_service_account("example");
5176 /// ```
5177 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5178 self.service_account = v.into();
5179 self
5180 }
5181
5182 /// Sets the value of [service_account_scopes][crate::model::GceClusterConfig::service_account_scopes].
5183 ///
5184 /// # Example
5185 /// ```ignore,no_run
5186 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5187 /// let x = GceClusterConfig::new().set_service_account_scopes(["a", "b", "c"]);
5188 /// ```
5189 pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
5190 where
5191 T: std::iter::IntoIterator<Item = V>,
5192 V: std::convert::Into<std::string::String>,
5193 {
5194 use std::iter::Iterator;
5195 self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
5196 self
5197 }
5198
5199 /// Sets the value of [tags][crate::model::GceClusterConfig::tags].
5200 ///
5201 /// # Example
5202 /// ```ignore,no_run
5203 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5204 /// let x = GceClusterConfig::new().set_tags(["a", "b", "c"]);
5205 /// ```
5206 pub fn set_tags<T, V>(mut self, v: T) -> Self
5207 where
5208 T: std::iter::IntoIterator<Item = V>,
5209 V: std::convert::Into<std::string::String>,
5210 {
5211 use std::iter::Iterator;
5212 self.tags = v.into_iter().map(|i| i.into()).collect();
5213 self
5214 }
5215
5216 /// Sets the value of [metadata][crate::model::GceClusterConfig::metadata].
5217 ///
5218 /// # Example
5219 /// ```ignore,no_run
5220 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5221 /// let x = GceClusterConfig::new().set_metadata([
5222 /// ("key0", "abc"),
5223 /// ("key1", "xyz"),
5224 /// ]);
5225 /// ```
5226 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
5227 where
5228 T: std::iter::IntoIterator<Item = (K, V)>,
5229 K: std::convert::Into<std::string::String>,
5230 V: std::convert::Into<std::string::String>,
5231 {
5232 use std::iter::Iterator;
5233 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5234 self
5235 }
5236
5237 /// Sets the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
5238 ///
5239 /// # Example
5240 /// ```ignore,no_run
5241 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5242 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
5243 /// let x = GceClusterConfig::new().set_reservation_affinity(ReservationAffinity::default()/* use setters */);
5244 /// ```
5245 pub fn set_reservation_affinity<T>(mut self, v: T) -> Self
5246 where
5247 T: std::convert::Into<crate::model::ReservationAffinity>,
5248 {
5249 self.reservation_affinity = std::option::Option::Some(v.into());
5250 self
5251 }
5252
5253 /// Sets or clears the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
5254 ///
5255 /// # Example
5256 /// ```ignore,no_run
5257 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5258 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
5259 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(Some(ReservationAffinity::default()/* use setters */));
5260 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(None::<ReservationAffinity>);
5261 /// ```
5262 pub fn set_or_clear_reservation_affinity<T>(mut self, v: std::option::Option<T>) -> Self
5263 where
5264 T: std::convert::Into<crate::model::ReservationAffinity>,
5265 {
5266 self.reservation_affinity = v.map(|x| x.into());
5267 self
5268 }
5269
5270 /// Sets the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
5271 ///
5272 /// # Example
5273 /// ```ignore,no_run
5274 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5275 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5276 /// let x = GceClusterConfig::new().set_node_group_affinity(NodeGroupAffinity::default()/* use setters */);
5277 /// ```
5278 pub fn set_node_group_affinity<T>(mut self, v: T) -> Self
5279 where
5280 T: std::convert::Into<crate::model::NodeGroupAffinity>,
5281 {
5282 self.node_group_affinity = std::option::Option::Some(v.into());
5283 self
5284 }
5285
5286 /// Sets or clears the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
5287 ///
5288 /// # Example
5289 /// ```ignore,no_run
5290 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5291 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5292 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(Some(NodeGroupAffinity::default()/* use setters */));
5293 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(None::<NodeGroupAffinity>);
5294 /// ```
5295 pub fn set_or_clear_node_group_affinity<T>(mut self, v: std::option::Option<T>) -> Self
5296 where
5297 T: std::convert::Into<crate::model::NodeGroupAffinity>,
5298 {
5299 self.node_group_affinity = v.map(|x| x.into());
5300 self
5301 }
5302
5303 /// Sets the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
5304 ///
5305 /// # Example
5306 /// ```ignore,no_run
5307 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5308 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5309 /// let x = GceClusterConfig::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
5310 /// ```
5311 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
5312 where
5313 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
5314 {
5315 self.shielded_instance_config = std::option::Option::Some(v.into());
5316 self
5317 }
5318
5319 /// Sets or clears the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
5320 ///
5321 /// # Example
5322 /// ```ignore,no_run
5323 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5324 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5325 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
5326 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
5327 /// ```
5328 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5329 where
5330 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
5331 {
5332 self.shielded_instance_config = v.map(|x| x.into());
5333 self
5334 }
5335
5336 /// Sets the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
5337 ///
5338 /// # Example
5339 /// ```ignore,no_run
5340 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5341 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5342 /// let x = GceClusterConfig::new().set_confidential_instance_config(ConfidentialInstanceConfig::default()/* use setters */);
5343 /// ```
5344 pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
5345 where
5346 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
5347 {
5348 self.confidential_instance_config = std::option::Option::Some(v.into());
5349 self
5350 }
5351
5352 /// Sets or clears the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
5353 ///
5354 /// # Example
5355 /// ```ignore,no_run
5356 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
5357 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5358 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(Some(ConfidentialInstanceConfig::default()/* use setters */));
5359 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(None::<ConfidentialInstanceConfig>);
5360 /// ```
5361 pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5362 where
5363 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
5364 {
5365 self.confidential_instance_config = v.map(|x| x.into());
5366 self
5367 }
5368}
5369
5370impl wkt::message::Message for GceClusterConfig {
5371 fn typename() -> &'static str {
5372 "type.googleapis.com/google.cloud.dataproc.v1.GceClusterConfig"
5373 }
5374}
5375
5376/// Defines additional types related to [GceClusterConfig].
5377pub mod gce_cluster_config {
5378 #[allow(unused_imports)]
5379 use super::*;
5380
5381 /// `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes
5382 /// can communicate with Google Services through gRPC over IPv6.
5383 /// These values are directly mapped to corresponding values in the
5384 /// [Compute Engine Instance
5385 /// fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
5386 ///
5387 /// # Working with unknown values
5388 ///
5389 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5390 /// additional enum variants at any time. Adding new variants is not considered
5391 /// a breaking change. Applications should write their code in anticipation of:
5392 ///
5393 /// - New values appearing in future releases of the client library, **and**
5394 /// - New values received dynamically, without application changes.
5395 ///
5396 /// Please consult the [Working with enums] section in the user guide for some
5397 /// guidelines.
5398 ///
5399 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5400 #[derive(Clone, Debug, PartialEq)]
5401 #[non_exhaustive]
5402 pub enum PrivateIpv6GoogleAccess {
5403 /// If unspecified, Compute Engine default behavior will apply, which
5404 /// is the same as
5405 /// [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK].
5406 ///
5407 /// [google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess::InheritFromSubnetwork
5408 Unspecified,
5409 /// Private access to and from Google Services configuration
5410 /// inherited from the subnetwork configuration. This is the
5411 /// default Compute Engine behavior.
5412 InheritFromSubnetwork,
5413 /// Enables outbound private IPv6 access to Google Services from the Dataproc
5414 /// cluster.
5415 Outbound,
5416 /// Enables bidirectional private IPv6 access between Google Services and the
5417 /// Dataproc cluster.
5418 Bidirectional,
5419 /// If set, the enum was initialized with an unknown value.
5420 ///
5421 /// Applications can examine the value using [PrivateIpv6GoogleAccess::value] or
5422 /// [PrivateIpv6GoogleAccess::name].
5423 UnknownValue(private_ipv_6_google_access::UnknownValue),
5424 }
5425
5426 #[doc(hidden)]
5427 pub mod private_ipv_6_google_access {
5428 #[allow(unused_imports)]
5429 use super::*;
5430 #[derive(Clone, Debug, PartialEq)]
5431 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5432 }
5433
5434 impl PrivateIpv6GoogleAccess {
5435 /// Gets the enum value.
5436 ///
5437 /// Returns `None` if the enum contains an unknown value deserialized from
5438 /// the string representation of enums.
5439 pub fn value(&self) -> std::option::Option<i32> {
5440 match self {
5441 Self::Unspecified => std::option::Option::Some(0),
5442 Self::InheritFromSubnetwork => std::option::Option::Some(1),
5443 Self::Outbound => std::option::Option::Some(2),
5444 Self::Bidirectional => std::option::Option::Some(3),
5445 Self::UnknownValue(u) => u.0.value(),
5446 }
5447 }
5448
5449 /// Gets the enum value as a string.
5450 ///
5451 /// Returns `None` if the enum contains an unknown value deserialized from
5452 /// the integer representation of enums.
5453 pub fn name(&self) -> std::option::Option<&str> {
5454 match self {
5455 Self::Unspecified => {
5456 std::option::Option::Some("PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED")
5457 }
5458 Self::InheritFromSubnetwork => std::option::Option::Some("INHERIT_FROM_SUBNETWORK"),
5459 Self::Outbound => std::option::Option::Some("OUTBOUND"),
5460 Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
5461 Self::UnknownValue(u) => u.0.name(),
5462 }
5463 }
5464 }
5465
5466 impl std::default::Default for PrivateIpv6GoogleAccess {
5467 fn default() -> Self {
5468 use std::convert::From;
5469 Self::from(0)
5470 }
5471 }
5472
5473 impl std::fmt::Display for PrivateIpv6GoogleAccess {
5474 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5475 wkt::internal::display_enum(f, self.name(), self.value())
5476 }
5477 }
5478
5479 impl std::convert::From<i32> for PrivateIpv6GoogleAccess {
5480 fn from(value: i32) -> Self {
5481 match value {
5482 0 => Self::Unspecified,
5483 1 => Self::InheritFromSubnetwork,
5484 2 => Self::Outbound,
5485 3 => Self::Bidirectional,
5486 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5487 wkt::internal::UnknownEnumValue::Integer(value),
5488 )),
5489 }
5490 }
5491 }
5492
5493 impl std::convert::From<&str> for PrivateIpv6GoogleAccess {
5494 fn from(value: &str) -> Self {
5495 use std::string::ToString;
5496 match value {
5497 "PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED" => Self::Unspecified,
5498 "INHERIT_FROM_SUBNETWORK" => Self::InheritFromSubnetwork,
5499 "OUTBOUND" => Self::Outbound,
5500 "BIDIRECTIONAL" => Self::Bidirectional,
5501 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5502 wkt::internal::UnknownEnumValue::String(value.to_string()),
5503 )),
5504 }
5505 }
5506 }
5507
5508 impl serde::ser::Serialize for PrivateIpv6GoogleAccess {
5509 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5510 where
5511 S: serde::Serializer,
5512 {
5513 match self {
5514 Self::Unspecified => serializer.serialize_i32(0),
5515 Self::InheritFromSubnetwork => serializer.serialize_i32(1),
5516 Self::Outbound => serializer.serialize_i32(2),
5517 Self::Bidirectional => serializer.serialize_i32(3),
5518 Self::UnknownValue(u) => u.0.serialize(serializer),
5519 }
5520 }
5521 }
5522
5523 impl<'de> serde::de::Deserialize<'de> for PrivateIpv6GoogleAccess {
5524 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5525 where
5526 D: serde::Deserializer<'de>,
5527 {
5528 deserializer.deserialize_any(
5529 wkt::internal::EnumVisitor::<PrivateIpv6GoogleAccess>::new(
5530 ".google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess",
5531 ),
5532 )
5533 }
5534 }
5535}
5536
5537/// Node Group Affinity for clusters using sole-tenant node groups.
5538/// **The Dataproc `NodeGroupAffinity` resource is not related to the
5539/// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.**
5540///
5541/// [google.cloud.dataproc.v1.NodeGroup]: crate::model::NodeGroup
5542#[derive(Clone, Default, PartialEq)]
5543#[non_exhaustive]
5544pub struct NodeGroupAffinity {
5545 /// Required. The URI of a
5546 /// sole-tenant [node group
5547 /// resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups)
5548 /// that the cluster will be created on.
5549 ///
5550 /// A full URL, partial URI, or node group name are valid. Examples:
5551 ///
5552 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/nodeGroups/node-group-1`
5553 /// * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1`
5554 /// * `node-group-1`
5555 pub node_group_uri: std::string::String,
5556
5557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5558}
5559
5560impl NodeGroupAffinity {
5561 /// Creates a new default instance.
5562 pub fn new() -> Self {
5563 std::default::Default::default()
5564 }
5565
5566 /// Sets the value of [node_group_uri][crate::model::NodeGroupAffinity::node_group_uri].
5567 ///
5568 /// # Example
5569 /// ```ignore,no_run
5570 /// # use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5571 /// let x = NodeGroupAffinity::new().set_node_group_uri("example");
5572 /// ```
5573 pub fn set_node_group_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5574 self.node_group_uri = v.into();
5575 self
5576 }
5577}
5578
5579impl wkt::message::Message for NodeGroupAffinity {
5580 fn typename() -> &'static str {
5581 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupAffinity"
5582 }
5583}
5584
5585/// Shielded Instance Config for clusters using [Compute Engine Shielded
5586/// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
5587#[derive(Clone, Default, PartialEq)]
5588#[non_exhaustive]
5589pub struct ShieldedInstanceConfig {
5590 /// Optional. Defines whether instances have Secure Boot enabled.
5591 pub enable_secure_boot: std::option::Option<bool>,
5592
5593 /// Optional. Defines whether instances have the vTPM enabled.
5594 pub enable_vtpm: std::option::Option<bool>,
5595
5596 /// Optional. Defines whether instances have integrity monitoring enabled.
5597 pub enable_integrity_monitoring: std::option::Option<bool>,
5598
5599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5600}
5601
5602impl ShieldedInstanceConfig {
5603 /// Creates a new default instance.
5604 pub fn new() -> Self {
5605 std::default::Default::default()
5606 }
5607
5608 /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5609 ///
5610 /// # Example
5611 /// ```ignore,no_run
5612 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5613 /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
5614 /// ```
5615 pub fn set_enable_secure_boot<T>(mut self, v: T) -> Self
5616 where
5617 T: std::convert::Into<bool>,
5618 {
5619 self.enable_secure_boot = std::option::Option::Some(v.into());
5620 self
5621 }
5622
5623 /// Sets or clears the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5624 ///
5625 /// # Example
5626 /// ```ignore,no_run
5627 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5628 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(Some(false));
5629 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(None::<bool>);
5630 /// ```
5631 pub fn set_or_clear_enable_secure_boot<T>(mut self, v: std::option::Option<T>) -> Self
5632 where
5633 T: std::convert::Into<bool>,
5634 {
5635 self.enable_secure_boot = v.map(|x| x.into());
5636 self
5637 }
5638
5639 /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5640 ///
5641 /// # Example
5642 /// ```ignore,no_run
5643 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5644 /// let x = ShieldedInstanceConfig::new().set_enable_vtpm(true);
5645 /// ```
5646 pub fn set_enable_vtpm<T>(mut self, v: T) -> Self
5647 where
5648 T: std::convert::Into<bool>,
5649 {
5650 self.enable_vtpm = std::option::Option::Some(v.into());
5651 self
5652 }
5653
5654 /// Sets or clears the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5655 ///
5656 /// # Example
5657 /// ```ignore,no_run
5658 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5659 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(Some(false));
5660 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(None::<bool>);
5661 /// ```
5662 pub fn set_or_clear_enable_vtpm<T>(mut self, v: std::option::Option<T>) -> Self
5663 where
5664 T: std::convert::Into<bool>,
5665 {
5666 self.enable_vtpm = v.map(|x| x.into());
5667 self
5668 }
5669
5670 /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5671 ///
5672 /// # Example
5673 /// ```ignore,no_run
5674 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5675 /// let x = ShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
5676 /// ```
5677 pub fn set_enable_integrity_monitoring<T>(mut self, v: T) -> Self
5678 where
5679 T: std::convert::Into<bool>,
5680 {
5681 self.enable_integrity_monitoring = std::option::Option::Some(v.into());
5682 self
5683 }
5684
5685 /// Sets or clears the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5686 ///
5687 /// # Example
5688 /// ```ignore,no_run
5689 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5690 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(Some(false));
5691 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(None::<bool>);
5692 /// ```
5693 pub fn set_or_clear_enable_integrity_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
5694 where
5695 T: std::convert::Into<bool>,
5696 {
5697 self.enable_integrity_monitoring = v.map(|x| x.into());
5698 self
5699 }
5700}
5701
5702impl wkt::message::Message for ShieldedInstanceConfig {
5703 fn typename() -> &'static str {
5704 "type.googleapis.com/google.cloud.dataproc.v1.ShieldedInstanceConfig"
5705 }
5706}
5707
5708/// Confidential Instance Config for clusters using [Confidential
5709/// VMs](https://cloud.google.com/compute/confidential-vm/docs)
5710#[derive(Clone, Default, PartialEq)]
5711#[non_exhaustive]
5712pub struct ConfidentialInstanceConfig {
5713 /// Optional. Defines whether the instance should have confidential compute
5714 /// enabled.
5715 pub enable_confidential_compute: bool,
5716
5717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5718}
5719
5720impl ConfidentialInstanceConfig {
5721 /// Creates a new default instance.
5722 pub fn new() -> Self {
5723 std::default::Default::default()
5724 }
5725
5726 /// Sets the value of [enable_confidential_compute][crate::model::ConfidentialInstanceConfig::enable_confidential_compute].
5727 ///
5728 /// # Example
5729 /// ```ignore,no_run
5730 /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5731 /// let x = ConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
5732 /// ```
5733 pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5734 self.enable_confidential_compute = v.into();
5735 self
5736 }
5737}
5738
5739impl wkt::message::Message for ConfidentialInstanceConfig {
5740 fn typename() -> &'static str {
5741 "type.googleapis.com/google.cloud.dataproc.v1.ConfidentialInstanceConfig"
5742 }
5743}
5744
5745/// The config settings for Compute Engine resources in
5746/// an instance group, such as a master or worker group.
5747#[derive(Clone, Default, PartialEq)]
5748#[non_exhaustive]
5749pub struct InstanceGroupConfig {
5750 /// Optional. The number of VM instances in the instance group.
5751 /// For [HA
5752 /// cluster](/dataproc/docs/concepts/configuring-clusters/high-availability)
5753 /// [master_config](#FIELDS.master_config) groups, **must be set to 3**.
5754 /// For standard cluster [master_config](#FIELDS.master_config) groups,
5755 /// **must be set to 1**.
5756 pub num_instances: i32,
5757
5758 /// Output only. The list of instance names. Dataproc derives the names
5759 /// from `cluster_name`, `num_instances`, and the instance group.
5760 pub instance_names: std::vec::Vec<std::string::String>,
5761
5762 /// Output only. List of references to Compute Engine instances.
5763 pub instance_references: std::vec::Vec<crate::model::InstanceReference>,
5764
5765 /// Optional. The Compute Engine image resource used for cluster instances.
5766 ///
5767 /// The URI can represent an image or image family.
5768 ///
5769 /// Image examples:
5770 ///
5771 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/[image-id]`
5772 /// * `projects/[project_id]/global/images/[image-id]`
5773 /// * `image-id`
5774 ///
5775 /// Image family examples. Dataproc will use the most recent
5776 /// image from the family:
5777 ///
5778 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/family/[custom-image-family-name]`
5779 /// * `projects/[project_id]/global/images/family/[custom-image-family-name]`
5780 ///
5781 /// If the URI is unspecified, it will be inferred from
5782 /// `SoftwareConfig.image_version` or the system default.
5783 pub image_uri: std::string::String,
5784
5785 /// Optional. The Compute Engine machine type used for cluster instances.
5786 ///
5787 /// A full URL, partial URI, or short name are valid. Examples:
5788 ///
5789 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5790 /// * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5791 /// * `n1-standard-2`
5792 ///
5793 /// **Auto Zone Exception**: If you are using the Dataproc
5794 /// [Auto Zone
5795 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
5796 /// feature, you must use the short name of the machine type
5797 /// resource, for example, `n1-standard-2`.
5798 pub machine_type_uri: std::string::String,
5799
5800 /// Optional. Disk option config settings.
5801 pub disk_config: std::option::Option<crate::model::DiskConfig>,
5802
5803 /// Output only. Specifies that this instance group contains preemptible
5804 /// instances.
5805 pub is_preemptible: bool,
5806
5807 /// Optional. Specifies the preemptibility of the instance group.
5808 ///
5809 /// The default value for master and worker groups is
5810 /// `NON_PREEMPTIBLE`. This default cannot be changed.
5811 ///
5812 /// The default value for secondary instances is
5813 /// `PREEMPTIBLE`.
5814 pub preemptibility: crate::model::instance_group_config::Preemptibility,
5815
5816 /// Output only. The config for Compute Engine Instance Group
5817 /// Manager that manages this group.
5818 /// This is only used for preemptible instance groups.
5819 pub managed_group_config: std::option::Option<crate::model::ManagedGroupConfig>,
5820
5821 /// Optional. The Compute Engine accelerator configuration for these
5822 /// instances.
5823 pub accelerators: std::vec::Vec<crate::model::AcceleratorConfig>,
5824
5825 /// Optional. Specifies the minimum cpu platform for the Instance Group.
5826 /// See [Dataproc -> Minimum CPU
5827 /// Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
5828 pub min_cpu_platform: std::string::String,
5829
5830 /// Optional. The minimum number of primary worker instances to create.
5831 /// If `min_num_instances` is set, cluster creation will succeed if
5832 /// the number of primary workers created is at least equal to the
5833 /// `min_num_instances` number.
5834 ///
5835 /// Example: Cluster creation request with `num_instances` = `5` and
5836 /// `min_num_instances` = `3`:
5837 ///
5838 /// * If 4 VMs are created and 1 instance fails,
5839 /// the failed VM is deleted. The cluster is
5840 /// resized to 4 instances and placed in a `RUNNING` state.
5841 /// * If 2 instances are created and 3 instances fail,
5842 /// the cluster in placed in an `ERROR` state. The failed VMs
5843 /// are not deleted.
5844 pub min_num_instances: i32,
5845
5846 /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and
5847 /// provisioning models.
5848 pub instance_flexibility_policy: std::option::Option<crate::model::InstanceFlexibilityPolicy>,
5849
5850 /// Optional. Configuration to handle the startup of instances during cluster
5851 /// create and update process.
5852 pub startup_config: std::option::Option<crate::model::StartupConfig>,
5853
5854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5855}
5856
5857impl InstanceGroupConfig {
5858 /// Creates a new default instance.
5859 pub fn new() -> Self {
5860 std::default::Default::default()
5861 }
5862
5863 /// Sets the value of [num_instances][crate::model::InstanceGroupConfig::num_instances].
5864 ///
5865 /// # Example
5866 /// ```ignore,no_run
5867 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5868 /// let x = InstanceGroupConfig::new().set_num_instances(42);
5869 /// ```
5870 pub fn set_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5871 self.num_instances = v.into();
5872 self
5873 }
5874
5875 /// Sets the value of [instance_names][crate::model::InstanceGroupConfig::instance_names].
5876 ///
5877 /// # Example
5878 /// ```ignore,no_run
5879 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5880 /// let x = InstanceGroupConfig::new().set_instance_names(["a", "b", "c"]);
5881 /// ```
5882 pub fn set_instance_names<T, V>(mut self, v: T) -> Self
5883 where
5884 T: std::iter::IntoIterator<Item = V>,
5885 V: std::convert::Into<std::string::String>,
5886 {
5887 use std::iter::Iterator;
5888 self.instance_names = v.into_iter().map(|i| i.into()).collect();
5889 self
5890 }
5891
5892 /// Sets the value of [instance_references][crate::model::InstanceGroupConfig::instance_references].
5893 ///
5894 /// # Example
5895 /// ```ignore,no_run
5896 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5897 /// use google_cloud_dataproc_v1::model::InstanceReference;
5898 /// let x = InstanceGroupConfig::new()
5899 /// .set_instance_references([
5900 /// InstanceReference::default()/* use setters */,
5901 /// InstanceReference::default()/* use (different) setters */,
5902 /// ]);
5903 /// ```
5904 pub fn set_instance_references<T, V>(mut self, v: T) -> Self
5905 where
5906 T: std::iter::IntoIterator<Item = V>,
5907 V: std::convert::Into<crate::model::InstanceReference>,
5908 {
5909 use std::iter::Iterator;
5910 self.instance_references = v.into_iter().map(|i| i.into()).collect();
5911 self
5912 }
5913
5914 /// Sets the value of [image_uri][crate::model::InstanceGroupConfig::image_uri].
5915 ///
5916 /// # Example
5917 /// ```ignore,no_run
5918 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5919 /// let x = InstanceGroupConfig::new().set_image_uri("example");
5920 /// ```
5921 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5922 self.image_uri = v.into();
5923 self
5924 }
5925
5926 /// Sets the value of [machine_type_uri][crate::model::InstanceGroupConfig::machine_type_uri].
5927 ///
5928 /// # Example
5929 /// ```ignore,no_run
5930 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5931 /// let x = InstanceGroupConfig::new().set_machine_type_uri("example");
5932 /// ```
5933 pub fn set_machine_type_uri<T: std::convert::Into<std::string::String>>(
5934 mut self,
5935 v: T,
5936 ) -> Self {
5937 self.machine_type_uri = v.into();
5938 self
5939 }
5940
5941 /// Sets the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5942 ///
5943 /// # Example
5944 /// ```ignore,no_run
5945 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5946 /// use google_cloud_dataproc_v1::model::DiskConfig;
5947 /// let x = InstanceGroupConfig::new().set_disk_config(DiskConfig::default()/* use setters */);
5948 /// ```
5949 pub fn set_disk_config<T>(mut self, v: T) -> Self
5950 where
5951 T: std::convert::Into<crate::model::DiskConfig>,
5952 {
5953 self.disk_config = std::option::Option::Some(v.into());
5954 self
5955 }
5956
5957 /// Sets or clears the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5958 ///
5959 /// # Example
5960 /// ```ignore,no_run
5961 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5962 /// use google_cloud_dataproc_v1::model::DiskConfig;
5963 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
5964 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(None::<DiskConfig>);
5965 /// ```
5966 pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
5967 where
5968 T: std::convert::Into<crate::model::DiskConfig>,
5969 {
5970 self.disk_config = v.map(|x| x.into());
5971 self
5972 }
5973
5974 /// Sets the value of [is_preemptible][crate::model::InstanceGroupConfig::is_preemptible].
5975 ///
5976 /// # Example
5977 /// ```ignore,no_run
5978 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5979 /// let x = InstanceGroupConfig::new().set_is_preemptible(true);
5980 /// ```
5981 pub fn set_is_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5982 self.is_preemptible = v.into();
5983 self
5984 }
5985
5986 /// Sets the value of [preemptibility][crate::model::InstanceGroupConfig::preemptibility].
5987 ///
5988 /// # Example
5989 /// ```ignore,no_run
5990 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5991 /// use google_cloud_dataproc_v1::model::instance_group_config::Preemptibility;
5992 /// let x0 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::NonPreemptible);
5993 /// let x1 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Preemptible);
5994 /// let x2 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Spot);
5995 /// ```
5996 pub fn set_preemptibility<
5997 T: std::convert::Into<crate::model::instance_group_config::Preemptibility>,
5998 >(
5999 mut self,
6000 v: T,
6001 ) -> Self {
6002 self.preemptibility = v.into();
6003 self
6004 }
6005
6006 /// Sets the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
6007 ///
6008 /// # Example
6009 /// ```ignore,no_run
6010 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6011 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6012 /// let x = InstanceGroupConfig::new().set_managed_group_config(ManagedGroupConfig::default()/* use setters */);
6013 /// ```
6014 pub fn set_managed_group_config<T>(mut self, v: T) -> Self
6015 where
6016 T: std::convert::Into<crate::model::ManagedGroupConfig>,
6017 {
6018 self.managed_group_config = std::option::Option::Some(v.into());
6019 self
6020 }
6021
6022 /// Sets or clears the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
6023 ///
6024 /// # Example
6025 /// ```ignore,no_run
6026 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6027 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6028 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(Some(ManagedGroupConfig::default()/* use setters */));
6029 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(None::<ManagedGroupConfig>);
6030 /// ```
6031 pub fn set_or_clear_managed_group_config<T>(mut self, v: std::option::Option<T>) -> Self
6032 where
6033 T: std::convert::Into<crate::model::ManagedGroupConfig>,
6034 {
6035 self.managed_group_config = v.map(|x| x.into());
6036 self
6037 }
6038
6039 /// Sets the value of [accelerators][crate::model::InstanceGroupConfig::accelerators].
6040 ///
6041 /// # Example
6042 /// ```ignore,no_run
6043 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6044 /// use google_cloud_dataproc_v1::model::AcceleratorConfig;
6045 /// let x = InstanceGroupConfig::new()
6046 /// .set_accelerators([
6047 /// AcceleratorConfig::default()/* use setters */,
6048 /// AcceleratorConfig::default()/* use (different) setters */,
6049 /// ]);
6050 /// ```
6051 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
6052 where
6053 T: std::iter::IntoIterator<Item = V>,
6054 V: std::convert::Into<crate::model::AcceleratorConfig>,
6055 {
6056 use std::iter::Iterator;
6057 self.accelerators = v.into_iter().map(|i| i.into()).collect();
6058 self
6059 }
6060
6061 /// Sets the value of [min_cpu_platform][crate::model::InstanceGroupConfig::min_cpu_platform].
6062 ///
6063 /// # Example
6064 /// ```ignore,no_run
6065 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6066 /// let x = InstanceGroupConfig::new().set_min_cpu_platform("example");
6067 /// ```
6068 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
6069 mut self,
6070 v: T,
6071 ) -> Self {
6072 self.min_cpu_platform = v.into();
6073 self
6074 }
6075
6076 /// Sets the value of [min_num_instances][crate::model::InstanceGroupConfig::min_num_instances].
6077 ///
6078 /// # Example
6079 /// ```ignore,no_run
6080 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6081 /// let x = InstanceGroupConfig::new().set_min_num_instances(42);
6082 /// ```
6083 pub fn set_min_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6084 self.min_num_instances = v.into();
6085 self
6086 }
6087
6088 /// Sets the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
6089 ///
6090 /// # Example
6091 /// ```ignore,no_run
6092 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6093 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6094 /// let x = InstanceGroupConfig::new().set_instance_flexibility_policy(InstanceFlexibilityPolicy::default()/* use setters */);
6095 /// ```
6096 pub fn set_instance_flexibility_policy<T>(mut self, v: T) -> Self
6097 where
6098 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
6099 {
6100 self.instance_flexibility_policy = std::option::Option::Some(v.into());
6101 self
6102 }
6103
6104 /// Sets or clears the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
6105 ///
6106 /// # Example
6107 /// ```ignore,no_run
6108 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6109 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6110 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(Some(InstanceFlexibilityPolicy::default()/* use setters */));
6111 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(None::<InstanceFlexibilityPolicy>);
6112 /// ```
6113 pub fn set_or_clear_instance_flexibility_policy<T>(mut self, v: std::option::Option<T>) -> Self
6114 where
6115 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
6116 {
6117 self.instance_flexibility_policy = v.map(|x| x.into());
6118 self
6119 }
6120
6121 /// Sets the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
6122 ///
6123 /// # Example
6124 /// ```ignore,no_run
6125 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6126 /// use google_cloud_dataproc_v1::model::StartupConfig;
6127 /// let x = InstanceGroupConfig::new().set_startup_config(StartupConfig::default()/* use setters */);
6128 /// ```
6129 pub fn set_startup_config<T>(mut self, v: T) -> Self
6130 where
6131 T: std::convert::Into<crate::model::StartupConfig>,
6132 {
6133 self.startup_config = std::option::Option::Some(v.into());
6134 self
6135 }
6136
6137 /// Sets or clears the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
6138 ///
6139 /// # Example
6140 /// ```ignore,no_run
6141 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6142 /// use google_cloud_dataproc_v1::model::StartupConfig;
6143 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(Some(StartupConfig::default()/* use setters */));
6144 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(None::<StartupConfig>);
6145 /// ```
6146 pub fn set_or_clear_startup_config<T>(mut self, v: std::option::Option<T>) -> Self
6147 where
6148 T: std::convert::Into<crate::model::StartupConfig>,
6149 {
6150 self.startup_config = v.map(|x| x.into());
6151 self
6152 }
6153}
6154
6155impl wkt::message::Message for InstanceGroupConfig {
6156 fn typename() -> &'static str {
6157 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupConfig"
6158 }
6159}
6160
6161/// Defines additional types related to [InstanceGroupConfig].
6162pub mod instance_group_config {
6163 #[allow(unused_imports)]
6164 use super::*;
6165
6166 /// Controls the use of preemptible instances within the group.
6167 ///
6168 /// # Working with unknown values
6169 ///
6170 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6171 /// additional enum variants at any time. Adding new variants is not considered
6172 /// a breaking change. Applications should write their code in anticipation of:
6173 ///
6174 /// - New values appearing in future releases of the client library, **and**
6175 /// - New values received dynamically, without application changes.
6176 ///
6177 /// Please consult the [Working with enums] section in the user guide for some
6178 /// guidelines.
6179 ///
6180 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6181 #[derive(Clone, Debug, PartialEq)]
6182 #[non_exhaustive]
6183 pub enum Preemptibility {
6184 /// Preemptibility is unspecified, the system will choose the
6185 /// appropriate setting for each instance group.
6186 Unspecified,
6187 /// Instances are non-preemptible.
6188 ///
6189 /// This option is allowed for all instance groups and is the only valid
6190 /// value for Master and Worker instance groups.
6191 NonPreemptible,
6192 /// Instances are [preemptible]
6193 /// (<https://cloud.google.com/compute/docs/instances/preemptible>).
6194 ///
6195 /// This option is allowed only for [secondary worker]
6196 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
6197 /// groups.
6198 Preemptible,
6199 /// Instances are [Spot VMs]
6200 /// (<https://cloud.google.com/compute/docs/instances/spot>).
6201 ///
6202 /// This option is allowed only for [secondary worker]
6203 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
6204 /// groups. Spot VMs are the latest version of [preemptible VMs]
6205 /// (<https://cloud.google.com/compute/docs/instances/preemptible>), and
6206 /// provide additional features.
6207 Spot,
6208 /// If set, the enum was initialized with an unknown value.
6209 ///
6210 /// Applications can examine the value using [Preemptibility::value] or
6211 /// [Preemptibility::name].
6212 UnknownValue(preemptibility::UnknownValue),
6213 }
6214
6215 #[doc(hidden)]
6216 pub mod preemptibility {
6217 #[allow(unused_imports)]
6218 use super::*;
6219 #[derive(Clone, Debug, PartialEq)]
6220 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6221 }
6222
6223 impl Preemptibility {
6224 /// Gets the enum value.
6225 ///
6226 /// Returns `None` if the enum contains an unknown value deserialized from
6227 /// the string representation of enums.
6228 pub fn value(&self) -> std::option::Option<i32> {
6229 match self {
6230 Self::Unspecified => std::option::Option::Some(0),
6231 Self::NonPreemptible => std::option::Option::Some(1),
6232 Self::Preemptible => std::option::Option::Some(2),
6233 Self::Spot => std::option::Option::Some(3),
6234 Self::UnknownValue(u) => u.0.value(),
6235 }
6236 }
6237
6238 /// Gets the enum value as a string.
6239 ///
6240 /// Returns `None` if the enum contains an unknown value deserialized from
6241 /// the integer representation of enums.
6242 pub fn name(&self) -> std::option::Option<&str> {
6243 match self {
6244 Self::Unspecified => std::option::Option::Some("PREEMPTIBILITY_UNSPECIFIED"),
6245 Self::NonPreemptible => std::option::Option::Some("NON_PREEMPTIBLE"),
6246 Self::Preemptible => std::option::Option::Some("PREEMPTIBLE"),
6247 Self::Spot => std::option::Option::Some("SPOT"),
6248 Self::UnknownValue(u) => u.0.name(),
6249 }
6250 }
6251 }
6252
6253 impl std::default::Default for Preemptibility {
6254 fn default() -> Self {
6255 use std::convert::From;
6256 Self::from(0)
6257 }
6258 }
6259
6260 impl std::fmt::Display for Preemptibility {
6261 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6262 wkt::internal::display_enum(f, self.name(), self.value())
6263 }
6264 }
6265
6266 impl std::convert::From<i32> for Preemptibility {
6267 fn from(value: i32) -> Self {
6268 match value {
6269 0 => Self::Unspecified,
6270 1 => Self::NonPreemptible,
6271 2 => Self::Preemptible,
6272 3 => Self::Spot,
6273 _ => Self::UnknownValue(preemptibility::UnknownValue(
6274 wkt::internal::UnknownEnumValue::Integer(value),
6275 )),
6276 }
6277 }
6278 }
6279
6280 impl std::convert::From<&str> for Preemptibility {
6281 fn from(value: &str) -> Self {
6282 use std::string::ToString;
6283 match value {
6284 "PREEMPTIBILITY_UNSPECIFIED" => Self::Unspecified,
6285 "NON_PREEMPTIBLE" => Self::NonPreemptible,
6286 "PREEMPTIBLE" => Self::Preemptible,
6287 "SPOT" => Self::Spot,
6288 _ => Self::UnknownValue(preemptibility::UnknownValue(
6289 wkt::internal::UnknownEnumValue::String(value.to_string()),
6290 )),
6291 }
6292 }
6293 }
6294
6295 impl serde::ser::Serialize for Preemptibility {
6296 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6297 where
6298 S: serde::Serializer,
6299 {
6300 match self {
6301 Self::Unspecified => serializer.serialize_i32(0),
6302 Self::NonPreemptible => serializer.serialize_i32(1),
6303 Self::Preemptible => serializer.serialize_i32(2),
6304 Self::Spot => serializer.serialize_i32(3),
6305 Self::UnknownValue(u) => u.0.serialize(serializer),
6306 }
6307 }
6308 }
6309
6310 impl<'de> serde::de::Deserialize<'de> for Preemptibility {
6311 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6312 where
6313 D: serde::Deserializer<'de>,
6314 {
6315 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Preemptibility>::new(
6316 ".google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility",
6317 ))
6318 }
6319 }
6320}
6321
6322/// Configuration to handle the startup of instances during cluster create and
6323/// update process.
6324#[derive(Clone, Default, PartialEq)]
6325#[non_exhaustive]
6326pub struct StartupConfig {
6327 /// Optional. The config setting to enable cluster creation/ updation to be
6328 /// successful only after required_registration_fraction of instances are up
6329 /// and running. This configuration is applicable to only secondary workers for
6330 /// now. The cluster will fail if required_registration_fraction of instances
6331 /// are not available. This will include instance creation, agent registration,
6332 /// and service registration (if enabled).
6333 pub required_registration_fraction: std::option::Option<f64>,
6334
6335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6336}
6337
6338impl StartupConfig {
6339 /// Creates a new default instance.
6340 pub fn new() -> Self {
6341 std::default::Default::default()
6342 }
6343
6344 /// Sets the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
6345 ///
6346 /// # Example
6347 /// ```ignore,no_run
6348 /// # use google_cloud_dataproc_v1::model::StartupConfig;
6349 /// let x = StartupConfig::new().set_required_registration_fraction(42.0);
6350 /// ```
6351 pub fn set_required_registration_fraction<T>(mut self, v: T) -> Self
6352 where
6353 T: std::convert::Into<f64>,
6354 {
6355 self.required_registration_fraction = std::option::Option::Some(v.into());
6356 self
6357 }
6358
6359 /// Sets or clears the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
6360 ///
6361 /// # Example
6362 /// ```ignore,no_run
6363 /// # use google_cloud_dataproc_v1::model::StartupConfig;
6364 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(Some(42.0));
6365 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(None::<f32>);
6366 /// ```
6367 pub fn set_or_clear_required_registration_fraction<T>(
6368 mut self,
6369 v: std::option::Option<T>,
6370 ) -> Self
6371 where
6372 T: std::convert::Into<f64>,
6373 {
6374 self.required_registration_fraction = v.map(|x| x.into());
6375 self
6376 }
6377}
6378
6379impl wkt::message::Message for StartupConfig {
6380 fn typename() -> &'static str {
6381 "type.googleapis.com/google.cloud.dataproc.v1.StartupConfig"
6382 }
6383}
6384
6385/// A reference to a Compute Engine instance.
6386#[derive(Clone, Default, PartialEq)]
6387#[non_exhaustive]
6388pub struct InstanceReference {
6389 /// The user-friendly name of the Compute Engine instance.
6390 pub instance_name: std::string::String,
6391
6392 /// The unique identifier of the Compute Engine instance.
6393 pub instance_id: std::string::String,
6394
6395 /// The public RSA key used for sharing data with this instance.
6396 pub public_key: std::string::String,
6397
6398 /// The public ECIES key used for sharing data with this instance.
6399 pub public_ecies_key: std::string::String,
6400
6401 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6402}
6403
6404impl InstanceReference {
6405 /// Creates a new default instance.
6406 pub fn new() -> Self {
6407 std::default::Default::default()
6408 }
6409
6410 /// Sets the value of [instance_name][crate::model::InstanceReference::instance_name].
6411 ///
6412 /// # Example
6413 /// ```ignore,no_run
6414 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6415 /// let x = InstanceReference::new().set_instance_name("example");
6416 /// ```
6417 pub fn set_instance_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6418 self.instance_name = v.into();
6419 self
6420 }
6421
6422 /// Sets the value of [instance_id][crate::model::InstanceReference::instance_id].
6423 ///
6424 /// # Example
6425 /// ```ignore,no_run
6426 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6427 /// let x = InstanceReference::new().set_instance_id("example");
6428 /// ```
6429 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6430 self.instance_id = v.into();
6431 self
6432 }
6433
6434 /// Sets the value of [public_key][crate::model::InstanceReference::public_key].
6435 ///
6436 /// # Example
6437 /// ```ignore,no_run
6438 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6439 /// let x = InstanceReference::new().set_public_key("example");
6440 /// ```
6441 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6442 self.public_key = v.into();
6443 self
6444 }
6445
6446 /// Sets the value of [public_ecies_key][crate::model::InstanceReference::public_ecies_key].
6447 ///
6448 /// # Example
6449 /// ```ignore,no_run
6450 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6451 /// let x = InstanceReference::new().set_public_ecies_key("example");
6452 /// ```
6453 pub fn set_public_ecies_key<T: std::convert::Into<std::string::String>>(
6454 mut self,
6455 v: T,
6456 ) -> Self {
6457 self.public_ecies_key = v.into();
6458 self
6459 }
6460}
6461
6462impl wkt::message::Message for InstanceReference {
6463 fn typename() -> &'static str {
6464 "type.googleapis.com/google.cloud.dataproc.v1.InstanceReference"
6465 }
6466}
6467
6468/// Specifies the resources used to actively manage an instance group.
6469#[derive(Clone, Default, PartialEq)]
6470#[non_exhaustive]
6471pub struct ManagedGroupConfig {
6472 /// Output only. The name of the Instance Template used for the Managed
6473 /// Instance Group.
6474 pub instance_template_name: std::string::String,
6475
6476 /// Output only. The name of the Instance Group Manager for this group.
6477 pub instance_group_manager_name: std::string::String,
6478
6479 /// Output only. The partial URI to the instance group manager for this group.
6480 /// E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
6481 pub instance_group_manager_uri: std::string::String,
6482
6483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6484}
6485
6486impl ManagedGroupConfig {
6487 /// Creates a new default instance.
6488 pub fn new() -> Self {
6489 std::default::Default::default()
6490 }
6491
6492 /// Sets the value of [instance_template_name][crate::model::ManagedGroupConfig::instance_template_name].
6493 ///
6494 /// # Example
6495 /// ```ignore,no_run
6496 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6497 /// let x = ManagedGroupConfig::new().set_instance_template_name("example");
6498 /// ```
6499 pub fn set_instance_template_name<T: std::convert::Into<std::string::String>>(
6500 mut self,
6501 v: T,
6502 ) -> Self {
6503 self.instance_template_name = v.into();
6504 self
6505 }
6506
6507 /// Sets the value of [instance_group_manager_name][crate::model::ManagedGroupConfig::instance_group_manager_name].
6508 ///
6509 /// # Example
6510 /// ```ignore,no_run
6511 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6512 /// let x = ManagedGroupConfig::new().set_instance_group_manager_name("example");
6513 /// ```
6514 pub fn set_instance_group_manager_name<T: std::convert::Into<std::string::String>>(
6515 mut self,
6516 v: T,
6517 ) -> Self {
6518 self.instance_group_manager_name = v.into();
6519 self
6520 }
6521
6522 /// Sets the value of [instance_group_manager_uri][crate::model::ManagedGroupConfig::instance_group_manager_uri].
6523 ///
6524 /// # Example
6525 /// ```ignore,no_run
6526 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6527 /// let x = ManagedGroupConfig::new().set_instance_group_manager_uri("example");
6528 /// ```
6529 pub fn set_instance_group_manager_uri<T: std::convert::Into<std::string::String>>(
6530 mut self,
6531 v: T,
6532 ) -> Self {
6533 self.instance_group_manager_uri = v.into();
6534 self
6535 }
6536}
6537
6538impl wkt::message::Message for ManagedGroupConfig {
6539 fn typename() -> &'static str {
6540 "type.googleapis.com/google.cloud.dataproc.v1.ManagedGroupConfig"
6541 }
6542}
6543
6544/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning
6545/// models.
6546#[derive(Clone, Default, PartialEq)]
6547#[non_exhaustive]
6548pub struct InstanceFlexibilityPolicy {
6549 /// Optional. Defines how the Group selects the provisioning model to ensure
6550 /// required reliability.
6551 pub provisioning_model_mix:
6552 std::option::Option<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6553
6554 /// Optional. List of instance selection options that the group will use when
6555 /// creating new VMs.
6556 pub instance_selection_list:
6557 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelection>,
6558
6559 /// Output only. A list of instance selection results in the group.
6560 pub instance_selection_results:
6561 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6562
6563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6564}
6565
6566impl InstanceFlexibilityPolicy {
6567 /// Creates a new default instance.
6568 pub fn new() -> Self {
6569 std::default::Default::default()
6570 }
6571
6572 /// Sets the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6573 ///
6574 /// # Example
6575 /// ```ignore,no_run
6576 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6577 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6578 /// let x = InstanceFlexibilityPolicy::new().set_provisioning_model_mix(ProvisioningModelMix::default()/* use setters */);
6579 /// ```
6580 pub fn set_provisioning_model_mix<T>(mut self, v: T) -> Self
6581 where
6582 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6583 {
6584 self.provisioning_model_mix = std::option::Option::Some(v.into());
6585 self
6586 }
6587
6588 /// Sets or clears the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6589 ///
6590 /// # Example
6591 /// ```ignore,no_run
6592 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6593 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6594 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(Some(ProvisioningModelMix::default()/* use setters */));
6595 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(None::<ProvisioningModelMix>);
6596 /// ```
6597 pub fn set_or_clear_provisioning_model_mix<T>(mut self, v: std::option::Option<T>) -> Self
6598 where
6599 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6600 {
6601 self.provisioning_model_mix = v.map(|x| x.into());
6602 self
6603 }
6604
6605 /// Sets the value of [instance_selection_list][crate::model::InstanceFlexibilityPolicy::instance_selection_list].
6606 ///
6607 /// # Example
6608 /// ```ignore,no_run
6609 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6610 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6611 /// let x = InstanceFlexibilityPolicy::new()
6612 /// .set_instance_selection_list([
6613 /// InstanceSelection::default()/* use setters */,
6614 /// InstanceSelection::default()/* use (different) setters */,
6615 /// ]);
6616 /// ```
6617 pub fn set_instance_selection_list<T, V>(mut self, v: T) -> Self
6618 where
6619 T: std::iter::IntoIterator<Item = V>,
6620 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelection>,
6621 {
6622 use std::iter::Iterator;
6623 self.instance_selection_list = v.into_iter().map(|i| i.into()).collect();
6624 self
6625 }
6626
6627 /// Sets the value of [instance_selection_results][crate::model::InstanceFlexibilityPolicy::instance_selection_results].
6628 ///
6629 /// # Example
6630 /// ```ignore,no_run
6631 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6632 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6633 /// let x = InstanceFlexibilityPolicy::new()
6634 /// .set_instance_selection_results([
6635 /// InstanceSelectionResult::default()/* use setters */,
6636 /// InstanceSelectionResult::default()/* use (different) setters */,
6637 /// ]);
6638 /// ```
6639 pub fn set_instance_selection_results<T, V>(mut self, v: T) -> Self
6640 where
6641 T: std::iter::IntoIterator<Item = V>,
6642 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6643 {
6644 use std::iter::Iterator;
6645 self.instance_selection_results = v.into_iter().map(|i| i.into()).collect();
6646 self
6647 }
6648}
6649
6650impl wkt::message::Message for InstanceFlexibilityPolicy {
6651 fn typename() -> &'static str {
6652 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy"
6653 }
6654}
6655
6656/// Defines additional types related to [InstanceFlexibilityPolicy].
6657pub mod instance_flexibility_policy {
6658 #[allow(unused_imports)]
6659 use super::*;
6660
6661 /// Defines how Dataproc should create VMs with a mixture of provisioning
6662 /// models.
6663 #[derive(Clone, Default, PartialEq)]
6664 #[non_exhaustive]
6665 pub struct ProvisioningModelMix {
6666 /// Optional. The base capacity that will always use Standard VMs to avoid
6667 /// risk of more preemption than the minimum capacity you need. Dataproc will
6668 /// create only standard VMs until it reaches standard_capacity_base, then it
6669 /// will start using standard_capacity_percent_above_base to mix Spot with
6670 /// Standard VMs. eg. If 15 instances are requested and
6671 /// standard_capacity_base is 5, Dataproc will create 5 standard VMs and then
6672 /// start mixing spot and standard VMs for remaining 10 instances.
6673 pub standard_capacity_base: std::option::Option<i32>,
6674
6675 /// Optional. The percentage of target capacity that should use Standard VM.
6676 /// The remaining percentage will use Spot VMs. The percentage applies only
6677 /// to the capacity above standard_capacity_base. eg. If 15 instances are
6678 /// requested and standard_capacity_base is 5 and
6679 /// standard_capacity_percent_above_base is 30, Dataproc will create 5
6680 /// standard VMs and then start mixing spot and standard VMs for remaining 10
6681 /// instances. The mix will be 30% standard and 70% spot.
6682 pub standard_capacity_percent_above_base: std::option::Option<i32>,
6683
6684 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6685 }
6686
6687 impl ProvisioningModelMix {
6688 /// Creates a new default instance.
6689 pub fn new() -> Self {
6690 std::default::Default::default()
6691 }
6692
6693 /// Sets the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6694 ///
6695 /// # Example
6696 /// ```ignore,no_run
6697 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6698 /// let x = ProvisioningModelMix::new().set_standard_capacity_base(42);
6699 /// ```
6700 pub fn set_standard_capacity_base<T>(mut self, v: T) -> Self
6701 where
6702 T: std::convert::Into<i32>,
6703 {
6704 self.standard_capacity_base = std::option::Option::Some(v.into());
6705 self
6706 }
6707
6708 /// Sets or clears the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6709 ///
6710 /// # Example
6711 /// ```ignore,no_run
6712 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6713 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(Some(42));
6714 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(None::<i32>);
6715 /// ```
6716 pub fn set_or_clear_standard_capacity_base<T>(mut self, v: std::option::Option<T>) -> Self
6717 where
6718 T: std::convert::Into<i32>,
6719 {
6720 self.standard_capacity_base = v.map(|x| x.into());
6721 self
6722 }
6723
6724 /// Sets the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6725 ///
6726 /// # Example
6727 /// ```ignore,no_run
6728 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6729 /// let x = ProvisioningModelMix::new().set_standard_capacity_percent_above_base(42);
6730 /// ```
6731 pub fn set_standard_capacity_percent_above_base<T>(mut self, v: T) -> Self
6732 where
6733 T: std::convert::Into<i32>,
6734 {
6735 self.standard_capacity_percent_above_base = std::option::Option::Some(v.into());
6736 self
6737 }
6738
6739 /// Sets or clears the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6740 ///
6741 /// # Example
6742 /// ```ignore,no_run
6743 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6744 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(Some(42));
6745 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(None::<i32>);
6746 /// ```
6747 pub fn set_or_clear_standard_capacity_percent_above_base<T>(
6748 mut self,
6749 v: std::option::Option<T>,
6750 ) -> Self
6751 where
6752 T: std::convert::Into<i32>,
6753 {
6754 self.standard_capacity_percent_above_base = v.map(|x| x.into());
6755 self
6756 }
6757 }
6758
6759 impl wkt::message::Message for ProvisioningModelMix {
6760 fn typename() -> &'static str {
6761 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.ProvisioningModelMix"
6762 }
6763 }
6764
6765 /// Defines machines types and a rank to which the machines types belong.
6766 #[derive(Clone, Default, PartialEq)]
6767 #[non_exhaustive]
6768 pub struct InstanceSelection {
6769 /// Optional. Full machine-type names, e.g. "n1-standard-16".
6770 pub machine_types: std::vec::Vec<std::string::String>,
6771
6772 /// Optional. Preference of this instance selection. Lower number means
6773 /// higher preference. Dataproc will first try to create a VM based on the
6774 /// machine-type with priority rank and fallback to next rank based on
6775 /// availability. Machine types and instance selections with the same
6776 /// priority have the same preference.
6777 pub rank: i32,
6778
6779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6780 }
6781
6782 impl InstanceSelection {
6783 /// Creates a new default instance.
6784 pub fn new() -> Self {
6785 std::default::Default::default()
6786 }
6787
6788 /// Sets the value of [machine_types][crate::model::instance_flexibility_policy::InstanceSelection::machine_types].
6789 ///
6790 /// # Example
6791 /// ```ignore,no_run
6792 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6793 /// let x = InstanceSelection::new().set_machine_types(["a", "b", "c"]);
6794 /// ```
6795 pub fn set_machine_types<T, V>(mut self, v: T) -> Self
6796 where
6797 T: std::iter::IntoIterator<Item = V>,
6798 V: std::convert::Into<std::string::String>,
6799 {
6800 use std::iter::Iterator;
6801 self.machine_types = v.into_iter().map(|i| i.into()).collect();
6802 self
6803 }
6804
6805 /// Sets the value of [rank][crate::model::instance_flexibility_policy::InstanceSelection::rank].
6806 ///
6807 /// # Example
6808 /// ```ignore,no_run
6809 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6810 /// let x = InstanceSelection::new().set_rank(42);
6811 /// ```
6812 pub fn set_rank<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6813 self.rank = v.into();
6814 self
6815 }
6816 }
6817
6818 impl wkt::message::Message for InstanceSelection {
6819 fn typename() -> &'static str {
6820 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelection"
6821 }
6822 }
6823
6824 /// Defines a mapping from machine types to the number of VMs that are created
6825 /// with each machine type.
6826 #[derive(Clone, Default, PartialEq)]
6827 #[non_exhaustive]
6828 pub struct InstanceSelectionResult {
6829 /// Output only. Full machine-type names, e.g. "n1-standard-16".
6830 pub machine_type: std::option::Option<std::string::String>,
6831
6832 /// Output only. Number of VM provisioned with the machine_type.
6833 pub vm_count: std::option::Option<i32>,
6834
6835 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6836 }
6837
6838 impl InstanceSelectionResult {
6839 /// Creates a new default instance.
6840 pub fn new() -> Self {
6841 std::default::Default::default()
6842 }
6843
6844 /// Sets the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6845 ///
6846 /// # Example
6847 /// ```ignore,no_run
6848 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6849 /// let x = InstanceSelectionResult::new().set_machine_type("example");
6850 /// ```
6851 pub fn set_machine_type<T>(mut self, v: T) -> Self
6852 where
6853 T: std::convert::Into<std::string::String>,
6854 {
6855 self.machine_type = std::option::Option::Some(v.into());
6856 self
6857 }
6858
6859 /// Sets or clears the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6860 ///
6861 /// # Example
6862 /// ```ignore,no_run
6863 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6864 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(Some("example"));
6865 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(None::<String>);
6866 /// ```
6867 pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
6868 where
6869 T: std::convert::Into<std::string::String>,
6870 {
6871 self.machine_type = v.map(|x| x.into());
6872 self
6873 }
6874
6875 /// Sets the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6876 ///
6877 /// # Example
6878 /// ```ignore,no_run
6879 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6880 /// let x = InstanceSelectionResult::new().set_vm_count(42);
6881 /// ```
6882 pub fn set_vm_count<T>(mut self, v: T) -> Self
6883 where
6884 T: std::convert::Into<i32>,
6885 {
6886 self.vm_count = std::option::Option::Some(v.into());
6887 self
6888 }
6889
6890 /// Sets or clears the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6891 ///
6892 /// # Example
6893 /// ```ignore,no_run
6894 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6895 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(Some(42));
6896 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(None::<i32>);
6897 /// ```
6898 pub fn set_or_clear_vm_count<T>(mut self, v: std::option::Option<T>) -> Self
6899 where
6900 T: std::convert::Into<i32>,
6901 {
6902 self.vm_count = v.map(|x| x.into());
6903 self
6904 }
6905 }
6906
6907 impl wkt::message::Message for InstanceSelectionResult {
6908 fn typename() -> &'static str {
6909 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelectionResult"
6910 }
6911 }
6912}
6913
6914/// Specifies the type and number of accelerator cards attached to the instances
6915/// of an instance. See [GPUs on Compute
6916/// Engine](https://cloud.google.com/compute/docs/gpus/).
6917#[derive(Clone, Default, PartialEq)]
6918#[non_exhaustive]
6919pub struct AcceleratorConfig {
6920 /// Full URL, partial URI, or short name of the accelerator type resource to
6921 /// expose to this instance. See
6922 /// [Compute Engine
6923 /// AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).
6924 ///
6925 /// Examples:
6926 ///
6927 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6928 /// * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6929 /// * `nvidia-tesla-t4`
6930 ///
6931 /// **Auto Zone Exception**: If you are using the Dataproc
6932 /// [Auto Zone
6933 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
6934 /// feature, you must use the short name of the accelerator type
6935 /// resource, for example, `nvidia-tesla-t4`.
6936 pub accelerator_type_uri: std::string::String,
6937
6938 /// The number of the accelerator cards of this type exposed to this instance.
6939 pub accelerator_count: i32,
6940
6941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6942}
6943
6944impl AcceleratorConfig {
6945 /// Creates a new default instance.
6946 pub fn new() -> Self {
6947 std::default::Default::default()
6948 }
6949
6950 /// Sets the value of [accelerator_type_uri][crate::model::AcceleratorConfig::accelerator_type_uri].
6951 ///
6952 /// # Example
6953 /// ```ignore,no_run
6954 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6955 /// let x = AcceleratorConfig::new().set_accelerator_type_uri("example");
6956 /// ```
6957 pub fn set_accelerator_type_uri<T: std::convert::Into<std::string::String>>(
6958 mut self,
6959 v: T,
6960 ) -> Self {
6961 self.accelerator_type_uri = v.into();
6962 self
6963 }
6964
6965 /// Sets the value of [accelerator_count][crate::model::AcceleratorConfig::accelerator_count].
6966 ///
6967 /// # Example
6968 /// ```ignore,no_run
6969 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6970 /// let x = AcceleratorConfig::new().set_accelerator_count(42);
6971 /// ```
6972 pub fn set_accelerator_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6973 self.accelerator_count = v.into();
6974 self
6975 }
6976}
6977
6978impl wkt::message::Message for AcceleratorConfig {
6979 fn typename() -> &'static str {
6980 "type.googleapis.com/google.cloud.dataproc.v1.AcceleratorConfig"
6981 }
6982}
6983
6984/// Specifies the config of disk options for a group of VM instances.
6985#[derive(Clone, Default, PartialEq)]
6986#[non_exhaustive]
6987pub struct DiskConfig {
6988 /// Optional. Type of the boot disk (default is "pd-standard").
6989 /// Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive),
6990 /// "pd-ssd" (Persistent Disk Solid State Drive),
6991 /// or "pd-standard" (Persistent Disk Hard Disk Drive).
6992 /// See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types).
6993 pub boot_disk_type: std::string::String,
6994
6995 /// Optional. Size in GB of the boot disk (default is 500GB).
6996 pub boot_disk_size_gb: i32,
6997
6998 /// Optional. Number of attached SSDs, from 0 to 8 (default is 0).
6999 /// If SSDs are not attached, the boot disk is used to store runtime logs and
7000 /// [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data.
7001 /// If one or more SSDs are attached, this runtime bulk
7002 /// data is spread across them, and the boot disk contains only basic
7003 /// config and installed binaries.
7004 ///
7005 /// Note: Local SSD options may vary by machine type and number of vCPUs
7006 /// selected.
7007 pub num_local_ssds: i32,
7008
7009 /// Optional. Interface type of local SSDs (default is "scsi").
7010 /// Valid values: "scsi" (Small Computer System Interface),
7011 /// "nvme" (Non-Volatile Memory Express).
7012 /// See [local SSD
7013 /// performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance).
7014 pub local_ssd_interface: std::string::String,
7015
7016 /// Optional. Indicates how many IOPS to provision for the disk. This sets the
7017 /// number of I/O operations per second that the disk can handle. Note: This
7018 /// field is only supported if boot_disk_type is hyperdisk-balanced.
7019 pub boot_disk_provisioned_iops: std::option::Option<i64>,
7020
7021 /// Optional. Indicates how much throughput to provision for the disk. This
7022 /// sets the number of throughput mb per second that the disk can handle.
7023 /// Values must be greater than or equal to 1. Note: This field is only
7024 /// supported if boot_disk_type is hyperdisk-balanced.
7025 pub boot_disk_provisioned_throughput: std::option::Option<i64>,
7026
7027 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7028}
7029
7030impl DiskConfig {
7031 /// Creates a new default instance.
7032 pub fn new() -> Self {
7033 std::default::Default::default()
7034 }
7035
7036 /// Sets the value of [boot_disk_type][crate::model::DiskConfig::boot_disk_type].
7037 ///
7038 /// # Example
7039 /// ```ignore,no_run
7040 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7041 /// let x = DiskConfig::new().set_boot_disk_type("example");
7042 /// ```
7043 pub fn set_boot_disk_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7044 self.boot_disk_type = v.into();
7045 self
7046 }
7047
7048 /// Sets the value of [boot_disk_size_gb][crate::model::DiskConfig::boot_disk_size_gb].
7049 ///
7050 /// # Example
7051 /// ```ignore,no_run
7052 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7053 /// let x = DiskConfig::new().set_boot_disk_size_gb(42);
7054 /// ```
7055 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7056 self.boot_disk_size_gb = v.into();
7057 self
7058 }
7059
7060 /// Sets the value of [num_local_ssds][crate::model::DiskConfig::num_local_ssds].
7061 ///
7062 /// # Example
7063 /// ```ignore,no_run
7064 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7065 /// let x = DiskConfig::new().set_num_local_ssds(42);
7066 /// ```
7067 pub fn set_num_local_ssds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7068 self.num_local_ssds = v.into();
7069 self
7070 }
7071
7072 /// Sets the value of [local_ssd_interface][crate::model::DiskConfig::local_ssd_interface].
7073 ///
7074 /// # Example
7075 /// ```ignore,no_run
7076 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7077 /// let x = DiskConfig::new().set_local_ssd_interface("example");
7078 /// ```
7079 pub fn set_local_ssd_interface<T: std::convert::Into<std::string::String>>(
7080 mut self,
7081 v: T,
7082 ) -> Self {
7083 self.local_ssd_interface = v.into();
7084 self
7085 }
7086
7087 /// Sets the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
7088 ///
7089 /// # Example
7090 /// ```ignore,no_run
7091 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7092 /// let x = DiskConfig::new().set_boot_disk_provisioned_iops(42);
7093 /// ```
7094 pub fn set_boot_disk_provisioned_iops<T>(mut self, v: T) -> Self
7095 where
7096 T: std::convert::Into<i64>,
7097 {
7098 self.boot_disk_provisioned_iops = std::option::Option::Some(v.into());
7099 self
7100 }
7101
7102 /// Sets or clears the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
7103 ///
7104 /// # Example
7105 /// ```ignore,no_run
7106 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7107 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(Some(42));
7108 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(None::<i32>);
7109 /// ```
7110 pub fn set_or_clear_boot_disk_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
7111 where
7112 T: std::convert::Into<i64>,
7113 {
7114 self.boot_disk_provisioned_iops = v.map(|x| x.into());
7115 self
7116 }
7117
7118 /// Sets the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
7119 ///
7120 /// # Example
7121 /// ```ignore,no_run
7122 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7123 /// let x = DiskConfig::new().set_boot_disk_provisioned_throughput(42);
7124 /// ```
7125 pub fn set_boot_disk_provisioned_throughput<T>(mut self, v: T) -> Self
7126 where
7127 T: std::convert::Into<i64>,
7128 {
7129 self.boot_disk_provisioned_throughput = std::option::Option::Some(v.into());
7130 self
7131 }
7132
7133 /// Sets or clears the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
7134 ///
7135 /// # Example
7136 /// ```ignore,no_run
7137 /// # use google_cloud_dataproc_v1::model::DiskConfig;
7138 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(Some(42));
7139 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(None::<i32>);
7140 /// ```
7141 pub fn set_or_clear_boot_disk_provisioned_throughput<T>(
7142 mut self,
7143 v: std::option::Option<T>,
7144 ) -> Self
7145 where
7146 T: std::convert::Into<i64>,
7147 {
7148 self.boot_disk_provisioned_throughput = v.map(|x| x.into());
7149 self
7150 }
7151}
7152
7153impl wkt::message::Message for DiskConfig {
7154 fn typename() -> &'static str {
7155 "type.googleapis.com/google.cloud.dataproc.v1.DiskConfig"
7156 }
7157}
7158
7159/// Node group identification and configuration information.
7160#[derive(Clone, Default, PartialEq)]
7161#[non_exhaustive]
7162pub struct AuxiliaryNodeGroup {
7163 /// Required. Node group configuration.
7164 pub node_group: std::option::Option<crate::model::NodeGroup>,
7165
7166 /// Optional. A node group ID. Generated if not specified.
7167 ///
7168 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
7169 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
7170 /// or hyphen. Must consist of from 3 to 33 characters.
7171 pub node_group_id: std::string::String,
7172
7173 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7174}
7175
7176impl AuxiliaryNodeGroup {
7177 /// Creates a new default instance.
7178 pub fn new() -> Self {
7179 std::default::Default::default()
7180 }
7181
7182 /// Sets the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
7183 ///
7184 /// # Example
7185 /// ```ignore,no_run
7186 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
7187 /// use google_cloud_dataproc_v1::model::NodeGroup;
7188 /// let x = AuxiliaryNodeGroup::new().set_node_group(NodeGroup::default()/* use setters */);
7189 /// ```
7190 pub fn set_node_group<T>(mut self, v: T) -> Self
7191 where
7192 T: std::convert::Into<crate::model::NodeGroup>,
7193 {
7194 self.node_group = std::option::Option::Some(v.into());
7195 self
7196 }
7197
7198 /// Sets or clears the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
7199 ///
7200 /// # Example
7201 /// ```ignore,no_run
7202 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
7203 /// use google_cloud_dataproc_v1::model::NodeGroup;
7204 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
7205 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(None::<NodeGroup>);
7206 /// ```
7207 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
7208 where
7209 T: std::convert::Into<crate::model::NodeGroup>,
7210 {
7211 self.node_group = v.map(|x| x.into());
7212 self
7213 }
7214
7215 /// Sets the value of [node_group_id][crate::model::AuxiliaryNodeGroup::node_group_id].
7216 ///
7217 /// # Example
7218 /// ```ignore,no_run
7219 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
7220 /// let x = AuxiliaryNodeGroup::new().set_node_group_id("example");
7221 /// ```
7222 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7223 self.node_group_id = v.into();
7224 self
7225 }
7226}
7227
7228impl wkt::message::Message for AuxiliaryNodeGroup {
7229 fn typename() -> &'static str {
7230 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryNodeGroup"
7231 }
7232}
7233
7234/// Dataproc Node Group.
7235/// **The Dataproc `NodeGroup` resource is not related to the
7236/// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity]
7237/// resource.**
7238///
7239/// [google.cloud.dataproc.v1.NodeGroupAffinity]: crate::model::NodeGroupAffinity
7240#[derive(Clone, Default, PartialEq)]
7241#[non_exhaustive]
7242pub struct NodeGroup {
7243 /// The Node group [resource name](https://aip.dev/122).
7244 pub name: std::string::String,
7245
7246 /// Required. Node group roles.
7247 pub roles: std::vec::Vec<crate::model::node_group::Role>,
7248
7249 /// Optional. The node group instance group configuration.
7250 pub node_group_config: std::option::Option<crate::model::InstanceGroupConfig>,
7251
7252 /// Optional. Node group labels.
7253 ///
7254 /// * Label **keys** must consist of from 1 to 63 characters and conform to
7255 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
7256 /// * Label **values** can be empty. If specified, they must consist of from
7257 /// 1 to 63 characters and conform to [RFC 1035]
7258 /// (<https://www.ietf.org/rfc/rfc1035.txt>).
7259 /// * The node group must have no more than 32 labels.
7260 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7261
7262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7263}
7264
7265impl NodeGroup {
7266 /// Creates a new default instance.
7267 pub fn new() -> Self {
7268 std::default::Default::default()
7269 }
7270
7271 /// Sets the value of [name][crate::model::NodeGroup::name].
7272 ///
7273 /// # Example
7274 /// ```ignore,no_run
7275 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7276 /// # let project_id = "project_id";
7277 /// # let region_id = "region_id";
7278 /// # let cluster_id = "cluster_id";
7279 /// # let node_group_id = "node_group_id";
7280 /// let x = NodeGroup::new().set_name(format!("projects/{project_id}/regions/{region_id}/clusters/{cluster_id}/nodeGroups/{node_group_id}"));
7281 /// ```
7282 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7283 self.name = v.into();
7284 self
7285 }
7286
7287 /// Sets the value of [roles][crate::model::NodeGroup::roles].
7288 ///
7289 /// # Example
7290 /// ```ignore,no_run
7291 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7292 /// use google_cloud_dataproc_v1::model::node_group::Role;
7293 /// let x = NodeGroup::new().set_roles([
7294 /// Role::Driver,
7295 /// ]);
7296 /// ```
7297 pub fn set_roles<T, V>(mut self, v: T) -> Self
7298 where
7299 T: std::iter::IntoIterator<Item = V>,
7300 V: std::convert::Into<crate::model::node_group::Role>,
7301 {
7302 use std::iter::Iterator;
7303 self.roles = v.into_iter().map(|i| i.into()).collect();
7304 self
7305 }
7306
7307 /// Sets the value of [node_group_config][crate::model::NodeGroup::node_group_config].
7308 ///
7309 /// # Example
7310 /// ```ignore,no_run
7311 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7312 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
7313 /// let x = NodeGroup::new().set_node_group_config(InstanceGroupConfig::default()/* use setters */);
7314 /// ```
7315 pub fn set_node_group_config<T>(mut self, v: T) -> Self
7316 where
7317 T: std::convert::Into<crate::model::InstanceGroupConfig>,
7318 {
7319 self.node_group_config = std::option::Option::Some(v.into());
7320 self
7321 }
7322
7323 /// Sets or clears the value of [node_group_config][crate::model::NodeGroup::node_group_config].
7324 ///
7325 /// # Example
7326 /// ```ignore,no_run
7327 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7328 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
7329 /// let x = NodeGroup::new().set_or_clear_node_group_config(Some(InstanceGroupConfig::default()/* use setters */));
7330 /// let x = NodeGroup::new().set_or_clear_node_group_config(None::<InstanceGroupConfig>);
7331 /// ```
7332 pub fn set_or_clear_node_group_config<T>(mut self, v: std::option::Option<T>) -> Self
7333 where
7334 T: std::convert::Into<crate::model::InstanceGroupConfig>,
7335 {
7336 self.node_group_config = v.map(|x| x.into());
7337 self
7338 }
7339
7340 /// Sets the value of [labels][crate::model::NodeGroup::labels].
7341 ///
7342 /// # Example
7343 /// ```ignore,no_run
7344 /// # use google_cloud_dataproc_v1::model::NodeGroup;
7345 /// let x = NodeGroup::new().set_labels([
7346 /// ("key0", "abc"),
7347 /// ("key1", "xyz"),
7348 /// ]);
7349 /// ```
7350 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7351 where
7352 T: std::iter::IntoIterator<Item = (K, V)>,
7353 K: std::convert::Into<std::string::String>,
7354 V: std::convert::Into<std::string::String>,
7355 {
7356 use std::iter::Iterator;
7357 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7358 self
7359 }
7360}
7361
7362impl wkt::message::Message for NodeGroup {
7363 fn typename() -> &'static str {
7364 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroup"
7365 }
7366}
7367
7368/// Defines additional types related to [NodeGroup].
7369pub mod node_group {
7370 #[allow(unused_imports)]
7371 use super::*;
7372
7373 /// Node pool roles.
7374 ///
7375 /// # Working with unknown values
7376 ///
7377 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7378 /// additional enum variants at any time. Adding new variants is not considered
7379 /// a breaking change. Applications should write their code in anticipation of:
7380 ///
7381 /// - New values appearing in future releases of the client library, **and**
7382 /// - New values received dynamically, without application changes.
7383 ///
7384 /// Please consult the [Working with enums] section in the user guide for some
7385 /// guidelines.
7386 ///
7387 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7388 #[derive(Clone, Debug, PartialEq)]
7389 #[non_exhaustive]
7390 pub enum Role {
7391 /// Required unspecified role.
7392 Unspecified,
7393 /// Job drivers run on the node pool.
7394 Driver,
7395 /// If set, the enum was initialized with an unknown value.
7396 ///
7397 /// Applications can examine the value using [Role::value] or
7398 /// [Role::name].
7399 UnknownValue(role::UnknownValue),
7400 }
7401
7402 #[doc(hidden)]
7403 pub mod role {
7404 #[allow(unused_imports)]
7405 use super::*;
7406 #[derive(Clone, Debug, PartialEq)]
7407 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7408 }
7409
7410 impl Role {
7411 /// Gets the enum value.
7412 ///
7413 /// Returns `None` if the enum contains an unknown value deserialized from
7414 /// the string representation of enums.
7415 pub fn value(&self) -> std::option::Option<i32> {
7416 match self {
7417 Self::Unspecified => std::option::Option::Some(0),
7418 Self::Driver => std::option::Option::Some(1),
7419 Self::UnknownValue(u) => u.0.value(),
7420 }
7421 }
7422
7423 /// Gets the enum value as a string.
7424 ///
7425 /// Returns `None` if the enum contains an unknown value deserialized from
7426 /// the integer representation of enums.
7427 pub fn name(&self) -> std::option::Option<&str> {
7428 match self {
7429 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
7430 Self::Driver => std::option::Option::Some("DRIVER"),
7431 Self::UnknownValue(u) => u.0.name(),
7432 }
7433 }
7434 }
7435
7436 impl std::default::Default for Role {
7437 fn default() -> Self {
7438 use std::convert::From;
7439 Self::from(0)
7440 }
7441 }
7442
7443 impl std::fmt::Display for Role {
7444 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7445 wkt::internal::display_enum(f, self.name(), self.value())
7446 }
7447 }
7448
7449 impl std::convert::From<i32> for Role {
7450 fn from(value: i32) -> Self {
7451 match value {
7452 0 => Self::Unspecified,
7453 1 => Self::Driver,
7454 _ => Self::UnknownValue(role::UnknownValue(
7455 wkt::internal::UnknownEnumValue::Integer(value),
7456 )),
7457 }
7458 }
7459 }
7460
7461 impl std::convert::From<&str> for Role {
7462 fn from(value: &str) -> Self {
7463 use std::string::ToString;
7464 match value {
7465 "ROLE_UNSPECIFIED" => Self::Unspecified,
7466 "DRIVER" => Self::Driver,
7467 _ => Self::UnknownValue(role::UnknownValue(
7468 wkt::internal::UnknownEnumValue::String(value.to_string()),
7469 )),
7470 }
7471 }
7472 }
7473
7474 impl serde::ser::Serialize for Role {
7475 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7476 where
7477 S: serde::Serializer,
7478 {
7479 match self {
7480 Self::Unspecified => serializer.serialize_i32(0),
7481 Self::Driver => serializer.serialize_i32(1),
7482 Self::UnknownValue(u) => u.0.serialize(serializer),
7483 }
7484 }
7485 }
7486
7487 impl<'de> serde::de::Deserialize<'de> for Role {
7488 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7489 where
7490 D: serde::Deserializer<'de>,
7491 {
7492 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
7493 ".google.cloud.dataproc.v1.NodeGroup.Role",
7494 ))
7495 }
7496 }
7497}
7498
7499/// Specifies an executable to run on a fully configured node and a
7500/// timeout period for executable completion.
7501#[derive(Clone, Default, PartialEq)]
7502#[non_exhaustive]
7503pub struct NodeInitializationAction {
7504 /// Required. Cloud Storage URI of executable file.
7505 pub executable_file: std::string::String,
7506
7507 /// Optional. Amount of time executable has to complete. Default is
7508 /// 10 minutes (see JSON representation of
7509 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7510 ///
7511 /// Cluster creation fails with an explanatory error message (the
7512 /// name of the executable that caused the error and the exceeded timeout
7513 /// period) if the executable is not completed at end of the timeout period.
7514 pub execution_timeout: std::option::Option<wkt::Duration>,
7515
7516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7517}
7518
7519impl NodeInitializationAction {
7520 /// Creates a new default instance.
7521 pub fn new() -> Self {
7522 std::default::Default::default()
7523 }
7524
7525 /// Sets the value of [executable_file][crate::model::NodeInitializationAction::executable_file].
7526 ///
7527 /// # Example
7528 /// ```ignore,no_run
7529 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7530 /// let x = NodeInitializationAction::new().set_executable_file("example");
7531 /// ```
7532 pub fn set_executable_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7533 self.executable_file = v.into();
7534 self
7535 }
7536
7537 /// Sets the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7538 ///
7539 /// # Example
7540 /// ```ignore,no_run
7541 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7542 /// use wkt::Duration;
7543 /// let x = NodeInitializationAction::new().set_execution_timeout(Duration::default()/* use setters */);
7544 /// ```
7545 pub fn set_execution_timeout<T>(mut self, v: T) -> Self
7546 where
7547 T: std::convert::Into<wkt::Duration>,
7548 {
7549 self.execution_timeout = std::option::Option::Some(v.into());
7550 self
7551 }
7552
7553 /// Sets or clears the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7554 ///
7555 /// # Example
7556 /// ```ignore,no_run
7557 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7558 /// use wkt::Duration;
7559 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
7560 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(None::<Duration>);
7561 /// ```
7562 pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7563 where
7564 T: std::convert::Into<wkt::Duration>,
7565 {
7566 self.execution_timeout = v.map(|x| x.into());
7567 self
7568 }
7569}
7570
7571impl wkt::message::Message for NodeInitializationAction {
7572 fn typename() -> &'static str {
7573 "type.googleapis.com/google.cloud.dataproc.v1.NodeInitializationAction"
7574 }
7575}
7576
7577/// The status of a cluster and its instances.
7578#[derive(Clone, Default, PartialEq)]
7579#[non_exhaustive]
7580pub struct ClusterStatus {
7581 /// Output only. The cluster's state.
7582 pub state: crate::model::cluster_status::State,
7583
7584 /// Optional. Output only. Details of cluster's state.
7585 pub detail: std::string::String,
7586
7587 /// Output only. Time when this state was entered (see JSON representation of
7588 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7589 pub state_start_time: std::option::Option<wkt::Timestamp>,
7590
7591 /// Output only. Additional state information that includes
7592 /// status reported by the agent.
7593 pub substate: crate::model::cluster_status::Substate,
7594
7595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7596}
7597
7598impl ClusterStatus {
7599 /// Creates a new default instance.
7600 pub fn new() -> Self {
7601 std::default::Default::default()
7602 }
7603
7604 /// Sets the value of [state][crate::model::ClusterStatus::state].
7605 ///
7606 /// # Example
7607 /// ```ignore,no_run
7608 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7609 /// use google_cloud_dataproc_v1::model::cluster_status::State;
7610 /// let x0 = ClusterStatus::new().set_state(State::Creating);
7611 /// let x1 = ClusterStatus::new().set_state(State::Running);
7612 /// let x2 = ClusterStatus::new().set_state(State::Error);
7613 /// ```
7614 pub fn set_state<T: std::convert::Into<crate::model::cluster_status::State>>(
7615 mut self,
7616 v: T,
7617 ) -> Self {
7618 self.state = v.into();
7619 self
7620 }
7621
7622 /// Sets the value of [detail][crate::model::ClusterStatus::detail].
7623 ///
7624 /// # Example
7625 /// ```ignore,no_run
7626 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7627 /// let x = ClusterStatus::new().set_detail("example");
7628 /// ```
7629 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7630 self.detail = v.into();
7631 self
7632 }
7633
7634 /// Sets the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7635 ///
7636 /// # Example
7637 /// ```ignore,no_run
7638 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7639 /// use wkt::Timestamp;
7640 /// let x = ClusterStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
7641 /// ```
7642 pub fn set_state_start_time<T>(mut self, v: T) -> Self
7643 where
7644 T: std::convert::Into<wkt::Timestamp>,
7645 {
7646 self.state_start_time = std::option::Option::Some(v.into());
7647 self
7648 }
7649
7650 /// Sets or clears the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7651 ///
7652 /// # Example
7653 /// ```ignore,no_run
7654 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7655 /// use wkt::Timestamp;
7656 /// let x = ClusterStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
7657 /// let x = ClusterStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
7658 /// ```
7659 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7660 where
7661 T: std::convert::Into<wkt::Timestamp>,
7662 {
7663 self.state_start_time = v.map(|x| x.into());
7664 self
7665 }
7666
7667 /// Sets the value of [substate][crate::model::ClusterStatus::substate].
7668 ///
7669 /// # Example
7670 /// ```ignore,no_run
7671 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7672 /// use google_cloud_dataproc_v1::model::cluster_status::Substate;
7673 /// let x0 = ClusterStatus::new().set_substate(Substate::Unhealthy);
7674 /// let x1 = ClusterStatus::new().set_substate(Substate::StaleStatus);
7675 /// ```
7676 pub fn set_substate<T: std::convert::Into<crate::model::cluster_status::Substate>>(
7677 mut self,
7678 v: T,
7679 ) -> Self {
7680 self.substate = v.into();
7681 self
7682 }
7683}
7684
7685impl wkt::message::Message for ClusterStatus {
7686 fn typename() -> &'static str {
7687 "type.googleapis.com/google.cloud.dataproc.v1.ClusterStatus"
7688 }
7689}
7690
7691/// Defines additional types related to [ClusterStatus].
7692pub mod cluster_status {
7693 #[allow(unused_imports)]
7694 use super::*;
7695
7696 /// The cluster state.
7697 ///
7698 /// # Working with unknown values
7699 ///
7700 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7701 /// additional enum variants at any time. Adding new variants is not considered
7702 /// a breaking change. Applications should write their code in anticipation of:
7703 ///
7704 /// - New values appearing in future releases of the client library, **and**
7705 /// - New values received dynamically, without application changes.
7706 ///
7707 /// Please consult the [Working with enums] section in the user guide for some
7708 /// guidelines.
7709 ///
7710 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7711 #[derive(Clone, Debug, PartialEq)]
7712 #[non_exhaustive]
7713 pub enum State {
7714 /// The cluster state is unknown.
7715 Unknown,
7716 /// The cluster is being created and set up. It is not ready for use.
7717 Creating,
7718 /// The cluster is currently running and healthy. It is ready for use.
7719 ///
7720 /// **Note:** The cluster state changes from "creating" to "running" status
7721 /// after the master node(s), first two primary worker nodes (and the last
7722 /// primary worker node if primary workers > 2) are running.
7723 Running,
7724 /// The cluster encountered an error. It is not ready for use.
7725 Error,
7726 /// The cluster has encountered an error while being updated. Jobs can
7727 /// be submitted to the cluster, but the cluster cannot be updated.
7728 ErrorDueToUpdate,
7729 /// The cluster is being deleted. It cannot be used.
7730 Deleting,
7731 /// The cluster is being updated. It continues to accept and process jobs.
7732 Updating,
7733 /// The cluster is being stopped. It cannot be used.
7734 Stopping,
7735 /// The cluster is currently stopped. It is not ready for use.
7736 Stopped,
7737 /// The cluster is being started. It is not ready for use.
7738 Starting,
7739 /// The cluster is being repaired. It is not ready for use.
7740 Repairing,
7741 /// If set, the enum was initialized with an unknown value.
7742 ///
7743 /// Applications can examine the value using [State::value] or
7744 /// [State::name].
7745 UnknownValue(state::UnknownValue),
7746 }
7747
7748 #[doc(hidden)]
7749 pub mod state {
7750 #[allow(unused_imports)]
7751 use super::*;
7752 #[derive(Clone, Debug, PartialEq)]
7753 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7754 }
7755
7756 impl State {
7757 /// Gets the enum value.
7758 ///
7759 /// Returns `None` if the enum contains an unknown value deserialized from
7760 /// the string representation of enums.
7761 pub fn value(&self) -> std::option::Option<i32> {
7762 match self {
7763 Self::Unknown => std::option::Option::Some(0),
7764 Self::Creating => std::option::Option::Some(1),
7765 Self::Running => std::option::Option::Some(2),
7766 Self::Error => std::option::Option::Some(3),
7767 Self::ErrorDueToUpdate => std::option::Option::Some(9),
7768 Self::Deleting => std::option::Option::Some(4),
7769 Self::Updating => std::option::Option::Some(5),
7770 Self::Stopping => std::option::Option::Some(6),
7771 Self::Stopped => std::option::Option::Some(7),
7772 Self::Starting => std::option::Option::Some(8),
7773 Self::Repairing => std::option::Option::Some(10),
7774 Self::UnknownValue(u) => u.0.value(),
7775 }
7776 }
7777
7778 /// Gets the enum value as a string.
7779 ///
7780 /// Returns `None` if the enum contains an unknown value deserialized from
7781 /// the integer representation of enums.
7782 pub fn name(&self) -> std::option::Option<&str> {
7783 match self {
7784 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7785 Self::Creating => std::option::Option::Some("CREATING"),
7786 Self::Running => std::option::Option::Some("RUNNING"),
7787 Self::Error => std::option::Option::Some("ERROR"),
7788 Self::ErrorDueToUpdate => std::option::Option::Some("ERROR_DUE_TO_UPDATE"),
7789 Self::Deleting => std::option::Option::Some("DELETING"),
7790 Self::Updating => std::option::Option::Some("UPDATING"),
7791 Self::Stopping => std::option::Option::Some("STOPPING"),
7792 Self::Stopped => std::option::Option::Some("STOPPED"),
7793 Self::Starting => std::option::Option::Some("STARTING"),
7794 Self::Repairing => std::option::Option::Some("REPAIRING"),
7795 Self::UnknownValue(u) => u.0.name(),
7796 }
7797 }
7798 }
7799
7800 impl std::default::Default for State {
7801 fn default() -> Self {
7802 use std::convert::From;
7803 Self::from(0)
7804 }
7805 }
7806
7807 impl std::fmt::Display for State {
7808 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7809 wkt::internal::display_enum(f, self.name(), self.value())
7810 }
7811 }
7812
7813 impl std::convert::From<i32> for State {
7814 fn from(value: i32) -> Self {
7815 match value {
7816 0 => Self::Unknown,
7817 1 => Self::Creating,
7818 2 => Self::Running,
7819 3 => Self::Error,
7820 4 => Self::Deleting,
7821 5 => Self::Updating,
7822 6 => Self::Stopping,
7823 7 => Self::Stopped,
7824 8 => Self::Starting,
7825 9 => Self::ErrorDueToUpdate,
7826 10 => Self::Repairing,
7827 _ => Self::UnknownValue(state::UnknownValue(
7828 wkt::internal::UnknownEnumValue::Integer(value),
7829 )),
7830 }
7831 }
7832 }
7833
7834 impl std::convert::From<&str> for State {
7835 fn from(value: &str) -> Self {
7836 use std::string::ToString;
7837 match value {
7838 "UNKNOWN" => Self::Unknown,
7839 "CREATING" => Self::Creating,
7840 "RUNNING" => Self::Running,
7841 "ERROR" => Self::Error,
7842 "ERROR_DUE_TO_UPDATE" => Self::ErrorDueToUpdate,
7843 "DELETING" => Self::Deleting,
7844 "UPDATING" => Self::Updating,
7845 "STOPPING" => Self::Stopping,
7846 "STOPPED" => Self::Stopped,
7847 "STARTING" => Self::Starting,
7848 "REPAIRING" => Self::Repairing,
7849 _ => Self::UnknownValue(state::UnknownValue(
7850 wkt::internal::UnknownEnumValue::String(value.to_string()),
7851 )),
7852 }
7853 }
7854 }
7855
7856 impl serde::ser::Serialize for State {
7857 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7858 where
7859 S: serde::Serializer,
7860 {
7861 match self {
7862 Self::Unknown => serializer.serialize_i32(0),
7863 Self::Creating => serializer.serialize_i32(1),
7864 Self::Running => serializer.serialize_i32(2),
7865 Self::Error => serializer.serialize_i32(3),
7866 Self::ErrorDueToUpdate => serializer.serialize_i32(9),
7867 Self::Deleting => serializer.serialize_i32(4),
7868 Self::Updating => serializer.serialize_i32(5),
7869 Self::Stopping => serializer.serialize_i32(6),
7870 Self::Stopped => serializer.serialize_i32(7),
7871 Self::Starting => serializer.serialize_i32(8),
7872 Self::Repairing => serializer.serialize_i32(10),
7873 Self::UnknownValue(u) => u.0.serialize(serializer),
7874 }
7875 }
7876 }
7877
7878 impl<'de> serde::de::Deserialize<'de> for State {
7879 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7880 where
7881 D: serde::Deserializer<'de>,
7882 {
7883 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7884 ".google.cloud.dataproc.v1.ClusterStatus.State",
7885 ))
7886 }
7887 }
7888
7889 /// The cluster substate.
7890 ///
7891 /// # Working with unknown values
7892 ///
7893 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7894 /// additional enum variants at any time. Adding new variants is not considered
7895 /// a breaking change. Applications should write their code in anticipation of:
7896 ///
7897 /// - New values appearing in future releases of the client library, **and**
7898 /// - New values received dynamically, without application changes.
7899 ///
7900 /// Please consult the [Working with enums] section in the user guide for some
7901 /// guidelines.
7902 ///
7903 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7904 #[derive(Clone, Debug, PartialEq)]
7905 #[non_exhaustive]
7906 pub enum Substate {
7907 /// The cluster substate is unknown.
7908 Unspecified,
7909 /// The cluster is known to be in an unhealthy state
7910 /// (for example, critical daemons are not running or HDFS capacity is
7911 /// exhausted).
7912 ///
7913 /// Applies to RUNNING state.
7914 Unhealthy,
7915 /// The agent-reported status is out of date (may occur if
7916 /// Dataproc loses communication with Agent).
7917 ///
7918 /// Applies to RUNNING state.
7919 StaleStatus,
7920 /// If set, the enum was initialized with an unknown value.
7921 ///
7922 /// Applications can examine the value using [Substate::value] or
7923 /// [Substate::name].
7924 UnknownValue(substate::UnknownValue),
7925 }
7926
7927 #[doc(hidden)]
7928 pub mod substate {
7929 #[allow(unused_imports)]
7930 use super::*;
7931 #[derive(Clone, Debug, PartialEq)]
7932 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7933 }
7934
7935 impl Substate {
7936 /// Gets the enum value.
7937 ///
7938 /// Returns `None` if the enum contains an unknown value deserialized from
7939 /// the string representation of enums.
7940 pub fn value(&self) -> std::option::Option<i32> {
7941 match self {
7942 Self::Unspecified => std::option::Option::Some(0),
7943 Self::Unhealthy => std::option::Option::Some(1),
7944 Self::StaleStatus => std::option::Option::Some(2),
7945 Self::UnknownValue(u) => u.0.value(),
7946 }
7947 }
7948
7949 /// Gets the enum value as a string.
7950 ///
7951 /// Returns `None` if the enum contains an unknown value deserialized from
7952 /// the integer representation of enums.
7953 pub fn name(&self) -> std::option::Option<&str> {
7954 match self {
7955 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
7956 Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
7957 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
7958 Self::UnknownValue(u) => u.0.name(),
7959 }
7960 }
7961 }
7962
7963 impl std::default::Default for Substate {
7964 fn default() -> Self {
7965 use std::convert::From;
7966 Self::from(0)
7967 }
7968 }
7969
7970 impl std::fmt::Display for Substate {
7971 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7972 wkt::internal::display_enum(f, self.name(), self.value())
7973 }
7974 }
7975
7976 impl std::convert::From<i32> for Substate {
7977 fn from(value: i32) -> Self {
7978 match value {
7979 0 => Self::Unspecified,
7980 1 => Self::Unhealthy,
7981 2 => Self::StaleStatus,
7982 _ => Self::UnknownValue(substate::UnknownValue(
7983 wkt::internal::UnknownEnumValue::Integer(value),
7984 )),
7985 }
7986 }
7987 }
7988
7989 impl std::convert::From<&str> for Substate {
7990 fn from(value: &str) -> Self {
7991 use std::string::ToString;
7992 match value {
7993 "UNSPECIFIED" => Self::Unspecified,
7994 "UNHEALTHY" => Self::Unhealthy,
7995 "STALE_STATUS" => Self::StaleStatus,
7996 _ => Self::UnknownValue(substate::UnknownValue(
7997 wkt::internal::UnknownEnumValue::String(value.to_string()),
7998 )),
7999 }
8000 }
8001 }
8002
8003 impl serde::ser::Serialize for Substate {
8004 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8005 where
8006 S: serde::Serializer,
8007 {
8008 match self {
8009 Self::Unspecified => serializer.serialize_i32(0),
8010 Self::Unhealthy => serializer.serialize_i32(1),
8011 Self::StaleStatus => serializer.serialize_i32(2),
8012 Self::UnknownValue(u) => u.0.serialize(serializer),
8013 }
8014 }
8015 }
8016
8017 impl<'de> serde::de::Deserialize<'de> for Substate {
8018 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8019 where
8020 D: serde::Deserializer<'de>,
8021 {
8022 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
8023 ".google.cloud.dataproc.v1.ClusterStatus.Substate",
8024 ))
8025 }
8026 }
8027}
8028
8029/// Security related configuration, including encryption, Kerberos, etc.
8030#[derive(Clone, Default, PartialEq)]
8031#[non_exhaustive]
8032pub struct SecurityConfig {
8033 /// Optional. Kerberos related configuration.
8034 pub kerberos_config: std::option::Option<crate::model::KerberosConfig>,
8035
8036 /// Optional. Identity related configuration, including service account based
8037 /// secure multi-tenancy user mappings.
8038 pub identity_config: std::option::Option<crate::model::IdentityConfig>,
8039
8040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8041}
8042
8043impl SecurityConfig {
8044 /// Creates a new default instance.
8045 pub fn new() -> Self {
8046 std::default::Default::default()
8047 }
8048
8049 /// Sets the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
8050 ///
8051 /// # Example
8052 /// ```ignore,no_run
8053 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8054 /// use google_cloud_dataproc_v1::model::KerberosConfig;
8055 /// let x = SecurityConfig::new().set_kerberos_config(KerberosConfig::default()/* use setters */);
8056 /// ```
8057 pub fn set_kerberos_config<T>(mut self, v: T) -> Self
8058 where
8059 T: std::convert::Into<crate::model::KerberosConfig>,
8060 {
8061 self.kerberos_config = std::option::Option::Some(v.into());
8062 self
8063 }
8064
8065 /// Sets or clears the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
8066 ///
8067 /// # Example
8068 /// ```ignore,no_run
8069 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8070 /// use google_cloud_dataproc_v1::model::KerberosConfig;
8071 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(Some(KerberosConfig::default()/* use setters */));
8072 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(None::<KerberosConfig>);
8073 /// ```
8074 pub fn set_or_clear_kerberos_config<T>(mut self, v: std::option::Option<T>) -> Self
8075 where
8076 T: std::convert::Into<crate::model::KerberosConfig>,
8077 {
8078 self.kerberos_config = v.map(|x| x.into());
8079 self
8080 }
8081
8082 /// Sets the value of [identity_config][crate::model::SecurityConfig::identity_config].
8083 ///
8084 /// # Example
8085 /// ```ignore,no_run
8086 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8087 /// use google_cloud_dataproc_v1::model::IdentityConfig;
8088 /// let x = SecurityConfig::new().set_identity_config(IdentityConfig::default()/* use setters */);
8089 /// ```
8090 pub fn set_identity_config<T>(mut self, v: T) -> Self
8091 where
8092 T: std::convert::Into<crate::model::IdentityConfig>,
8093 {
8094 self.identity_config = std::option::Option::Some(v.into());
8095 self
8096 }
8097
8098 /// Sets or clears the value of [identity_config][crate::model::SecurityConfig::identity_config].
8099 ///
8100 /// # Example
8101 /// ```ignore,no_run
8102 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
8103 /// use google_cloud_dataproc_v1::model::IdentityConfig;
8104 /// let x = SecurityConfig::new().set_or_clear_identity_config(Some(IdentityConfig::default()/* use setters */));
8105 /// let x = SecurityConfig::new().set_or_clear_identity_config(None::<IdentityConfig>);
8106 /// ```
8107 pub fn set_or_clear_identity_config<T>(mut self, v: std::option::Option<T>) -> Self
8108 where
8109 T: std::convert::Into<crate::model::IdentityConfig>,
8110 {
8111 self.identity_config = v.map(|x| x.into());
8112 self
8113 }
8114}
8115
8116impl wkt::message::Message for SecurityConfig {
8117 fn typename() -> &'static str {
8118 "type.googleapis.com/google.cloud.dataproc.v1.SecurityConfig"
8119 }
8120}
8121
8122/// Specifies Kerberos related configuration.
8123#[derive(Clone, Default, PartialEq)]
8124#[non_exhaustive]
8125pub struct KerberosConfig {
8126 /// Optional. Flag to indicate whether to Kerberize the cluster (default:
8127 /// false). Set this field to true to enable Kerberos on a cluster.
8128 pub enable_kerberos: bool,
8129
8130 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root
8131 /// principal password.
8132 pub root_principal_password_uri: std::string::String,
8133
8134 /// Optional. The URI of the KMS key used to encrypt sensitive
8135 /// files.
8136 pub kms_key_uri: std::string::String,
8137
8138 /// Optional. The Cloud Storage URI of the keystore file used for SSL
8139 /// encryption. If not provided, Dataproc will provide a self-signed
8140 /// certificate.
8141 pub keystore_uri: std::string::String,
8142
8143 /// Optional. The Cloud Storage URI of the truststore file used for SSL
8144 /// encryption. If not provided, Dataproc will provide a self-signed
8145 /// certificate.
8146 pub truststore_uri: std::string::String,
8147
8148 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8149 /// password to the user provided keystore. For the self-signed certificate,
8150 /// this password is generated by Dataproc.
8151 pub keystore_password_uri: std::string::String,
8152
8153 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8154 /// password to the user provided key. For the self-signed certificate, this
8155 /// password is generated by Dataproc.
8156 pub key_password_uri: std::string::String,
8157
8158 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8159 /// password to the user provided truststore. For the self-signed certificate,
8160 /// this password is generated by Dataproc.
8161 pub truststore_password_uri: std::string::String,
8162
8163 /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should
8164 /// the user enable cross realm trust.
8165 pub cross_realm_trust_realm: std::string::String,
8166
8167 /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross
8168 /// realm trust relationship.
8169 pub cross_realm_trust_kdc: std::string::String,
8170
8171 /// Optional. The admin server (IP or hostname) for the remote trusted realm in
8172 /// a cross realm trust relationship.
8173 pub cross_realm_trust_admin_server: std::string::String,
8174
8175 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8176 /// shared password between the on-cluster Kerberos realm and the remote
8177 /// trusted realm, in a cross realm trust relationship.
8178 pub cross_realm_trust_shared_password_uri: std::string::String,
8179
8180 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
8181 /// master key of the KDC database.
8182 pub kdc_db_key_uri: std::string::String,
8183
8184 /// Optional. The lifetime of the ticket granting ticket, in hours.
8185 /// If not specified, or user specifies 0, then default value 10
8186 /// will be used.
8187 pub tgt_lifetime_hours: i32,
8188
8189 /// Optional. The name of the on-cluster Kerberos realm.
8190 /// If not specified, the uppercased domain of hostnames will be the realm.
8191 pub realm: std::string::String,
8192
8193 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8194}
8195
8196impl KerberosConfig {
8197 /// Creates a new default instance.
8198 pub fn new() -> Self {
8199 std::default::Default::default()
8200 }
8201
8202 /// Sets the value of [enable_kerberos][crate::model::KerberosConfig::enable_kerberos].
8203 ///
8204 /// # Example
8205 /// ```ignore,no_run
8206 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8207 /// let x = KerberosConfig::new().set_enable_kerberos(true);
8208 /// ```
8209 pub fn set_enable_kerberos<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8210 self.enable_kerberos = v.into();
8211 self
8212 }
8213
8214 /// Sets the value of [root_principal_password_uri][crate::model::KerberosConfig::root_principal_password_uri].
8215 ///
8216 /// # Example
8217 /// ```ignore,no_run
8218 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8219 /// let x = KerberosConfig::new().set_root_principal_password_uri("example");
8220 /// ```
8221 pub fn set_root_principal_password_uri<T: std::convert::Into<std::string::String>>(
8222 mut self,
8223 v: T,
8224 ) -> Self {
8225 self.root_principal_password_uri = v.into();
8226 self
8227 }
8228
8229 /// Sets the value of [kms_key_uri][crate::model::KerberosConfig::kms_key_uri].
8230 ///
8231 /// # Example
8232 /// ```ignore,no_run
8233 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8234 /// let x = KerberosConfig::new().set_kms_key_uri("example");
8235 /// ```
8236 pub fn set_kms_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8237 self.kms_key_uri = v.into();
8238 self
8239 }
8240
8241 /// Sets the value of [keystore_uri][crate::model::KerberosConfig::keystore_uri].
8242 ///
8243 /// # Example
8244 /// ```ignore,no_run
8245 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8246 /// let x = KerberosConfig::new().set_keystore_uri("example");
8247 /// ```
8248 pub fn set_keystore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8249 self.keystore_uri = v.into();
8250 self
8251 }
8252
8253 /// Sets the value of [truststore_uri][crate::model::KerberosConfig::truststore_uri].
8254 ///
8255 /// # Example
8256 /// ```ignore,no_run
8257 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8258 /// let x = KerberosConfig::new().set_truststore_uri("example");
8259 /// ```
8260 pub fn set_truststore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8261 self.truststore_uri = v.into();
8262 self
8263 }
8264
8265 /// Sets the value of [keystore_password_uri][crate::model::KerberosConfig::keystore_password_uri].
8266 ///
8267 /// # Example
8268 /// ```ignore,no_run
8269 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8270 /// let x = KerberosConfig::new().set_keystore_password_uri("example");
8271 /// ```
8272 pub fn set_keystore_password_uri<T: std::convert::Into<std::string::String>>(
8273 mut self,
8274 v: T,
8275 ) -> Self {
8276 self.keystore_password_uri = v.into();
8277 self
8278 }
8279
8280 /// Sets the value of [key_password_uri][crate::model::KerberosConfig::key_password_uri].
8281 ///
8282 /// # Example
8283 /// ```ignore,no_run
8284 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8285 /// let x = KerberosConfig::new().set_key_password_uri("example");
8286 /// ```
8287 pub fn set_key_password_uri<T: std::convert::Into<std::string::String>>(
8288 mut self,
8289 v: T,
8290 ) -> Self {
8291 self.key_password_uri = v.into();
8292 self
8293 }
8294
8295 /// Sets the value of [truststore_password_uri][crate::model::KerberosConfig::truststore_password_uri].
8296 ///
8297 /// # Example
8298 /// ```ignore,no_run
8299 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8300 /// let x = KerberosConfig::new().set_truststore_password_uri("example");
8301 /// ```
8302 pub fn set_truststore_password_uri<T: std::convert::Into<std::string::String>>(
8303 mut self,
8304 v: T,
8305 ) -> Self {
8306 self.truststore_password_uri = v.into();
8307 self
8308 }
8309
8310 /// Sets the value of [cross_realm_trust_realm][crate::model::KerberosConfig::cross_realm_trust_realm].
8311 ///
8312 /// # Example
8313 /// ```ignore,no_run
8314 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8315 /// let x = KerberosConfig::new().set_cross_realm_trust_realm("example");
8316 /// ```
8317 pub fn set_cross_realm_trust_realm<T: std::convert::Into<std::string::String>>(
8318 mut self,
8319 v: T,
8320 ) -> Self {
8321 self.cross_realm_trust_realm = v.into();
8322 self
8323 }
8324
8325 /// Sets the value of [cross_realm_trust_kdc][crate::model::KerberosConfig::cross_realm_trust_kdc].
8326 ///
8327 /// # Example
8328 /// ```ignore,no_run
8329 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8330 /// let x = KerberosConfig::new().set_cross_realm_trust_kdc("example");
8331 /// ```
8332 pub fn set_cross_realm_trust_kdc<T: std::convert::Into<std::string::String>>(
8333 mut self,
8334 v: T,
8335 ) -> Self {
8336 self.cross_realm_trust_kdc = v.into();
8337 self
8338 }
8339
8340 /// Sets the value of [cross_realm_trust_admin_server][crate::model::KerberosConfig::cross_realm_trust_admin_server].
8341 ///
8342 /// # Example
8343 /// ```ignore,no_run
8344 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8345 /// let x = KerberosConfig::new().set_cross_realm_trust_admin_server("example");
8346 /// ```
8347 pub fn set_cross_realm_trust_admin_server<T: std::convert::Into<std::string::String>>(
8348 mut self,
8349 v: T,
8350 ) -> Self {
8351 self.cross_realm_trust_admin_server = v.into();
8352 self
8353 }
8354
8355 /// Sets the value of [cross_realm_trust_shared_password_uri][crate::model::KerberosConfig::cross_realm_trust_shared_password_uri].
8356 ///
8357 /// # Example
8358 /// ```ignore,no_run
8359 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8360 /// let x = KerberosConfig::new().set_cross_realm_trust_shared_password_uri("example");
8361 /// ```
8362 pub fn set_cross_realm_trust_shared_password_uri<T: std::convert::Into<std::string::String>>(
8363 mut self,
8364 v: T,
8365 ) -> Self {
8366 self.cross_realm_trust_shared_password_uri = v.into();
8367 self
8368 }
8369
8370 /// Sets the value of [kdc_db_key_uri][crate::model::KerberosConfig::kdc_db_key_uri].
8371 ///
8372 /// # Example
8373 /// ```ignore,no_run
8374 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8375 /// let x = KerberosConfig::new().set_kdc_db_key_uri("example");
8376 /// ```
8377 pub fn set_kdc_db_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8378 self.kdc_db_key_uri = v.into();
8379 self
8380 }
8381
8382 /// Sets the value of [tgt_lifetime_hours][crate::model::KerberosConfig::tgt_lifetime_hours].
8383 ///
8384 /// # Example
8385 /// ```ignore,no_run
8386 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8387 /// let x = KerberosConfig::new().set_tgt_lifetime_hours(42);
8388 /// ```
8389 pub fn set_tgt_lifetime_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8390 self.tgt_lifetime_hours = v.into();
8391 self
8392 }
8393
8394 /// Sets the value of [realm][crate::model::KerberosConfig::realm].
8395 ///
8396 /// # Example
8397 /// ```ignore,no_run
8398 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
8399 /// let x = KerberosConfig::new().set_realm("example");
8400 /// ```
8401 pub fn set_realm<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8402 self.realm = v.into();
8403 self
8404 }
8405}
8406
8407impl wkt::message::Message for KerberosConfig {
8408 fn typename() -> &'static str {
8409 "type.googleapis.com/google.cloud.dataproc.v1.KerberosConfig"
8410 }
8411}
8412
8413/// Identity related configuration, including service account based
8414/// secure multi-tenancy user mappings.
8415#[derive(Clone, Default, PartialEq)]
8416#[non_exhaustive]
8417pub struct IdentityConfig {
8418 /// Required. Map of user to service account.
8419 pub user_service_account_mapping:
8420 std::collections::HashMap<std::string::String, std::string::String>,
8421
8422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8423}
8424
8425impl IdentityConfig {
8426 /// Creates a new default instance.
8427 pub fn new() -> Self {
8428 std::default::Default::default()
8429 }
8430
8431 /// Sets the value of [user_service_account_mapping][crate::model::IdentityConfig::user_service_account_mapping].
8432 ///
8433 /// # Example
8434 /// ```ignore,no_run
8435 /// # use google_cloud_dataproc_v1::model::IdentityConfig;
8436 /// let x = IdentityConfig::new().set_user_service_account_mapping([
8437 /// ("key0", "abc"),
8438 /// ("key1", "xyz"),
8439 /// ]);
8440 /// ```
8441 pub fn set_user_service_account_mapping<T, K, V>(mut self, v: T) -> Self
8442 where
8443 T: std::iter::IntoIterator<Item = (K, V)>,
8444 K: std::convert::Into<std::string::String>,
8445 V: std::convert::Into<std::string::String>,
8446 {
8447 use std::iter::Iterator;
8448 self.user_service_account_mapping =
8449 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8450 self
8451 }
8452}
8453
8454impl wkt::message::Message for IdentityConfig {
8455 fn typename() -> &'static str {
8456 "type.googleapis.com/google.cloud.dataproc.v1.IdentityConfig"
8457 }
8458}
8459
8460/// Specifies the selection and config of software inside the cluster.
8461#[derive(Clone, Default, PartialEq)]
8462#[non_exhaustive]
8463pub struct SoftwareConfig {
8464 /// Optional. The version of software inside the cluster. It must be one of the
8465 /// supported [Dataproc
8466 /// Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported-dataproc-image-versions),
8467 /// such as "1.2" (including a subminor version, such as "1.2.29"), or the
8468 /// ["preview"
8469 /// version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
8470 /// If unspecified, it defaults to the latest Debian version.
8471 pub image_version: std::string::String,
8472
8473 /// Optional. The properties to set on daemon config files.
8474 ///
8475 /// Property keys are specified in `prefix:property` format, for example
8476 /// `core:hadoop.tmp.dir`. The following are supported prefixes
8477 /// and their mappings:
8478 ///
8479 /// * capacity-scheduler: `capacity-scheduler.xml`
8480 /// * core: `core-site.xml`
8481 /// * distcp: `distcp-default.xml`
8482 /// * hdfs: `hdfs-site.xml`
8483 /// * hive: `hive-site.xml`
8484 /// * mapred: `mapred-site.xml`
8485 /// * pig: `pig.properties`
8486 /// * spark: `spark-defaults.conf`
8487 /// * yarn: `yarn-site.xml`
8488 ///
8489 /// For more information, see [Cluster
8490 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
8491 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
8492
8493 /// Optional. The set of components to activate on the cluster.
8494 pub optional_components: std::vec::Vec<crate::model::Component>,
8495
8496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8497}
8498
8499impl SoftwareConfig {
8500 /// Creates a new default instance.
8501 pub fn new() -> Self {
8502 std::default::Default::default()
8503 }
8504
8505 /// Sets the value of [image_version][crate::model::SoftwareConfig::image_version].
8506 ///
8507 /// # Example
8508 /// ```ignore,no_run
8509 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8510 /// let x = SoftwareConfig::new().set_image_version("example");
8511 /// ```
8512 pub fn set_image_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8513 self.image_version = v.into();
8514 self
8515 }
8516
8517 /// Sets the value of [properties][crate::model::SoftwareConfig::properties].
8518 ///
8519 /// # Example
8520 /// ```ignore,no_run
8521 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8522 /// let x = SoftwareConfig::new().set_properties([
8523 /// ("key0", "abc"),
8524 /// ("key1", "xyz"),
8525 /// ]);
8526 /// ```
8527 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
8528 where
8529 T: std::iter::IntoIterator<Item = (K, V)>,
8530 K: std::convert::Into<std::string::String>,
8531 V: std::convert::Into<std::string::String>,
8532 {
8533 use std::iter::Iterator;
8534 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8535 self
8536 }
8537
8538 /// Sets the value of [optional_components][crate::model::SoftwareConfig::optional_components].
8539 ///
8540 /// # Example
8541 /// ```ignore,no_run
8542 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8543 /// use google_cloud_dataproc_v1::model::Component;
8544 /// let x = SoftwareConfig::new().set_optional_components([
8545 /// Component::Anaconda,
8546 /// Component::Delta,
8547 /// Component::Docker,
8548 /// ]);
8549 /// ```
8550 pub fn set_optional_components<T, V>(mut self, v: T) -> Self
8551 where
8552 T: std::iter::IntoIterator<Item = V>,
8553 V: std::convert::Into<crate::model::Component>,
8554 {
8555 use std::iter::Iterator;
8556 self.optional_components = v.into_iter().map(|i| i.into()).collect();
8557 self
8558 }
8559}
8560
8561impl wkt::message::Message for SoftwareConfig {
8562 fn typename() -> &'static str {
8563 "type.googleapis.com/google.cloud.dataproc.v1.SoftwareConfig"
8564 }
8565}
8566
8567/// Specifies the cluster auto-delete schedule configuration.
8568#[derive(Clone, Default, PartialEq)]
8569#[non_exhaustive]
8570pub struct LifecycleConfig {
8571 /// Optional. The duration to keep the cluster alive while idling (when no jobs
8572 /// are running). Passing this threshold will cause the cluster to be
8573 /// deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON
8574 /// representation of
8575 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8576 pub idle_delete_ttl: std::option::Option<wkt::Duration>,
8577
8578 /// Optional. The duration to keep the cluster started while idling (when no
8579 /// jobs are running). Passing this threshold will cause the cluster to be
8580 /// stopped. Minimum value is 5 minutes; maximum value is 14 days (see JSON
8581 /// representation of
8582 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8583 pub idle_stop_ttl: std::option::Option<wkt::Duration>,
8584
8585 /// Output only. The time when cluster became idle (most recent job finished)
8586 /// and became eligible for deletion due to idleness (see JSON representation
8587 /// of
8588 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8589 pub idle_start_time: std::option::Option<wkt::Timestamp>,
8590
8591 /// Either the exact time the cluster should be deleted at or
8592 /// the cluster maximum age.
8593 pub ttl: std::option::Option<crate::model::lifecycle_config::Ttl>,
8594
8595 /// Either the exact time the cluster should be stopped at or
8596 /// the cluster maximum age.
8597 pub stop_ttl: std::option::Option<crate::model::lifecycle_config::StopTtl>,
8598
8599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8600}
8601
8602impl LifecycleConfig {
8603 /// Creates a new default instance.
8604 pub fn new() -> Self {
8605 std::default::Default::default()
8606 }
8607
8608 /// Sets the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8609 ///
8610 /// # Example
8611 /// ```ignore,no_run
8612 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8613 /// use wkt::Duration;
8614 /// let x = LifecycleConfig::new().set_idle_delete_ttl(Duration::default()/* use setters */);
8615 /// ```
8616 pub fn set_idle_delete_ttl<T>(mut self, v: T) -> Self
8617 where
8618 T: std::convert::Into<wkt::Duration>,
8619 {
8620 self.idle_delete_ttl = std::option::Option::Some(v.into());
8621 self
8622 }
8623
8624 /// Sets or clears the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8625 ///
8626 /// # Example
8627 /// ```ignore,no_run
8628 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8629 /// use wkt::Duration;
8630 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(Some(Duration::default()/* use setters */));
8631 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(None::<Duration>);
8632 /// ```
8633 pub fn set_or_clear_idle_delete_ttl<T>(mut self, v: std::option::Option<T>) -> Self
8634 where
8635 T: std::convert::Into<wkt::Duration>,
8636 {
8637 self.idle_delete_ttl = v.map(|x| x.into());
8638 self
8639 }
8640
8641 /// Sets the value of [idle_stop_ttl][crate::model::LifecycleConfig::idle_stop_ttl].
8642 ///
8643 /// # Example
8644 /// ```ignore,no_run
8645 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8646 /// use wkt::Duration;
8647 /// let x = LifecycleConfig::new().set_idle_stop_ttl(Duration::default()/* use setters */);
8648 /// ```
8649 pub fn set_idle_stop_ttl<T>(mut self, v: T) -> Self
8650 where
8651 T: std::convert::Into<wkt::Duration>,
8652 {
8653 self.idle_stop_ttl = std::option::Option::Some(v.into());
8654 self
8655 }
8656
8657 /// Sets or clears the value of [idle_stop_ttl][crate::model::LifecycleConfig::idle_stop_ttl].
8658 ///
8659 /// # Example
8660 /// ```ignore,no_run
8661 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8662 /// use wkt::Duration;
8663 /// let x = LifecycleConfig::new().set_or_clear_idle_stop_ttl(Some(Duration::default()/* use setters */));
8664 /// let x = LifecycleConfig::new().set_or_clear_idle_stop_ttl(None::<Duration>);
8665 /// ```
8666 pub fn set_or_clear_idle_stop_ttl<T>(mut self, v: std::option::Option<T>) -> Self
8667 where
8668 T: std::convert::Into<wkt::Duration>,
8669 {
8670 self.idle_stop_ttl = v.map(|x| x.into());
8671 self
8672 }
8673
8674 /// Sets the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8675 ///
8676 /// # Example
8677 /// ```ignore,no_run
8678 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8679 /// use wkt::Timestamp;
8680 /// let x = LifecycleConfig::new().set_idle_start_time(Timestamp::default()/* use setters */);
8681 /// ```
8682 pub fn set_idle_start_time<T>(mut self, v: T) -> Self
8683 where
8684 T: std::convert::Into<wkt::Timestamp>,
8685 {
8686 self.idle_start_time = std::option::Option::Some(v.into());
8687 self
8688 }
8689
8690 /// Sets or clears the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8691 ///
8692 /// # Example
8693 /// ```ignore,no_run
8694 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8695 /// use wkt::Timestamp;
8696 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(Some(Timestamp::default()/* use setters */));
8697 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(None::<Timestamp>);
8698 /// ```
8699 pub fn set_or_clear_idle_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8700 where
8701 T: std::convert::Into<wkt::Timestamp>,
8702 {
8703 self.idle_start_time = v.map(|x| x.into());
8704 self
8705 }
8706
8707 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl].
8708 ///
8709 /// Note that all the setters affecting `ttl` are mutually
8710 /// exclusive.
8711 ///
8712 /// # Example
8713 /// ```ignore,no_run
8714 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8715 /// use wkt::Timestamp;
8716 /// let x = LifecycleConfig::new().set_ttl(Some(
8717 /// google_cloud_dataproc_v1::model::lifecycle_config::Ttl::AutoDeleteTime(Timestamp::default().into())));
8718 /// ```
8719 pub fn set_ttl<
8720 T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::Ttl>>,
8721 >(
8722 mut self,
8723 v: T,
8724 ) -> Self {
8725 self.ttl = v.into();
8726 self
8727 }
8728
8729 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8730 /// if it holds a `AutoDeleteTime`, `None` if the field is not set or
8731 /// holds a different branch.
8732 pub fn auto_delete_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
8733 #[allow(unreachable_patterns)]
8734 self.ttl.as_ref().and_then(|v| match v {
8735 crate::model::lifecycle_config::Ttl::AutoDeleteTime(v) => std::option::Option::Some(v),
8736 _ => std::option::Option::None,
8737 })
8738 }
8739
8740 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8741 /// to hold a `AutoDeleteTime`.
8742 ///
8743 /// Note that all the setters affecting `ttl` are
8744 /// mutually exclusive.
8745 ///
8746 /// # Example
8747 /// ```ignore,no_run
8748 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8749 /// use wkt::Timestamp;
8750 /// let x = LifecycleConfig::new().set_auto_delete_time(Timestamp::default()/* use setters */);
8751 /// assert!(x.auto_delete_time().is_some());
8752 /// assert!(x.auto_delete_ttl().is_none());
8753 /// ```
8754 pub fn set_auto_delete_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
8755 mut self,
8756 v: T,
8757 ) -> Self {
8758 self.ttl = std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTime(
8759 v.into(),
8760 ));
8761 self
8762 }
8763
8764 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8765 /// if it holds a `AutoDeleteTtl`, `None` if the field is not set or
8766 /// holds a different branch.
8767 pub fn auto_delete_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
8768 #[allow(unreachable_patterns)]
8769 self.ttl.as_ref().and_then(|v| match v {
8770 crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v) => std::option::Option::Some(v),
8771 _ => std::option::Option::None,
8772 })
8773 }
8774
8775 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8776 /// to hold a `AutoDeleteTtl`.
8777 ///
8778 /// Note that all the setters affecting `ttl` are
8779 /// mutually exclusive.
8780 ///
8781 /// # Example
8782 /// ```ignore,no_run
8783 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8784 /// use wkt::Duration;
8785 /// let x = LifecycleConfig::new().set_auto_delete_ttl(Duration::default()/* use setters */);
8786 /// assert!(x.auto_delete_ttl().is_some());
8787 /// assert!(x.auto_delete_time().is_none());
8788 /// ```
8789 pub fn set_auto_delete_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
8790 mut self,
8791 v: T,
8792 ) -> Self {
8793 self.ttl =
8794 std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v.into()));
8795 self
8796 }
8797
8798 /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl].
8799 ///
8800 /// Note that all the setters affecting `stop_ttl` are mutually
8801 /// exclusive.
8802 ///
8803 /// # Example
8804 /// ```ignore,no_run
8805 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8806 /// use wkt::Timestamp;
8807 /// let x = LifecycleConfig::new().set_stop_ttl(Some(
8808 /// google_cloud_dataproc_v1::model::lifecycle_config::StopTtl::AutoStopTime(Timestamp::default().into())));
8809 /// ```
8810 pub fn set_stop_ttl<
8811 T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::StopTtl>>,
8812 >(
8813 mut self,
8814 v: T,
8815 ) -> Self {
8816 self.stop_ttl = v.into();
8817 self
8818 }
8819
8820 /// The value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8821 /// if it holds a `AutoStopTime`, `None` if the field is not set or
8822 /// holds a different branch.
8823 pub fn auto_stop_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
8824 #[allow(unreachable_patterns)]
8825 self.stop_ttl.as_ref().and_then(|v| match v {
8826 crate::model::lifecycle_config::StopTtl::AutoStopTime(v) => {
8827 std::option::Option::Some(v)
8828 }
8829 _ => std::option::Option::None,
8830 })
8831 }
8832
8833 /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8834 /// to hold a `AutoStopTime`.
8835 ///
8836 /// Note that all the setters affecting `stop_ttl` are
8837 /// mutually exclusive.
8838 ///
8839 /// # Example
8840 /// ```ignore,no_run
8841 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8842 /// use wkt::Timestamp;
8843 /// let x = LifecycleConfig::new().set_auto_stop_time(Timestamp::default()/* use setters */);
8844 /// assert!(x.auto_stop_time().is_some());
8845 /// assert!(x.auto_stop_ttl().is_none());
8846 /// ```
8847 pub fn set_auto_stop_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
8848 mut self,
8849 v: T,
8850 ) -> Self {
8851 self.stop_ttl = std::option::Option::Some(
8852 crate::model::lifecycle_config::StopTtl::AutoStopTime(v.into()),
8853 );
8854 self
8855 }
8856
8857 /// The value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8858 /// if it holds a `AutoStopTtl`, `None` if the field is not set or
8859 /// holds a different branch.
8860 pub fn auto_stop_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
8861 #[allow(unreachable_patterns)]
8862 self.stop_ttl.as_ref().and_then(|v| match v {
8863 crate::model::lifecycle_config::StopTtl::AutoStopTtl(v) => std::option::Option::Some(v),
8864 _ => std::option::Option::None,
8865 })
8866 }
8867
8868 /// Sets the value of [stop_ttl][crate::model::LifecycleConfig::stop_ttl]
8869 /// to hold a `AutoStopTtl`.
8870 ///
8871 /// Note that all the setters affecting `stop_ttl` are
8872 /// mutually exclusive.
8873 ///
8874 /// # Example
8875 /// ```ignore,no_run
8876 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8877 /// use wkt::Duration;
8878 /// let x = LifecycleConfig::new().set_auto_stop_ttl(Duration::default()/* use setters */);
8879 /// assert!(x.auto_stop_ttl().is_some());
8880 /// assert!(x.auto_stop_time().is_none());
8881 /// ```
8882 pub fn set_auto_stop_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
8883 mut self,
8884 v: T,
8885 ) -> Self {
8886 self.stop_ttl = std::option::Option::Some(
8887 crate::model::lifecycle_config::StopTtl::AutoStopTtl(v.into()),
8888 );
8889 self
8890 }
8891}
8892
8893impl wkt::message::Message for LifecycleConfig {
8894 fn typename() -> &'static str {
8895 "type.googleapis.com/google.cloud.dataproc.v1.LifecycleConfig"
8896 }
8897}
8898
8899/// Defines additional types related to [LifecycleConfig].
8900pub mod lifecycle_config {
8901 #[allow(unused_imports)]
8902 use super::*;
8903
8904 /// Either the exact time the cluster should be deleted at or
8905 /// the cluster maximum age.
8906 #[derive(Clone, Debug, PartialEq)]
8907 #[non_exhaustive]
8908 pub enum Ttl {
8909 /// Optional. The time when cluster will be auto-deleted (see JSON
8910 /// representation of
8911 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8912 AutoDeleteTime(std::boxed::Box<wkt::Timestamp>),
8913 /// Optional. The lifetime duration of cluster. The cluster will be
8914 /// auto-deleted at the end of this period. Minimum value is 10 minutes;
8915 /// maximum value is 14 days (see JSON representation of
8916 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8917 AutoDeleteTtl(std::boxed::Box<wkt::Duration>),
8918 }
8919
8920 /// Either the exact time the cluster should be stopped at or
8921 /// the cluster maximum age.
8922 #[derive(Clone, Debug, PartialEq)]
8923 #[non_exhaustive]
8924 pub enum StopTtl {
8925 /// Optional. The time when cluster will be auto-stopped (see JSON
8926 /// representation of
8927 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8928 AutoStopTime(std::boxed::Box<wkt::Timestamp>),
8929 /// Optional. The lifetime duration of the cluster. The cluster will be
8930 /// auto-stopped at the end of this period, calculated from the time of
8931 /// submission of the create or update cluster request. Minimum value is 10
8932 /// minutes; maximum value is 14 days (see JSON representation of
8933 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8934 AutoStopTtl(std::boxed::Box<wkt::Duration>),
8935 }
8936}
8937
8938/// Specifies a Metastore configuration.
8939#[derive(Clone, Default, PartialEq)]
8940#[non_exhaustive]
8941pub struct MetastoreConfig {
8942 /// Required. Resource name of an existing Dataproc Metastore service.
8943 ///
8944 /// Example:
8945 ///
8946 /// * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]`
8947 pub dataproc_metastore_service: std::string::String,
8948
8949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8950}
8951
8952impl MetastoreConfig {
8953 /// Creates a new default instance.
8954 pub fn new() -> Self {
8955 std::default::Default::default()
8956 }
8957
8958 /// Sets the value of [dataproc_metastore_service][crate::model::MetastoreConfig::dataproc_metastore_service].
8959 ///
8960 /// # Example
8961 /// ```ignore,no_run
8962 /// # use google_cloud_dataproc_v1::model::MetastoreConfig;
8963 /// let x = MetastoreConfig::new().set_dataproc_metastore_service("example");
8964 /// ```
8965 pub fn set_dataproc_metastore_service<T: std::convert::Into<std::string::String>>(
8966 mut self,
8967 v: T,
8968 ) -> Self {
8969 self.dataproc_metastore_service = v.into();
8970 self
8971 }
8972}
8973
8974impl wkt::message::Message for MetastoreConfig {
8975 fn typename() -> &'static str {
8976 "type.googleapis.com/google.cloud.dataproc.v1.MetastoreConfig"
8977 }
8978}
8979
8980/// Contains cluster daemon metrics, such as HDFS and YARN stats.
8981///
8982/// **Beta Feature**: This report is available for testing purposes only. It may
8983/// be changed before final release.
8984#[derive(Clone, Default, PartialEq)]
8985#[non_exhaustive]
8986pub struct ClusterMetrics {
8987 /// The HDFS metrics.
8988 pub hdfs_metrics: std::collections::HashMap<std::string::String, i64>,
8989
8990 /// YARN metrics.
8991 pub yarn_metrics: std::collections::HashMap<std::string::String, i64>,
8992
8993 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8994}
8995
8996impl ClusterMetrics {
8997 /// Creates a new default instance.
8998 pub fn new() -> Self {
8999 std::default::Default::default()
9000 }
9001
9002 /// Sets the value of [hdfs_metrics][crate::model::ClusterMetrics::hdfs_metrics].
9003 ///
9004 /// # Example
9005 /// ```ignore,no_run
9006 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
9007 /// let x = ClusterMetrics::new().set_hdfs_metrics([
9008 /// ("key0", 123),
9009 /// ("key1", 456),
9010 /// ]);
9011 /// ```
9012 pub fn set_hdfs_metrics<T, K, V>(mut self, v: T) -> Self
9013 where
9014 T: std::iter::IntoIterator<Item = (K, V)>,
9015 K: std::convert::Into<std::string::String>,
9016 V: std::convert::Into<i64>,
9017 {
9018 use std::iter::Iterator;
9019 self.hdfs_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9020 self
9021 }
9022
9023 /// Sets the value of [yarn_metrics][crate::model::ClusterMetrics::yarn_metrics].
9024 ///
9025 /// # Example
9026 /// ```ignore,no_run
9027 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
9028 /// let x = ClusterMetrics::new().set_yarn_metrics([
9029 /// ("key0", 123),
9030 /// ("key1", 456),
9031 /// ]);
9032 /// ```
9033 pub fn set_yarn_metrics<T, K, V>(mut self, v: T) -> Self
9034 where
9035 T: std::iter::IntoIterator<Item = (K, V)>,
9036 K: std::convert::Into<std::string::String>,
9037 V: std::convert::Into<i64>,
9038 {
9039 use std::iter::Iterator;
9040 self.yarn_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9041 self
9042 }
9043}
9044
9045impl wkt::message::Message for ClusterMetrics {
9046 fn typename() -> &'static str {
9047 "type.googleapis.com/google.cloud.dataproc.v1.ClusterMetrics"
9048 }
9049}
9050
9051/// Dataproc metric config.
9052#[derive(Clone, Default, PartialEq)]
9053#[non_exhaustive]
9054pub struct DataprocMetricConfig {
9055 /// Required. Metrics sources to enable.
9056 pub metrics: std::vec::Vec<crate::model::dataproc_metric_config::Metric>,
9057
9058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9059}
9060
9061impl DataprocMetricConfig {
9062 /// Creates a new default instance.
9063 pub fn new() -> Self {
9064 std::default::Default::default()
9065 }
9066
9067 /// Sets the value of [metrics][crate::model::DataprocMetricConfig::metrics].
9068 ///
9069 /// # Example
9070 /// ```ignore,no_run
9071 /// # use google_cloud_dataproc_v1::model::DataprocMetricConfig;
9072 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
9073 /// let x = DataprocMetricConfig::new()
9074 /// .set_metrics([
9075 /// Metric::default()/* use setters */,
9076 /// Metric::default()/* use (different) setters */,
9077 /// ]);
9078 /// ```
9079 pub fn set_metrics<T, V>(mut self, v: T) -> Self
9080 where
9081 T: std::iter::IntoIterator<Item = V>,
9082 V: std::convert::Into<crate::model::dataproc_metric_config::Metric>,
9083 {
9084 use std::iter::Iterator;
9085 self.metrics = v.into_iter().map(|i| i.into()).collect();
9086 self
9087 }
9088}
9089
9090impl wkt::message::Message for DataprocMetricConfig {
9091 fn typename() -> &'static str {
9092 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig"
9093 }
9094}
9095
9096/// Defines additional types related to [DataprocMetricConfig].
9097pub mod dataproc_metric_config {
9098 #[allow(unused_imports)]
9099 use super::*;
9100
9101 /// A Dataproc custom metric.
9102 #[derive(Clone, Default, PartialEq)]
9103 #[non_exhaustive]
9104 pub struct Metric {
9105 /// Required. A standard set of metrics is collected unless `metricOverrides`
9106 /// are specified for the metric source (see [Custom metrics]
9107 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
9108 /// for more information).
9109 pub metric_source: crate::model::dataproc_metric_config::MetricSource,
9110
9111 /// Optional. Specify one or more [Custom metrics]
9112 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
9113 /// to collect for the metric course (for the `SPARK` metric source (any
9114 /// [Spark metric]
9115 /// (<https://spark.apache.org/docs/latest/monitoring.html#metrics>) can be
9116 /// specified).
9117 ///
9118 /// Provide metrics in the following format:
9119 /// \<code\>\<var\>METRIC_SOURCE\</var\>:\<var\>INSTANCE\</var\>:\<var\>GROUP\</var\>:\<var\>METRIC\</var\>\</code\>
9120 /// Use camelcase as appropriate.
9121 ///
9122 /// Examples:
9123 ///
9124 /// ```norust
9125 /// yarn:ResourceManager:QueueMetrics:AppsCompleted
9126 /// spark:driver:DAGScheduler:job.allJobs
9127 /// sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed
9128 /// hiveserver2:JVM:Memory:NonHeapMemoryUsage.used
9129 /// ```
9130 ///
9131 /// Notes:
9132 ///
9133 /// * Only the specified overridden metrics are collected for the
9134 /// metric source. For example, if one or more `spark:executive` metrics
9135 /// are listed as metric overrides, other `SPARK` metrics are not
9136 /// collected. The collection of the metrics for other enabled custom
9137 /// metric sources is unaffected. For example, if both `SPARK` andd `YARN`
9138 /// metric sources are enabled, and overrides are provided for Spark
9139 /// metrics only, all YARN metrics are collected.
9140 pub metric_overrides: std::vec::Vec<std::string::String>,
9141
9142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9143 }
9144
9145 impl Metric {
9146 /// Creates a new default instance.
9147 pub fn new() -> Self {
9148 std::default::Default::default()
9149 }
9150
9151 /// Sets the value of [metric_source][crate::model::dataproc_metric_config::Metric::metric_source].
9152 ///
9153 /// # Example
9154 /// ```ignore,no_run
9155 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
9156 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::MetricSource;
9157 /// let x0 = Metric::new().set_metric_source(MetricSource::MonitoringAgentDefaults);
9158 /// let x1 = Metric::new().set_metric_source(MetricSource::Hdfs);
9159 /// let x2 = Metric::new().set_metric_source(MetricSource::Spark);
9160 /// ```
9161 pub fn set_metric_source<
9162 T: std::convert::Into<crate::model::dataproc_metric_config::MetricSource>,
9163 >(
9164 mut self,
9165 v: T,
9166 ) -> Self {
9167 self.metric_source = v.into();
9168 self
9169 }
9170
9171 /// Sets the value of [metric_overrides][crate::model::dataproc_metric_config::Metric::metric_overrides].
9172 ///
9173 /// # Example
9174 /// ```ignore,no_run
9175 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
9176 /// let x = Metric::new().set_metric_overrides(["a", "b", "c"]);
9177 /// ```
9178 pub fn set_metric_overrides<T, V>(mut self, v: T) -> Self
9179 where
9180 T: std::iter::IntoIterator<Item = V>,
9181 V: std::convert::Into<std::string::String>,
9182 {
9183 use std::iter::Iterator;
9184 self.metric_overrides = v.into_iter().map(|i| i.into()).collect();
9185 self
9186 }
9187 }
9188
9189 impl wkt::message::Message for Metric {
9190 fn typename() -> &'static str {
9191 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig.Metric"
9192 }
9193 }
9194
9195 /// A source for the collection of Dataproc custom metrics (see [Custom
9196 /// metrics]
9197 /// (<https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics>)).
9198 ///
9199 /// # Working with unknown values
9200 ///
9201 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9202 /// additional enum variants at any time. Adding new variants is not considered
9203 /// a breaking change. Applications should write their code in anticipation of:
9204 ///
9205 /// - New values appearing in future releases of the client library, **and**
9206 /// - New values received dynamically, without application changes.
9207 ///
9208 /// Please consult the [Working with enums] section in the user guide for some
9209 /// guidelines.
9210 ///
9211 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9212 #[derive(Clone, Debug, PartialEq)]
9213 #[non_exhaustive]
9214 pub enum MetricSource {
9215 /// Required unspecified metric source.
9216 Unspecified,
9217 /// Monitoring agent metrics. If this source is enabled,
9218 /// Dataproc enables the monitoring agent in Compute Engine,
9219 /// and collects monitoring agent metrics, which are published
9220 /// with an `agent.googleapis.com` prefix.
9221 MonitoringAgentDefaults,
9222 /// HDFS metric source.
9223 Hdfs,
9224 /// Spark metric source.
9225 Spark,
9226 /// YARN metric source.
9227 Yarn,
9228 /// Spark History Server metric source.
9229 SparkHistoryServer,
9230 /// Hiveserver2 metric source.
9231 Hiveserver2,
9232 /// hivemetastore metric source
9233 Hivemetastore,
9234 /// flink metric source
9235 Flink,
9236 /// If set, the enum was initialized with an unknown value.
9237 ///
9238 /// Applications can examine the value using [MetricSource::value] or
9239 /// [MetricSource::name].
9240 UnknownValue(metric_source::UnknownValue),
9241 }
9242
9243 #[doc(hidden)]
9244 pub mod metric_source {
9245 #[allow(unused_imports)]
9246 use super::*;
9247 #[derive(Clone, Debug, PartialEq)]
9248 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9249 }
9250
9251 impl MetricSource {
9252 /// Gets the enum value.
9253 ///
9254 /// Returns `None` if the enum contains an unknown value deserialized from
9255 /// the string representation of enums.
9256 pub fn value(&self) -> std::option::Option<i32> {
9257 match self {
9258 Self::Unspecified => std::option::Option::Some(0),
9259 Self::MonitoringAgentDefaults => std::option::Option::Some(1),
9260 Self::Hdfs => std::option::Option::Some(2),
9261 Self::Spark => std::option::Option::Some(3),
9262 Self::Yarn => std::option::Option::Some(4),
9263 Self::SparkHistoryServer => std::option::Option::Some(5),
9264 Self::Hiveserver2 => std::option::Option::Some(6),
9265 Self::Hivemetastore => std::option::Option::Some(7),
9266 Self::Flink => std::option::Option::Some(8),
9267 Self::UnknownValue(u) => u.0.value(),
9268 }
9269 }
9270
9271 /// Gets the enum value as a string.
9272 ///
9273 /// Returns `None` if the enum contains an unknown value deserialized from
9274 /// the integer representation of enums.
9275 pub fn name(&self) -> std::option::Option<&str> {
9276 match self {
9277 Self::Unspecified => std::option::Option::Some("METRIC_SOURCE_UNSPECIFIED"),
9278 Self::MonitoringAgentDefaults => {
9279 std::option::Option::Some("MONITORING_AGENT_DEFAULTS")
9280 }
9281 Self::Hdfs => std::option::Option::Some("HDFS"),
9282 Self::Spark => std::option::Option::Some("SPARK"),
9283 Self::Yarn => std::option::Option::Some("YARN"),
9284 Self::SparkHistoryServer => std::option::Option::Some("SPARK_HISTORY_SERVER"),
9285 Self::Hiveserver2 => std::option::Option::Some("HIVESERVER2"),
9286 Self::Hivemetastore => std::option::Option::Some("HIVEMETASTORE"),
9287 Self::Flink => std::option::Option::Some("FLINK"),
9288 Self::UnknownValue(u) => u.0.name(),
9289 }
9290 }
9291 }
9292
9293 impl std::default::Default for MetricSource {
9294 fn default() -> Self {
9295 use std::convert::From;
9296 Self::from(0)
9297 }
9298 }
9299
9300 impl std::fmt::Display for MetricSource {
9301 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9302 wkt::internal::display_enum(f, self.name(), self.value())
9303 }
9304 }
9305
9306 impl std::convert::From<i32> for MetricSource {
9307 fn from(value: i32) -> Self {
9308 match value {
9309 0 => Self::Unspecified,
9310 1 => Self::MonitoringAgentDefaults,
9311 2 => Self::Hdfs,
9312 3 => Self::Spark,
9313 4 => Self::Yarn,
9314 5 => Self::SparkHistoryServer,
9315 6 => Self::Hiveserver2,
9316 7 => Self::Hivemetastore,
9317 8 => Self::Flink,
9318 _ => Self::UnknownValue(metric_source::UnknownValue(
9319 wkt::internal::UnknownEnumValue::Integer(value),
9320 )),
9321 }
9322 }
9323 }
9324
9325 impl std::convert::From<&str> for MetricSource {
9326 fn from(value: &str) -> Self {
9327 use std::string::ToString;
9328 match value {
9329 "METRIC_SOURCE_UNSPECIFIED" => Self::Unspecified,
9330 "MONITORING_AGENT_DEFAULTS" => Self::MonitoringAgentDefaults,
9331 "HDFS" => Self::Hdfs,
9332 "SPARK" => Self::Spark,
9333 "YARN" => Self::Yarn,
9334 "SPARK_HISTORY_SERVER" => Self::SparkHistoryServer,
9335 "HIVESERVER2" => Self::Hiveserver2,
9336 "HIVEMETASTORE" => Self::Hivemetastore,
9337 "FLINK" => Self::Flink,
9338 _ => Self::UnknownValue(metric_source::UnknownValue(
9339 wkt::internal::UnknownEnumValue::String(value.to_string()),
9340 )),
9341 }
9342 }
9343 }
9344
9345 impl serde::ser::Serialize for MetricSource {
9346 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9347 where
9348 S: serde::Serializer,
9349 {
9350 match self {
9351 Self::Unspecified => serializer.serialize_i32(0),
9352 Self::MonitoringAgentDefaults => serializer.serialize_i32(1),
9353 Self::Hdfs => serializer.serialize_i32(2),
9354 Self::Spark => serializer.serialize_i32(3),
9355 Self::Yarn => serializer.serialize_i32(4),
9356 Self::SparkHistoryServer => serializer.serialize_i32(5),
9357 Self::Hiveserver2 => serializer.serialize_i32(6),
9358 Self::Hivemetastore => serializer.serialize_i32(7),
9359 Self::Flink => serializer.serialize_i32(8),
9360 Self::UnknownValue(u) => u.0.serialize(serializer),
9361 }
9362 }
9363 }
9364
9365 impl<'de> serde::de::Deserialize<'de> for MetricSource {
9366 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9367 where
9368 D: serde::Deserializer<'de>,
9369 {
9370 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricSource>::new(
9371 ".google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource",
9372 ))
9373 }
9374 }
9375}
9376
9377/// A request to create a cluster.
9378#[derive(Clone, Default, PartialEq)]
9379#[non_exhaustive]
9380pub struct CreateClusterRequest {
9381 /// Required. The ID of the Google Cloud Platform project that the cluster
9382 /// belongs to.
9383 pub project_id: std::string::String,
9384
9385 /// Required. The Dataproc region in which to handle the request.
9386 pub region: std::string::String,
9387
9388 /// Required. The cluster to create.
9389 pub cluster: std::option::Option<crate::model::Cluster>,
9390
9391 /// Optional. A unique ID used to identify the request. If the server receives
9392 /// two
9393 /// [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
9394 /// with the same id, then the second request will be ignored and the
9395 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9396 /// and stored in the backend is returned.
9397 ///
9398 /// It is recommended to always set this value to a
9399 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9400 ///
9401 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9402 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9403 ///
9404 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9405 pub request_id: std::string::String,
9406
9407 /// Optional. Failure action when primary worker creation fails.
9408 pub action_on_failed_primary_workers: crate::model::FailureAction,
9409
9410 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9411}
9412
9413impl CreateClusterRequest {
9414 /// Creates a new default instance.
9415 pub fn new() -> Self {
9416 std::default::Default::default()
9417 }
9418
9419 /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
9420 ///
9421 /// # Example
9422 /// ```ignore,no_run
9423 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9424 /// let x = CreateClusterRequest::new().set_project_id("example");
9425 /// ```
9426 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9427 self.project_id = v.into();
9428 self
9429 }
9430
9431 /// Sets the value of [region][crate::model::CreateClusterRequest::region].
9432 ///
9433 /// # Example
9434 /// ```ignore,no_run
9435 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9436 /// let x = CreateClusterRequest::new().set_region("example");
9437 /// ```
9438 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9439 self.region = v.into();
9440 self
9441 }
9442
9443 /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
9444 ///
9445 /// # Example
9446 /// ```ignore,no_run
9447 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9448 /// use google_cloud_dataproc_v1::model::Cluster;
9449 /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9450 /// ```
9451 pub fn set_cluster<T>(mut self, v: T) -> Self
9452 where
9453 T: std::convert::Into<crate::model::Cluster>,
9454 {
9455 self.cluster = std::option::Option::Some(v.into());
9456 self
9457 }
9458
9459 /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
9460 ///
9461 /// # Example
9462 /// ```ignore,no_run
9463 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9464 /// use google_cloud_dataproc_v1::model::Cluster;
9465 /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9466 /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9467 /// ```
9468 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9469 where
9470 T: std::convert::Into<crate::model::Cluster>,
9471 {
9472 self.cluster = v.map(|x| x.into());
9473 self
9474 }
9475
9476 /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
9477 ///
9478 /// # Example
9479 /// ```ignore,no_run
9480 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9481 /// let x = CreateClusterRequest::new().set_request_id("example");
9482 /// ```
9483 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9484 self.request_id = v.into();
9485 self
9486 }
9487
9488 /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
9489 ///
9490 /// # Example
9491 /// ```ignore,no_run
9492 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
9493 /// use google_cloud_dataproc_v1::model::FailureAction;
9494 /// let x0 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::NoAction);
9495 /// let x1 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::Delete);
9496 /// ```
9497 pub fn set_action_on_failed_primary_workers<
9498 T: std::convert::Into<crate::model::FailureAction>,
9499 >(
9500 mut self,
9501 v: T,
9502 ) -> Self {
9503 self.action_on_failed_primary_workers = v.into();
9504 self
9505 }
9506}
9507
9508impl wkt::message::Message for CreateClusterRequest {
9509 fn typename() -> &'static str {
9510 "type.googleapis.com/google.cloud.dataproc.v1.CreateClusterRequest"
9511 }
9512}
9513
9514/// A request to update a cluster.
9515#[derive(Clone, Default, PartialEq)]
9516#[non_exhaustive]
9517pub struct UpdateClusterRequest {
9518 /// Required. The ID of the Google Cloud Platform project the
9519 /// cluster belongs to.
9520 pub project_id: std::string::String,
9521
9522 /// Required. The Dataproc region in which to handle the request.
9523 pub region: std::string::String,
9524
9525 /// Required. The cluster name.
9526 pub cluster_name: std::string::String,
9527
9528 /// Required. The changes to the cluster.
9529 pub cluster: std::option::Option<crate::model::Cluster>,
9530
9531 /// Optional. Timeout for graceful YARN decommissioning. Graceful
9532 /// decommissioning allows removing nodes from the cluster without
9533 /// interrupting jobs in progress. Timeout specifies how long to wait for jobs
9534 /// in progress to finish before forcefully removing nodes (and potentially
9535 /// interrupting jobs). Default timeout is 0 (for forceful decommission), and
9536 /// the maximum allowed timeout is 1 day. (see JSON representation of
9537 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
9538 ///
9539 /// Only supported on Dataproc image versions 1.2 and higher.
9540 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
9541
9542 /// Required. Specifies the path, relative to `Cluster`, of
9543 /// the field to update. For example, to change the number of workers
9544 /// in a cluster to 5, the `update_mask` parameter would be
9545 /// specified as `config.worker_config.num_instances`,
9546 /// and the `PATCH` request body would specify the new value, as follows:
9547 ///
9548 /// ```norust
9549 /// {
9550 /// "config":{
9551 /// "workerConfig":{
9552 /// "numInstances":"5"
9553 /// }
9554 /// }
9555 /// }
9556 /// ```
9557 ///
9558 /// Similarly, to change the number of preemptible workers in a cluster to 5,
9559 /// the `update_mask` parameter would be
9560 /// `config.secondary_worker_config.num_instances`, and the `PATCH` request
9561 /// body would be set as follows:
9562 ///
9563 /// ```norust
9564 /// {
9565 /// "config":{
9566 /// "secondaryWorkerConfig":{
9567 /// "numInstances":"5"
9568 /// }
9569 /// }
9570 /// }
9571 /// ```
9572 ///
9573 /// \<strong\>Note:\</strong\> Currently, only the following fields can be updated:
9574 pub update_mask: std::option::Option<wkt::FieldMask>,
9575
9576 /// Optional. A unique ID used to identify the request. If the server
9577 /// receives two
9578 /// [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
9579 /// with the same id, then the second request will be ignored and the
9580 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9581 /// and stored in the backend is returned.
9582 ///
9583 /// It is recommended to always set this value to a
9584 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9585 ///
9586 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9587 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9588 ///
9589 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9590 pub request_id: std::string::String,
9591
9592 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9593}
9594
9595impl UpdateClusterRequest {
9596 /// Creates a new default instance.
9597 pub fn new() -> Self {
9598 std::default::Default::default()
9599 }
9600
9601 /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
9602 ///
9603 /// # Example
9604 /// ```ignore,no_run
9605 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9606 /// let x = UpdateClusterRequest::new().set_project_id("example");
9607 /// ```
9608 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9609 self.project_id = v.into();
9610 self
9611 }
9612
9613 /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
9614 ///
9615 /// # Example
9616 /// ```ignore,no_run
9617 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9618 /// let x = UpdateClusterRequest::new().set_region("example");
9619 /// ```
9620 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9621 self.region = v.into();
9622 self
9623 }
9624
9625 /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
9626 ///
9627 /// # Example
9628 /// ```ignore,no_run
9629 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9630 /// let x = UpdateClusterRequest::new().set_cluster_name("example");
9631 /// ```
9632 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9633 self.cluster_name = v.into();
9634 self
9635 }
9636
9637 /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9638 ///
9639 /// # Example
9640 /// ```ignore,no_run
9641 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9642 /// use google_cloud_dataproc_v1::model::Cluster;
9643 /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9644 /// ```
9645 pub fn set_cluster<T>(mut self, v: T) -> Self
9646 where
9647 T: std::convert::Into<crate::model::Cluster>,
9648 {
9649 self.cluster = std::option::Option::Some(v.into());
9650 self
9651 }
9652
9653 /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9654 ///
9655 /// # Example
9656 /// ```ignore,no_run
9657 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9658 /// use google_cloud_dataproc_v1::model::Cluster;
9659 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9660 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9661 /// ```
9662 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9663 where
9664 T: std::convert::Into<crate::model::Cluster>,
9665 {
9666 self.cluster = v.map(|x| x.into());
9667 self
9668 }
9669
9670 /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9671 ///
9672 /// # Example
9673 /// ```ignore,no_run
9674 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9675 /// use wkt::Duration;
9676 /// let x = UpdateClusterRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
9677 /// ```
9678 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
9679 where
9680 T: std::convert::Into<wkt::Duration>,
9681 {
9682 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
9683 self
9684 }
9685
9686 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9687 ///
9688 /// # Example
9689 /// ```ignore,no_run
9690 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9691 /// use wkt::Duration;
9692 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
9693 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
9694 /// ```
9695 pub fn set_or_clear_graceful_decommission_timeout<T>(
9696 mut self,
9697 v: std::option::Option<T>,
9698 ) -> Self
9699 where
9700 T: std::convert::Into<wkt::Duration>,
9701 {
9702 self.graceful_decommission_timeout = v.map(|x| x.into());
9703 self
9704 }
9705
9706 /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9707 ///
9708 /// # Example
9709 /// ```ignore,no_run
9710 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9711 /// use wkt::FieldMask;
9712 /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9713 /// ```
9714 pub fn set_update_mask<T>(mut self, v: T) -> Self
9715 where
9716 T: std::convert::Into<wkt::FieldMask>,
9717 {
9718 self.update_mask = std::option::Option::Some(v.into());
9719 self
9720 }
9721
9722 /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9723 ///
9724 /// # Example
9725 /// ```ignore,no_run
9726 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9727 /// use wkt::FieldMask;
9728 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9729 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9730 /// ```
9731 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9732 where
9733 T: std::convert::Into<wkt::FieldMask>,
9734 {
9735 self.update_mask = v.map(|x| x.into());
9736 self
9737 }
9738
9739 /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
9740 ///
9741 /// # Example
9742 /// ```ignore,no_run
9743 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9744 /// let x = UpdateClusterRequest::new().set_request_id("example");
9745 /// ```
9746 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9747 self.request_id = v.into();
9748 self
9749 }
9750}
9751
9752impl wkt::message::Message for UpdateClusterRequest {
9753 fn typename() -> &'static str {
9754 "type.googleapis.com/google.cloud.dataproc.v1.UpdateClusterRequest"
9755 }
9756}
9757
9758/// A request to stop a cluster.
9759#[derive(Clone, Default, PartialEq)]
9760#[non_exhaustive]
9761pub struct StopClusterRequest {
9762 /// Required. The ID of the Google Cloud Platform project the
9763 /// cluster belongs to.
9764 pub project_id: std::string::String,
9765
9766 /// Required. The Dataproc region in which to handle the request.
9767 pub region: std::string::String,
9768
9769 /// Required. The cluster name.
9770 pub cluster_name: std::string::String,
9771
9772 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9773 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9774 pub cluster_uuid: std::string::String,
9775
9776 /// Optional. A unique ID used to identify the request. If the server
9777 /// receives two
9778 /// [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
9779 /// with the same id, then the second request will be ignored and the
9780 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9781 /// and stored in the backend is returned.
9782 ///
9783 /// Recommendation: Set this value to a
9784 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9785 ///
9786 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9787 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9788 ///
9789 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9790 pub request_id: std::string::String,
9791
9792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9793}
9794
9795impl StopClusterRequest {
9796 /// Creates a new default instance.
9797 pub fn new() -> Self {
9798 std::default::Default::default()
9799 }
9800
9801 /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
9802 ///
9803 /// # Example
9804 /// ```ignore,no_run
9805 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9806 /// let x = StopClusterRequest::new().set_project_id("example");
9807 /// ```
9808 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9809 self.project_id = v.into();
9810 self
9811 }
9812
9813 /// Sets the value of [region][crate::model::StopClusterRequest::region].
9814 ///
9815 /// # Example
9816 /// ```ignore,no_run
9817 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9818 /// let x = StopClusterRequest::new().set_region("example");
9819 /// ```
9820 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9821 self.region = v.into();
9822 self
9823 }
9824
9825 /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
9826 ///
9827 /// # Example
9828 /// ```ignore,no_run
9829 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9830 /// let x = StopClusterRequest::new().set_cluster_name("example");
9831 /// ```
9832 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9833 self.cluster_name = v.into();
9834 self
9835 }
9836
9837 /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
9838 ///
9839 /// # Example
9840 /// ```ignore,no_run
9841 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9842 /// let x = StopClusterRequest::new().set_cluster_uuid("example");
9843 /// ```
9844 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9845 self.cluster_uuid = v.into();
9846 self
9847 }
9848
9849 /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
9850 ///
9851 /// # Example
9852 /// ```ignore,no_run
9853 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9854 /// let x = StopClusterRequest::new().set_request_id("example");
9855 /// ```
9856 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9857 self.request_id = v.into();
9858 self
9859 }
9860}
9861
9862impl wkt::message::Message for StopClusterRequest {
9863 fn typename() -> &'static str {
9864 "type.googleapis.com/google.cloud.dataproc.v1.StopClusterRequest"
9865 }
9866}
9867
9868/// A request to start a cluster.
9869#[derive(Clone, Default, PartialEq)]
9870#[non_exhaustive]
9871pub struct StartClusterRequest {
9872 /// Required. The ID of the Google Cloud Platform project the
9873 /// cluster belongs to.
9874 pub project_id: std::string::String,
9875
9876 /// Required. The Dataproc region in which to handle the request.
9877 pub region: std::string::String,
9878
9879 /// Required. The cluster name.
9880 pub cluster_name: std::string::String,
9881
9882 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9883 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9884 pub cluster_uuid: std::string::String,
9885
9886 /// Optional. A unique ID used to identify the request. If the server
9887 /// receives two
9888 /// [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
9889 /// with the same id, then the second request will be ignored and the
9890 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9891 /// and stored in the backend is returned.
9892 ///
9893 /// Recommendation: Set this value to a
9894 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9895 ///
9896 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9897 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9898 ///
9899 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9900 pub request_id: std::string::String,
9901
9902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9903}
9904
9905impl StartClusterRequest {
9906 /// Creates a new default instance.
9907 pub fn new() -> Self {
9908 std::default::Default::default()
9909 }
9910
9911 /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
9912 ///
9913 /// # Example
9914 /// ```ignore,no_run
9915 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9916 /// let x = StartClusterRequest::new().set_project_id("example");
9917 /// ```
9918 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9919 self.project_id = v.into();
9920 self
9921 }
9922
9923 /// Sets the value of [region][crate::model::StartClusterRequest::region].
9924 ///
9925 /// # Example
9926 /// ```ignore,no_run
9927 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9928 /// let x = StartClusterRequest::new().set_region("example");
9929 /// ```
9930 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9931 self.region = v.into();
9932 self
9933 }
9934
9935 /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
9936 ///
9937 /// # Example
9938 /// ```ignore,no_run
9939 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9940 /// let x = StartClusterRequest::new().set_cluster_name("example");
9941 /// ```
9942 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9943 self.cluster_name = v.into();
9944 self
9945 }
9946
9947 /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
9948 ///
9949 /// # Example
9950 /// ```ignore,no_run
9951 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9952 /// let x = StartClusterRequest::new().set_cluster_uuid("example");
9953 /// ```
9954 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9955 self.cluster_uuid = v.into();
9956 self
9957 }
9958
9959 /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
9960 ///
9961 /// # Example
9962 /// ```ignore,no_run
9963 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9964 /// let x = StartClusterRequest::new().set_request_id("example");
9965 /// ```
9966 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9967 self.request_id = v.into();
9968 self
9969 }
9970}
9971
9972impl wkt::message::Message for StartClusterRequest {
9973 fn typename() -> &'static str {
9974 "type.googleapis.com/google.cloud.dataproc.v1.StartClusterRequest"
9975 }
9976}
9977
9978/// A request to delete a cluster.
9979#[derive(Clone, Default, PartialEq)]
9980#[non_exhaustive]
9981pub struct DeleteClusterRequest {
9982 /// Required. The ID of the Google Cloud Platform project that the cluster
9983 /// belongs to.
9984 pub project_id: std::string::String,
9985
9986 /// Required. The Dataproc region in which to handle the request.
9987 pub region: std::string::String,
9988
9989 /// Required. The cluster name.
9990 pub cluster_name: std::string::String,
9991
9992 /// Optional. Specifying the `cluster_uuid` means the RPC should fail
9993 /// (with error NOT_FOUND) if cluster with specified UUID does not exist.
9994 pub cluster_uuid: std::string::String,
9995
9996 /// Optional. A unique ID used to identify the request. If the server
9997 /// receives two
9998 /// [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
9999 /// with the same id, then the second request will be ignored and the
10000 /// first [google.longrunning.Operation][google.longrunning.Operation] created
10001 /// and stored in the backend is returned.
10002 ///
10003 /// It is recommended to always set this value to a
10004 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
10005 ///
10006 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
10007 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
10008 ///
10009 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
10010 pub request_id: std::string::String,
10011
10012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10013}
10014
10015impl DeleteClusterRequest {
10016 /// Creates a new default instance.
10017 pub fn new() -> Self {
10018 std::default::Default::default()
10019 }
10020
10021 /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
10022 ///
10023 /// # Example
10024 /// ```ignore,no_run
10025 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10026 /// let x = DeleteClusterRequest::new().set_project_id("example");
10027 /// ```
10028 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10029 self.project_id = v.into();
10030 self
10031 }
10032
10033 /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
10034 ///
10035 /// # Example
10036 /// ```ignore,no_run
10037 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10038 /// let x = DeleteClusterRequest::new().set_region("example");
10039 /// ```
10040 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10041 self.region = v.into();
10042 self
10043 }
10044
10045 /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
10046 ///
10047 /// # Example
10048 /// ```ignore,no_run
10049 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10050 /// let x = DeleteClusterRequest::new().set_cluster_name("example");
10051 /// ```
10052 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10053 self.cluster_name = v.into();
10054 self
10055 }
10056
10057 /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
10058 ///
10059 /// # Example
10060 /// ```ignore,no_run
10061 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10062 /// let x = DeleteClusterRequest::new().set_cluster_uuid("example");
10063 /// ```
10064 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10065 self.cluster_uuid = v.into();
10066 self
10067 }
10068
10069 /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
10070 ///
10071 /// # Example
10072 /// ```ignore,no_run
10073 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
10074 /// let x = DeleteClusterRequest::new().set_request_id("example");
10075 /// ```
10076 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10077 self.request_id = v.into();
10078 self
10079 }
10080}
10081
10082impl wkt::message::Message for DeleteClusterRequest {
10083 fn typename() -> &'static str {
10084 "type.googleapis.com/google.cloud.dataproc.v1.DeleteClusterRequest"
10085 }
10086}
10087
10088/// Request to get the resource representation for a cluster in a project.
10089#[derive(Clone, Default, PartialEq)]
10090#[non_exhaustive]
10091pub struct GetClusterRequest {
10092 /// Required. The ID of the Google Cloud Platform project that the cluster
10093 /// belongs to.
10094 pub project_id: std::string::String,
10095
10096 /// Required. The Dataproc region in which to handle the request.
10097 pub region: std::string::String,
10098
10099 /// Required. The cluster name.
10100 pub cluster_name: std::string::String,
10101
10102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10103}
10104
10105impl GetClusterRequest {
10106 /// Creates a new default instance.
10107 pub fn new() -> Self {
10108 std::default::Default::default()
10109 }
10110
10111 /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
10112 ///
10113 /// # Example
10114 /// ```ignore,no_run
10115 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
10116 /// let x = GetClusterRequest::new().set_project_id("example");
10117 /// ```
10118 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10119 self.project_id = v.into();
10120 self
10121 }
10122
10123 /// Sets the value of [region][crate::model::GetClusterRequest::region].
10124 ///
10125 /// # Example
10126 /// ```ignore,no_run
10127 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
10128 /// let x = GetClusterRequest::new().set_region("example");
10129 /// ```
10130 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10131 self.region = v.into();
10132 self
10133 }
10134
10135 /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
10136 ///
10137 /// # Example
10138 /// ```ignore,no_run
10139 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
10140 /// let x = GetClusterRequest::new().set_cluster_name("example");
10141 /// ```
10142 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10143 self.cluster_name = v.into();
10144 self
10145 }
10146}
10147
10148impl wkt::message::Message for GetClusterRequest {
10149 fn typename() -> &'static str {
10150 "type.googleapis.com/google.cloud.dataproc.v1.GetClusterRequest"
10151 }
10152}
10153
10154/// A request to list the clusters in a project.
10155#[derive(Clone, Default, PartialEq)]
10156#[non_exhaustive]
10157pub struct ListClustersRequest {
10158 /// Required. The ID of the Google Cloud Platform project that the cluster
10159 /// belongs to.
10160 pub project_id: std::string::String,
10161
10162 /// Required. The Dataproc region in which to handle the request.
10163 pub region: std::string::String,
10164
10165 /// Optional. A filter constraining the clusters to list. Filters are
10166 /// case-sensitive and have the following syntax:
10167 ///
10168 /// field = value [AND [field = value]] ...
10169 ///
10170 /// where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
10171 /// and `[KEY]` is a label key. **value** can be `*` to match all values.
10172 /// `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
10173 /// `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
10174 /// `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
10175 /// states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
10176 /// `STOPPED` states. `clusterName` is the name of the cluster provided at
10177 /// creation time. Only the logical `AND` operator is supported;
10178 /// space-separated items are treated as having an implicit `AND` operator.
10179 ///
10180 /// Example filter:
10181 ///
10182 /// status.state = ACTIVE AND clusterName = mycluster
10183 /// AND labels.env = staging AND labels.starred = *
10184 pub filter: std::string::String,
10185
10186 /// Optional. The standard List page size.
10187 pub page_size: i32,
10188
10189 /// Optional. The standard List page token.
10190 pub page_token: std::string::String,
10191
10192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10193}
10194
10195impl ListClustersRequest {
10196 /// Creates a new default instance.
10197 pub fn new() -> Self {
10198 std::default::Default::default()
10199 }
10200
10201 /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
10202 ///
10203 /// # Example
10204 /// ```ignore,no_run
10205 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10206 /// let x = ListClustersRequest::new().set_project_id("example");
10207 /// ```
10208 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10209 self.project_id = v.into();
10210 self
10211 }
10212
10213 /// Sets the value of [region][crate::model::ListClustersRequest::region].
10214 ///
10215 /// # Example
10216 /// ```ignore,no_run
10217 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10218 /// let x = ListClustersRequest::new().set_region("example");
10219 /// ```
10220 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10221 self.region = v.into();
10222 self
10223 }
10224
10225 /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
10226 ///
10227 /// # Example
10228 /// ```ignore,no_run
10229 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10230 /// let x = ListClustersRequest::new().set_filter("example");
10231 /// ```
10232 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10233 self.filter = v.into();
10234 self
10235 }
10236
10237 /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
10238 ///
10239 /// # Example
10240 /// ```ignore,no_run
10241 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10242 /// let x = ListClustersRequest::new().set_page_size(42);
10243 /// ```
10244 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10245 self.page_size = v.into();
10246 self
10247 }
10248
10249 /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
10250 ///
10251 /// # Example
10252 /// ```ignore,no_run
10253 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
10254 /// let x = ListClustersRequest::new().set_page_token("example");
10255 /// ```
10256 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10257 self.page_token = v.into();
10258 self
10259 }
10260}
10261
10262impl wkt::message::Message for ListClustersRequest {
10263 fn typename() -> &'static str {
10264 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersRequest"
10265 }
10266}
10267
10268/// The list of all clusters in a project.
10269#[derive(Clone, Default, PartialEq)]
10270#[non_exhaustive]
10271pub struct ListClustersResponse {
10272 /// Output only. The clusters in the project.
10273 pub clusters: std::vec::Vec<crate::model::Cluster>,
10274
10275 /// Output only. This token is included in the response if there are more
10276 /// results to fetch. To fetch additional results, provide this value as the
10277 /// `page_token` in a subsequent `ListClustersRequest`.
10278 pub next_page_token: std::string::String,
10279
10280 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10281}
10282
10283impl ListClustersResponse {
10284 /// Creates a new default instance.
10285 pub fn new() -> Self {
10286 std::default::Default::default()
10287 }
10288
10289 /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
10290 ///
10291 /// # Example
10292 /// ```ignore,no_run
10293 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
10294 /// use google_cloud_dataproc_v1::model::Cluster;
10295 /// let x = ListClustersResponse::new()
10296 /// .set_clusters([
10297 /// Cluster::default()/* use setters */,
10298 /// Cluster::default()/* use (different) setters */,
10299 /// ]);
10300 /// ```
10301 pub fn set_clusters<T, V>(mut self, v: T) -> Self
10302 where
10303 T: std::iter::IntoIterator<Item = V>,
10304 V: std::convert::Into<crate::model::Cluster>,
10305 {
10306 use std::iter::Iterator;
10307 self.clusters = v.into_iter().map(|i| i.into()).collect();
10308 self
10309 }
10310
10311 /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
10312 ///
10313 /// # Example
10314 /// ```ignore,no_run
10315 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
10316 /// let x = ListClustersResponse::new().set_next_page_token("example");
10317 /// ```
10318 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10319 self.next_page_token = v.into();
10320 self
10321 }
10322}
10323
10324impl wkt::message::Message for ListClustersResponse {
10325 fn typename() -> &'static str {
10326 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersResponse"
10327 }
10328}
10329
10330#[doc(hidden)]
10331impl google_cloud_gax::paginator::internal::PageableResponse for ListClustersResponse {
10332 type PageItem = crate::model::Cluster;
10333
10334 fn items(self) -> std::vec::Vec<Self::PageItem> {
10335 self.clusters
10336 }
10337
10338 fn next_page_token(&self) -> std::string::String {
10339 use std::clone::Clone;
10340 self.next_page_token.clone()
10341 }
10342}
10343
10344/// A request to collect cluster diagnostic information.
10345#[derive(Clone, Default, PartialEq)]
10346#[non_exhaustive]
10347pub struct DiagnoseClusterRequest {
10348 /// Required. The ID of the Google Cloud Platform project that the cluster
10349 /// belongs to.
10350 pub project_id: std::string::String,
10351
10352 /// Required. The Dataproc region in which to handle the request.
10353 pub region: std::string::String,
10354
10355 /// Required. The cluster name.
10356 pub cluster_name: std::string::String,
10357
10358 /// Optional. (Optional) The output Cloud Storage directory for the diagnostic
10359 /// tarball. If not specified, a task-specific directory in the cluster's
10360 /// staging bucket will be used.
10361 pub tarball_gcs_dir: std::string::String,
10362
10363 /// Optional. (Optional) The access type to the diagnostic tarball. If not
10364 /// specified, falls back to default access of the bucket
10365 pub tarball_access: crate::model::diagnose_cluster_request::TarballAccess,
10366
10367 /// Optional. Time interval in which diagnosis should be carried out on the
10368 /// cluster.
10369 pub diagnosis_interval: std::option::Option<google_cloud_type::model::Interval>,
10370
10371 /// Optional. Specifies a list of jobs on which diagnosis is to be performed.
10372 /// Format: projects/{project}/regions/{region}/jobs/{job}
10373 pub jobs: std::vec::Vec<std::string::String>,
10374
10375 /// Optional. Specifies a list of yarn applications on which diagnosis is to be
10376 /// performed.
10377 pub yarn_application_ids: std::vec::Vec<std::string::String>,
10378
10379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10380}
10381
10382impl DiagnoseClusterRequest {
10383 /// Creates a new default instance.
10384 pub fn new() -> Self {
10385 std::default::Default::default()
10386 }
10387
10388 /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
10389 ///
10390 /// # Example
10391 /// ```ignore,no_run
10392 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10393 /// let x = DiagnoseClusterRequest::new().set_project_id("example");
10394 /// ```
10395 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10396 self.project_id = v.into();
10397 self
10398 }
10399
10400 /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
10401 ///
10402 /// # Example
10403 /// ```ignore,no_run
10404 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10405 /// let x = DiagnoseClusterRequest::new().set_region("example");
10406 /// ```
10407 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10408 self.region = v.into();
10409 self
10410 }
10411
10412 /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
10413 ///
10414 /// # Example
10415 /// ```ignore,no_run
10416 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10417 /// let x = DiagnoseClusterRequest::new().set_cluster_name("example");
10418 /// ```
10419 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10420 self.cluster_name = v.into();
10421 self
10422 }
10423
10424 /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
10425 ///
10426 /// # Example
10427 /// ```ignore,no_run
10428 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10429 /// let x = DiagnoseClusterRequest::new().set_tarball_gcs_dir("example");
10430 /// ```
10431 pub fn set_tarball_gcs_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10432 self.tarball_gcs_dir = v.into();
10433 self
10434 }
10435
10436 /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
10437 ///
10438 /// # Example
10439 /// ```ignore,no_run
10440 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10441 /// use google_cloud_dataproc_v1::model::diagnose_cluster_request::TarballAccess;
10442 /// let x0 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleCloudSupport);
10443 /// let x1 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleDataprocDiagnose);
10444 /// ```
10445 pub fn set_tarball_access<
10446 T: std::convert::Into<crate::model::diagnose_cluster_request::TarballAccess>,
10447 >(
10448 mut self,
10449 v: T,
10450 ) -> Self {
10451 self.tarball_access = v.into();
10452 self
10453 }
10454
10455 /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
10456 ///
10457 /// # Example
10458 /// ```ignore,no_run
10459 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10460 /// use google_cloud_type::model::Interval;
10461 /// let x = DiagnoseClusterRequest::new().set_diagnosis_interval(Interval::default()/* use setters */);
10462 /// ```
10463 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
10464 where
10465 T: std::convert::Into<google_cloud_type::model::Interval>,
10466 {
10467 self.diagnosis_interval = std::option::Option::Some(v.into());
10468 self
10469 }
10470
10471 /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
10472 ///
10473 /// # Example
10474 /// ```ignore,no_run
10475 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10476 /// use google_cloud_type::model::Interval;
10477 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(Some(Interval::default()/* use setters */));
10478 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(None::<Interval>);
10479 /// ```
10480 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
10481 where
10482 T: std::convert::Into<google_cloud_type::model::Interval>,
10483 {
10484 self.diagnosis_interval = v.map(|x| x.into());
10485 self
10486 }
10487
10488 /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
10489 ///
10490 /// # Example
10491 /// ```ignore,no_run
10492 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10493 /// let x = DiagnoseClusterRequest::new().set_jobs(["a", "b", "c"]);
10494 /// ```
10495 pub fn set_jobs<T, V>(mut self, v: T) -> Self
10496 where
10497 T: std::iter::IntoIterator<Item = V>,
10498 V: std::convert::Into<std::string::String>,
10499 {
10500 use std::iter::Iterator;
10501 self.jobs = v.into_iter().map(|i| i.into()).collect();
10502 self
10503 }
10504
10505 /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
10506 ///
10507 /// # Example
10508 /// ```ignore,no_run
10509 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
10510 /// let x = DiagnoseClusterRequest::new().set_yarn_application_ids(["a", "b", "c"]);
10511 /// ```
10512 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
10513 where
10514 T: std::iter::IntoIterator<Item = V>,
10515 V: std::convert::Into<std::string::String>,
10516 {
10517 use std::iter::Iterator;
10518 self.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
10519 self
10520 }
10521}
10522
10523impl wkt::message::Message for DiagnoseClusterRequest {
10524 fn typename() -> &'static str {
10525 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterRequest"
10526 }
10527}
10528
10529/// Defines additional types related to [DiagnoseClusterRequest].
10530pub mod diagnose_cluster_request {
10531 #[allow(unused_imports)]
10532 use super::*;
10533
10534 /// Defines who has access to the diagnostic tarball
10535 ///
10536 /// # Working with unknown values
10537 ///
10538 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10539 /// additional enum variants at any time. Adding new variants is not considered
10540 /// a breaking change. Applications should write their code in anticipation of:
10541 ///
10542 /// - New values appearing in future releases of the client library, **and**
10543 /// - New values received dynamically, without application changes.
10544 ///
10545 /// Please consult the [Working with enums] section in the user guide for some
10546 /// guidelines.
10547 ///
10548 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10549 #[derive(Clone, Debug, PartialEq)]
10550 #[non_exhaustive]
10551 pub enum TarballAccess {
10552 /// Tarball Access unspecified. Falls back to default access of the bucket
10553 Unspecified,
10554 /// Google Cloud Support group has read access to the
10555 /// diagnostic tarball
10556 GoogleCloudSupport,
10557 /// Google Cloud Dataproc Diagnose service account has read access to the
10558 /// diagnostic tarball
10559 GoogleDataprocDiagnose,
10560 /// If set, the enum was initialized with an unknown value.
10561 ///
10562 /// Applications can examine the value using [TarballAccess::value] or
10563 /// [TarballAccess::name].
10564 UnknownValue(tarball_access::UnknownValue),
10565 }
10566
10567 #[doc(hidden)]
10568 pub mod tarball_access {
10569 #[allow(unused_imports)]
10570 use super::*;
10571 #[derive(Clone, Debug, PartialEq)]
10572 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10573 }
10574
10575 impl TarballAccess {
10576 /// Gets the enum value.
10577 ///
10578 /// Returns `None` if the enum contains an unknown value deserialized from
10579 /// the string representation of enums.
10580 pub fn value(&self) -> std::option::Option<i32> {
10581 match self {
10582 Self::Unspecified => std::option::Option::Some(0),
10583 Self::GoogleCloudSupport => std::option::Option::Some(1),
10584 Self::GoogleDataprocDiagnose => std::option::Option::Some(2),
10585 Self::UnknownValue(u) => u.0.value(),
10586 }
10587 }
10588
10589 /// Gets the enum value as a string.
10590 ///
10591 /// Returns `None` if the enum contains an unknown value deserialized from
10592 /// the integer representation of enums.
10593 pub fn name(&self) -> std::option::Option<&str> {
10594 match self {
10595 Self::Unspecified => std::option::Option::Some("TARBALL_ACCESS_UNSPECIFIED"),
10596 Self::GoogleCloudSupport => std::option::Option::Some("GOOGLE_CLOUD_SUPPORT"),
10597 Self::GoogleDataprocDiagnose => {
10598 std::option::Option::Some("GOOGLE_DATAPROC_DIAGNOSE")
10599 }
10600 Self::UnknownValue(u) => u.0.name(),
10601 }
10602 }
10603 }
10604
10605 impl std::default::Default for TarballAccess {
10606 fn default() -> Self {
10607 use std::convert::From;
10608 Self::from(0)
10609 }
10610 }
10611
10612 impl std::fmt::Display for TarballAccess {
10613 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10614 wkt::internal::display_enum(f, self.name(), self.value())
10615 }
10616 }
10617
10618 impl std::convert::From<i32> for TarballAccess {
10619 fn from(value: i32) -> Self {
10620 match value {
10621 0 => Self::Unspecified,
10622 1 => Self::GoogleCloudSupport,
10623 2 => Self::GoogleDataprocDiagnose,
10624 _ => Self::UnknownValue(tarball_access::UnknownValue(
10625 wkt::internal::UnknownEnumValue::Integer(value),
10626 )),
10627 }
10628 }
10629 }
10630
10631 impl std::convert::From<&str> for TarballAccess {
10632 fn from(value: &str) -> Self {
10633 use std::string::ToString;
10634 match value {
10635 "TARBALL_ACCESS_UNSPECIFIED" => Self::Unspecified,
10636 "GOOGLE_CLOUD_SUPPORT" => Self::GoogleCloudSupport,
10637 "GOOGLE_DATAPROC_DIAGNOSE" => Self::GoogleDataprocDiagnose,
10638 _ => Self::UnknownValue(tarball_access::UnknownValue(
10639 wkt::internal::UnknownEnumValue::String(value.to_string()),
10640 )),
10641 }
10642 }
10643 }
10644
10645 impl serde::ser::Serialize for TarballAccess {
10646 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10647 where
10648 S: serde::Serializer,
10649 {
10650 match self {
10651 Self::Unspecified => serializer.serialize_i32(0),
10652 Self::GoogleCloudSupport => serializer.serialize_i32(1),
10653 Self::GoogleDataprocDiagnose => serializer.serialize_i32(2),
10654 Self::UnknownValue(u) => u.0.serialize(serializer),
10655 }
10656 }
10657 }
10658
10659 impl<'de> serde::de::Deserialize<'de> for TarballAccess {
10660 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10661 where
10662 D: serde::Deserializer<'de>,
10663 {
10664 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TarballAccess>::new(
10665 ".google.cloud.dataproc.v1.DiagnoseClusterRequest.TarballAccess",
10666 ))
10667 }
10668 }
10669}
10670
10671/// The location of diagnostic output.
10672#[derive(Clone, Default, PartialEq)]
10673#[non_exhaustive]
10674pub struct DiagnoseClusterResults {
10675 /// Output only. The Cloud Storage URI of the diagnostic output.
10676 /// The output report is a plain text file with a summary of collected
10677 /// diagnostics.
10678 pub output_uri: std::string::String,
10679
10680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10681}
10682
10683impl DiagnoseClusterResults {
10684 /// Creates a new default instance.
10685 pub fn new() -> Self {
10686 std::default::Default::default()
10687 }
10688
10689 /// Sets the value of [output_uri][crate::model::DiagnoseClusterResults::output_uri].
10690 ///
10691 /// # Example
10692 /// ```ignore,no_run
10693 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterResults;
10694 /// let x = DiagnoseClusterResults::new().set_output_uri("example");
10695 /// ```
10696 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10697 self.output_uri = v.into();
10698 self
10699 }
10700}
10701
10702impl wkt::message::Message for DiagnoseClusterResults {
10703 fn typename() -> &'static str {
10704 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterResults"
10705 }
10706}
10707
10708/// Reservation Affinity for consuming Zonal reservation.
10709#[derive(Clone, Default, PartialEq)]
10710#[non_exhaustive]
10711pub struct ReservationAffinity {
10712 /// Optional. Type of reservation to consume
10713 pub consume_reservation_type: crate::model::reservation_affinity::Type,
10714
10715 /// Optional. Corresponds to the label key of reservation resource.
10716 pub key: std::string::String,
10717
10718 /// Optional. Corresponds to the label values of reservation resource.
10719 pub values: std::vec::Vec<std::string::String>,
10720
10721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10722}
10723
10724impl ReservationAffinity {
10725 /// Creates a new default instance.
10726 pub fn new() -> Self {
10727 std::default::Default::default()
10728 }
10729
10730 /// Sets the value of [consume_reservation_type][crate::model::ReservationAffinity::consume_reservation_type].
10731 ///
10732 /// # Example
10733 /// ```ignore,no_run
10734 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10735 /// use google_cloud_dataproc_v1::model::reservation_affinity::Type;
10736 /// let x0 = ReservationAffinity::new().set_consume_reservation_type(Type::NoReservation);
10737 /// let x1 = ReservationAffinity::new().set_consume_reservation_type(Type::AnyReservation);
10738 /// let x2 = ReservationAffinity::new().set_consume_reservation_type(Type::SpecificReservation);
10739 /// ```
10740 pub fn set_consume_reservation_type<
10741 T: std::convert::Into<crate::model::reservation_affinity::Type>,
10742 >(
10743 mut self,
10744 v: T,
10745 ) -> Self {
10746 self.consume_reservation_type = v.into();
10747 self
10748 }
10749
10750 /// Sets the value of [key][crate::model::ReservationAffinity::key].
10751 ///
10752 /// # Example
10753 /// ```ignore,no_run
10754 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10755 /// let x = ReservationAffinity::new().set_key("example");
10756 /// ```
10757 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10758 self.key = v.into();
10759 self
10760 }
10761
10762 /// Sets the value of [values][crate::model::ReservationAffinity::values].
10763 ///
10764 /// # Example
10765 /// ```ignore,no_run
10766 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10767 /// let x = ReservationAffinity::new().set_values(["a", "b", "c"]);
10768 /// ```
10769 pub fn set_values<T, V>(mut self, v: T) -> Self
10770 where
10771 T: std::iter::IntoIterator<Item = V>,
10772 V: std::convert::Into<std::string::String>,
10773 {
10774 use std::iter::Iterator;
10775 self.values = v.into_iter().map(|i| i.into()).collect();
10776 self
10777 }
10778}
10779
10780impl wkt::message::Message for ReservationAffinity {
10781 fn typename() -> &'static str {
10782 "type.googleapis.com/google.cloud.dataproc.v1.ReservationAffinity"
10783 }
10784}
10785
10786/// Defines additional types related to [ReservationAffinity].
10787pub mod reservation_affinity {
10788 #[allow(unused_imports)]
10789 use super::*;
10790
10791 /// Indicates whether to consume capacity from an reservation or not.
10792 ///
10793 /// # Working with unknown values
10794 ///
10795 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10796 /// additional enum variants at any time. Adding new variants is not considered
10797 /// a breaking change. Applications should write their code in anticipation of:
10798 ///
10799 /// - New values appearing in future releases of the client library, **and**
10800 /// - New values received dynamically, without application changes.
10801 ///
10802 /// Please consult the [Working with enums] section in the user guide for some
10803 /// guidelines.
10804 ///
10805 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10806 #[derive(Clone, Debug, PartialEq)]
10807 #[non_exhaustive]
10808 pub enum Type {
10809 #[allow(missing_docs)]
10810 Unspecified,
10811 /// Do not consume from any allocated capacity.
10812 NoReservation,
10813 /// Consume any reservation available.
10814 AnyReservation,
10815 /// Must consume from a specific reservation. Must specify key value fields
10816 /// for specifying the reservations.
10817 SpecificReservation,
10818 /// If set, the enum was initialized with an unknown value.
10819 ///
10820 /// Applications can examine the value using [Type::value] or
10821 /// [Type::name].
10822 UnknownValue(r#type::UnknownValue),
10823 }
10824
10825 #[doc(hidden)]
10826 pub mod r#type {
10827 #[allow(unused_imports)]
10828 use super::*;
10829 #[derive(Clone, Debug, PartialEq)]
10830 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10831 }
10832
10833 impl Type {
10834 /// Gets the enum value.
10835 ///
10836 /// Returns `None` if the enum contains an unknown value deserialized from
10837 /// the string representation of enums.
10838 pub fn value(&self) -> std::option::Option<i32> {
10839 match self {
10840 Self::Unspecified => std::option::Option::Some(0),
10841 Self::NoReservation => std::option::Option::Some(1),
10842 Self::AnyReservation => std::option::Option::Some(2),
10843 Self::SpecificReservation => std::option::Option::Some(3),
10844 Self::UnknownValue(u) => u.0.value(),
10845 }
10846 }
10847
10848 /// Gets the enum value as a string.
10849 ///
10850 /// Returns `None` if the enum contains an unknown value deserialized from
10851 /// the integer representation of enums.
10852 pub fn name(&self) -> std::option::Option<&str> {
10853 match self {
10854 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
10855 Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
10856 Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
10857 Self::SpecificReservation => std::option::Option::Some("SPECIFIC_RESERVATION"),
10858 Self::UnknownValue(u) => u.0.name(),
10859 }
10860 }
10861 }
10862
10863 impl std::default::Default for Type {
10864 fn default() -> Self {
10865 use std::convert::From;
10866 Self::from(0)
10867 }
10868 }
10869
10870 impl std::fmt::Display for Type {
10871 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10872 wkt::internal::display_enum(f, self.name(), self.value())
10873 }
10874 }
10875
10876 impl std::convert::From<i32> for Type {
10877 fn from(value: i32) -> Self {
10878 match value {
10879 0 => Self::Unspecified,
10880 1 => Self::NoReservation,
10881 2 => Self::AnyReservation,
10882 3 => Self::SpecificReservation,
10883 _ => Self::UnknownValue(r#type::UnknownValue(
10884 wkt::internal::UnknownEnumValue::Integer(value),
10885 )),
10886 }
10887 }
10888 }
10889
10890 impl std::convert::From<&str> for Type {
10891 fn from(value: &str) -> Self {
10892 use std::string::ToString;
10893 match value {
10894 "TYPE_UNSPECIFIED" => Self::Unspecified,
10895 "NO_RESERVATION" => Self::NoReservation,
10896 "ANY_RESERVATION" => Self::AnyReservation,
10897 "SPECIFIC_RESERVATION" => Self::SpecificReservation,
10898 _ => Self::UnknownValue(r#type::UnknownValue(
10899 wkt::internal::UnknownEnumValue::String(value.to_string()),
10900 )),
10901 }
10902 }
10903 }
10904
10905 impl serde::ser::Serialize for Type {
10906 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10907 where
10908 S: serde::Serializer,
10909 {
10910 match self {
10911 Self::Unspecified => serializer.serialize_i32(0),
10912 Self::NoReservation => serializer.serialize_i32(1),
10913 Self::AnyReservation => serializer.serialize_i32(2),
10914 Self::SpecificReservation => serializer.serialize_i32(3),
10915 Self::UnknownValue(u) => u.0.serialize(serializer),
10916 }
10917 }
10918 }
10919
10920 impl<'de> serde::de::Deserialize<'de> for Type {
10921 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10922 where
10923 D: serde::Deserializer<'de>,
10924 {
10925 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
10926 ".google.cloud.dataproc.v1.ReservationAffinity.Type",
10927 ))
10928 }
10929 }
10930}
10931
10932/// The runtime logging config of the job.
10933#[derive(Clone, Default, PartialEq)]
10934#[non_exhaustive]
10935pub struct LoggingConfig {
10936 /// The per-package log levels for the driver. This can include
10937 /// "root" package name to configure rootLogger.
10938 /// Examples:
10939 ///
10940 /// - 'com.google = FATAL'
10941 /// - 'root = INFO'
10942 /// - 'org.apache = DEBUG'
10943 pub driver_log_levels:
10944 std::collections::HashMap<std::string::String, crate::model::logging_config::Level>,
10945
10946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10947}
10948
10949impl LoggingConfig {
10950 /// Creates a new default instance.
10951 pub fn new() -> Self {
10952 std::default::Default::default()
10953 }
10954
10955 /// Sets the value of [driver_log_levels][crate::model::LoggingConfig::driver_log_levels].
10956 ///
10957 /// # Example
10958 /// ```ignore,no_run
10959 /// # use google_cloud_dataproc_v1::model::LoggingConfig;
10960 /// use google_cloud_dataproc_v1::model::logging_config::Level;
10961 /// let x = LoggingConfig::new().set_driver_log_levels([
10962 /// ("key0", Level::All),
10963 /// ("key1", Level::Trace),
10964 /// ("key2", Level::Debug),
10965 /// ]);
10966 /// ```
10967 pub fn set_driver_log_levels<T, K, V>(mut self, v: T) -> Self
10968 where
10969 T: std::iter::IntoIterator<Item = (K, V)>,
10970 K: std::convert::Into<std::string::String>,
10971 V: std::convert::Into<crate::model::logging_config::Level>,
10972 {
10973 use std::iter::Iterator;
10974 self.driver_log_levels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10975 self
10976 }
10977}
10978
10979impl wkt::message::Message for LoggingConfig {
10980 fn typename() -> &'static str {
10981 "type.googleapis.com/google.cloud.dataproc.v1.LoggingConfig"
10982 }
10983}
10984
10985/// Defines additional types related to [LoggingConfig].
10986pub mod logging_config {
10987 #[allow(unused_imports)]
10988 use super::*;
10989
10990 /// The Log4j level for job execution. When running an
10991 /// [Apache Hive](https://hive.apache.org/) job, Cloud
10992 /// Dataproc configures the Hive client to an equivalent verbosity level.
10993 ///
10994 /// # Working with unknown values
10995 ///
10996 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10997 /// additional enum variants at any time. Adding new variants is not considered
10998 /// a breaking change. Applications should write their code in anticipation of:
10999 ///
11000 /// - New values appearing in future releases of the client library, **and**
11001 /// - New values received dynamically, without application changes.
11002 ///
11003 /// Please consult the [Working with enums] section in the user guide for some
11004 /// guidelines.
11005 ///
11006 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11007 #[derive(Clone, Debug, PartialEq)]
11008 #[non_exhaustive]
11009 pub enum Level {
11010 /// Level is unspecified. Use default level for log4j.
11011 Unspecified,
11012 /// Use ALL level for log4j.
11013 All,
11014 /// Use TRACE level for log4j.
11015 Trace,
11016 /// Use DEBUG level for log4j.
11017 Debug,
11018 /// Use INFO level for log4j.
11019 Info,
11020 /// Use WARN level for log4j.
11021 Warn,
11022 /// Use ERROR level for log4j.
11023 Error,
11024 /// Use FATAL level for log4j.
11025 Fatal,
11026 /// Turn off log4j.
11027 Off,
11028 /// If set, the enum was initialized with an unknown value.
11029 ///
11030 /// Applications can examine the value using [Level::value] or
11031 /// [Level::name].
11032 UnknownValue(level::UnknownValue),
11033 }
11034
11035 #[doc(hidden)]
11036 pub mod level {
11037 #[allow(unused_imports)]
11038 use super::*;
11039 #[derive(Clone, Debug, PartialEq)]
11040 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11041 }
11042
11043 impl Level {
11044 /// Gets the enum value.
11045 ///
11046 /// Returns `None` if the enum contains an unknown value deserialized from
11047 /// the string representation of enums.
11048 pub fn value(&self) -> std::option::Option<i32> {
11049 match self {
11050 Self::Unspecified => std::option::Option::Some(0),
11051 Self::All => std::option::Option::Some(1),
11052 Self::Trace => std::option::Option::Some(2),
11053 Self::Debug => std::option::Option::Some(3),
11054 Self::Info => std::option::Option::Some(4),
11055 Self::Warn => std::option::Option::Some(5),
11056 Self::Error => std::option::Option::Some(6),
11057 Self::Fatal => std::option::Option::Some(7),
11058 Self::Off => std::option::Option::Some(8),
11059 Self::UnknownValue(u) => u.0.value(),
11060 }
11061 }
11062
11063 /// Gets the enum value as a string.
11064 ///
11065 /// Returns `None` if the enum contains an unknown value deserialized from
11066 /// the integer representation of enums.
11067 pub fn name(&self) -> std::option::Option<&str> {
11068 match self {
11069 Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
11070 Self::All => std::option::Option::Some("ALL"),
11071 Self::Trace => std::option::Option::Some("TRACE"),
11072 Self::Debug => std::option::Option::Some("DEBUG"),
11073 Self::Info => std::option::Option::Some("INFO"),
11074 Self::Warn => std::option::Option::Some("WARN"),
11075 Self::Error => std::option::Option::Some("ERROR"),
11076 Self::Fatal => std::option::Option::Some("FATAL"),
11077 Self::Off => std::option::Option::Some("OFF"),
11078 Self::UnknownValue(u) => u.0.name(),
11079 }
11080 }
11081 }
11082
11083 impl std::default::Default for Level {
11084 fn default() -> Self {
11085 use std::convert::From;
11086 Self::from(0)
11087 }
11088 }
11089
11090 impl std::fmt::Display for Level {
11091 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11092 wkt::internal::display_enum(f, self.name(), self.value())
11093 }
11094 }
11095
11096 impl std::convert::From<i32> for Level {
11097 fn from(value: i32) -> Self {
11098 match value {
11099 0 => Self::Unspecified,
11100 1 => Self::All,
11101 2 => Self::Trace,
11102 3 => Self::Debug,
11103 4 => Self::Info,
11104 5 => Self::Warn,
11105 6 => Self::Error,
11106 7 => Self::Fatal,
11107 8 => Self::Off,
11108 _ => Self::UnknownValue(level::UnknownValue(
11109 wkt::internal::UnknownEnumValue::Integer(value),
11110 )),
11111 }
11112 }
11113 }
11114
11115 impl std::convert::From<&str> for Level {
11116 fn from(value: &str) -> Self {
11117 use std::string::ToString;
11118 match value {
11119 "LEVEL_UNSPECIFIED" => Self::Unspecified,
11120 "ALL" => Self::All,
11121 "TRACE" => Self::Trace,
11122 "DEBUG" => Self::Debug,
11123 "INFO" => Self::Info,
11124 "WARN" => Self::Warn,
11125 "ERROR" => Self::Error,
11126 "FATAL" => Self::Fatal,
11127 "OFF" => Self::Off,
11128 _ => Self::UnknownValue(level::UnknownValue(
11129 wkt::internal::UnknownEnumValue::String(value.to_string()),
11130 )),
11131 }
11132 }
11133 }
11134
11135 impl serde::ser::Serialize for Level {
11136 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11137 where
11138 S: serde::Serializer,
11139 {
11140 match self {
11141 Self::Unspecified => serializer.serialize_i32(0),
11142 Self::All => serializer.serialize_i32(1),
11143 Self::Trace => serializer.serialize_i32(2),
11144 Self::Debug => serializer.serialize_i32(3),
11145 Self::Info => serializer.serialize_i32(4),
11146 Self::Warn => serializer.serialize_i32(5),
11147 Self::Error => serializer.serialize_i32(6),
11148 Self::Fatal => serializer.serialize_i32(7),
11149 Self::Off => serializer.serialize_i32(8),
11150 Self::UnknownValue(u) => u.0.serialize(serializer),
11151 }
11152 }
11153 }
11154
11155 impl<'de> serde::de::Deserialize<'de> for Level {
11156 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11157 where
11158 D: serde::Deserializer<'de>,
11159 {
11160 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
11161 ".google.cloud.dataproc.v1.LoggingConfig.Level",
11162 ))
11163 }
11164 }
11165}
11166
11167/// A Dataproc job for running
11168/// [Apache Hadoop
11169/// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html)
11170/// jobs on [Apache Hadoop
11171/// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
11172#[derive(Clone, Default, PartialEq)]
11173#[non_exhaustive]
11174pub struct HadoopJob {
11175 /// Optional. The arguments to pass to the driver. Do not
11176 /// include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
11177 /// job properties, since a collision might occur that causes an incorrect job
11178 /// submission.
11179 pub args: std::vec::Vec<std::string::String>,
11180
11181 /// Optional. Jar file URIs to add to the CLASSPATHs of the
11182 /// Hadoop driver and tasks.
11183 pub jar_file_uris: std::vec::Vec<std::string::String>,
11184
11185 /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied
11186 /// to the working directory of Hadoop drivers and distributed tasks. Useful
11187 /// for naively parallel tasks.
11188 pub file_uris: std::vec::Vec<std::string::String>,
11189
11190 /// Optional. HCFS URIs of archives to be extracted in the working directory of
11191 /// Hadoop drivers and tasks. Supported file types:
11192 /// .jar, .tar, .tar.gz, .tgz, or .zip.
11193 pub archive_uris: std::vec::Vec<std::string::String>,
11194
11195 /// Optional. A mapping of property names to values, used to configure Hadoop.
11196 /// Properties that conflict with values set by the Dataproc API might be
11197 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and
11198 /// classes in user code.
11199 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11200
11201 /// Optional. The runtime log config for job execution.
11202 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11203
11204 /// Required. Indicates the location of the driver's main class. Specify
11205 /// either the jar file that contains the main class or the main class name.
11206 /// To specify both, add the jar file to `jar_file_uris`, and then specify
11207 /// the main class name in this property.
11208 pub driver: std::option::Option<crate::model::hadoop_job::Driver>,
11209
11210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11211}
11212
11213impl HadoopJob {
11214 /// Creates a new default instance.
11215 pub fn new() -> Self {
11216 std::default::Default::default()
11217 }
11218
11219 /// Sets the value of [args][crate::model::HadoopJob::args].
11220 ///
11221 /// # Example
11222 /// ```ignore,no_run
11223 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11224 /// let x = HadoopJob::new().set_args(["a", "b", "c"]);
11225 /// ```
11226 pub fn set_args<T, V>(mut self, v: T) -> Self
11227 where
11228 T: std::iter::IntoIterator<Item = V>,
11229 V: std::convert::Into<std::string::String>,
11230 {
11231 use std::iter::Iterator;
11232 self.args = v.into_iter().map(|i| i.into()).collect();
11233 self
11234 }
11235
11236 /// Sets the value of [jar_file_uris][crate::model::HadoopJob::jar_file_uris].
11237 ///
11238 /// # Example
11239 /// ```ignore,no_run
11240 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11241 /// let x = HadoopJob::new().set_jar_file_uris(["a", "b", "c"]);
11242 /// ```
11243 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11244 where
11245 T: std::iter::IntoIterator<Item = V>,
11246 V: std::convert::Into<std::string::String>,
11247 {
11248 use std::iter::Iterator;
11249 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11250 self
11251 }
11252
11253 /// Sets the value of [file_uris][crate::model::HadoopJob::file_uris].
11254 ///
11255 /// # Example
11256 /// ```ignore,no_run
11257 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11258 /// let x = HadoopJob::new().set_file_uris(["a", "b", "c"]);
11259 /// ```
11260 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11261 where
11262 T: std::iter::IntoIterator<Item = V>,
11263 V: std::convert::Into<std::string::String>,
11264 {
11265 use std::iter::Iterator;
11266 self.file_uris = v.into_iter().map(|i| i.into()).collect();
11267 self
11268 }
11269
11270 /// Sets the value of [archive_uris][crate::model::HadoopJob::archive_uris].
11271 ///
11272 /// # Example
11273 /// ```ignore,no_run
11274 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11275 /// let x = HadoopJob::new().set_archive_uris(["a", "b", "c"]);
11276 /// ```
11277 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11278 where
11279 T: std::iter::IntoIterator<Item = V>,
11280 V: std::convert::Into<std::string::String>,
11281 {
11282 use std::iter::Iterator;
11283 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11284 self
11285 }
11286
11287 /// Sets the value of [properties][crate::model::HadoopJob::properties].
11288 ///
11289 /// # Example
11290 /// ```ignore,no_run
11291 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11292 /// let x = HadoopJob::new().set_properties([
11293 /// ("key0", "abc"),
11294 /// ("key1", "xyz"),
11295 /// ]);
11296 /// ```
11297 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11298 where
11299 T: std::iter::IntoIterator<Item = (K, V)>,
11300 K: std::convert::Into<std::string::String>,
11301 V: std::convert::Into<std::string::String>,
11302 {
11303 use std::iter::Iterator;
11304 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11305 self
11306 }
11307
11308 /// Sets the value of [logging_config][crate::model::HadoopJob::logging_config].
11309 ///
11310 /// # Example
11311 /// ```ignore,no_run
11312 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11313 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11314 /// let x = HadoopJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11315 /// ```
11316 pub fn set_logging_config<T>(mut self, v: T) -> Self
11317 where
11318 T: std::convert::Into<crate::model::LoggingConfig>,
11319 {
11320 self.logging_config = std::option::Option::Some(v.into());
11321 self
11322 }
11323
11324 /// Sets or clears the value of [logging_config][crate::model::HadoopJob::logging_config].
11325 ///
11326 /// # Example
11327 /// ```ignore,no_run
11328 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11329 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11330 /// let x = HadoopJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11331 /// let x = HadoopJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11332 /// ```
11333 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11334 where
11335 T: std::convert::Into<crate::model::LoggingConfig>,
11336 {
11337 self.logging_config = v.map(|x| x.into());
11338 self
11339 }
11340
11341 /// Sets the value of [driver][crate::model::HadoopJob::driver].
11342 ///
11343 /// Note that all the setters affecting `driver` are mutually
11344 /// exclusive.
11345 ///
11346 /// # Example
11347 /// ```ignore,no_run
11348 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11349 /// use google_cloud_dataproc_v1::model::hadoop_job::Driver;
11350 /// let x = HadoopJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
11351 /// ```
11352 pub fn set_driver<
11353 T: std::convert::Into<std::option::Option<crate::model::hadoop_job::Driver>>,
11354 >(
11355 mut self,
11356 v: T,
11357 ) -> Self {
11358 self.driver = v.into();
11359 self
11360 }
11361
11362 /// The value of [driver][crate::model::HadoopJob::driver]
11363 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
11364 /// holds a different branch.
11365 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
11366 #[allow(unreachable_patterns)]
11367 self.driver.as_ref().and_then(|v| match v {
11368 crate::model::hadoop_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
11369 _ => std::option::Option::None,
11370 })
11371 }
11372
11373 /// Sets the value of [driver][crate::model::HadoopJob::driver]
11374 /// to hold a `MainJarFileUri`.
11375 ///
11376 /// Note that all the setters affecting `driver` are
11377 /// mutually exclusive.
11378 ///
11379 /// # Example
11380 /// ```ignore,no_run
11381 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11382 /// let x = HadoopJob::new().set_main_jar_file_uri("example");
11383 /// assert!(x.main_jar_file_uri().is_some());
11384 /// assert!(x.main_class().is_none());
11385 /// ```
11386 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
11387 mut self,
11388 v: T,
11389 ) -> Self {
11390 self.driver =
11391 std::option::Option::Some(crate::model::hadoop_job::Driver::MainJarFileUri(v.into()));
11392 self
11393 }
11394
11395 /// The value of [driver][crate::model::HadoopJob::driver]
11396 /// if it holds a `MainClass`, `None` if the field is not set or
11397 /// holds a different branch.
11398 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
11399 #[allow(unreachable_patterns)]
11400 self.driver.as_ref().and_then(|v| match v {
11401 crate::model::hadoop_job::Driver::MainClass(v) => std::option::Option::Some(v),
11402 _ => std::option::Option::None,
11403 })
11404 }
11405
11406 /// Sets the value of [driver][crate::model::HadoopJob::driver]
11407 /// to hold a `MainClass`.
11408 ///
11409 /// Note that all the setters affecting `driver` are
11410 /// mutually exclusive.
11411 ///
11412 /// # Example
11413 /// ```ignore,no_run
11414 /// # use google_cloud_dataproc_v1::model::HadoopJob;
11415 /// let x = HadoopJob::new().set_main_class("example");
11416 /// assert!(x.main_class().is_some());
11417 /// assert!(x.main_jar_file_uri().is_none());
11418 /// ```
11419 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11420 self.driver =
11421 std::option::Option::Some(crate::model::hadoop_job::Driver::MainClass(v.into()));
11422 self
11423 }
11424}
11425
11426impl wkt::message::Message for HadoopJob {
11427 fn typename() -> &'static str {
11428 "type.googleapis.com/google.cloud.dataproc.v1.HadoopJob"
11429 }
11430}
11431
11432/// Defines additional types related to [HadoopJob].
11433pub mod hadoop_job {
11434 #[allow(unused_imports)]
11435 use super::*;
11436
11437 /// Required. Indicates the location of the driver's main class. Specify
11438 /// either the jar file that contains the main class or the main class name.
11439 /// To specify both, add the jar file to `jar_file_uris`, and then specify
11440 /// the main class name in this property.
11441 #[derive(Clone, Debug, PartialEq)]
11442 #[non_exhaustive]
11443 pub enum Driver {
11444 /// The HCFS URI of the jar file containing the main class.
11445 /// Examples:
11446 /// 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar'
11447 /// 'hdfs:/tmp/test-samples/custom-wordcount.jar'
11448 /// 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
11449 MainJarFileUri(std::string::String),
11450 /// The name of the driver's main class. The jar file containing the class
11451 /// must be in the default CLASSPATH or specified in `jar_file_uris`.
11452 MainClass(std::string::String),
11453 }
11454}
11455
11456/// A Dataproc job for running [Apache Spark](https://spark.apache.org/)
11457/// applications on YARN.
11458#[derive(Clone, Default, PartialEq)]
11459#[non_exhaustive]
11460pub struct SparkJob {
11461 /// Optional. The arguments to pass to the driver. Do not include arguments,
11462 /// such as `--conf`, that can be set as job properties, since a collision may
11463 /// occur that causes an incorrect job submission.
11464 pub args: std::vec::Vec<std::string::String>,
11465
11466 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
11467 /// Spark driver and tasks.
11468 pub jar_file_uris: std::vec::Vec<std::string::String>,
11469
11470 /// Optional. HCFS URIs of files to be placed in the working directory of
11471 /// each executor. Useful for naively parallel tasks.
11472 pub file_uris: std::vec::Vec<std::string::String>,
11473
11474 /// Optional. HCFS URIs of archives to be extracted into the working directory
11475 /// of each executor. Supported file types:
11476 /// .jar, .tar, .tar.gz, .tgz, and .zip.
11477 pub archive_uris: std::vec::Vec<std::string::String>,
11478
11479 /// Optional. A mapping of property names to values, used to configure Spark.
11480 /// Properties that conflict with values set by the Dataproc API might be
11481 /// overwritten. Can include properties set in
11482 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11483 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11484
11485 /// Optional. The runtime log config for job execution.
11486 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11487
11488 /// Required. The specification of the main method to call to drive the job.
11489 /// Specify either the jar file that contains the main class or the main class
11490 /// name. To pass both a main jar and a main class in that jar, add the jar to
11491 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
11492 /// specify the main class name in
11493 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
11494 ///
11495 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
11496 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
11497 pub driver: std::option::Option<crate::model::spark_job::Driver>,
11498
11499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11500}
11501
11502impl SparkJob {
11503 /// Creates a new default instance.
11504 pub fn new() -> Self {
11505 std::default::Default::default()
11506 }
11507
11508 /// Sets the value of [args][crate::model::SparkJob::args].
11509 ///
11510 /// # Example
11511 /// ```ignore,no_run
11512 /// # use google_cloud_dataproc_v1::model::SparkJob;
11513 /// let x = SparkJob::new().set_args(["a", "b", "c"]);
11514 /// ```
11515 pub fn set_args<T, V>(mut self, v: T) -> Self
11516 where
11517 T: std::iter::IntoIterator<Item = V>,
11518 V: std::convert::Into<std::string::String>,
11519 {
11520 use std::iter::Iterator;
11521 self.args = v.into_iter().map(|i| i.into()).collect();
11522 self
11523 }
11524
11525 /// Sets the value of [jar_file_uris][crate::model::SparkJob::jar_file_uris].
11526 ///
11527 /// # Example
11528 /// ```ignore,no_run
11529 /// # use google_cloud_dataproc_v1::model::SparkJob;
11530 /// let x = SparkJob::new().set_jar_file_uris(["a", "b", "c"]);
11531 /// ```
11532 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11533 where
11534 T: std::iter::IntoIterator<Item = V>,
11535 V: std::convert::Into<std::string::String>,
11536 {
11537 use std::iter::Iterator;
11538 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11539 self
11540 }
11541
11542 /// Sets the value of [file_uris][crate::model::SparkJob::file_uris].
11543 ///
11544 /// # Example
11545 /// ```ignore,no_run
11546 /// # use google_cloud_dataproc_v1::model::SparkJob;
11547 /// let x = SparkJob::new().set_file_uris(["a", "b", "c"]);
11548 /// ```
11549 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11550 where
11551 T: std::iter::IntoIterator<Item = V>,
11552 V: std::convert::Into<std::string::String>,
11553 {
11554 use std::iter::Iterator;
11555 self.file_uris = v.into_iter().map(|i| i.into()).collect();
11556 self
11557 }
11558
11559 /// Sets the value of [archive_uris][crate::model::SparkJob::archive_uris].
11560 ///
11561 /// # Example
11562 /// ```ignore,no_run
11563 /// # use google_cloud_dataproc_v1::model::SparkJob;
11564 /// let x = SparkJob::new().set_archive_uris(["a", "b", "c"]);
11565 /// ```
11566 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11567 where
11568 T: std::iter::IntoIterator<Item = V>,
11569 V: std::convert::Into<std::string::String>,
11570 {
11571 use std::iter::Iterator;
11572 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11573 self
11574 }
11575
11576 /// Sets the value of [properties][crate::model::SparkJob::properties].
11577 ///
11578 /// # Example
11579 /// ```ignore,no_run
11580 /// # use google_cloud_dataproc_v1::model::SparkJob;
11581 /// let x = SparkJob::new().set_properties([
11582 /// ("key0", "abc"),
11583 /// ("key1", "xyz"),
11584 /// ]);
11585 /// ```
11586 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11587 where
11588 T: std::iter::IntoIterator<Item = (K, V)>,
11589 K: std::convert::Into<std::string::String>,
11590 V: std::convert::Into<std::string::String>,
11591 {
11592 use std::iter::Iterator;
11593 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11594 self
11595 }
11596
11597 /// Sets the value of [logging_config][crate::model::SparkJob::logging_config].
11598 ///
11599 /// # Example
11600 /// ```ignore,no_run
11601 /// # use google_cloud_dataproc_v1::model::SparkJob;
11602 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11603 /// let x = SparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11604 /// ```
11605 pub fn set_logging_config<T>(mut self, v: T) -> Self
11606 where
11607 T: std::convert::Into<crate::model::LoggingConfig>,
11608 {
11609 self.logging_config = std::option::Option::Some(v.into());
11610 self
11611 }
11612
11613 /// Sets or clears the value of [logging_config][crate::model::SparkJob::logging_config].
11614 ///
11615 /// # Example
11616 /// ```ignore,no_run
11617 /// # use google_cloud_dataproc_v1::model::SparkJob;
11618 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11619 /// let x = SparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11620 /// let x = SparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11621 /// ```
11622 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11623 where
11624 T: std::convert::Into<crate::model::LoggingConfig>,
11625 {
11626 self.logging_config = v.map(|x| x.into());
11627 self
11628 }
11629
11630 /// Sets the value of [driver][crate::model::SparkJob::driver].
11631 ///
11632 /// Note that all the setters affecting `driver` are mutually
11633 /// exclusive.
11634 ///
11635 /// # Example
11636 /// ```ignore,no_run
11637 /// # use google_cloud_dataproc_v1::model::SparkJob;
11638 /// use google_cloud_dataproc_v1::model::spark_job::Driver;
11639 /// let x = SparkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
11640 /// ```
11641 pub fn set_driver<
11642 T: std::convert::Into<std::option::Option<crate::model::spark_job::Driver>>,
11643 >(
11644 mut self,
11645 v: T,
11646 ) -> Self {
11647 self.driver = v.into();
11648 self
11649 }
11650
11651 /// The value of [driver][crate::model::SparkJob::driver]
11652 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
11653 /// holds a different branch.
11654 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
11655 #[allow(unreachable_patterns)]
11656 self.driver.as_ref().and_then(|v| match v {
11657 crate::model::spark_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
11658 _ => std::option::Option::None,
11659 })
11660 }
11661
11662 /// Sets the value of [driver][crate::model::SparkJob::driver]
11663 /// to hold a `MainJarFileUri`.
11664 ///
11665 /// Note that all the setters affecting `driver` are
11666 /// mutually exclusive.
11667 ///
11668 /// # Example
11669 /// ```ignore,no_run
11670 /// # use google_cloud_dataproc_v1::model::SparkJob;
11671 /// let x = SparkJob::new().set_main_jar_file_uri("example");
11672 /// assert!(x.main_jar_file_uri().is_some());
11673 /// assert!(x.main_class().is_none());
11674 /// ```
11675 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
11676 mut self,
11677 v: T,
11678 ) -> Self {
11679 self.driver =
11680 std::option::Option::Some(crate::model::spark_job::Driver::MainJarFileUri(v.into()));
11681 self
11682 }
11683
11684 /// The value of [driver][crate::model::SparkJob::driver]
11685 /// if it holds a `MainClass`, `None` if the field is not set or
11686 /// holds a different branch.
11687 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
11688 #[allow(unreachable_patterns)]
11689 self.driver.as_ref().and_then(|v| match v {
11690 crate::model::spark_job::Driver::MainClass(v) => std::option::Option::Some(v),
11691 _ => std::option::Option::None,
11692 })
11693 }
11694
11695 /// Sets the value of [driver][crate::model::SparkJob::driver]
11696 /// to hold a `MainClass`.
11697 ///
11698 /// Note that all the setters affecting `driver` are
11699 /// mutually exclusive.
11700 ///
11701 /// # Example
11702 /// ```ignore,no_run
11703 /// # use google_cloud_dataproc_v1::model::SparkJob;
11704 /// let x = SparkJob::new().set_main_class("example");
11705 /// assert!(x.main_class().is_some());
11706 /// assert!(x.main_jar_file_uri().is_none());
11707 /// ```
11708 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11709 self.driver =
11710 std::option::Option::Some(crate::model::spark_job::Driver::MainClass(v.into()));
11711 self
11712 }
11713}
11714
11715impl wkt::message::Message for SparkJob {
11716 fn typename() -> &'static str {
11717 "type.googleapis.com/google.cloud.dataproc.v1.SparkJob"
11718 }
11719}
11720
11721/// Defines additional types related to [SparkJob].
11722pub mod spark_job {
11723 #[allow(unused_imports)]
11724 use super::*;
11725
11726 /// Required. The specification of the main method to call to drive the job.
11727 /// Specify either the jar file that contains the main class or the main class
11728 /// name. To pass both a main jar and a main class in that jar, add the jar to
11729 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
11730 /// specify the main class name in
11731 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
11732 ///
11733 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
11734 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
11735 #[derive(Clone, Debug, PartialEq)]
11736 #[non_exhaustive]
11737 pub enum Driver {
11738 /// The HCFS URI of the jar file that contains the main class.
11739 MainJarFileUri(std::string::String),
11740 /// The name of the driver's main class. The jar file that contains the class
11741 /// must be in the default CLASSPATH or specified in
11742 /// SparkJob.jar_file_uris.
11743 MainClass(std::string::String),
11744 }
11745}
11746
11747/// A Dataproc job for running
11748/// [Apache
11749/// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html)
11750/// applications on YARN.
11751#[derive(Clone, Default, PartialEq)]
11752#[non_exhaustive]
11753pub struct PySparkJob {
11754 /// Required. The HCFS URI of the main Python file to use as the driver. Must
11755 /// be a .py file.
11756 pub main_python_file_uri: std::string::String,
11757
11758 /// Optional. The arguments to pass to the driver. Do not include arguments,
11759 /// such as `--conf`, that can be set as job properties, since a collision may
11760 /// occur that causes an incorrect job submission.
11761 pub args: std::vec::Vec<std::string::String>,
11762
11763 /// Optional. HCFS file URIs of Python files to pass to the PySpark
11764 /// framework. Supported file types: .py, .egg, and .zip.
11765 pub python_file_uris: std::vec::Vec<std::string::String>,
11766
11767 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
11768 /// Python driver and tasks.
11769 pub jar_file_uris: std::vec::Vec<std::string::String>,
11770
11771 /// Optional. HCFS URIs of files to be placed in the working directory of
11772 /// each executor. Useful for naively parallel tasks.
11773 pub file_uris: std::vec::Vec<std::string::String>,
11774
11775 /// Optional. HCFS URIs of archives to be extracted into the working directory
11776 /// of each executor. Supported file types:
11777 /// .jar, .tar, .tar.gz, .tgz, and .zip.
11778 pub archive_uris: std::vec::Vec<std::string::String>,
11779
11780 /// Optional. A mapping of property names to values, used to configure PySpark.
11781 /// Properties that conflict with values set by the Dataproc API might be
11782 /// overwritten. Can include properties set in
11783 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11784 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11785
11786 /// Optional. The runtime log config for job execution.
11787 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11788
11789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11790}
11791
11792impl PySparkJob {
11793 /// Creates a new default instance.
11794 pub fn new() -> Self {
11795 std::default::Default::default()
11796 }
11797
11798 /// Sets the value of [main_python_file_uri][crate::model::PySparkJob::main_python_file_uri].
11799 ///
11800 /// # Example
11801 /// ```ignore,no_run
11802 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11803 /// let x = PySparkJob::new().set_main_python_file_uri("example");
11804 /// ```
11805 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
11806 mut self,
11807 v: T,
11808 ) -> Self {
11809 self.main_python_file_uri = v.into();
11810 self
11811 }
11812
11813 /// Sets the value of [args][crate::model::PySparkJob::args].
11814 ///
11815 /// # Example
11816 /// ```ignore,no_run
11817 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11818 /// let x = PySparkJob::new().set_args(["a", "b", "c"]);
11819 /// ```
11820 pub fn set_args<T, V>(mut self, v: T) -> Self
11821 where
11822 T: std::iter::IntoIterator<Item = V>,
11823 V: std::convert::Into<std::string::String>,
11824 {
11825 use std::iter::Iterator;
11826 self.args = v.into_iter().map(|i| i.into()).collect();
11827 self
11828 }
11829
11830 /// Sets the value of [python_file_uris][crate::model::PySparkJob::python_file_uris].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11835 /// let x = PySparkJob::new().set_python_file_uris(["a", "b", "c"]);
11836 /// ```
11837 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
11838 where
11839 T: std::iter::IntoIterator<Item = V>,
11840 V: std::convert::Into<std::string::String>,
11841 {
11842 use std::iter::Iterator;
11843 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
11844 self
11845 }
11846
11847 /// Sets the value of [jar_file_uris][crate::model::PySparkJob::jar_file_uris].
11848 ///
11849 /// # Example
11850 /// ```ignore,no_run
11851 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11852 /// let x = PySparkJob::new().set_jar_file_uris(["a", "b", "c"]);
11853 /// ```
11854 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11855 where
11856 T: std::iter::IntoIterator<Item = V>,
11857 V: std::convert::Into<std::string::String>,
11858 {
11859 use std::iter::Iterator;
11860 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11861 self
11862 }
11863
11864 /// Sets the value of [file_uris][crate::model::PySparkJob::file_uris].
11865 ///
11866 /// # Example
11867 /// ```ignore,no_run
11868 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11869 /// let x = PySparkJob::new().set_file_uris(["a", "b", "c"]);
11870 /// ```
11871 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11872 where
11873 T: std::iter::IntoIterator<Item = V>,
11874 V: std::convert::Into<std::string::String>,
11875 {
11876 use std::iter::Iterator;
11877 self.file_uris = v.into_iter().map(|i| i.into()).collect();
11878 self
11879 }
11880
11881 /// Sets the value of [archive_uris][crate::model::PySparkJob::archive_uris].
11882 ///
11883 /// # Example
11884 /// ```ignore,no_run
11885 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11886 /// let x = PySparkJob::new().set_archive_uris(["a", "b", "c"]);
11887 /// ```
11888 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11889 where
11890 T: std::iter::IntoIterator<Item = V>,
11891 V: std::convert::Into<std::string::String>,
11892 {
11893 use std::iter::Iterator;
11894 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11895 self
11896 }
11897
11898 /// Sets the value of [properties][crate::model::PySparkJob::properties].
11899 ///
11900 /// # Example
11901 /// ```ignore,no_run
11902 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11903 /// let x = PySparkJob::new().set_properties([
11904 /// ("key0", "abc"),
11905 /// ("key1", "xyz"),
11906 /// ]);
11907 /// ```
11908 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11909 where
11910 T: std::iter::IntoIterator<Item = (K, V)>,
11911 K: std::convert::Into<std::string::String>,
11912 V: std::convert::Into<std::string::String>,
11913 {
11914 use std::iter::Iterator;
11915 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11916 self
11917 }
11918
11919 /// Sets the value of [logging_config][crate::model::PySparkJob::logging_config].
11920 ///
11921 /// # Example
11922 /// ```ignore,no_run
11923 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11924 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11925 /// let x = PySparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11926 /// ```
11927 pub fn set_logging_config<T>(mut self, v: T) -> Self
11928 where
11929 T: std::convert::Into<crate::model::LoggingConfig>,
11930 {
11931 self.logging_config = std::option::Option::Some(v.into());
11932 self
11933 }
11934
11935 /// Sets or clears the value of [logging_config][crate::model::PySparkJob::logging_config].
11936 ///
11937 /// # Example
11938 /// ```ignore,no_run
11939 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11940 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11941 /// let x = PySparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11942 /// let x = PySparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11943 /// ```
11944 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11945 where
11946 T: std::convert::Into<crate::model::LoggingConfig>,
11947 {
11948 self.logging_config = v.map(|x| x.into());
11949 self
11950 }
11951}
11952
11953impl wkt::message::Message for PySparkJob {
11954 fn typename() -> &'static str {
11955 "type.googleapis.com/google.cloud.dataproc.v1.PySparkJob"
11956 }
11957}
11958
11959/// A list of queries to run on a cluster.
11960#[derive(Clone, Default, PartialEq)]
11961#[non_exhaustive]
11962pub struct QueryList {
11963 /// Required. The queries to execute. You do not need to end a query expression
11964 /// with a semicolon. Multiple queries can be specified in one
11965 /// string by separating each with a semicolon. Here is an example of a
11966 /// Dataproc API snippet that uses a QueryList to specify a HiveJob:
11967 ///
11968 /// ```norust
11969 /// "hiveJob": {
11970 /// "queryList": {
11971 /// "queries": [
11972 /// "query1",
11973 /// "query2",
11974 /// "query3;query4",
11975 /// ]
11976 /// }
11977 /// }
11978 /// ```
11979 pub queries: std::vec::Vec<std::string::String>,
11980
11981 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11982}
11983
11984impl QueryList {
11985 /// Creates a new default instance.
11986 pub fn new() -> Self {
11987 std::default::Default::default()
11988 }
11989
11990 /// Sets the value of [queries][crate::model::QueryList::queries].
11991 ///
11992 /// # Example
11993 /// ```ignore,no_run
11994 /// # use google_cloud_dataproc_v1::model::QueryList;
11995 /// let x = QueryList::new().set_queries(["a", "b", "c"]);
11996 /// ```
11997 pub fn set_queries<T, V>(mut self, v: T) -> Self
11998 where
11999 T: std::iter::IntoIterator<Item = V>,
12000 V: std::convert::Into<std::string::String>,
12001 {
12002 use std::iter::Iterator;
12003 self.queries = v.into_iter().map(|i| i.into()).collect();
12004 self
12005 }
12006}
12007
12008impl wkt::message::Message for QueryList {
12009 fn typename() -> &'static str {
12010 "type.googleapis.com/google.cloud.dataproc.v1.QueryList"
12011 }
12012}
12013
12014/// A Dataproc job for running [Apache Hive](https://hive.apache.org/)
12015/// queries on YARN.
12016#[derive(Clone, Default, PartialEq)]
12017#[non_exhaustive]
12018pub struct HiveJob {
12019 /// Optional. Whether to continue executing queries if a query fails.
12020 /// The default value is `false`. Setting to `true` can be useful when
12021 /// executing independent parallel queries.
12022 pub continue_on_failure: bool,
12023
12024 /// Optional. Mapping of query variable names to values (equivalent to the
12025 /// Hive command: `SET name="value";`).
12026 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
12027
12028 /// Optional. A mapping of property names and values, used to configure Hive.
12029 /// Properties that conflict with values set by the Dataproc API might be
12030 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
12031 /// /etc/hive/conf/hive-site.xml, and classes in user code.
12032 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12033
12034 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the
12035 /// Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes
12036 /// and UDFs.
12037 pub jar_file_uris: std::vec::Vec<std::string::String>,
12038
12039 /// Required. The sequence of Hive queries to execute, specified as either
12040 /// an HCFS file URI or a list of queries.
12041 pub queries: std::option::Option<crate::model::hive_job::Queries>,
12042
12043 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12044}
12045
12046impl HiveJob {
12047 /// Creates a new default instance.
12048 pub fn new() -> Self {
12049 std::default::Default::default()
12050 }
12051
12052 /// Sets the value of [continue_on_failure][crate::model::HiveJob::continue_on_failure].
12053 ///
12054 /// # Example
12055 /// ```ignore,no_run
12056 /// # use google_cloud_dataproc_v1::model::HiveJob;
12057 /// let x = HiveJob::new().set_continue_on_failure(true);
12058 /// ```
12059 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12060 self.continue_on_failure = v.into();
12061 self
12062 }
12063
12064 /// Sets the value of [script_variables][crate::model::HiveJob::script_variables].
12065 ///
12066 /// # Example
12067 /// ```ignore,no_run
12068 /// # use google_cloud_dataproc_v1::model::HiveJob;
12069 /// let x = HiveJob::new().set_script_variables([
12070 /// ("key0", "abc"),
12071 /// ("key1", "xyz"),
12072 /// ]);
12073 /// ```
12074 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
12075 where
12076 T: std::iter::IntoIterator<Item = (K, V)>,
12077 K: std::convert::Into<std::string::String>,
12078 V: std::convert::Into<std::string::String>,
12079 {
12080 use std::iter::Iterator;
12081 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12082 self
12083 }
12084
12085 /// Sets the value of [properties][crate::model::HiveJob::properties].
12086 ///
12087 /// # Example
12088 /// ```ignore,no_run
12089 /// # use google_cloud_dataproc_v1::model::HiveJob;
12090 /// let x = HiveJob::new().set_properties([
12091 /// ("key0", "abc"),
12092 /// ("key1", "xyz"),
12093 /// ]);
12094 /// ```
12095 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12096 where
12097 T: std::iter::IntoIterator<Item = (K, V)>,
12098 K: std::convert::Into<std::string::String>,
12099 V: std::convert::Into<std::string::String>,
12100 {
12101 use std::iter::Iterator;
12102 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12103 self
12104 }
12105
12106 /// Sets the value of [jar_file_uris][crate::model::HiveJob::jar_file_uris].
12107 ///
12108 /// # Example
12109 /// ```ignore,no_run
12110 /// # use google_cloud_dataproc_v1::model::HiveJob;
12111 /// let x = HiveJob::new().set_jar_file_uris(["a", "b", "c"]);
12112 /// ```
12113 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12114 where
12115 T: std::iter::IntoIterator<Item = V>,
12116 V: std::convert::Into<std::string::String>,
12117 {
12118 use std::iter::Iterator;
12119 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12120 self
12121 }
12122
12123 /// Sets the value of [queries][crate::model::HiveJob::queries].
12124 ///
12125 /// Note that all the setters affecting `queries` are mutually
12126 /// exclusive.
12127 ///
12128 /// # Example
12129 /// ```ignore,no_run
12130 /// # use google_cloud_dataproc_v1::model::HiveJob;
12131 /// use google_cloud_dataproc_v1::model::hive_job::Queries;
12132 /// let x = HiveJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12133 /// ```
12134 pub fn set_queries<
12135 T: std::convert::Into<std::option::Option<crate::model::hive_job::Queries>>,
12136 >(
12137 mut self,
12138 v: T,
12139 ) -> Self {
12140 self.queries = v.into();
12141 self
12142 }
12143
12144 /// The value of [queries][crate::model::HiveJob::queries]
12145 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12146 /// holds a different branch.
12147 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12148 #[allow(unreachable_patterns)]
12149 self.queries.as_ref().and_then(|v| match v {
12150 crate::model::hive_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12151 _ => std::option::Option::None,
12152 })
12153 }
12154
12155 /// Sets the value of [queries][crate::model::HiveJob::queries]
12156 /// to hold a `QueryFileUri`.
12157 ///
12158 /// Note that all the setters affecting `queries` are
12159 /// mutually exclusive.
12160 ///
12161 /// # Example
12162 /// ```ignore,no_run
12163 /// # use google_cloud_dataproc_v1::model::HiveJob;
12164 /// let x = HiveJob::new().set_query_file_uri("example");
12165 /// assert!(x.query_file_uri().is_some());
12166 /// assert!(x.query_list().is_none());
12167 /// ```
12168 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12169 self.queries =
12170 std::option::Option::Some(crate::model::hive_job::Queries::QueryFileUri(v.into()));
12171 self
12172 }
12173
12174 /// The value of [queries][crate::model::HiveJob::queries]
12175 /// if it holds a `QueryList`, `None` if the field is not set or
12176 /// holds a different branch.
12177 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12178 #[allow(unreachable_patterns)]
12179 self.queries.as_ref().and_then(|v| match v {
12180 crate::model::hive_job::Queries::QueryList(v) => std::option::Option::Some(v),
12181 _ => std::option::Option::None,
12182 })
12183 }
12184
12185 /// Sets the value of [queries][crate::model::HiveJob::queries]
12186 /// to hold a `QueryList`.
12187 ///
12188 /// Note that all the setters affecting `queries` are
12189 /// mutually exclusive.
12190 ///
12191 /// # Example
12192 /// ```ignore,no_run
12193 /// # use google_cloud_dataproc_v1::model::HiveJob;
12194 /// use google_cloud_dataproc_v1::model::QueryList;
12195 /// let x = HiveJob::new().set_query_list(QueryList::default()/* use setters */);
12196 /// assert!(x.query_list().is_some());
12197 /// assert!(x.query_file_uri().is_none());
12198 /// ```
12199 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12200 mut self,
12201 v: T,
12202 ) -> Self {
12203 self.queries =
12204 std::option::Option::Some(crate::model::hive_job::Queries::QueryList(v.into()));
12205 self
12206 }
12207}
12208
12209impl wkt::message::Message for HiveJob {
12210 fn typename() -> &'static str {
12211 "type.googleapis.com/google.cloud.dataproc.v1.HiveJob"
12212 }
12213}
12214
12215/// Defines additional types related to [HiveJob].
12216pub mod hive_job {
12217 #[allow(unused_imports)]
12218 use super::*;
12219
12220 /// Required. The sequence of Hive queries to execute, specified as either
12221 /// an HCFS file URI or a list of queries.
12222 #[derive(Clone, Debug, PartialEq)]
12223 #[non_exhaustive]
12224 pub enum Queries {
12225 /// The HCFS URI of the script that contains Hive queries.
12226 QueryFileUri(std::string::String),
12227 /// A list of queries.
12228 QueryList(std::boxed::Box<crate::model::QueryList>),
12229 }
12230}
12231
12232/// A Dataproc job for running [Apache Spark
12233/// SQL](https://spark.apache.org/sql/) queries.
12234#[derive(Clone, Default, PartialEq)]
12235#[non_exhaustive]
12236pub struct SparkSqlJob {
12237 /// Optional. Mapping of query variable names to values (equivalent to the
12238 /// Spark SQL command: SET `name="value";`).
12239 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
12240
12241 /// Optional. A mapping of property names to values, used to configure
12242 /// Spark SQL's SparkConf. Properties that conflict with values set by the
12243 /// Dataproc API might be overwritten.
12244 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12245
12246 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
12247 pub jar_file_uris: std::vec::Vec<std::string::String>,
12248
12249 /// Optional. The runtime log config for job execution.
12250 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12251
12252 /// Required. The sequence of Spark SQL queries to execute, specified as
12253 /// either an HCFS file URI or as a list of queries.
12254 pub queries: std::option::Option<crate::model::spark_sql_job::Queries>,
12255
12256 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12257}
12258
12259impl SparkSqlJob {
12260 /// Creates a new default instance.
12261 pub fn new() -> Self {
12262 std::default::Default::default()
12263 }
12264
12265 /// Sets the value of [script_variables][crate::model::SparkSqlJob::script_variables].
12266 ///
12267 /// # Example
12268 /// ```ignore,no_run
12269 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12270 /// let x = SparkSqlJob::new().set_script_variables([
12271 /// ("key0", "abc"),
12272 /// ("key1", "xyz"),
12273 /// ]);
12274 /// ```
12275 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
12276 where
12277 T: std::iter::IntoIterator<Item = (K, V)>,
12278 K: std::convert::Into<std::string::String>,
12279 V: std::convert::Into<std::string::String>,
12280 {
12281 use std::iter::Iterator;
12282 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12283 self
12284 }
12285
12286 /// Sets the value of [properties][crate::model::SparkSqlJob::properties].
12287 ///
12288 /// # Example
12289 /// ```ignore,no_run
12290 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12291 /// let x = SparkSqlJob::new().set_properties([
12292 /// ("key0", "abc"),
12293 /// ("key1", "xyz"),
12294 /// ]);
12295 /// ```
12296 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12297 where
12298 T: std::iter::IntoIterator<Item = (K, V)>,
12299 K: std::convert::Into<std::string::String>,
12300 V: std::convert::Into<std::string::String>,
12301 {
12302 use std::iter::Iterator;
12303 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12304 self
12305 }
12306
12307 /// Sets the value of [jar_file_uris][crate::model::SparkSqlJob::jar_file_uris].
12308 ///
12309 /// # Example
12310 /// ```ignore,no_run
12311 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12312 /// let x = SparkSqlJob::new().set_jar_file_uris(["a", "b", "c"]);
12313 /// ```
12314 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12315 where
12316 T: std::iter::IntoIterator<Item = V>,
12317 V: std::convert::Into<std::string::String>,
12318 {
12319 use std::iter::Iterator;
12320 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12321 self
12322 }
12323
12324 /// Sets the value of [logging_config][crate::model::SparkSqlJob::logging_config].
12325 ///
12326 /// # Example
12327 /// ```ignore,no_run
12328 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12329 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12330 /// let x = SparkSqlJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12331 /// ```
12332 pub fn set_logging_config<T>(mut self, v: T) -> Self
12333 where
12334 T: std::convert::Into<crate::model::LoggingConfig>,
12335 {
12336 self.logging_config = std::option::Option::Some(v.into());
12337 self
12338 }
12339
12340 /// Sets or clears the value of [logging_config][crate::model::SparkSqlJob::logging_config].
12341 ///
12342 /// # Example
12343 /// ```ignore,no_run
12344 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12345 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12346 /// let x = SparkSqlJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12347 /// let x = SparkSqlJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12348 /// ```
12349 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12350 where
12351 T: std::convert::Into<crate::model::LoggingConfig>,
12352 {
12353 self.logging_config = v.map(|x| x.into());
12354 self
12355 }
12356
12357 /// Sets the value of [queries][crate::model::SparkSqlJob::queries].
12358 ///
12359 /// Note that all the setters affecting `queries` are mutually
12360 /// exclusive.
12361 ///
12362 /// # Example
12363 /// ```ignore,no_run
12364 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12365 /// use google_cloud_dataproc_v1::model::spark_sql_job::Queries;
12366 /// let x = SparkSqlJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12367 /// ```
12368 pub fn set_queries<
12369 T: std::convert::Into<std::option::Option<crate::model::spark_sql_job::Queries>>,
12370 >(
12371 mut self,
12372 v: T,
12373 ) -> Self {
12374 self.queries = v.into();
12375 self
12376 }
12377
12378 /// The value of [queries][crate::model::SparkSqlJob::queries]
12379 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12380 /// holds a different branch.
12381 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12382 #[allow(unreachable_patterns)]
12383 self.queries.as_ref().and_then(|v| match v {
12384 crate::model::spark_sql_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12385 _ => std::option::Option::None,
12386 })
12387 }
12388
12389 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
12390 /// to hold a `QueryFileUri`.
12391 ///
12392 /// Note that all the setters affecting `queries` are
12393 /// mutually exclusive.
12394 ///
12395 /// # Example
12396 /// ```ignore,no_run
12397 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12398 /// let x = SparkSqlJob::new().set_query_file_uri("example");
12399 /// assert!(x.query_file_uri().is_some());
12400 /// assert!(x.query_list().is_none());
12401 /// ```
12402 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12403 self.queries =
12404 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryFileUri(v.into()));
12405 self
12406 }
12407
12408 /// The value of [queries][crate::model::SparkSqlJob::queries]
12409 /// if it holds a `QueryList`, `None` if the field is not set or
12410 /// holds a different branch.
12411 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12412 #[allow(unreachable_patterns)]
12413 self.queries.as_ref().and_then(|v| match v {
12414 crate::model::spark_sql_job::Queries::QueryList(v) => std::option::Option::Some(v),
12415 _ => std::option::Option::None,
12416 })
12417 }
12418
12419 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
12420 /// to hold a `QueryList`.
12421 ///
12422 /// Note that all the setters affecting `queries` are
12423 /// mutually exclusive.
12424 ///
12425 /// # Example
12426 /// ```ignore,no_run
12427 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
12428 /// use google_cloud_dataproc_v1::model::QueryList;
12429 /// let x = SparkSqlJob::new().set_query_list(QueryList::default()/* use setters */);
12430 /// assert!(x.query_list().is_some());
12431 /// assert!(x.query_file_uri().is_none());
12432 /// ```
12433 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12434 mut self,
12435 v: T,
12436 ) -> Self {
12437 self.queries =
12438 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryList(v.into()));
12439 self
12440 }
12441}
12442
12443impl wkt::message::Message for SparkSqlJob {
12444 fn typename() -> &'static str {
12445 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlJob"
12446 }
12447}
12448
12449/// Defines additional types related to [SparkSqlJob].
12450pub mod spark_sql_job {
12451 #[allow(unused_imports)]
12452 use super::*;
12453
12454 /// Required. The sequence of Spark SQL queries to execute, specified as
12455 /// either an HCFS file URI or as a list of queries.
12456 #[derive(Clone, Debug, PartialEq)]
12457 #[non_exhaustive]
12458 pub enum Queries {
12459 /// The HCFS URI of the script that contains SQL queries.
12460 QueryFileUri(std::string::String),
12461 /// A list of queries.
12462 QueryList(std::boxed::Box<crate::model::QueryList>),
12463 }
12464}
12465
12466/// A Dataproc job for running [Apache Pig](https://pig.apache.org/)
12467/// queries on YARN.
12468#[derive(Clone, Default, PartialEq)]
12469#[non_exhaustive]
12470pub struct PigJob {
12471 /// Optional. Whether to continue executing queries if a query fails.
12472 /// The default value is `false`. Setting to `true` can be useful when
12473 /// executing independent parallel queries.
12474 pub continue_on_failure: bool,
12475
12476 /// Optional. Mapping of query variable names to values (equivalent to the Pig
12477 /// command: `name=[value]`).
12478 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
12479
12480 /// Optional. A mapping of property names to values, used to configure Pig.
12481 /// Properties that conflict with values set by the Dataproc API might be
12482 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
12483 /// /etc/pig/conf/pig.properties, and classes in user code.
12484 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12485
12486 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of
12487 /// the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
12488 pub jar_file_uris: std::vec::Vec<std::string::String>,
12489
12490 /// Optional. The runtime log config for job execution.
12491 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12492
12493 /// Required. The sequence of Pig queries to execute, specified as an HCFS
12494 /// file URI or a list of queries.
12495 pub queries: std::option::Option<crate::model::pig_job::Queries>,
12496
12497 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12498}
12499
12500impl PigJob {
12501 /// Creates a new default instance.
12502 pub fn new() -> Self {
12503 std::default::Default::default()
12504 }
12505
12506 /// Sets the value of [continue_on_failure][crate::model::PigJob::continue_on_failure].
12507 ///
12508 /// # Example
12509 /// ```ignore,no_run
12510 /// # use google_cloud_dataproc_v1::model::PigJob;
12511 /// let x = PigJob::new().set_continue_on_failure(true);
12512 /// ```
12513 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12514 self.continue_on_failure = v.into();
12515 self
12516 }
12517
12518 /// Sets the value of [script_variables][crate::model::PigJob::script_variables].
12519 ///
12520 /// # Example
12521 /// ```ignore,no_run
12522 /// # use google_cloud_dataproc_v1::model::PigJob;
12523 /// let x = PigJob::new().set_script_variables([
12524 /// ("key0", "abc"),
12525 /// ("key1", "xyz"),
12526 /// ]);
12527 /// ```
12528 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
12529 where
12530 T: std::iter::IntoIterator<Item = (K, V)>,
12531 K: std::convert::Into<std::string::String>,
12532 V: std::convert::Into<std::string::String>,
12533 {
12534 use std::iter::Iterator;
12535 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12536 self
12537 }
12538
12539 /// Sets the value of [properties][crate::model::PigJob::properties].
12540 ///
12541 /// # Example
12542 /// ```ignore,no_run
12543 /// # use google_cloud_dataproc_v1::model::PigJob;
12544 /// let x = PigJob::new().set_properties([
12545 /// ("key0", "abc"),
12546 /// ("key1", "xyz"),
12547 /// ]);
12548 /// ```
12549 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12550 where
12551 T: std::iter::IntoIterator<Item = (K, V)>,
12552 K: std::convert::Into<std::string::String>,
12553 V: std::convert::Into<std::string::String>,
12554 {
12555 use std::iter::Iterator;
12556 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12557 self
12558 }
12559
12560 /// Sets the value of [jar_file_uris][crate::model::PigJob::jar_file_uris].
12561 ///
12562 /// # Example
12563 /// ```ignore,no_run
12564 /// # use google_cloud_dataproc_v1::model::PigJob;
12565 /// let x = PigJob::new().set_jar_file_uris(["a", "b", "c"]);
12566 /// ```
12567 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12568 where
12569 T: std::iter::IntoIterator<Item = V>,
12570 V: std::convert::Into<std::string::String>,
12571 {
12572 use std::iter::Iterator;
12573 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12574 self
12575 }
12576
12577 /// Sets the value of [logging_config][crate::model::PigJob::logging_config].
12578 ///
12579 /// # Example
12580 /// ```ignore,no_run
12581 /// # use google_cloud_dataproc_v1::model::PigJob;
12582 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12583 /// let x = PigJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12584 /// ```
12585 pub fn set_logging_config<T>(mut self, v: T) -> Self
12586 where
12587 T: std::convert::Into<crate::model::LoggingConfig>,
12588 {
12589 self.logging_config = std::option::Option::Some(v.into());
12590 self
12591 }
12592
12593 /// Sets or clears the value of [logging_config][crate::model::PigJob::logging_config].
12594 ///
12595 /// # Example
12596 /// ```ignore,no_run
12597 /// # use google_cloud_dataproc_v1::model::PigJob;
12598 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12599 /// let x = PigJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12600 /// let x = PigJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12601 /// ```
12602 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12603 where
12604 T: std::convert::Into<crate::model::LoggingConfig>,
12605 {
12606 self.logging_config = v.map(|x| x.into());
12607 self
12608 }
12609
12610 /// Sets the value of [queries][crate::model::PigJob::queries].
12611 ///
12612 /// Note that all the setters affecting `queries` are mutually
12613 /// exclusive.
12614 ///
12615 /// # Example
12616 /// ```ignore,no_run
12617 /// # use google_cloud_dataproc_v1::model::PigJob;
12618 /// use google_cloud_dataproc_v1::model::pig_job::Queries;
12619 /// let x = PigJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12620 /// ```
12621 pub fn set_queries<
12622 T: std::convert::Into<std::option::Option<crate::model::pig_job::Queries>>,
12623 >(
12624 mut self,
12625 v: T,
12626 ) -> Self {
12627 self.queries = v.into();
12628 self
12629 }
12630
12631 /// The value of [queries][crate::model::PigJob::queries]
12632 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12633 /// holds a different branch.
12634 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12635 #[allow(unreachable_patterns)]
12636 self.queries.as_ref().and_then(|v| match v {
12637 crate::model::pig_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12638 _ => std::option::Option::None,
12639 })
12640 }
12641
12642 /// Sets the value of [queries][crate::model::PigJob::queries]
12643 /// to hold a `QueryFileUri`.
12644 ///
12645 /// Note that all the setters affecting `queries` are
12646 /// mutually exclusive.
12647 ///
12648 /// # Example
12649 /// ```ignore,no_run
12650 /// # use google_cloud_dataproc_v1::model::PigJob;
12651 /// let x = PigJob::new().set_query_file_uri("example");
12652 /// assert!(x.query_file_uri().is_some());
12653 /// assert!(x.query_list().is_none());
12654 /// ```
12655 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12656 self.queries =
12657 std::option::Option::Some(crate::model::pig_job::Queries::QueryFileUri(v.into()));
12658 self
12659 }
12660
12661 /// The value of [queries][crate::model::PigJob::queries]
12662 /// if it holds a `QueryList`, `None` if the field is not set or
12663 /// holds a different branch.
12664 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12665 #[allow(unreachable_patterns)]
12666 self.queries.as_ref().and_then(|v| match v {
12667 crate::model::pig_job::Queries::QueryList(v) => std::option::Option::Some(v),
12668 _ => std::option::Option::None,
12669 })
12670 }
12671
12672 /// Sets the value of [queries][crate::model::PigJob::queries]
12673 /// to hold a `QueryList`.
12674 ///
12675 /// Note that all the setters affecting `queries` are
12676 /// mutually exclusive.
12677 ///
12678 /// # Example
12679 /// ```ignore,no_run
12680 /// # use google_cloud_dataproc_v1::model::PigJob;
12681 /// use google_cloud_dataproc_v1::model::QueryList;
12682 /// let x = PigJob::new().set_query_list(QueryList::default()/* use setters */);
12683 /// assert!(x.query_list().is_some());
12684 /// assert!(x.query_file_uri().is_none());
12685 /// ```
12686 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12687 mut self,
12688 v: T,
12689 ) -> Self {
12690 self.queries =
12691 std::option::Option::Some(crate::model::pig_job::Queries::QueryList(v.into()));
12692 self
12693 }
12694}
12695
12696impl wkt::message::Message for PigJob {
12697 fn typename() -> &'static str {
12698 "type.googleapis.com/google.cloud.dataproc.v1.PigJob"
12699 }
12700}
12701
12702/// Defines additional types related to [PigJob].
12703pub mod pig_job {
12704 #[allow(unused_imports)]
12705 use super::*;
12706
12707 /// Required. The sequence of Pig queries to execute, specified as an HCFS
12708 /// file URI or a list of queries.
12709 #[derive(Clone, Debug, PartialEq)]
12710 #[non_exhaustive]
12711 pub enum Queries {
12712 /// The HCFS URI of the script that contains the Pig queries.
12713 QueryFileUri(std::string::String),
12714 /// A list of queries.
12715 QueryList(std::boxed::Box<crate::model::QueryList>),
12716 }
12717}
12718
12719/// A Dataproc job for running
12720/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
12721/// applications on YARN.
12722#[derive(Clone, Default, PartialEq)]
12723#[non_exhaustive]
12724pub struct SparkRJob {
12725 /// Required. The HCFS URI of the main R file to use as the driver.
12726 /// Must be a .R file.
12727 pub main_r_file_uri: std::string::String,
12728
12729 /// Optional. The arguments to pass to the driver. Do not include arguments,
12730 /// such as `--conf`, that can be set as job properties, since a collision may
12731 /// occur that causes an incorrect job submission.
12732 pub args: std::vec::Vec<std::string::String>,
12733
12734 /// Optional. HCFS URIs of files to be placed in the working directory of
12735 /// each executor. Useful for naively parallel tasks.
12736 pub file_uris: std::vec::Vec<std::string::String>,
12737
12738 /// Optional. HCFS URIs of archives to be extracted into the working directory
12739 /// of each executor. Supported file types:
12740 /// .jar, .tar, .tar.gz, .tgz, and .zip.
12741 pub archive_uris: std::vec::Vec<std::string::String>,
12742
12743 /// Optional. A mapping of property names to values, used to configure SparkR.
12744 /// Properties that conflict with values set by the Dataproc API might be
12745 /// overwritten. Can include properties set in
12746 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
12747 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12748
12749 /// Optional. The runtime log config for job execution.
12750 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12751
12752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12753}
12754
12755impl SparkRJob {
12756 /// Creates a new default instance.
12757 pub fn new() -> Self {
12758 std::default::Default::default()
12759 }
12760
12761 /// Sets the value of [main_r_file_uri][crate::model::SparkRJob::main_r_file_uri].
12762 ///
12763 /// # Example
12764 /// ```ignore,no_run
12765 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12766 /// let x = SparkRJob::new().set_main_r_file_uri("example");
12767 /// ```
12768 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12769 self.main_r_file_uri = v.into();
12770 self
12771 }
12772
12773 /// Sets the value of [args][crate::model::SparkRJob::args].
12774 ///
12775 /// # Example
12776 /// ```ignore,no_run
12777 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12778 /// let x = SparkRJob::new().set_args(["a", "b", "c"]);
12779 /// ```
12780 pub fn set_args<T, V>(mut self, v: T) -> Self
12781 where
12782 T: std::iter::IntoIterator<Item = V>,
12783 V: std::convert::Into<std::string::String>,
12784 {
12785 use std::iter::Iterator;
12786 self.args = v.into_iter().map(|i| i.into()).collect();
12787 self
12788 }
12789
12790 /// Sets the value of [file_uris][crate::model::SparkRJob::file_uris].
12791 ///
12792 /// # Example
12793 /// ```ignore,no_run
12794 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12795 /// let x = SparkRJob::new().set_file_uris(["a", "b", "c"]);
12796 /// ```
12797 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
12798 where
12799 T: std::iter::IntoIterator<Item = V>,
12800 V: std::convert::Into<std::string::String>,
12801 {
12802 use std::iter::Iterator;
12803 self.file_uris = v.into_iter().map(|i| i.into()).collect();
12804 self
12805 }
12806
12807 /// Sets the value of [archive_uris][crate::model::SparkRJob::archive_uris].
12808 ///
12809 /// # Example
12810 /// ```ignore,no_run
12811 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12812 /// let x = SparkRJob::new().set_archive_uris(["a", "b", "c"]);
12813 /// ```
12814 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
12815 where
12816 T: std::iter::IntoIterator<Item = V>,
12817 V: std::convert::Into<std::string::String>,
12818 {
12819 use std::iter::Iterator;
12820 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
12821 self
12822 }
12823
12824 /// Sets the value of [properties][crate::model::SparkRJob::properties].
12825 ///
12826 /// # Example
12827 /// ```ignore,no_run
12828 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12829 /// let x = SparkRJob::new().set_properties([
12830 /// ("key0", "abc"),
12831 /// ("key1", "xyz"),
12832 /// ]);
12833 /// ```
12834 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12835 where
12836 T: std::iter::IntoIterator<Item = (K, V)>,
12837 K: std::convert::Into<std::string::String>,
12838 V: std::convert::Into<std::string::String>,
12839 {
12840 use std::iter::Iterator;
12841 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12842 self
12843 }
12844
12845 /// Sets the value of [logging_config][crate::model::SparkRJob::logging_config].
12846 ///
12847 /// # Example
12848 /// ```ignore,no_run
12849 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12850 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12851 /// let x = SparkRJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12852 /// ```
12853 pub fn set_logging_config<T>(mut self, v: T) -> Self
12854 where
12855 T: std::convert::Into<crate::model::LoggingConfig>,
12856 {
12857 self.logging_config = std::option::Option::Some(v.into());
12858 self
12859 }
12860
12861 /// Sets or clears the value of [logging_config][crate::model::SparkRJob::logging_config].
12862 ///
12863 /// # Example
12864 /// ```ignore,no_run
12865 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12866 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12867 /// let x = SparkRJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12868 /// let x = SparkRJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12869 /// ```
12870 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12871 where
12872 T: std::convert::Into<crate::model::LoggingConfig>,
12873 {
12874 self.logging_config = v.map(|x| x.into());
12875 self
12876 }
12877}
12878
12879impl wkt::message::Message for SparkRJob {
12880 fn typename() -> &'static str {
12881 "type.googleapis.com/google.cloud.dataproc.v1.SparkRJob"
12882 }
12883}
12884
12885/// A Dataproc job for running [Presto](https://prestosql.io/) queries.
12886/// **IMPORTANT**: The [Dataproc Presto Optional
12887/// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto)
12888/// must be enabled when the cluster is created to submit a Presto job to the
12889/// cluster.
12890#[derive(Clone, Default, PartialEq)]
12891#[non_exhaustive]
12892pub struct PrestoJob {
12893 /// Optional. Whether to continue executing queries if a query fails.
12894 /// The default value is `false`. Setting to `true` can be useful when
12895 /// executing independent parallel queries.
12896 pub continue_on_failure: bool,
12897
12898 /// Optional. The format in which query output will be displayed. See the
12899 /// Presto documentation for supported output formats
12900 pub output_format: std::string::String,
12901
12902 /// Optional. Presto client tags to attach to this query
12903 pub client_tags: std::vec::Vec<std::string::String>,
12904
12905 /// Optional. A mapping of property names to values. Used to set Presto
12906 /// [session properties](https://prestodb.io/docs/current/sql/set-session.html)
12907 /// Equivalent to using the --session flag in the Presto CLI
12908 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12909
12910 /// Optional. The runtime log config for job execution.
12911 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12912
12913 /// Required. The sequence of Presto queries to execute, specified as
12914 /// either an HCFS file URI or as a list of queries.
12915 pub queries: std::option::Option<crate::model::presto_job::Queries>,
12916
12917 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12918}
12919
12920impl PrestoJob {
12921 /// Creates a new default instance.
12922 pub fn new() -> Self {
12923 std::default::Default::default()
12924 }
12925
12926 /// Sets the value of [continue_on_failure][crate::model::PrestoJob::continue_on_failure].
12927 ///
12928 /// # Example
12929 /// ```ignore,no_run
12930 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12931 /// let x = PrestoJob::new().set_continue_on_failure(true);
12932 /// ```
12933 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12934 self.continue_on_failure = v.into();
12935 self
12936 }
12937
12938 /// Sets the value of [output_format][crate::model::PrestoJob::output_format].
12939 ///
12940 /// # Example
12941 /// ```ignore,no_run
12942 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12943 /// let x = PrestoJob::new().set_output_format("example");
12944 /// ```
12945 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12946 self.output_format = v.into();
12947 self
12948 }
12949
12950 /// Sets the value of [client_tags][crate::model::PrestoJob::client_tags].
12951 ///
12952 /// # Example
12953 /// ```ignore,no_run
12954 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12955 /// let x = PrestoJob::new().set_client_tags(["a", "b", "c"]);
12956 /// ```
12957 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12958 where
12959 T: std::iter::IntoIterator<Item = V>,
12960 V: std::convert::Into<std::string::String>,
12961 {
12962 use std::iter::Iterator;
12963 self.client_tags = v.into_iter().map(|i| i.into()).collect();
12964 self
12965 }
12966
12967 /// Sets the value of [properties][crate::model::PrestoJob::properties].
12968 ///
12969 /// # Example
12970 /// ```ignore,no_run
12971 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12972 /// let x = PrestoJob::new().set_properties([
12973 /// ("key0", "abc"),
12974 /// ("key1", "xyz"),
12975 /// ]);
12976 /// ```
12977 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12978 where
12979 T: std::iter::IntoIterator<Item = (K, V)>,
12980 K: std::convert::Into<std::string::String>,
12981 V: std::convert::Into<std::string::String>,
12982 {
12983 use std::iter::Iterator;
12984 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12985 self
12986 }
12987
12988 /// Sets the value of [logging_config][crate::model::PrestoJob::logging_config].
12989 ///
12990 /// # Example
12991 /// ```ignore,no_run
12992 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12993 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12994 /// let x = PrestoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12995 /// ```
12996 pub fn set_logging_config<T>(mut self, v: T) -> Self
12997 where
12998 T: std::convert::Into<crate::model::LoggingConfig>,
12999 {
13000 self.logging_config = std::option::Option::Some(v.into());
13001 self
13002 }
13003
13004 /// Sets or clears the value of [logging_config][crate::model::PrestoJob::logging_config].
13005 ///
13006 /// # Example
13007 /// ```ignore,no_run
13008 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13009 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13010 /// let x = PrestoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13011 /// let x = PrestoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13012 /// ```
13013 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13014 where
13015 T: std::convert::Into<crate::model::LoggingConfig>,
13016 {
13017 self.logging_config = v.map(|x| x.into());
13018 self
13019 }
13020
13021 /// Sets the value of [queries][crate::model::PrestoJob::queries].
13022 ///
13023 /// Note that all the setters affecting `queries` are mutually
13024 /// exclusive.
13025 ///
13026 /// # Example
13027 /// ```ignore,no_run
13028 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13029 /// use google_cloud_dataproc_v1::model::presto_job::Queries;
13030 /// let x = PrestoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
13031 /// ```
13032 pub fn set_queries<
13033 T: std::convert::Into<std::option::Option<crate::model::presto_job::Queries>>,
13034 >(
13035 mut self,
13036 v: T,
13037 ) -> Self {
13038 self.queries = v.into();
13039 self
13040 }
13041
13042 /// The value of [queries][crate::model::PrestoJob::queries]
13043 /// if it holds a `QueryFileUri`, `None` if the field is not set or
13044 /// holds a different branch.
13045 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
13046 #[allow(unreachable_patterns)]
13047 self.queries.as_ref().and_then(|v| match v {
13048 crate::model::presto_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
13049 _ => std::option::Option::None,
13050 })
13051 }
13052
13053 /// Sets the value of [queries][crate::model::PrestoJob::queries]
13054 /// to hold a `QueryFileUri`.
13055 ///
13056 /// Note that all the setters affecting `queries` are
13057 /// mutually exclusive.
13058 ///
13059 /// # Example
13060 /// ```ignore,no_run
13061 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13062 /// let x = PrestoJob::new().set_query_file_uri("example");
13063 /// assert!(x.query_file_uri().is_some());
13064 /// assert!(x.query_list().is_none());
13065 /// ```
13066 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13067 self.queries =
13068 std::option::Option::Some(crate::model::presto_job::Queries::QueryFileUri(v.into()));
13069 self
13070 }
13071
13072 /// The value of [queries][crate::model::PrestoJob::queries]
13073 /// if it holds a `QueryList`, `None` if the field is not set or
13074 /// holds a different branch.
13075 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
13076 #[allow(unreachable_patterns)]
13077 self.queries.as_ref().and_then(|v| match v {
13078 crate::model::presto_job::Queries::QueryList(v) => std::option::Option::Some(v),
13079 _ => std::option::Option::None,
13080 })
13081 }
13082
13083 /// Sets the value of [queries][crate::model::PrestoJob::queries]
13084 /// to hold a `QueryList`.
13085 ///
13086 /// Note that all the setters affecting `queries` are
13087 /// mutually exclusive.
13088 ///
13089 /// # Example
13090 /// ```ignore,no_run
13091 /// # use google_cloud_dataproc_v1::model::PrestoJob;
13092 /// use google_cloud_dataproc_v1::model::QueryList;
13093 /// let x = PrestoJob::new().set_query_list(QueryList::default()/* use setters */);
13094 /// assert!(x.query_list().is_some());
13095 /// assert!(x.query_file_uri().is_none());
13096 /// ```
13097 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
13098 mut self,
13099 v: T,
13100 ) -> Self {
13101 self.queries =
13102 std::option::Option::Some(crate::model::presto_job::Queries::QueryList(v.into()));
13103 self
13104 }
13105}
13106
13107impl wkt::message::Message for PrestoJob {
13108 fn typename() -> &'static str {
13109 "type.googleapis.com/google.cloud.dataproc.v1.PrestoJob"
13110 }
13111}
13112
13113/// Defines additional types related to [PrestoJob].
13114pub mod presto_job {
13115 #[allow(unused_imports)]
13116 use super::*;
13117
13118 /// Required. The sequence of Presto queries to execute, specified as
13119 /// either an HCFS file URI or as a list of queries.
13120 #[derive(Clone, Debug, PartialEq)]
13121 #[non_exhaustive]
13122 pub enum Queries {
13123 /// The HCFS URI of the script that contains SQL queries.
13124 QueryFileUri(std::string::String),
13125 /// A list of queries.
13126 QueryList(std::boxed::Box<crate::model::QueryList>),
13127 }
13128}
13129
13130/// A Dataproc job for running [Trino](https://trino.io/) queries.
13131/// **IMPORTANT**: The [Dataproc Trino Optional
13132/// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino)
13133/// must be enabled when the cluster is created to submit a Trino job to the
13134/// cluster.
13135#[derive(Clone, Default, PartialEq)]
13136#[non_exhaustive]
13137pub struct TrinoJob {
13138 /// Optional. Whether to continue executing queries if a query fails.
13139 /// The default value is `false`. Setting to `true` can be useful when
13140 /// executing independent parallel queries.
13141 pub continue_on_failure: bool,
13142
13143 /// Optional. The format in which query output will be displayed. See the
13144 /// Trino documentation for supported output formats
13145 pub output_format: std::string::String,
13146
13147 /// Optional. Trino client tags to attach to this query
13148 pub client_tags: std::vec::Vec<std::string::String>,
13149
13150 /// Optional. A mapping of property names to values. Used to set Trino
13151 /// [session properties](https://trino.io/docs/current/sql/set-session.html)
13152 /// Equivalent to using the --session flag in the Trino CLI
13153 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13154
13155 /// Optional. The runtime log config for job execution.
13156 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13157
13158 /// Required. The sequence of Trino queries to execute, specified as
13159 /// either an HCFS file URI or as a list of queries.
13160 pub queries: std::option::Option<crate::model::trino_job::Queries>,
13161
13162 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13163}
13164
13165impl TrinoJob {
13166 /// Creates a new default instance.
13167 pub fn new() -> Self {
13168 std::default::Default::default()
13169 }
13170
13171 /// Sets the value of [continue_on_failure][crate::model::TrinoJob::continue_on_failure].
13172 ///
13173 /// # Example
13174 /// ```ignore,no_run
13175 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13176 /// let x = TrinoJob::new().set_continue_on_failure(true);
13177 /// ```
13178 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13179 self.continue_on_failure = v.into();
13180 self
13181 }
13182
13183 /// Sets the value of [output_format][crate::model::TrinoJob::output_format].
13184 ///
13185 /// # Example
13186 /// ```ignore,no_run
13187 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13188 /// let x = TrinoJob::new().set_output_format("example");
13189 /// ```
13190 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13191 self.output_format = v.into();
13192 self
13193 }
13194
13195 /// Sets the value of [client_tags][crate::model::TrinoJob::client_tags].
13196 ///
13197 /// # Example
13198 /// ```ignore,no_run
13199 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13200 /// let x = TrinoJob::new().set_client_tags(["a", "b", "c"]);
13201 /// ```
13202 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
13203 where
13204 T: std::iter::IntoIterator<Item = V>,
13205 V: std::convert::Into<std::string::String>,
13206 {
13207 use std::iter::Iterator;
13208 self.client_tags = v.into_iter().map(|i| i.into()).collect();
13209 self
13210 }
13211
13212 /// Sets the value of [properties][crate::model::TrinoJob::properties].
13213 ///
13214 /// # Example
13215 /// ```ignore,no_run
13216 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13217 /// let x = TrinoJob::new().set_properties([
13218 /// ("key0", "abc"),
13219 /// ("key1", "xyz"),
13220 /// ]);
13221 /// ```
13222 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
13223 where
13224 T: std::iter::IntoIterator<Item = (K, V)>,
13225 K: std::convert::Into<std::string::String>,
13226 V: std::convert::Into<std::string::String>,
13227 {
13228 use std::iter::Iterator;
13229 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13230 self
13231 }
13232
13233 /// Sets the value of [logging_config][crate::model::TrinoJob::logging_config].
13234 ///
13235 /// # Example
13236 /// ```ignore,no_run
13237 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13238 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13239 /// let x = TrinoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13240 /// ```
13241 pub fn set_logging_config<T>(mut self, v: T) -> Self
13242 where
13243 T: std::convert::Into<crate::model::LoggingConfig>,
13244 {
13245 self.logging_config = std::option::Option::Some(v.into());
13246 self
13247 }
13248
13249 /// Sets or clears the value of [logging_config][crate::model::TrinoJob::logging_config].
13250 ///
13251 /// # Example
13252 /// ```ignore,no_run
13253 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13254 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13255 /// let x = TrinoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13256 /// let x = TrinoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13257 /// ```
13258 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13259 where
13260 T: std::convert::Into<crate::model::LoggingConfig>,
13261 {
13262 self.logging_config = v.map(|x| x.into());
13263 self
13264 }
13265
13266 /// Sets the value of [queries][crate::model::TrinoJob::queries].
13267 ///
13268 /// Note that all the setters affecting `queries` are mutually
13269 /// exclusive.
13270 ///
13271 /// # Example
13272 /// ```ignore,no_run
13273 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13274 /// use google_cloud_dataproc_v1::model::trino_job::Queries;
13275 /// let x = TrinoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
13276 /// ```
13277 pub fn set_queries<
13278 T: std::convert::Into<std::option::Option<crate::model::trino_job::Queries>>,
13279 >(
13280 mut self,
13281 v: T,
13282 ) -> Self {
13283 self.queries = v.into();
13284 self
13285 }
13286
13287 /// The value of [queries][crate::model::TrinoJob::queries]
13288 /// if it holds a `QueryFileUri`, `None` if the field is not set or
13289 /// holds a different branch.
13290 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
13291 #[allow(unreachable_patterns)]
13292 self.queries.as_ref().and_then(|v| match v {
13293 crate::model::trino_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
13294 _ => std::option::Option::None,
13295 })
13296 }
13297
13298 /// Sets the value of [queries][crate::model::TrinoJob::queries]
13299 /// to hold a `QueryFileUri`.
13300 ///
13301 /// Note that all the setters affecting `queries` are
13302 /// mutually exclusive.
13303 ///
13304 /// # Example
13305 /// ```ignore,no_run
13306 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13307 /// let x = TrinoJob::new().set_query_file_uri("example");
13308 /// assert!(x.query_file_uri().is_some());
13309 /// assert!(x.query_list().is_none());
13310 /// ```
13311 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13312 self.queries =
13313 std::option::Option::Some(crate::model::trino_job::Queries::QueryFileUri(v.into()));
13314 self
13315 }
13316
13317 /// The value of [queries][crate::model::TrinoJob::queries]
13318 /// if it holds a `QueryList`, `None` if the field is not set or
13319 /// holds a different branch.
13320 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
13321 #[allow(unreachable_patterns)]
13322 self.queries.as_ref().and_then(|v| match v {
13323 crate::model::trino_job::Queries::QueryList(v) => std::option::Option::Some(v),
13324 _ => std::option::Option::None,
13325 })
13326 }
13327
13328 /// Sets the value of [queries][crate::model::TrinoJob::queries]
13329 /// to hold a `QueryList`.
13330 ///
13331 /// Note that all the setters affecting `queries` are
13332 /// mutually exclusive.
13333 ///
13334 /// # Example
13335 /// ```ignore,no_run
13336 /// # use google_cloud_dataproc_v1::model::TrinoJob;
13337 /// use google_cloud_dataproc_v1::model::QueryList;
13338 /// let x = TrinoJob::new().set_query_list(QueryList::default()/* use setters */);
13339 /// assert!(x.query_list().is_some());
13340 /// assert!(x.query_file_uri().is_none());
13341 /// ```
13342 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
13343 mut self,
13344 v: T,
13345 ) -> Self {
13346 self.queries =
13347 std::option::Option::Some(crate::model::trino_job::Queries::QueryList(v.into()));
13348 self
13349 }
13350}
13351
13352impl wkt::message::Message for TrinoJob {
13353 fn typename() -> &'static str {
13354 "type.googleapis.com/google.cloud.dataproc.v1.TrinoJob"
13355 }
13356}
13357
13358/// Defines additional types related to [TrinoJob].
13359pub mod trino_job {
13360 #[allow(unused_imports)]
13361 use super::*;
13362
13363 /// Required. The sequence of Trino queries to execute, specified as
13364 /// either an HCFS file URI or as a list of queries.
13365 #[derive(Clone, Debug, PartialEq)]
13366 #[non_exhaustive]
13367 pub enum Queries {
13368 /// The HCFS URI of the script that contains SQL queries.
13369 QueryFileUri(std::string::String),
13370 /// A list of queries.
13371 QueryList(std::boxed::Box<crate::model::QueryList>),
13372 }
13373}
13374
13375/// A Dataproc job for running Apache Flink applications on YARN.
13376#[derive(Clone, Default, PartialEq)]
13377#[non_exhaustive]
13378pub struct FlinkJob {
13379 /// Optional. The arguments to pass to the driver. Do not include arguments,
13380 /// such as `--conf`, that can be set as job properties, since a collision
13381 /// might occur that causes an incorrect job submission.
13382 pub args: std::vec::Vec<std::string::String>,
13383
13384 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
13385 /// Flink driver and tasks.
13386 pub jar_file_uris: std::vec::Vec<std::string::String>,
13387
13388 /// Optional. HCFS URI of the savepoint, which contains the last saved progress
13389 /// for starting the current job.
13390 pub savepoint_uri: std::string::String,
13391
13392 /// Optional. A mapping of property names to values, used to configure Flink.
13393 /// Properties that conflict with values set by the Dataproc API might be
13394 /// overwritten. Can include properties set in
13395 /// `/etc/flink/conf/flink-defaults.conf` and classes in user code.
13396 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
13397
13398 /// Optional. The runtime log config for job execution.
13399 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
13400
13401 /// Required. The specification of the main method to call to drive the job.
13402 /// Specify either the jar file that contains the main class or the main class
13403 /// name. To pass both a main jar and a main class in the jar, add the jar to
13404 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
13405 /// specify the main class name in
13406 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
13407 ///
13408 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13409 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
13410 pub driver: std::option::Option<crate::model::flink_job::Driver>,
13411
13412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13413}
13414
13415impl FlinkJob {
13416 /// Creates a new default instance.
13417 pub fn new() -> Self {
13418 std::default::Default::default()
13419 }
13420
13421 /// Sets the value of [args][crate::model::FlinkJob::args].
13422 ///
13423 /// # Example
13424 /// ```ignore,no_run
13425 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13426 /// let x = FlinkJob::new().set_args(["a", "b", "c"]);
13427 /// ```
13428 pub fn set_args<T, V>(mut self, v: T) -> Self
13429 where
13430 T: std::iter::IntoIterator<Item = V>,
13431 V: std::convert::Into<std::string::String>,
13432 {
13433 use std::iter::Iterator;
13434 self.args = v.into_iter().map(|i| i.into()).collect();
13435 self
13436 }
13437
13438 /// Sets the value of [jar_file_uris][crate::model::FlinkJob::jar_file_uris].
13439 ///
13440 /// # Example
13441 /// ```ignore,no_run
13442 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13443 /// let x = FlinkJob::new().set_jar_file_uris(["a", "b", "c"]);
13444 /// ```
13445 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
13446 where
13447 T: std::iter::IntoIterator<Item = V>,
13448 V: std::convert::Into<std::string::String>,
13449 {
13450 use std::iter::Iterator;
13451 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
13452 self
13453 }
13454
13455 /// Sets the value of [savepoint_uri][crate::model::FlinkJob::savepoint_uri].
13456 ///
13457 /// # Example
13458 /// ```ignore,no_run
13459 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13460 /// let x = FlinkJob::new().set_savepoint_uri("example");
13461 /// ```
13462 pub fn set_savepoint_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13463 self.savepoint_uri = v.into();
13464 self
13465 }
13466
13467 /// Sets the value of [properties][crate::model::FlinkJob::properties].
13468 ///
13469 /// # Example
13470 /// ```ignore,no_run
13471 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13472 /// let x = FlinkJob::new().set_properties([
13473 /// ("key0", "abc"),
13474 /// ("key1", "xyz"),
13475 /// ]);
13476 /// ```
13477 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
13478 where
13479 T: std::iter::IntoIterator<Item = (K, V)>,
13480 K: std::convert::Into<std::string::String>,
13481 V: std::convert::Into<std::string::String>,
13482 {
13483 use std::iter::Iterator;
13484 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13485 self
13486 }
13487
13488 /// Sets the value of [logging_config][crate::model::FlinkJob::logging_config].
13489 ///
13490 /// # Example
13491 /// ```ignore,no_run
13492 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13493 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13494 /// let x = FlinkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
13495 /// ```
13496 pub fn set_logging_config<T>(mut self, v: T) -> Self
13497 where
13498 T: std::convert::Into<crate::model::LoggingConfig>,
13499 {
13500 self.logging_config = std::option::Option::Some(v.into());
13501 self
13502 }
13503
13504 /// Sets or clears the value of [logging_config][crate::model::FlinkJob::logging_config].
13505 ///
13506 /// # Example
13507 /// ```ignore,no_run
13508 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13509 /// use google_cloud_dataproc_v1::model::LoggingConfig;
13510 /// let x = FlinkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
13511 /// let x = FlinkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
13512 /// ```
13513 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
13514 where
13515 T: std::convert::Into<crate::model::LoggingConfig>,
13516 {
13517 self.logging_config = v.map(|x| x.into());
13518 self
13519 }
13520
13521 /// Sets the value of [driver][crate::model::FlinkJob::driver].
13522 ///
13523 /// Note that all the setters affecting `driver` are mutually
13524 /// exclusive.
13525 ///
13526 /// # Example
13527 /// ```ignore,no_run
13528 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13529 /// use google_cloud_dataproc_v1::model::flink_job::Driver;
13530 /// let x = FlinkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
13531 /// ```
13532 pub fn set_driver<
13533 T: std::convert::Into<std::option::Option<crate::model::flink_job::Driver>>,
13534 >(
13535 mut self,
13536 v: T,
13537 ) -> Self {
13538 self.driver = v.into();
13539 self
13540 }
13541
13542 /// The value of [driver][crate::model::FlinkJob::driver]
13543 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
13544 /// holds a different branch.
13545 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
13546 #[allow(unreachable_patterns)]
13547 self.driver.as_ref().and_then(|v| match v {
13548 crate::model::flink_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
13549 _ => std::option::Option::None,
13550 })
13551 }
13552
13553 /// Sets the value of [driver][crate::model::FlinkJob::driver]
13554 /// to hold a `MainJarFileUri`.
13555 ///
13556 /// Note that all the setters affecting `driver` are
13557 /// mutually exclusive.
13558 ///
13559 /// # Example
13560 /// ```ignore,no_run
13561 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13562 /// let x = FlinkJob::new().set_main_jar_file_uri("example");
13563 /// assert!(x.main_jar_file_uri().is_some());
13564 /// assert!(x.main_class().is_none());
13565 /// ```
13566 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
13567 mut self,
13568 v: T,
13569 ) -> Self {
13570 self.driver =
13571 std::option::Option::Some(crate::model::flink_job::Driver::MainJarFileUri(v.into()));
13572 self
13573 }
13574
13575 /// The value of [driver][crate::model::FlinkJob::driver]
13576 /// if it holds a `MainClass`, `None` if the field is not set or
13577 /// holds a different branch.
13578 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
13579 #[allow(unreachable_patterns)]
13580 self.driver.as_ref().and_then(|v| match v {
13581 crate::model::flink_job::Driver::MainClass(v) => std::option::Option::Some(v),
13582 _ => std::option::Option::None,
13583 })
13584 }
13585
13586 /// Sets the value of [driver][crate::model::FlinkJob::driver]
13587 /// to hold a `MainClass`.
13588 ///
13589 /// Note that all the setters affecting `driver` are
13590 /// mutually exclusive.
13591 ///
13592 /// # Example
13593 /// ```ignore,no_run
13594 /// # use google_cloud_dataproc_v1::model::FlinkJob;
13595 /// let x = FlinkJob::new().set_main_class("example");
13596 /// assert!(x.main_class().is_some());
13597 /// assert!(x.main_jar_file_uri().is_none());
13598 /// ```
13599 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13600 self.driver =
13601 std::option::Option::Some(crate::model::flink_job::Driver::MainClass(v.into()));
13602 self
13603 }
13604}
13605
13606impl wkt::message::Message for FlinkJob {
13607 fn typename() -> &'static str {
13608 "type.googleapis.com/google.cloud.dataproc.v1.FlinkJob"
13609 }
13610}
13611
13612/// Defines additional types related to [FlinkJob].
13613pub mod flink_job {
13614 #[allow(unused_imports)]
13615 use super::*;
13616
13617 /// Required. The specification of the main method to call to drive the job.
13618 /// Specify either the jar file that contains the main class or the main class
13619 /// name. To pass both a main jar and a main class in the jar, add the jar to
13620 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
13621 /// specify the main class name in
13622 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
13623 ///
13624 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13625 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
13626 #[derive(Clone, Debug, PartialEq)]
13627 #[non_exhaustive]
13628 pub enum Driver {
13629 /// The HCFS URI of the jar file that contains the main class.
13630 MainJarFileUri(std::string::String),
13631 /// The name of the driver's main class. The jar file that contains the class
13632 /// must be in the default CLASSPATH or specified in
13633 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris].
13634 ///
13635 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13636 MainClass(std::string::String),
13637 }
13638}
13639
13640/// Dataproc job config.
13641#[derive(Clone, Default, PartialEq)]
13642#[non_exhaustive]
13643pub struct JobPlacement {
13644 /// Required. The name of the cluster where the job will be submitted.
13645 pub cluster_name: std::string::String,
13646
13647 /// Output only. A cluster UUID generated by the Dataproc service when
13648 /// the job is submitted.
13649 pub cluster_uuid: std::string::String,
13650
13651 /// Optional. Cluster labels to identify a cluster where the job will be
13652 /// submitted.
13653 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
13654
13655 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13656}
13657
13658impl JobPlacement {
13659 /// Creates a new default instance.
13660 pub fn new() -> Self {
13661 std::default::Default::default()
13662 }
13663
13664 /// Sets the value of [cluster_name][crate::model::JobPlacement::cluster_name].
13665 ///
13666 /// # Example
13667 /// ```ignore,no_run
13668 /// # use google_cloud_dataproc_v1::model::JobPlacement;
13669 /// let x = JobPlacement::new().set_cluster_name("example");
13670 /// ```
13671 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13672 self.cluster_name = v.into();
13673 self
13674 }
13675
13676 /// Sets the value of [cluster_uuid][crate::model::JobPlacement::cluster_uuid].
13677 ///
13678 /// # Example
13679 /// ```ignore,no_run
13680 /// # use google_cloud_dataproc_v1::model::JobPlacement;
13681 /// let x = JobPlacement::new().set_cluster_uuid("example");
13682 /// ```
13683 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13684 self.cluster_uuid = v.into();
13685 self
13686 }
13687
13688 /// Sets the value of [cluster_labels][crate::model::JobPlacement::cluster_labels].
13689 ///
13690 /// # Example
13691 /// ```ignore,no_run
13692 /// # use google_cloud_dataproc_v1::model::JobPlacement;
13693 /// let x = JobPlacement::new().set_cluster_labels([
13694 /// ("key0", "abc"),
13695 /// ("key1", "xyz"),
13696 /// ]);
13697 /// ```
13698 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
13699 where
13700 T: std::iter::IntoIterator<Item = (K, V)>,
13701 K: std::convert::Into<std::string::String>,
13702 V: std::convert::Into<std::string::String>,
13703 {
13704 use std::iter::Iterator;
13705 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13706 self
13707 }
13708}
13709
13710impl wkt::message::Message for JobPlacement {
13711 fn typename() -> &'static str {
13712 "type.googleapis.com/google.cloud.dataproc.v1.JobPlacement"
13713 }
13714}
13715
13716/// Dataproc job status.
13717#[derive(Clone, Default, PartialEq)]
13718#[non_exhaustive]
13719pub struct JobStatus {
13720 /// Output only. A state message specifying the overall job state.
13721 pub state: crate::model::job_status::State,
13722
13723 /// Optional. Output only. Job state details, such as an error
13724 /// description if the state is `ERROR`.
13725 pub details: std::string::String,
13726
13727 /// Output only. The time when this state was entered.
13728 pub state_start_time: std::option::Option<wkt::Timestamp>,
13729
13730 /// Output only. Additional state information, which includes
13731 /// status reported by the agent.
13732 pub substate: crate::model::job_status::Substate,
13733
13734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13735}
13736
13737impl JobStatus {
13738 /// Creates a new default instance.
13739 pub fn new() -> Self {
13740 std::default::Default::default()
13741 }
13742
13743 /// Sets the value of [state][crate::model::JobStatus::state].
13744 ///
13745 /// # Example
13746 /// ```ignore,no_run
13747 /// # use google_cloud_dataproc_v1::model::JobStatus;
13748 /// use google_cloud_dataproc_v1::model::job_status::State;
13749 /// let x0 = JobStatus::new().set_state(State::Pending);
13750 /// let x1 = JobStatus::new().set_state(State::SetupDone);
13751 /// let x2 = JobStatus::new().set_state(State::Running);
13752 /// ```
13753 pub fn set_state<T: std::convert::Into<crate::model::job_status::State>>(
13754 mut self,
13755 v: T,
13756 ) -> Self {
13757 self.state = v.into();
13758 self
13759 }
13760
13761 /// Sets the value of [details][crate::model::JobStatus::details].
13762 ///
13763 /// # Example
13764 /// ```ignore,no_run
13765 /// # use google_cloud_dataproc_v1::model::JobStatus;
13766 /// let x = JobStatus::new().set_details("example");
13767 /// ```
13768 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13769 self.details = v.into();
13770 self
13771 }
13772
13773 /// Sets the value of [state_start_time][crate::model::JobStatus::state_start_time].
13774 ///
13775 /// # Example
13776 /// ```ignore,no_run
13777 /// # use google_cloud_dataproc_v1::model::JobStatus;
13778 /// use wkt::Timestamp;
13779 /// let x = JobStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
13780 /// ```
13781 pub fn set_state_start_time<T>(mut self, v: T) -> Self
13782 where
13783 T: std::convert::Into<wkt::Timestamp>,
13784 {
13785 self.state_start_time = std::option::Option::Some(v.into());
13786 self
13787 }
13788
13789 /// Sets or clears the value of [state_start_time][crate::model::JobStatus::state_start_time].
13790 ///
13791 /// # Example
13792 /// ```ignore,no_run
13793 /// # use google_cloud_dataproc_v1::model::JobStatus;
13794 /// use wkt::Timestamp;
13795 /// let x = JobStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
13796 /// let x = JobStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
13797 /// ```
13798 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
13799 where
13800 T: std::convert::Into<wkt::Timestamp>,
13801 {
13802 self.state_start_time = v.map(|x| x.into());
13803 self
13804 }
13805
13806 /// Sets the value of [substate][crate::model::JobStatus::substate].
13807 ///
13808 /// # Example
13809 /// ```ignore,no_run
13810 /// # use google_cloud_dataproc_v1::model::JobStatus;
13811 /// use google_cloud_dataproc_v1::model::job_status::Substate;
13812 /// let x0 = JobStatus::new().set_substate(Substate::Submitted);
13813 /// let x1 = JobStatus::new().set_substate(Substate::Queued);
13814 /// let x2 = JobStatus::new().set_substate(Substate::StaleStatus);
13815 /// ```
13816 pub fn set_substate<T: std::convert::Into<crate::model::job_status::Substate>>(
13817 mut self,
13818 v: T,
13819 ) -> Self {
13820 self.substate = v.into();
13821 self
13822 }
13823}
13824
13825impl wkt::message::Message for JobStatus {
13826 fn typename() -> &'static str {
13827 "type.googleapis.com/google.cloud.dataproc.v1.JobStatus"
13828 }
13829}
13830
13831/// Defines additional types related to [JobStatus].
13832pub mod job_status {
13833 #[allow(unused_imports)]
13834 use super::*;
13835
13836 /// The job state.
13837 ///
13838 /// # Working with unknown values
13839 ///
13840 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13841 /// additional enum variants at any time. Adding new variants is not considered
13842 /// a breaking change. Applications should write their code in anticipation of:
13843 ///
13844 /// - New values appearing in future releases of the client library, **and**
13845 /// - New values received dynamically, without application changes.
13846 ///
13847 /// Please consult the [Working with enums] section in the user guide for some
13848 /// guidelines.
13849 ///
13850 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13851 #[derive(Clone, Debug, PartialEq)]
13852 #[non_exhaustive]
13853 pub enum State {
13854 /// The job state is unknown.
13855 Unspecified,
13856 /// The job is pending; it has been submitted, but is not yet running.
13857 Pending,
13858 /// Job has been received by the service and completed initial setup;
13859 /// it will soon be submitted to the cluster.
13860 SetupDone,
13861 /// The job is running on the cluster.
13862 Running,
13863 /// A CancelJob request has been received, but is pending.
13864 CancelPending,
13865 /// Transient in-flight resources have been canceled, and the request to
13866 /// cancel the running job has been issued to the cluster.
13867 CancelStarted,
13868 /// The job cancellation was successful.
13869 Cancelled,
13870 /// The job has completed successfully.
13871 Done,
13872 /// The job has completed, but encountered an error.
13873 Error,
13874 /// Job attempt has failed. The detail field contains failure details for
13875 /// this attempt.
13876 ///
13877 /// Applies to restartable jobs only.
13878 AttemptFailure,
13879 /// If set, the enum was initialized with an unknown value.
13880 ///
13881 /// Applications can examine the value using [State::value] or
13882 /// [State::name].
13883 UnknownValue(state::UnknownValue),
13884 }
13885
13886 #[doc(hidden)]
13887 pub mod state {
13888 #[allow(unused_imports)]
13889 use super::*;
13890 #[derive(Clone, Debug, PartialEq)]
13891 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13892 }
13893
13894 impl State {
13895 /// Gets the enum value.
13896 ///
13897 /// Returns `None` if the enum contains an unknown value deserialized from
13898 /// the string representation of enums.
13899 pub fn value(&self) -> std::option::Option<i32> {
13900 match self {
13901 Self::Unspecified => std::option::Option::Some(0),
13902 Self::Pending => std::option::Option::Some(1),
13903 Self::SetupDone => std::option::Option::Some(8),
13904 Self::Running => std::option::Option::Some(2),
13905 Self::CancelPending => std::option::Option::Some(3),
13906 Self::CancelStarted => std::option::Option::Some(7),
13907 Self::Cancelled => std::option::Option::Some(4),
13908 Self::Done => std::option::Option::Some(5),
13909 Self::Error => std::option::Option::Some(6),
13910 Self::AttemptFailure => std::option::Option::Some(9),
13911 Self::UnknownValue(u) => u.0.value(),
13912 }
13913 }
13914
13915 /// Gets the enum value as a string.
13916 ///
13917 /// Returns `None` if the enum contains an unknown value deserialized from
13918 /// the integer representation of enums.
13919 pub fn name(&self) -> std::option::Option<&str> {
13920 match self {
13921 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13922 Self::Pending => std::option::Option::Some("PENDING"),
13923 Self::SetupDone => std::option::Option::Some("SETUP_DONE"),
13924 Self::Running => std::option::Option::Some("RUNNING"),
13925 Self::CancelPending => std::option::Option::Some("CANCEL_PENDING"),
13926 Self::CancelStarted => std::option::Option::Some("CANCEL_STARTED"),
13927 Self::Cancelled => std::option::Option::Some("CANCELLED"),
13928 Self::Done => std::option::Option::Some("DONE"),
13929 Self::Error => std::option::Option::Some("ERROR"),
13930 Self::AttemptFailure => std::option::Option::Some("ATTEMPT_FAILURE"),
13931 Self::UnknownValue(u) => u.0.name(),
13932 }
13933 }
13934 }
13935
13936 impl std::default::Default for State {
13937 fn default() -> Self {
13938 use std::convert::From;
13939 Self::from(0)
13940 }
13941 }
13942
13943 impl std::fmt::Display for State {
13944 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13945 wkt::internal::display_enum(f, self.name(), self.value())
13946 }
13947 }
13948
13949 impl std::convert::From<i32> for State {
13950 fn from(value: i32) -> Self {
13951 match value {
13952 0 => Self::Unspecified,
13953 1 => Self::Pending,
13954 2 => Self::Running,
13955 3 => Self::CancelPending,
13956 4 => Self::Cancelled,
13957 5 => Self::Done,
13958 6 => Self::Error,
13959 7 => Self::CancelStarted,
13960 8 => Self::SetupDone,
13961 9 => Self::AttemptFailure,
13962 _ => Self::UnknownValue(state::UnknownValue(
13963 wkt::internal::UnknownEnumValue::Integer(value),
13964 )),
13965 }
13966 }
13967 }
13968
13969 impl std::convert::From<&str> for State {
13970 fn from(value: &str) -> Self {
13971 use std::string::ToString;
13972 match value {
13973 "STATE_UNSPECIFIED" => Self::Unspecified,
13974 "PENDING" => Self::Pending,
13975 "SETUP_DONE" => Self::SetupDone,
13976 "RUNNING" => Self::Running,
13977 "CANCEL_PENDING" => Self::CancelPending,
13978 "CANCEL_STARTED" => Self::CancelStarted,
13979 "CANCELLED" => Self::Cancelled,
13980 "DONE" => Self::Done,
13981 "ERROR" => Self::Error,
13982 "ATTEMPT_FAILURE" => Self::AttemptFailure,
13983 _ => Self::UnknownValue(state::UnknownValue(
13984 wkt::internal::UnknownEnumValue::String(value.to_string()),
13985 )),
13986 }
13987 }
13988 }
13989
13990 impl serde::ser::Serialize for State {
13991 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13992 where
13993 S: serde::Serializer,
13994 {
13995 match self {
13996 Self::Unspecified => serializer.serialize_i32(0),
13997 Self::Pending => serializer.serialize_i32(1),
13998 Self::SetupDone => serializer.serialize_i32(8),
13999 Self::Running => serializer.serialize_i32(2),
14000 Self::CancelPending => serializer.serialize_i32(3),
14001 Self::CancelStarted => serializer.serialize_i32(7),
14002 Self::Cancelled => serializer.serialize_i32(4),
14003 Self::Done => serializer.serialize_i32(5),
14004 Self::Error => serializer.serialize_i32(6),
14005 Self::AttemptFailure => serializer.serialize_i32(9),
14006 Self::UnknownValue(u) => u.0.serialize(serializer),
14007 }
14008 }
14009 }
14010
14011 impl<'de> serde::de::Deserialize<'de> for State {
14012 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14013 where
14014 D: serde::Deserializer<'de>,
14015 {
14016 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
14017 ".google.cloud.dataproc.v1.JobStatus.State",
14018 ))
14019 }
14020 }
14021
14022 /// The job substate.
14023 ///
14024 /// # Working with unknown values
14025 ///
14026 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14027 /// additional enum variants at any time. Adding new variants is not considered
14028 /// a breaking change. Applications should write their code in anticipation of:
14029 ///
14030 /// - New values appearing in future releases of the client library, **and**
14031 /// - New values received dynamically, without application changes.
14032 ///
14033 /// Please consult the [Working with enums] section in the user guide for some
14034 /// guidelines.
14035 ///
14036 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14037 #[derive(Clone, Debug, PartialEq)]
14038 #[non_exhaustive]
14039 pub enum Substate {
14040 /// The job substate is unknown.
14041 Unspecified,
14042 /// The Job is submitted to the agent.
14043 ///
14044 /// Applies to RUNNING state.
14045 Submitted,
14046 /// The Job has been received and is awaiting execution (it might be waiting
14047 /// for a condition to be met). See the "details" field for the reason for
14048 /// the delay.
14049 ///
14050 /// Applies to RUNNING state.
14051 Queued,
14052 /// The agent-reported status is out of date, which can be caused by a
14053 /// loss of communication between the agent and Dataproc. If the
14054 /// agent does not send a timely update, the job will fail.
14055 ///
14056 /// Applies to RUNNING state.
14057 StaleStatus,
14058 /// If set, the enum was initialized with an unknown value.
14059 ///
14060 /// Applications can examine the value using [Substate::value] or
14061 /// [Substate::name].
14062 UnknownValue(substate::UnknownValue),
14063 }
14064
14065 #[doc(hidden)]
14066 pub mod substate {
14067 #[allow(unused_imports)]
14068 use super::*;
14069 #[derive(Clone, Debug, PartialEq)]
14070 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14071 }
14072
14073 impl Substate {
14074 /// Gets the enum value.
14075 ///
14076 /// Returns `None` if the enum contains an unknown value deserialized from
14077 /// the string representation of enums.
14078 pub fn value(&self) -> std::option::Option<i32> {
14079 match self {
14080 Self::Unspecified => std::option::Option::Some(0),
14081 Self::Submitted => std::option::Option::Some(1),
14082 Self::Queued => std::option::Option::Some(2),
14083 Self::StaleStatus => std::option::Option::Some(3),
14084 Self::UnknownValue(u) => u.0.value(),
14085 }
14086 }
14087
14088 /// Gets the enum value as a string.
14089 ///
14090 /// Returns `None` if the enum contains an unknown value deserialized from
14091 /// the integer representation of enums.
14092 pub fn name(&self) -> std::option::Option<&str> {
14093 match self {
14094 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
14095 Self::Submitted => std::option::Option::Some("SUBMITTED"),
14096 Self::Queued => std::option::Option::Some("QUEUED"),
14097 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
14098 Self::UnknownValue(u) => u.0.name(),
14099 }
14100 }
14101 }
14102
14103 impl std::default::Default for Substate {
14104 fn default() -> Self {
14105 use std::convert::From;
14106 Self::from(0)
14107 }
14108 }
14109
14110 impl std::fmt::Display for Substate {
14111 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14112 wkt::internal::display_enum(f, self.name(), self.value())
14113 }
14114 }
14115
14116 impl std::convert::From<i32> for Substate {
14117 fn from(value: i32) -> Self {
14118 match value {
14119 0 => Self::Unspecified,
14120 1 => Self::Submitted,
14121 2 => Self::Queued,
14122 3 => Self::StaleStatus,
14123 _ => Self::UnknownValue(substate::UnknownValue(
14124 wkt::internal::UnknownEnumValue::Integer(value),
14125 )),
14126 }
14127 }
14128 }
14129
14130 impl std::convert::From<&str> for Substate {
14131 fn from(value: &str) -> Self {
14132 use std::string::ToString;
14133 match value {
14134 "UNSPECIFIED" => Self::Unspecified,
14135 "SUBMITTED" => Self::Submitted,
14136 "QUEUED" => Self::Queued,
14137 "STALE_STATUS" => Self::StaleStatus,
14138 _ => Self::UnknownValue(substate::UnknownValue(
14139 wkt::internal::UnknownEnumValue::String(value.to_string()),
14140 )),
14141 }
14142 }
14143 }
14144
14145 impl serde::ser::Serialize for Substate {
14146 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14147 where
14148 S: serde::Serializer,
14149 {
14150 match self {
14151 Self::Unspecified => serializer.serialize_i32(0),
14152 Self::Submitted => serializer.serialize_i32(1),
14153 Self::Queued => serializer.serialize_i32(2),
14154 Self::StaleStatus => serializer.serialize_i32(3),
14155 Self::UnknownValue(u) => u.0.serialize(serializer),
14156 }
14157 }
14158 }
14159
14160 impl<'de> serde::de::Deserialize<'de> for Substate {
14161 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14162 where
14163 D: serde::Deserializer<'de>,
14164 {
14165 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
14166 ".google.cloud.dataproc.v1.JobStatus.Substate",
14167 ))
14168 }
14169 }
14170}
14171
14172/// Encapsulates the full scoping used to reference a job.
14173#[derive(Clone, Default, PartialEq)]
14174#[non_exhaustive]
14175pub struct JobReference {
14176 /// Optional. The ID of the Google Cloud Platform project that the job belongs
14177 /// to. If specified, must match the request project ID.
14178 pub project_id: std::string::String,
14179
14180 /// Optional. The job ID, which must be unique within the project.
14181 ///
14182 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
14183 /// underscores (_), or hyphens (-). The maximum length is 100 characters.
14184 ///
14185 /// If not specified by the caller, the job ID will be provided by the server.
14186 pub job_id: std::string::String,
14187
14188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14189}
14190
14191impl JobReference {
14192 /// Creates a new default instance.
14193 pub fn new() -> Self {
14194 std::default::Default::default()
14195 }
14196
14197 /// Sets the value of [project_id][crate::model::JobReference::project_id].
14198 ///
14199 /// # Example
14200 /// ```ignore,no_run
14201 /// # use google_cloud_dataproc_v1::model::JobReference;
14202 /// let x = JobReference::new().set_project_id("example");
14203 /// ```
14204 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14205 self.project_id = v.into();
14206 self
14207 }
14208
14209 /// Sets the value of [job_id][crate::model::JobReference::job_id].
14210 ///
14211 /// # Example
14212 /// ```ignore,no_run
14213 /// # use google_cloud_dataproc_v1::model::JobReference;
14214 /// let x = JobReference::new().set_job_id("example");
14215 /// ```
14216 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14217 self.job_id = v.into();
14218 self
14219 }
14220}
14221
14222impl wkt::message::Message for JobReference {
14223 fn typename() -> &'static str {
14224 "type.googleapis.com/google.cloud.dataproc.v1.JobReference"
14225 }
14226}
14227
14228/// A YARN application created by a job. Application information is a subset of
14229/// \<code\>org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto\</code\>.
14230///
14231/// **Beta Feature**: This report is available for testing purposes only. It may
14232/// be changed before final release.
14233#[derive(Clone, Default, PartialEq)]
14234#[non_exhaustive]
14235pub struct YarnApplication {
14236 /// Required. The application name.
14237 pub name: std::string::String,
14238
14239 /// Required. The application state.
14240 pub state: crate::model::yarn_application::State,
14241
14242 /// Required. The numerical progress of the application, from 1 to 100.
14243 pub progress: f32,
14244
14245 /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or
14246 /// TimelineServer that provides application-specific information. The URL uses
14247 /// the internal hostname, and requires a proxy server for resolution and,
14248 /// possibly, access.
14249 pub tracking_url: std::string::String,
14250
14251 /// Optional. The cumulative CPU time consumed by the application for a job,
14252 /// measured in vcore-seconds.
14253 pub vcore_seconds: i64,
14254
14255 /// Optional. The cumulative memory usage of the application for a job,
14256 /// measured in mb-seconds.
14257 pub memory_mb_seconds: i64,
14258
14259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14260}
14261
14262impl YarnApplication {
14263 /// Creates a new default instance.
14264 pub fn new() -> Self {
14265 std::default::Default::default()
14266 }
14267
14268 /// Sets the value of [name][crate::model::YarnApplication::name].
14269 ///
14270 /// # Example
14271 /// ```ignore,no_run
14272 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14273 /// let x = YarnApplication::new().set_name("example");
14274 /// ```
14275 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14276 self.name = v.into();
14277 self
14278 }
14279
14280 /// Sets the value of [state][crate::model::YarnApplication::state].
14281 ///
14282 /// # Example
14283 /// ```ignore,no_run
14284 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14285 /// use google_cloud_dataproc_v1::model::yarn_application::State;
14286 /// let x0 = YarnApplication::new().set_state(State::New);
14287 /// let x1 = YarnApplication::new().set_state(State::NewSaving);
14288 /// let x2 = YarnApplication::new().set_state(State::Submitted);
14289 /// ```
14290 pub fn set_state<T: std::convert::Into<crate::model::yarn_application::State>>(
14291 mut self,
14292 v: T,
14293 ) -> Self {
14294 self.state = v.into();
14295 self
14296 }
14297
14298 /// Sets the value of [progress][crate::model::YarnApplication::progress].
14299 ///
14300 /// # Example
14301 /// ```ignore,no_run
14302 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14303 /// let x = YarnApplication::new().set_progress(42.0);
14304 /// ```
14305 pub fn set_progress<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
14306 self.progress = v.into();
14307 self
14308 }
14309
14310 /// Sets the value of [tracking_url][crate::model::YarnApplication::tracking_url].
14311 ///
14312 /// # Example
14313 /// ```ignore,no_run
14314 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14315 /// let x = YarnApplication::new().set_tracking_url("example");
14316 /// ```
14317 pub fn set_tracking_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14318 self.tracking_url = v.into();
14319 self
14320 }
14321
14322 /// Sets the value of [vcore_seconds][crate::model::YarnApplication::vcore_seconds].
14323 ///
14324 /// # Example
14325 /// ```ignore,no_run
14326 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14327 /// let x = YarnApplication::new().set_vcore_seconds(42);
14328 /// ```
14329 pub fn set_vcore_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14330 self.vcore_seconds = v.into();
14331 self
14332 }
14333
14334 /// Sets the value of [memory_mb_seconds][crate::model::YarnApplication::memory_mb_seconds].
14335 ///
14336 /// # Example
14337 /// ```ignore,no_run
14338 /// # use google_cloud_dataproc_v1::model::YarnApplication;
14339 /// let x = YarnApplication::new().set_memory_mb_seconds(42);
14340 /// ```
14341 pub fn set_memory_mb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14342 self.memory_mb_seconds = v.into();
14343 self
14344 }
14345}
14346
14347impl wkt::message::Message for YarnApplication {
14348 fn typename() -> &'static str {
14349 "type.googleapis.com/google.cloud.dataproc.v1.YarnApplication"
14350 }
14351}
14352
14353/// Defines additional types related to [YarnApplication].
14354pub mod yarn_application {
14355 #[allow(unused_imports)]
14356 use super::*;
14357
14358 /// The application state, corresponding to
14359 /// \<code\>YarnProtos.YarnApplicationStateProto\</code\>.
14360 ///
14361 /// # Working with unknown values
14362 ///
14363 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14364 /// additional enum variants at any time. Adding new variants is not considered
14365 /// a breaking change. Applications should write their code in anticipation of:
14366 ///
14367 /// - New values appearing in future releases of the client library, **and**
14368 /// - New values received dynamically, without application changes.
14369 ///
14370 /// Please consult the [Working with enums] section in the user guide for some
14371 /// guidelines.
14372 ///
14373 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14374 #[derive(Clone, Debug, PartialEq)]
14375 #[non_exhaustive]
14376 pub enum State {
14377 /// Status is unspecified.
14378 Unspecified,
14379 /// Status is NEW.
14380 New,
14381 /// Status is NEW_SAVING.
14382 NewSaving,
14383 /// Status is SUBMITTED.
14384 Submitted,
14385 /// Status is ACCEPTED.
14386 Accepted,
14387 /// Status is RUNNING.
14388 Running,
14389 /// Status is FINISHED.
14390 Finished,
14391 /// Status is FAILED.
14392 Failed,
14393 /// Status is KILLED.
14394 Killed,
14395 /// If set, the enum was initialized with an unknown value.
14396 ///
14397 /// Applications can examine the value using [State::value] or
14398 /// [State::name].
14399 UnknownValue(state::UnknownValue),
14400 }
14401
14402 #[doc(hidden)]
14403 pub mod state {
14404 #[allow(unused_imports)]
14405 use super::*;
14406 #[derive(Clone, Debug, PartialEq)]
14407 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14408 }
14409
14410 impl State {
14411 /// Gets the enum value.
14412 ///
14413 /// Returns `None` if the enum contains an unknown value deserialized from
14414 /// the string representation of enums.
14415 pub fn value(&self) -> std::option::Option<i32> {
14416 match self {
14417 Self::Unspecified => std::option::Option::Some(0),
14418 Self::New => std::option::Option::Some(1),
14419 Self::NewSaving => std::option::Option::Some(2),
14420 Self::Submitted => std::option::Option::Some(3),
14421 Self::Accepted => std::option::Option::Some(4),
14422 Self::Running => std::option::Option::Some(5),
14423 Self::Finished => std::option::Option::Some(6),
14424 Self::Failed => std::option::Option::Some(7),
14425 Self::Killed => std::option::Option::Some(8),
14426 Self::UnknownValue(u) => u.0.value(),
14427 }
14428 }
14429
14430 /// Gets the enum value as a string.
14431 ///
14432 /// Returns `None` if the enum contains an unknown value deserialized from
14433 /// the integer representation of enums.
14434 pub fn name(&self) -> std::option::Option<&str> {
14435 match self {
14436 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
14437 Self::New => std::option::Option::Some("NEW"),
14438 Self::NewSaving => std::option::Option::Some("NEW_SAVING"),
14439 Self::Submitted => std::option::Option::Some("SUBMITTED"),
14440 Self::Accepted => std::option::Option::Some("ACCEPTED"),
14441 Self::Running => std::option::Option::Some("RUNNING"),
14442 Self::Finished => std::option::Option::Some("FINISHED"),
14443 Self::Failed => std::option::Option::Some("FAILED"),
14444 Self::Killed => std::option::Option::Some("KILLED"),
14445 Self::UnknownValue(u) => u.0.name(),
14446 }
14447 }
14448 }
14449
14450 impl std::default::Default for State {
14451 fn default() -> Self {
14452 use std::convert::From;
14453 Self::from(0)
14454 }
14455 }
14456
14457 impl std::fmt::Display for State {
14458 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14459 wkt::internal::display_enum(f, self.name(), self.value())
14460 }
14461 }
14462
14463 impl std::convert::From<i32> for State {
14464 fn from(value: i32) -> Self {
14465 match value {
14466 0 => Self::Unspecified,
14467 1 => Self::New,
14468 2 => Self::NewSaving,
14469 3 => Self::Submitted,
14470 4 => Self::Accepted,
14471 5 => Self::Running,
14472 6 => Self::Finished,
14473 7 => Self::Failed,
14474 8 => Self::Killed,
14475 _ => Self::UnknownValue(state::UnknownValue(
14476 wkt::internal::UnknownEnumValue::Integer(value),
14477 )),
14478 }
14479 }
14480 }
14481
14482 impl std::convert::From<&str> for State {
14483 fn from(value: &str) -> Self {
14484 use std::string::ToString;
14485 match value {
14486 "STATE_UNSPECIFIED" => Self::Unspecified,
14487 "NEW" => Self::New,
14488 "NEW_SAVING" => Self::NewSaving,
14489 "SUBMITTED" => Self::Submitted,
14490 "ACCEPTED" => Self::Accepted,
14491 "RUNNING" => Self::Running,
14492 "FINISHED" => Self::Finished,
14493 "FAILED" => Self::Failed,
14494 "KILLED" => Self::Killed,
14495 _ => Self::UnknownValue(state::UnknownValue(
14496 wkt::internal::UnknownEnumValue::String(value.to_string()),
14497 )),
14498 }
14499 }
14500 }
14501
14502 impl serde::ser::Serialize for State {
14503 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14504 where
14505 S: serde::Serializer,
14506 {
14507 match self {
14508 Self::Unspecified => serializer.serialize_i32(0),
14509 Self::New => serializer.serialize_i32(1),
14510 Self::NewSaving => serializer.serialize_i32(2),
14511 Self::Submitted => serializer.serialize_i32(3),
14512 Self::Accepted => serializer.serialize_i32(4),
14513 Self::Running => serializer.serialize_i32(5),
14514 Self::Finished => serializer.serialize_i32(6),
14515 Self::Failed => serializer.serialize_i32(7),
14516 Self::Killed => serializer.serialize_i32(8),
14517 Self::UnknownValue(u) => u.0.serialize(serializer),
14518 }
14519 }
14520 }
14521
14522 impl<'de> serde::de::Deserialize<'de> for State {
14523 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14524 where
14525 D: serde::Deserializer<'de>,
14526 {
14527 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
14528 ".google.cloud.dataproc.v1.YarnApplication.State",
14529 ))
14530 }
14531 }
14532}
14533
14534/// A Dataproc job resource.
14535#[derive(Clone, Default, PartialEq)]
14536#[non_exhaustive]
14537pub struct Job {
14538 /// Optional. The fully qualified reference to the job, which can be used to
14539 /// obtain the equivalent REST path of the job resource. If this property
14540 /// is not specified when a job is created, the server generates a
14541 /// \<code\>job_id\</code\>.
14542 pub reference: std::option::Option<crate::model::JobReference>,
14543
14544 /// Required. Job information, including how, when, and where to
14545 /// run the job.
14546 pub placement: std::option::Option<crate::model::JobPlacement>,
14547
14548 /// Output only. The job status. Additional application-specific
14549 /// status information might be contained in the \<code\>type_job\</code\>
14550 /// and \<code\>yarn_applications\</code\> fields.
14551 pub status: std::option::Option<crate::model::JobStatus>,
14552
14553 /// Output only. The previous job status.
14554 pub status_history: std::vec::Vec<crate::model::JobStatus>,
14555
14556 /// Output only. The collection of YARN applications spun up by this job.
14557 ///
14558 /// **Beta** Feature: This report is available for testing purposes only. It
14559 /// might be changed before final release.
14560 pub yarn_applications: std::vec::Vec<crate::model::YarnApplication>,
14561
14562 /// Output only. A URI pointing to the location of the stdout of the job's
14563 /// driver program.
14564 pub driver_output_resource_uri: std::string::String,
14565
14566 /// Output only. If present, the location of miscellaneous control files
14567 /// which can be used as part of job setup and handling. If not present,
14568 /// control files might be placed in the same location as `driver_output_uri`.
14569 pub driver_control_files_uri: std::string::String,
14570
14571 /// Optional. The labels to associate with this job.
14572 /// Label **keys** must contain 1 to 63 characters, and must conform to
14573 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
14574 /// Label **values** can be empty, but, if present, must contain 1 to 63
14575 /// characters, and must conform to [RFC
14576 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
14577 /// associated with a job.
14578 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
14579
14580 /// Optional. Job scheduling configuration.
14581 pub scheduling: std::option::Option<crate::model::JobScheduling>,
14582
14583 /// Output only. A UUID that uniquely identifies a job within the project
14584 /// over time. This is in contrast to a user-settable reference.job_id that
14585 /// might be reused over time.
14586 pub job_uuid: std::string::String,
14587
14588 /// Output only. Indicates whether the job is completed. If the value is
14589 /// `false`, the job is still in progress. If `true`, the job is completed, and
14590 /// `status.state` field will indicate if it was successful, failed,
14591 /// or cancelled.
14592 pub done: bool,
14593
14594 /// Optional. Driver scheduling configuration.
14595 pub driver_scheduling_config: std::option::Option<crate::model::DriverSchedulingConfig>,
14596
14597 /// Required. The application/framework-specific portion of the job.
14598 pub type_job: std::option::Option<crate::model::job::TypeJob>,
14599
14600 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14601}
14602
14603impl Job {
14604 /// Creates a new default instance.
14605 pub fn new() -> Self {
14606 std::default::Default::default()
14607 }
14608
14609 /// Sets the value of [reference][crate::model::Job::reference].
14610 ///
14611 /// # Example
14612 /// ```ignore,no_run
14613 /// # use google_cloud_dataproc_v1::model::Job;
14614 /// use google_cloud_dataproc_v1::model::JobReference;
14615 /// let x = Job::new().set_reference(JobReference::default()/* use setters */);
14616 /// ```
14617 pub fn set_reference<T>(mut self, v: T) -> Self
14618 where
14619 T: std::convert::Into<crate::model::JobReference>,
14620 {
14621 self.reference = std::option::Option::Some(v.into());
14622 self
14623 }
14624
14625 /// Sets or clears the value of [reference][crate::model::Job::reference].
14626 ///
14627 /// # Example
14628 /// ```ignore,no_run
14629 /// # use google_cloud_dataproc_v1::model::Job;
14630 /// use google_cloud_dataproc_v1::model::JobReference;
14631 /// let x = Job::new().set_or_clear_reference(Some(JobReference::default()/* use setters */));
14632 /// let x = Job::new().set_or_clear_reference(None::<JobReference>);
14633 /// ```
14634 pub fn set_or_clear_reference<T>(mut self, v: std::option::Option<T>) -> Self
14635 where
14636 T: std::convert::Into<crate::model::JobReference>,
14637 {
14638 self.reference = v.map(|x| x.into());
14639 self
14640 }
14641
14642 /// Sets the value of [placement][crate::model::Job::placement].
14643 ///
14644 /// # Example
14645 /// ```ignore,no_run
14646 /// # use google_cloud_dataproc_v1::model::Job;
14647 /// use google_cloud_dataproc_v1::model::JobPlacement;
14648 /// let x = Job::new().set_placement(JobPlacement::default()/* use setters */);
14649 /// ```
14650 pub fn set_placement<T>(mut self, v: T) -> Self
14651 where
14652 T: std::convert::Into<crate::model::JobPlacement>,
14653 {
14654 self.placement = std::option::Option::Some(v.into());
14655 self
14656 }
14657
14658 /// Sets or clears the value of [placement][crate::model::Job::placement].
14659 ///
14660 /// # Example
14661 /// ```ignore,no_run
14662 /// # use google_cloud_dataproc_v1::model::Job;
14663 /// use google_cloud_dataproc_v1::model::JobPlacement;
14664 /// let x = Job::new().set_or_clear_placement(Some(JobPlacement::default()/* use setters */));
14665 /// let x = Job::new().set_or_clear_placement(None::<JobPlacement>);
14666 /// ```
14667 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
14668 where
14669 T: std::convert::Into<crate::model::JobPlacement>,
14670 {
14671 self.placement = v.map(|x| x.into());
14672 self
14673 }
14674
14675 /// Sets the value of [status][crate::model::Job::status].
14676 ///
14677 /// # Example
14678 /// ```ignore,no_run
14679 /// # use google_cloud_dataproc_v1::model::Job;
14680 /// use google_cloud_dataproc_v1::model::JobStatus;
14681 /// let x = Job::new().set_status(JobStatus::default()/* use setters */);
14682 /// ```
14683 pub fn set_status<T>(mut self, v: T) -> Self
14684 where
14685 T: std::convert::Into<crate::model::JobStatus>,
14686 {
14687 self.status = std::option::Option::Some(v.into());
14688 self
14689 }
14690
14691 /// Sets or clears the value of [status][crate::model::Job::status].
14692 ///
14693 /// # Example
14694 /// ```ignore,no_run
14695 /// # use google_cloud_dataproc_v1::model::Job;
14696 /// use google_cloud_dataproc_v1::model::JobStatus;
14697 /// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
14698 /// let x = Job::new().set_or_clear_status(None::<JobStatus>);
14699 /// ```
14700 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
14701 where
14702 T: std::convert::Into<crate::model::JobStatus>,
14703 {
14704 self.status = v.map(|x| x.into());
14705 self
14706 }
14707
14708 /// Sets the value of [status_history][crate::model::Job::status_history].
14709 ///
14710 /// # Example
14711 /// ```ignore,no_run
14712 /// # use google_cloud_dataproc_v1::model::Job;
14713 /// use google_cloud_dataproc_v1::model::JobStatus;
14714 /// let x = Job::new()
14715 /// .set_status_history([
14716 /// JobStatus::default()/* use setters */,
14717 /// JobStatus::default()/* use (different) setters */,
14718 /// ]);
14719 /// ```
14720 pub fn set_status_history<T, V>(mut self, v: T) -> Self
14721 where
14722 T: std::iter::IntoIterator<Item = V>,
14723 V: std::convert::Into<crate::model::JobStatus>,
14724 {
14725 use std::iter::Iterator;
14726 self.status_history = v.into_iter().map(|i| i.into()).collect();
14727 self
14728 }
14729
14730 /// Sets the value of [yarn_applications][crate::model::Job::yarn_applications].
14731 ///
14732 /// # Example
14733 /// ```ignore,no_run
14734 /// # use google_cloud_dataproc_v1::model::Job;
14735 /// use google_cloud_dataproc_v1::model::YarnApplication;
14736 /// let x = Job::new()
14737 /// .set_yarn_applications([
14738 /// YarnApplication::default()/* use setters */,
14739 /// YarnApplication::default()/* use (different) setters */,
14740 /// ]);
14741 /// ```
14742 pub fn set_yarn_applications<T, V>(mut self, v: T) -> Self
14743 where
14744 T: std::iter::IntoIterator<Item = V>,
14745 V: std::convert::Into<crate::model::YarnApplication>,
14746 {
14747 use std::iter::Iterator;
14748 self.yarn_applications = v.into_iter().map(|i| i.into()).collect();
14749 self
14750 }
14751
14752 /// Sets the value of [driver_output_resource_uri][crate::model::Job::driver_output_resource_uri].
14753 ///
14754 /// # Example
14755 /// ```ignore,no_run
14756 /// # use google_cloud_dataproc_v1::model::Job;
14757 /// let x = Job::new().set_driver_output_resource_uri("example");
14758 /// ```
14759 pub fn set_driver_output_resource_uri<T: std::convert::Into<std::string::String>>(
14760 mut self,
14761 v: T,
14762 ) -> Self {
14763 self.driver_output_resource_uri = v.into();
14764 self
14765 }
14766
14767 /// Sets the value of [driver_control_files_uri][crate::model::Job::driver_control_files_uri].
14768 ///
14769 /// # Example
14770 /// ```ignore,no_run
14771 /// # use google_cloud_dataproc_v1::model::Job;
14772 /// let x = Job::new().set_driver_control_files_uri("example");
14773 /// ```
14774 pub fn set_driver_control_files_uri<T: std::convert::Into<std::string::String>>(
14775 mut self,
14776 v: T,
14777 ) -> Self {
14778 self.driver_control_files_uri = v.into();
14779 self
14780 }
14781
14782 /// Sets the value of [labels][crate::model::Job::labels].
14783 ///
14784 /// # Example
14785 /// ```ignore,no_run
14786 /// # use google_cloud_dataproc_v1::model::Job;
14787 /// let x = Job::new().set_labels([
14788 /// ("key0", "abc"),
14789 /// ("key1", "xyz"),
14790 /// ]);
14791 /// ```
14792 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14793 where
14794 T: std::iter::IntoIterator<Item = (K, V)>,
14795 K: std::convert::Into<std::string::String>,
14796 V: std::convert::Into<std::string::String>,
14797 {
14798 use std::iter::Iterator;
14799 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14800 self
14801 }
14802
14803 /// Sets the value of [scheduling][crate::model::Job::scheduling].
14804 ///
14805 /// # Example
14806 /// ```ignore,no_run
14807 /// # use google_cloud_dataproc_v1::model::Job;
14808 /// use google_cloud_dataproc_v1::model::JobScheduling;
14809 /// let x = Job::new().set_scheduling(JobScheduling::default()/* use setters */);
14810 /// ```
14811 pub fn set_scheduling<T>(mut self, v: T) -> Self
14812 where
14813 T: std::convert::Into<crate::model::JobScheduling>,
14814 {
14815 self.scheduling = std::option::Option::Some(v.into());
14816 self
14817 }
14818
14819 /// Sets or clears the value of [scheduling][crate::model::Job::scheduling].
14820 ///
14821 /// # Example
14822 /// ```ignore,no_run
14823 /// # use google_cloud_dataproc_v1::model::Job;
14824 /// use google_cloud_dataproc_v1::model::JobScheduling;
14825 /// let x = Job::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
14826 /// let x = Job::new().set_or_clear_scheduling(None::<JobScheduling>);
14827 /// ```
14828 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
14829 where
14830 T: std::convert::Into<crate::model::JobScheduling>,
14831 {
14832 self.scheduling = v.map(|x| x.into());
14833 self
14834 }
14835
14836 /// Sets the value of [job_uuid][crate::model::Job::job_uuid].
14837 ///
14838 /// # Example
14839 /// ```ignore,no_run
14840 /// # use google_cloud_dataproc_v1::model::Job;
14841 /// let x = Job::new().set_job_uuid("example");
14842 /// ```
14843 pub fn set_job_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14844 self.job_uuid = v.into();
14845 self
14846 }
14847
14848 /// Sets the value of [done][crate::model::Job::done].
14849 ///
14850 /// # Example
14851 /// ```ignore,no_run
14852 /// # use google_cloud_dataproc_v1::model::Job;
14853 /// let x = Job::new().set_done(true);
14854 /// ```
14855 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14856 self.done = v.into();
14857 self
14858 }
14859
14860 /// Sets the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14861 ///
14862 /// # Example
14863 /// ```ignore,no_run
14864 /// # use google_cloud_dataproc_v1::model::Job;
14865 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14866 /// let x = Job::new().set_driver_scheduling_config(DriverSchedulingConfig::default()/* use setters */);
14867 /// ```
14868 pub fn set_driver_scheduling_config<T>(mut self, v: T) -> Self
14869 where
14870 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14871 {
14872 self.driver_scheduling_config = std::option::Option::Some(v.into());
14873 self
14874 }
14875
14876 /// Sets or clears the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14877 ///
14878 /// # Example
14879 /// ```ignore,no_run
14880 /// # use google_cloud_dataproc_v1::model::Job;
14881 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14882 /// let x = Job::new().set_or_clear_driver_scheduling_config(Some(DriverSchedulingConfig::default()/* use setters */));
14883 /// let x = Job::new().set_or_clear_driver_scheduling_config(None::<DriverSchedulingConfig>);
14884 /// ```
14885 pub fn set_or_clear_driver_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
14886 where
14887 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14888 {
14889 self.driver_scheduling_config = v.map(|x| x.into());
14890 self
14891 }
14892
14893 /// Sets the value of [type_job][crate::model::Job::type_job].
14894 ///
14895 /// Note that all the setters affecting `type_job` are mutually
14896 /// exclusive.
14897 ///
14898 /// # Example
14899 /// ```ignore,no_run
14900 /// # use google_cloud_dataproc_v1::model::Job;
14901 /// use google_cloud_dataproc_v1::model::HadoopJob;
14902 /// let x = Job::new().set_type_job(Some(
14903 /// google_cloud_dataproc_v1::model::job::TypeJob::HadoopJob(HadoopJob::default().into())));
14904 /// ```
14905 pub fn set_type_job<T: std::convert::Into<std::option::Option<crate::model::job::TypeJob>>>(
14906 mut self,
14907 v: T,
14908 ) -> Self {
14909 self.type_job = v.into();
14910 self
14911 }
14912
14913 /// The value of [type_job][crate::model::Job::type_job]
14914 /// if it holds a `HadoopJob`, `None` if the field is not set or
14915 /// holds a different branch.
14916 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
14917 #[allow(unreachable_patterns)]
14918 self.type_job.as_ref().and_then(|v| match v {
14919 crate::model::job::TypeJob::HadoopJob(v) => std::option::Option::Some(v),
14920 _ => std::option::Option::None,
14921 })
14922 }
14923
14924 /// Sets the value of [type_job][crate::model::Job::type_job]
14925 /// to hold a `HadoopJob`.
14926 ///
14927 /// Note that all the setters affecting `type_job` are
14928 /// mutually exclusive.
14929 ///
14930 /// # Example
14931 /// ```ignore,no_run
14932 /// # use google_cloud_dataproc_v1::model::Job;
14933 /// use google_cloud_dataproc_v1::model::HadoopJob;
14934 /// let x = Job::new().set_hadoop_job(HadoopJob::default()/* use setters */);
14935 /// assert!(x.hadoop_job().is_some());
14936 /// assert!(x.spark_job().is_none());
14937 /// assert!(x.pyspark_job().is_none());
14938 /// assert!(x.hive_job().is_none());
14939 /// assert!(x.pig_job().is_none());
14940 /// assert!(x.spark_r_job().is_none());
14941 /// assert!(x.spark_sql_job().is_none());
14942 /// assert!(x.presto_job().is_none());
14943 /// assert!(x.trino_job().is_none());
14944 /// assert!(x.flink_job().is_none());
14945 /// ```
14946 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
14947 mut self,
14948 v: T,
14949 ) -> Self {
14950 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HadoopJob(v.into()));
14951 self
14952 }
14953
14954 /// The value of [type_job][crate::model::Job::type_job]
14955 /// if it holds a `SparkJob`, `None` if the field is not set or
14956 /// holds a different branch.
14957 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
14958 #[allow(unreachable_patterns)]
14959 self.type_job.as_ref().and_then(|v| match v {
14960 crate::model::job::TypeJob::SparkJob(v) => std::option::Option::Some(v),
14961 _ => std::option::Option::None,
14962 })
14963 }
14964
14965 /// Sets the value of [type_job][crate::model::Job::type_job]
14966 /// to hold a `SparkJob`.
14967 ///
14968 /// Note that all the setters affecting `type_job` are
14969 /// mutually exclusive.
14970 ///
14971 /// # Example
14972 /// ```ignore,no_run
14973 /// # use google_cloud_dataproc_v1::model::Job;
14974 /// use google_cloud_dataproc_v1::model::SparkJob;
14975 /// let x = Job::new().set_spark_job(SparkJob::default()/* use setters */);
14976 /// assert!(x.spark_job().is_some());
14977 /// assert!(x.hadoop_job().is_none());
14978 /// assert!(x.pyspark_job().is_none());
14979 /// assert!(x.hive_job().is_none());
14980 /// assert!(x.pig_job().is_none());
14981 /// assert!(x.spark_r_job().is_none());
14982 /// assert!(x.spark_sql_job().is_none());
14983 /// assert!(x.presto_job().is_none());
14984 /// assert!(x.trino_job().is_none());
14985 /// assert!(x.flink_job().is_none());
14986 /// ```
14987 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
14988 mut self,
14989 v: T,
14990 ) -> Self {
14991 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkJob(v.into()));
14992 self
14993 }
14994
14995 /// The value of [type_job][crate::model::Job::type_job]
14996 /// if it holds a `PysparkJob`, `None` if the field is not set or
14997 /// holds a different branch.
14998 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
14999 #[allow(unreachable_patterns)]
15000 self.type_job.as_ref().and_then(|v| match v {
15001 crate::model::job::TypeJob::PysparkJob(v) => std::option::Option::Some(v),
15002 _ => std::option::Option::None,
15003 })
15004 }
15005
15006 /// Sets the value of [type_job][crate::model::Job::type_job]
15007 /// to hold a `PysparkJob`.
15008 ///
15009 /// Note that all the setters affecting `type_job` are
15010 /// mutually exclusive.
15011 ///
15012 /// # Example
15013 /// ```ignore,no_run
15014 /// # use google_cloud_dataproc_v1::model::Job;
15015 /// use google_cloud_dataproc_v1::model::PySparkJob;
15016 /// let x = Job::new().set_pyspark_job(PySparkJob::default()/* use setters */);
15017 /// assert!(x.pyspark_job().is_some());
15018 /// assert!(x.hadoop_job().is_none());
15019 /// assert!(x.spark_job().is_none());
15020 /// assert!(x.hive_job().is_none());
15021 /// assert!(x.pig_job().is_none());
15022 /// assert!(x.spark_r_job().is_none());
15023 /// assert!(x.spark_sql_job().is_none());
15024 /// assert!(x.presto_job().is_none());
15025 /// assert!(x.trino_job().is_none());
15026 /// assert!(x.flink_job().is_none());
15027 /// ```
15028 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
15029 mut self,
15030 v: T,
15031 ) -> Self {
15032 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PysparkJob(v.into()));
15033 self
15034 }
15035
15036 /// The value of [type_job][crate::model::Job::type_job]
15037 /// if it holds a `HiveJob`, `None` if the field is not set or
15038 /// holds a different branch.
15039 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
15040 #[allow(unreachable_patterns)]
15041 self.type_job.as_ref().and_then(|v| match v {
15042 crate::model::job::TypeJob::HiveJob(v) => std::option::Option::Some(v),
15043 _ => std::option::Option::None,
15044 })
15045 }
15046
15047 /// Sets the value of [type_job][crate::model::Job::type_job]
15048 /// to hold a `HiveJob`.
15049 ///
15050 /// Note that all the setters affecting `type_job` are
15051 /// mutually exclusive.
15052 ///
15053 /// # Example
15054 /// ```ignore,no_run
15055 /// # use google_cloud_dataproc_v1::model::Job;
15056 /// use google_cloud_dataproc_v1::model::HiveJob;
15057 /// let x = Job::new().set_hive_job(HiveJob::default()/* use setters */);
15058 /// assert!(x.hive_job().is_some());
15059 /// assert!(x.hadoop_job().is_none());
15060 /// assert!(x.spark_job().is_none());
15061 /// assert!(x.pyspark_job().is_none());
15062 /// assert!(x.pig_job().is_none());
15063 /// assert!(x.spark_r_job().is_none());
15064 /// assert!(x.spark_sql_job().is_none());
15065 /// assert!(x.presto_job().is_none());
15066 /// assert!(x.trino_job().is_none());
15067 /// assert!(x.flink_job().is_none());
15068 /// ```
15069 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
15070 mut self,
15071 v: T,
15072 ) -> Self {
15073 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HiveJob(v.into()));
15074 self
15075 }
15076
15077 /// The value of [type_job][crate::model::Job::type_job]
15078 /// if it holds a `PigJob`, `None` if the field is not set or
15079 /// holds a different branch.
15080 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
15081 #[allow(unreachable_patterns)]
15082 self.type_job.as_ref().and_then(|v| match v {
15083 crate::model::job::TypeJob::PigJob(v) => std::option::Option::Some(v),
15084 _ => std::option::Option::None,
15085 })
15086 }
15087
15088 /// Sets the value of [type_job][crate::model::Job::type_job]
15089 /// to hold a `PigJob`.
15090 ///
15091 /// Note that all the setters affecting `type_job` are
15092 /// mutually exclusive.
15093 ///
15094 /// # Example
15095 /// ```ignore,no_run
15096 /// # use google_cloud_dataproc_v1::model::Job;
15097 /// use google_cloud_dataproc_v1::model::PigJob;
15098 /// let x = Job::new().set_pig_job(PigJob::default()/* use setters */);
15099 /// assert!(x.pig_job().is_some());
15100 /// assert!(x.hadoop_job().is_none());
15101 /// assert!(x.spark_job().is_none());
15102 /// assert!(x.pyspark_job().is_none());
15103 /// assert!(x.hive_job().is_none());
15104 /// assert!(x.spark_r_job().is_none());
15105 /// assert!(x.spark_sql_job().is_none());
15106 /// assert!(x.presto_job().is_none());
15107 /// assert!(x.trino_job().is_none());
15108 /// assert!(x.flink_job().is_none());
15109 /// ```
15110 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
15111 mut self,
15112 v: T,
15113 ) -> Self {
15114 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PigJob(v.into()));
15115 self
15116 }
15117
15118 /// The value of [type_job][crate::model::Job::type_job]
15119 /// if it holds a `SparkRJob`, `None` if the field is not set or
15120 /// holds a different branch.
15121 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
15122 #[allow(unreachable_patterns)]
15123 self.type_job.as_ref().and_then(|v| match v {
15124 crate::model::job::TypeJob::SparkRJob(v) => std::option::Option::Some(v),
15125 _ => std::option::Option::None,
15126 })
15127 }
15128
15129 /// Sets the value of [type_job][crate::model::Job::type_job]
15130 /// to hold a `SparkRJob`.
15131 ///
15132 /// Note that all the setters affecting `type_job` are
15133 /// mutually exclusive.
15134 ///
15135 /// # Example
15136 /// ```ignore,no_run
15137 /// # use google_cloud_dataproc_v1::model::Job;
15138 /// use google_cloud_dataproc_v1::model::SparkRJob;
15139 /// let x = Job::new().set_spark_r_job(SparkRJob::default()/* use setters */);
15140 /// assert!(x.spark_r_job().is_some());
15141 /// assert!(x.hadoop_job().is_none());
15142 /// assert!(x.spark_job().is_none());
15143 /// assert!(x.pyspark_job().is_none());
15144 /// assert!(x.hive_job().is_none());
15145 /// assert!(x.pig_job().is_none());
15146 /// assert!(x.spark_sql_job().is_none());
15147 /// assert!(x.presto_job().is_none());
15148 /// assert!(x.trino_job().is_none());
15149 /// assert!(x.flink_job().is_none());
15150 /// ```
15151 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
15152 mut self,
15153 v: T,
15154 ) -> Self {
15155 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkRJob(v.into()));
15156 self
15157 }
15158
15159 /// The value of [type_job][crate::model::Job::type_job]
15160 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
15161 /// holds a different branch.
15162 pub fn spark_sql_job(
15163 &self,
15164 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
15165 #[allow(unreachable_patterns)]
15166 self.type_job.as_ref().and_then(|v| match v {
15167 crate::model::job::TypeJob::SparkSqlJob(v) => std::option::Option::Some(v),
15168 _ => std::option::Option::None,
15169 })
15170 }
15171
15172 /// Sets the value of [type_job][crate::model::Job::type_job]
15173 /// to hold a `SparkSqlJob`.
15174 ///
15175 /// Note that all the setters affecting `type_job` are
15176 /// mutually exclusive.
15177 ///
15178 /// # Example
15179 /// ```ignore,no_run
15180 /// # use google_cloud_dataproc_v1::model::Job;
15181 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
15182 /// let x = Job::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
15183 /// assert!(x.spark_sql_job().is_some());
15184 /// assert!(x.hadoop_job().is_none());
15185 /// assert!(x.spark_job().is_none());
15186 /// assert!(x.pyspark_job().is_none());
15187 /// assert!(x.hive_job().is_none());
15188 /// assert!(x.pig_job().is_none());
15189 /// assert!(x.spark_r_job().is_none());
15190 /// assert!(x.presto_job().is_none());
15191 /// assert!(x.trino_job().is_none());
15192 /// assert!(x.flink_job().is_none());
15193 /// ```
15194 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
15195 mut self,
15196 v: T,
15197 ) -> Self {
15198 self.type_job =
15199 std::option::Option::Some(crate::model::job::TypeJob::SparkSqlJob(v.into()));
15200 self
15201 }
15202
15203 /// The value of [type_job][crate::model::Job::type_job]
15204 /// if it holds a `PrestoJob`, `None` if the field is not set or
15205 /// holds a different branch.
15206 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
15207 #[allow(unreachable_patterns)]
15208 self.type_job.as_ref().and_then(|v| match v {
15209 crate::model::job::TypeJob::PrestoJob(v) => std::option::Option::Some(v),
15210 _ => std::option::Option::None,
15211 })
15212 }
15213
15214 /// Sets the value of [type_job][crate::model::Job::type_job]
15215 /// to hold a `PrestoJob`.
15216 ///
15217 /// Note that all the setters affecting `type_job` are
15218 /// mutually exclusive.
15219 ///
15220 /// # Example
15221 /// ```ignore,no_run
15222 /// # use google_cloud_dataproc_v1::model::Job;
15223 /// use google_cloud_dataproc_v1::model::PrestoJob;
15224 /// let x = Job::new().set_presto_job(PrestoJob::default()/* use setters */);
15225 /// assert!(x.presto_job().is_some());
15226 /// assert!(x.hadoop_job().is_none());
15227 /// assert!(x.spark_job().is_none());
15228 /// assert!(x.pyspark_job().is_none());
15229 /// assert!(x.hive_job().is_none());
15230 /// assert!(x.pig_job().is_none());
15231 /// assert!(x.spark_r_job().is_none());
15232 /// assert!(x.spark_sql_job().is_none());
15233 /// assert!(x.trino_job().is_none());
15234 /// assert!(x.flink_job().is_none());
15235 /// ```
15236 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
15237 mut self,
15238 v: T,
15239 ) -> Self {
15240 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PrestoJob(v.into()));
15241 self
15242 }
15243
15244 /// The value of [type_job][crate::model::Job::type_job]
15245 /// if it holds a `TrinoJob`, `None` if the field is not set or
15246 /// holds a different branch.
15247 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
15248 #[allow(unreachable_patterns)]
15249 self.type_job.as_ref().and_then(|v| match v {
15250 crate::model::job::TypeJob::TrinoJob(v) => std::option::Option::Some(v),
15251 _ => std::option::Option::None,
15252 })
15253 }
15254
15255 /// Sets the value of [type_job][crate::model::Job::type_job]
15256 /// to hold a `TrinoJob`.
15257 ///
15258 /// Note that all the setters affecting `type_job` are
15259 /// mutually exclusive.
15260 ///
15261 /// # Example
15262 /// ```ignore,no_run
15263 /// # use google_cloud_dataproc_v1::model::Job;
15264 /// use google_cloud_dataproc_v1::model::TrinoJob;
15265 /// let x = Job::new().set_trino_job(TrinoJob::default()/* use setters */);
15266 /// assert!(x.trino_job().is_some());
15267 /// assert!(x.hadoop_job().is_none());
15268 /// assert!(x.spark_job().is_none());
15269 /// assert!(x.pyspark_job().is_none());
15270 /// assert!(x.hive_job().is_none());
15271 /// assert!(x.pig_job().is_none());
15272 /// assert!(x.spark_r_job().is_none());
15273 /// assert!(x.spark_sql_job().is_none());
15274 /// assert!(x.presto_job().is_none());
15275 /// assert!(x.flink_job().is_none());
15276 /// ```
15277 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
15278 mut self,
15279 v: T,
15280 ) -> Self {
15281 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::TrinoJob(v.into()));
15282 self
15283 }
15284
15285 /// The value of [type_job][crate::model::Job::type_job]
15286 /// if it holds a `FlinkJob`, `None` if the field is not set or
15287 /// holds a different branch.
15288 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
15289 #[allow(unreachable_patterns)]
15290 self.type_job.as_ref().and_then(|v| match v {
15291 crate::model::job::TypeJob::FlinkJob(v) => std::option::Option::Some(v),
15292 _ => std::option::Option::None,
15293 })
15294 }
15295
15296 /// Sets the value of [type_job][crate::model::Job::type_job]
15297 /// to hold a `FlinkJob`.
15298 ///
15299 /// Note that all the setters affecting `type_job` are
15300 /// mutually exclusive.
15301 ///
15302 /// # Example
15303 /// ```ignore,no_run
15304 /// # use google_cloud_dataproc_v1::model::Job;
15305 /// use google_cloud_dataproc_v1::model::FlinkJob;
15306 /// let x = Job::new().set_flink_job(FlinkJob::default()/* use setters */);
15307 /// assert!(x.flink_job().is_some());
15308 /// assert!(x.hadoop_job().is_none());
15309 /// assert!(x.spark_job().is_none());
15310 /// assert!(x.pyspark_job().is_none());
15311 /// assert!(x.hive_job().is_none());
15312 /// assert!(x.pig_job().is_none());
15313 /// assert!(x.spark_r_job().is_none());
15314 /// assert!(x.spark_sql_job().is_none());
15315 /// assert!(x.presto_job().is_none());
15316 /// assert!(x.trino_job().is_none());
15317 /// ```
15318 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
15319 mut self,
15320 v: T,
15321 ) -> Self {
15322 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::FlinkJob(v.into()));
15323 self
15324 }
15325}
15326
15327impl wkt::message::Message for Job {
15328 fn typename() -> &'static str {
15329 "type.googleapis.com/google.cloud.dataproc.v1.Job"
15330 }
15331}
15332
15333/// Defines additional types related to [Job].
15334pub mod job {
15335 #[allow(unused_imports)]
15336 use super::*;
15337
15338 /// Required. The application/framework-specific portion of the job.
15339 #[derive(Clone, Debug, PartialEq)]
15340 #[non_exhaustive]
15341 pub enum TypeJob {
15342 /// Optional. Job is a Hadoop job.
15343 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
15344 /// Optional. Job is a Spark job.
15345 SparkJob(std::boxed::Box<crate::model::SparkJob>),
15346 /// Optional. Job is a PySpark job.
15347 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
15348 /// Optional. Job is a Hive job.
15349 HiveJob(std::boxed::Box<crate::model::HiveJob>),
15350 /// Optional. Job is a Pig job.
15351 PigJob(std::boxed::Box<crate::model::PigJob>),
15352 /// Optional. Job is a SparkR job.
15353 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
15354 /// Optional. Job is a SparkSql job.
15355 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
15356 /// Optional. Job is a Presto job.
15357 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
15358 /// Optional. Job is a Trino job.
15359 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
15360 /// Optional. Job is a Flink job.
15361 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
15362 }
15363}
15364
15365/// Driver scheduling configuration.
15366#[derive(Clone, Default, PartialEq)]
15367#[non_exhaustive]
15368pub struct DriverSchedulingConfig {
15369 /// Required. The amount of memory in MB the driver is requesting.
15370 pub memory_mb: i32,
15371
15372 /// Required. The number of vCPUs the driver is requesting.
15373 pub vcores: i32,
15374
15375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15376}
15377
15378impl DriverSchedulingConfig {
15379 /// Creates a new default instance.
15380 pub fn new() -> Self {
15381 std::default::Default::default()
15382 }
15383
15384 /// Sets the value of [memory_mb][crate::model::DriverSchedulingConfig::memory_mb].
15385 ///
15386 /// # Example
15387 /// ```ignore,no_run
15388 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15389 /// let x = DriverSchedulingConfig::new().set_memory_mb(42);
15390 /// ```
15391 pub fn set_memory_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15392 self.memory_mb = v.into();
15393 self
15394 }
15395
15396 /// Sets the value of [vcores][crate::model::DriverSchedulingConfig::vcores].
15397 ///
15398 /// # Example
15399 /// ```ignore,no_run
15400 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
15401 /// let x = DriverSchedulingConfig::new().set_vcores(42);
15402 /// ```
15403 pub fn set_vcores<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15404 self.vcores = v.into();
15405 self
15406 }
15407}
15408
15409impl wkt::message::Message for DriverSchedulingConfig {
15410 fn typename() -> &'static str {
15411 "type.googleapis.com/google.cloud.dataproc.v1.DriverSchedulingConfig"
15412 }
15413}
15414
15415/// Job scheduling options.
15416#[derive(Clone, Default, PartialEq)]
15417#[non_exhaustive]
15418pub struct JobScheduling {
15419 /// Optional. Maximum number of times per hour a driver can be restarted as
15420 /// a result of driver exiting with non-zero code before job is
15421 /// reported failed.
15422 ///
15423 /// A job might be reported as thrashing if the driver exits with a non-zero
15424 /// code four times within a 10-minute window.
15425 ///
15426 /// Maximum value is 10.
15427 ///
15428 /// **Note:** This restartable job option is not supported in Dataproc
15429 /// [workflow templates]
15430 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template>).
15431 pub max_failures_per_hour: i32,
15432
15433 /// Optional. Maximum total number of times a driver can be restarted as a
15434 /// result of the driver exiting with a non-zero code. After the maximum number
15435 /// is reached, the job will be reported as failed.
15436 ///
15437 /// Maximum value is 240.
15438 ///
15439 /// **Note:** Currently, this restartable job option is
15440 /// not supported in Dataproc
15441 /// [workflow
15442 /// templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
15443 pub max_failures_total: i32,
15444
15445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15446}
15447
15448impl JobScheduling {
15449 /// Creates a new default instance.
15450 pub fn new() -> Self {
15451 std::default::Default::default()
15452 }
15453
15454 /// Sets the value of [max_failures_per_hour][crate::model::JobScheduling::max_failures_per_hour].
15455 ///
15456 /// # Example
15457 /// ```ignore,no_run
15458 /// # use google_cloud_dataproc_v1::model::JobScheduling;
15459 /// let x = JobScheduling::new().set_max_failures_per_hour(42);
15460 /// ```
15461 pub fn set_max_failures_per_hour<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15462 self.max_failures_per_hour = v.into();
15463 self
15464 }
15465
15466 /// Sets the value of [max_failures_total][crate::model::JobScheduling::max_failures_total].
15467 ///
15468 /// # Example
15469 /// ```ignore,no_run
15470 /// # use google_cloud_dataproc_v1::model::JobScheduling;
15471 /// let x = JobScheduling::new().set_max_failures_total(42);
15472 /// ```
15473 pub fn set_max_failures_total<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15474 self.max_failures_total = v.into();
15475 self
15476 }
15477}
15478
15479impl wkt::message::Message for JobScheduling {
15480 fn typename() -> &'static str {
15481 "type.googleapis.com/google.cloud.dataproc.v1.JobScheduling"
15482 }
15483}
15484
15485/// A request to submit a job.
15486#[derive(Clone, Default, PartialEq)]
15487#[non_exhaustive]
15488pub struct SubmitJobRequest {
15489 /// Required. The ID of the Google Cloud Platform project that the job
15490 /// belongs to.
15491 pub project_id: std::string::String,
15492
15493 /// Required. The Dataproc region in which to handle the request.
15494 pub region: std::string::String,
15495
15496 /// Required. The job resource.
15497 pub job: std::option::Option<crate::model::Job>,
15498
15499 /// Optional. A unique id used to identify the request. If the server
15500 /// receives two
15501 /// [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
15502 /// with the same id, then the second request will be ignored and the
15503 /// first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend
15504 /// is returned.
15505 ///
15506 /// It is recommended to always set this value to a
15507 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15508 ///
15509 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
15510 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15511 ///
15512 /// [google.cloud.dataproc.v1.Job]: crate::model::Job
15513 pub request_id: std::string::String,
15514
15515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15516}
15517
15518impl SubmitJobRequest {
15519 /// Creates a new default instance.
15520 pub fn new() -> Self {
15521 std::default::Default::default()
15522 }
15523
15524 /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
15525 ///
15526 /// # Example
15527 /// ```ignore,no_run
15528 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15529 /// let x = SubmitJobRequest::new().set_project_id("example");
15530 /// ```
15531 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15532 self.project_id = v.into();
15533 self
15534 }
15535
15536 /// Sets the value of [region][crate::model::SubmitJobRequest::region].
15537 ///
15538 /// # Example
15539 /// ```ignore,no_run
15540 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15541 /// let x = SubmitJobRequest::new().set_region("example");
15542 /// ```
15543 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15544 self.region = v.into();
15545 self
15546 }
15547
15548 /// Sets the value of [job][crate::model::SubmitJobRequest::job].
15549 ///
15550 /// # Example
15551 /// ```ignore,no_run
15552 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15553 /// use google_cloud_dataproc_v1::model::Job;
15554 /// let x = SubmitJobRequest::new().set_job(Job::default()/* use setters */);
15555 /// ```
15556 pub fn set_job<T>(mut self, v: T) -> Self
15557 where
15558 T: std::convert::Into<crate::model::Job>,
15559 {
15560 self.job = std::option::Option::Some(v.into());
15561 self
15562 }
15563
15564 /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
15565 ///
15566 /// # Example
15567 /// ```ignore,no_run
15568 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15569 /// use google_cloud_dataproc_v1::model::Job;
15570 /// let x = SubmitJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
15571 /// let x = SubmitJobRequest::new().set_or_clear_job(None::<Job>);
15572 /// ```
15573 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
15574 where
15575 T: std::convert::Into<crate::model::Job>,
15576 {
15577 self.job = v.map(|x| x.into());
15578 self
15579 }
15580
15581 /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
15582 ///
15583 /// # Example
15584 /// ```ignore,no_run
15585 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
15586 /// let x = SubmitJobRequest::new().set_request_id("example");
15587 /// ```
15588 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15589 self.request_id = v.into();
15590 self
15591 }
15592}
15593
15594impl wkt::message::Message for SubmitJobRequest {
15595 fn typename() -> &'static str {
15596 "type.googleapis.com/google.cloud.dataproc.v1.SubmitJobRequest"
15597 }
15598}
15599
15600/// Job Operation metadata.
15601#[derive(Clone, Default, PartialEq)]
15602#[non_exhaustive]
15603pub struct JobMetadata {
15604 /// Output only. The job id.
15605 pub job_id: std::string::String,
15606
15607 /// Output only. Most recent job status.
15608 pub status: std::option::Option<crate::model::JobStatus>,
15609
15610 /// Output only. Operation type.
15611 pub operation_type: std::string::String,
15612
15613 /// Output only. Job submission time.
15614 pub start_time: std::option::Option<wkt::Timestamp>,
15615
15616 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15617}
15618
15619impl JobMetadata {
15620 /// Creates a new default instance.
15621 pub fn new() -> Self {
15622 std::default::Default::default()
15623 }
15624
15625 /// Sets the value of [job_id][crate::model::JobMetadata::job_id].
15626 ///
15627 /// # Example
15628 /// ```ignore,no_run
15629 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15630 /// let x = JobMetadata::new().set_job_id("example");
15631 /// ```
15632 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15633 self.job_id = v.into();
15634 self
15635 }
15636
15637 /// Sets the value of [status][crate::model::JobMetadata::status].
15638 ///
15639 /// # Example
15640 /// ```ignore,no_run
15641 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15642 /// use google_cloud_dataproc_v1::model::JobStatus;
15643 /// let x = JobMetadata::new().set_status(JobStatus::default()/* use setters */);
15644 /// ```
15645 pub fn set_status<T>(mut self, v: T) -> Self
15646 where
15647 T: std::convert::Into<crate::model::JobStatus>,
15648 {
15649 self.status = std::option::Option::Some(v.into());
15650 self
15651 }
15652
15653 /// Sets or clears the value of [status][crate::model::JobMetadata::status].
15654 ///
15655 /// # Example
15656 /// ```ignore,no_run
15657 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15658 /// use google_cloud_dataproc_v1::model::JobStatus;
15659 /// let x = JobMetadata::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
15660 /// let x = JobMetadata::new().set_or_clear_status(None::<JobStatus>);
15661 /// ```
15662 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
15663 where
15664 T: std::convert::Into<crate::model::JobStatus>,
15665 {
15666 self.status = v.map(|x| x.into());
15667 self
15668 }
15669
15670 /// Sets the value of [operation_type][crate::model::JobMetadata::operation_type].
15671 ///
15672 /// # Example
15673 /// ```ignore,no_run
15674 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15675 /// let x = JobMetadata::new().set_operation_type("example");
15676 /// ```
15677 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15678 self.operation_type = v.into();
15679 self
15680 }
15681
15682 /// Sets the value of [start_time][crate::model::JobMetadata::start_time].
15683 ///
15684 /// # Example
15685 /// ```ignore,no_run
15686 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15687 /// use wkt::Timestamp;
15688 /// let x = JobMetadata::new().set_start_time(Timestamp::default()/* use setters */);
15689 /// ```
15690 pub fn set_start_time<T>(mut self, v: T) -> Self
15691 where
15692 T: std::convert::Into<wkt::Timestamp>,
15693 {
15694 self.start_time = std::option::Option::Some(v.into());
15695 self
15696 }
15697
15698 /// Sets or clears the value of [start_time][crate::model::JobMetadata::start_time].
15699 ///
15700 /// # Example
15701 /// ```ignore,no_run
15702 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15703 /// use wkt::Timestamp;
15704 /// let x = JobMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
15705 /// let x = JobMetadata::new().set_or_clear_start_time(None::<Timestamp>);
15706 /// ```
15707 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
15708 where
15709 T: std::convert::Into<wkt::Timestamp>,
15710 {
15711 self.start_time = v.map(|x| x.into());
15712 self
15713 }
15714}
15715
15716impl wkt::message::Message for JobMetadata {
15717 fn typename() -> &'static str {
15718 "type.googleapis.com/google.cloud.dataproc.v1.JobMetadata"
15719 }
15720}
15721
15722/// A request to get the resource representation for a job in a project.
15723#[derive(Clone, Default, PartialEq)]
15724#[non_exhaustive]
15725pub struct GetJobRequest {
15726 /// Required. The ID of the Google Cloud Platform project that the job
15727 /// belongs to.
15728 pub project_id: std::string::String,
15729
15730 /// Required. The Dataproc region in which to handle the request.
15731 pub region: std::string::String,
15732
15733 /// Required. The job ID.
15734 pub job_id: std::string::String,
15735
15736 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15737}
15738
15739impl GetJobRequest {
15740 /// Creates a new default instance.
15741 pub fn new() -> Self {
15742 std::default::Default::default()
15743 }
15744
15745 /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
15746 ///
15747 /// # Example
15748 /// ```ignore,no_run
15749 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15750 /// let x = GetJobRequest::new().set_project_id("example");
15751 /// ```
15752 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15753 self.project_id = v.into();
15754 self
15755 }
15756
15757 /// Sets the value of [region][crate::model::GetJobRequest::region].
15758 ///
15759 /// # Example
15760 /// ```ignore,no_run
15761 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15762 /// let x = GetJobRequest::new().set_region("example");
15763 /// ```
15764 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15765 self.region = v.into();
15766 self
15767 }
15768
15769 /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
15770 ///
15771 /// # Example
15772 /// ```ignore,no_run
15773 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15774 /// let x = GetJobRequest::new().set_job_id("example");
15775 /// ```
15776 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15777 self.job_id = v.into();
15778 self
15779 }
15780}
15781
15782impl wkt::message::Message for GetJobRequest {
15783 fn typename() -> &'static str {
15784 "type.googleapis.com/google.cloud.dataproc.v1.GetJobRequest"
15785 }
15786}
15787
15788/// A request to list jobs in a project.
15789#[derive(Clone, Default, PartialEq)]
15790#[non_exhaustive]
15791pub struct ListJobsRequest {
15792 /// Required. The ID of the Google Cloud Platform project that the job
15793 /// belongs to.
15794 pub project_id: std::string::String,
15795
15796 /// Required. The Dataproc region in which to handle the request.
15797 pub region: std::string::String,
15798
15799 /// Optional. The number of results to return in each response.
15800 pub page_size: i32,
15801
15802 /// Optional. The page token, returned by a previous call, to request the
15803 /// next page of results.
15804 pub page_token: std::string::String,
15805
15806 /// Optional. If set, the returned jobs list includes only jobs that were
15807 /// submitted to the named cluster.
15808 pub cluster_name: std::string::String,
15809
15810 /// Optional. Specifies enumerated categories of jobs to list.
15811 /// (default = match ALL jobs).
15812 ///
15813 /// If `filter` is provided, `jobStateMatcher` will be ignored.
15814 pub job_state_matcher: crate::model::list_jobs_request::JobStateMatcher,
15815
15816 /// Optional. A filter constraining the jobs to list. Filters are
15817 /// case-sensitive and have the following syntax:
15818 ///
15819 /// [field = value] AND [field [= value]] ...
15820 ///
15821 /// where **field** is `status.state` or `insertTime`, or `labels.[KEY]`, and
15822 /// `[KEY]` is a label key. **value** can be `*` to match all values.
15823 /// `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
15824 /// Allows `insertTime` to be a timestamp in RFC 3339 format in double quotes,
15825 /// such as `2025-01-01T00:00:00Z`. Only the logical `AND` operator is
15826 /// supported; space-separated items are treated as having an implicit `AND`
15827 /// operator.
15828 ///
15829 /// Example filter:
15830 ///
15831 /// status.state = ACTIVE AND labels.env = staging AND labels.starred = * AND
15832 /// insertTime <= "2025-01-01T00:00:00Z"
15833 pub filter: std::string::String,
15834
15835 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15836}
15837
15838impl ListJobsRequest {
15839 /// Creates a new default instance.
15840 pub fn new() -> Self {
15841 std::default::Default::default()
15842 }
15843
15844 /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
15845 ///
15846 /// # Example
15847 /// ```ignore,no_run
15848 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15849 /// let x = ListJobsRequest::new().set_project_id("example");
15850 /// ```
15851 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15852 self.project_id = v.into();
15853 self
15854 }
15855
15856 /// Sets the value of [region][crate::model::ListJobsRequest::region].
15857 ///
15858 /// # Example
15859 /// ```ignore,no_run
15860 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15861 /// let x = ListJobsRequest::new().set_region("example");
15862 /// ```
15863 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15864 self.region = v.into();
15865 self
15866 }
15867
15868 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
15869 ///
15870 /// # Example
15871 /// ```ignore,no_run
15872 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15873 /// let x = ListJobsRequest::new().set_page_size(42);
15874 /// ```
15875 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15876 self.page_size = v.into();
15877 self
15878 }
15879
15880 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
15881 ///
15882 /// # Example
15883 /// ```ignore,no_run
15884 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15885 /// let x = ListJobsRequest::new().set_page_token("example");
15886 /// ```
15887 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15888 self.page_token = v.into();
15889 self
15890 }
15891
15892 /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
15893 ///
15894 /// # Example
15895 /// ```ignore,no_run
15896 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15897 /// let x = ListJobsRequest::new().set_cluster_name("example");
15898 /// ```
15899 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15900 self.cluster_name = v.into();
15901 self
15902 }
15903
15904 /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
15905 ///
15906 /// # Example
15907 /// ```ignore,no_run
15908 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15909 /// use google_cloud_dataproc_v1::model::list_jobs_request::JobStateMatcher;
15910 /// let x0 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::Active);
15911 /// let x1 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::NonActive);
15912 /// ```
15913 pub fn set_job_state_matcher<
15914 T: std::convert::Into<crate::model::list_jobs_request::JobStateMatcher>,
15915 >(
15916 mut self,
15917 v: T,
15918 ) -> Self {
15919 self.job_state_matcher = v.into();
15920 self
15921 }
15922
15923 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
15924 ///
15925 /// # Example
15926 /// ```ignore,no_run
15927 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15928 /// let x = ListJobsRequest::new().set_filter("example");
15929 /// ```
15930 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15931 self.filter = v.into();
15932 self
15933 }
15934}
15935
15936impl wkt::message::Message for ListJobsRequest {
15937 fn typename() -> &'static str {
15938 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsRequest"
15939 }
15940}
15941
15942/// Defines additional types related to [ListJobsRequest].
15943pub mod list_jobs_request {
15944 #[allow(unused_imports)]
15945 use super::*;
15946
15947 /// A matcher that specifies categories of job states.
15948 ///
15949 /// # Working with unknown values
15950 ///
15951 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15952 /// additional enum variants at any time. Adding new variants is not considered
15953 /// a breaking change. Applications should write their code in anticipation of:
15954 ///
15955 /// - New values appearing in future releases of the client library, **and**
15956 /// - New values received dynamically, without application changes.
15957 ///
15958 /// Please consult the [Working with enums] section in the user guide for some
15959 /// guidelines.
15960 ///
15961 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15962 #[derive(Clone, Debug, PartialEq)]
15963 #[non_exhaustive]
15964 pub enum JobStateMatcher {
15965 /// Match all jobs, regardless of state.
15966 All,
15967 /// Only match jobs in non-terminal states: PENDING, RUNNING, or
15968 /// CANCEL_PENDING.
15969 Active,
15970 /// Only match jobs in terminal states: CANCELLED, DONE, or ERROR.
15971 NonActive,
15972 /// If set, the enum was initialized with an unknown value.
15973 ///
15974 /// Applications can examine the value using [JobStateMatcher::value] or
15975 /// [JobStateMatcher::name].
15976 UnknownValue(job_state_matcher::UnknownValue),
15977 }
15978
15979 #[doc(hidden)]
15980 pub mod job_state_matcher {
15981 #[allow(unused_imports)]
15982 use super::*;
15983 #[derive(Clone, Debug, PartialEq)]
15984 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15985 }
15986
15987 impl JobStateMatcher {
15988 /// Gets the enum value.
15989 ///
15990 /// Returns `None` if the enum contains an unknown value deserialized from
15991 /// the string representation of enums.
15992 pub fn value(&self) -> std::option::Option<i32> {
15993 match self {
15994 Self::All => std::option::Option::Some(0),
15995 Self::Active => std::option::Option::Some(1),
15996 Self::NonActive => std::option::Option::Some(2),
15997 Self::UnknownValue(u) => u.0.value(),
15998 }
15999 }
16000
16001 /// Gets the enum value as a string.
16002 ///
16003 /// Returns `None` if the enum contains an unknown value deserialized from
16004 /// the integer representation of enums.
16005 pub fn name(&self) -> std::option::Option<&str> {
16006 match self {
16007 Self::All => std::option::Option::Some("ALL"),
16008 Self::Active => std::option::Option::Some("ACTIVE"),
16009 Self::NonActive => std::option::Option::Some("NON_ACTIVE"),
16010 Self::UnknownValue(u) => u.0.name(),
16011 }
16012 }
16013 }
16014
16015 impl std::default::Default for JobStateMatcher {
16016 fn default() -> Self {
16017 use std::convert::From;
16018 Self::from(0)
16019 }
16020 }
16021
16022 impl std::fmt::Display for JobStateMatcher {
16023 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16024 wkt::internal::display_enum(f, self.name(), self.value())
16025 }
16026 }
16027
16028 impl std::convert::From<i32> for JobStateMatcher {
16029 fn from(value: i32) -> Self {
16030 match value {
16031 0 => Self::All,
16032 1 => Self::Active,
16033 2 => Self::NonActive,
16034 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
16035 wkt::internal::UnknownEnumValue::Integer(value),
16036 )),
16037 }
16038 }
16039 }
16040
16041 impl std::convert::From<&str> for JobStateMatcher {
16042 fn from(value: &str) -> Self {
16043 use std::string::ToString;
16044 match value {
16045 "ALL" => Self::All,
16046 "ACTIVE" => Self::Active,
16047 "NON_ACTIVE" => Self::NonActive,
16048 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
16049 wkt::internal::UnknownEnumValue::String(value.to_string()),
16050 )),
16051 }
16052 }
16053 }
16054
16055 impl serde::ser::Serialize for JobStateMatcher {
16056 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16057 where
16058 S: serde::Serializer,
16059 {
16060 match self {
16061 Self::All => serializer.serialize_i32(0),
16062 Self::Active => serializer.serialize_i32(1),
16063 Self::NonActive => serializer.serialize_i32(2),
16064 Self::UnknownValue(u) => u.0.serialize(serializer),
16065 }
16066 }
16067 }
16068
16069 impl<'de> serde::de::Deserialize<'de> for JobStateMatcher {
16070 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16071 where
16072 D: serde::Deserializer<'de>,
16073 {
16074 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobStateMatcher>::new(
16075 ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher",
16076 ))
16077 }
16078 }
16079}
16080
16081/// A request to update a job.
16082#[derive(Clone, Default, PartialEq)]
16083#[non_exhaustive]
16084pub struct UpdateJobRequest {
16085 /// Required. The ID of the Google Cloud Platform project that the job
16086 /// belongs to.
16087 pub project_id: std::string::String,
16088
16089 /// Required. The Dataproc region in which to handle the request.
16090 pub region: std::string::String,
16091
16092 /// Required. The job ID.
16093 pub job_id: std::string::String,
16094
16095 /// Required. The changes to the job.
16096 pub job: std::option::Option<crate::model::Job>,
16097
16098 /// Required. Specifies the path, relative to \<code\>Job\</code\>, of
16099 /// the field to update. For example, to update the labels of a Job the
16100 /// \<code\>update_mask\</code\> parameter would be specified as
16101 /// \<code\>labels\</code\>, and the `PATCH` request body would specify the new
16102 /// value. \<strong\>Note:\</strong\> Currently, \<code\>labels\</code\> is the only
16103 /// field that can be updated.
16104 pub update_mask: std::option::Option<wkt::FieldMask>,
16105
16106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16107}
16108
16109impl UpdateJobRequest {
16110 /// Creates a new default instance.
16111 pub fn new() -> Self {
16112 std::default::Default::default()
16113 }
16114
16115 /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
16116 ///
16117 /// # Example
16118 /// ```ignore,no_run
16119 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16120 /// let x = UpdateJobRequest::new().set_project_id("example");
16121 /// ```
16122 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16123 self.project_id = v.into();
16124 self
16125 }
16126
16127 /// Sets the value of [region][crate::model::UpdateJobRequest::region].
16128 ///
16129 /// # Example
16130 /// ```ignore,no_run
16131 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16132 /// let x = UpdateJobRequest::new().set_region("example");
16133 /// ```
16134 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16135 self.region = v.into();
16136 self
16137 }
16138
16139 /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
16140 ///
16141 /// # Example
16142 /// ```ignore,no_run
16143 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16144 /// let x = UpdateJobRequest::new().set_job_id("example");
16145 /// ```
16146 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16147 self.job_id = v.into();
16148 self
16149 }
16150
16151 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
16152 ///
16153 /// # Example
16154 /// ```ignore,no_run
16155 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16156 /// use google_cloud_dataproc_v1::model::Job;
16157 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
16158 /// ```
16159 pub fn set_job<T>(mut self, v: T) -> Self
16160 where
16161 T: std::convert::Into<crate::model::Job>,
16162 {
16163 self.job = std::option::Option::Some(v.into());
16164 self
16165 }
16166
16167 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
16168 ///
16169 /// # Example
16170 /// ```ignore,no_run
16171 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16172 /// use google_cloud_dataproc_v1::model::Job;
16173 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
16174 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
16175 /// ```
16176 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
16177 where
16178 T: std::convert::Into<crate::model::Job>,
16179 {
16180 self.job = v.map(|x| x.into());
16181 self
16182 }
16183
16184 /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
16185 ///
16186 /// # Example
16187 /// ```ignore,no_run
16188 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16189 /// use wkt::FieldMask;
16190 /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
16191 /// ```
16192 pub fn set_update_mask<T>(mut self, v: T) -> Self
16193 where
16194 T: std::convert::Into<wkt::FieldMask>,
16195 {
16196 self.update_mask = std::option::Option::Some(v.into());
16197 self
16198 }
16199
16200 /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
16201 ///
16202 /// # Example
16203 /// ```ignore,no_run
16204 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
16205 /// use wkt::FieldMask;
16206 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
16207 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
16208 /// ```
16209 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16210 where
16211 T: std::convert::Into<wkt::FieldMask>,
16212 {
16213 self.update_mask = v.map(|x| x.into());
16214 self
16215 }
16216}
16217
16218impl wkt::message::Message for UpdateJobRequest {
16219 fn typename() -> &'static str {
16220 "type.googleapis.com/google.cloud.dataproc.v1.UpdateJobRequest"
16221 }
16222}
16223
16224/// A list of jobs in a project.
16225#[derive(Clone, Default, PartialEq)]
16226#[non_exhaustive]
16227pub struct ListJobsResponse {
16228 /// Output only. Jobs list.
16229 pub jobs: std::vec::Vec<crate::model::Job>,
16230
16231 /// Optional. This token is included in the response if there are more results
16232 /// to fetch. To fetch additional results, provide this value as the
16233 /// `page_token` in a subsequent \<code\>ListJobsRequest\</code\>.
16234 pub next_page_token: std::string::String,
16235
16236 /// Output only. List of jobs with
16237 /// [kms_key][google.cloud.dataproc.v1.EncryptionConfig.kms_key]-encrypted
16238 /// parameters that could not be decrypted. A response to a `jobs.get` request
16239 /// may indicate the reason for the decryption failure for a specific job.
16240 ///
16241 /// [google.cloud.dataproc.v1.EncryptionConfig.kms_key]: crate::model::EncryptionConfig::kms_key
16242 pub unreachable: std::vec::Vec<std::string::String>,
16243
16244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16245}
16246
16247impl ListJobsResponse {
16248 /// Creates a new default instance.
16249 pub fn new() -> Self {
16250 std::default::Default::default()
16251 }
16252
16253 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
16254 ///
16255 /// # Example
16256 /// ```ignore,no_run
16257 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16258 /// use google_cloud_dataproc_v1::model::Job;
16259 /// let x = ListJobsResponse::new()
16260 /// .set_jobs([
16261 /// Job::default()/* use setters */,
16262 /// Job::default()/* use (different) setters */,
16263 /// ]);
16264 /// ```
16265 pub fn set_jobs<T, V>(mut self, v: T) -> Self
16266 where
16267 T: std::iter::IntoIterator<Item = V>,
16268 V: std::convert::Into<crate::model::Job>,
16269 {
16270 use std::iter::Iterator;
16271 self.jobs = v.into_iter().map(|i| i.into()).collect();
16272 self
16273 }
16274
16275 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
16276 ///
16277 /// # Example
16278 /// ```ignore,no_run
16279 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16280 /// let x = ListJobsResponse::new().set_next_page_token("example");
16281 /// ```
16282 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16283 self.next_page_token = v.into();
16284 self
16285 }
16286
16287 /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
16288 ///
16289 /// # Example
16290 /// ```ignore,no_run
16291 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
16292 /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
16293 /// ```
16294 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
16295 where
16296 T: std::iter::IntoIterator<Item = V>,
16297 V: std::convert::Into<std::string::String>,
16298 {
16299 use std::iter::Iterator;
16300 self.unreachable = v.into_iter().map(|i| i.into()).collect();
16301 self
16302 }
16303}
16304
16305impl wkt::message::Message for ListJobsResponse {
16306 fn typename() -> &'static str {
16307 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsResponse"
16308 }
16309}
16310
16311#[doc(hidden)]
16312impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
16313 type PageItem = crate::model::Job;
16314
16315 fn items(self) -> std::vec::Vec<Self::PageItem> {
16316 self.jobs
16317 }
16318
16319 fn next_page_token(&self) -> std::string::String {
16320 use std::clone::Clone;
16321 self.next_page_token.clone()
16322 }
16323}
16324
16325/// A request to cancel a job.
16326#[derive(Clone, Default, PartialEq)]
16327#[non_exhaustive]
16328pub struct CancelJobRequest {
16329 /// Required. The ID of the Google Cloud Platform project that the job
16330 /// belongs to.
16331 pub project_id: std::string::String,
16332
16333 /// Required. The Dataproc region in which to handle the request.
16334 pub region: std::string::String,
16335
16336 /// Required. The job ID.
16337 pub job_id: std::string::String,
16338
16339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16340}
16341
16342impl CancelJobRequest {
16343 /// Creates a new default instance.
16344 pub fn new() -> Self {
16345 std::default::Default::default()
16346 }
16347
16348 /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
16349 ///
16350 /// # Example
16351 /// ```ignore,no_run
16352 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16353 /// let x = CancelJobRequest::new().set_project_id("example");
16354 /// ```
16355 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16356 self.project_id = v.into();
16357 self
16358 }
16359
16360 /// Sets the value of [region][crate::model::CancelJobRequest::region].
16361 ///
16362 /// # Example
16363 /// ```ignore,no_run
16364 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16365 /// let x = CancelJobRequest::new().set_region("example");
16366 /// ```
16367 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16368 self.region = v.into();
16369 self
16370 }
16371
16372 /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
16373 ///
16374 /// # Example
16375 /// ```ignore,no_run
16376 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
16377 /// let x = CancelJobRequest::new().set_job_id("example");
16378 /// ```
16379 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16380 self.job_id = v.into();
16381 self
16382 }
16383}
16384
16385impl wkt::message::Message for CancelJobRequest {
16386 fn typename() -> &'static str {
16387 "type.googleapis.com/google.cloud.dataproc.v1.CancelJobRequest"
16388 }
16389}
16390
16391/// A request to delete a job.
16392#[derive(Clone, Default, PartialEq)]
16393#[non_exhaustive]
16394pub struct DeleteJobRequest {
16395 /// Required. The ID of the Google Cloud Platform project that the job
16396 /// belongs to.
16397 pub project_id: std::string::String,
16398
16399 /// Required. The Dataproc region in which to handle the request.
16400 pub region: std::string::String,
16401
16402 /// Required. The job ID.
16403 pub job_id: std::string::String,
16404
16405 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16406}
16407
16408impl DeleteJobRequest {
16409 /// Creates a new default instance.
16410 pub fn new() -> Self {
16411 std::default::Default::default()
16412 }
16413
16414 /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
16415 ///
16416 /// # Example
16417 /// ```ignore,no_run
16418 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16419 /// let x = DeleteJobRequest::new().set_project_id("example");
16420 /// ```
16421 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16422 self.project_id = v.into();
16423 self
16424 }
16425
16426 /// Sets the value of [region][crate::model::DeleteJobRequest::region].
16427 ///
16428 /// # Example
16429 /// ```ignore,no_run
16430 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16431 /// let x = DeleteJobRequest::new().set_region("example");
16432 /// ```
16433 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16434 self.region = v.into();
16435 self
16436 }
16437
16438 /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
16439 ///
16440 /// # Example
16441 /// ```ignore,no_run
16442 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
16443 /// let x = DeleteJobRequest::new().set_job_id("example");
16444 /// ```
16445 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16446 self.job_id = v.into();
16447 self
16448 }
16449}
16450
16451impl wkt::message::Message for DeleteJobRequest {
16452 fn typename() -> &'static str {
16453 "type.googleapis.com/google.cloud.dataproc.v1.DeleteJobRequest"
16454 }
16455}
16456
16457/// A request to create a node group.
16458#[derive(Clone, Default, PartialEq)]
16459#[non_exhaustive]
16460pub struct CreateNodeGroupRequest {
16461 /// Required. The parent resource where this node group will be created.
16462 /// Format: `projects/{project}/regions/{region}/clusters/{cluster}`
16463 pub parent: std::string::String,
16464
16465 /// Required. The node group to create.
16466 pub node_group: std::option::Option<crate::model::NodeGroup>,
16467
16468 /// Optional. An optional node group ID. Generated if not specified.
16469 ///
16470 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
16471 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
16472 /// or hyphen. Must consist of from 3 to 33 characters.
16473 pub node_group_id: std::string::String,
16474
16475 /// Optional. A unique ID used to identify the request. If the server receives
16476 /// two
16477 /// [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
16478 /// with the same ID, the second request is ignored and the
16479 /// first [google.longrunning.Operation][google.longrunning.Operation] created
16480 /// and stored in the backend is returned.
16481 ///
16482 /// Recommendation: Set this value to a
16483 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
16484 ///
16485 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
16486 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
16487 ///
16488 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
16489 pub request_id: std::string::String,
16490
16491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16492}
16493
16494impl CreateNodeGroupRequest {
16495 /// Creates a new default instance.
16496 pub fn new() -> Self {
16497 std::default::Default::default()
16498 }
16499
16500 /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
16501 ///
16502 /// # Example
16503 /// ```ignore,no_run
16504 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16505 /// # let project_id = "project_id";
16506 /// # let region_id = "region_id";
16507 /// # let cluster_id = "cluster_id";
16508 /// let x = CreateNodeGroupRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}/clusters/{cluster_id}"));
16509 /// ```
16510 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16511 self.parent = v.into();
16512 self
16513 }
16514
16515 /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
16516 ///
16517 /// # Example
16518 /// ```ignore,no_run
16519 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16520 /// use google_cloud_dataproc_v1::model::NodeGroup;
16521 /// let x = CreateNodeGroupRequest::new().set_node_group(NodeGroup::default()/* use setters */);
16522 /// ```
16523 pub fn set_node_group<T>(mut self, v: T) -> Self
16524 where
16525 T: std::convert::Into<crate::model::NodeGroup>,
16526 {
16527 self.node_group = std::option::Option::Some(v.into());
16528 self
16529 }
16530
16531 /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
16532 ///
16533 /// # Example
16534 /// ```ignore,no_run
16535 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16536 /// use google_cloud_dataproc_v1::model::NodeGroup;
16537 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
16538 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(None::<NodeGroup>);
16539 /// ```
16540 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
16541 where
16542 T: std::convert::Into<crate::model::NodeGroup>,
16543 {
16544 self.node_group = v.map(|x| x.into());
16545 self
16546 }
16547
16548 /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
16549 ///
16550 /// # Example
16551 /// ```ignore,no_run
16552 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16553 /// let x = CreateNodeGroupRequest::new().set_node_group_id("example");
16554 /// ```
16555 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16556 self.node_group_id = v.into();
16557 self
16558 }
16559
16560 /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
16561 ///
16562 /// # Example
16563 /// ```ignore,no_run
16564 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
16565 /// let x = CreateNodeGroupRequest::new().set_request_id("example");
16566 /// ```
16567 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16568 self.request_id = v.into();
16569 self
16570 }
16571}
16572
16573impl wkt::message::Message for CreateNodeGroupRequest {
16574 fn typename() -> &'static str {
16575 "type.googleapis.com/google.cloud.dataproc.v1.CreateNodeGroupRequest"
16576 }
16577}
16578
16579/// A request to resize a node group.
16580#[derive(Clone, Default, PartialEq)]
16581#[non_exhaustive]
16582pub struct ResizeNodeGroupRequest {
16583 /// Required. The name of the node group to resize.
16584 /// Format:
16585 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
16586 pub name: std::string::String,
16587
16588 /// Required. The number of running instances for the node group to maintain.
16589 /// The group adds or removes instances to maintain the number of instances
16590 /// specified by this parameter.
16591 pub size: i32,
16592
16593 /// Optional. A unique ID used to identify the request. If the server receives
16594 /// two
16595 /// [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
16596 /// with the same ID, the second request is ignored and the
16597 /// first [google.longrunning.Operation][google.longrunning.Operation] created
16598 /// and stored in the backend is returned.
16599 ///
16600 /// Recommendation: Set this value to a
16601 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
16602 ///
16603 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
16604 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
16605 ///
16606 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
16607 pub request_id: std::string::String,
16608
16609 /// Optional. Timeout for graceful YARN decommissioning. [Graceful
16610 /// decommissioning]
16611 /// (<https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning>)
16612 /// allows the removal of nodes from the Compute Engine node group
16613 /// without interrupting jobs in progress. This timeout specifies how long to
16614 /// wait for jobs in progress to finish before forcefully removing nodes (and
16615 /// potentially interrupting jobs). Default timeout is 0 (for forceful
16616 /// decommission), and the maximum allowed timeout is 1 day. (see JSON
16617 /// representation of
16618 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
16619 ///
16620 /// Only supported on Dataproc image versions 1.2 and higher.
16621 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
16622
16623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16624}
16625
16626impl ResizeNodeGroupRequest {
16627 /// Creates a new default instance.
16628 pub fn new() -> Self {
16629 std::default::Default::default()
16630 }
16631
16632 /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
16633 ///
16634 /// # Example
16635 /// ```ignore,no_run
16636 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16637 /// let x = ResizeNodeGroupRequest::new().set_name("example");
16638 /// ```
16639 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16640 self.name = v.into();
16641 self
16642 }
16643
16644 /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
16645 ///
16646 /// # Example
16647 /// ```ignore,no_run
16648 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16649 /// let x = ResizeNodeGroupRequest::new().set_size(42);
16650 /// ```
16651 pub fn set_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16652 self.size = v.into();
16653 self
16654 }
16655
16656 /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
16657 ///
16658 /// # Example
16659 /// ```ignore,no_run
16660 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16661 /// let x = ResizeNodeGroupRequest::new().set_request_id("example");
16662 /// ```
16663 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16664 self.request_id = v.into();
16665 self
16666 }
16667
16668 /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
16669 ///
16670 /// # Example
16671 /// ```ignore,no_run
16672 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16673 /// use wkt::Duration;
16674 /// let x = ResizeNodeGroupRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
16675 /// ```
16676 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
16677 where
16678 T: std::convert::Into<wkt::Duration>,
16679 {
16680 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
16681 self
16682 }
16683
16684 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
16685 ///
16686 /// # Example
16687 /// ```ignore,no_run
16688 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16689 /// use wkt::Duration;
16690 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
16691 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
16692 /// ```
16693 pub fn set_or_clear_graceful_decommission_timeout<T>(
16694 mut self,
16695 v: std::option::Option<T>,
16696 ) -> Self
16697 where
16698 T: std::convert::Into<wkt::Duration>,
16699 {
16700 self.graceful_decommission_timeout = v.map(|x| x.into());
16701 self
16702 }
16703}
16704
16705impl wkt::message::Message for ResizeNodeGroupRequest {
16706 fn typename() -> &'static str {
16707 "type.googleapis.com/google.cloud.dataproc.v1.ResizeNodeGroupRequest"
16708 }
16709}
16710
16711/// A request to get a node group .
16712#[derive(Clone, Default, PartialEq)]
16713#[non_exhaustive]
16714pub struct GetNodeGroupRequest {
16715 /// Required. The name of the node group to retrieve.
16716 /// Format:
16717 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
16718 pub name: std::string::String,
16719
16720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16721}
16722
16723impl GetNodeGroupRequest {
16724 /// Creates a new default instance.
16725 pub fn new() -> Self {
16726 std::default::Default::default()
16727 }
16728
16729 /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
16730 ///
16731 /// # Example
16732 /// ```ignore,no_run
16733 /// # use google_cloud_dataproc_v1::model::GetNodeGroupRequest;
16734 /// # let project_id = "project_id";
16735 /// # let region_id = "region_id";
16736 /// # let cluster_id = "cluster_id";
16737 /// # let node_group_id = "node_group_id";
16738 /// let x = GetNodeGroupRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/clusters/{cluster_id}/nodeGroups/{node_group_id}"));
16739 /// ```
16740 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16741 self.name = v.into();
16742 self
16743 }
16744}
16745
16746impl wkt::message::Message for GetNodeGroupRequest {
16747 fn typename() -> &'static str {
16748 "type.googleapis.com/google.cloud.dataproc.v1.GetNodeGroupRequest"
16749 }
16750}
16751
16752/// Metadata describing the Batch operation.
16753#[derive(Clone, Default, PartialEq)]
16754#[non_exhaustive]
16755pub struct BatchOperationMetadata {
16756 /// Name of the batch for the operation.
16757 pub batch: std::string::String,
16758
16759 /// Batch UUID for the operation.
16760 pub batch_uuid: std::string::String,
16761
16762 /// The time when the operation was created.
16763 pub create_time: std::option::Option<wkt::Timestamp>,
16764
16765 /// The time when the operation finished.
16766 pub done_time: std::option::Option<wkt::Timestamp>,
16767
16768 /// The operation type.
16769 pub operation_type: crate::model::batch_operation_metadata::BatchOperationType,
16770
16771 /// Short description of the operation.
16772 pub description: std::string::String,
16773
16774 /// Labels associated with the operation.
16775 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16776
16777 /// Warnings encountered during operation execution.
16778 pub warnings: std::vec::Vec<std::string::String>,
16779
16780 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16781}
16782
16783impl BatchOperationMetadata {
16784 /// Creates a new default instance.
16785 pub fn new() -> Self {
16786 std::default::Default::default()
16787 }
16788
16789 /// Sets the value of [batch][crate::model::BatchOperationMetadata::batch].
16790 ///
16791 /// # Example
16792 /// ```ignore,no_run
16793 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16794 /// let x = BatchOperationMetadata::new().set_batch("example");
16795 /// ```
16796 pub fn set_batch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16797 self.batch = v.into();
16798 self
16799 }
16800
16801 /// Sets the value of [batch_uuid][crate::model::BatchOperationMetadata::batch_uuid].
16802 ///
16803 /// # Example
16804 /// ```ignore,no_run
16805 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16806 /// let x = BatchOperationMetadata::new().set_batch_uuid("example");
16807 /// ```
16808 pub fn set_batch_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16809 self.batch_uuid = v.into();
16810 self
16811 }
16812
16813 /// Sets the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16814 ///
16815 /// # Example
16816 /// ```ignore,no_run
16817 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16818 /// use wkt::Timestamp;
16819 /// let x = BatchOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16820 /// ```
16821 pub fn set_create_time<T>(mut self, v: T) -> Self
16822 where
16823 T: std::convert::Into<wkt::Timestamp>,
16824 {
16825 self.create_time = std::option::Option::Some(v.into());
16826 self
16827 }
16828
16829 /// Sets or clears the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16830 ///
16831 /// # Example
16832 /// ```ignore,no_run
16833 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16834 /// use wkt::Timestamp;
16835 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16836 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16837 /// ```
16838 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16839 where
16840 T: std::convert::Into<wkt::Timestamp>,
16841 {
16842 self.create_time = v.map(|x| x.into());
16843 self
16844 }
16845
16846 /// Sets the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16847 ///
16848 /// # Example
16849 /// ```ignore,no_run
16850 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16851 /// use wkt::Timestamp;
16852 /// let x = BatchOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16853 /// ```
16854 pub fn set_done_time<T>(mut self, v: T) -> Self
16855 where
16856 T: std::convert::Into<wkt::Timestamp>,
16857 {
16858 self.done_time = std::option::Option::Some(v.into());
16859 self
16860 }
16861
16862 /// Sets or clears the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16863 ///
16864 /// # Example
16865 /// ```ignore,no_run
16866 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16867 /// use wkt::Timestamp;
16868 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16869 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16870 /// ```
16871 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16872 where
16873 T: std::convert::Into<wkt::Timestamp>,
16874 {
16875 self.done_time = v.map(|x| x.into());
16876 self
16877 }
16878
16879 /// Sets the value of [operation_type][crate::model::BatchOperationMetadata::operation_type].
16880 ///
16881 /// # Example
16882 /// ```ignore,no_run
16883 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16884 /// use google_cloud_dataproc_v1::model::batch_operation_metadata::BatchOperationType;
16885 /// let x0 = BatchOperationMetadata::new().set_operation_type(BatchOperationType::Batch);
16886 /// ```
16887 pub fn set_operation_type<
16888 T: std::convert::Into<crate::model::batch_operation_metadata::BatchOperationType>,
16889 >(
16890 mut self,
16891 v: T,
16892 ) -> Self {
16893 self.operation_type = v.into();
16894 self
16895 }
16896
16897 /// Sets the value of [description][crate::model::BatchOperationMetadata::description].
16898 ///
16899 /// # Example
16900 /// ```ignore,no_run
16901 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16902 /// let x = BatchOperationMetadata::new().set_description("example");
16903 /// ```
16904 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16905 self.description = v.into();
16906 self
16907 }
16908
16909 /// Sets the value of [labels][crate::model::BatchOperationMetadata::labels].
16910 ///
16911 /// # Example
16912 /// ```ignore,no_run
16913 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16914 /// let x = BatchOperationMetadata::new().set_labels([
16915 /// ("key0", "abc"),
16916 /// ("key1", "xyz"),
16917 /// ]);
16918 /// ```
16919 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16920 where
16921 T: std::iter::IntoIterator<Item = (K, V)>,
16922 K: std::convert::Into<std::string::String>,
16923 V: std::convert::Into<std::string::String>,
16924 {
16925 use std::iter::Iterator;
16926 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16927 self
16928 }
16929
16930 /// Sets the value of [warnings][crate::model::BatchOperationMetadata::warnings].
16931 ///
16932 /// # Example
16933 /// ```ignore,no_run
16934 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16935 /// let x = BatchOperationMetadata::new().set_warnings(["a", "b", "c"]);
16936 /// ```
16937 pub fn set_warnings<T, V>(mut self, v: T) -> Self
16938 where
16939 T: std::iter::IntoIterator<Item = V>,
16940 V: std::convert::Into<std::string::String>,
16941 {
16942 use std::iter::Iterator;
16943 self.warnings = v.into_iter().map(|i| i.into()).collect();
16944 self
16945 }
16946}
16947
16948impl wkt::message::Message for BatchOperationMetadata {
16949 fn typename() -> &'static str {
16950 "type.googleapis.com/google.cloud.dataproc.v1.BatchOperationMetadata"
16951 }
16952}
16953
16954/// Defines additional types related to [BatchOperationMetadata].
16955pub mod batch_operation_metadata {
16956 #[allow(unused_imports)]
16957 use super::*;
16958
16959 /// Operation type for Batch resources
16960 ///
16961 /// # Working with unknown values
16962 ///
16963 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16964 /// additional enum variants at any time. Adding new variants is not considered
16965 /// a breaking change. Applications should write their code in anticipation of:
16966 ///
16967 /// - New values appearing in future releases of the client library, **and**
16968 /// - New values received dynamically, without application changes.
16969 ///
16970 /// Please consult the [Working with enums] section in the user guide for some
16971 /// guidelines.
16972 ///
16973 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16974 #[derive(Clone, Debug, PartialEq)]
16975 #[non_exhaustive]
16976 pub enum BatchOperationType {
16977 /// Batch operation type is unknown.
16978 Unspecified,
16979 /// Batch operation type.
16980 Batch,
16981 /// If set, the enum was initialized with an unknown value.
16982 ///
16983 /// Applications can examine the value using [BatchOperationType::value] or
16984 /// [BatchOperationType::name].
16985 UnknownValue(batch_operation_type::UnknownValue),
16986 }
16987
16988 #[doc(hidden)]
16989 pub mod batch_operation_type {
16990 #[allow(unused_imports)]
16991 use super::*;
16992 #[derive(Clone, Debug, PartialEq)]
16993 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16994 }
16995
16996 impl BatchOperationType {
16997 /// Gets the enum value.
16998 ///
16999 /// Returns `None` if the enum contains an unknown value deserialized from
17000 /// the string representation of enums.
17001 pub fn value(&self) -> std::option::Option<i32> {
17002 match self {
17003 Self::Unspecified => std::option::Option::Some(0),
17004 Self::Batch => std::option::Option::Some(1),
17005 Self::UnknownValue(u) => u.0.value(),
17006 }
17007 }
17008
17009 /// Gets the enum value as a string.
17010 ///
17011 /// Returns `None` if the enum contains an unknown value deserialized from
17012 /// the integer representation of enums.
17013 pub fn name(&self) -> std::option::Option<&str> {
17014 match self {
17015 Self::Unspecified => std::option::Option::Some("BATCH_OPERATION_TYPE_UNSPECIFIED"),
17016 Self::Batch => std::option::Option::Some("BATCH"),
17017 Self::UnknownValue(u) => u.0.name(),
17018 }
17019 }
17020 }
17021
17022 impl std::default::Default for BatchOperationType {
17023 fn default() -> Self {
17024 use std::convert::From;
17025 Self::from(0)
17026 }
17027 }
17028
17029 impl std::fmt::Display for BatchOperationType {
17030 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17031 wkt::internal::display_enum(f, self.name(), self.value())
17032 }
17033 }
17034
17035 impl std::convert::From<i32> for BatchOperationType {
17036 fn from(value: i32) -> Self {
17037 match value {
17038 0 => Self::Unspecified,
17039 1 => Self::Batch,
17040 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
17041 wkt::internal::UnknownEnumValue::Integer(value),
17042 )),
17043 }
17044 }
17045 }
17046
17047 impl std::convert::From<&str> for BatchOperationType {
17048 fn from(value: &str) -> Self {
17049 use std::string::ToString;
17050 match value {
17051 "BATCH_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17052 "BATCH" => Self::Batch,
17053 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
17054 wkt::internal::UnknownEnumValue::String(value.to_string()),
17055 )),
17056 }
17057 }
17058 }
17059
17060 impl serde::ser::Serialize for BatchOperationType {
17061 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17062 where
17063 S: serde::Serializer,
17064 {
17065 match self {
17066 Self::Unspecified => serializer.serialize_i32(0),
17067 Self::Batch => serializer.serialize_i32(1),
17068 Self::UnknownValue(u) => u.0.serialize(serializer),
17069 }
17070 }
17071 }
17072
17073 impl<'de> serde::de::Deserialize<'de> for BatchOperationType {
17074 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17075 where
17076 D: serde::Deserializer<'de>,
17077 {
17078 deserializer.deserialize_any(wkt::internal::EnumVisitor::<BatchOperationType>::new(
17079 ".google.cloud.dataproc.v1.BatchOperationMetadata.BatchOperationType",
17080 ))
17081 }
17082 }
17083}
17084
17085/// Metadata describing the Session operation.
17086#[derive(Clone, Default, PartialEq)]
17087#[non_exhaustive]
17088pub struct SessionOperationMetadata {
17089 /// Name of the session for the operation.
17090 pub session: std::string::String,
17091
17092 /// Session UUID for the operation.
17093 pub session_uuid: std::string::String,
17094
17095 /// The time when the operation was created.
17096 pub create_time: std::option::Option<wkt::Timestamp>,
17097
17098 /// The time when the operation was finished.
17099 pub done_time: std::option::Option<wkt::Timestamp>,
17100
17101 /// The operation type.
17102 pub operation_type: crate::model::session_operation_metadata::SessionOperationType,
17103
17104 /// Short description of the operation.
17105 pub description: std::string::String,
17106
17107 /// Labels associated with the operation.
17108 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17109
17110 /// Warnings encountered during operation execution.
17111 pub warnings: std::vec::Vec<std::string::String>,
17112
17113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17114}
17115
17116impl SessionOperationMetadata {
17117 /// Creates a new default instance.
17118 pub fn new() -> Self {
17119 std::default::Default::default()
17120 }
17121
17122 /// Sets the value of [session][crate::model::SessionOperationMetadata::session].
17123 ///
17124 /// # Example
17125 /// ```ignore,no_run
17126 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17127 /// let x = SessionOperationMetadata::new().set_session("example");
17128 /// ```
17129 pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17130 self.session = v.into();
17131 self
17132 }
17133
17134 /// Sets the value of [session_uuid][crate::model::SessionOperationMetadata::session_uuid].
17135 ///
17136 /// # Example
17137 /// ```ignore,no_run
17138 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17139 /// let x = SessionOperationMetadata::new().set_session_uuid("example");
17140 /// ```
17141 pub fn set_session_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17142 self.session_uuid = v.into();
17143 self
17144 }
17145
17146 /// Sets the value of [create_time][crate::model::SessionOperationMetadata::create_time].
17147 ///
17148 /// # Example
17149 /// ```ignore,no_run
17150 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17151 /// use wkt::Timestamp;
17152 /// let x = SessionOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
17153 /// ```
17154 pub fn set_create_time<T>(mut self, v: T) -> Self
17155 where
17156 T: std::convert::Into<wkt::Timestamp>,
17157 {
17158 self.create_time = std::option::Option::Some(v.into());
17159 self
17160 }
17161
17162 /// Sets or clears the value of [create_time][crate::model::SessionOperationMetadata::create_time].
17163 ///
17164 /// # Example
17165 /// ```ignore,no_run
17166 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17167 /// use wkt::Timestamp;
17168 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17169 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
17170 /// ```
17171 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17172 where
17173 T: std::convert::Into<wkt::Timestamp>,
17174 {
17175 self.create_time = v.map(|x| x.into());
17176 self
17177 }
17178
17179 /// Sets the value of [done_time][crate::model::SessionOperationMetadata::done_time].
17180 ///
17181 /// # Example
17182 /// ```ignore,no_run
17183 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17184 /// use wkt::Timestamp;
17185 /// let x = SessionOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
17186 /// ```
17187 pub fn set_done_time<T>(mut self, v: T) -> Self
17188 where
17189 T: std::convert::Into<wkt::Timestamp>,
17190 {
17191 self.done_time = std::option::Option::Some(v.into());
17192 self
17193 }
17194
17195 /// Sets or clears the value of [done_time][crate::model::SessionOperationMetadata::done_time].
17196 ///
17197 /// # Example
17198 /// ```ignore,no_run
17199 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17200 /// use wkt::Timestamp;
17201 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
17202 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
17203 /// ```
17204 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
17205 where
17206 T: std::convert::Into<wkt::Timestamp>,
17207 {
17208 self.done_time = v.map(|x| x.into());
17209 self
17210 }
17211
17212 /// Sets the value of [operation_type][crate::model::SessionOperationMetadata::operation_type].
17213 ///
17214 /// # Example
17215 /// ```ignore,no_run
17216 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17217 /// use google_cloud_dataproc_v1::model::session_operation_metadata::SessionOperationType;
17218 /// let x0 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Create);
17219 /// let x1 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Terminate);
17220 /// let x2 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Delete);
17221 /// ```
17222 pub fn set_operation_type<
17223 T: std::convert::Into<crate::model::session_operation_metadata::SessionOperationType>,
17224 >(
17225 mut self,
17226 v: T,
17227 ) -> Self {
17228 self.operation_type = v.into();
17229 self
17230 }
17231
17232 /// Sets the value of [description][crate::model::SessionOperationMetadata::description].
17233 ///
17234 /// # Example
17235 /// ```ignore,no_run
17236 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17237 /// let x = SessionOperationMetadata::new().set_description("example");
17238 /// ```
17239 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17240 self.description = v.into();
17241 self
17242 }
17243
17244 /// Sets the value of [labels][crate::model::SessionOperationMetadata::labels].
17245 ///
17246 /// # Example
17247 /// ```ignore,no_run
17248 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17249 /// let x = SessionOperationMetadata::new().set_labels([
17250 /// ("key0", "abc"),
17251 /// ("key1", "xyz"),
17252 /// ]);
17253 /// ```
17254 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17255 where
17256 T: std::iter::IntoIterator<Item = (K, V)>,
17257 K: std::convert::Into<std::string::String>,
17258 V: std::convert::Into<std::string::String>,
17259 {
17260 use std::iter::Iterator;
17261 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17262 self
17263 }
17264
17265 /// Sets the value of [warnings][crate::model::SessionOperationMetadata::warnings].
17266 ///
17267 /// # Example
17268 /// ```ignore,no_run
17269 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
17270 /// let x = SessionOperationMetadata::new().set_warnings(["a", "b", "c"]);
17271 /// ```
17272 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17273 where
17274 T: std::iter::IntoIterator<Item = V>,
17275 V: std::convert::Into<std::string::String>,
17276 {
17277 use std::iter::Iterator;
17278 self.warnings = v.into_iter().map(|i| i.into()).collect();
17279 self
17280 }
17281}
17282
17283impl wkt::message::Message for SessionOperationMetadata {
17284 fn typename() -> &'static str {
17285 "type.googleapis.com/google.cloud.dataproc.v1.SessionOperationMetadata"
17286 }
17287}
17288
17289/// Defines additional types related to [SessionOperationMetadata].
17290pub mod session_operation_metadata {
17291 #[allow(unused_imports)]
17292 use super::*;
17293
17294 /// Operation type for Session resources
17295 ///
17296 /// # Working with unknown values
17297 ///
17298 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17299 /// additional enum variants at any time. Adding new variants is not considered
17300 /// a breaking change. Applications should write their code in anticipation of:
17301 ///
17302 /// - New values appearing in future releases of the client library, **and**
17303 /// - New values received dynamically, without application changes.
17304 ///
17305 /// Please consult the [Working with enums] section in the user guide for some
17306 /// guidelines.
17307 ///
17308 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17309 #[derive(Clone, Debug, PartialEq)]
17310 #[non_exhaustive]
17311 pub enum SessionOperationType {
17312 /// Session operation type is unknown.
17313 Unspecified,
17314 /// Create Session operation type.
17315 Create,
17316 /// Terminate Session operation type.
17317 Terminate,
17318 /// Delete Session operation type.
17319 Delete,
17320 /// If set, the enum was initialized with an unknown value.
17321 ///
17322 /// Applications can examine the value using [SessionOperationType::value] or
17323 /// [SessionOperationType::name].
17324 UnknownValue(session_operation_type::UnknownValue),
17325 }
17326
17327 #[doc(hidden)]
17328 pub mod session_operation_type {
17329 #[allow(unused_imports)]
17330 use super::*;
17331 #[derive(Clone, Debug, PartialEq)]
17332 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17333 }
17334
17335 impl SessionOperationType {
17336 /// Gets the enum value.
17337 ///
17338 /// Returns `None` if the enum contains an unknown value deserialized from
17339 /// the string representation of enums.
17340 pub fn value(&self) -> std::option::Option<i32> {
17341 match self {
17342 Self::Unspecified => std::option::Option::Some(0),
17343 Self::Create => std::option::Option::Some(1),
17344 Self::Terminate => std::option::Option::Some(2),
17345 Self::Delete => std::option::Option::Some(3),
17346 Self::UnknownValue(u) => u.0.value(),
17347 }
17348 }
17349
17350 /// Gets the enum value as a string.
17351 ///
17352 /// Returns `None` if the enum contains an unknown value deserialized from
17353 /// the integer representation of enums.
17354 pub fn name(&self) -> std::option::Option<&str> {
17355 match self {
17356 Self::Unspecified => {
17357 std::option::Option::Some("SESSION_OPERATION_TYPE_UNSPECIFIED")
17358 }
17359 Self::Create => std::option::Option::Some("CREATE"),
17360 Self::Terminate => std::option::Option::Some("TERMINATE"),
17361 Self::Delete => std::option::Option::Some("DELETE"),
17362 Self::UnknownValue(u) => u.0.name(),
17363 }
17364 }
17365 }
17366
17367 impl std::default::Default for SessionOperationType {
17368 fn default() -> Self {
17369 use std::convert::From;
17370 Self::from(0)
17371 }
17372 }
17373
17374 impl std::fmt::Display for SessionOperationType {
17375 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17376 wkt::internal::display_enum(f, self.name(), self.value())
17377 }
17378 }
17379
17380 impl std::convert::From<i32> for SessionOperationType {
17381 fn from(value: i32) -> Self {
17382 match value {
17383 0 => Self::Unspecified,
17384 1 => Self::Create,
17385 2 => Self::Terminate,
17386 3 => Self::Delete,
17387 _ => Self::UnknownValue(session_operation_type::UnknownValue(
17388 wkt::internal::UnknownEnumValue::Integer(value),
17389 )),
17390 }
17391 }
17392 }
17393
17394 impl std::convert::From<&str> for SessionOperationType {
17395 fn from(value: &str) -> Self {
17396 use std::string::ToString;
17397 match value {
17398 "SESSION_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17399 "CREATE" => Self::Create,
17400 "TERMINATE" => Self::Terminate,
17401 "DELETE" => Self::Delete,
17402 _ => Self::UnknownValue(session_operation_type::UnknownValue(
17403 wkt::internal::UnknownEnumValue::String(value.to_string()),
17404 )),
17405 }
17406 }
17407 }
17408
17409 impl serde::ser::Serialize for SessionOperationType {
17410 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17411 where
17412 S: serde::Serializer,
17413 {
17414 match self {
17415 Self::Unspecified => serializer.serialize_i32(0),
17416 Self::Create => serializer.serialize_i32(1),
17417 Self::Terminate => serializer.serialize_i32(2),
17418 Self::Delete => serializer.serialize_i32(3),
17419 Self::UnknownValue(u) => u.0.serialize(serializer),
17420 }
17421 }
17422 }
17423
17424 impl<'de> serde::de::Deserialize<'de> for SessionOperationType {
17425 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17426 where
17427 D: serde::Deserializer<'de>,
17428 {
17429 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionOperationType>::new(
17430 ".google.cloud.dataproc.v1.SessionOperationMetadata.SessionOperationType",
17431 ))
17432 }
17433 }
17434}
17435
17436/// The status of the operation.
17437#[derive(Clone, Default, PartialEq)]
17438#[non_exhaustive]
17439pub struct ClusterOperationStatus {
17440 /// Output only. A message containing the operation state.
17441 pub state: crate::model::cluster_operation_status::State,
17442
17443 /// Output only. A message containing the detailed operation state.
17444 pub inner_state: std::string::String,
17445
17446 /// Output only. A message containing any operation metadata details.
17447 pub details: std::string::String,
17448
17449 /// Output only. The time this state was entered.
17450 pub state_start_time: std::option::Option<wkt::Timestamp>,
17451
17452 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17453}
17454
17455impl ClusterOperationStatus {
17456 /// Creates a new default instance.
17457 pub fn new() -> Self {
17458 std::default::Default::default()
17459 }
17460
17461 /// Sets the value of [state][crate::model::ClusterOperationStatus::state].
17462 ///
17463 /// # Example
17464 /// ```ignore,no_run
17465 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17466 /// use google_cloud_dataproc_v1::model::cluster_operation_status::State;
17467 /// let x0 = ClusterOperationStatus::new().set_state(State::Pending);
17468 /// let x1 = ClusterOperationStatus::new().set_state(State::Running);
17469 /// let x2 = ClusterOperationStatus::new().set_state(State::Done);
17470 /// ```
17471 pub fn set_state<T: std::convert::Into<crate::model::cluster_operation_status::State>>(
17472 mut self,
17473 v: T,
17474 ) -> Self {
17475 self.state = v.into();
17476 self
17477 }
17478
17479 /// Sets the value of [inner_state][crate::model::ClusterOperationStatus::inner_state].
17480 ///
17481 /// # Example
17482 /// ```ignore,no_run
17483 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17484 /// let x = ClusterOperationStatus::new().set_inner_state("example");
17485 /// ```
17486 pub fn set_inner_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17487 self.inner_state = v.into();
17488 self
17489 }
17490
17491 /// Sets the value of [details][crate::model::ClusterOperationStatus::details].
17492 ///
17493 /// # Example
17494 /// ```ignore,no_run
17495 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17496 /// let x = ClusterOperationStatus::new().set_details("example");
17497 /// ```
17498 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17499 self.details = v.into();
17500 self
17501 }
17502
17503 /// Sets the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
17504 ///
17505 /// # Example
17506 /// ```ignore,no_run
17507 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17508 /// use wkt::Timestamp;
17509 /// let x = ClusterOperationStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
17510 /// ```
17511 pub fn set_state_start_time<T>(mut self, v: T) -> Self
17512 where
17513 T: std::convert::Into<wkt::Timestamp>,
17514 {
17515 self.state_start_time = std::option::Option::Some(v.into());
17516 self
17517 }
17518
17519 /// Sets or clears the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
17520 ///
17521 /// # Example
17522 /// ```ignore,no_run
17523 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17524 /// use wkt::Timestamp;
17525 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
17526 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
17527 /// ```
17528 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
17529 where
17530 T: std::convert::Into<wkt::Timestamp>,
17531 {
17532 self.state_start_time = v.map(|x| x.into());
17533 self
17534 }
17535}
17536
17537impl wkt::message::Message for ClusterOperationStatus {
17538 fn typename() -> &'static str {
17539 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationStatus"
17540 }
17541}
17542
17543/// Defines additional types related to [ClusterOperationStatus].
17544pub mod cluster_operation_status {
17545 #[allow(unused_imports)]
17546 use super::*;
17547
17548 /// The operation state.
17549 ///
17550 /// # Working with unknown values
17551 ///
17552 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17553 /// additional enum variants at any time. Adding new variants is not considered
17554 /// a breaking change. Applications should write their code in anticipation of:
17555 ///
17556 /// - New values appearing in future releases of the client library, **and**
17557 /// - New values received dynamically, without application changes.
17558 ///
17559 /// Please consult the [Working with enums] section in the user guide for some
17560 /// guidelines.
17561 ///
17562 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17563 #[derive(Clone, Debug, PartialEq)]
17564 #[non_exhaustive]
17565 pub enum State {
17566 /// Unused.
17567 Unknown,
17568 /// The operation has been created.
17569 Pending,
17570 /// The operation is running.
17571 Running,
17572 /// The operation is done; either cancelled or completed.
17573 Done,
17574 /// If set, the enum was initialized with an unknown value.
17575 ///
17576 /// Applications can examine the value using [State::value] or
17577 /// [State::name].
17578 UnknownValue(state::UnknownValue),
17579 }
17580
17581 #[doc(hidden)]
17582 pub mod state {
17583 #[allow(unused_imports)]
17584 use super::*;
17585 #[derive(Clone, Debug, PartialEq)]
17586 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17587 }
17588
17589 impl State {
17590 /// Gets the enum value.
17591 ///
17592 /// Returns `None` if the enum contains an unknown value deserialized from
17593 /// the string representation of enums.
17594 pub fn value(&self) -> std::option::Option<i32> {
17595 match self {
17596 Self::Unknown => std::option::Option::Some(0),
17597 Self::Pending => std::option::Option::Some(1),
17598 Self::Running => std::option::Option::Some(2),
17599 Self::Done => std::option::Option::Some(3),
17600 Self::UnknownValue(u) => u.0.value(),
17601 }
17602 }
17603
17604 /// Gets the enum value as a string.
17605 ///
17606 /// Returns `None` if the enum contains an unknown value deserialized from
17607 /// the integer representation of enums.
17608 pub fn name(&self) -> std::option::Option<&str> {
17609 match self {
17610 Self::Unknown => std::option::Option::Some("UNKNOWN"),
17611 Self::Pending => std::option::Option::Some("PENDING"),
17612 Self::Running => std::option::Option::Some("RUNNING"),
17613 Self::Done => std::option::Option::Some("DONE"),
17614 Self::UnknownValue(u) => u.0.name(),
17615 }
17616 }
17617 }
17618
17619 impl std::default::Default for State {
17620 fn default() -> Self {
17621 use std::convert::From;
17622 Self::from(0)
17623 }
17624 }
17625
17626 impl std::fmt::Display for State {
17627 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17628 wkt::internal::display_enum(f, self.name(), self.value())
17629 }
17630 }
17631
17632 impl std::convert::From<i32> for State {
17633 fn from(value: i32) -> Self {
17634 match value {
17635 0 => Self::Unknown,
17636 1 => Self::Pending,
17637 2 => Self::Running,
17638 3 => Self::Done,
17639 _ => Self::UnknownValue(state::UnknownValue(
17640 wkt::internal::UnknownEnumValue::Integer(value),
17641 )),
17642 }
17643 }
17644 }
17645
17646 impl std::convert::From<&str> for State {
17647 fn from(value: &str) -> Self {
17648 use std::string::ToString;
17649 match value {
17650 "UNKNOWN" => Self::Unknown,
17651 "PENDING" => Self::Pending,
17652 "RUNNING" => Self::Running,
17653 "DONE" => Self::Done,
17654 _ => Self::UnknownValue(state::UnknownValue(
17655 wkt::internal::UnknownEnumValue::String(value.to_string()),
17656 )),
17657 }
17658 }
17659 }
17660
17661 impl serde::ser::Serialize for State {
17662 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17663 where
17664 S: serde::Serializer,
17665 {
17666 match self {
17667 Self::Unknown => serializer.serialize_i32(0),
17668 Self::Pending => serializer.serialize_i32(1),
17669 Self::Running => serializer.serialize_i32(2),
17670 Self::Done => serializer.serialize_i32(3),
17671 Self::UnknownValue(u) => u.0.serialize(serializer),
17672 }
17673 }
17674 }
17675
17676 impl<'de> serde::de::Deserialize<'de> for State {
17677 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17678 where
17679 D: serde::Deserializer<'de>,
17680 {
17681 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17682 ".google.cloud.dataproc.v1.ClusterOperationStatus.State",
17683 ))
17684 }
17685 }
17686}
17687
17688/// Metadata describing the operation.
17689#[derive(Clone, Default, PartialEq)]
17690#[non_exhaustive]
17691pub struct ClusterOperationMetadata {
17692 /// Output only. Name of the cluster for the operation.
17693 pub cluster_name: std::string::String,
17694
17695 /// Output only. Cluster UUID for the operation.
17696 pub cluster_uuid: std::string::String,
17697
17698 /// Output only. Current operation status.
17699 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17700
17701 /// Output only. The previous operation status.
17702 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17703
17704 /// Output only. The operation type.
17705 pub operation_type: std::string::String,
17706
17707 /// Output only. Short description of operation.
17708 pub description: std::string::String,
17709
17710 /// Output only. Labels associated with the operation
17711 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17712
17713 /// Output only. Errors encountered during operation execution.
17714 pub warnings: std::vec::Vec<std::string::String>,
17715
17716 /// Output only. Child operation ids
17717 pub child_operation_ids: std::vec::Vec<std::string::String>,
17718
17719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17720}
17721
17722impl ClusterOperationMetadata {
17723 /// Creates a new default instance.
17724 pub fn new() -> Self {
17725 std::default::Default::default()
17726 }
17727
17728 /// Sets the value of [cluster_name][crate::model::ClusterOperationMetadata::cluster_name].
17729 ///
17730 /// # Example
17731 /// ```ignore,no_run
17732 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17733 /// let x = ClusterOperationMetadata::new().set_cluster_name("example");
17734 /// ```
17735 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17736 self.cluster_name = v.into();
17737 self
17738 }
17739
17740 /// Sets the value of [cluster_uuid][crate::model::ClusterOperationMetadata::cluster_uuid].
17741 ///
17742 /// # Example
17743 /// ```ignore,no_run
17744 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17745 /// let x = ClusterOperationMetadata::new().set_cluster_uuid("example");
17746 /// ```
17747 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17748 self.cluster_uuid = v.into();
17749 self
17750 }
17751
17752 /// Sets the value of [status][crate::model::ClusterOperationMetadata::status].
17753 ///
17754 /// # Example
17755 /// ```ignore,no_run
17756 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17757 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17758 /// let x = ClusterOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17759 /// ```
17760 pub fn set_status<T>(mut self, v: T) -> Self
17761 where
17762 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17763 {
17764 self.status = std::option::Option::Some(v.into());
17765 self
17766 }
17767
17768 /// Sets or clears the value of [status][crate::model::ClusterOperationMetadata::status].
17769 ///
17770 /// # Example
17771 /// ```ignore,no_run
17772 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17773 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17774 /// let x = ClusterOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17775 /// let x = ClusterOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17776 /// ```
17777 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17778 where
17779 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17780 {
17781 self.status = v.map(|x| x.into());
17782 self
17783 }
17784
17785 /// Sets the value of [status_history][crate::model::ClusterOperationMetadata::status_history].
17786 ///
17787 /// # Example
17788 /// ```ignore,no_run
17789 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17790 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17791 /// let x = ClusterOperationMetadata::new()
17792 /// .set_status_history([
17793 /// ClusterOperationStatus::default()/* use setters */,
17794 /// ClusterOperationStatus::default()/* use (different) setters */,
17795 /// ]);
17796 /// ```
17797 pub fn set_status_history<T, V>(mut self, v: T) -> Self
17798 where
17799 T: std::iter::IntoIterator<Item = V>,
17800 V: std::convert::Into<crate::model::ClusterOperationStatus>,
17801 {
17802 use std::iter::Iterator;
17803 self.status_history = v.into_iter().map(|i| i.into()).collect();
17804 self
17805 }
17806
17807 /// Sets the value of [operation_type][crate::model::ClusterOperationMetadata::operation_type].
17808 ///
17809 /// # Example
17810 /// ```ignore,no_run
17811 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17812 /// let x = ClusterOperationMetadata::new().set_operation_type("example");
17813 /// ```
17814 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17815 self.operation_type = v.into();
17816 self
17817 }
17818
17819 /// Sets the value of [description][crate::model::ClusterOperationMetadata::description].
17820 ///
17821 /// # Example
17822 /// ```ignore,no_run
17823 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17824 /// let x = ClusterOperationMetadata::new().set_description("example");
17825 /// ```
17826 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17827 self.description = v.into();
17828 self
17829 }
17830
17831 /// Sets the value of [labels][crate::model::ClusterOperationMetadata::labels].
17832 ///
17833 /// # Example
17834 /// ```ignore,no_run
17835 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17836 /// let x = ClusterOperationMetadata::new().set_labels([
17837 /// ("key0", "abc"),
17838 /// ("key1", "xyz"),
17839 /// ]);
17840 /// ```
17841 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17842 where
17843 T: std::iter::IntoIterator<Item = (K, V)>,
17844 K: std::convert::Into<std::string::String>,
17845 V: std::convert::Into<std::string::String>,
17846 {
17847 use std::iter::Iterator;
17848 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17849 self
17850 }
17851
17852 /// Sets the value of [warnings][crate::model::ClusterOperationMetadata::warnings].
17853 ///
17854 /// # Example
17855 /// ```ignore,no_run
17856 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17857 /// let x = ClusterOperationMetadata::new().set_warnings(["a", "b", "c"]);
17858 /// ```
17859 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17860 where
17861 T: std::iter::IntoIterator<Item = V>,
17862 V: std::convert::Into<std::string::String>,
17863 {
17864 use std::iter::Iterator;
17865 self.warnings = v.into_iter().map(|i| i.into()).collect();
17866 self
17867 }
17868
17869 /// Sets the value of [child_operation_ids][crate::model::ClusterOperationMetadata::child_operation_ids].
17870 ///
17871 /// # Example
17872 /// ```ignore,no_run
17873 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17874 /// let x = ClusterOperationMetadata::new().set_child_operation_ids(["a", "b", "c"]);
17875 /// ```
17876 pub fn set_child_operation_ids<T, V>(mut self, v: T) -> Self
17877 where
17878 T: std::iter::IntoIterator<Item = V>,
17879 V: std::convert::Into<std::string::String>,
17880 {
17881 use std::iter::Iterator;
17882 self.child_operation_ids = v.into_iter().map(|i| i.into()).collect();
17883 self
17884 }
17885}
17886
17887impl wkt::message::Message for ClusterOperationMetadata {
17888 fn typename() -> &'static str {
17889 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationMetadata"
17890 }
17891}
17892
17893/// Metadata describing the node group operation.
17894#[derive(Clone, Default, PartialEq)]
17895#[non_exhaustive]
17896pub struct NodeGroupOperationMetadata {
17897 /// Output only. Node group ID for the operation.
17898 pub node_group_id: std::string::String,
17899
17900 /// Output only. Cluster UUID associated with the node group operation.
17901 pub cluster_uuid: std::string::String,
17902
17903 /// Output only. Current operation status.
17904 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17905
17906 /// Output only. The previous operation status.
17907 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17908
17909 /// The operation type.
17910 pub operation_type: crate::model::node_group_operation_metadata::NodeGroupOperationType,
17911
17912 /// Output only. Short description of operation.
17913 pub description: std::string::String,
17914
17915 /// Output only. Labels associated with the operation.
17916 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17917
17918 /// Output only. Errors encountered during operation execution.
17919 pub warnings: std::vec::Vec<std::string::String>,
17920
17921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17922}
17923
17924impl NodeGroupOperationMetadata {
17925 /// Creates a new default instance.
17926 pub fn new() -> Self {
17927 std::default::Default::default()
17928 }
17929
17930 /// Sets the value of [node_group_id][crate::model::NodeGroupOperationMetadata::node_group_id].
17931 ///
17932 /// # Example
17933 /// ```ignore,no_run
17934 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17935 /// let x = NodeGroupOperationMetadata::new().set_node_group_id("example");
17936 /// ```
17937 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17938 self.node_group_id = v.into();
17939 self
17940 }
17941
17942 /// Sets the value of [cluster_uuid][crate::model::NodeGroupOperationMetadata::cluster_uuid].
17943 ///
17944 /// # Example
17945 /// ```ignore,no_run
17946 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17947 /// let x = NodeGroupOperationMetadata::new().set_cluster_uuid("example");
17948 /// ```
17949 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17950 self.cluster_uuid = v.into();
17951 self
17952 }
17953
17954 /// Sets the value of [status][crate::model::NodeGroupOperationMetadata::status].
17955 ///
17956 /// # Example
17957 /// ```ignore,no_run
17958 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17959 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17960 /// let x = NodeGroupOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17961 /// ```
17962 pub fn set_status<T>(mut self, v: T) -> Self
17963 where
17964 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17965 {
17966 self.status = std::option::Option::Some(v.into());
17967 self
17968 }
17969
17970 /// Sets or clears the value of [status][crate::model::NodeGroupOperationMetadata::status].
17971 ///
17972 /// # Example
17973 /// ```ignore,no_run
17974 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17975 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17976 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17977 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17978 /// ```
17979 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17980 where
17981 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17982 {
17983 self.status = v.map(|x| x.into());
17984 self
17985 }
17986
17987 /// Sets the value of [status_history][crate::model::NodeGroupOperationMetadata::status_history].
17988 ///
17989 /// # Example
17990 /// ```ignore,no_run
17991 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17992 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17993 /// let x = NodeGroupOperationMetadata::new()
17994 /// .set_status_history([
17995 /// ClusterOperationStatus::default()/* use setters */,
17996 /// ClusterOperationStatus::default()/* use (different) setters */,
17997 /// ]);
17998 /// ```
17999 pub fn set_status_history<T, V>(mut self, v: T) -> Self
18000 where
18001 T: std::iter::IntoIterator<Item = V>,
18002 V: std::convert::Into<crate::model::ClusterOperationStatus>,
18003 {
18004 use std::iter::Iterator;
18005 self.status_history = v.into_iter().map(|i| i.into()).collect();
18006 self
18007 }
18008
18009 /// Sets the value of [operation_type][crate::model::NodeGroupOperationMetadata::operation_type].
18010 ///
18011 /// # Example
18012 /// ```ignore,no_run
18013 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18014 /// use google_cloud_dataproc_v1::model::node_group_operation_metadata::NodeGroupOperationType;
18015 /// let x0 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Create);
18016 /// let x1 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Update);
18017 /// let x2 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Delete);
18018 /// ```
18019 pub fn set_operation_type<
18020 T: std::convert::Into<crate::model::node_group_operation_metadata::NodeGroupOperationType>,
18021 >(
18022 mut self,
18023 v: T,
18024 ) -> Self {
18025 self.operation_type = v.into();
18026 self
18027 }
18028
18029 /// Sets the value of [description][crate::model::NodeGroupOperationMetadata::description].
18030 ///
18031 /// # Example
18032 /// ```ignore,no_run
18033 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18034 /// let x = NodeGroupOperationMetadata::new().set_description("example");
18035 /// ```
18036 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18037 self.description = v.into();
18038 self
18039 }
18040
18041 /// Sets the value of [labels][crate::model::NodeGroupOperationMetadata::labels].
18042 ///
18043 /// # Example
18044 /// ```ignore,no_run
18045 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18046 /// let x = NodeGroupOperationMetadata::new().set_labels([
18047 /// ("key0", "abc"),
18048 /// ("key1", "xyz"),
18049 /// ]);
18050 /// ```
18051 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18052 where
18053 T: std::iter::IntoIterator<Item = (K, V)>,
18054 K: std::convert::Into<std::string::String>,
18055 V: std::convert::Into<std::string::String>,
18056 {
18057 use std::iter::Iterator;
18058 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18059 self
18060 }
18061
18062 /// Sets the value of [warnings][crate::model::NodeGroupOperationMetadata::warnings].
18063 ///
18064 /// # Example
18065 /// ```ignore,no_run
18066 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
18067 /// let x = NodeGroupOperationMetadata::new().set_warnings(["a", "b", "c"]);
18068 /// ```
18069 pub fn set_warnings<T, V>(mut self, v: T) -> Self
18070 where
18071 T: std::iter::IntoIterator<Item = V>,
18072 V: std::convert::Into<std::string::String>,
18073 {
18074 use std::iter::Iterator;
18075 self.warnings = v.into_iter().map(|i| i.into()).collect();
18076 self
18077 }
18078}
18079
18080impl wkt::message::Message for NodeGroupOperationMetadata {
18081 fn typename() -> &'static str {
18082 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupOperationMetadata"
18083 }
18084}
18085
18086/// Defines additional types related to [NodeGroupOperationMetadata].
18087pub mod node_group_operation_metadata {
18088 #[allow(unused_imports)]
18089 use super::*;
18090
18091 /// Operation type for node group resources.
18092 ///
18093 /// # Working with unknown values
18094 ///
18095 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18096 /// additional enum variants at any time. Adding new variants is not considered
18097 /// a breaking change. Applications should write their code in anticipation of:
18098 ///
18099 /// - New values appearing in future releases of the client library, **and**
18100 /// - New values received dynamically, without application changes.
18101 ///
18102 /// Please consult the [Working with enums] section in the user guide for some
18103 /// guidelines.
18104 ///
18105 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18106 #[derive(Clone, Debug, PartialEq)]
18107 #[non_exhaustive]
18108 pub enum NodeGroupOperationType {
18109 /// Node group operation type is unknown.
18110 Unspecified,
18111 /// Create node group operation type.
18112 Create,
18113 /// Update node group operation type.
18114 Update,
18115 /// Delete node group operation type.
18116 Delete,
18117 /// Resize node group operation type.
18118 Resize,
18119 /// If set, the enum was initialized with an unknown value.
18120 ///
18121 /// Applications can examine the value using [NodeGroupOperationType::value] or
18122 /// [NodeGroupOperationType::name].
18123 UnknownValue(node_group_operation_type::UnknownValue),
18124 }
18125
18126 #[doc(hidden)]
18127 pub mod node_group_operation_type {
18128 #[allow(unused_imports)]
18129 use super::*;
18130 #[derive(Clone, Debug, PartialEq)]
18131 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18132 }
18133
18134 impl NodeGroupOperationType {
18135 /// Gets the enum value.
18136 ///
18137 /// Returns `None` if the enum contains an unknown value deserialized from
18138 /// the string representation of enums.
18139 pub fn value(&self) -> std::option::Option<i32> {
18140 match self {
18141 Self::Unspecified => std::option::Option::Some(0),
18142 Self::Create => std::option::Option::Some(1),
18143 Self::Update => std::option::Option::Some(2),
18144 Self::Delete => std::option::Option::Some(3),
18145 Self::Resize => std::option::Option::Some(4),
18146 Self::UnknownValue(u) => u.0.value(),
18147 }
18148 }
18149
18150 /// Gets the enum value as a string.
18151 ///
18152 /// Returns `None` if the enum contains an unknown value deserialized from
18153 /// the integer representation of enums.
18154 pub fn name(&self) -> std::option::Option<&str> {
18155 match self {
18156 Self::Unspecified => {
18157 std::option::Option::Some("NODE_GROUP_OPERATION_TYPE_UNSPECIFIED")
18158 }
18159 Self::Create => std::option::Option::Some("CREATE"),
18160 Self::Update => std::option::Option::Some("UPDATE"),
18161 Self::Delete => std::option::Option::Some("DELETE"),
18162 Self::Resize => std::option::Option::Some("RESIZE"),
18163 Self::UnknownValue(u) => u.0.name(),
18164 }
18165 }
18166 }
18167
18168 impl std::default::Default for NodeGroupOperationType {
18169 fn default() -> Self {
18170 use std::convert::From;
18171 Self::from(0)
18172 }
18173 }
18174
18175 impl std::fmt::Display for NodeGroupOperationType {
18176 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18177 wkt::internal::display_enum(f, self.name(), self.value())
18178 }
18179 }
18180
18181 impl std::convert::From<i32> for NodeGroupOperationType {
18182 fn from(value: i32) -> Self {
18183 match value {
18184 0 => Self::Unspecified,
18185 1 => Self::Create,
18186 2 => Self::Update,
18187 3 => Self::Delete,
18188 4 => Self::Resize,
18189 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
18190 wkt::internal::UnknownEnumValue::Integer(value),
18191 )),
18192 }
18193 }
18194 }
18195
18196 impl std::convert::From<&str> for NodeGroupOperationType {
18197 fn from(value: &str) -> Self {
18198 use std::string::ToString;
18199 match value {
18200 "NODE_GROUP_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
18201 "CREATE" => Self::Create,
18202 "UPDATE" => Self::Update,
18203 "DELETE" => Self::Delete,
18204 "RESIZE" => Self::Resize,
18205 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
18206 wkt::internal::UnknownEnumValue::String(value.to_string()),
18207 )),
18208 }
18209 }
18210 }
18211
18212 impl serde::ser::Serialize for NodeGroupOperationType {
18213 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18214 where
18215 S: serde::Serializer,
18216 {
18217 match self {
18218 Self::Unspecified => serializer.serialize_i32(0),
18219 Self::Create => serializer.serialize_i32(1),
18220 Self::Update => serializer.serialize_i32(2),
18221 Self::Delete => serializer.serialize_i32(3),
18222 Self::Resize => serializer.serialize_i32(4),
18223 Self::UnknownValue(u) => u.0.serialize(serializer),
18224 }
18225 }
18226 }
18227
18228 impl<'de> serde::de::Deserialize<'de> for NodeGroupOperationType {
18229 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18230 where
18231 D: serde::Deserializer<'de>,
18232 {
18233 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeGroupOperationType>::new(
18234 ".google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType",
18235 ))
18236 }
18237 }
18238}
18239
18240/// A request to create a session template.
18241#[derive(Clone, Default, PartialEq)]
18242#[non_exhaustive]
18243pub struct CreateSessionTemplateRequest {
18244 /// Required. The parent resource where this session template will be created.
18245 pub parent: std::string::String,
18246
18247 /// Required. The session template to create.
18248 pub session_template: std::option::Option<crate::model::SessionTemplate>,
18249
18250 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18251}
18252
18253impl CreateSessionTemplateRequest {
18254 /// Creates a new default instance.
18255 pub fn new() -> Self {
18256 std::default::Default::default()
18257 }
18258
18259 /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
18260 ///
18261 /// # Example
18262 /// ```ignore,no_run
18263 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18264 /// # let project_id = "project_id";
18265 /// # let location_id = "location_id";
18266 /// let x = CreateSessionTemplateRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
18267 /// ```
18268 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18269 self.parent = v.into();
18270 self
18271 }
18272
18273 /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
18274 ///
18275 /// # Example
18276 /// ```ignore,no_run
18277 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18278 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18279 /// let x = CreateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
18280 /// ```
18281 pub fn set_session_template<T>(mut self, v: T) -> Self
18282 where
18283 T: std::convert::Into<crate::model::SessionTemplate>,
18284 {
18285 self.session_template = std::option::Option::Some(v.into());
18286 self
18287 }
18288
18289 /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
18290 ///
18291 /// # Example
18292 /// ```ignore,no_run
18293 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
18294 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18295 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
18296 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
18297 /// ```
18298 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
18299 where
18300 T: std::convert::Into<crate::model::SessionTemplate>,
18301 {
18302 self.session_template = v.map(|x| x.into());
18303 self
18304 }
18305}
18306
18307impl wkt::message::Message for CreateSessionTemplateRequest {
18308 fn typename() -> &'static str {
18309 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionTemplateRequest"
18310 }
18311}
18312
18313/// A request to update a session template.
18314#[derive(Clone, Default, PartialEq)]
18315#[non_exhaustive]
18316pub struct UpdateSessionTemplateRequest {
18317 /// Required. The updated session template.
18318 pub session_template: std::option::Option<crate::model::SessionTemplate>,
18319
18320 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18321}
18322
18323impl UpdateSessionTemplateRequest {
18324 /// Creates a new default instance.
18325 pub fn new() -> Self {
18326 std::default::Default::default()
18327 }
18328
18329 /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
18330 ///
18331 /// # Example
18332 /// ```ignore,no_run
18333 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
18334 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18335 /// let x = UpdateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
18336 /// ```
18337 pub fn set_session_template<T>(mut self, v: T) -> Self
18338 where
18339 T: std::convert::Into<crate::model::SessionTemplate>,
18340 {
18341 self.session_template = std::option::Option::Some(v.into());
18342 self
18343 }
18344
18345 /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
18346 ///
18347 /// # Example
18348 /// ```ignore,no_run
18349 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
18350 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18351 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
18352 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
18353 /// ```
18354 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
18355 where
18356 T: std::convert::Into<crate::model::SessionTemplate>,
18357 {
18358 self.session_template = v.map(|x| x.into());
18359 self
18360 }
18361}
18362
18363impl wkt::message::Message for UpdateSessionTemplateRequest {
18364 fn typename() -> &'static str {
18365 "type.googleapis.com/google.cloud.dataproc.v1.UpdateSessionTemplateRequest"
18366 }
18367}
18368
18369/// A request to get the resource representation for a session template.
18370#[derive(Clone, Default, PartialEq)]
18371#[non_exhaustive]
18372pub struct GetSessionTemplateRequest {
18373 /// Required. The name of the session template to retrieve.
18374 pub name: std::string::String,
18375
18376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18377}
18378
18379impl GetSessionTemplateRequest {
18380 /// Creates a new default instance.
18381 pub fn new() -> Self {
18382 std::default::Default::default()
18383 }
18384
18385 /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
18386 ///
18387 /// # Example
18388 /// ```ignore,no_run
18389 /// # use google_cloud_dataproc_v1::model::GetSessionTemplateRequest;
18390 /// # let project_id = "project_id";
18391 /// # let location_id = "location_id";
18392 /// # let template_id = "template_id";
18393 /// let x = GetSessionTemplateRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
18394 /// ```
18395 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18396 self.name = v.into();
18397 self
18398 }
18399}
18400
18401impl wkt::message::Message for GetSessionTemplateRequest {
18402 fn typename() -> &'static str {
18403 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionTemplateRequest"
18404 }
18405}
18406
18407/// A request to list session templates in a project.
18408#[derive(Clone, Default, PartialEq)]
18409#[non_exhaustive]
18410pub struct ListSessionTemplatesRequest {
18411 /// Required. The parent that owns this collection of session templates.
18412 pub parent: std::string::String,
18413
18414 /// Optional. The maximum number of sessions to return in each response.
18415 /// The service may return fewer than this value.
18416 pub page_size: i32,
18417
18418 /// Optional. A page token received from a previous `ListSessions` call.
18419 /// Provide this token to retrieve the subsequent page.
18420 pub page_token: std::string::String,
18421
18422 /// Optional. A filter for the session templates to return in the response.
18423 /// Filters are case sensitive and have the following syntax:
18424 ///
18425 /// [field = value] AND [field [= value]] ...
18426 pub filter: std::string::String,
18427
18428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18429}
18430
18431impl ListSessionTemplatesRequest {
18432 /// Creates a new default instance.
18433 pub fn new() -> Self {
18434 std::default::Default::default()
18435 }
18436
18437 /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
18438 ///
18439 /// # Example
18440 /// ```ignore,no_run
18441 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18442 /// # let project_id = "project_id";
18443 /// # let location_id = "location_id";
18444 /// let x = ListSessionTemplatesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
18445 /// ```
18446 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18447 self.parent = v.into();
18448 self
18449 }
18450
18451 /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
18452 ///
18453 /// # Example
18454 /// ```ignore,no_run
18455 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18456 /// let x = ListSessionTemplatesRequest::new().set_page_size(42);
18457 /// ```
18458 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18459 self.page_size = v.into();
18460 self
18461 }
18462
18463 /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
18464 ///
18465 /// # Example
18466 /// ```ignore,no_run
18467 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18468 /// let x = ListSessionTemplatesRequest::new().set_page_token("example");
18469 /// ```
18470 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18471 self.page_token = v.into();
18472 self
18473 }
18474
18475 /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
18476 ///
18477 /// # Example
18478 /// ```ignore,no_run
18479 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
18480 /// let x = ListSessionTemplatesRequest::new().set_filter("example");
18481 /// ```
18482 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18483 self.filter = v.into();
18484 self
18485 }
18486}
18487
18488impl wkt::message::Message for ListSessionTemplatesRequest {
18489 fn typename() -> &'static str {
18490 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesRequest"
18491 }
18492}
18493
18494/// A list of session templates.
18495#[derive(Clone, Default, PartialEq)]
18496#[non_exhaustive]
18497pub struct ListSessionTemplatesResponse {
18498 /// Output only. Session template list
18499 pub session_templates: std::vec::Vec<crate::model::SessionTemplate>,
18500
18501 /// A token, which can be sent as `page_token` to retrieve the next page.
18502 /// If this field is omitted, there are no subsequent pages.
18503 pub next_page_token: std::string::String,
18504
18505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18506}
18507
18508impl ListSessionTemplatesResponse {
18509 /// Creates a new default instance.
18510 pub fn new() -> Self {
18511 std::default::Default::default()
18512 }
18513
18514 /// Sets the value of [session_templates][crate::model::ListSessionTemplatesResponse::session_templates].
18515 ///
18516 /// # Example
18517 /// ```ignore,no_run
18518 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
18519 /// use google_cloud_dataproc_v1::model::SessionTemplate;
18520 /// let x = ListSessionTemplatesResponse::new()
18521 /// .set_session_templates([
18522 /// SessionTemplate::default()/* use setters */,
18523 /// SessionTemplate::default()/* use (different) setters */,
18524 /// ]);
18525 /// ```
18526 pub fn set_session_templates<T, V>(mut self, v: T) -> Self
18527 where
18528 T: std::iter::IntoIterator<Item = V>,
18529 V: std::convert::Into<crate::model::SessionTemplate>,
18530 {
18531 use std::iter::Iterator;
18532 self.session_templates = v.into_iter().map(|i| i.into()).collect();
18533 self
18534 }
18535
18536 /// Sets the value of [next_page_token][crate::model::ListSessionTemplatesResponse::next_page_token].
18537 ///
18538 /// # Example
18539 /// ```ignore,no_run
18540 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
18541 /// let x = ListSessionTemplatesResponse::new().set_next_page_token("example");
18542 /// ```
18543 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18544 self.next_page_token = v.into();
18545 self
18546 }
18547}
18548
18549impl wkt::message::Message for ListSessionTemplatesResponse {
18550 fn typename() -> &'static str {
18551 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesResponse"
18552 }
18553}
18554
18555#[doc(hidden)]
18556impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionTemplatesResponse {
18557 type PageItem = crate::model::SessionTemplate;
18558
18559 fn items(self) -> std::vec::Vec<Self::PageItem> {
18560 self.session_templates
18561 }
18562
18563 fn next_page_token(&self) -> std::string::String {
18564 use std::clone::Clone;
18565 self.next_page_token.clone()
18566 }
18567}
18568
18569/// A request to delete a session template.
18570#[derive(Clone, Default, PartialEq)]
18571#[non_exhaustive]
18572pub struct DeleteSessionTemplateRequest {
18573 /// Required. The name of the session template resource to delete.
18574 pub name: std::string::String,
18575
18576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18577}
18578
18579impl DeleteSessionTemplateRequest {
18580 /// Creates a new default instance.
18581 pub fn new() -> Self {
18582 std::default::Default::default()
18583 }
18584
18585 /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
18586 ///
18587 /// # Example
18588 /// ```ignore,no_run
18589 /// # use google_cloud_dataproc_v1::model::DeleteSessionTemplateRequest;
18590 /// # let project_id = "project_id";
18591 /// # let location_id = "location_id";
18592 /// # let template_id = "template_id";
18593 /// let x = DeleteSessionTemplateRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
18594 /// ```
18595 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18596 self.name = v.into();
18597 self
18598 }
18599}
18600
18601impl wkt::message::Message for DeleteSessionTemplateRequest {
18602 fn typename() -> &'static str {
18603 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionTemplateRequest"
18604 }
18605}
18606
18607/// A representation of a session template.
18608#[derive(Clone, Default, PartialEq)]
18609#[non_exhaustive]
18610pub struct SessionTemplate {
18611 /// Required. Identifier. The resource name of the session template.
18612 pub name: std::string::String,
18613
18614 /// Optional. Brief description of the template.
18615 pub description: std::string::String,
18616
18617 /// Output only. The time when the template was created.
18618 pub create_time: std::option::Option<wkt::Timestamp>,
18619
18620 /// Output only. The email address of the user who created the template.
18621 pub creator: std::string::String,
18622
18623 /// Optional. Labels to associate with sessions created using this template.
18624 /// Label **keys** must contain 1 to 63 characters, and must conform to
18625 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
18626 /// Label **values** can be empty, but, if present, must contain 1 to 63
18627 /// characters and conform to [RFC
18628 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
18629 /// associated with a session.
18630 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18631
18632 /// Optional. Runtime configuration for session execution.
18633 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
18634
18635 /// Optional. Environment configuration for session execution.
18636 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
18637
18638 /// Output only. The time the template was last updated.
18639 pub update_time: std::option::Option<wkt::Timestamp>,
18640
18641 /// Output only. A session template UUID (Unique Universal Identifier). The
18642 /// service generates this value when it creates the session template.
18643 pub uuid: std::string::String,
18644
18645 /// The session configuration.
18646 pub session_config: std::option::Option<crate::model::session_template::SessionConfig>,
18647
18648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18649}
18650
18651impl SessionTemplate {
18652 /// Creates a new default instance.
18653 pub fn new() -> Self {
18654 std::default::Default::default()
18655 }
18656
18657 /// Sets the value of [name][crate::model::SessionTemplate::name].
18658 ///
18659 /// # Example
18660 /// ```ignore,no_run
18661 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18662 /// # let project_id = "project_id";
18663 /// # let location_id = "location_id";
18664 /// # let template_id = "template_id";
18665 /// let x = SessionTemplate::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
18666 /// ```
18667 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18668 self.name = v.into();
18669 self
18670 }
18671
18672 /// Sets the value of [description][crate::model::SessionTemplate::description].
18673 ///
18674 /// # Example
18675 /// ```ignore,no_run
18676 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18677 /// let x = SessionTemplate::new().set_description("example");
18678 /// ```
18679 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18680 self.description = v.into();
18681 self
18682 }
18683
18684 /// Sets the value of [create_time][crate::model::SessionTemplate::create_time].
18685 ///
18686 /// # Example
18687 /// ```ignore,no_run
18688 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18689 /// use wkt::Timestamp;
18690 /// let x = SessionTemplate::new().set_create_time(Timestamp::default()/* use setters */);
18691 /// ```
18692 pub fn set_create_time<T>(mut self, v: T) -> Self
18693 where
18694 T: std::convert::Into<wkt::Timestamp>,
18695 {
18696 self.create_time = std::option::Option::Some(v.into());
18697 self
18698 }
18699
18700 /// Sets or clears the value of [create_time][crate::model::SessionTemplate::create_time].
18701 ///
18702 /// # Example
18703 /// ```ignore,no_run
18704 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18705 /// use wkt::Timestamp;
18706 /// let x = SessionTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18707 /// let x = SessionTemplate::new().set_or_clear_create_time(None::<Timestamp>);
18708 /// ```
18709 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18710 where
18711 T: std::convert::Into<wkt::Timestamp>,
18712 {
18713 self.create_time = v.map(|x| x.into());
18714 self
18715 }
18716
18717 /// Sets the value of [creator][crate::model::SessionTemplate::creator].
18718 ///
18719 /// # Example
18720 /// ```ignore,no_run
18721 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18722 /// let x = SessionTemplate::new().set_creator("example");
18723 /// ```
18724 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18725 self.creator = v.into();
18726 self
18727 }
18728
18729 /// Sets the value of [labels][crate::model::SessionTemplate::labels].
18730 ///
18731 /// # Example
18732 /// ```ignore,no_run
18733 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18734 /// let x = SessionTemplate::new().set_labels([
18735 /// ("key0", "abc"),
18736 /// ("key1", "xyz"),
18737 /// ]);
18738 /// ```
18739 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18740 where
18741 T: std::iter::IntoIterator<Item = (K, V)>,
18742 K: std::convert::Into<std::string::String>,
18743 V: std::convert::Into<std::string::String>,
18744 {
18745 use std::iter::Iterator;
18746 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18747 self
18748 }
18749
18750 /// Sets the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18751 ///
18752 /// # Example
18753 /// ```ignore,no_run
18754 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18755 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18756 /// let x = SessionTemplate::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18757 /// ```
18758 pub fn set_runtime_config<T>(mut self, v: T) -> Self
18759 where
18760 T: std::convert::Into<crate::model::RuntimeConfig>,
18761 {
18762 self.runtime_config = std::option::Option::Some(v.into());
18763 self
18764 }
18765
18766 /// Sets or clears the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18767 ///
18768 /// # Example
18769 /// ```ignore,no_run
18770 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18771 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18772 /// let x = SessionTemplate::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
18773 /// let x = SessionTemplate::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
18774 /// ```
18775 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
18776 where
18777 T: std::convert::Into<crate::model::RuntimeConfig>,
18778 {
18779 self.runtime_config = v.map(|x| x.into());
18780 self
18781 }
18782
18783 /// Sets the value of [environment_config][crate::model::SessionTemplate::environment_config].
18784 ///
18785 /// # Example
18786 /// ```ignore,no_run
18787 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18788 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18789 /// let x = SessionTemplate::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
18790 /// ```
18791 pub fn set_environment_config<T>(mut self, v: T) -> Self
18792 where
18793 T: std::convert::Into<crate::model::EnvironmentConfig>,
18794 {
18795 self.environment_config = std::option::Option::Some(v.into());
18796 self
18797 }
18798
18799 /// Sets or clears the value of [environment_config][crate::model::SessionTemplate::environment_config].
18800 ///
18801 /// # Example
18802 /// ```ignore,no_run
18803 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18804 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18805 /// let x = SessionTemplate::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
18806 /// let x = SessionTemplate::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
18807 /// ```
18808 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
18809 where
18810 T: std::convert::Into<crate::model::EnvironmentConfig>,
18811 {
18812 self.environment_config = v.map(|x| x.into());
18813 self
18814 }
18815
18816 /// Sets the value of [update_time][crate::model::SessionTemplate::update_time].
18817 ///
18818 /// # Example
18819 /// ```ignore,no_run
18820 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18821 /// use wkt::Timestamp;
18822 /// let x = SessionTemplate::new().set_update_time(Timestamp::default()/* use setters */);
18823 /// ```
18824 pub fn set_update_time<T>(mut self, v: T) -> Self
18825 where
18826 T: std::convert::Into<wkt::Timestamp>,
18827 {
18828 self.update_time = std::option::Option::Some(v.into());
18829 self
18830 }
18831
18832 /// Sets or clears the value of [update_time][crate::model::SessionTemplate::update_time].
18833 ///
18834 /// # Example
18835 /// ```ignore,no_run
18836 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18837 /// use wkt::Timestamp;
18838 /// let x = SessionTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
18839 /// let x = SessionTemplate::new().set_or_clear_update_time(None::<Timestamp>);
18840 /// ```
18841 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
18842 where
18843 T: std::convert::Into<wkt::Timestamp>,
18844 {
18845 self.update_time = v.map(|x| x.into());
18846 self
18847 }
18848
18849 /// Sets the value of [uuid][crate::model::SessionTemplate::uuid].
18850 ///
18851 /// # Example
18852 /// ```ignore,no_run
18853 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18854 /// let x = SessionTemplate::new().set_uuid("example");
18855 /// ```
18856 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18857 self.uuid = v.into();
18858 self
18859 }
18860
18861 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config].
18862 ///
18863 /// Note that all the setters affecting `session_config` are mutually
18864 /// exclusive.
18865 ///
18866 /// # Example
18867 /// ```ignore,no_run
18868 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18869 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18870 /// let x = SessionTemplate::new().set_session_config(Some(
18871 /// google_cloud_dataproc_v1::model::session_template::SessionConfig::JupyterSession(JupyterConfig::default().into())));
18872 /// ```
18873 pub fn set_session_config<
18874 T: std::convert::Into<std::option::Option<crate::model::session_template::SessionConfig>>,
18875 >(
18876 mut self,
18877 v: T,
18878 ) -> Self {
18879 self.session_config = v.into();
18880 self
18881 }
18882
18883 /// The value of [session_config][crate::model::SessionTemplate::session_config]
18884 /// if it holds a `JupyterSession`, `None` if the field is not set or
18885 /// holds a different branch.
18886 pub fn jupyter_session(
18887 &self,
18888 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
18889 #[allow(unreachable_patterns)]
18890 self.session_config.as_ref().and_then(|v| match v {
18891 crate::model::session_template::SessionConfig::JupyterSession(v) => {
18892 std::option::Option::Some(v)
18893 }
18894 _ => std::option::Option::None,
18895 })
18896 }
18897
18898 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18899 /// to hold a `JupyterSession`.
18900 ///
18901 /// Note that all the setters affecting `session_config` are
18902 /// mutually exclusive.
18903 ///
18904 /// # Example
18905 /// ```ignore,no_run
18906 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18907 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18908 /// let x = SessionTemplate::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
18909 /// assert!(x.jupyter_session().is_some());
18910 /// assert!(x.spark_connect_session().is_none());
18911 /// ```
18912 pub fn set_jupyter_session<
18913 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
18914 >(
18915 mut self,
18916 v: T,
18917 ) -> Self {
18918 self.session_config = std::option::Option::Some(
18919 crate::model::session_template::SessionConfig::JupyterSession(v.into()),
18920 );
18921 self
18922 }
18923
18924 /// The value of [session_config][crate::model::SessionTemplate::session_config]
18925 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
18926 /// holds a different branch.
18927 pub fn spark_connect_session(
18928 &self,
18929 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
18930 #[allow(unreachable_patterns)]
18931 self.session_config.as_ref().and_then(|v| match v {
18932 crate::model::session_template::SessionConfig::SparkConnectSession(v) => {
18933 std::option::Option::Some(v)
18934 }
18935 _ => std::option::Option::None,
18936 })
18937 }
18938
18939 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18940 /// to hold a `SparkConnectSession`.
18941 ///
18942 /// Note that all the setters affecting `session_config` are
18943 /// mutually exclusive.
18944 ///
18945 /// # Example
18946 /// ```ignore,no_run
18947 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18948 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
18949 /// let x = SessionTemplate::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
18950 /// assert!(x.spark_connect_session().is_some());
18951 /// assert!(x.jupyter_session().is_none());
18952 /// ```
18953 pub fn set_spark_connect_session<
18954 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
18955 >(
18956 mut self,
18957 v: T,
18958 ) -> Self {
18959 self.session_config = std::option::Option::Some(
18960 crate::model::session_template::SessionConfig::SparkConnectSession(v.into()),
18961 );
18962 self
18963 }
18964}
18965
18966impl wkt::message::Message for SessionTemplate {
18967 fn typename() -> &'static str {
18968 "type.googleapis.com/google.cloud.dataproc.v1.SessionTemplate"
18969 }
18970}
18971
18972/// Defines additional types related to [SessionTemplate].
18973pub mod session_template {
18974 #[allow(unused_imports)]
18975 use super::*;
18976
18977 /// The session configuration.
18978 #[derive(Clone, Debug, PartialEq)]
18979 #[non_exhaustive]
18980 pub enum SessionConfig {
18981 /// Optional. Jupyter session config.
18982 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
18983 /// Optional. Spark connect session config.
18984 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
18985 }
18986}
18987
18988/// A request to create a session.
18989#[derive(Clone, Default, PartialEq)]
18990#[non_exhaustive]
18991pub struct CreateSessionRequest {
18992 /// Required. The parent resource where this session will be created.
18993 pub parent: std::string::String,
18994
18995 /// Required. The interactive session to create.
18996 pub session: std::option::Option<crate::model::Session>,
18997
18998 /// Required. The ID to use for the session, which becomes the final component
18999 /// of the session's resource name.
19000 ///
19001 /// This value must be 4-63 characters. Valid characters
19002 /// are /[a-z][0-9]-/.
19003 pub session_id: std::string::String,
19004
19005 /// Optional. A unique ID used to identify the request. If the service
19006 /// receives two
19007 /// [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
19008 /// with the same ID, the second request is ignored, and the
19009 /// first [Session][google.cloud.dataproc.v1.Session] is created and stored in
19010 /// the backend.
19011 ///
19012 /// Recommendation: Set this value to a
19013 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19014 ///
19015 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19016 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19017 ///
19018 /// [google.cloud.dataproc.v1.Session]: crate::model::Session
19019 pub request_id: std::string::String,
19020
19021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19022}
19023
19024impl CreateSessionRequest {
19025 /// Creates a new default instance.
19026 pub fn new() -> Self {
19027 std::default::Default::default()
19028 }
19029
19030 /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
19031 ///
19032 /// # Example
19033 /// ```ignore,no_run
19034 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19035 /// # let project_id = "project_id";
19036 /// # let location_id = "location_id";
19037 /// let x = CreateSessionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
19038 /// ```
19039 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19040 self.parent = v.into();
19041 self
19042 }
19043
19044 /// Sets the value of [session][crate::model::CreateSessionRequest::session].
19045 ///
19046 /// # Example
19047 /// ```ignore,no_run
19048 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19049 /// use google_cloud_dataproc_v1::model::Session;
19050 /// let x = CreateSessionRequest::new().set_session(Session::default()/* use setters */);
19051 /// ```
19052 pub fn set_session<T>(mut self, v: T) -> Self
19053 where
19054 T: std::convert::Into<crate::model::Session>,
19055 {
19056 self.session = std::option::Option::Some(v.into());
19057 self
19058 }
19059
19060 /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
19061 ///
19062 /// # Example
19063 /// ```ignore,no_run
19064 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19065 /// use google_cloud_dataproc_v1::model::Session;
19066 /// let x = CreateSessionRequest::new().set_or_clear_session(Some(Session::default()/* use setters */));
19067 /// let x = CreateSessionRequest::new().set_or_clear_session(None::<Session>);
19068 /// ```
19069 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
19070 where
19071 T: std::convert::Into<crate::model::Session>,
19072 {
19073 self.session = v.map(|x| x.into());
19074 self
19075 }
19076
19077 /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
19078 ///
19079 /// # Example
19080 /// ```ignore,no_run
19081 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19082 /// let x = CreateSessionRequest::new().set_session_id("example");
19083 /// ```
19084 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19085 self.session_id = v.into();
19086 self
19087 }
19088
19089 /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
19090 ///
19091 /// # Example
19092 /// ```ignore,no_run
19093 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
19094 /// let x = CreateSessionRequest::new().set_request_id("example");
19095 /// ```
19096 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19097 self.request_id = v.into();
19098 self
19099 }
19100}
19101
19102impl wkt::message::Message for CreateSessionRequest {
19103 fn typename() -> &'static str {
19104 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionRequest"
19105 }
19106}
19107
19108/// A request to get the resource representation for a session.
19109#[derive(Clone, Default, PartialEq)]
19110#[non_exhaustive]
19111pub struct GetSessionRequest {
19112 /// Required. The name of the session to retrieve.
19113 pub name: std::string::String,
19114
19115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19116}
19117
19118impl GetSessionRequest {
19119 /// Creates a new default instance.
19120 pub fn new() -> Self {
19121 std::default::Default::default()
19122 }
19123
19124 /// Sets the value of [name][crate::model::GetSessionRequest::name].
19125 ///
19126 /// # Example
19127 /// ```ignore,no_run
19128 /// # use google_cloud_dataproc_v1::model::GetSessionRequest;
19129 /// # let project_id = "project_id";
19130 /// # let location_id = "location_id";
19131 /// # let session_id = "session_id";
19132 /// let x = GetSessionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
19133 /// ```
19134 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19135 self.name = v.into();
19136 self
19137 }
19138}
19139
19140impl wkt::message::Message for GetSessionRequest {
19141 fn typename() -> &'static str {
19142 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionRequest"
19143 }
19144}
19145
19146/// A request to list sessions in a project.
19147#[derive(Clone, Default, PartialEq)]
19148#[non_exhaustive]
19149pub struct ListSessionsRequest {
19150 /// Required. The parent, which owns this collection of sessions.
19151 pub parent: std::string::String,
19152
19153 /// Optional. The maximum number of sessions to return in each response.
19154 /// The service may return fewer than this value.
19155 pub page_size: i32,
19156
19157 /// Optional. A page token received from a previous `ListSessions` call.
19158 /// Provide this token to retrieve the subsequent page.
19159 pub page_token: std::string::String,
19160
19161 /// Optional. A filter for the sessions to return in the response.
19162 ///
19163 /// A filter is a logical expression constraining the values of various fields
19164 /// in each session resource. Filters are case sensitive, and may contain
19165 /// multiple clauses combined with logical operators (AND, OR).
19166 /// Supported fields are `session_id`, `session_uuid`, `state`, `create_time`,
19167 /// and `labels`.
19168 ///
19169 /// Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
19170 /// is a filter for sessions in an ACTIVE state that were created before
19171 /// 2023-01-01. `state = ACTIVE and labels.environment=production` is a filter
19172 /// for sessions in an ACTIVE state that have a production environment label.
19173 ///
19174 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
19175 /// description of the filter syntax and a list of supported comparators.
19176 pub filter: std::string::String,
19177
19178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19179}
19180
19181impl ListSessionsRequest {
19182 /// Creates a new default instance.
19183 pub fn new() -> Self {
19184 std::default::Default::default()
19185 }
19186
19187 /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
19188 ///
19189 /// # Example
19190 /// ```ignore,no_run
19191 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19192 /// # let project_id = "project_id";
19193 /// # let location_id = "location_id";
19194 /// let x = ListSessionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
19195 /// ```
19196 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19197 self.parent = v.into();
19198 self
19199 }
19200
19201 /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
19202 ///
19203 /// # Example
19204 /// ```ignore,no_run
19205 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19206 /// let x = ListSessionsRequest::new().set_page_size(42);
19207 /// ```
19208 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19209 self.page_size = v.into();
19210 self
19211 }
19212
19213 /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
19214 ///
19215 /// # Example
19216 /// ```ignore,no_run
19217 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19218 /// let x = ListSessionsRequest::new().set_page_token("example");
19219 /// ```
19220 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19221 self.page_token = v.into();
19222 self
19223 }
19224
19225 /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
19226 ///
19227 /// # Example
19228 /// ```ignore,no_run
19229 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
19230 /// let x = ListSessionsRequest::new().set_filter("example");
19231 /// ```
19232 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19233 self.filter = v.into();
19234 self
19235 }
19236}
19237
19238impl wkt::message::Message for ListSessionsRequest {
19239 fn typename() -> &'static str {
19240 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsRequest"
19241 }
19242}
19243
19244/// A list of interactive sessions.
19245#[derive(Clone, Default, PartialEq)]
19246#[non_exhaustive]
19247pub struct ListSessionsResponse {
19248 /// Output only. The sessions from the specified collection.
19249 pub sessions: std::vec::Vec<crate::model::Session>,
19250
19251 /// A token, which can be sent as `page_token`, to retrieve the next page.
19252 /// If this field is omitted, there are no subsequent pages.
19253 pub next_page_token: std::string::String,
19254
19255 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19256}
19257
19258impl ListSessionsResponse {
19259 /// Creates a new default instance.
19260 pub fn new() -> Self {
19261 std::default::Default::default()
19262 }
19263
19264 /// Sets the value of [sessions][crate::model::ListSessionsResponse::sessions].
19265 ///
19266 /// # Example
19267 /// ```ignore,no_run
19268 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
19269 /// use google_cloud_dataproc_v1::model::Session;
19270 /// let x = ListSessionsResponse::new()
19271 /// .set_sessions([
19272 /// Session::default()/* use setters */,
19273 /// Session::default()/* use (different) setters */,
19274 /// ]);
19275 /// ```
19276 pub fn set_sessions<T, V>(mut self, v: T) -> Self
19277 where
19278 T: std::iter::IntoIterator<Item = V>,
19279 V: std::convert::Into<crate::model::Session>,
19280 {
19281 use std::iter::Iterator;
19282 self.sessions = v.into_iter().map(|i| i.into()).collect();
19283 self
19284 }
19285
19286 /// Sets the value of [next_page_token][crate::model::ListSessionsResponse::next_page_token].
19287 ///
19288 /// # Example
19289 /// ```ignore,no_run
19290 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
19291 /// let x = ListSessionsResponse::new().set_next_page_token("example");
19292 /// ```
19293 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19294 self.next_page_token = v.into();
19295 self
19296 }
19297}
19298
19299impl wkt::message::Message for ListSessionsResponse {
19300 fn typename() -> &'static str {
19301 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsResponse"
19302 }
19303}
19304
19305#[doc(hidden)]
19306impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionsResponse {
19307 type PageItem = crate::model::Session;
19308
19309 fn items(self) -> std::vec::Vec<Self::PageItem> {
19310 self.sessions
19311 }
19312
19313 fn next_page_token(&self) -> std::string::String {
19314 use std::clone::Clone;
19315 self.next_page_token.clone()
19316 }
19317}
19318
19319/// A request to terminate an interactive session.
19320#[derive(Clone, Default, PartialEq)]
19321#[non_exhaustive]
19322pub struct TerminateSessionRequest {
19323 /// Required. The name of the session resource to terminate.
19324 pub name: std::string::String,
19325
19326 /// Optional. A unique ID used to identify the request. If the service
19327 /// receives two
19328 /// [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
19329 /// with the same ID, the second request is ignored.
19330 ///
19331 /// Recommendation: Set this value to a
19332 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19333 ///
19334 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19335 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19336 pub request_id: std::string::String,
19337
19338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19339}
19340
19341impl TerminateSessionRequest {
19342 /// Creates a new default instance.
19343 pub fn new() -> Self {
19344 std::default::Default::default()
19345 }
19346
19347 /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
19348 ///
19349 /// # Example
19350 /// ```ignore,no_run
19351 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
19352 /// # let project_id = "project_id";
19353 /// # let location_id = "location_id";
19354 /// # let session_id = "session_id";
19355 /// let x = TerminateSessionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
19356 /// ```
19357 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19358 self.name = v.into();
19359 self
19360 }
19361
19362 /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
19363 ///
19364 /// # Example
19365 /// ```ignore,no_run
19366 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
19367 /// let x = TerminateSessionRequest::new().set_request_id("example");
19368 /// ```
19369 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19370 self.request_id = v.into();
19371 self
19372 }
19373}
19374
19375impl wkt::message::Message for TerminateSessionRequest {
19376 fn typename() -> &'static str {
19377 "type.googleapis.com/google.cloud.dataproc.v1.TerminateSessionRequest"
19378 }
19379}
19380
19381/// A request to delete a session.
19382#[derive(Clone, Default, PartialEq)]
19383#[non_exhaustive]
19384pub struct DeleteSessionRequest {
19385 /// Required. The name of the session resource to delete.
19386 pub name: std::string::String,
19387
19388 /// Optional. A unique ID used to identify the request. If the service
19389 /// receives two
19390 /// [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
19391 /// with the same ID, the second request is ignored.
19392 ///
19393 /// Recommendation: Set this value to a
19394 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
19395 ///
19396 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
19397 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
19398 pub request_id: std::string::String,
19399
19400 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19401}
19402
19403impl DeleteSessionRequest {
19404 /// Creates a new default instance.
19405 pub fn new() -> Self {
19406 std::default::Default::default()
19407 }
19408
19409 /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
19410 ///
19411 /// # Example
19412 /// ```ignore,no_run
19413 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
19414 /// # let project_id = "project_id";
19415 /// # let location_id = "location_id";
19416 /// # let session_id = "session_id";
19417 /// let x = DeleteSessionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
19418 /// ```
19419 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19420 self.name = v.into();
19421 self
19422 }
19423
19424 /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
19425 ///
19426 /// # Example
19427 /// ```ignore,no_run
19428 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
19429 /// let x = DeleteSessionRequest::new().set_request_id("example");
19430 /// ```
19431 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19432 self.request_id = v.into();
19433 self
19434 }
19435}
19436
19437impl wkt::message::Message for DeleteSessionRequest {
19438 fn typename() -> &'static str {
19439 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionRequest"
19440 }
19441}
19442
19443/// A representation of a session.
19444#[derive(Clone, Default, PartialEq)]
19445#[non_exhaustive]
19446pub struct Session {
19447 /// Identifier. The resource name of the session.
19448 pub name: std::string::String,
19449
19450 /// Output only. A session UUID (Unique Universal Identifier). The service
19451 /// generates this value when it creates the session.
19452 pub uuid: std::string::String,
19453
19454 /// Output only. The time when the session was created.
19455 pub create_time: std::option::Option<wkt::Timestamp>,
19456
19457 /// Output only. Runtime information about session execution.
19458 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
19459
19460 /// Output only. A state of the session.
19461 pub state: crate::model::session::State,
19462
19463 /// Output only. Session state details, such as the failure
19464 /// description if the state is `FAILED`.
19465 pub state_message: std::string::String,
19466
19467 /// Output only. The time when the session entered the current state.
19468 pub state_time: std::option::Option<wkt::Timestamp>,
19469
19470 /// Output only. The email address of the user who created the session.
19471 pub creator: std::string::String,
19472
19473 /// Optional. The labels to associate with the session.
19474 /// Label **keys** must contain 1 to 63 characters, and must conform to
19475 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
19476 /// Label **values** may be empty, but, if present, must contain 1 to 63
19477 /// characters, and must conform to [RFC
19478 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
19479 /// associated with a session.
19480 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
19481
19482 /// Optional. Runtime configuration for the session execution.
19483 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
19484
19485 /// Optional. Environment configuration for the session execution.
19486 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
19487
19488 /// Optional. The email address of the user who owns the session.
19489 pub user: std::string::String,
19490
19491 /// Output only. Historical state information for the session.
19492 pub state_history: std::vec::Vec<crate::model::session::SessionStateHistory>,
19493
19494 /// Optional. The session template used by the session.
19495 ///
19496 /// Only resource names, including project ID and location, are valid.
19497 ///
19498 /// Example:
19499 ///
19500 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
19501 /// * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
19502 ///
19503 /// The template must be in the same project and Dataproc region as the
19504 /// session.
19505 pub session_template: std::string::String,
19506
19507 /// The session configuration.
19508 pub session_config: std::option::Option<crate::model::session::SessionConfig>,
19509
19510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19511}
19512
19513impl Session {
19514 /// Creates a new default instance.
19515 pub fn new() -> Self {
19516 std::default::Default::default()
19517 }
19518
19519 /// Sets the value of [name][crate::model::Session::name].
19520 ///
19521 /// # Example
19522 /// ```ignore,no_run
19523 /// # use google_cloud_dataproc_v1::model::Session;
19524 /// # let project_id = "project_id";
19525 /// # let location_id = "location_id";
19526 /// # let session_id = "session_id";
19527 /// let x = Session::new().set_name(format!("projects/{project_id}/locations/{location_id}/sessions/{session_id}"));
19528 /// ```
19529 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19530 self.name = v.into();
19531 self
19532 }
19533
19534 /// Sets the value of [uuid][crate::model::Session::uuid].
19535 ///
19536 /// # Example
19537 /// ```ignore,no_run
19538 /// # use google_cloud_dataproc_v1::model::Session;
19539 /// let x = Session::new().set_uuid("example");
19540 /// ```
19541 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19542 self.uuid = v.into();
19543 self
19544 }
19545
19546 /// Sets the value of [create_time][crate::model::Session::create_time].
19547 ///
19548 /// # Example
19549 /// ```ignore,no_run
19550 /// # use google_cloud_dataproc_v1::model::Session;
19551 /// use wkt::Timestamp;
19552 /// let x = Session::new().set_create_time(Timestamp::default()/* use setters */);
19553 /// ```
19554 pub fn set_create_time<T>(mut self, v: T) -> Self
19555 where
19556 T: std::convert::Into<wkt::Timestamp>,
19557 {
19558 self.create_time = std::option::Option::Some(v.into());
19559 self
19560 }
19561
19562 /// Sets or clears the value of [create_time][crate::model::Session::create_time].
19563 ///
19564 /// # Example
19565 /// ```ignore,no_run
19566 /// # use google_cloud_dataproc_v1::model::Session;
19567 /// use wkt::Timestamp;
19568 /// let x = Session::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19569 /// let x = Session::new().set_or_clear_create_time(None::<Timestamp>);
19570 /// ```
19571 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19572 where
19573 T: std::convert::Into<wkt::Timestamp>,
19574 {
19575 self.create_time = v.map(|x| x.into());
19576 self
19577 }
19578
19579 /// Sets the value of [runtime_info][crate::model::Session::runtime_info].
19580 ///
19581 /// # Example
19582 /// ```ignore,no_run
19583 /// # use google_cloud_dataproc_v1::model::Session;
19584 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
19585 /// let x = Session::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
19586 /// ```
19587 pub fn set_runtime_info<T>(mut self, v: T) -> Self
19588 where
19589 T: std::convert::Into<crate::model::RuntimeInfo>,
19590 {
19591 self.runtime_info = std::option::Option::Some(v.into());
19592 self
19593 }
19594
19595 /// Sets or clears the value of [runtime_info][crate::model::Session::runtime_info].
19596 ///
19597 /// # Example
19598 /// ```ignore,no_run
19599 /// # use google_cloud_dataproc_v1::model::Session;
19600 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
19601 /// let x = Session::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
19602 /// let x = Session::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
19603 /// ```
19604 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
19605 where
19606 T: std::convert::Into<crate::model::RuntimeInfo>,
19607 {
19608 self.runtime_info = v.map(|x| x.into());
19609 self
19610 }
19611
19612 /// Sets the value of [state][crate::model::Session::state].
19613 ///
19614 /// # Example
19615 /// ```ignore,no_run
19616 /// # use google_cloud_dataproc_v1::model::Session;
19617 /// use google_cloud_dataproc_v1::model::session::State;
19618 /// let x0 = Session::new().set_state(State::Creating);
19619 /// let x1 = Session::new().set_state(State::Active);
19620 /// let x2 = Session::new().set_state(State::Terminating);
19621 /// ```
19622 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(mut self, v: T) -> Self {
19623 self.state = v.into();
19624 self
19625 }
19626
19627 /// Sets the value of [state_message][crate::model::Session::state_message].
19628 ///
19629 /// # Example
19630 /// ```ignore,no_run
19631 /// # use google_cloud_dataproc_v1::model::Session;
19632 /// let x = Session::new().set_state_message("example");
19633 /// ```
19634 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19635 self.state_message = v.into();
19636 self
19637 }
19638
19639 /// Sets the value of [state_time][crate::model::Session::state_time].
19640 ///
19641 /// # Example
19642 /// ```ignore,no_run
19643 /// # use google_cloud_dataproc_v1::model::Session;
19644 /// use wkt::Timestamp;
19645 /// let x = Session::new().set_state_time(Timestamp::default()/* use setters */);
19646 /// ```
19647 pub fn set_state_time<T>(mut self, v: T) -> Self
19648 where
19649 T: std::convert::Into<wkt::Timestamp>,
19650 {
19651 self.state_time = std::option::Option::Some(v.into());
19652 self
19653 }
19654
19655 /// Sets or clears the value of [state_time][crate::model::Session::state_time].
19656 ///
19657 /// # Example
19658 /// ```ignore,no_run
19659 /// # use google_cloud_dataproc_v1::model::Session;
19660 /// use wkt::Timestamp;
19661 /// let x = Session::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
19662 /// let x = Session::new().set_or_clear_state_time(None::<Timestamp>);
19663 /// ```
19664 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
19665 where
19666 T: std::convert::Into<wkt::Timestamp>,
19667 {
19668 self.state_time = v.map(|x| x.into());
19669 self
19670 }
19671
19672 /// Sets the value of [creator][crate::model::Session::creator].
19673 ///
19674 /// # Example
19675 /// ```ignore,no_run
19676 /// # use google_cloud_dataproc_v1::model::Session;
19677 /// let x = Session::new().set_creator("example");
19678 /// ```
19679 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19680 self.creator = v.into();
19681 self
19682 }
19683
19684 /// Sets the value of [labels][crate::model::Session::labels].
19685 ///
19686 /// # Example
19687 /// ```ignore,no_run
19688 /// # use google_cloud_dataproc_v1::model::Session;
19689 /// let x = Session::new().set_labels([
19690 /// ("key0", "abc"),
19691 /// ("key1", "xyz"),
19692 /// ]);
19693 /// ```
19694 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
19695 where
19696 T: std::iter::IntoIterator<Item = (K, V)>,
19697 K: std::convert::Into<std::string::String>,
19698 V: std::convert::Into<std::string::String>,
19699 {
19700 use std::iter::Iterator;
19701 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
19702 self
19703 }
19704
19705 /// Sets the value of [runtime_config][crate::model::Session::runtime_config].
19706 ///
19707 /// # Example
19708 /// ```ignore,no_run
19709 /// # use google_cloud_dataproc_v1::model::Session;
19710 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19711 /// let x = Session::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
19712 /// ```
19713 pub fn set_runtime_config<T>(mut self, v: T) -> Self
19714 where
19715 T: std::convert::Into<crate::model::RuntimeConfig>,
19716 {
19717 self.runtime_config = std::option::Option::Some(v.into());
19718 self
19719 }
19720
19721 /// Sets or clears the value of [runtime_config][crate::model::Session::runtime_config].
19722 ///
19723 /// # Example
19724 /// ```ignore,no_run
19725 /// # use google_cloud_dataproc_v1::model::Session;
19726 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19727 /// let x = Session::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
19728 /// let x = Session::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
19729 /// ```
19730 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
19731 where
19732 T: std::convert::Into<crate::model::RuntimeConfig>,
19733 {
19734 self.runtime_config = v.map(|x| x.into());
19735 self
19736 }
19737
19738 /// Sets the value of [environment_config][crate::model::Session::environment_config].
19739 ///
19740 /// # Example
19741 /// ```ignore,no_run
19742 /// # use google_cloud_dataproc_v1::model::Session;
19743 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19744 /// let x = Session::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
19745 /// ```
19746 pub fn set_environment_config<T>(mut self, v: T) -> Self
19747 where
19748 T: std::convert::Into<crate::model::EnvironmentConfig>,
19749 {
19750 self.environment_config = std::option::Option::Some(v.into());
19751 self
19752 }
19753
19754 /// Sets or clears the value of [environment_config][crate::model::Session::environment_config].
19755 ///
19756 /// # Example
19757 /// ```ignore,no_run
19758 /// # use google_cloud_dataproc_v1::model::Session;
19759 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19760 /// let x = Session::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
19761 /// let x = Session::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
19762 /// ```
19763 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
19764 where
19765 T: std::convert::Into<crate::model::EnvironmentConfig>,
19766 {
19767 self.environment_config = v.map(|x| x.into());
19768 self
19769 }
19770
19771 /// Sets the value of [user][crate::model::Session::user].
19772 ///
19773 /// # Example
19774 /// ```ignore,no_run
19775 /// # use google_cloud_dataproc_v1::model::Session;
19776 /// let x = Session::new().set_user("example");
19777 /// ```
19778 pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19779 self.user = v.into();
19780 self
19781 }
19782
19783 /// Sets the value of [state_history][crate::model::Session::state_history].
19784 ///
19785 /// # Example
19786 /// ```ignore,no_run
19787 /// # use google_cloud_dataproc_v1::model::Session;
19788 /// use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19789 /// let x = Session::new()
19790 /// .set_state_history([
19791 /// SessionStateHistory::default()/* use setters */,
19792 /// SessionStateHistory::default()/* use (different) setters */,
19793 /// ]);
19794 /// ```
19795 pub fn set_state_history<T, V>(mut self, v: T) -> Self
19796 where
19797 T: std::iter::IntoIterator<Item = V>,
19798 V: std::convert::Into<crate::model::session::SessionStateHistory>,
19799 {
19800 use std::iter::Iterator;
19801 self.state_history = v.into_iter().map(|i| i.into()).collect();
19802 self
19803 }
19804
19805 /// Sets the value of [session_template][crate::model::Session::session_template].
19806 ///
19807 /// # Example
19808 /// ```ignore,no_run
19809 /// # use google_cloud_dataproc_v1::model::Session;
19810 /// # let project_id = "project_id";
19811 /// # let location_id = "location_id";
19812 /// # let template_id = "template_id";
19813 /// let x = Session::new().set_session_template(format!("projects/{project_id}/locations/{location_id}/sessionTemplates/{template_id}"));
19814 /// ```
19815 pub fn set_session_template<T: std::convert::Into<std::string::String>>(
19816 mut self,
19817 v: T,
19818 ) -> Self {
19819 self.session_template = v.into();
19820 self
19821 }
19822
19823 /// Sets the value of [session_config][crate::model::Session::session_config].
19824 ///
19825 /// Note that all the setters affecting `session_config` are mutually
19826 /// exclusive.
19827 ///
19828 /// # Example
19829 /// ```ignore,no_run
19830 /// # use google_cloud_dataproc_v1::model::Session;
19831 /// use google_cloud_dataproc_v1::model::JupyterConfig;
19832 /// let x = Session::new().set_session_config(Some(
19833 /// google_cloud_dataproc_v1::model::session::SessionConfig::JupyterSession(JupyterConfig::default().into())));
19834 /// ```
19835 pub fn set_session_config<
19836 T: std::convert::Into<std::option::Option<crate::model::session::SessionConfig>>,
19837 >(
19838 mut self,
19839 v: T,
19840 ) -> Self {
19841 self.session_config = v.into();
19842 self
19843 }
19844
19845 /// The value of [session_config][crate::model::Session::session_config]
19846 /// if it holds a `JupyterSession`, `None` if the field is not set or
19847 /// holds a different branch.
19848 pub fn jupyter_session(
19849 &self,
19850 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
19851 #[allow(unreachable_patterns)]
19852 self.session_config.as_ref().and_then(|v| match v {
19853 crate::model::session::SessionConfig::JupyterSession(v) => std::option::Option::Some(v),
19854 _ => std::option::Option::None,
19855 })
19856 }
19857
19858 /// Sets the value of [session_config][crate::model::Session::session_config]
19859 /// to hold a `JupyterSession`.
19860 ///
19861 /// Note that all the setters affecting `session_config` are
19862 /// mutually exclusive.
19863 ///
19864 /// # Example
19865 /// ```ignore,no_run
19866 /// # use google_cloud_dataproc_v1::model::Session;
19867 /// use google_cloud_dataproc_v1::model::JupyterConfig;
19868 /// let x = Session::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
19869 /// assert!(x.jupyter_session().is_some());
19870 /// assert!(x.spark_connect_session().is_none());
19871 /// ```
19872 pub fn set_jupyter_session<
19873 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
19874 >(
19875 mut self,
19876 v: T,
19877 ) -> Self {
19878 self.session_config = std::option::Option::Some(
19879 crate::model::session::SessionConfig::JupyterSession(v.into()),
19880 );
19881 self
19882 }
19883
19884 /// The value of [session_config][crate::model::Session::session_config]
19885 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
19886 /// holds a different branch.
19887 pub fn spark_connect_session(
19888 &self,
19889 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
19890 #[allow(unreachable_patterns)]
19891 self.session_config.as_ref().and_then(|v| match v {
19892 crate::model::session::SessionConfig::SparkConnectSession(v) => {
19893 std::option::Option::Some(v)
19894 }
19895 _ => std::option::Option::None,
19896 })
19897 }
19898
19899 /// Sets the value of [session_config][crate::model::Session::session_config]
19900 /// to hold a `SparkConnectSession`.
19901 ///
19902 /// Note that all the setters affecting `session_config` are
19903 /// mutually exclusive.
19904 ///
19905 /// # Example
19906 /// ```ignore,no_run
19907 /// # use google_cloud_dataproc_v1::model::Session;
19908 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
19909 /// let x = Session::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
19910 /// assert!(x.spark_connect_session().is_some());
19911 /// assert!(x.jupyter_session().is_none());
19912 /// ```
19913 pub fn set_spark_connect_session<
19914 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
19915 >(
19916 mut self,
19917 v: T,
19918 ) -> Self {
19919 self.session_config = std::option::Option::Some(
19920 crate::model::session::SessionConfig::SparkConnectSession(v.into()),
19921 );
19922 self
19923 }
19924}
19925
19926impl wkt::message::Message for Session {
19927 fn typename() -> &'static str {
19928 "type.googleapis.com/google.cloud.dataproc.v1.Session"
19929 }
19930}
19931
19932/// Defines additional types related to [Session].
19933pub mod session {
19934 #[allow(unused_imports)]
19935 use super::*;
19936
19937 /// Historical state information.
19938 #[derive(Clone, Default, PartialEq)]
19939 #[non_exhaustive]
19940 pub struct SessionStateHistory {
19941 /// Output only. The state of the session at this point in the session
19942 /// history.
19943 pub state: crate::model::session::State,
19944
19945 /// Output only. Details about the state at this point in the session
19946 /// history.
19947 pub state_message: std::string::String,
19948
19949 /// Output only. The time when the session entered the historical state.
19950 pub state_start_time: std::option::Option<wkt::Timestamp>,
19951
19952 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19953 }
19954
19955 impl SessionStateHistory {
19956 /// Creates a new default instance.
19957 pub fn new() -> Self {
19958 std::default::Default::default()
19959 }
19960
19961 /// Sets the value of [state][crate::model::session::SessionStateHistory::state].
19962 ///
19963 /// # Example
19964 /// ```ignore,no_run
19965 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19966 /// use google_cloud_dataproc_v1::model::session::State;
19967 /// let x0 = SessionStateHistory::new().set_state(State::Creating);
19968 /// let x1 = SessionStateHistory::new().set_state(State::Active);
19969 /// let x2 = SessionStateHistory::new().set_state(State::Terminating);
19970 /// ```
19971 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(
19972 mut self,
19973 v: T,
19974 ) -> Self {
19975 self.state = v.into();
19976 self
19977 }
19978
19979 /// Sets the value of [state_message][crate::model::session::SessionStateHistory::state_message].
19980 ///
19981 /// # Example
19982 /// ```ignore,no_run
19983 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19984 /// let x = SessionStateHistory::new().set_state_message("example");
19985 /// ```
19986 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
19987 mut self,
19988 v: T,
19989 ) -> Self {
19990 self.state_message = v.into();
19991 self
19992 }
19993
19994 /// Sets the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
19995 ///
19996 /// # Example
19997 /// ```ignore,no_run
19998 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19999 /// use wkt::Timestamp;
20000 /// let x = SessionStateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
20001 /// ```
20002 pub fn set_state_start_time<T>(mut self, v: T) -> Self
20003 where
20004 T: std::convert::Into<wkt::Timestamp>,
20005 {
20006 self.state_start_time = std::option::Option::Some(v.into());
20007 self
20008 }
20009
20010 /// Sets or clears the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
20011 ///
20012 /// # Example
20013 /// ```ignore,no_run
20014 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
20015 /// use wkt::Timestamp;
20016 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
20017 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
20018 /// ```
20019 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
20020 where
20021 T: std::convert::Into<wkt::Timestamp>,
20022 {
20023 self.state_start_time = v.map(|x| x.into());
20024 self
20025 }
20026 }
20027
20028 impl wkt::message::Message for SessionStateHistory {
20029 fn typename() -> &'static str {
20030 "type.googleapis.com/google.cloud.dataproc.v1.Session.SessionStateHistory"
20031 }
20032 }
20033
20034 /// The session state.
20035 ///
20036 /// # Working with unknown values
20037 ///
20038 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20039 /// additional enum variants at any time. Adding new variants is not considered
20040 /// a breaking change. Applications should write their code in anticipation of:
20041 ///
20042 /// - New values appearing in future releases of the client library, **and**
20043 /// - New values received dynamically, without application changes.
20044 ///
20045 /// Please consult the [Working with enums] section in the user guide for some
20046 /// guidelines.
20047 ///
20048 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
20049 #[derive(Clone, Debug, PartialEq)]
20050 #[non_exhaustive]
20051 pub enum State {
20052 /// The session state is unknown.
20053 Unspecified,
20054 /// The session is created prior to running.
20055 Creating,
20056 /// The session is running.
20057 Active,
20058 /// The session is terminating.
20059 Terminating,
20060 /// The session is terminated successfully.
20061 Terminated,
20062 /// The session is no longer running due to an error.
20063 Failed,
20064 /// If set, the enum was initialized with an unknown value.
20065 ///
20066 /// Applications can examine the value using [State::value] or
20067 /// [State::name].
20068 UnknownValue(state::UnknownValue),
20069 }
20070
20071 #[doc(hidden)]
20072 pub mod state {
20073 #[allow(unused_imports)]
20074 use super::*;
20075 #[derive(Clone, Debug, PartialEq)]
20076 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20077 }
20078
20079 impl State {
20080 /// Gets the enum value.
20081 ///
20082 /// Returns `None` if the enum contains an unknown value deserialized from
20083 /// the string representation of enums.
20084 pub fn value(&self) -> std::option::Option<i32> {
20085 match self {
20086 Self::Unspecified => std::option::Option::Some(0),
20087 Self::Creating => std::option::Option::Some(1),
20088 Self::Active => std::option::Option::Some(2),
20089 Self::Terminating => std::option::Option::Some(3),
20090 Self::Terminated => std::option::Option::Some(4),
20091 Self::Failed => std::option::Option::Some(5),
20092 Self::UnknownValue(u) => u.0.value(),
20093 }
20094 }
20095
20096 /// Gets the enum value as a string.
20097 ///
20098 /// Returns `None` if the enum contains an unknown value deserialized from
20099 /// the integer representation of enums.
20100 pub fn name(&self) -> std::option::Option<&str> {
20101 match self {
20102 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
20103 Self::Creating => std::option::Option::Some("CREATING"),
20104 Self::Active => std::option::Option::Some("ACTIVE"),
20105 Self::Terminating => std::option::Option::Some("TERMINATING"),
20106 Self::Terminated => std::option::Option::Some("TERMINATED"),
20107 Self::Failed => std::option::Option::Some("FAILED"),
20108 Self::UnknownValue(u) => u.0.name(),
20109 }
20110 }
20111 }
20112
20113 impl std::default::Default for State {
20114 fn default() -> Self {
20115 use std::convert::From;
20116 Self::from(0)
20117 }
20118 }
20119
20120 impl std::fmt::Display for State {
20121 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20122 wkt::internal::display_enum(f, self.name(), self.value())
20123 }
20124 }
20125
20126 impl std::convert::From<i32> for State {
20127 fn from(value: i32) -> Self {
20128 match value {
20129 0 => Self::Unspecified,
20130 1 => Self::Creating,
20131 2 => Self::Active,
20132 3 => Self::Terminating,
20133 4 => Self::Terminated,
20134 5 => Self::Failed,
20135 _ => Self::UnknownValue(state::UnknownValue(
20136 wkt::internal::UnknownEnumValue::Integer(value),
20137 )),
20138 }
20139 }
20140 }
20141
20142 impl std::convert::From<&str> for State {
20143 fn from(value: &str) -> Self {
20144 use std::string::ToString;
20145 match value {
20146 "STATE_UNSPECIFIED" => Self::Unspecified,
20147 "CREATING" => Self::Creating,
20148 "ACTIVE" => Self::Active,
20149 "TERMINATING" => Self::Terminating,
20150 "TERMINATED" => Self::Terminated,
20151 "FAILED" => Self::Failed,
20152 _ => Self::UnknownValue(state::UnknownValue(
20153 wkt::internal::UnknownEnumValue::String(value.to_string()),
20154 )),
20155 }
20156 }
20157 }
20158
20159 impl serde::ser::Serialize for State {
20160 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20161 where
20162 S: serde::Serializer,
20163 {
20164 match self {
20165 Self::Unspecified => serializer.serialize_i32(0),
20166 Self::Creating => serializer.serialize_i32(1),
20167 Self::Active => serializer.serialize_i32(2),
20168 Self::Terminating => serializer.serialize_i32(3),
20169 Self::Terminated => serializer.serialize_i32(4),
20170 Self::Failed => serializer.serialize_i32(5),
20171 Self::UnknownValue(u) => u.0.serialize(serializer),
20172 }
20173 }
20174 }
20175
20176 impl<'de> serde::de::Deserialize<'de> for State {
20177 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20178 where
20179 D: serde::Deserializer<'de>,
20180 {
20181 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
20182 ".google.cloud.dataproc.v1.Session.State",
20183 ))
20184 }
20185 }
20186
20187 /// The session configuration.
20188 #[derive(Clone, Debug, PartialEq)]
20189 #[non_exhaustive]
20190 pub enum SessionConfig {
20191 /// Optional. Jupyter session config.
20192 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
20193 /// Optional. Spark connect session config.
20194 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
20195 }
20196}
20197
20198/// Jupyter configuration for an interactive session.
20199#[derive(Clone, Default, PartialEq)]
20200#[non_exhaustive]
20201pub struct JupyterConfig {
20202 /// Optional. Kernel
20203 pub kernel: crate::model::jupyter_config::Kernel,
20204
20205 /// Optional. Display name, shown in the Jupyter kernelspec card.
20206 pub display_name: std::string::String,
20207
20208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20209}
20210
20211impl JupyterConfig {
20212 /// Creates a new default instance.
20213 pub fn new() -> Self {
20214 std::default::Default::default()
20215 }
20216
20217 /// Sets the value of [kernel][crate::model::JupyterConfig::kernel].
20218 ///
20219 /// # Example
20220 /// ```ignore,no_run
20221 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
20222 /// use google_cloud_dataproc_v1::model::jupyter_config::Kernel;
20223 /// let x0 = JupyterConfig::new().set_kernel(Kernel::Python);
20224 /// let x1 = JupyterConfig::new().set_kernel(Kernel::Scala);
20225 /// ```
20226 pub fn set_kernel<T: std::convert::Into<crate::model::jupyter_config::Kernel>>(
20227 mut self,
20228 v: T,
20229 ) -> Self {
20230 self.kernel = v.into();
20231 self
20232 }
20233
20234 /// Sets the value of [display_name][crate::model::JupyterConfig::display_name].
20235 ///
20236 /// # Example
20237 /// ```ignore,no_run
20238 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
20239 /// let x = JupyterConfig::new().set_display_name("example");
20240 /// ```
20241 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20242 self.display_name = v.into();
20243 self
20244 }
20245}
20246
20247impl wkt::message::Message for JupyterConfig {
20248 fn typename() -> &'static str {
20249 "type.googleapis.com/google.cloud.dataproc.v1.JupyterConfig"
20250 }
20251}
20252
20253/// Defines additional types related to [JupyterConfig].
20254pub mod jupyter_config {
20255 #[allow(unused_imports)]
20256 use super::*;
20257
20258 /// Jupyter kernel types.
20259 ///
20260 /// # Working with unknown values
20261 ///
20262 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20263 /// additional enum variants at any time. Adding new variants is not considered
20264 /// a breaking change. Applications should write their code in anticipation of:
20265 ///
20266 /// - New values appearing in future releases of the client library, **and**
20267 /// - New values received dynamically, without application changes.
20268 ///
20269 /// Please consult the [Working with enums] section in the user guide for some
20270 /// guidelines.
20271 ///
20272 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
20273 #[derive(Clone, Debug, PartialEq)]
20274 #[non_exhaustive]
20275 pub enum Kernel {
20276 /// The kernel is unknown.
20277 Unspecified,
20278 /// Python kernel.
20279 Python,
20280 /// Scala kernel.
20281 Scala,
20282 /// If set, the enum was initialized with an unknown value.
20283 ///
20284 /// Applications can examine the value using [Kernel::value] or
20285 /// [Kernel::name].
20286 UnknownValue(kernel::UnknownValue),
20287 }
20288
20289 #[doc(hidden)]
20290 pub mod kernel {
20291 #[allow(unused_imports)]
20292 use super::*;
20293 #[derive(Clone, Debug, PartialEq)]
20294 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20295 }
20296
20297 impl Kernel {
20298 /// Gets the enum value.
20299 ///
20300 /// Returns `None` if the enum contains an unknown value deserialized from
20301 /// the string representation of enums.
20302 pub fn value(&self) -> std::option::Option<i32> {
20303 match self {
20304 Self::Unspecified => std::option::Option::Some(0),
20305 Self::Python => std::option::Option::Some(1),
20306 Self::Scala => std::option::Option::Some(2),
20307 Self::UnknownValue(u) => u.0.value(),
20308 }
20309 }
20310
20311 /// Gets the enum value as a string.
20312 ///
20313 /// Returns `None` if the enum contains an unknown value deserialized from
20314 /// the integer representation of enums.
20315 pub fn name(&self) -> std::option::Option<&str> {
20316 match self {
20317 Self::Unspecified => std::option::Option::Some("KERNEL_UNSPECIFIED"),
20318 Self::Python => std::option::Option::Some("PYTHON"),
20319 Self::Scala => std::option::Option::Some("SCALA"),
20320 Self::UnknownValue(u) => u.0.name(),
20321 }
20322 }
20323 }
20324
20325 impl std::default::Default for Kernel {
20326 fn default() -> Self {
20327 use std::convert::From;
20328 Self::from(0)
20329 }
20330 }
20331
20332 impl std::fmt::Display for Kernel {
20333 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20334 wkt::internal::display_enum(f, self.name(), self.value())
20335 }
20336 }
20337
20338 impl std::convert::From<i32> for Kernel {
20339 fn from(value: i32) -> Self {
20340 match value {
20341 0 => Self::Unspecified,
20342 1 => Self::Python,
20343 2 => Self::Scala,
20344 _ => Self::UnknownValue(kernel::UnknownValue(
20345 wkt::internal::UnknownEnumValue::Integer(value),
20346 )),
20347 }
20348 }
20349 }
20350
20351 impl std::convert::From<&str> for Kernel {
20352 fn from(value: &str) -> Self {
20353 use std::string::ToString;
20354 match value {
20355 "KERNEL_UNSPECIFIED" => Self::Unspecified,
20356 "PYTHON" => Self::Python,
20357 "SCALA" => Self::Scala,
20358 _ => Self::UnknownValue(kernel::UnknownValue(
20359 wkt::internal::UnknownEnumValue::String(value.to_string()),
20360 )),
20361 }
20362 }
20363 }
20364
20365 impl serde::ser::Serialize for Kernel {
20366 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20367 where
20368 S: serde::Serializer,
20369 {
20370 match self {
20371 Self::Unspecified => serializer.serialize_i32(0),
20372 Self::Python => serializer.serialize_i32(1),
20373 Self::Scala => serializer.serialize_i32(2),
20374 Self::UnknownValue(u) => u.0.serialize(serializer),
20375 }
20376 }
20377 }
20378
20379 impl<'de> serde::de::Deserialize<'de> for Kernel {
20380 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20381 where
20382 D: serde::Deserializer<'de>,
20383 {
20384 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kernel>::new(
20385 ".google.cloud.dataproc.v1.JupyterConfig.Kernel",
20386 ))
20387 }
20388 }
20389}
20390
20391/// Spark connect configuration for an interactive session.
20392#[derive(Clone, Default, PartialEq)]
20393#[non_exhaustive]
20394pub struct SparkConnectConfig {
20395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20396}
20397
20398impl SparkConnectConfig {
20399 /// Creates a new default instance.
20400 pub fn new() -> Self {
20401 std::default::Default::default()
20402 }
20403}
20404
20405impl wkt::message::Message for SparkConnectConfig {
20406 fn typename() -> &'static str {
20407 "type.googleapis.com/google.cloud.dataproc.v1.SparkConnectConfig"
20408 }
20409}
20410
20411/// Runtime configuration for a workload.
20412#[derive(Clone, Default, PartialEq)]
20413#[non_exhaustive]
20414pub struct RuntimeConfig {
20415 /// Optional. Version of the batch runtime.
20416 pub version: std::string::String,
20417
20418 /// Optional. Optional custom container image for the job runtime environment.
20419 /// If not specified, a default container image will be used.
20420 pub container_image: std::string::String,
20421
20422 /// Optional. A mapping of property names to values, which are used to
20423 /// configure workload execution.
20424 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
20425
20426 /// Optional. Dependency repository configuration.
20427 pub repository_config: std::option::Option<crate::model::RepositoryConfig>,
20428
20429 /// Optional. Autotuning configuration of the workload.
20430 pub autotuning_config: std::option::Option<crate::model::AutotuningConfig>,
20431
20432 /// Optional. Cohort identifier. Identifies families of the workloads that have
20433 /// the same shape, for example, daily ETL jobs.
20434 pub cohort: std::string::String,
20435
20436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20437}
20438
20439impl RuntimeConfig {
20440 /// Creates a new default instance.
20441 pub fn new() -> Self {
20442 std::default::Default::default()
20443 }
20444
20445 /// Sets the value of [version][crate::model::RuntimeConfig::version].
20446 ///
20447 /// # Example
20448 /// ```ignore,no_run
20449 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20450 /// let x = RuntimeConfig::new().set_version("example");
20451 /// ```
20452 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20453 self.version = v.into();
20454 self
20455 }
20456
20457 /// Sets the value of [container_image][crate::model::RuntimeConfig::container_image].
20458 ///
20459 /// # Example
20460 /// ```ignore,no_run
20461 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20462 /// let x = RuntimeConfig::new().set_container_image("example");
20463 /// ```
20464 pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20465 self.container_image = v.into();
20466 self
20467 }
20468
20469 /// Sets the value of [properties][crate::model::RuntimeConfig::properties].
20470 ///
20471 /// # Example
20472 /// ```ignore,no_run
20473 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20474 /// let x = RuntimeConfig::new().set_properties([
20475 /// ("key0", "abc"),
20476 /// ("key1", "xyz"),
20477 /// ]);
20478 /// ```
20479 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
20480 where
20481 T: std::iter::IntoIterator<Item = (K, V)>,
20482 K: std::convert::Into<std::string::String>,
20483 V: std::convert::Into<std::string::String>,
20484 {
20485 use std::iter::Iterator;
20486 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20487 self
20488 }
20489
20490 /// Sets the value of [repository_config][crate::model::RuntimeConfig::repository_config].
20491 ///
20492 /// # Example
20493 /// ```ignore,no_run
20494 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20495 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
20496 /// let x = RuntimeConfig::new().set_repository_config(RepositoryConfig::default()/* use setters */);
20497 /// ```
20498 pub fn set_repository_config<T>(mut self, v: T) -> Self
20499 where
20500 T: std::convert::Into<crate::model::RepositoryConfig>,
20501 {
20502 self.repository_config = std::option::Option::Some(v.into());
20503 self
20504 }
20505
20506 /// Sets or clears the value of [repository_config][crate::model::RuntimeConfig::repository_config].
20507 ///
20508 /// # Example
20509 /// ```ignore,no_run
20510 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20511 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
20512 /// let x = RuntimeConfig::new().set_or_clear_repository_config(Some(RepositoryConfig::default()/* use setters */));
20513 /// let x = RuntimeConfig::new().set_or_clear_repository_config(None::<RepositoryConfig>);
20514 /// ```
20515 pub fn set_or_clear_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
20516 where
20517 T: std::convert::Into<crate::model::RepositoryConfig>,
20518 {
20519 self.repository_config = v.map(|x| x.into());
20520 self
20521 }
20522
20523 /// Sets the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
20524 ///
20525 /// # Example
20526 /// ```ignore,no_run
20527 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20528 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
20529 /// let x = RuntimeConfig::new().set_autotuning_config(AutotuningConfig::default()/* use setters */);
20530 /// ```
20531 pub fn set_autotuning_config<T>(mut self, v: T) -> Self
20532 where
20533 T: std::convert::Into<crate::model::AutotuningConfig>,
20534 {
20535 self.autotuning_config = std::option::Option::Some(v.into());
20536 self
20537 }
20538
20539 /// Sets or clears the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
20540 ///
20541 /// # Example
20542 /// ```ignore,no_run
20543 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20544 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
20545 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(Some(AutotuningConfig::default()/* use setters */));
20546 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(None::<AutotuningConfig>);
20547 /// ```
20548 pub fn set_or_clear_autotuning_config<T>(mut self, v: std::option::Option<T>) -> Self
20549 where
20550 T: std::convert::Into<crate::model::AutotuningConfig>,
20551 {
20552 self.autotuning_config = v.map(|x| x.into());
20553 self
20554 }
20555
20556 /// Sets the value of [cohort][crate::model::RuntimeConfig::cohort].
20557 ///
20558 /// # Example
20559 /// ```ignore,no_run
20560 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
20561 /// let x = RuntimeConfig::new().set_cohort("example");
20562 /// ```
20563 pub fn set_cohort<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20564 self.cohort = v.into();
20565 self
20566 }
20567}
20568
20569impl wkt::message::Message for RuntimeConfig {
20570 fn typename() -> &'static str {
20571 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeConfig"
20572 }
20573}
20574
20575/// Environment configuration for a workload.
20576#[derive(Clone, Default, PartialEq)]
20577#[non_exhaustive]
20578pub struct EnvironmentConfig {
20579 /// Optional. Execution configuration for a workload.
20580 pub execution_config: std::option::Option<crate::model::ExecutionConfig>,
20581
20582 /// Optional. Peripherals configuration that workload has access to.
20583 pub peripherals_config: std::option::Option<crate::model::PeripheralsConfig>,
20584
20585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20586}
20587
20588impl EnvironmentConfig {
20589 /// Creates a new default instance.
20590 pub fn new() -> Self {
20591 std::default::Default::default()
20592 }
20593
20594 /// Sets the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
20595 ///
20596 /// # Example
20597 /// ```ignore,no_run
20598 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20599 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
20600 /// let x = EnvironmentConfig::new().set_execution_config(ExecutionConfig::default()/* use setters */);
20601 /// ```
20602 pub fn set_execution_config<T>(mut self, v: T) -> Self
20603 where
20604 T: std::convert::Into<crate::model::ExecutionConfig>,
20605 {
20606 self.execution_config = std::option::Option::Some(v.into());
20607 self
20608 }
20609
20610 /// Sets or clears the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
20611 ///
20612 /// # Example
20613 /// ```ignore,no_run
20614 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20615 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
20616 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(Some(ExecutionConfig::default()/* use setters */));
20617 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(None::<ExecutionConfig>);
20618 /// ```
20619 pub fn set_or_clear_execution_config<T>(mut self, v: std::option::Option<T>) -> Self
20620 where
20621 T: std::convert::Into<crate::model::ExecutionConfig>,
20622 {
20623 self.execution_config = v.map(|x| x.into());
20624 self
20625 }
20626
20627 /// Sets the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
20628 ///
20629 /// # Example
20630 /// ```ignore,no_run
20631 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20632 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
20633 /// let x = EnvironmentConfig::new().set_peripherals_config(PeripheralsConfig::default()/* use setters */);
20634 /// ```
20635 pub fn set_peripherals_config<T>(mut self, v: T) -> Self
20636 where
20637 T: std::convert::Into<crate::model::PeripheralsConfig>,
20638 {
20639 self.peripherals_config = std::option::Option::Some(v.into());
20640 self
20641 }
20642
20643 /// Sets or clears the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
20644 ///
20645 /// # Example
20646 /// ```ignore,no_run
20647 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
20648 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
20649 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(Some(PeripheralsConfig::default()/* use setters */));
20650 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(None::<PeripheralsConfig>);
20651 /// ```
20652 pub fn set_or_clear_peripherals_config<T>(mut self, v: std::option::Option<T>) -> Self
20653 where
20654 T: std::convert::Into<crate::model::PeripheralsConfig>,
20655 {
20656 self.peripherals_config = v.map(|x| x.into());
20657 self
20658 }
20659}
20660
20661impl wkt::message::Message for EnvironmentConfig {
20662 fn typename() -> &'static str {
20663 "type.googleapis.com/google.cloud.dataproc.v1.EnvironmentConfig"
20664 }
20665}
20666
20667/// Execution configuration for a workload.
20668#[derive(Clone, Default, PartialEq)]
20669#[non_exhaustive]
20670pub struct ExecutionConfig {
20671 /// Optional. Service account that used to execute workload.
20672 pub service_account: std::string::String,
20673
20674 /// Optional. Tags used for network traffic control.
20675 pub network_tags: std::vec::Vec<std::string::String>,
20676
20677 /// Optional. The Cloud KMS key to use for encryption.
20678 pub kms_key: std::string::String,
20679
20680 /// Optional. Applies to sessions only. The duration to keep the session alive
20681 /// while it's idling. Exceeding this threshold causes the session to
20682 /// terminate. This field cannot be set on a batch workload. Minimum value is
20683 /// 10 minutes; maximum value is 14 days (see JSON representation of
20684 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
20685 /// Defaults to 1 hour if not set.
20686 /// If both `ttl` and `idle_ttl` are specified for an interactive session,
20687 /// the conditions are treated as `OR` conditions: the workload will be
20688 /// terminated when it has been idle for `idle_ttl` or when `ttl` has been
20689 /// exceeded, whichever occurs first.
20690 pub idle_ttl: std::option::Option<wkt::Duration>,
20691
20692 /// Optional. The duration after which the workload will be terminated,
20693 /// specified as the JSON representation for
20694 /// [Duration](https://protobuf.dev/programming-guides/proto3/#json).
20695 /// When the workload exceeds this duration, it will be unconditionally
20696 /// terminated without waiting for ongoing work to finish. If `ttl` is not
20697 /// specified for a batch workload, the workload will be allowed to run until
20698 /// it exits naturally (or run forever without exiting). If `ttl` is not
20699 /// specified for an interactive session, it defaults to 24 hours. If `ttl` is
20700 /// not specified for a batch that uses 2.1+ runtime version, it defaults to 4
20701 /// hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl`
20702 /// and `idle_ttl` are specified (for an interactive session), the conditions
20703 /// are treated as `OR` conditions: the workload will be terminated when it has
20704 /// been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs
20705 /// first.
20706 pub ttl: std::option::Option<wkt::Duration>,
20707
20708 /// Optional. A Cloud Storage bucket used to stage workload dependencies,
20709 /// config files, and store workload output and other ephemeral data, such as
20710 /// Spark history files. If you do not specify a staging bucket, Cloud Dataproc
20711 /// will determine a Cloud Storage location according to the region where your
20712 /// workload is running, and then create and manage project-level, per-location
20713 /// staging and temporary buckets.
20714 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
20715 /// a Cloud Storage bucket.**
20716 pub staging_bucket: std::string::String,
20717
20718 /// Optional. Authentication configuration used to set the default identity for
20719 /// the workload execution. The config specifies the type of identity
20720 /// (service account or user) that will be used by workloads to access
20721 /// resources on the project(s).
20722 pub authentication_config: std::option::Option<crate::model::AuthenticationConfig>,
20723
20724 /// Optional. Associates Resource Manager tags with the workload nodes.
20725 /// There is a max limit of 30 tags.
20726 /// Keys and values can be either in numeric format, such as
20727 /// `tagKeys/{tag_key_id}` and `tagValues/{tag_value_id}`, or in namespaced
20728 /// format, such as `{org_id|project_id}/{tag_key_short_name}` and
20729 /// `{tag_value_short_name}`.
20730 pub resource_manager_tags: std::collections::HashMap<std::string::String, std::string::String>,
20731
20732 /// Network configuration for workload execution.
20733 pub network: std::option::Option<crate::model::execution_config::Network>,
20734
20735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20736}
20737
20738impl ExecutionConfig {
20739 /// Creates a new default instance.
20740 pub fn new() -> Self {
20741 std::default::Default::default()
20742 }
20743
20744 /// Sets the value of [service_account][crate::model::ExecutionConfig::service_account].
20745 ///
20746 /// # Example
20747 /// ```ignore,no_run
20748 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20749 /// let x = ExecutionConfig::new().set_service_account("example");
20750 /// ```
20751 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20752 self.service_account = v.into();
20753 self
20754 }
20755
20756 /// Sets the value of [network_tags][crate::model::ExecutionConfig::network_tags].
20757 ///
20758 /// # Example
20759 /// ```ignore,no_run
20760 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20761 /// let x = ExecutionConfig::new().set_network_tags(["a", "b", "c"]);
20762 /// ```
20763 pub fn set_network_tags<T, V>(mut self, v: T) -> Self
20764 where
20765 T: std::iter::IntoIterator<Item = V>,
20766 V: std::convert::Into<std::string::String>,
20767 {
20768 use std::iter::Iterator;
20769 self.network_tags = v.into_iter().map(|i| i.into()).collect();
20770 self
20771 }
20772
20773 /// Sets the value of [kms_key][crate::model::ExecutionConfig::kms_key].
20774 ///
20775 /// # Example
20776 /// ```ignore,no_run
20777 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20778 /// let x = ExecutionConfig::new().set_kms_key("example");
20779 /// ```
20780 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20781 self.kms_key = v.into();
20782 self
20783 }
20784
20785 /// Sets the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20786 ///
20787 /// # Example
20788 /// ```ignore,no_run
20789 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20790 /// use wkt::Duration;
20791 /// let x = ExecutionConfig::new().set_idle_ttl(Duration::default()/* use setters */);
20792 /// ```
20793 pub fn set_idle_ttl<T>(mut self, v: T) -> Self
20794 where
20795 T: std::convert::Into<wkt::Duration>,
20796 {
20797 self.idle_ttl = std::option::Option::Some(v.into());
20798 self
20799 }
20800
20801 /// Sets or clears the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20802 ///
20803 /// # Example
20804 /// ```ignore,no_run
20805 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20806 /// use wkt::Duration;
20807 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(Some(Duration::default()/* use setters */));
20808 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(None::<Duration>);
20809 /// ```
20810 pub fn set_or_clear_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20811 where
20812 T: std::convert::Into<wkt::Duration>,
20813 {
20814 self.idle_ttl = v.map(|x| x.into());
20815 self
20816 }
20817
20818 /// Sets the value of [ttl][crate::model::ExecutionConfig::ttl].
20819 ///
20820 /// # Example
20821 /// ```ignore,no_run
20822 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20823 /// use wkt::Duration;
20824 /// let x = ExecutionConfig::new().set_ttl(Duration::default()/* use setters */);
20825 /// ```
20826 pub fn set_ttl<T>(mut self, v: T) -> Self
20827 where
20828 T: std::convert::Into<wkt::Duration>,
20829 {
20830 self.ttl = std::option::Option::Some(v.into());
20831 self
20832 }
20833
20834 /// Sets or clears the value of [ttl][crate::model::ExecutionConfig::ttl].
20835 ///
20836 /// # Example
20837 /// ```ignore,no_run
20838 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20839 /// use wkt::Duration;
20840 /// let x = ExecutionConfig::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
20841 /// let x = ExecutionConfig::new().set_or_clear_ttl(None::<Duration>);
20842 /// ```
20843 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20844 where
20845 T: std::convert::Into<wkt::Duration>,
20846 {
20847 self.ttl = v.map(|x| x.into());
20848 self
20849 }
20850
20851 /// Sets the value of [staging_bucket][crate::model::ExecutionConfig::staging_bucket].
20852 ///
20853 /// # Example
20854 /// ```ignore,no_run
20855 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20856 /// let x = ExecutionConfig::new().set_staging_bucket("example");
20857 /// ```
20858 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20859 self.staging_bucket = v.into();
20860 self
20861 }
20862
20863 /// Sets the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20864 ///
20865 /// # Example
20866 /// ```ignore,no_run
20867 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20868 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20869 /// let x = ExecutionConfig::new().set_authentication_config(AuthenticationConfig::default()/* use setters */);
20870 /// ```
20871 pub fn set_authentication_config<T>(mut self, v: T) -> Self
20872 where
20873 T: std::convert::Into<crate::model::AuthenticationConfig>,
20874 {
20875 self.authentication_config = std::option::Option::Some(v.into());
20876 self
20877 }
20878
20879 /// Sets or clears the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20880 ///
20881 /// # Example
20882 /// ```ignore,no_run
20883 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20884 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20885 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(Some(AuthenticationConfig::default()/* use setters */));
20886 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(None::<AuthenticationConfig>);
20887 /// ```
20888 pub fn set_or_clear_authentication_config<T>(mut self, v: std::option::Option<T>) -> Self
20889 where
20890 T: std::convert::Into<crate::model::AuthenticationConfig>,
20891 {
20892 self.authentication_config = v.map(|x| x.into());
20893 self
20894 }
20895
20896 /// Sets the value of [resource_manager_tags][crate::model::ExecutionConfig::resource_manager_tags].
20897 ///
20898 /// # Example
20899 /// ```ignore,no_run
20900 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20901 /// let x = ExecutionConfig::new().set_resource_manager_tags([
20902 /// ("key0", "abc"),
20903 /// ("key1", "xyz"),
20904 /// ]);
20905 /// ```
20906 pub fn set_resource_manager_tags<T, K, V>(mut self, v: T) -> Self
20907 where
20908 T: std::iter::IntoIterator<Item = (K, V)>,
20909 K: std::convert::Into<std::string::String>,
20910 V: std::convert::Into<std::string::String>,
20911 {
20912 use std::iter::Iterator;
20913 self.resource_manager_tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20914 self
20915 }
20916
20917 /// Sets the value of [network][crate::model::ExecutionConfig::network].
20918 ///
20919 /// Note that all the setters affecting `network` are mutually
20920 /// exclusive.
20921 ///
20922 /// # Example
20923 /// ```ignore,no_run
20924 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20925 /// use google_cloud_dataproc_v1::model::execution_config::Network;
20926 /// let x = ExecutionConfig::new().set_network(Some(Network::NetworkUri("example".to_string())));
20927 /// ```
20928 pub fn set_network<
20929 T: std::convert::Into<std::option::Option<crate::model::execution_config::Network>>,
20930 >(
20931 mut self,
20932 v: T,
20933 ) -> Self {
20934 self.network = v.into();
20935 self
20936 }
20937
20938 /// The value of [network][crate::model::ExecutionConfig::network]
20939 /// if it holds a `NetworkUri`, `None` if the field is not set or
20940 /// holds a different branch.
20941 pub fn network_uri(&self) -> std::option::Option<&std::string::String> {
20942 #[allow(unreachable_patterns)]
20943 self.network.as_ref().and_then(|v| match v {
20944 crate::model::execution_config::Network::NetworkUri(v) => std::option::Option::Some(v),
20945 _ => std::option::Option::None,
20946 })
20947 }
20948
20949 /// Sets the value of [network][crate::model::ExecutionConfig::network]
20950 /// to hold a `NetworkUri`.
20951 ///
20952 /// Note that all the setters affecting `network` are
20953 /// mutually exclusive.
20954 ///
20955 /// # Example
20956 /// ```ignore,no_run
20957 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20958 /// let x = ExecutionConfig::new().set_network_uri("example");
20959 /// assert!(x.network_uri().is_some());
20960 /// assert!(x.subnetwork_uri().is_none());
20961 /// ```
20962 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20963 self.network = std::option::Option::Some(
20964 crate::model::execution_config::Network::NetworkUri(v.into()),
20965 );
20966 self
20967 }
20968
20969 /// The value of [network][crate::model::ExecutionConfig::network]
20970 /// if it holds a `SubnetworkUri`, `None` if the field is not set or
20971 /// holds a different branch.
20972 pub fn subnetwork_uri(&self) -> std::option::Option<&std::string::String> {
20973 #[allow(unreachable_patterns)]
20974 self.network.as_ref().and_then(|v| match v {
20975 crate::model::execution_config::Network::SubnetworkUri(v) => {
20976 std::option::Option::Some(v)
20977 }
20978 _ => std::option::Option::None,
20979 })
20980 }
20981
20982 /// Sets the value of [network][crate::model::ExecutionConfig::network]
20983 /// to hold a `SubnetworkUri`.
20984 ///
20985 /// Note that all the setters affecting `network` are
20986 /// mutually exclusive.
20987 ///
20988 /// # Example
20989 /// ```ignore,no_run
20990 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20991 /// let x = ExecutionConfig::new().set_subnetwork_uri("example");
20992 /// assert!(x.subnetwork_uri().is_some());
20993 /// assert!(x.network_uri().is_none());
20994 /// ```
20995 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20996 self.network = std::option::Option::Some(
20997 crate::model::execution_config::Network::SubnetworkUri(v.into()),
20998 );
20999 self
21000 }
21001}
21002
21003impl wkt::message::Message for ExecutionConfig {
21004 fn typename() -> &'static str {
21005 "type.googleapis.com/google.cloud.dataproc.v1.ExecutionConfig"
21006 }
21007}
21008
21009/// Defines additional types related to [ExecutionConfig].
21010pub mod execution_config {
21011 #[allow(unused_imports)]
21012 use super::*;
21013
21014 /// Network configuration for workload execution.
21015 #[derive(Clone, Debug, PartialEq)]
21016 #[non_exhaustive]
21017 pub enum Network {
21018 /// Optional. Network URI to connect workload to.
21019 NetworkUri(std::string::String),
21020 /// Optional. Subnetwork URI to connect workload to.
21021 SubnetworkUri(std::string::String),
21022 }
21023}
21024
21025/// Spark History Server configuration for the workload.
21026#[derive(Clone, Default, PartialEq)]
21027#[non_exhaustive]
21028pub struct SparkHistoryServerConfig {
21029 /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark
21030 /// History Server for the workload.
21031 ///
21032 /// Example:
21033 ///
21034 /// * `projects/[project_id]/regions/[region]/clusters/[cluster_name]`
21035 pub dataproc_cluster: std::string::String,
21036
21037 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21038}
21039
21040impl SparkHistoryServerConfig {
21041 /// Creates a new default instance.
21042 pub fn new() -> Self {
21043 std::default::Default::default()
21044 }
21045
21046 /// Sets the value of [dataproc_cluster][crate::model::SparkHistoryServerConfig::dataproc_cluster].
21047 ///
21048 /// # Example
21049 /// ```ignore,no_run
21050 /// # use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
21051 /// let x = SparkHistoryServerConfig::new().set_dataproc_cluster("example");
21052 /// ```
21053 pub fn set_dataproc_cluster<T: std::convert::Into<std::string::String>>(
21054 mut self,
21055 v: T,
21056 ) -> Self {
21057 self.dataproc_cluster = v.into();
21058 self
21059 }
21060}
21061
21062impl wkt::message::Message for SparkHistoryServerConfig {
21063 fn typename() -> &'static str {
21064 "type.googleapis.com/google.cloud.dataproc.v1.SparkHistoryServerConfig"
21065 }
21066}
21067
21068/// Auxiliary services configuration for a workload.
21069#[derive(Clone, Default, PartialEq)]
21070#[non_exhaustive]
21071pub struct PeripheralsConfig {
21072 /// Optional. Resource name of an existing Dataproc Metastore service.
21073 ///
21074 /// Example:
21075 ///
21076 /// * `projects/[project_id]/locations/[region]/services/[service_id]`
21077 pub metastore_service: std::string::String,
21078
21079 /// Optional. The Spark History Server configuration for the workload.
21080 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
21081
21082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21083}
21084
21085impl PeripheralsConfig {
21086 /// Creates a new default instance.
21087 pub fn new() -> Self {
21088 std::default::Default::default()
21089 }
21090
21091 /// Sets the value of [metastore_service][crate::model::PeripheralsConfig::metastore_service].
21092 ///
21093 /// # Example
21094 /// ```ignore,no_run
21095 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
21096 /// let x = PeripheralsConfig::new().set_metastore_service("example");
21097 /// ```
21098 pub fn set_metastore_service<T: std::convert::Into<std::string::String>>(
21099 mut self,
21100 v: T,
21101 ) -> Self {
21102 self.metastore_service = v.into();
21103 self
21104 }
21105
21106 /// Sets the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
21107 ///
21108 /// # Example
21109 /// ```ignore,no_run
21110 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
21111 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
21112 /// let x = PeripheralsConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
21113 /// ```
21114 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
21115 where
21116 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
21117 {
21118 self.spark_history_server_config = std::option::Option::Some(v.into());
21119 self
21120 }
21121
21122 /// Sets or clears the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
21123 ///
21124 /// # Example
21125 /// ```ignore,no_run
21126 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
21127 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
21128 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
21129 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
21130 /// ```
21131 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
21132 where
21133 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
21134 {
21135 self.spark_history_server_config = v.map(|x| x.into());
21136 self
21137 }
21138}
21139
21140impl wkt::message::Message for PeripheralsConfig {
21141 fn typename() -> &'static str {
21142 "type.googleapis.com/google.cloud.dataproc.v1.PeripheralsConfig"
21143 }
21144}
21145
21146/// Runtime information about workload execution.
21147#[derive(Clone, Default, PartialEq)]
21148#[non_exhaustive]
21149pub struct RuntimeInfo {
21150 /// Output only. Map of remote access endpoints (such as web interfaces and
21151 /// APIs) to their URIs.
21152 pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
21153
21154 /// Output only. A URI pointing to the location of the stdout and stderr of the
21155 /// workload.
21156 pub output_uri: std::string::String,
21157
21158 /// Output only. A URI pointing to the location of the diagnostics tarball.
21159 pub diagnostic_output_uri: std::string::String,
21160
21161 /// Output only. Approximate workload resource usage, calculated when
21162 /// the workload completes (see [Dataproc Serverless pricing]
21163 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21164 ///
21165 /// **Note:** This metric calculation may change in the future, for
21166 /// example, to capture cumulative workload resource
21167 /// consumption during workload execution (see the
21168 /// [Dataproc Serverless release notes]
21169 /// (<https://cloud.google.com/dataproc-serverless/docs/release-notes>)
21170 /// for announcements, changes, fixes
21171 /// and other Dataproc developments).
21172 pub approximate_usage: std::option::Option<crate::model::UsageMetrics>,
21173
21174 /// Output only. Snapshot of current workload resource usage.
21175 pub current_usage: std::option::Option<crate::model::UsageSnapshot>,
21176
21177 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21178}
21179
21180impl RuntimeInfo {
21181 /// Creates a new default instance.
21182 pub fn new() -> Self {
21183 std::default::Default::default()
21184 }
21185
21186 /// Sets the value of [endpoints][crate::model::RuntimeInfo::endpoints].
21187 ///
21188 /// # Example
21189 /// ```ignore,no_run
21190 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21191 /// let x = RuntimeInfo::new().set_endpoints([
21192 /// ("key0", "abc"),
21193 /// ("key1", "xyz"),
21194 /// ]);
21195 /// ```
21196 pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
21197 where
21198 T: std::iter::IntoIterator<Item = (K, V)>,
21199 K: std::convert::Into<std::string::String>,
21200 V: std::convert::Into<std::string::String>,
21201 {
21202 use std::iter::Iterator;
21203 self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21204 self
21205 }
21206
21207 /// Sets the value of [output_uri][crate::model::RuntimeInfo::output_uri].
21208 ///
21209 /// # Example
21210 /// ```ignore,no_run
21211 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21212 /// let x = RuntimeInfo::new().set_output_uri("example");
21213 /// ```
21214 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21215 self.output_uri = v.into();
21216 self
21217 }
21218
21219 /// Sets the value of [diagnostic_output_uri][crate::model::RuntimeInfo::diagnostic_output_uri].
21220 ///
21221 /// # Example
21222 /// ```ignore,no_run
21223 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21224 /// let x = RuntimeInfo::new().set_diagnostic_output_uri("example");
21225 /// ```
21226 pub fn set_diagnostic_output_uri<T: std::convert::Into<std::string::String>>(
21227 mut self,
21228 v: T,
21229 ) -> Self {
21230 self.diagnostic_output_uri = v.into();
21231 self
21232 }
21233
21234 /// Sets the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
21235 ///
21236 /// # Example
21237 /// ```ignore,no_run
21238 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21239 /// use google_cloud_dataproc_v1::model::UsageMetrics;
21240 /// let x = RuntimeInfo::new().set_approximate_usage(UsageMetrics::default()/* use setters */);
21241 /// ```
21242 pub fn set_approximate_usage<T>(mut self, v: T) -> Self
21243 where
21244 T: std::convert::Into<crate::model::UsageMetrics>,
21245 {
21246 self.approximate_usage = std::option::Option::Some(v.into());
21247 self
21248 }
21249
21250 /// Sets or clears the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
21251 ///
21252 /// # Example
21253 /// ```ignore,no_run
21254 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21255 /// use google_cloud_dataproc_v1::model::UsageMetrics;
21256 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(Some(UsageMetrics::default()/* use setters */));
21257 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(None::<UsageMetrics>);
21258 /// ```
21259 pub fn set_or_clear_approximate_usage<T>(mut self, v: std::option::Option<T>) -> Self
21260 where
21261 T: std::convert::Into<crate::model::UsageMetrics>,
21262 {
21263 self.approximate_usage = v.map(|x| x.into());
21264 self
21265 }
21266
21267 /// Sets the value of [current_usage][crate::model::RuntimeInfo::current_usage].
21268 ///
21269 /// # Example
21270 /// ```ignore,no_run
21271 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21272 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
21273 /// let x = RuntimeInfo::new().set_current_usage(UsageSnapshot::default()/* use setters */);
21274 /// ```
21275 pub fn set_current_usage<T>(mut self, v: T) -> Self
21276 where
21277 T: std::convert::Into<crate::model::UsageSnapshot>,
21278 {
21279 self.current_usage = std::option::Option::Some(v.into());
21280 self
21281 }
21282
21283 /// Sets or clears the value of [current_usage][crate::model::RuntimeInfo::current_usage].
21284 ///
21285 /// # Example
21286 /// ```ignore,no_run
21287 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
21288 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
21289 /// let x = RuntimeInfo::new().set_or_clear_current_usage(Some(UsageSnapshot::default()/* use setters */));
21290 /// let x = RuntimeInfo::new().set_or_clear_current_usage(None::<UsageSnapshot>);
21291 /// ```
21292 pub fn set_or_clear_current_usage<T>(mut self, v: std::option::Option<T>) -> Self
21293 where
21294 T: std::convert::Into<crate::model::UsageSnapshot>,
21295 {
21296 self.current_usage = v.map(|x| x.into());
21297 self
21298 }
21299}
21300
21301impl wkt::message::Message for RuntimeInfo {
21302 fn typename() -> &'static str {
21303 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeInfo"
21304 }
21305}
21306
21307/// Usage metrics represent approximate total resources consumed by a workload.
21308#[derive(Clone, Default, PartialEq)]
21309#[non_exhaustive]
21310pub struct UsageMetrics {
21311 /// Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`)
21312 /// (see [Dataproc Serverless pricing]
21313 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21314 pub milli_dcu_seconds: i64,
21315
21316 /// Optional. Shuffle storage usage in (`GB` x `seconds`) (see
21317 /// [Dataproc Serverless pricing]
21318 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21319 pub shuffle_storage_gb_seconds: i64,
21320
21321 /// Optional. [DEPRECATED] Accelerator usage in (`milliAccelerator` x
21322 /// `seconds`) (see [Dataproc Serverless pricing]
21323 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21324 pub milli_accelerator_seconds: i64,
21325
21326 /// Optional. [DEPRECATED] Accelerator type being used, if any
21327 pub accelerator_type: std::string::String,
21328
21329 /// Optional. The timestamp of the usage metrics.
21330 pub update_time: std::option::Option<wkt::Timestamp>,
21331
21332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21333}
21334
21335impl UsageMetrics {
21336 /// Creates a new default instance.
21337 pub fn new() -> Self {
21338 std::default::Default::default()
21339 }
21340
21341 /// Sets the value of [milli_dcu_seconds][crate::model::UsageMetrics::milli_dcu_seconds].
21342 ///
21343 /// # Example
21344 /// ```ignore,no_run
21345 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21346 /// let x = UsageMetrics::new().set_milli_dcu_seconds(42);
21347 /// ```
21348 pub fn set_milli_dcu_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21349 self.milli_dcu_seconds = v.into();
21350 self
21351 }
21352
21353 /// Sets the value of [shuffle_storage_gb_seconds][crate::model::UsageMetrics::shuffle_storage_gb_seconds].
21354 ///
21355 /// # Example
21356 /// ```ignore,no_run
21357 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21358 /// let x = UsageMetrics::new().set_shuffle_storage_gb_seconds(42);
21359 /// ```
21360 pub fn set_shuffle_storage_gb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21361 self.shuffle_storage_gb_seconds = v.into();
21362 self
21363 }
21364
21365 /// Sets the value of [milli_accelerator_seconds][crate::model::UsageMetrics::milli_accelerator_seconds].
21366 ///
21367 /// # Example
21368 /// ```ignore,no_run
21369 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21370 /// let x = UsageMetrics::new().set_milli_accelerator_seconds(42);
21371 /// ```
21372 pub fn set_milli_accelerator_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21373 self.milli_accelerator_seconds = v.into();
21374 self
21375 }
21376
21377 /// Sets the value of [accelerator_type][crate::model::UsageMetrics::accelerator_type].
21378 ///
21379 /// # Example
21380 /// ```ignore,no_run
21381 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21382 /// let x = UsageMetrics::new().set_accelerator_type("example");
21383 /// ```
21384 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21385 mut self,
21386 v: T,
21387 ) -> Self {
21388 self.accelerator_type = v.into();
21389 self
21390 }
21391
21392 /// Sets the value of [update_time][crate::model::UsageMetrics::update_time].
21393 ///
21394 /// # Example
21395 /// ```ignore,no_run
21396 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21397 /// use wkt::Timestamp;
21398 /// let x = UsageMetrics::new().set_update_time(Timestamp::default()/* use setters */);
21399 /// ```
21400 pub fn set_update_time<T>(mut self, v: T) -> Self
21401 where
21402 T: std::convert::Into<wkt::Timestamp>,
21403 {
21404 self.update_time = std::option::Option::Some(v.into());
21405 self
21406 }
21407
21408 /// Sets or clears the value of [update_time][crate::model::UsageMetrics::update_time].
21409 ///
21410 /// # Example
21411 /// ```ignore,no_run
21412 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
21413 /// use wkt::Timestamp;
21414 /// let x = UsageMetrics::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
21415 /// let x = UsageMetrics::new().set_or_clear_update_time(None::<Timestamp>);
21416 /// ```
21417 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
21418 where
21419 T: std::convert::Into<wkt::Timestamp>,
21420 {
21421 self.update_time = v.map(|x| x.into());
21422 self
21423 }
21424}
21425
21426impl wkt::message::Message for UsageMetrics {
21427 fn typename() -> &'static str {
21428 "type.googleapis.com/google.cloud.dataproc.v1.UsageMetrics"
21429 }
21430}
21431
21432/// The usage snapshot represents the resources consumed by a workload at a
21433/// specified time.
21434#[derive(Clone, Default, PartialEq)]
21435#[non_exhaustive]
21436pub struct UsageSnapshot {
21437 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see
21438 /// [Dataproc Serverless pricing]
21439 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21440 pub milli_dcu: i64,
21441
21442 /// Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless
21443 /// pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
21444 pub shuffle_storage_gb: i64,
21445
21446 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at
21447 /// premium tier (see [Dataproc Serverless pricing]
21448 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
21449 pub milli_dcu_premium: i64,
21450
21451 /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see
21452 /// [Dataproc Serverless pricing]
21453 /// (<https://cloud.google.com/dataproc-serverless/pricing>))
21454 pub shuffle_storage_gb_premium: i64,
21455
21456 /// Optional. Milli (one-thousandth) accelerator. (see [Dataproc
21457 /// Serverless pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
21458 pub milli_accelerator: i64,
21459
21460 /// Optional. Accelerator type being used, if any
21461 pub accelerator_type: std::string::String,
21462
21463 /// Optional. The timestamp of the usage snapshot.
21464 pub snapshot_time: std::option::Option<wkt::Timestamp>,
21465
21466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21467}
21468
21469impl UsageSnapshot {
21470 /// Creates a new default instance.
21471 pub fn new() -> Self {
21472 std::default::Default::default()
21473 }
21474
21475 /// Sets the value of [milli_dcu][crate::model::UsageSnapshot::milli_dcu].
21476 ///
21477 /// # Example
21478 /// ```ignore,no_run
21479 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21480 /// let x = UsageSnapshot::new().set_milli_dcu(42);
21481 /// ```
21482 pub fn set_milli_dcu<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21483 self.milli_dcu = v.into();
21484 self
21485 }
21486
21487 /// Sets the value of [shuffle_storage_gb][crate::model::UsageSnapshot::shuffle_storage_gb].
21488 ///
21489 /// # Example
21490 /// ```ignore,no_run
21491 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21492 /// let x = UsageSnapshot::new().set_shuffle_storage_gb(42);
21493 /// ```
21494 pub fn set_shuffle_storage_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21495 self.shuffle_storage_gb = v.into();
21496 self
21497 }
21498
21499 /// Sets the value of [milli_dcu_premium][crate::model::UsageSnapshot::milli_dcu_premium].
21500 ///
21501 /// # Example
21502 /// ```ignore,no_run
21503 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21504 /// let x = UsageSnapshot::new().set_milli_dcu_premium(42);
21505 /// ```
21506 pub fn set_milli_dcu_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21507 self.milli_dcu_premium = v.into();
21508 self
21509 }
21510
21511 /// Sets the value of [shuffle_storage_gb_premium][crate::model::UsageSnapshot::shuffle_storage_gb_premium].
21512 ///
21513 /// # Example
21514 /// ```ignore,no_run
21515 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21516 /// let x = UsageSnapshot::new().set_shuffle_storage_gb_premium(42);
21517 /// ```
21518 pub fn set_shuffle_storage_gb_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21519 self.shuffle_storage_gb_premium = v.into();
21520 self
21521 }
21522
21523 /// Sets the value of [milli_accelerator][crate::model::UsageSnapshot::milli_accelerator].
21524 ///
21525 /// # Example
21526 /// ```ignore,no_run
21527 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21528 /// let x = UsageSnapshot::new().set_milli_accelerator(42);
21529 /// ```
21530 pub fn set_milli_accelerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21531 self.milli_accelerator = v.into();
21532 self
21533 }
21534
21535 /// Sets the value of [accelerator_type][crate::model::UsageSnapshot::accelerator_type].
21536 ///
21537 /// # Example
21538 /// ```ignore,no_run
21539 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21540 /// let x = UsageSnapshot::new().set_accelerator_type("example");
21541 /// ```
21542 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21543 mut self,
21544 v: T,
21545 ) -> Self {
21546 self.accelerator_type = v.into();
21547 self
21548 }
21549
21550 /// Sets the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
21551 ///
21552 /// # Example
21553 /// ```ignore,no_run
21554 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21555 /// use wkt::Timestamp;
21556 /// let x = UsageSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
21557 /// ```
21558 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
21559 where
21560 T: std::convert::Into<wkt::Timestamp>,
21561 {
21562 self.snapshot_time = std::option::Option::Some(v.into());
21563 self
21564 }
21565
21566 /// Sets or clears the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
21567 ///
21568 /// # Example
21569 /// ```ignore,no_run
21570 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
21571 /// use wkt::Timestamp;
21572 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
21573 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
21574 /// ```
21575 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
21576 where
21577 T: std::convert::Into<wkt::Timestamp>,
21578 {
21579 self.snapshot_time = v.map(|x| x.into());
21580 self
21581 }
21582}
21583
21584impl wkt::message::Message for UsageSnapshot {
21585 fn typename() -> &'static str {
21586 "type.googleapis.com/google.cloud.dataproc.v1.UsageSnapshot"
21587 }
21588}
21589
21590/// The cluster's GKE config.
21591#[derive(Clone, Default, PartialEq)]
21592#[non_exhaustive]
21593pub struct GkeClusterConfig {
21594 /// Optional. A target GKE cluster to deploy to. It must be in the same project
21595 /// and region as the Dataproc cluster (the GKE cluster can be zonal or
21596 /// regional). Format:
21597 /// 'projects/{project}/locations/{location}/clusters/{cluster_id}'
21598 pub gke_cluster_target: std::string::String,
21599
21600 /// Optional. GKE node pools where workloads will be scheduled. At least one
21601 /// node pool must be assigned the `DEFAULT`
21602 /// [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role].
21603 /// If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT`
21604 /// `GkeNodePoolTarget`. Each role can be given to only one
21605 /// `GkeNodePoolTarget`. All node pools must have the same location settings.
21606 ///
21607 /// [google.cloud.dataproc.v1.GkeNodePoolTarget.Role]: crate::model::gke_node_pool_target::Role
21608 pub node_pool_target: std::vec::Vec<crate::model::GkeNodePoolTarget>,
21609
21610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21611}
21612
21613impl GkeClusterConfig {
21614 /// Creates a new default instance.
21615 pub fn new() -> Self {
21616 std::default::Default::default()
21617 }
21618
21619 /// Sets the value of [gke_cluster_target][crate::model::GkeClusterConfig::gke_cluster_target].
21620 ///
21621 /// # Example
21622 /// ```ignore,no_run
21623 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
21624 /// let x = GkeClusterConfig::new().set_gke_cluster_target("example");
21625 /// ```
21626 pub fn set_gke_cluster_target<T: std::convert::Into<std::string::String>>(
21627 mut self,
21628 v: T,
21629 ) -> Self {
21630 self.gke_cluster_target = v.into();
21631 self
21632 }
21633
21634 /// Sets the value of [node_pool_target][crate::model::GkeClusterConfig::node_pool_target].
21635 ///
21636 /// # Example
21637 /// ```ignore,no_run
21638 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
21639 /// use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21640 /// let x = GkeClusterConfig::new()
21641 /// .set_node_pool_target([
21642 /// GkeNodePoolTarget::default()/* use setters */,
21643 /// GkeNodePoolTarget::default()/* use (different) setters */,
21644 /// ]);
21645 /// ```
21646 pub fn set_node_pool_target<T, V>(mut self, v: T) -> Self
21647 where
21648 T: std::iter::IntoIterator<Item = V>,
21649 V: std::convert::Into<crate::model::GkeNodePoolTarget>,
21650 {
21651 use std::iter::Iterator;
21652 self.node_pool_target = v.into_iter().map(|i| i.into()).collect();
21653 self
21654 }
21655}
21656
21657impl wkt::message::Message for GkeClusterConfig {
21658 fn typename() -> &'static str {
21659 "type.googleapis.com/google.cloud.dataproc.v1.GkeClusterConfig"
21660 }
21661}
21662
21663/// The configuration for running the Dataproc cluster on Kubernetes.
21664#[derive(Clone, Default, PartialEq)]
21665#[non_exhaustive]
21666pub struct KubernetesClusterConfig {
21667 /// Optional. A namespace within the Kubernetes cluster to deploy into. If this
21668 /// namespace does not exist, it is created. If it exists, Dataproc verifies
21669 /// that another Dataproc VirtualCluster is not installed into it. If not
21670 /// specified, the name of the Dataproc Cluster is used.
21671 pub kubernetes_namespace: std::string::String,
21672
21673 /// Optional. The software configuration for this Dataproc cluster running on
21674 /// Kubernetes.
21675 pub kubernetes_software_config: std::option::Option<crate::model::KubernetesSoftwareConfig>,
21676
21677 #[allow(missing_docs)]
21678 pub config: std::option::Option<crate::model::kubernetes_cluster_config::Config>,
21679
21680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21681}
21682
21683impl KubernetesClusterConfig {
21684 /// Creates a new default instance.
21685 pub fn new() -> Self {
21686 std::default::Default::default()
21687 }
21688
21689 /// Sets the value of [kubernetes_namespace][crate::model::KubernetesClusterConfig::kubernetes_namespace].
21690 ///
21691 /// # Example
21692 /// ```ignore,no_run
21693 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21694 /// let x = KubernetesClusterConfig::new().set_kubernetes_namespace("example");
21695 /// ```
21696 pub fn set_kubernetes_namespace<T: std::convert::Into<std::string::String>>(
21697 mut self,
21698 v: T,
21699 ) -> Self {
21700 self.kubernetes_namespace = v.into();
21701 self
21702 }
21703
21704 /// Sets the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
21705 ///
21706 /// # Example
21707 /// ```ignore,no_run
21708 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21709 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21710 /// let x = KubernetesClusterConfig::new().set_kubernetes_software_config(KubernetesSoftwareConfig::default()/* use setters */);
21711 /// ```
21712 pub fn set_kubernetes_software_config<T>(mut self, v: T) -> Self
21713 where
21714 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
21715 {
21716 self.kubernetes_software_config = std::option::Option::Some(v.into());
21717 self
21718 }
21719
21720 /// Sets or clears the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
21721 ///
21722 /// # Example
21723 /// ```ignore,no_run
21724 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21725 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21726 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(Some(KubernetesSoftwareConfig::default()/* use setters */));
21727 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(None::<KubernetesSoftwareConfig>);
21728 /// ```
21729 pub fn set_or_clear_kubernetes_software_config<T>(mut self, v: std::option::Option<T>) -> Self
21730 where
21731 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
21732 {
21733 self.kubernetes_software_config = v.map(|x| x.into());
21734 self
21735 }
21736
21737 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config].
21738 ///
21739 /// Note that all the setters affecting `config` are mutually
21740 /// exclusive.
21741 ///
21742 /// # Example
21743 /// ```ignore,no_run
21744 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21745 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
21746 /// let x = KubernetesClusterConfig::new().set_config(Some(
21747 /// google_cloud_dataproc_v1::model::kubernetes_cluster_config::Config::GkeClusterConfig(GkeClusterConfig::default().into())));
21748 /// ```
21749 pub fn set_config<
21750 T: std::convert::Into<std::option::Option<crate::model::kubernetes_cluster_config::Config>>,
21751 >(
21752 mut self,
21753 v: T,
21754 ) -> Self {
21755 self.config = v.into();
21756 self
21757 }
21758
21759 /// The value of [config][crate::model::KubernetesClusterConfig::config]
21760 /// if it holds a `GkeClusterConfig`, `None` if the field is not set or
21761 /// holds a different branch.
21762 pub fn gke_cluster_config(
21763 &self,
21764 ) -> std::option::Option<&std::boxed::Box<crate::model::GkeClusterConfig>> {
21765 #[allow(unreachable_patterns)]
21766 self.config.as_ref().and_then(|v| match v {
21767 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v) => {
21768 std::option::Option::Some(v)
21769 }
21770 _ => std::option::Option::None,
21771 })
21772 }
21773
21774 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config]
21775 /// to hold a `GkeClusterConfig`.
21776 ///
21777 /// Note that all the setters affecting `config` are
21778 /// mutually exclusive.
21779 ///
21780 /// # Example
21781 /// ```ignore,no_run
21782 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
21783 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
21784 /// let x = KubernetesClusterConfig::new().set_gke_cluster_config(GkeClusterConfig::default()/* use setters */);
21785 /// assert!(x.gke_cluster_config().is_some());
21786 /// ```
21787 pub fn set_gke_cluster_config<
21788 T: std::convert::Into<std::boxed::Box<crate::model::GkeClusterConfig>>,
21789 >(
21790 mut self,
21791 v: T,
21792 ) -> Self {
21793 self.config = std::option::Option::Some(
21794 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v.into()),
21795 );
21796 self
21797 }
21798}
21799
21800impl wkt::message::Message for KubernetesClusterConfig {
21801 fn typename() -> &'static str {
21802 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesClusterConfig"
21803 }
21804}
21805
21806/// Defines additional types related to [KubernetesClusterConfig].
21807pub mod kubernetes_cluster_config {
21808 #[allow(unused_imports)]
21809 use super::*;
21810
21811 #[allow(missing_docs)]
21812 #[derive(Clone, Debug, PartialEq)]
21813 #[non_exhaustive]
21814 pub enum Config {
21815 /// Required. The configuration for running the Dataproc cluster on GKE.
21816 GkeClusterConfig(std::boxed::Box<crate::model::GkeClusterConfig>),
21817 }
21818}
21819
21820/// The software configuration for this Dataproc cluster running on Kubernetes.
21821#[derive(Clone, Default, PartialEq)]
21822#[non_exhaustive]
21823pub struct KubernetesSoftwareConfig {
21824 /// The components that should be installed in this Dataproc cluster. The key
21825 /// must be a string from the KubernetesComponent enumeration. The value is
21826 /// the version of the software to be installed.
21827 /// At least one entry must be specified.
21828 pub component_version: std::collections::HashMap<std::string::String, std::string::String>,
21829
21830 /// The properties to set on daemon config files.
21831 ///
21832 /// Property keys are specified in `prefix:property` format, for example
21833 /// `spark:spark.kubernetes.container.image`. The following are supported
21834 /// prefixes and their mappings:
21835 ///
21836 /// * spark: `spark-defaults.conf`
21837 ///
21838 /// For more information, see [Cluster
21839 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
21840 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
21841
21842 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21843}
21844
21845impl KubernetesSoftwareConfig {
21846 /// Creates a new default instance.
21847 pub fn new() -> Self {
21848 std::default::Default::default()
21849 }
21850
21851 /// Sets the value of [component_version][crate::model::KubernetesSoftwareConfig::component_version].
21852 ///
21853 /// # Example
21854 /// ```ignore,no_run
21855 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21856 /// let x = KubernetesSoftwareConfig::new().set_component_version([
21857 /// ("key0", "abc"),
21858 /// ("key1", "xyz"),
21859 /// ]);
21860 /// ```
21861 pub fn set_component_version<T, K, V>(mut self, v: T) -> Self
21862 where
21863 T: std::iter::IntoIterator<Item = (K, V)>,
21864 K: std::convert::Into<std::string::String>,
21865 V: std::convert::Into<std::string::String>,
21866 {
21867 use std::iter::Iterator;
21868 self.component_version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21869 self
21870 }
21871
21872 /// Sets the value of [properties][crate::model::KubernetesSoftwareConfig::properties].
21873 ///
21874 /// # Example
21875 /// ```ignore,no_run
21876 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21877 /// let x = KubernetesSoftwareConfig::new().set_properties([
21878 /// ("key0", "abc"),
21879 /// ("key1", "xyz"),
21880 /// ]);
21881 /// ```
21882 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
21883 where
21884 T: std::iter::IntoIterator<Item = (K, V)>,
21885 K: std::convert::Into<std::string::String>,
21886 V: std::convert::Into<std::string::String>,
21887 {
21888 use std::iter::Iterator;
21889 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21890 self
21891 }
21892}
21893
21894impl wkt::message::Message for KubernetesSoftwareConfig {
21895 fn typename() -> &'static str {
21896 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesSoftwareConfig"
21897 }
21898}
21899
21900/// GKE node pools that Dataproc workloads run on.
21901#[derive(Clone, Default, PartialEq)]
21902#[non_exhaustive]
21903pub struct GkeNodePoolTarget {
21904 /// Required. The target GKE node pool.
21905 /// Format:
21906 /// 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
21907 pub node_pool: std::string::String,
21908
21909 /// Required. The roles associated with the GKE node pool.
21910 pub roles: std::vec::Vec<crate::model::gke_node_pool_target::Role>,
21911
21912 /// Input only. The configuration for the GKE node pool.
21913 ///
21914 /// If specified, Dataproc attempts to create a node pool with the
21915 /// specified shape. If one with the same name already exists, it is
21916 /// verified against all specified fields. If a field differs, the
21917 /// virtual cluster creation will fail.
21918 ///
21919 /// If omitted, any node pool with the specified name is used. If a
21920 /// node pool with the specified name does not exist, Dataproc create a
21921 /// node pool with default values.
21922 ///
21923 /// This is an input only field. It will not be returned by the API.
21924 pub node_pool_config: std::option::Option<crate::model::GkeNodePoolConfig>,
21925
21926 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21927}
21928
21929impl GkeNodePoolTarget {
21930 /// Creates a new default instance.
21931 pub fn new() -> Self {
21932 std::default::Default::default()
21933 }
21934
21935 /// Sets the value of [node_pool][crate::model::GkeNodePoolTarget::node_pool].
21936 ///
21937 /// # Example
21938 /// ```ignore,no_run
21939 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21940 /// let x = GkeNodePoolTarget::new().set_node_pool("example");
21941 /// ```
21942 pub fn set_node_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21943 self.node_pool = v.into();
21944 self
21945 }
21946
21947 /// Sets the value of [roles][crate::model::GkeNodePoolTarget::roles].
21948 ///
21949 /// # Example
21950 /// ```ignore,no_run
21951 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21952 /// use google_cloud_dataproc_v1::model::gke_node_pool_target::Role;
21953 /// let x = GkeNodePoolTarget::new().set_roles([
21954 /// Role::Default,
21955 /// Role::Controller,
21956 /// Role::SparkDriver,
21957 /// ]);
21958 /// ```
21959 pub fn set_roles<T, V>(mut self, v: T) -> Self
21960 where
21961 T: std::iter::IntoIterator<Item = V>,
21962 V: std::convert::Into<crate::model::gke_node_pool_target::Role>,
21963 {
21964 use std::iter::Iterator;
21965 self.roles = v.into_iter().map(|i| i.into()).collect();
21966 self
21967 }
21968
21969 /// Sets the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21970 ///
21971 /// # Example
21972 /// ```ignore,no_run
21973 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21974 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21975 /// let x = GkeNodePoolTarget::new().set_node_pool_config(GkeNodePoolConfig::default()/* use setters */);
21976 /// ```
21977 pub fn set_node_pool_config<T>(mut self, v: T) -> Self
21978 where
21979 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21980 {
21981 self.node_pool_config = std::option::Option::Some(v.into());
21982 self
21983 }
21984
21985 /// Sets or clears the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21986 ///
21987 /// # Example
21988 /// ```ignore,no_run
21989 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21990 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21991 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(Some(GkeNodePoolConfig::default()/* use setters */));
21992 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(None::<GkeNodePoolConfig>);
21993 /// ```
21994 pub fn set_or_clear_node_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
21995 where
21996 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21997 {
21998 self.node_pool_config = v.map(|x| x.into());
21999 self
22000 }
22001}
22002
22003impl wkt::message::Message for GkeNodePoolTarget {
22004 fn typename() -> &'static str {
22005 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolTarget"
22006 }
22007}
22008
22009/// Defines additional types related to [GkeNodePoolTarget].
22010pub mod gke_node_pool_target {
22011 #[allow(unused_imports)]
22012 use super::*;
22013
22014 /// `Role` specifies the tasks that will run on the node pool. Roles can be
22015 /// specific to workloads. Exactly one
22016 /// [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the
22017 /// virtual cluster must have the `DEFAULT` role, which is used to run all
22018 /// workloads that are not associated with a node pool.
22019 ///
22020 /// [google.cloud.dataproc.v1.GkeNodePoolTarget]: crate::model::GkeNodePoolTarget
22021 ///
22022 /// # Working with unknown values
22023 ///
22024 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22025 /// additional enum variants at any time. Adding new variants is not considered
22026 /// a breaking change. Applications should write their code in anticipation of:
22027 ///
22028 /// - New values appearing in future releases of the client library, **and**
22029 /// - New values received dynamically, without application changes.
22030 ///
22031 /// Please consult the [Working with enums] section in the user guide for some
22032 /// guidelines.
22033 ///
22034 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22035 #[derive(Clone, Debug, PartialEq)]
22036 #[non_exhaustive]
22037 pub enum Role {
22038 /// Role is unspecified.
22039 Unspecified,
22040 /// At least one node pool must have the `DEFAULT` role.
22041 /// Work assigned to a role that is not associated with a node pool
22042 /// is assigned to the node pool with the `DEFAULT` role. For example,
22043 /// work assigned to the `CONTROLLER` role will be assigned to the node pool
22044 /// with the `DEFAULT` role if no node pool has the `CONTROLLER` role.
22045 Default,
22046 /// Run work associated with the Dataproc control plane (for example,
22047 /// controllers and webhooks). Very low resource requirements.
22048 Controller,
22049 /// Run work associated with a Spark driver of a job.
22050 SparkDriver,
22051 /// Run work associated with a Spark executor of a job.
22052 SparkExecutor,
22053 /// If set, the enum was initialized with an unknown value.
22054 ///
22055 /// Applications can examine the value using [Role::value] or
22056 /// [Role::name].
22057 UnknownValue(role::UnknownValue),
22058 }
22059
22060 #[doc(hidden)]
22061 pub mod role {
22062 #[allow(unused_imports)]
22063 use super::*;
22064 #[derive(Clone, Debug, PartialEq)]
22065 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22066 }
22067
22068 impl Role {
22069 /// Gets the enum value.
22070 ///
22071 /// Returns `None` if the enum contains an unknown value deserialized from
22072 /// the string representation of enums.
22073 pub fn value(&self) -> std::option::Option<i32> {
22074 match self {
22075 Self::Unspecified => std::option::Option::Some(0),
22076 Self::Default => std::option::Option::Some(1),
22077 Self::Controller => std::option::Option::Some(2),
22078 Self::SparkDriver => std::option::Option::Some(3),
22079 Self::SparkExecutor => std::option::Option::Some(4),
22080 Self::UnknownValue(u) => u.0.value(),
22081 }
22082 }
22083
22084 /// Gets the enum value as a string.
22085 ///
22086 /// Returns `None` if the enum contains an unknown value deserialized from
22087 /// the integer representation of enums.
22088 pub fn name(&self) -> std::option::Option<&str> {
22089 match self {
22090 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
22091 Self::Default => std::option::Option::Some("DEFAULT"),
22092 Self::Controller => std::option::Option::Some("CONTROLLER"),
22093 Self::SparkDriver => std::option::Option::Some("SPARK_DRIVER"),
22094 Self::SparkExecutor => std::option::Option::Some("SPARK_EXECUTOR"),
22095 Self::UnknownValue(u) => u.0.name(),
22096 }
22097 }
22098 }
22099
22100 impl std::default::Default for Role {
22101 fn default() -> Self {
22102 use std::convert::From;
22103 Self::from(0)
22104 }
22105 }
22106
22107 impl std::fmt::Display for Role {
22108 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22109 wkt::internal::display_enum(f, self.name(), self.value())
22110 }
22111 }
22112
22113 impl std::convert::From<i32> for Role {
22114 fn from(value: i32) -> Self {
22115 match value {
22116 0 => Self::Unspecified,
22117 1 => Self::Default,
22118 2 => Self::Controller,
22119 3 => Self::SparkDriver,
22120 4 => Self::SparkExecutor,
22121 _ => Self::UnknownValue(role::UnknownValue(
22122 wkt::internal::UnknownEnumValue::Integer(value),
22123 )),
22124 }
22125 }
22126 }
22127
22128 impl std::convert::From<&str> for Role {
22129 fn from(value: &str) -> Self {
22130 use std::string::ToString;
22131 match value {
22132 "ROLE_UNSPECIFIED" => Self::Unspecified,
22133 "DEFAULT" => Self::Default,
22134 "CONTROLLER" => Self::Controller,
22135 "SPARK_DRIVER" => Self::SparkDriver,
22136 "SPARK_EXECUTOR" => Self::SparkExecutor,
22137 _ => Self::UnknownValue(role::UnknownValue(
22138 wkt::internal::UnknownEnumValue::String(value.to_string()),
22139 )),
22140 }
22141 }
22142 }
22143
22144 impl serde::ser::Serialize for Role {
22145 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22146 where
22147 S: serde::Serializer,
22148 {
22149 match self {
22150 Self::Unspecified => serializer.serialize_i32(0),
22151 Self::Default => serializer.serialize_i32(1),
22152 Self::Controller => serializer.serialize_i32(2),
22153 Self::SparkDriver => serializer.serialize_i32(3),
22154 Self::SparkExecutor => serializer.serialize_i32(4),
22155 Self::UnknownValue(u) => u.0.serialize(serializer),
22156 }
22157 }
22158 }
22159
22160 impl<'de> serde::de::Deserialize<'de> for Role {
22161 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22162 where
22163 D: serde::Deserializer<'de>,
22164 {
22165 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
22166 ".google.cloud.dataproc.v1.GkeNodePoolTarget.Role",
22167 ))
22168 }
22169 }
22170}
22171
22172/// The configuration of a GKE node pool used by a [Dataproc-on-GKE
22173/// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
22174#[derive(Clone, Default, PartialEq)]
22175#[non_exhaustive]
22176pub struct GkeNodePoolConfig {
22177 /// Optional. The node pool configuration.
22178 pub config: std::option::Option<crate::model::gke_node_pool_config::GkeNodeConfig>,
22179
22180 /// Optional. The list of Compute Engine
22181 /// [zones](https://cloud.google.com/compute/docs/zones#available) where
22182 /// node pool nodes associated with a Dataproc on GKE virtual cluster
22183 /// will be located.
22184 ///
22185 /// **Note:** All node pools associated with a virtual cluster
22186 /// must be located in the same region as the virtual cluster, and they must
22187 /// be located in the same zone within that region.
22188 ///
22189 /// If a location is not specified during node pool creation, Dataproc on GKE
22190 /// will choose the zone.
22191 pub locations: std::vec::Vec<std::string::String>,
22192
22193 /// Optional. The autoscaler configuration for this node pool. The autoscaler
22194 /// is enabled only when a valid configuration is present.
22195 pub autoscaling:
22196 std::option::Option<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
22197
22198 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22199}
22200
22201impl GkeNodePoolConfig {
22202 /// Creates a new default instance.
22203 pub fn new() -> Self {
22204 std::default::Default::default()
22205 }
22206
22207 /// Sets the value of [config][crate::model::GkeNodePoolConfig::config].
22208 ///
22209 /// # Example
22210 /// ```ignore,no_run
22211 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22212 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22213 /// let x = GkeNodePoolConfig::new().set_config(GkeNodeConfig::default()/* use setters */);
22214 /// ```
22215 pub fn set_config<T>(mut self, v: T) -> Self
22216 where
22217 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
22218 {
22219 self.config = std::option::Option::Some(v.into());
22220 self
22221 }
22222
22223 /// Sets or clears the value of [config][crate::model::GkeNodePoolConfig::config].
22224 ///
22225 /// # Example
22226 /// ```ignore,no_run
22227 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22228 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22229 /// let x = GkeNodePoolConfig::new().set_or_clear_config(Some(GkeNodeConfig::default()/* use setters */));
22230 /// let x = GkeNodePoolConfig::new().set_or_clear_config(None::<GkeNodeConfig>);
22231 /// ```
22232 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
22233 where
22234 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
22235 {
22236 self.config = v.map(|x| x.into());
22237 self
22238 }
22239
22240 /// Sets the value of [locations][crate::model::GkeNodePoolConfig::locations].
22241 ///
22242 /// # Example
22243 /// ```ignore,no_run
22244 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22245 /// let x = GkeNodePoolConfig::new().set_locations(["a", "b", "c"]);
22246 /// ```
22247 pub fn set_locations<T, V>(mut self, v: T) -> Self
22248 where
22249 T: std::iter::IntoIterator<Item = V>,
22250 V: std::convert::Into<std::string::String>,
22251 {
22252 use std::iter::Iterator;
22253 self.locations = v.into_iter().map(|i| i.into()).collect();
22254 self
22255 }
22256
22257 /// Sets the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
22258 ///
22259 /// # Example
22260 /// ```ignore,no_run
22261 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22262 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22263 /// let x = GkeNodePoolConfig::new().set_autoscaling(GkeNodePoolAutoscalingConfig::default()/* use setters */);
22264 /// ```
22265 pub fn set_autoscaling<T>(mut self, v: T) -> Self
22266 where
22267 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
22268 {
22269 self.autoscaling = std::option::Option::Some(v.into());
22270 self
22271 }
22272
22273 /// Sets or clears the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
22274 ///
22275 /// # Example
22276 /// ```ignore,no_run
22277 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
22278 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22279 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(Some(GkeNodePoolAutoscalingConfig::default()/* use setters */));
22280 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(None::<GkeNodePoolAutoscalingConfig>);
22281 /// ```
22282 pub fn set_or_clear_autoscaling<T>(mut self, v: std::option::Option<T>) -> Self
22283 where
22284 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
22285 {
22286 self.autoscaling = v.map(|x| x.into());
22287 self
22288 }
22289}
22290
22291impl wkt::message::Message for GkeNodePoolConfig {
22292 fn typename() -> &'static str {
22293 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig"
22294 }
22295}
22296
22297/// Defines additional types related to [GkeNodePoolConfig].
22298pub mod gke_node_pool_config {
22299 #[allow(unused_imports)]
22300 use super::*;
22301
22302 /// Parameters that describe cluster nodes.
22303 #[derive(Clone, Default, PartialEq)]
22304 #[non_exhaustive]
22305 pub struct GkeNodeConfig {
22306 /// Optional. The name of a Compute Engine [machine
22307 /// type](https://cloud.google.com/compute/docs/machine-types).
22308 pub machine_type: std::string::String,
22309
22310 /// Optional. The number of local SSD disks to attach to the node, which is
22311 /// limited by the maximum number of disks allowable per zone (see [Adding
22312 /// Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)).
22313 pub local_ssd_count: i32,
22314
22315 /// Optional. Whether the nodes are created as legacy [preemptible VM
22316 /// instances] (<https://cloud.google.com/compute/docs/instances/preemptible>).
22317 /// Also see
22318 /// [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]
22319 /// VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot
22320 /// preemptible nodes cannot be used in a node pool with the `CONTROLLER`
22321 /// [role]
22322 /// (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
22323 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
22324 /// DEFAULT node pool will assume the CONTROLLER role).
22325 ///
22326 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]: crate::model::gke_node_pool_config::GkeNodeConfig::spot
22327 pub preemptible: bool,
22328
22329 /// Optional. A list of [hardware
22330 /// accelerators](https://cloud.google.com/compute/docs/gpus) to attach to
22331 /// each node.
22332 pub accelerators:
22333 std::vec::Vec<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
22334
22335 /// Optional. [Minimum CPU
22336 /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
22337 /// to be used by this instance. The instance may be scheduled on the
22338 /// specified or a newer CPU platform. Specify the friendly names of CPU
22339 /// platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
22340 pub min_cpu_platform: std::string::String,
22341
22342 /// Optional. The [Customer Managed Encryption Key (CMEK)]
22343 /// (<https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek>)
22344 /// used to encrypt the boot disk attached to each node in the node pool.
22345 /// Specify the key using the following format:
22346 /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`
22347 pub boot_disk_kms_key: std::string::String,
22348
22349 /// Optional. Whether the nodes are created as [Spot VM instances]
22350 /// (<https://cloud.google.com/compute/docs/instances/spot>).
22351 /// Spot VMs are the latest update to legacy
22352 /// [preemptible
22353 /// VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible].
22354 /// Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible
22355 /// nodes cannot be used in a node pool with the `CONTROLLER`
22356 /// [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
22357 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
22358 /// DEFAULT node pool will assume the CONTROLLER role).
22359 ///
22360 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]: crate::model::gke_node_pool_config::GkeNodeConfig::preemptible
22361 pub spot: bool,
22362
22363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22364 }
22365
22366 impl GkeNodeConfig {
22367 /// Creates a new default instance.
22368 pub fn new() -> Self {
22369 std::default::Default::default()
22370 }
22371
22372 /// Sets the value of [machine_type][crate::model::gke_node_pool_config::GkeNodeConfig::machine_type].
22373 ///
22374 /// # Example
22375 /// ```ignore,no_run
22376 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22377 /// let x = GkeNodeConfig::new().set_machine_type("example");
22378 /// ```
22379 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
22380 mut self,
22381 v: T,
22382 ) -> Self {
22383 self.machine_type = v.into();
22384 self
22385 }
22386
22387 /// Sets the value of [local_ssd_count][crate::model::gke_node_pool_config::GkeNodeConfig::local_ssd_count].
22388 ///
22389 /// # Example
22390 /// ```ignore,no_run
22391 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22392 /// let x = GkeNodeConfig::new().set_local_ssd_count(42);
22393 /// ```
22394 pub fn set_local_ssd_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22395 self.local_ssd_count = v.into();
22396 self
22397 }
22398
22399 /// Sets the value of [preemptible][crate::model::gke_node_pool_config::GkeNodeConfig::preemptible].
22400 ///
22401 /// # Example
22402 /// ```ignore,no_run
22403 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22404 /// let x = GkeNodeConfig::new().set_preemptible(true);
22405 /// ```
22406 pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22407 self.preemptible = v.into();
22408 self
22409 }
22410
22411 /// Sets the value of [accelerators][crate::model::gke_node_pool_config::GkeNodeConfig::accelerators].
22412 ///
22413 /// # Example
22414 /// ```ignore,no_run
22415 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22416 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22417 /// let x = GkeNodeConfig::new()
22418 /// .set_accelerators([
22419 /// GkeNodePoolAcceleratorConfig::default()/* use setters */,
22420 /// GkeNodePoolAcceleratorConfig::default()/* use (different) setters */,
22421 /// ]);
22422 /// ```
22423 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
22424 where
22425 T: std::iter::IntoIterator<Item = V>,
22426 V: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
22427 {
22428 use std::iter::Iterator;
22429 self.accelerators = v.into_iter().map(|i| i.into()).collect();
22430 self
22431 }
22432
22433 /// Sets the value of [min_cpu_platform][crate::model::gke_node_pool_config::GkeNodeConfig::min_cpu_platform].
22434 ///
22435 /// # Example
22436 /// ```ignore,no_run
22437 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22438 /// let x = GkeNodeConfig::new().set_min_cpu_platform("example");
22439 /// ```
22440 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
22441 mut self,
22442 v: T,
22443 ) -> Self {
22444 self.min_cpu_platform = v.into();
22445 self
22446 }
22447
22448 /// Sets the value of [boot_disk_kms_key][crate::model::gke_node_pool_config::GkeNodeConfig::boot_disk_kms_key].
22449 ///
22450 /// # Example
22451 /// ```ignore,no_run
22452 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22453 /// let x = GkeNodeConfig::new().set_boot_disk_kms_key("example");
22454 /// ```
22455 pub fn set_boot_disk_kms_key<T: std::convert::Into<std::string::String>>(
22456 mut self,
22457 v: T,
22458 ) -> Self {
22459 self.boot_disk_kms_key = v.into();
22460 self
22461 }
22462
22463 /// Sets the value of [spot][crate::model::gke_node_pool_config::GkeNodeConfig::spot].
22464 ///
22465 /// # Example
22466 /// ```ignore,no_run
22467 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
22468 /// let x = GkeNodeConfig::new().set_spot(true);
22469 /// ```
22470 pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22471 self.spot = v.into();
22472 self
22473 }
22474 }
22475
22476 impl wkt::message::Message for GkeNodeConfig {
22477 fn typename() -> &'static str {
22478 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig"
22479 }
22480 }
22481
22482 /// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request
22483 /// for a node pool.
22484 #[derive(Clone, Default, PartialEq)]
22485 #[non_exhaustive]
22486 pub struct GkeNodePoolAcceleratorConfig {
22487 /// The number of accelerator cards exposed to an instance.
22488 pub accelerator_count: i64,
22489
22490 /// The accelerator type resource namename (see GPUs on Compute Engine).
22491 pub accelerator_type: std::string::String,
22492
22493 /// Size of partitions to create on the GPU. Valid values are described in
22494 /// the NVIDIA [mig user
22495 /// guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
22496 pub gpu_partition_size: std::string::String,
22497
22498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22499 }
22500
22501 impl GkeNodePoolAcceleratorConfig {
22502 /// Creates a new default instance.
22503 pub fn new() -> Self {
22504 std::default::Default::default()
22505 }
22506
22507 /// Sets the value of [accelerator_count][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_count].
22508 ///
22509 /// # Example
22510 /// ```ignore,no_run
22511 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22512 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_count(42);
22513 /// ```
22514 pub fn set_accelerator_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22515 self.accelerator_count = v.into();
22516 self
22517 }
22518
22519 /// Sets the value of [accelerator_type][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_type].
22520 ///
22521 /// # Example
22522 /// ```ignore,no_run
22523 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22524 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_type("example");
22525 /// ```
22526 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
22527 mut self,
22528 v: T,
22529 ) -> Self {
22530 self.accelerator_type = v.into();
22531 self
22532 }
22533
22534 /// Sets the value of [gpu_partition_size][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::gpu_partition_size].
22535 ///
22536 /// # Example
22537 /// ```ignore,no_run
22538 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
22539 /// let x = GkeNodePoolAcceleratorConfig::new().set_gpu_partition_size("example");
22540 /// ```
22541 pub fn set_gpu_partition_size<T: std::convert::Into<std::string::String>>(
22542 mut self,
22543 v: T,
22544 ) -> Self {
22545 self.gpu_partition_size = v.into();
22546 self
22547 }
22548 }
22549
22550 impl wkt::message::Message for GkeNodePoolAcceleratorConfig {
22551 fn typename() -> &'static str {
22552 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAcceleratorConfig"
22553 }
22554 }
22555
22556 /// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to
22557 /// adjust the size of the node pool to the current cluster usage.
22558 #[derive(Clone, Default, PartialEq)]
22559 #[non_exhaustive]
22560 pub struct GkeNodePoolAutoscalingConfig {
22561 /// The minimum number of nodes in the node pool. Must be >= 0 and <=
22562 /// max_node_count.
22563 pub min_node_count: i32,
22564
22565 /// The maximum number of nodes in the node pool. Must be >= min_node_count,
22566 /// and must be > 0.
22567 /// **Note:** Quota must be sufficient to scale up the cluster.
22568 pub max_node_count: i32,
22569
22570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22571 }
22572
22573 impl GkeNodePoolAutoscalingConfig {
22574 /// Creates a new default instance.
22575 pub fn new() -> Self {
22576 std::default::Default::default()
22577 }
22578
22579 /// Sets the value of [min_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::min_node_count].
22580 ///
22581 /// # Example
22582 /// ```ignore,no_run
22583 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22584 /// let x = GkeNodePoolAutoscalingConfig::new().set_min_node_count(42);
22585 /// ```
22586 pub fn set_min_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22587 self.min_node_count = v.into();
22588 self
22589 }
22590
22591 /// Sets the value of [max_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::max_node_count].
22592 ///
22593 /// # Example
22594 /// ```ignore,no_run
22595 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
22596 /// let x = GkeNodePoolAutoscalingConfig::new().set_max_node_count(42);
22597 /// ```
22598 pub fn set_max_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22599 self.max_node_count = v.into();
22600 self
22601 }
22602 }
22603
22604 impl wkt::message::Message for GkeNodePoolAutoscalingConfig {
22605 fn typename() -> &'static str {
22606 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAutoscalingConfig"
22607 }
22608 }
22609}
22610
22611/// Authentication configuration for a workload is used to set the default
22612/// identity for the workload execution.
22613/// The config specifies the type of identity (service account or user) that
22614/// will be used by workloads to access resources on the project(s).
22615#[derive(Clone, Default, PartialEq)]
22616#[non_exhaustive]
22617pub struct AuthenticationConfig {
22618 /// Optional. Authentication type for the user workload running in containers.
22619 pub user_workload_authentication_type: crate::model::authentication_config::AuthenticationType,
22620
22621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22622}
22623
22624impl AuthenticationConfig {
22625 /// Creates a new default instance.
22626 pub fn new() -> Self {
22627 std::default::Default::default()
22628 }
22629
22630 /// Sets the value of [user_workload_authentication_type][crate::model::AuthenticationConfig::user_workload_authentication_type].
22631 ///
22632 /// # Example
22633 /// ```ignore,no_run
22634 /// # use google_cloud_dataproc_v1::model::AuthenticationConfig;
22635 /// use google_cloud_dataproc_v1::model::authentication_config::AuthenticationType;
22636 /// let x0 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::ServiceAccount);
22637 /// let x1 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::EndUserCredentials);
22638 /// ```
22639 pub fn set_user_workload_authentication_type<
22640 T: std::convert::Into<crate::model::authentication_config::AuthenticationType>,
22641 >(
22642 mut self,
22643 v: T,
22644 ) -> Self {
22645 self.user_workload_authentication_type = v.into();
22646 self
22647 }
22648}
22649
22650impl wkt::message::Message for AuthenticationConfig {
22651 fn typename() -> &'static str {
22652 "type.googleapis.com/google.cloud.dataproc.v1.AuthenticationConfig"
22653 }
22654}
22655
22656/// Defines additional types related to [AuthenticationConfig].
22657pub mod authentication_config {
22658 #[allow(unused_imports)]
22659 use super::*;
22660
22661 /// Authentication types for workload execution.
22662 ///
22663 /// # Working with unknown values
22664 ///
22665 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22666 /// additional enum variants at any time. Adding new variants is not considered
22667 /// a breaking change. Applications should write their code in anticipation of:
22668 ///
22669 /// - New values appearing in future releases of the client library, **and**
22670 /// - New values received dynamically, without application changes.
22671 ///
22672 /// Please consult the [Working with enums] section in the user guide for some
22673 /// guidelines.
22674 ///
22675 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22676 #[derive(Clone, Debug, PartialEq)]
22677 #[non_exhaustive]
22678 pub enum AuthenticationType {
22679 /// If AuthenticationType is unspecified then END_USER_CREDENTIALS is used
22680 /// for 3.0 and newer runtimes, and SERVICE_ACCOUNT is used for older
22681 /// runtimes.
22682 Unspecified,
22683 /// Use service account credentials for authenticating to other services.
22684 ServiceAccount,
22685 /// Use OAuth credentials associated with the workload creator/user for
22686 /// authenticating to other services.
22687 EndUserCredentials,
22688 /// If set, the enum was initialized with an unknown value.
22689 ///
22690 /// Applications can examine the value using [AuthenticationType::value] or
22691 /// [AuthenticationType::name].
22692 UnknownValue(authentication_type::UnknownValue),
22693 }
22694
22695 #[doc(hidden)]
22696 pub mod authentication_type {
22697 #[allow(unused_imports)]
22698 use super::*;
22699 #[derive(Clone, Debug, PartialEq)]
22700 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22701 }
22702
22703 impl AuthenticationType {
22704 /// Gets the enum value.
22705 ///
22706 /// Returns `None` if the enum contains an unknown value deserialized from
22707 /// the string representation of enums.
22708 pub fn value(&self) -> std::option::Option<i32> {
22709 match self {
22710 Self::Unspecified => std::option::Option::Some(0),
22711 Self::ServiceAccount => std::option::Option::Some(1),
22712 Self::EndUserCredentials => std::option::Option::Some(2),
22713 Self::UnknownValue(u) => u.0.value(),
22714 }
22715 }
22716
22717 /// Gets the enum value as a string.
22718 ///
22719 /// Returns `None` if the enum contains an unknown value deserialized from
22720 /// the integer representation of enums.
22721 pub fn name(&self) -> std::option::Option<&str> {
22722 match self {
22723 Self::Unspecified => std::option::Option::Some("AUTHENTICATION_TYPE_UNSPECIFIED"),
22724 Self::ServiceAccount => std::option::Option::Some("SERVICE_ACCOUNT"),
22725 Self::EndUserCredentials => std::option::Option::Some("END_USER_CREDENTIALS"),
22726 Self::UnknownValue(u) => u.0.name(),
22727 }
22728 }
22729 }
22730
22731 impl std::default::Default for AuthenticationType {
22732 fn default() -> Self {
22733 use std::convert::From;
22734 Self::from(0)
22735 }
22736 }
22737
22738 impl std::fmt::Display for AuthenticationType {
22739 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22740 wkt::internal::display_enum(f, self.name(), self.value())
22741 }
22742 }
22743
22744 impl std::convert::From<i32> for AuthenticationType {
22745 fn from(value: i32) -> Self {
22746 match value {
22747 0 => Self::Unspecified,
22748 1 => Self::ServiceAccount,
22749 2 => Self::EndUserCredentials,
22750 _ => Self::UnknownValue(authentication_type::UnknownValue(
22751 wkt::internal::UnknownEnumValue::Integer(value),
22752 )),
22753 }
22754 }
22755 }
22756
22757 impl std::convert::From<&str> for AuthenticationType {
22758 fn from(value: &str) -> Self {
22759 use std::string::ToString;
22760 match value {
22761 "AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
22762 "SERVICE_ACCOUNT" => Self::ServiceAccount,
22763 "END_USER_CREDENTIALS" => Self::EndUserCredentials,
22764 _ => Self::UnknownValue(authentication_type::UnknownValue(
22765 wkt::internal::UnknownEnumValue::String(value.to_string()),
22766 )),
22767 }
22768 }
22769 }
22770
22771 impl serde::ser::Serialize for AuthenticationType {
22772 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22773 where
22774 S: serde::Serializer,
22775 {
22776 match self {
22777 Self::Unspecified => serializer.serialize_i32(0),
22778 Self::ServiceAccount => serializer.serialize_i32(1),
22779 Self::EndUserCredentials => serializer.serialize_i32(2),
22780 Self::UnknownValue(u) => u.0.serialize(serializer),
22781 }
22782 }
22783 }
22784
22785 impl<'de> serde::de::Deserialize<'de> for AuthenticationType {
22786 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22787 where
22788 D: serde::Deserializer<'de>,
22789 {
22790 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthenticationType>::new(
22791 ".google.cloud.dataproc.v1.AuthenticationConfig.AuthenticationType",
22792 ))
22793 }
22794 }
22795}
22796
22797/// Autotuning configuration of the workload.
22798#[derive(Clone, Default, PartialEq)]
22799#[non_exhaustive]
22800pub struct AutotuningConfig {
22801 /// Optional. Scenarios for which tunings are applied.
22802 pub scenarios: std::vec::Vec<crate::model::autotuning_config::Scenario>,
22803
22804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22805}
22806
22807impl AutotuningConfig {
22808 /// Creates a new default instance.
22809 pub fn new() -> Self {
22810 std::default::Default::default()
22811 }
22812
22813 /// Sets the value of [scenarios][crate::model::AutotuningConfig::scenarios].
22814 ///
22815 /// # Example
22816 /// ```ignore,no_run
22817 /// # use google_cloud_dataproc_v1::model::AutotuningConfig;
22818 /// use google_cloud_dataproc_v1::model::autotuning_config::Scenario;
22819 /// let x = AutotuningConfig::new().set_scenarios([
22820 /// Scenario::Scaling,
22821 /// Scenario::BroadcastHashJoin,
22822 /// Scenario::Memory,
22823 /// ]);
22824 /// ```
22825 pub fn set_scenarios<T, V>(mut self, v: T) -> Self
22826 where
22827 T: std::iter::IntoIterator<Item = V>,
22828 V: std::convert::Into<crate::model::autotuning_config::Scenario>,
22829 {
22830 use std::iter::Iterator;
22831 self.scenarios = v.into_iter().map(|i| i.into()).collect();
22832 self
22833 }
22834}
22835
22836impl wkt::message::Message for AutotuningConfig {
22837 fn typename() -> &'static str {
22838 "type.googleapis.com/google.cloud.dataproc.v1.AutotuningConfig"
22839 }
22840}
22841
22842/// Defines additional types related to [AutotuningConfig].
22843pub mod autotuning_config {
22844 #[allow(unused_imports)]
22845 use super::*;
22846
22847 /// Scenario represents a specific goal that autotuning will attempt to achieve
22848 /// by modifying workloads.
22849 ///
22850 /// # Working with unknown values
22851 ///
22852 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22853 /// additional enum variants at any time. Adding new variants is not considered
22854 /// a breaking change. Applications should write their code in anticipation of:
22855 ///
22856 /// - New values appearing in future releases of the client library, **and**
22857 /// - New values received dynamically, without application changes.
22858 ///
22859 /// Please consult the [Working with enums] section in the user guide for some
22860 /// guidelines.
22861 ///
22862 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22863 #[derive(Clone, Debug, PartialEq)]
22864 #[non_exhaustive]
22865 pub enum Scenario {
22866 /// Default value.
22867 Unspecified,
22868 /// Scaling recommendations such as initialExecutors.
22869 Scaling,
22870 /// Adding hints for potential relation broadcasts.
22871 BroadcastHashJoin,
22872 /// Memory management for workloads.
22873 Memory,
22874 /// No autotuning.
22875 None,
22876 /// Automatic selection of scenarios.
22877 Auto,
22878 /// If set, the enum was initialized with an unknown value.
22879 ///
22880 /// Applications can examine the value using [Scenario::value] or
22881 /// [Scenario::name].
22882 UnknownValue(scenario::UnknownValue),
22883 }
22884
22885 #[doc(hidden)]
22886 pub mod scenario {
22887 #[allow(unused_imports)]
22888 use super::*;
22889 #[derive(Clone, Debug, PartialEq)]
22890 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22891 }
22892
22893 impl Scenario {
22894 /// Gets the enum value.
22895 ///
22896 /// Returns `None` if the enum contains an unknown value deserialized from
22897 /// the string representation of enums.
22898 pub fn value(&self) -> std::option::Option<i32> {
22899 match self {
22900 Self::Unspecified => std::option::Option::Some(0),
22901 Self::Scaling => std::option::Option::Some(2),
22902 Self::BroadcastHashJoin => std::option::Option::Some(3),
22903 Self::Memory => std::option::Option::Some(4),
22904 Self::None => std::option::Option::Some(5),
22905 Self::Auto => std::option::Option::Some(6),
22906 Self::UnknownValue(u) => u.0.value(),
22907 }
22908 }
22909
22910 /// Gets the enum value as a string.
22911 ///
22912 /// Returns `None` if the enum contains an unknown value deserialized from
22913 /// the integer representation of enums.
22914 pub fn name(&self) -> std::option::Option<&str> {
22915 match self {
22916 Self::Unspecified => std::option::Option::Some("SCENARIO_UNSPECIFIED"),
22917 Self::Scaling => std::option::Option::Some("SCALING"),
22918 Self::BroadcastHashJoin => std::option::Option::Some("BROADCAST_HASH_JOIN"),
22919 Self::Memory => std::option::Option::Some("MEMORY"),
22920 Self::None => std::option::Option::Some("NONE"),
22921 Self::Auto => std::option::Option::Some("AUTO"),
22922 Self::UnknownValue(u) => u.0.name(),
22923 }
22924 }
22925 }
22926
22927 impl std::default::Default for Scenario {
22928 fn default() -> Self {
22929 use std::convert::From;
22930 Self::from(0)
22931 }
22932 }
22933
22934 impl std::fmt::Display for Scenario {
22935 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22936 wkt::internal::display_enum(f, self.name(), self.value())
22937 }
22938 }
22939
22940 impl std::convert::From<i32> for Scenario {
22941 fn from(value: i32) -> Self {
22942 match value {
22943 0 => Self::Unspecified,
22944 2 => Self::Scaling,
22945 3 => Self::BroadcastHashJoin,
22946 4 => Self::Memory,
22947 5 => Self::None,
22948 6 => Self::Auto,
22949 _ => Self::UnknownValue(scenario::UnknownValue(
22950 wkt::internal::UnknownEnumValue::Integer(value),
22951 )),
22952 }
22953 }
22954 }
22955
22956 impl std::convert::From<&str> for Scenario {
22957 fn from(value: &str) -> Self {
22958 use std::string::ToString;
22959 match value {
22960 "SCENARIO_UNSPECIFIED" => Self::Unspecified,
22961 "SCALING" => Self::Scaling,
22962 "BROADCAST_HASH_JOIN" => Self::BroadcastHashJoin,
22963 "MEMORY" => Self::Memory,
22964 "NONE" => Self::None,
22965 "AUTO" => Self::Auto,
22966 _ => Self::UnknownValue(scenario::UnknownValue(
22967 wkt::internal::UnknownEnumValue::String(value.to_string()),
22968 )),
22969 }
22970 }
22971 }
22972
22973 impl serde::ser::Serialize for Scenario {
22974 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22975 where
22976 S: serde::Serializer,
22977 {
22978 match self {
22979 Self::Unspecified => serializer.serialize_i32(0),
22980 Self::Scaling => serializer.serialize_i32(2),
22981 Self::BroadcastHashJoin => serializer.serialize_i32(3),
22982 Self::Memory => serializer.serialize_i32(4),
22983 Self::None => serializer.serialize_i32(5),
22984 Self::Auto => serializer.serialize_i32(6),
22985 Self::UnknownValue(u) => u.0.serialize(serializer),
22986 }
22987 }
22988 }
22989
22990 impl<'de> serde::de::Deserialize<'de> for Scenario {
22991 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22992 where
22993 D: serde::Deserializer<'de>,
22994 {
22995 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scenario>::new(
22996 ".google.cloud.dataproc.v1.AutotuningConfig.Scenario",
22997 ))
22998 }
22999 }
23000}
23001
23002/// Configuration for dependency repositories
23003#[derive(Clone, Default, PartialEq)]
23004#[non_exhaustive]
23005pub struct RepositoryConfig {
23006 /// Optional. Configuration for PyPi repository.
23007 pub pypi_repository_config: std::option::Option<crate::model::PyPiRepositoryConfig>,
23008
23009 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23010}
23011
23012impl RepositoryConfig {
23013 /// Creates a new default instance.
23014 pub fn new() -> Self {
23015 std::default::Default::default()
23016 }
23017
23018 /// Sets the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
23019 ///
23020 /// # Example
23021 /// ```ignore,no_run
23022 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
23023 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
23024 /// let x = RepositoryConfig::new().set_pypi_repository_config(PyPiRepositoryConfig::default()/* use setters */);
23025 /// ```
23026 pub fn set_pypi_repository_config<T>(mut self, v: T) -> Self
23027 where
23028 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
23029 {
23030 self.pypi_repository_config = std::option::Option::Some(v.into());
23031 self
23032 }
23033
23034 /// Sets or clears the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
23035 ///
23036 /// # Example
23037 /// ```ignore,no_run
23038 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
23039 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
23040 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(Some(PyPiRepositoryConfig::default()/* use setters */));
23041 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(None::<PyPiRepositoryConfig>);
23042 /// ```
23043 pub fn set_or_clear_pypi_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
23044 where
23045 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
23046 {
23047 self.pypi_repository_config = v.map(|x| x.into());
23048 self
23049 }
23050}
23051
23052impl wkt::message::Message for RepositoryConfig {
23053 fn typename() -> &'static str {
23054 "type.googleapis.com/google.cloud.dataproc.v1.RepositoryConfig"
23055 }
23056}
23057
23058/// Configuration for PyPi repository
23059#[derive(Clone, Default, PartialEq)]
23060#[non_exhaustive]
23061pub struct PyPiRepositoryConfig {
23062 /// Optional. The PyPi repository address. **Note: This field is not available
23063 /// for batch workloads.**
23064 pub pypi_repository: std::string::String,
23065
23066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23067}
23068
23069impl PyPiRepositoryConfig {
23070 /// Creates a new default instance.
23071 pub fn new() -> Self {
23072 std::default::Default::default()
23073 }
23074
23075 /// Sets the value of [pypi_repository][crate::model::PyPiRepositoryConfig::pypi_repository].
23076 ///
23077 /// # Example
23078 /// ```ignore,no_run
23079 /// # use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
23080 /// let x = PyPiRepositoryConfig::new().set_pypi_repository("example");
23081 /// ```
23082 pub fn set_pypi_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23083 self.pypi_repository = v.into();
23084 self
23085 }
23086}
23087
23088impl wkt::message::Message for PyPiRepositoryConfig {
23089 fn typename() -> &'static str {
23090 "type.googleapis.com/google.cloud.dataproc.v1.PyPiRepositoryConfig"
23091 }
23092}
23093
23094/// A Dataproc workflow template resource.
23095#[derive(Clone, Default, PartialEq)]
23096#[non_exhaustive]
23097pub struct WorkflowTemplate {
23098 #[allow(missing_docs)]
23099 pub id: std::string::String,
23100
23101 /// Output only. The resource name of the workflow template, as described
23102 /// in <https://cloud.google.com/apis/design/resource_names>.
23103 ///
23104 /// * For `projects.regions.workflowTemplates`, the resource name of the
23105 /// template has the following format:
23106 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
23107 ///
23108 /// * For `projects.locations.workflowTemplates`, the resource name of the
23109 /// template has the following format:
23110 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
23111 ///
23112 pub name: std::string::String,
23113
23114 /// Optional. Used to perform a consistent read-modify-write.
23115 ///
23116 /// This field should be left blank for a `CreateWorkflowTemplate` request. It
23117 /// is required for an `UpdateWorkflowTemplate` request, and must match the
23118 /// current server version. A typical update template flow would fetch the
23119 /// current template with a `GetWorkflowTemplate` request, which will return
23120 /// the current template with the `version` field filled in with the
23121 /// current server version. The user updates other fields in the template,
23122 /// then returns it as part of the `UpdateWorkflowTemplate` request.
23123 pub version: i32,
23124
23125 /// Output only. The time template was created.
23126 pub create_time: std::option::Option<wkt::Timestamp>,
23127
23128 /// Output only. The time template was last updated.
23129 pub update_time: std::option::Option<wkt::Timestamp>,
23130
23131 /// Optional. The labels to associate with this template. These labels
23132 /// will be propagated to all jobs and clusters created by the workflow
23133 /// instance.
23134 ///
23135 /// Label **keys** must contain 1 to 63 characters, and must conform to
23136 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
23137 ///
23138 /// Label **values** may be empty, but, if present, must contain 1 to 63
23139 /// characters, and must conform to
23140 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
23141 ///
23142 /// No more than 32 labels can be associated with a template.
23143 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23144
23145 /// Required. WorkflowTemplate scheduling information.
23146 pub placement: std::option::Option<crate::model::WorkflowTemplatePlacement>,
23147
23148 /// Required. The Directed Acyclic Graph of Jobs to submit.
23149 pub jobs: std::vec::Vec<crate::model::OrderedJob>,
23150
23151 /// Optional. Template parameters whose values are substituted into the
23152 /// template. Values for parameters must be provided when the template is
23153 /// instantiated.
23154 pub parameters: std::vec::Vec<crate::model::TemplateParameter>,
23155
23156 /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
23157 /// [JSON representation of
23158 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
23159 /// The timeout duration must be from 10 minutes ("600s") to 24 hours
23160 /// ("86400s"). The timer begins when the first job is submitted. If the
23161 /// workflow is running at the end of the timeout period, any remaining jobs
23162 /// are cancelled, the workflow is ended, and if the workflow was running on a
23163 /// [managed
23164 /// cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
23165 /// the cluster is deleted.
23166 pub dag_timeout: std::option::Option<wkt::Duration>,
23167
23168 /// Optional. Encryption settings for encrypting workflow template job
23169 /// arguments.
23170 pub encryption_config: std::option::Option<crate::model::workflow_template::EncryptionConfig>,
23171
23172 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23173}
23174
23175impl WorkflowTemplate {
23176 /// Creates a new default instance.
23177 pub fn new() -> Self {
23178 std::default::Default::default()
23179 }
23180
23181 /// Sets the value of [id][crate::model::WorkflowTemplate::id].
23182 ///
23183 /// # Example
23184 /// ```ignore,no_run
23185 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23186 /// let x = WorkflowTemplate::new().set_id("example");
23187 /// ```
23188 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23189 self.id = v.into();
23190 self
23191 }
23192
23193 /// Sets the value of [name][crate::model::WorkflowTemplate::name].
23194 ///
23195 /// # Example
23196 /// ```ignore,no_run
23197 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23198 /// # let project_id = "project_id";
23199 /// # let region_id = "region_id";
23200 /// # let workflow_template_id = "workflow_template_id";
23201 /// let x = WorkflowTemplate::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
23202 /// ```
23203 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23204 self.name = v.into();
23205 self
23206 }
23207
23208 /// Sets the value of [version][crate::model::WorkflowTemplate::version].
23209 ///
23210 /// # Example
23211 /// ```ignore,no_run
23212 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23213 /// let x = WorkflowTemplate::new().set_version(42);
23214 /// ```
23215 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23216 self.version = v.into();
23217 self
23218 }
23219
23220 /// Sets the value of [create_time][crate::model::WorkflowTemplate::create_time].
23221 ///
23222 /// # Example
23223 /// ```ignore,no_run
23224 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23225 /// use wkt::Timestamp;
23226 /// let x = WorkflowTemplate::new().set_create_time(Timestamp::default()/* use setters */);
23227 /// ```
23228 pub fn set_create_time<T>(mut self, v: T) -> Self
23229 where
23230 T: std::convert::Into<wkt::Timestamp>,
23231 {
23232 self.create_time = std::option::Option::Some(v.into());
23233 self
23234 }
23235
23236 /// Sets or clears the value of [create_time][crate::model::WorkflowTemplate::create_time].
23237 ///
23238 /// # Example
23239 /// ```ignore,no_run
23240 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23241 /// use wkt::Timestamp;
23242 /// let x = WorkflowTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
23243 /// let x = WorkflowTemplate::new().set_or_clear_create_time(None::<Timestamp>);
23244 /// ```
23245 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
23246 where
23247 T: std::convert::Into<wkt::Timestamp>,
23248 {
23249 self.create_time = v.map(|x| x.into());
23250 self
23251 }
23252
23253 /// Sets the value of [update_time][crate::model::WorkflowTemplate::update_time].
23254 ///
23255 /// # Example
23256 /// ```ignore,no_run
23257 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23258 /// use wkt::Timestamp;
23259 /// let x = WorkflowTemplate::new().set_update_time(Timestamp::default()/* use setters */);
23260 /// ```
23261 pub fn set_update_time<T>(mut self, v: T) -> Self
23262 where
23263 T: std::convert::Into<wkt::Timestamp>,
23264 {
23265 self.update_time = std::option::Option::Some(v.into());
23266 self
23267 }
23268
23269 /// Sets or clears the value of [update_time][crate::model::WorkflowTemplate::update_time].
23270 ///
23271 /// # Example
23272 /// ```ignore,no_run
23273 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23274 /// use wkt::Timestamp;
23275 /// let x = WorkflowTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
23276 /// let x = WorkflowTemplate::new().set_or_clear_update_time(None::<Timestamp>);
23277 /// ```
23278 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
23279 where
23280 T: std::convert::Into<wkt::Timestamp>,
23281 {
23282 self.update_time = v.map(|x| x.into());
23283 self
23284 }
23285
23286 /// Sets the value of [labels][crate::model::WorkflowTemplate::labels].
23287 ///
23288 /// # Example
23289 /// ```ignore,no_run
23290 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23291 /// let x = WorkflowTemplate::new().set_labels([
23292 /// ("key0", "abc"),
23293 /// ("key1", "xyz"),
23294 /// ]);
23295 /// ```
23296 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23297 where
23298 T: std::iter::IntoIterator<Item = (K, V)>,
23299 K: std::convert::Into<std::string::String>,
23300 V: std::convert::Into<std::string::String>,
23301 {
23302 use std::iter::Iterator;
23303 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23304 self
23305 }
23306
23307 /// Sets the value of [placement][crate::model::WorkflowTemplate::placement].
23308 ///
23309 /// # Example
23310 /// ```ignore,no_run
23311 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23312 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23313 /// let x = WorkflowTemplate::new().set_placement(WorkflowTemplatePlacement::default()/* use setters */);
23314 /// ```
23315 pub fn set_placement<T>(mut self, v: T) -> Self
23316 where
23317 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
23318 {
23319 self.placement = std::option::Option::Some(v.into());
23320 self
23321 }
23322
23323 /// Sets or clears the value of [placement][crate::model::WorkflowTemplate::placement].
23324 ///
23325 /// # Example
23326 /// ```ignore,no_run
23327 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23328 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23329 /// let x = WorkflowTemplate::new().set_or_clear_placement(Some(WorkflowTemplatePlacement::default()/* use setters */));
23330 /// let x = WorkflowTemplate::new().set_or_clear_placement(None::<WorkflowTemplatePlacement>);
23331 /// ```
23332 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
23333 where
23334 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
23335 {
23336 self.placement = v.map(|x| x.into());
23337 self
23338 }
23339
23340 /// Sets the value of [jobs][crate::model::WorkflowTemplate::jobs].
23341 ///
23342 /// # Example
23343 /// ```ignore,no_run
23344 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23345 /// use google_cloud_dataproc_v1::model::OrderedJob;
23346 /// let x = WorkflowTemplate::new()
23347 /// .set_jobs([
23348 /// OrderedJob::default()/* use setters */,
23349 /// OrderedJob::default()/* use (different) setters */,
23350 /// ]);
23351 /// ```
23352 pub fn set_jobs<T, V>(mut self, v: T) -> Self
23353 where
23354 T: std::iter::IntoIterator<Item = V>,
23355 V: std::convert::Into<crate::model::OrderedJob>,
23356 {
23357 use std::iter::Iterator;
23358 self.jobs = v.into_iter().map(|i| i.into()).collect();
23359 self
23360 }
23361
23362 /// Sets the value of [parameters][crate::model::WorkflowTemplate::parameters].
23363 ///
23364 /// # Example
23365 /// ```ignore,no_run
23366 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23367 /// use google_cloud_dataproc_v1::model::TemplateParameter;
23368 /// let x = WorkflowTemplate::new()
23369 /// .set_parameters([
23370 /// TemplateParameter::default()/* use setters */,
23371 /// TemplateParameter::default()/* use (different) setters */,
23372 /// ]);
23373 /// ```
23374 pub fn set_parameters<T, V>(mut self, v: T) -> Self
23375 where
23376 T: std::iter::IntoIterator<Item = V>,
23377 V: std::convert::Into<crate::model::TemplateParameter>,
23378 {
23379 use std::iter::Iterator;
23380 self.parameters = v.into_iter().map(|i| i.into()).collect();
23381 self
23382 }
23383
23384 /// Sets the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
23385 ///
23386 /// # Example
23387 /// ```ignore,no_run
23388 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23389 /// use wkt::Duration;
23390 /// let x = WorkflowTemplate::new().set_dag_timeout(Duration::default()/* use setters */);
23391 /// ```
23392 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
23393 where
23394 T: std::convert::Into<wkt::Duration>,
23395 {
23396 self.dag_timeout = std::option::Option::Some(v.into());
23397 self
23398 }
23399
23400 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
23401 ///
23402 /// # Example
23403 /// ```ignore,no_run
23404 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23405 /// use wkt::Duration;
23406 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
23407 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(None::<Duration>);
23408 /// ```
23409 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
23410 where
23411 T: std::convert::Into<wkt::Duration>,
23412 {
23413 self.dag_timeout = v.map(|x| x.into());
23414 self
23415 }
23416
23417 /// Sets the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
23418 ///
23419 /// # Example
23420 /// ```ignore,no_run
23421 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23422 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
23423 /// let x = WorkflowTemplate::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
23424 /// ```
23425 pub fn set_encryption_config<T>(mut self, v: T) -> Self
23426 where
23427 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
23428 {
23429 self.encryption_config = std::option::Option::Some(v.into());
23430 self
23431 }
23432
23433 /// Sets or clears the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
23434 ///
23435 /// # Example
23436 /// ```ignore,no_run
23437 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
23438 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
23439 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
23440 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
23441 /// ```
23442 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
23443 where
23444 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
23445 {
23446 self.encryption_config = v.map(|x| x.into());
23447 self
23448 }
23449}
23450
23451impl wkt::message::Message for WorkflowTemplate {
23452 fn typename() -> &'static str {
23453 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate"
23454 }
23455}
23456
23457/// Defines additional types related to [WorkflowTemplate].
23458pub mod workflow_template {
23459 #[allow(unused_imports)]
23460 use super::*;
23461
23462 /// Encryption settings for encrypting workflow template job arguments.
23463 #[derive(Clone, Default, PartialEq)]
23464 #[non_exhaustive]
23465 pub struct EncryptionConfig {
23466 /// Optional. The Cloud KMS key name to use for encrypting
23467 /// workflow template job arguments.
23468 ///
23469 /// When this this key is provided, the following workflow template
23470 /// [job arguments]
23471 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template>),
23472 /// if present, are
23473 /// [CMEK
23474 /// encrypted](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data):
23475 ///
23476 /// * [FlinkJob
23477 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
23478 /// * [HadoopJob
23479 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
23480 /// * [SparkJob
23481 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
23482 /// * [SparkRJob
23483 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
23484 /// * [PySparkJob
23485 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
23486 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
23487 /// scriptVariables and queryList.queries
23488 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
23489 /// scriptVariables and queryList.queries
23490 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
23491 /// scriptVariables and queryList.queries
23492 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
23493 /// scriptVariables and queryList.queries
23494 pub kms_key: std::string::String,
23495
23496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23497 }
23498
23499 impl EncryptionConfig {
23500 /// Creates a new default instance.
23501 pub fn new() -> Self {
23502 std::default::Default::default()
23503 }
23504
23505 /// Sets the value of [kms_key][crate::model::workflow_template::EncryptionConfig::kms_key].
23506 ///
23507 /// # Example
23508 /// ```ignore,no_run
23509 /// # use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
23510 /// let x = EncryptionConfig::new().set_kms_key("example");
23511 /// ```
23512 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23513 self.kms_key = v.into();
23514 self
23515 }
23516 }
23517
23518 impl wkt::message::Message for EncryptionConfig {
23519 fn typename() -> &'static str {
23520 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate.EncryptionConfig"
23521 }
23522 }
23523}
23524
23525/// Specifies workflow execution target.
23526///
23527/// Either `managed_cluster` or `cluster_selector` is required.
23528#[derive(Clone, Default, PartialEq)]
23529#[non_exhaustive]
23530pub struct WorkflowTemplatePlacement {
23531 /// Required. Specifies where workflow executes; either on a managed
23532 /// cluster or an existing cluster chosen by labels.
23533 pub placement: std::option::Option<crate::model::workflow_template_placement::Placement>,
23534
23535 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23536}
23537
23538impl WorkflowTemplatePlacement {
23539 /// Creates a new default instance.
23540 pub fn new() -> Self {
23541 std::default::Default::default()
23542 }
23543
23544 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement].
23545 ///
23546 /// Note that all the setters affecting `placement` are mutually
23547 /// exclusive.
23548 ///
23549 /// # Example
23550 /// ```ignore,no_run
23551 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23552 /// use google_cloud_dataproc_v1::model::ManagedCluster;
23553 /// let x = WorkflowTemplatePlacement::new().set_placement(Some(
23554 /// google_cloud_dataproc_v1::model::workflow_template_placement::Placement::ManagedCluster(ManagedCluster::default().into())));
23555 /// ```
23556 pub fn set_placement<
23557 T: std::convert::Into<
23558 std::option::Option<crate::model::workflow_template_placement::Placement>,
23559 >,
23560 >(
23561 mut self,
23562 v: T,
23563 ) -> Self {
23564 self.placement = v.into();
23565 self
23566 }
23567
23568 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23569 /// if it holds a `ManagedCluster`, `None` if the field is not set or
23570 /// holds a different branch.
23571 pub fn managed_cluster(
23572 &self,
23573 ) -> std::option::Option<&std::boxed::Box<crate::model::ManagedCluster>> {
23574 #[allow(unreachable_patterns)]
23575 self.placement.as_ref().and_then(|v| match v {
23576 crate::model::workflow_template_placement::Placement::ManagedCluster(v) => {
23577 std::option::Option::Some(v)
23578 }
23579 _ => std::option::Option::None,
23580 })
23581 }
23582
23583 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23584 /// to hold a `ManagedCluster`.
23585 ///
23586 /// Note that all the setters affecting `placement` are
23587 /// mutually exclusive.
23588 ///
23589 /// # Example
23590 /// ```ignore,no_run
23591 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23592 /// use google_cloud_dataproc_v1::model::ManagedCluster;
23593 /// let x = WorkflowTemplatePlacement::new().set_managed_cluster(ManagedCluster::default()/* use setters */);
23594 /// assert!(x.managed_cluster().is_some());
23595 /// assert!(x.cluster_selector().is_none());
23596 /// ```
23597 pub fn set_managed_cluster<
23598 T: std::convert::Into<std::boxed::Box<crate::model::ManagedCluster>>,
23599 >(
23600 mut self,
23601 v: T,
23602 ) -> Self {
23603 self.placement = std::option::Option::Some(
23604 crate::model::workflow_template_placement::Placement::ManagedCluster(v.into()),
23605 );
23606 self
23607 }
23608
23609 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23610 /// if it holds a `ClusterSelector`, `None` if the field is not set or
23611 /// holds a different branch.
23612 pub fn cluster_selector(
23613 &self,
23614 ) -> std::option::Option<&std::boxed::Box<crate::model::ClusterSelector>> {
23615 #[allow(unreachable_patterns)]
23616 self.placement.as_ref().and_then(|v| match v {
23617 crate::model::workflow_template_placement::Placement::ClusterSelector(v) => {
23618 std::option::Option::Some(v)
23619 }
23620 _ => std::option::Option::None,
23621 })
23622 }
23623
23624 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
23625 /// to hold a `ClusterSelector`.
23626 ///
23627 /// Note that all the setters affecting `placement` are
23628 /// mutually exclusive.
23629 ///
23630 /// # Example
23631 /// ```ignore,no_run
23632 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
23633 /// use google_cloud_dataproc_v1::model::ClusterSelector;
23634 /// let x = WorkflowTemplatePlacement::new().set_cluster_selector(ClusterSelector::default()/* use setters */);
23635 /// assert!(x.cluster_selector().is_some());
23636 /// assert!(x.managed_cluster().is_none());
23637 /// ```
23638 pub fn set_cluster_selector<
23639 T: std::convert::Into<std::boxed::Box<crate::model::ClusterSelector>>,
23640 >(
23641 mut self,
23642 v: T,
23643 ) -> Self {
23644 self.placement = std::option::Option::Some(
23645 crate::model::workflow_template_placement::Placement::ClusterSelector(v.into()),
23646 );
23647 self
23648 }
23649}
23650
23651impl wkt::message::Message for WorkflowTemplatePlacement {
23652 fn typename() -> &'static str {
23653 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplatePlacement"
23654 }
23655}
23656
23657/// Defines additional types related to [WorkflowTemplatePlacement].
23658pub mod workflow_template_placement {
23659 #[allow(unused_imports)]
23660 use super::*;
23661
23662 /// Required. Specifies where workflow executes; either on a managed
23663 /// cluster or an existing cluster chosen by labels.
23664 #[derive(Clone, Debug, PartialEq)]
23665 #[non_exhaustive]
23666 pub enum Placement {
23667 /// A cluster that is managed by the workflow.
23668 ManagedCluster(std::boxed::Box<crate::model::ManagedCluster>),
23669 /// Optional. A selector that chooses target cluster for jobs based
23670 /// on metadata.
23671 ///
23672 /// The selector is evaluated at the time each job is submitted.
23673 ClusterSelector(std::boxed::Box<crate::model::ClusterSelector>),
23674 }
23675}
23676
23677/// Cluster that is managed by the workflow.
23678#[derive(Clone, Default, PartialEq)]
23679#[non_exhaustive]
23680pub struct ManagedCluster {
23681 /// Required. The cluster name prefix. A unique cluster name will be formed by
23682 /// appending a random suffix.
23683 ///
23684 /// The name must contain only lower-case letters (a-z), numbers (0-9),
23685 /// and hyphens (-). Must begin with a letter. Cannot begin or end with
23686 /// hyphen. Must consist of between 2 and 35 characters.
23687 pub cluster_name: std::string::String,
23688
23689 /// Required. The cluster configuration.
23690 pub config: std::option::Option<crate::model::ClusterConfig>,
23691
23692 /// Optional. The labels to associate with this cluster.
23693 ///
23694 /// Label keys must be between 1 and 63 characters long, and must conform to
23695 /// the following PCRE regular expression:
23696 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
23697 ///
23698 /// Label values must be between 1 and 63 characters long, and must conform to
23699 /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
23700 ///
23701 /// No more than 32 labels can be associated with a given cluster.
23702 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23703
23704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23705}
23706
23707impl ManagedCluster {
23708 /// Creates a new default instance.
23709 pub fn new() -> Self {
23710 std::default::Default::default()
23711 }
23712
23713 /// Sets the value of [cluster_name][crate::model::ManagedCluster::cluster_name].
23714 ///
23715 /// # Example
23716 /// ```ignore,no_run
23717 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23718 /// let x = ManagedCluster::new().set_cluster_name("example");
23719 /// ```
23720 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23721 self.cluster_name = v.into();
23722 self
23723 }
23724
23725 /// Sets the value of [config][crate::model::ManagedCluster::config].
23726 ///
23727 /// # Example
23728 /// ```ignore,no_run
23729 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23730 /// use google_cloud_dataproc_v1::model::ClusterConfig;
23731 /// let x = ManagedCluster::new().set_config(ClusterConfig::default()/* use setters */);
23732 /// ```
23733 pub fn set_config<T>(mut self, v: T) -> Self
23734 where
23735 T: std::convert::Into<crate::model::ClusterConfig>,
23736 {
23737 self.config = std::option::Option::Some(v.into());
23738 self
23739 }
23740
23741 /// Sets or clears the value of [config][crate::model::ManagedCluster::config].
23742 ///
23743 /// # Example
23744 /// ```ignore,no_run
23745 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23746 /// use google_cloud_dataproc_v1::model::ClusterConfig;
23747 /// let x = ManagedCluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
23748 /// let x = ManagedCluster::new().set_or_clear_config(None::<ClusterConfig>);
23749 /// ```
23750 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
23751 where
23752 T: std::convert::Into<crate::model::ClusterConfig>,
23753 {
23754 self.config = v.map(|x| x.into());
23755 self
23756 }
23757
23758 /// Sets the value of [labels][crate::model::ManagedCluster::labels].
23759 ///
23760 /// # Example
23761 /// ```ignore,no_run
23762 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
23763 /// let x = ManagedCluster::new().set_labels([
23764 /// ("key0", "abc"),
23765 /// ("key1", "xyz"),
23766 /// ]);
23767 /// ```
23768 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23769 where
23770 T: std::iter::IntoIterator<Item = (K, V)>,
23771 K: std::convert::Into<std::string::String>,
23772 V: std::convert::Into<std::string::String>,
23773 {
23774 use std::iter::Iterator;
23775 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23776 self
23777 }
23778}
23779
23780impl wkt::message::Message for ManagedCluster {
23781 fn typename() -> &'static str {
23782 "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
23783 }
23784}
23785
23786/// A selector that chooses target cluster for jobs based on metadata.
23787#[derive(Clone, Default, PartialEq)]
23788#[non_exhaustive]
23789pub struct ClusterSelector {
23790 /// Optional. The zone where workflow process executes. This parameter does not
23791 /// affect the selection of the cluster.
23792 ///
23793 /// If unspecified, the zone of the first cluster matching the selector
23794 /// is used.
23795 pub zone: std::string::String,
23796
23797 /// Required. The cluster labels. Cluster must have all labels
23798 /// to match.
23799 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
23800
23801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23802}
23803
23804impl ClusterSelector {
23805 /// Creates a new default instance.
23806 pub fn new() -> Self {
23807 std::default::Default::default()
23808 }
23809
23810 /// Sets the value of [zone][crate::model::ClusterSelector::zone].
23811 ///
23812 /// # Example
23813 /// ```ignore,no_run
23814 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
23815 /// let x = ClusterSelector::new().set_zone("example");
23816 /// ```
23817 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23818 self.zone = v.into();
23819 self
23820 }
23821
23822 /// Sets the value of [cluster_labels][crate::model::ClusterSelector::cluster_labels].
23823 ///
23824 /// # Example
23825 /// ```ignore,no_run
23826 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
23827 /// let x = ClusterSelector::new().set_cluster_labels([
23828 /// ("key0", "abc"),
23829 /// ("key1", "xyz"),
23830 /// ]);
23831 /// ```
23832 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
23833 where
23834 T: std::iter::IntoIterator<Item = (K, V)>,
23835 K: std::convert::Into<std::string::String>,
23836 V: std::convert::Into<std::string::String>,
23837 {
23838 use std::iter::Iterator;
23839 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23840 self
23841 }
23842}
23843
23844impl wkt::message::Message for ClusterSelector {
23845 fn typename() -> &'static str {
23846 "type.googleapis.com/google.cloud.dataproc.v1.ClusterSelector"
23847 }
23848}
23849
23850/// A job executed by the workflow.
23851#[derive(Clone, Default, PartialEq)]
23852#[non_exhaustive]
23853pub struct OrderedJob {
23854 /// Required. The step id. The id must be unique among all jobs
23855 /// within the template.
23856 ///
23857 /// The step id is used as prefix for job id, as job
23858 /// `goog-dataproc-workflow-step-id` label, and in
23859 /// [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
23860 /// field from other steps.
23861 ///
23862 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
23863 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
23864 /// or hyphen. Must consist of between 3 and 50 characters.
23865 ///
23866 /// [google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]: crate::model::OrderedJob::prerequisite_step_ids
23867 pub step_id: std::string::String,
23868
23869 /// Optional. The labels to associate with this job.
23870 ///
23871 /// Label keys must be between 1 and 63 characters long, and must conform to
23872 /// the following regular expression:
23873 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
23874 ///
23875 /// Label values must be between 1 and 63 characters long, and must conform to
23876 /// the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
23877 ///
23878 /// No more than 32 labels can be associated with a given job.
23879 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23880
23881 /// Optional. Job scheduling configuration.
23882 pub scheduling: std::option::Option<crate::model::JobScheduling>,
23883
23884 /// Optional. The optional list of prerequisite job step_ids.
23885 /// If not specified, the job will start at the beginning of workflow.
23886 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
23887
23888 /// Required. The job definition.
23889 pub job_type: std::option::Option<crate::model::ordered_job::JobType>,
23890
23891 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23892}
23893
23894impl OrderedJob {
23895 /// Creates a new default instance.
23896 pub fn new() -> Self {
23897 std::default::Default::default()
23898 }
23899
23900 /// Sets the value of [step_id][crate::model::OrderedJob::step_id].
23901 ///
23902 /// # Example
23903 /// ```ignore,no_run
23904 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23905 /// let x = OrderedJob::new().set_step_id("example");
23906 /// ```
23907 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23908 self.step_id = v.into();
23909 self
23910 }
23911
23912 /// Sets the value of [labels][crate::model::OrderedJob::labels].
23913 ///
23914 /// # Example
23915 /// ```ignore,no_run
23916 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23917 /// let x = OrderedJob::new().set_labels([
23918 /// ("key0", "abc"),
23919 /// ("key1", "xyz"),
23920 /// ]);
23921 /// ```
23922 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23923 where
23924 T: std::iter::IntoIterator<Item = (K, V)>,
23925 K: std::convert::Into<std::string::String>,
23926 V: std::convert::Into<std::string::String>,
23927 {
23928 use std::iter::Iterator;
23929 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23930 self
23931 }
23932
23933 /// Sets the value of [scheduling][crate::model::OrderedJob::scheduling].
23934 ///
23935 /// # Example
23936 /// ```ignore,no_run
23937 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23938 /// use google_cloud_dataproc_v1::model::JobScheduling;
23939 /// let x = OrderedJob::new().set_scheduling(JobScheduling::default()/* use setters */);
23940 /// ```
23941 pub fn set_scheduling<T>(mut self, v: T) -> Self
23942 where
23943 T: std::convert::Into<crate::model::JobScheduling>,
23944 {
23945 self.scheduling = std::option::Option::Some(v.into());
23946 self
23947 }
23948
23949 /// Sets or clears the value of [scheduling][crate::model::OrderedJob::scheduling].
23950 ///
23951 /// # Example
23952 /// ```ignore,no_run
23953 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23954 /// use google_cloud_dataproc_v1::model::JobScheduling;
23955 /// let x = OrderedJob::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
23956 /// let x = OrderedJob::new().set_or_clear_scheduling(None::<JobScheduling>);
23957 /// ```
23958 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
23959 where
23960 T: std::convert::Into<crate::model::JobScheduling>,
23961 {
23962 self.scheduling = v.map(|x| x.into());
23963 self
23964 }
23965
23966 /// Sets the value of [prerequisite_step_ids][crate::model::OrderedJob::prerequisite_step_ids].
23967 ///
23968 /// # Example
23969 /// ```ignore,no_run
23970 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23971 /// let x = OrderedJob::new().set_prerequisite_step_ids(["a", "b", "c"]);
23972 /// ```
23973 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
23974 where
23975 T: std::iter::IntoIterator<Item = V>,
23976 V: std::convert::Into<std::string::String>,
23977 {
23978 use std::iter::Iterator;
23979 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
23980 self
23981 }
23982
23983 /// Sets the value of [job_type][crate::model::OrderedJob::job_type].
23984 ///
23985 /// Note that all the setters affecting `job_type` are mutually
23986 /// exclusive.
23987 ///
23988 /// # Example
23989 /// ```ignore,no_run
23990 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23991 /// use google_cloud_dataproc_v1::model::HadoopJob;
23992 /// let x = OrderedJob::new().set_job_type(Some(
23993 /// google_cloud_dataproc_v1::model::ordered_job::JobType::HadoopJob(HadoopJob::default().into())));
23994 /// ```
23995 pub fn set_job_type<
23996 T: std::convert::Into<std::option::Option<crate::model::ordered_job::JobType>>,
23997 >(
23998 mut self,
23999 v: T,
24000 ) -> Self {
24001 self.job_type = v.into();
24002 self
24003 }
24004
24005 /// The value of [job_type][crate::model::OrderedJob::job_type]
24006 /// if it holds a `HadoopJob`, `None` if the field is not set or
24007 /// holds a different branch.
24008 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
24009 #[allow(unreachable_patterns)]
24010 self.job_type.as_ref().and_then(|v| match v {
24011 crate::model::ordered_job::JobType::HadoopJob(v) => std::option::Option::Some(v),
24012 _ => std::option::Option::None,
24013 })
24014 }
24015
24016 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24017 /// to hold a `HadoopJob`.
24018 ///
24019 /// Note that all the setters affecting `job_type` are
24020 /// mutually exclusive.
24021 ///
24022 /// # Example
24023 /// ```ignore,no_run
24024 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24025 /// use google_cloud_dataproc_v1::model::HadoopJob;
24026 /// let x = OrderedJob::new().set_hadoop_job(HadoopJob::default()/* use setters */);
24027 /// assert!(x.hadoop_job().is_some());
24028 /// assert!(x.spark_job().is_none());
24029 /// assert!(x.pyspark_job().is_none());
24030 /// assert!(x.hive_job().is_none());
24031 /// assert!(x.pig_job().is_none());
24032 /// assert!(x.spark_r_job().is_none());
24033 /// assert!(x.spark_sql_job().is_none());
24034 /// assert!(x.presto_job().is_none());
24035 /// assert!(x.trino_job().is_none());
24036 /// assert!(x.flink_job().is_none());
24037 /// ```
24038 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
24039 mut self,
24040 v: T,
24041 ) -> Self {
24042 self.job_type =
24043 std::option::Option::Some(crate::model::ordered_job::JobType::HadoopJob(v.into()));
24044 self
24045 }
24046
24047 /// The value of [job_type][crate::model::OrderedJob::job_type]
24048 /// if it holds a `SparkJob`, `None` if the field is not set or
24049 /// holds a different branch.
24050 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
24051 #[allow(unreachable_patterns)]
24052 self.job_type.as_ref().and_then(|v| match v {
24053 crate::model::ordered_job::JobType::SparkJob(v) => std::option::Option::Some(v),
24054 _ => std::option::Option::None,
24055 })
24056 }
24057
24058 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24059 /// to hold a `SparkJob`.
24060 ///
24061 /// Note that all the setters affecting `job_type` are
24062 /// mutually exclusive.
24063 ///
24064 /// # Example
24065 /// ```ignore,no_run
24066 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24067 /// use google_cloud_dataproc_v1::model::SparkJob;
24068 /// let x = OrderedJob::new().set_spark_job(SparkJob::default()/* use setters */);
24069 /// assert!(x.spark_job().is_some());
24070 /// assert!(x.hadoop_job().is_none());
24071 /// assert!(x.pyspark_job().is_none());
24072 /// assert!(x.hive_job().is_none());
24073 /// assert!(x.pig_job().is_none());
24074 /// assert!(x.spark_r_job().is_none());
24075 /// assert!(x.spark_sql_job().is_none());
24076 /// assert!(x.presto_job().is_none());
24077 /// assert!(x.trino_job().is_none());
24078 /// assert!(x.flink_job().is_none());
24079 /// ```
24080 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
24081 mut self,
24082 v: T,
24083 ) -> Self {
24084 self.job_type =
24085 std::option::Option::Some(crate::model::ordered_job::JobType::SparkJob(v.into()));
24086 self
24087 }
24088
24089 /// The value of [job_type][crate::model::OrderedJob::job_type]
24090 /// if it holds a `PysparkJob`, `None` if the field is not set or
24091 /// holds a different branch.
24092 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
24093 #[allow(unreachable_patterns)]
24094 self.job_type.as_ref().and_then(|v| match v {
24095 crate::model::ordered_job::JobType::PysparkJob(v) => std::option::Option::Some(v),
24096 _ => std::option::Option::None,
24097 })
24098 }
24099
24100 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24101 /// to hold a `PysparkJob`.
24102 ///
24103 /// Note that all the setters affecting `job_type` are
24104 /// mutually exclusive.
24105 ///
24106 /// # Example
24107 /// ```ignore,no_run
24108 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24109 /// use google_cloud_dataproc_v1::model::PySparkJob;
24110 /// let x = OrderedJob::new().set_pyspark_job(PySparkJob::default()/* use setters */);
24111 /// assert!(x.pyspark_job().is_some());
24112 /// assert!(x.hadoop_job().is_none());
24113 /// assert!(x.spark_job().is_none());
24114 /// assert!(x.hive_job().is_none());
24115 /// assert!(x.pig_job().is_none());
24116 /// assert!(x.spark_r_job().is_none());
24117 /// assert!(x.spark_sql_job().is_none());
24118 /// assert!(x.presto_job().is_none());
24119 /// assert!(x.trino_job().is_none());
24120 /// assert!(x.flink_job().is_none());
24121 /// ```
24122 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
24123 mut self,
24124 v: T,
24125 ) -> Self {
24126 self.job_type =
24127 std::option::Option::Some(crate::model::ordered_job::JobType::PysparkJob(v.into()));
24128 self
24129 }
24130
24131 /// The value of [job_type][crate::model::OrderedJob::job_type]
24132 /// if it holds a `HiveJob`, `None` if the field is not set or
24133 /// holds a different branch.
24134 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
24135 #[allow(unreachable_patterns)]
24136 self.job_type.as_ref().and_then(|v| match v {
24137 crate::model::ordered_job::JobType::HiveJob(v) => std::option::Option::Some(v),
24138 _ => std::option::Option::None,
24139 })
24140 }
24141
24142 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24143 /// to hold a `HiveJob`.
24144 ///
24145 /// Note that all the setters affecting `job_type` are
24146 /// mutually exclusive.
24147 ///
24148 /// # Example
24149 /// ```ignore,no_run
24150 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24151 /// use google_cloud_dataproc_v1::model::HiveJob;
24152 /// let x = OrderedJob::new().set_hive_job(HiveJob::default()/* use setters */);
24153 /// assert!(x.hive_job().is_some());
24154 /// assert!(x.hadoop_job().is_none());
24155 /// assert!(x.spark_job().is_none());
24156 /// assert!(x.pyspark_job().is_none());
24157 /// assert!(x.pig_job().is_none());
24158 /// assert!(x.spark_r_job().is_none());
24159 /// assert!(x.spark_sql_job().is_none());
24160 /// assert!(x.presto_job().is_none());
24161 /// assert!(x.trino_job().is_none());
24162 /// assert!(x.flink_job().is_none());
24163 /// ```
24164 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
24165 mut self,
24166 v: T,
24167 ) -> Self {
24168 self.job_type =
24169 std::option::Option::Some(crate::model::ordered_job::JobType::HiveJob(v.into()));
24170 self
24171 }
24172
24173 /// The value of [job_type][crate::model::OrderedJob::job_type]
24174 /// if it holds a `PigJob`, `None` if the field is not set or
24175 /// holds a different branch.
24176 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
24177 #[allow(unreachable_patterns)]
24178 self.job_type.as_ref().and_then(|v| match v {
24179 crate::model::ordered_job::JobType::PigJob(v) => std::option::Option::Some(v),
24180 _ => std::option::Option::None,
24181 })
24182 }
24183
24184 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24185 /// to hold a `PigJob`.
24186 ///
24187 /// Note that all the setters affecting `job_type` are
24188 /// mutually exclusive.
24189 ///
24190 /// # Example
24191 /// ```ignore,no_run
24192 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24193 /// use google_cloud_dataproc_v1::model::PigJob;
24194 /// let x = OrderedJob::new().set_pig_job(PigJob::default()/* use setters */);
24195 /// assert!(x.pig_job().is_some());
24196 /// assert!(x.hadoop_job().is_none());
24197 /// assert!(x.spark_job().is_none());
24198 /// assert!(x.pyspark_job().is_none());
24199 /// assert!(x.hive_job().is_none());
24200 /// assert!(x.spark_r_job().is_none());
24201 /// assert!(x.spark_sql_job().is_none());
24202 /// assert!(x.presto_job().is_none());
24203 /// assert!(x.trino_job().is_none());
24204 /// assert!(x.flink_job().is_none());
24205 /// ```
24206 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
24207 mut self,
24208 v: T,
24209 ) -> Self {
24210 self.job_type =
24211 std::option::Option::Some(crate::model::ordered_job::JobType::PigJob(v.into()));
24212 self
24213 }
24214
24215 /// The value of [job_type][crate::model::OrderedJob::job_type]
24216 /// if it holds a `SparkRJob`, `None` if the field is not set or
24217 /// holds a different branch.
24218 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
24219 #[allow(unreachable_patterns)]
24220 self.job_type.as_ref().and_then(|v| match v {
24221 crate::model::ordered_job::JobType::SparkRJob(v) => std::option::Option::Some(v),
24222 _ => std::option::Option::None,
24223 })
24224 }
24225
24226 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24227 /// to hold a `SparkRJob`.
24228 ///
24229 /// Note that all the setters affecting `job_type` are
24230 /// mutually exclusive.
24231 ///
24232 /// # Example
24233 /// ```ignore,no_run
24234 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24235 /// use google_cloud_dataproc_v1::model::SparkRJob;
24236 /// let x = OrderedJob::new().set_spark_r_job(SparkRJob::default()/* use setters */);
24237 /// assert!(x.spark_r_job().is_some());
24238 /// assert!(x.hadoop_job().is_none());
24239 /// assert!(x.spark_job().is_none());
24240 /// assert!(x.pyspark_job().is_none());
24241 /// assert!(x.hive_job().is_none());
24242 /// assert!(x.pig_job().is_none());
24243 /// assert!(x.spark_sql_job().is_none());
24244 /// assert!(x.presto_job().is_none());
24245 /// assert!(x.trino_job().is_none());
24246 /// assert!(x.flink_job().is_none());
24247 /// ```
24248 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
24249 mut self,
24250 v: T,
24251 ) -> Self {
24252 self.job_type =
24253 std::option::Option::Some(crate::model::ordered_job::JobType::SparkRJob(v.into()));
24254 self
24255 }
24256
24257 /// The value of [job_type][crate::model::OrderedJob::job_type]
24258 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
24259 /// holds a different branch.
24260 pub fn spark_sql_job(
24261 &self,
24262 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
24263 #[allow(unreachable_patterns)]
24264 self.job_type.as_ref().and_then(|v| match v {
24265 crate::model::ordered_job::JobType::SparkSqlJob(v) => std::option::Option::Some(v),
24266 _ => std::option::Option::None,
24267 })
24268 }
24269
24270 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24271 /// to hold a `SparkSqlJob`.
24272 ///
24273 /// Note that all the setters affecting `job_type` are
24274 /// mutually exclusive.
24275 ///
24276 /// # Example
24277 /// ```ignore,no_run
24278 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24279 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
24280 /// let x = OrderedJob::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
24281 /// assert!(x.spark_sql_job().is_some());
24282 /// assert!(x.hadoop_job().is_none());
24283 /// assert!(x.spark_job().is_none());
24284 /// assert!(x.pyspark_job().is_none());
24285 /// assert!(x.hive_job().is_none());
24286 /// assert!(x.pig_job().is_none());
24287 /// assert!(x.spark_r_job().is_none());
24288 /// assert!(x.presto_job().is_none());
24289 /// assert!(x.trino_job().is_none());
24290 /// assert!(x.flink_job().is_none());
24291 /// ```
24292 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
24293 mut self,
24294 v: T,
24295 ) -> Self {
24296 self.job_type =
24297 std::option::Option::Some(crate::model::ordered_job::JobType::SparkSqlJob(v.into()));
24298 self
24299 }
24300
24301 /// The value of [job_type][crate::model::OrderedJob::job_type]
24302 /// if it holds a `PrestoJob`, `None` if the field is not set or
24303 /// holds a different branch.
24304 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
24305 #[allow(unreachable_patterns)]
24306 self.job_type.as_ref().and_then(|v| match v {
24307 crate::model::ordered_job::JobType::PrestoJob(v) => std::option::Option::Some(v),
24308 _ => std::option::Option::None,
24309 })
24310 }
24311
24312 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24313 /// to hold a `PrestoJob`.
24314 ///
24315 /// Note that all the setters affecting `job_type` are
24316 /// mutually exclusive.
24317 ///
24318 /// # Example
24319 /// ```ignore,no_run
24320 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24321 /// use google_cloud_dataproc_v1::model::PrestoJob;
24322 /// let x = OrderedJob::new().set_presto_job(PrestoJob::default()/* use setters */);
24323 /// assert!(x.presto_job().is_some());
24324 /// assert!(x.hadoop_job().is_none());
24325 /// assert!(x.spark_job().is_none());
24326 /// assert!(x.pyspark_job().is_none());
24327 /// assert!(x.hive_job().is_none());
24328 /// assert!(x.pig_job().is_none());
24329 /// assert!(x.spark_r_job().is_none());
24330 /// assert!(x.spark_sql_job().is_none());
24331 /// assert!(x.trino_job().is_none());
24332 /// assert!(x.flink_job().is_none());
24333 /// ```
24334 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
24335 mut self,
24336 v: T,
24337 ) -> Self {
24338 self.job_type =
24339 std::option::Option::Some(crate::model::ordered_job::JobType::PrestoJob(v.into()));
24340 self
24341 }
24342
24343 /// The value of [job_type][crate::model::OrderedJob::job_type]
24344 /// if it holds a `TrinoJob`, `None` if the field is not set or
24345 /// holds a different branch.
24346 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
24347 #[allow(unreachable_patterns)]
24348 self.job_type.as_ref().and_then(|v| match v {
24349 crate::model::ordered_job::JobType::TrinoJob(v) => std::option::Option::Some(v),
24350 _ => std::option::Option::None,
24351 })
24352 }
24353
24354 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24355 /// to hold a `TrinoJob`.
24356 ///
24357 /// Note that all the setters affecting `job_type` are
24358 /// mutually exclusive.
24359 ///
24360 /// # Example
24361 /// ```ignore,no_run
24362 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24363 /// use google_cloud_dataproc_v1::model::TrinoJob;
24364 /// let x = OrderedJob::new().set_trino_job(TrinoJob::default()/* use setters */);
24365 /// assert!(x.trino_job().is_some());
24366 /// assert!(x.hadoop_job().is_none());
24367 /// assert!(x.spark_job().is_none());
24368 /// assert!(x.pyspark_job().is_none());
24369 /// assert!(x.hive_job().is_none());
24370 /// assert!(x.pig_job().is_none());
24371 /// assert!(x.spark_r_job().is_none());
24372 /// assert!(x.spark_sql_job().is_none());
24373 /// assert!(x.presto_job().is_none());
24374 /// assert!(x.flink_job().is_none());
24375 /// ```
24376 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
24377 mut self,
24378 v: T,
24379 ) -> Self {
24380 self.job_type =
24381 std::option::Option::Some(crate::model::ordered_job::JobType::TrinoJob(v.into()));
24382 self
24383 }
24384
24385 /// The value of [job_type][crate::model::OrderedJob::job_type]
24386 /// if it holds a `FlinkJob`, `None` if the field is not set or
24387 /// holds a different branch.
24388 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
24389 #[allow(unreachable_patterns)]
24390 self.job_type.as_ref().and_then(|v| match v {
24391 crate::model::ordered_job::JobType::FlinkJob(v) => std::option::Option::Some(v),
24392 _ => std::option::Option::None,
24393 })
24394 }
24395
24396 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
24397 /// to hold a `FlinkJob`.
24398 ///
24399 /// Note that all the setters affecting `job_type` are
24400 /// mutually exclusive.
24401 ///
24402 /// # Example
24403 /// ```ignore,no_run
24404 /// # use google_cloud_dataproc_v1::model::OrderedJob;
24405 /// use google_cloud_dataproc_v1::model::FlinkJob;
24406 /// let x = OrderedJob::new().set_flink_job(FlinkJob::default()/* use setters */);
24407 /// assert!(x.flink_job().is_some());
24408 /// assert!(x.hadoop_job().is_none());
24409 /// assert!(x.spark_job().is_none());
24410 /// assert!(x.pyspark_job().is_none());
24411 /// assert!(x.hive_job().is_none());
24412 /// assert!(x.pig_job().is_none());
24413 /// assert!(x.spark_r_job().is_none());
24414 /// assert!(x.spark_sql_job().is_none());
24415 /// assert!(x.presto_job().is_none());
24416 /// assert!(x.trino_job().is_none());
24417 /// ```
24418 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
24419 mut self,
24420 v: T,
24421 ) -> Self {
24422 self.job_type =
24423 std::option::Option::Some(crate::model::ordered_job::JobType::FlinkJob(v.into()));
24424 self
24425 }
24426}
24427
24428impl wkt::message::Message for OrderedJob {
24429 fn typename() -> &'static str {
24430 "type.googleapis.com/google.cloud.dataproc.v1.OrderedJob"
24431 }
24432}
24433
24434/// Defines additional types related to [OrderedJob].
24435pub mod ordered_job {
24436 #[allow(unused_imports)]
24437 use super::*;
24438
24439 /// Required. The job definition.
24440 #[derive(Clone, Debug, PartialEq)]
24441 #[non_exhaustive]
24442 pub enum JobType {
24443 /// Optional. Job is a Hadoop job.
24444 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
24445 /// Optional. Job is a Spark job.
24446 SparkJob(std::boxed::Box<crate::model::SparkJob>),
24447 /// Optional. Job is a PySpark job.
24448 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
24449 /// Optional. Job is a Hive job.
24450 HiveJob(std::boxed::Box<crate::model::HiveJob>),
24451 /// Optional. Job is a Pig job.
24452 PigJob(std::boxed::Box<crate::model::PigJob>),
24453 /// Optional. Job is a SparkR job.
24454 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
24455 /// Optional. Job is a SparkSql job.
24456 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
24457 /// Optional. Job is a Presto job.
24458 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
24459 /// Optional. Job is a Trino job.
24460 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
24461 /// Optional. Job is a Flink job.
24462 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
24463 }
24464}
24465
24466/// A configurable parameter that replaces one or more fields in the template.
24467/// Parameterizable fields:
24468///
24469/// - Labels
24470/// - File uris
24471/// - Job properties
24472/// - Job arguments
24473/// - Script variables
24474/// - Main class (in HadoopJob and SparkJob)
24475/// - Zone (in ClusterSelector)
24476#[derive(Clone, Default, PartialEq)]
24477#[non_exhaustive]
24478pub struct TemplateParameter {
24479 /// Required. Parameter name.
24480 /// The parameter name is used as the key, and paired with the
24481 /// parameter value, which are passed to the template when the template
24482 /// is instantiated.
24483 /// The name must contain only capital letters (A-Z), numbers (0-9), and
24484 /// underscores (_), and must not start with a number. The maximum length is
24485 /// 40 characters.
24486 pub name: std::string::String,
24487
24488 /// Required. Paths to all fields that the parameter replaces.
24489 /// A field is allowed to appear in at most one parameter's list of field
24490 /// paths.
24491 ///
24492 /// A field path is similar in syntax to a
24493 /// [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
24494 /// field path that references the zone field of a workflow template's cluster
24495 /// selector would be specified as `placement.clusterSelector.zone`.
24496 ///
24497 /// Also, field paths can reference fields using the following syntax:
24498 ///
24499 /// * Values in maps can be referenced by key:
24500 ///
24501 /// * labels['key']
24502 /// * placement.clusterSelector.clusterLabels['key']
24503 /// * placement.managedCluster.labels['key']
24504 /// * placement.clusterSelector.clusterLabels['key']
24505 /// * jobs['step-id'].labels['key']
24506 /// * Jobs in the jobs list can be referenced by step-id:
24507 ///
24508 /// * jobs['step-id'].hadoopJob.mainJarFileUri
24509 /// * jobs['step-id'].hiveJob.queryFileUri
24510 /// * jobs['step-id'].pySparkJob.mainPythonFileUri
24511 /// * jobs['step-id'].hadoopJob.jarFileUris[0]
24512 /// * jobs['step-id'].hadoopJob.archiveUris[0]
24513 /// * jobs['step-id'].hadoopJob.fileUris[0]
24514 /// * jobs['step-id'].pySparkJob.pythonFileUris[0]
24515 /// * Items in repeated fields can be referenced by a zero-based index:
24516 ///
24517 /// * jobs['step-id'].sparkJob.args[0]
24518 /// * Other examples:
24519 ///
24520 /// * jobs['step-id'].hadoopJob.properties['key']
24521 /// * jobs['step-id'].hadoopJob.args[0]
24522 /// * jobs['step-id'].hiveJob.scriptVariables['key']
24523 /// * jobs['step-id'].hadoopJob.mainJarFileUri
24524 /// * placement.clusterSelector.zone
24525 ///
24526 /// It may not be possible to parameterize maps and repeated fields in their
24527 /// entirety since only individual map values and individual items in repeated
24528 /// fields can be referenced. For example, the following field paths are
24529 /// invalid:
24530 ///
24531 /// - placement.clusterSelector.clusterLabels
24532 /// - jobs['step-id'].sparkJob.args
24533 ///
24534 /// [google.protobuf.FieldMask]: wkt::FieldMask
24535 pub fields: std::vec::Vec<std::string::String>,
24536
24537 /// Optional. Brief description of the parameter.
24538 /// Must not exceed 1024 characters.
24539 pub description: std::string::String,
24540
24541 /// Optional. Validation rules to be applied to this parameter's value.
24542 pub validation: std::option::Option<crate::model::ParameterValidation>,
24543
24544 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24545}
24546
24547impl TemplateParameter {
24548 /// Creates a new default instance.
24549 pub fn new() -> Self {
24550 std::default::Default::default()
24551 }
24552
24553 /// Sets the value of [name][crate::model::TemplateParameter::name].
24554 ///
24555 /// # Example
24556 /// ```ignore,no_run
24557 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24558 /// let x = TemplateParameter::new().set_name("example");
24559 /// ```
24560 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24561 self.name = v.into();
24562 self
24563 }
24564
24565 /// Sets the value of [fields][crate::model::TemplateParameter::fields].
24566 ///
24567 /// # Example
24568 /// ```ignore,no_run
24569 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24570 /// let x = TemplateParameter::new().set_fields(["a", "b", "c"]);
24571 /// ```
24572 pub fn set_fields<T, V>(mut self, v: T) -> Self
24573 where
24574 T: std::iter::IntoIterator<Item = V>,
24575 V: std::convert::Into<std::string::String>,
24576 {
24577 use std::iter::Iterator;
24578 self.fields = v.into_iter().map(|i| i.into()).collect();
24579 self
24580 }
24581
24582 /// Sets the value of [description][crate::model::TemplateParameter::description].
24583 ///
24584 /// # Example
24585 /// ```ignore,no_run
24586 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24587 /// let x = TemplateParameter::new().set_description("example");
24588 /// ```
24589 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24590 self.description = v.into();
24591 self
24592 }
24593
24594 /// Sets the value of [validation][crate::model::TemplateParameter::validation].
24595 ///
24596 /// # Example
24597 /// ```ignore,no_run
24598 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24599 /// use google_cloud_dataproc_v1::model::ParameterValidation;
24600 /// let x = TemplateParameter::new().set_validation(ParameterValidation::default()/* use setters */);
24601 /// ```
24602 pub fn set_validation<T>(mut self, v: T) -> Self
24603 where
24604 T: std::convert::Into<crate::model::ParameterValidation>,
24605 {
24606 self.validation = std::option::Option::Some(v.into());
24607 self
24608 }
24609
24610 /// Sets or clears the value of [validation][crate::model::TemplateParameter::validation].
24611 ///
24612 /// # Example
24613 /// ```ignore,no_run
24614 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
24615 /// use google_cloud_dataproc_v1::model::ParameterValidation;
24616 /// let x = TemplateParameter::new().set_or_clear_validation(Some(ParameterValidation::default()/* use setters */));
24617 /// let x = TemplateParameter::new().set_or_clear_validation(None::<ParameterValidation>);
24618 /// ```
24619 pub fn set_or_clear_validation<T>(mut self, v: std::option::Option<T>) -> Self
24620 where
24621 T: std::convert::Into<crate::model::ParameterValidation>,
24622 {
24623 self.validation = v.map(|x| x.into());
24624 self
24625 }
24626}
24627
24628impl wkt::message::Message for TemplateParameter {
24629 fn typename() -> &'static str {
24630 "type.googleapis.com/google.cloud.dataproc.v1.TemplateParameter"
24631 }
24632}
24633
24634/// Configuration for parameter validation.
24635#[derive(Clone, Default, PartialEq)]
24636#[non_exhaustive]
24637pub struct ParameterValidation {
24638 /// Required. The type of validation to be performed.
24639 pub validation_type: std::option::Option<crate::model::parameter_validation::ValidationType>,
24640
24641 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24642}
24643
24644impl ParameterValidation {
24645 /// Creates a new default instance.
24646 pub fn new() -> Self {
24647 std::default::Default::default()
24648 }
24649
24650 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type].
24651 ///
24652 /// Note that all the setters affecting `validation_type` are mutually
24653 /// exclusive.
24654 ///
24655 /// # Example
24656 /// ```ignore,no_run
24657 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
24658 /// use google_cloud_dataproc_v1::model::RegexValidation;
24659 /// let x = ParameterValidation::new().set_validation_type(Some(
24660 /// google_cloud_dataproc_v1::model::parameter_validation::ValidationType::Regex(RegexValidation::default().into())));
24661 /// ```
24662 pub fn set_validation_type<
24663 T: std::convert::Into<std::option::Option<crate::model::parameter_validation::ValidationType>>,
24664 >(
24665 mut self,
24666 v: T,
24667 ) -> Self {
24668 self.validation_type = v.into();
24669 self
24670 }
24671
24672 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
24673 /// if it holds a `Regex`, `None` if the field is not set or
24674 /// holds a different branch.
24675 pub fn regex(&self) -> std::option::Option<&std::boxed::Box<crate::model::RegexValidation>> {
24676 #[allow(unreachable_patterns)]
24677 self.validation_type.as_ref().and_then(|v| match v {
24678 crate::model::parameter_validation::ValidationType::Regex(v) => {
24679 std::option::Option::Some(v)
24680 }
24681 _ => std::option::Option::None,
24682 })
24683 }
24684
24685 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
24686 /// to hold a `Regex`.
24687 ///
24688 /// Note that all the setters affecting `validation_type` are
24689 /// mutually exclusive.
24690 ///
24691 /// # Example
24692 /// ```ignore,no_run
24693 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
24694 /// use google_cloud_dataproc_v1::model::RegexValidation;
24695 /// let x = ParameterValidation::new().set_regex(RegexValidation::default()/* use setters */);
24696 /// assert!(x.regex().is_some());
24697 /// assert!(x.values().is_none());
24698 /// ```
24699 pub fn set_regex<T: std::convert::Into<std::boxed::Box<crate::model::RegexValidation>>>(
24700 mut self,
24701 v: T,
24702 ) -> Self {
24703 self.validation_type = std::option::Option::Some(
24704 crate::model::parameter_validation::ValidationType::Regex(v.into()),
24705 );
24706 self
24707 }
24708
24709 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
24710 /// if it holds a `Values`, `None` if the field is not set or
24711 /// holds a different branch.
24712 pub fn values(&self) -> std::option::Option<&std::boxed::Box<crate::model::ValueValidation>> {
24713 #[allow(unreachable_patterns)]
24714 self.validation_type.as_ref().and_then(|v| match v {
24715 crate::model::parameter_validation::ValidationType::Values(v) => {
24716 std::option::Option::Some(v)
24717 }
24718 _ => std::option::Option::None,
24719 })
24720 }
24721
24722 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
24723 /// to hold a `Values`.
24724 ///
24725 /// Note that all the setters affecting `validation_type` are
24726 /// mutually exclusive.
24727 ///
24728 /// # Example
24729 /// ```ignore,no_run
24730 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
24731 /// use google_cloud_dataproc_v1::model::ValueValidation;
24732 /// let x = ParameterValidation::new().set_values(ValueValidation::default()/* use setters */);
24733 /// assert!(x.values().is_some());
24734 /// assert!(x.regex().is_none());
24735 /// ```
24736 pub fn set_values<T: std::convert::Into<std::boxed::Box<crate::model::ValueValidation>>>(
24737 mut self,
24738 v: T,
24739 ) -> Self {
24740 self.validation_type = std::option::Option::Some(
24741 crate::model::parameter_validation::ValidationType::Values(v.into()),
24742 );
24743 self
24744 }
24745}
24746
24747impl wkt::message::Message for ParameterValidation {
24748 fn typename() -> &'static str {
24749 "type.googleapis.com/google.cloud.dataproc.v1.ParameterValidation"
24750 }
24751}
24752
24753/// Defines additional types related to [ParameterValidation].
24754pub mod parameter_validation {
24755 #[allow(unused_imports)]
24756 use super::*;
24757
24758 /// Required. The type of validation to be performed.
24759 #[derive(Clone, Debug, PartialEq)]
24760 #[non_exhaustive]
24761 pub enum ValidationType {
24762 /// Validation based on regular expressions.
24763 Regex(std::boxed::Box<crate::model::RegexValidation>),
24764 /// Validation based on a list of allowed values.
24765 Values(std::boxed::Box<crate::model::ValueValidation>),
24766 }
24767}
24768
24769/// Validation based on regular expressions.
24770#[derive(Clone, Default, PartialEq)]
24771#[non_exhaustive]
24772pub struct RegexValidation {
24773 /// Required. RE2 regular expressions used to validate the parameter's value.
24774 /// The value must match the regex in its entirety (substring
24775 /// matches are not sufficient).
24776 pub regexes: std::vec::Vec<std::string::String>,
24777
24778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24779}
24780
24781impl RegexValidation {
24782 /// Creates a new default instance.
24783 pub fn new() -> Self {
24784 std::default::Default::default()
24785 }
24786
24787 /// Sets the value of [regexes][crate::model::RegexValidation::regexes].
24788 ///
24789 /// # Example
24790 /// ```ignore,no_run
24791 /// # use google_cloud_dataproc_v1::model::RegexValidation;
24792 /// let x = RegexValidation::new().set_regexes(["a", "b", "c"]);
24793 /// ```
24794 pub fn set_regexes<T, V>(mut self, v: T) -> Self
24795 where
24796 T: std::iter::IntoIterator<Item = V>,
24797 V: std::convert::Into<std::string::String>,
24798 {
24799 use std::iter::Iterator;
24800 self.regexes = v.into_iter().map(|i| i.into()).collect();
24801 self
24802 }
24803}
24804
24805impl wkt::message::Message for RegexValidation {
24806 fn typename() -> &'static str {
24807 "type.googleapis.com/google.cloud.dataproc.v1.RegexValidation"
24808 }
24809}
24810
24811/// Validation based on a list of allowed values.
24812#[derive(Clone, Default, PartialEq)]
24813#[non_exhaustive]
24814pub struct ValueValidation {
24815 /// Required. List of allowed values for the parameter.
24816 pub values: std::vec::Vec<std::string::String>,
24817
24818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24819}
24820
24821impl ValueValidation {
24822 /// Creates a new default instance.
24823 pub fn new() -> Self {
24824 std::default::Default::default()
24825 }
24826
24827 /// Sets the value of [values][crate::model::ValueValidation::values].
24828 ///
24829 /// # Example
24830 /// ```ignore,no_run
24831 /// # use google_cloud_dataproc_v1::model::ValueValidation;
24832 /// let x = ValueValidation::new().set_values(["a", "b", "c"]);
24833 /// ```
24834 pub fn set_values<T, V>(mut self, v: T) -> Self
24835 where
24836 T: std::iter::IntoIterator<Item = V>,
24837 V: std::convert::Into<std::string::String>,
24838 {
24839 use std::iter::Iterator;
24840 self.values = v.into_iter().map(|i| i.into()).collect();
24841 self
24842 }
24843}
24844
24845impl wkt::message::Message for ValueValidation {
24846 fn typename() -> &'static str {
24847 "type.googleapis.com/google.cloud.dataproc.v1.ValueValidation"
24848 }
24849}
24850
24851/// A Dataproc workflow template resource.
24852#[derive(Clone, Default, PartialEq)]
24853#[non_exhaustive]
24854pub struct WorkflowMetadata {
24855 /// Output only. The resource name of the workflow template as described
24856 /// in <https://cloud.google.com/apis/design/resource_names>.
24857 ///
24858 /// * For `projects.regions.workflowTemplates`, the resource name of the
24859 /// template has the following format:
24860 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24861 ///
24862 /// * For `projects.locations.workflowTemplates`, the resource name of the
24863 /// template has the following format:
24864 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24865 ///
24866 pub template: std::string::String,
24867
24868 /// Output only. The version of template at the time of
24869 /// workflow instantiation.
24870 pub version: i32,
24871
24872 /// Output only. The create cluster operation metadata.
24873 pub create_cluster: std::option::Option<crate::model::ClusterOperation>,
24874
24875 /// Output only. The workflow graph.
24876 pub graph: std::option::Option<crate::model::WorkflowGraph>,
24877
24878 /// Output only. The delete cluster operation metadata.
24879 pub delete_cluster: std::option::Option<crate::model::ClusterOperation>,
24880
24881 /// Output only. The workflow state.
24882 pub state: crate::model::workflow_metadata::State,
24883
24884 /// Output only. The name of the target cluster.
24885 pub cluster_name: std::string::String,
24886
24887 /// Map from parameter names to values that were used for those parameters.
24888 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
24889
24890 /// Output only. Workflow start time.
24891 pub start_time: std::option::Option<wkt::Timestamp>,
24892
24893 /// Output only. Workflow end time.
24894 pub end_time: std::option::Option<wkt::Timestamp>,
24895
24896 /// Output only. The UUID of target cluster.
24897 pub cluster_uuid: std::string::String,
24898
24899 /// Output only. The timeout duration for the DAG of jobs, expressed in seconds
24900 /// (see [JSON representation of
24901 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
24902 pub dag_timeout: std::option::Option<wkt::Duration>,
24903
24904 /// Output only. DAG start time, only set for workflows with
24905 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24906 /// DAG begins.
24907 ///
24908 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24909 pub dag_start_time: std::option::Option<wkt::Timestamp>,
24910
24911 /// Output only. DAG end time, only set for workflows with
24912 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24913 /// DAG ends.
24914 ///
24915 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24916 pub dag_end_time: std::option::Option<wkt::Timestamp>,
24917
24918 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24919}
24920
24921impl WorkflowMetadata {
24922 /// Creates a new default instance.
24923 pub fn new() -> Self {
24924 std::default::Default::default()
24925 }
24926
24927 /// Sets the value of [template][crate::model::WorkflowMetadata::template].
24928 ///
24929 /// # Example
24930 /// ```ignore,no_run
24931 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24932 /// let x = WorkflowMetadata::new().set_template("example");
24933 /// ```
24934 pub fn set_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24935 self.template = v.into();
24936 self
24937 }
24938
24939 /// Sets the value of [version][crate::model::WorkflowMetadata::version].
24940 ///
24941 /// # Example
24942 /// ```ignore,no_run
24943 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24944 /// let x = WorkflowMetadata::new().set_version(42);
24945 /// ```
24946 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24947 self.version = v.into();
24948 self
24949 }
24950
24951 /// Sets the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24952 ///
24953 /// # Example
24954 /// ```ignore,no_run
24955 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24956 /// use google_cloud_dataproc_v1::model::ClusterOperation;
24957 /// let x = WorkflowMetadata::new().set_create_cluster(ClusterOperation::default()/* use setters */);
24958 /// ```
24959 pub fn set_create_cluster<T>(mut self, v: T) -> Self
24960 where
24961 T: std::convert::Into<crate::model::ClusterOperation>,
24962 {
24963 self.create_cluster = std::option::Option::Some(v.into());
24964 self
24965 }
24966
24967 /// Sets or clears the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24968 ///
24969 /// # Example
24970 /// ```ignore,no_run
24971 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24972 /// use google_cloud_dataproc_v1::model::ClusterOperation;
24973 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(Some(ClusterOperation::default()/* use setters */));
24974 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(None::<ClusterOperation>);
24975 /// ```
24976 pub fn set_or_clear_create_cluster<T>(mut self, v: std::option::Option<T>) -> Self
24977 where
24978 T: std::convert::Into<crate::model::ClusterOperation>,
24979 {
24980 self.create_cluster = v.map(|x| x.into());
24981 self
24982 }
24983
24984 /// Sets the value of [graph][crate::model::WorkflowMetadata::graph].
24985 ///
24986 /// # Example
24987 /// ```ignore,no_run
24988 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24989 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
24990 /// let x = WorkflowMetadata::new().set_graph(WorkflowGraph::default()/* use setters */);
24991 /// ```
24992 pub fn set_graph<T>(mut self, v: T) -> Self
24993 where
24994 T: std::convert::Into<crate::model::WorkflowGraph>,
24995 {
24996 self.graph = std::option::Option::Some(v.into());
24997 self
24998 }
24999
25000 /// Sets or clears the value of [graph][crate::model::WorkflowMetadata::graph].
25001 ///
25002 /// # Example
25003 /// ```ignore,no_run
25004 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25005 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
25006 /// let x = WorkflowMetadata::new().set_or_clear_graph(Some(WorkflowGraph::default()/* use setters */));
25007 /// let x = WorkflowMetadata::new().set_or_clear_graph(None::<WorkflowGraph>);
25008 /// ```
25009 pub fn set_or_clear_graph<T>(mut self, v: std::option::Option<T>) -> Self
25010 where
25011 T: std::convert::Into<crate::model::WorkflowGraph>,
25012 {
25013 self.graph = v.map(|x| x.into());
25014 self
25015 }
25016
25017 /// Sets the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
25018 ///
25019 /// # Example
25020 /// ```ignore,no_run
25021 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25022 /// use google_cloud_dataproc_v1::model::ClusterOperation;
25023 /// let x = WorkflowMetadata::new().set_delete_cluster(ClusterOperation::default()/* use setters */);
25024 /// ```
25025 pub fn set_delete_cluster<T>(mut self, v: T) -> Self
25026 where
25027 T: std::convert::Into<crate::model::ClusterOperation>,
25028 {
25029 self.delete_cluster = std::option::Option::Some(v.into());
25030 self
25031 }
25032
25033 /// Sets or clears the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
25034 ///
25035 /// # Example
25036 /// ```ignore,no_run
25037 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25038 /// use google_cloud_dataproc_v1::model::ClusterOperation;
25039 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(Some(ClusterOperation::default()/* use setters */));
25040 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(None::<ClusterOperation>);
25041 /// ```
25042 pub fn set_or_clear_delete_cluster<T>(mut self, v: std::option::Option<T>) -> Self
25043 where
25044 T: std::convert::Into<crate::model::ClusterOperation>,
25045 {
25046 self.delete_cluster = v.map(|x| x.into());
25047 self
25048 }
25049
25050 /// Sets the value of [state][crate::model::WorkflowMetadata::state].
25051 ///
25052 /// # Example
25053 /// ```ignore,no_run
25054 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25055 /// use google_cloud_dataproc_v1::model::workflow_metadata::State;
25056 /// let x0 = WorkflowMetadata::new().set_state(State::Pending);
25057 /// let x1 = WorkflowMetadata::new().set_state(State::Running);
25058 /// let x2 = WorkflowMetadata::new().set_state(State::Done);
25059 /// ```
25060 pub fn set_state<T: std::convert::Into<crate::model::workflow_metadata::State>>(
25061 mut self,
25062 v: T,
25063 ) -> Self {
25064 self.state = v.into();
25065 self
25066 }
25067
25068 /// Sets the value of [cluster_name][crate::model::WorkflowMetadata::cluster_name].
25069 ///
25070 /// # Example
25071 /// ```ignore,no_run
25072 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25073 /// let x = WorkflowMetadata::new().set_cluster_name("example");
25074 /// ```
25075 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25076 self.cluster_name = v.into();
25077 self
25078 }
25079
25080 /// Sets the value of [parameters][crate::model::WorkflowMetadata::parameters].
25081 ///
25082 /// # Example
25083 /// ```ignore,no_run
25084 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25085 /// let x = WorkflowMetadata::new().set_parameters([
25086 /// ("key0", "abc"),
25087 /// ("key1", "xyz"),
25088 /// ]);
25089 /// ```
25090 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
25091 where
25092 T: std::iter::IntoIterator<Item = (K, V)>,
25093 K: std::convert::Into<std::string::String>,
25094 V: std::convert::Into<std::string::String>,
25095 {
25096 use std::iter::Iterator;
25097 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
25098 self
25099 }
25100
25101 /// Sets the value of [start_time][crate::model::WorkflowMetadata::start_time].
25102 ///
25103 /// # Example
25104 /// ```ignore,no_run
25105 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25106 /// use wkt::Timestamp;
25107 /// let x = WorkflowMetadata::new().set_start_time(Timestamp::default()/* use setters */);
25108 /// ```
25109 pub fn set_start_time<T>(mut self, v: T) -> Self
25110 where
25111 T: std::convert::Into<wkt::Timestamp>,
25112 {
25113 self.start_time = std::option::Option::Some(v.into());
25114 self
25115 }
25116
25117 /// Sets or clears the value of [start_time][crate::model::WorkflowMetadata::start_time].
25118 ///
25119 /// # Example
25120 /// ```ignore,no_run
25121 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25122 /// use wkt::Timestamp;
25123 /// let x = WorkflowMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
25124 /// let x = WorkflowMetadata::new().set_or_clear_start_time(None::<Timestamp>);
25125 /// ```
25126 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
25127 where
25128 T: std::convert::Into<wkt::Timestamp>,
25129 {
25130 self.start_time = v.map(|x| x.into());
25131 self
25132 }
25133
25134 /// Sets the value of [end_time][crate::model::WorkflowMetadata::end_time].
25135 ///
25136 /// # Example
25137 /// ```ignore,no_run
25138 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25139 /// use wkt::Timestamp;
25140 /// let x = WorkflowMetadata::new().set_end_time(Timestamp::default()/* use setters */);
25141 /// ```
25142 pub fn set_end_time<T>(mut self, v: T) -> Self
25143 where
25144 T: std::convert::Into<wkt::Timestamp>,
25145 {
25146 self.end_time = std::option::Option::Some(v.into());
25147 self
25148 }
25149
25150 /// Sets or clears the value of [end_time][crate::model::WorkflowMetadata::end_time].
25151 ///
25152 /// # Example
25153 /// ```ignore,no_run
25154 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25155 /// use wkt::Timestamp;
25156 /// let x = WorkflowMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
25157 /// let x = WorkflowMetadata::new().set_or_clear_end_time(None::<Timestamp>);
25158 /// ```
25159 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
25160 where
25161 T: std::convert::Into<wkt::Timestamp>,
25162 {
25163 self.end_time = v.map(|x| x.into());
25164 self
25165 }
25166
25167 /// Sets the value of [cluster_uuid][crate::model::WorkflowMetadata::cluster_uuid].
25168 ///
25169 /// # Example
25170 /// ```ignore,no_run
25171 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25172 /// let x = WorkflowMetadata::new().set_cluster_uuid("example");
25173 /// ```
25174 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25175 self.cluster_uuid = v.into();
25176 self
25177 }
25178
25179 /// Sets the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
25180 ///
25181 /// # Example
25182 /// ```ignore,no_run
25183 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25184 /// use wkt::Duration;
25185 /// let x = WorkflowMetadata::new().set_dag_timeout(Duration::default()/* use setters */);
25186 /// ```
25187 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
25188 where
25189 T: std::convert::Into<wkt::Duration>,
25190 {
25191 self.dag_timeout = std::option::Option::Some(v.into());
25192 self
25193 }
25194
25195 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
25196 ///
25197 /// # Example
25198 /// ```ignore,no_run
25199 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25200 /// use wkt::Duration;
25201 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
25202 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(None::<Duration>);
25203 /// ```
25204 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
25205 where
25206 T: std::convert::Into<wkt::Duration>,
25207 {
25208 self.dag_timeout = v.map(|x| x.into());
25209 self
25210 }
25211
25212 /// Sets the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
25213 ///
25214 /// # Example
25215 /// ```ignore,no_run
25216 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25217 /// use wkt::Timestamp;
25218 /// let x = WorkflowMetadata::new().set_dag_start_time(Timestamp::default()/* use setters */);
25219 /// ```
25220 pub fn set_dag_start_time<T>(mut self, v: T) -> Self
25221 where
25222 T: std::convert::Into<wkt::Timestamp>,
25223 {
25224 self.dag_start_time = std::option::Option::Some(v.into());
25225 self
25226 }
25227
25228 /// Sets or clears the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
25229 ///
25230 /// # Example
25231 /// ```ignore,no_run
25232 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25233 /// use wkt::Timestamp;
25234 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(Some(Timestamp::default()/* use setters */));
25235 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(None::<Timestamp>);
25236 /// ```
25237 pub fn set_or_clear_dag_start_time<T>(mut self, v: std::option::Option<T>) -> Self
25238 where
25239 T: std::convert::Into<wkt::Timestamp>,
25240 {
25241 self.dag_start_time = v.map(|x| x.into());
25242 self
25243 }
25244
25245 /// Sets the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
25246 ///
25247 /// # Example
25248 /// ```ignore,no_run
25249 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25250 /// use wkt::Timestamp;
25251 /// let x = WorkflowMetadata::new().set_dag_end_time(Timestamp::default()/* use setters */);
25252 /// ```
25253 pub fn set_dag_end_time<T>(mut self, v: T) -> Self
25254 where
25255 T: std::convert::Into<wkt::Timestamp>,
25256 {
25257 self.dag_end_time = std::option::Option::Some(v.into());
25258 self
25259 }
25260
25261 /// Sets or clears the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
25262 ///
25263 /// # Example
25264 /// ```ignore,no_run
25265 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
25266 /// use wkt::Timestamp;
25267 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(Some(Timestamp::default()/* use setters */));
25268 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(None::<Timestamp>);
25269 /// ```
25270 pub fn set_or_clear_dag_end_time<T>(mut self, v: std::option::Option<T>) -> Self
25271 where
25272 T: std::convert::Into<wkt::Timestamp>,
25273 {
25274 self.dag_end_time = v.map(|x| x.into());
25275 self
25276 }
25277}
25278
25279impl wkt::message::Message for WorkflowMetadata {
25280 fn typename() -> &'static str {
25281 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowMetadata"
25282 }
25283}
25284
25285/// Defines additional types related to [WorkflowMetadata].
25286pub mod workflow_metadata {
25287 #[allow(unused_imports)]
25288 use super::*;
25289
25290 /// The operation state.
25291 ///
25292 /// # Working with unknown values
25293 ///
25294 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25295 /// additional enum variants at any time. Adding new variants is not considered
25296 /// a breaking change. Applications should write their code in anticipation of:
25297 ///
25298 /// - New values appearing in future releases of the client library, **and**
25299 /// - New values received dynamically, without application changes.
25300 ///
25301 /// Please consult the [Working with enums] section in the user guide for some
25302 /// guidelines.
25303 ///
25304 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25305 #[derive(Clone, Debug, PartialEq)]
25306 #[non_exhaustive]
25307 pub enum State {
25308 /// Unused.
25309 Unknown,
25310 /// The operation has been created.
25311 Pending,
25312 /// The operation is running.
25313 Running,
25314 /// The operation is done; either cancelled or completed.
25315 Done,
25316 /// If set, the enum was initialized with an unknown value.
25317 ///
25318 /// Applications can examine the value using [State::value] or
25319 /// [State::name].
25320 UnknownValue(state::UnknownValue),
25321 }
25322
25323 #[doc(hidden)]
25324 pub mod state {
25325 #[allow(unused_imports)]
25326 use super::*;
25327 #[derive(Clone, Debug, PartialEq)]
25328 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25329 }
25330
25331 impl State {
25332 /// Gets the enum value.
25333 ///
25334 /// Returns `None` if the enum contains an unknown value deserialized from
25335 /// the string representation of enums.
25336 pub fn value(&self) -> std::option::Option<i32> {
25337 match self {
25338 Self::Unknown => std::option::Option::Some(0),
25339 Self::Pending => std::option::Option::Some(1),
25340 Self::Running => std::option::Option::Some(2),
25341 Self::Done => std::option::Option::Some(3),
25342 Self::UnknownValue(u) => u.0.value(),
25343 }
25344 }
25345
25346 /// Gets the enum value as a string.
25347 ///
25348 /// Returns `None` if the enum contains an unknown value deserialized from
25349 /// the integer representation of enums.
25350 pub fn name(&self) -> std::option::Option<&str> {
25351 match self {
25352 Self::Unknown => std::option::Option::Some("UNKNOWN"),
25353 Self::Pending => std::option::Option::Some("PENDING"),
25354 Self::Running => std::option::Option::Some("RUNNING"),
25355 Self::Done => std::option::Option::Some("DONE"),
25356 Self::UnknownValue(u) => u.0.name(),
25357 }
25358 }
25359 }
25360
25361 impl std::default::Default for State {
25362 fn default() -> Self {
25363 use std::convert::From;
25364 Self::from(0)
25365 }
25366 }
25367
25368 impl std::fmt::Display for State {
25369 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25370 wkt::internal::display_enum(f, self.name(), self.value())
25371 }
25372 }
25373
25374 impl std::convert::From<i32> for State {
25375 fn from(value: i32) -> Self {
25376 match value {
25377 0 => Self::Unknown,
25378 1 => Self::Pending,
25379 2 => Self::Running,
25380 3 => Self::Done,
25381 _ => Self::UnknownValue(state::UnknownValue(
25382 wkt::internal::UnknownEnumValue::Integer(value),
25383 )),
25384 }
25385 }
25386 }
25387
25388 impl std::convert::From<&str> for State {
25389 fn from(value: &str) -> Self {
25390 use std::string::ToString;
25391 match value {
25392 "UNKNOWN" => Self::Unknown,
25393 "PENDING" => Self::Pending,
25394 "RUNNING" => Self::Running,
25395 "DONE" => Self::Done,
25396 _ => Self::UnknownValue(state::UnknownValue(
25397 wkt::internal::UnknownEnumValue::String(value.to_string()),
25398 )),
25399 }
25400 }
25401 }
25402
25403 impl serde::ser::Serialize for State {
25404 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25405 where
25406 S: serde::Serializer,
25407 {
25408 match self {
25409 Self::Unknown => serializer.serialize_i32(0),
25410 Self::Pending => serializer.serialize_i32(1),
25411 Self::Running => serializer.serialize_i32(2),
25412 Self::Done => serializer.serialize_i32(3),
25413 Self::UnknownValue(u) => u.0.serialize(serializer),
25414 }
25415 }
25416 }
25417
25418 impl<'de> serde::de::Deserialize<'de> for State {
25419 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25420 where
25421 D: serde::Deserializer<'de>,
25422 {
25423 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
25424 ".google.cloud.dataproc.v1.WorkflowMetadata.State",
25425 ))
25426 }
25427 }
25428}
25429
25430/// The cluster operation triggered by a workflow.
25431#[derive(Clone, Default, PartialEq)]
25432#[non_exhaustive]
25433pub struct ClusterOperation {
25434 /// Output only. The id of the cluster operation.
25435 pub operation_id: std::string::String,
25436
25437 /// Output only. Error, if operation failed.
25438 pub error: std::string::String,
25439
25440 /// Output only. Indicates the operation is done.
25441 pub done: bool,
25442
25443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25444}
25445
25446impl ClusterOperation {
25447 /// Creates a new default instance.
25448 pub fn new() -> Self {
25449 std::default::Default::default()
25450 }
25451
25452 /// Sets the value of [operation_id][crate::model::ClusterOperation::operation_id].
25453 ///
25454 /// # Example
25455 /// ```ignore,no_run
25456 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
25457 /// let x = ClusterOperation::new().set_operation_id("example");
25458 /// ```
25459 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25460 self.operation_id = v.into();
25461 self
25462 }
25463
25464 /// Sets the value of [error][crate::model::ClusterOperation::error].
25465 ///
25466 /// # Example
25467 /// ```ignore,no_run
25468 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
25469 /// let x = ClusterOperation::new().set_error("example");
25470 /// ```
25471 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25472 self.error = v.into();
25473 self
25474 }
25475
25476 /// Sets the value of [done][crate::model::ClusterOperation::done].
25477 ///
25478 /// # Example
25479 /// ```ignore,no_run
25480 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
25481 /// let x = ClusterOperation::new().set_done(true);
25482 /// ```
25483 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25484 self.done = v.into();
25485 self
25486 }
25487}
25488
25489impl wkt::message::Message for ClusterOperation {
25490 fn typename() -> &'static str {
25491 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperation"
25492 }
25493}
25494
25495/// The workflow graph.
25496#[derive(Clone, Default, PartialEq)]
25497#[non_exhaustive]
25498pub struct WorkflowGraph {
25499 /// Output only. The workflow nodes.
25500 pub nodes: std::vec::Vec<crate::model::WorkflowNode>,
25501
25502 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25503}
25504
25505impl WorkflowGraph {
25506 /// Creates a new default instance.
25507 pub fn new() -> Self {
25508 std::default::Default::default()
25509 }
25510
25511 /// Sets the value of [nodes][crate::model::WorkflowGraph::nodes].
25512 ///
25513 /// # Example
25514 /// ```ignore,no_run
25515 /// # use google_cloud_dataproc_v1::model::WorkflowGraph;
25516 /// use google_cloud_dataproc_v1::model::WorkflowNode;
25517 /// let x = WorkflowGraph::new()
25518 /// .set_nodes([
25519 /// WorkflowNode::default()/* use setters */,
25520 /// WorkflowNode::default()/* use (different) setters */,
25521 /// ]);
25522 /// ```
25523 pub fn set_nodes<T, V>(mut self, v: T) -> Self
25524 where
25525 T: std::iter::IntoIterator<Item = V>,
25526 V: std::convert::Into<crate::model::WorkflowNode>,
25527 {
25528 use std::iter::Iterator;
25529 self.nodes = v.into_iter().map(|i| i.into()).collect();
25530 self
25531 }
25532}
25533
25534impl wkt::message::Message for WorkflowGraph {
25535 fn typename() -> &'static str {
25536 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowGraph"
25537 }
25538}
25539
25540/// The workflow node.
25541#[derive(Clone, Default, PartialEq)]
25542#[non_exhaustive]
25543pub struct WorkflowNode {
25544 /// Output only. The name of the node.
25545 pub step_id: std::string::String,
25546
25547 /// Output only. Node's prerequisite nodes.
25548 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
25549
25550 /// Output only. The job id; populated after the node enters RUNNING state.
25551 pub job_id: std::string::String,
25552
25553 /// Output only. The node state.
25554 pub state: crate::model::workflow_node::NodeState,
25555
25556 /// Output only. The error detail.
25557 pub error: std::string::String,
25558
25559 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25560}
25561
25562impl WorkflowNode {
25563 /// Creates a new default instance.
25564 pub fn new() -> Self {
25565 std::default::Default::default()
25566 }
25567
25568 /// Sets the value of [step_id][crate::model::WorkflowNode::step_id].
25569 ///
25570 /// # Example
25571 /// ```ignore,no_run
25572 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25573 /// let x = WorkflowNode::new().set_step_id("example");
25574 /// ```
25575 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25576 self.step_id = v.into();
25577 self
25578 }
25579
25580 /// Sets the value of [prerequisite_step_ids][crate::model::WorkflowNode::prerequisite_step_ids].
25581 ///
25582 /// # Example
25583 /// ```ignore,no_run
25584 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25585 /// let x = WorkflowNode::new().set_prerequisite_step_ids(["a", "b", "c"]);
25586 /// ```
25587 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
25588 where
25589 T: std::iter::IntoIterator<Item = V>,
25590 V: std::convert::Into<std::string::String>,
25591 {
25592 use std::iter::Iterator;
25593 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
25594 self
25595 }
25596
25597 /// Sets the value of [job_id][crate::model::WorkflowNode::job_id].
25598 ///
25599 /// # Example
25600 /// ```ignore,no_run
25601 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25602 /// let x = WorkflowNode::new().set_job_id("example");
25603 /// ```
25604 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25605 self.job_id = v.into();
25606 self
25607 }
25608
25609 /// Sets the value of [state][crate::model::WorkflowNode::state].
25610 ///
25611 /// # Example
25612 /// ```ignore,no_run
25613 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25614 /// use google_cloud_dataproc_v1::model::workflow_node::NodeState;
25615 /// let x0 = WorkflowNode::new().set_state(NodeState::Blocked);
25616 /// let x1 = WorkflowNode::new().set_state(NodeState::Runnable);
25617 /// let x2 = WorkflowNode::new().set_state(NodeState::Running);
25618 /// ```
25619 pub fn set_state<T: std::convert::Into<crate::model::workflow_node::NodeState>>(
25620 mut self,
25621 v: T,
25622 ) -> Self {
25623 self.state = v.into();
25624 self
25625 }
25626
25627 /// Sets the value of [error][crate::model::WorkflowNode::error].
25628 ///
25629 /// # Example
25630 /// ```ignore,no_run
25631 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
25632 /// let x = WorkflowNode::new().set_error("example");
25633 /// ```
25634 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25635 self.error = v.into();
25636 self
25637 }
25638}
25639
25640impl wkt::message::Message for WorkflowNode {
25641 fn typename() -> &'static str {
25642 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowNode"
25643 }
25644}
25645
25646/// Defines additional types related to [WorkflowNode].
25647pub mod workflow_node {
25648 #[allow(unused_imports)]
25649 use super::*;
25650
25651 /// The workflow node state.
25652 ///
25653 /// # Working with unknown values
25654 ///
25655 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25656 /// additional enum variants at any time. Adding new variants is not considered
25657 /// a breaking change. Applications should write their code in anticipation of:
25658 ///
25659 /// - New values appearing in future releases of the client library, **and**
25660 /// - New values received dynamically, without application changes.
25661 ///
25662 /// Please consult the [Working with enums] section in the user guide for some
25663 /// guidelines.
25664 ///
25665 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25666 #[derive(Clone, Debug, PartialEq)]
25667 #[non_exhaustive]
25668 pub enum NodeState {
25669 /// State is unspecified.
25670 Unspecified,
25671 /// The node is awaiting prerequisite node to finish.
25672 Blocked,
25673 /// The node is runnable but not running.
25674 Runnable,
25675 /// The node is running.
25676 Running,
25677 /// The node completed successfully.
25678 Completed,
25679 /// The node failed. A node can be marked FAILED because
25680 /// its ancestor or peer failed.
25681 Failed,
25682 /// If set, the enum was initialized with an unknown value.
25683 ///
25684 /// Applications can examine the value using [NodeState::value] or
25685 /// [NodeState::name].
25686 UnknownValue(node_state::UnknownValue),
25687 }
25688
25689 #[doc(hidden)]
25690 pub mod node_state {
25691 #[allow(unused_imports)]
25692 use super::*;
25693 #[derive(Clone, Debug, PartialEq)]
25694 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25695 }
25696
25697 impl NodeState {
25698 /// Gets the enum value.
25699 ///
25700 /// Returns `None` if the enum contains an unknown value deserialized from
25701 /// the string representation of enums.
25702 pub fn value(&self) -> std::option::Option<i32> {
25703 match self {
25704 Self::Unspecified => std::option::Option::Some(0),
25705 Self::Blocked => std::option::Option::Some(1),
25706 Self::Runnable => std::option::Option::Some(2),
25707 Self::Running => std::option::Option::Some(3),
25708 Self::Completed => std::option::Option::Some(4),
25709 Self::Failed => std::option::Option::Some(5),
25710 Self::UnknownValue(u) => u.0.value(),
25711 }
25712 }
25713
25714 /// Gets the enum value as a string.
25715 ///
25716 /// Returns `None` if the enum contains an unknown value deserialized from
25717 /// the integer representation of enums.
25718 pub fn name(&self) -> std::option::Option<&str> {
25719 match self {
25720 Self::Unspecified => std::option::Option::Some("NODE_STATE_UNSPECIFIED"),
25721 Self::Blocked => std::option::Option::Some("BLOCKED"),
25722 Self::Runnable => std::option::Option::Some("RUNNABLE"),
25723 Self::Running => std::option::Option::Some("RUNNING"),
25724 Self::Completed => std::option::Option::Some("COMPLETED"),
25725 Self::Failed => std::option::Option::Some("FAILED"),
25726 Self::UnknownValue(u) => u.0.name(),
25727 }
25728 }
25729 }
25730
25731 impl std::default::Default for NodeState {
25732 fn default() -> Self {
25733 use std::convert::From;
25734 Self::from(0)
25735 }
25736 }
25737
25738 impl std::fmt::Display for NodeState {
25739 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25740 wkt::internal::display_enum(f, self.name(), self.value())
25741 }
25742 }
25743
25744 impl std::convert::From<i32> for NodeState {
25745 fn from(value: i32) -> Self {
25746 match value {
25747 0 => Self::Unspecified,
25748 1 => Self::Blocked,
25749 2 => Self::Runnable,
25750 3 => Self::Running,
25751 4 => Self::Completed,
25752 5 => Self::Failed,
25753 _ => Self::UnknownValue(node_state::UnknownValue(
25754 wkt::internal::UnknownEnumValue::Integer(value),
25755 )),
25756 }
25757 }
25758 }
25759
25760 impl std::convert::From<&str> for NodeState {
25761 fn from(value: &str) -> Self {
25762 use std::string::ToString;
25763 match value {
25764 "NODE_STATE_UNSPECIFIED" => Self::Unspecified,
25765 "BLOCKED" => Self::Blocked,
25766 "RUNNABLE" => Self::Runnable,
25767 "RUNNING" => Self::Running,
25768 "COMPLETED" => Self::Completed,
25769 "FAILED" => Self::Failed,
25770 _ => Self::UnknownValue(node_state::UnknownValue(
25771 wkt::internal::UnknownEnumValue::String(value.to_string()),
25772 )),
25773 }
25774 }
25775 }
25776
25777 impl serde::ser::Serialize for NodeState {
25778 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25779 where
25780 S: serde::Serializer,
25781 {
25782 match self {
25783 Self::Unspecified => serializer.serialize_i32(0),
25784 Self::Blocked => serializer.serialize_i32(1),
25785 Self::Runnable => serializer.serialize_i32(2),
25786 Self::Running => serializer.serialize_i32(3),
25787 Self::Completed => serializer.serialize_i32(4),
25788 Self::Failed => serializer.serialize_i32(5),
25789 Self::UnknownValue(u) => u.0.serialize(serializer),
25790 }
25791 }
25792 }
25793
25794 impl<'de> serde::de::Deserialize<'de> for NodeState {
25795 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25796 where
25797 D: serde::Deserializer<'de>,
25798 {
25799 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeState>::new(
25800 ".google.cloud.dataproc.v1.WorkflowNode.NodeState",
25801 ))
25802 }
25803 }
25804}
25805
25806/// A request to create a workflow template.
25807#[derive(Clone, Default, PartialEq)]
25808#[non_exhaustive]
25809pub struct CreateWorkflowTemplateRequest {
25810 /// Required. The resource name of the region or location, as described
25811 /// in <https://cloud.google.com/apis/design/resource_names>.
25812 ///
25813 /// * For `projects.regions.workflowTemplates.create`, the resource name of the
25814 /// region has the following format:
25815 /// `projects/{project_id}/regions/{region}`
25816 ///
25817 /// * For `projects.locations.workflowTemplates.create`, the resource name of
25818 /// the location has the following format:
25819 /// `projects/{project_id}/locations/{location}`
25820 ///
25821 pub parent: std::string::String,
25822
25823 /// Required. The Dataproc workflow template to create.
25824 pub template: std::option::Option<crate::model::WorkflowTemplate>,
25825
25826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25827}
25828
25829impl CreateWorkflowTemplateRequest {
25830 /// Creates a new default instance.
25831 pub fn new() -> Self {
25832 std::default::Default::default()
25833 }
25834
25835 /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
25836 ///
25837 /// # Example
25838 /// ```ignore,no_run
25839 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25840 /// # let project_id = "project_id";
25841 /// # let region_id = "region_id";
25842 /// let x = CreateWorkflowTemplateRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}"));
25843 /// ```
25844 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25845 self.parent = v.into();
25846 self
25847 }
25848
25849 /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25850 ///
25851 /// # Example
25852 /// ```ignore,no_run
25853 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25854 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25855 /// let x = CreateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25856 /// ```
25857 pub fn set_template<T>(mut self, v: T) -> Self
25858 where
25859 T: std::convert::Into<crate::model::WorkflowTemplate>,
25860 {
25861 self.template = std::option::Option::Some(v.into());
25862 self
25863 }
25864
25865 /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25866 ///
25867 /// # Example
25868 /// ```ignore,no_run
25869 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25870 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25871 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25872 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25873 /// ```
25874 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25875 where
25876 T: std::convert::Into<crate::model::WorkflowTemplate>,
25877 {
25878 self.template = v.map(|x| x.into());
25879 self
25880 }
25881}
25882
25883impl wkt::message::Message for CreateWorkflowTemplateRequest {
25884 fn typename() -> &'static str {
25885 "type.googleapis.com/google.cloud.dataproc.v1.CreateWorkflowTemplateRequest"
25886 }
25887}
25888
25889/// A request to fetch a workflow template.
25890#[derive(Clone, Default, PartialEq)]
25891#[non_exhaustive]
25892pub struct GetWorkflowTemplateRequest {
25893 /// Required. The resource name of the workflow template, as described
25894 /// in <https://cloud.google.com/apis/design/resource_names>.
25895 ///
25896 /// * For `projects.regions.workflowTemplates.get`, the resource name of the
25897 /// template has the following format:
25898 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25899 ///
25900 /// * For `projects.locations.workflowTemplates.get`, the resource name of the
25901 /// template has the following format:
25902 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25903 ///
25904 pub name: std::string::String,
25905
25906 /// Optional. The version of workflow template to retrieve. Only previously
25907 /// instantiated versions can be retrieved.
25908 ///
25909 /// If unspecified, retrieves the current version.
25910 pub version: i32,
25911
25912 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25913}
25914
25915impl GetWorkflowTemplateRequest {
25916 /// Creates a new default instance.
25917 pub fn new() -> Self {
25918 std::default::Default::default()
25919 }
25920
25921 /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
25922 ///
25923 /// # Example
25924 /// ```ignore,no_run
25925 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25926 /// # let project_id = "project_id";
25927 /// # let region_id = "region_id";
25928 /// # let workflow_template_id = "workflow_template_id";
25929 /// let x = GetWorkflowTemplateRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
25930 /// ```
25931 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25932 self.name = v.into();
25933 self
25934 }
25935
25936 /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
25937 ///
25938 /// # Example
25939 /// ```ignore,no_run
25940 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25941 /// let x = GetWorkflowTemplateRequest::new().set_version(42);
25942 /// ```
25943 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25944 self.version = v.into();
25945 self
25946 }
25947}
25948
25949impl wkt::message::Message for GetWorkflowTemplateRequest {
25950 fn typename() -> &'static str {
25951 "type.googleapis.com/google.cloud.dataproc.v1.GetWorkflowTemplateRequest"
25952 }
25953}
25954
25955/// A request to instantiate a workflow template.
25956#[derive(Clone, Default, PartialEq)]
25957#[non_exhaustive]
25958pub struct InstantiateWorkflowTemplateRequest {
25959 /// Required. The resource name of the workflow template, as described
25960 /// in <https://cloud.google.com/apis/design/resource_names>.
25961 ///
25962 /// * For `projects.regions.workflowTemplates.instantiate`, the resource name
25963 /// of the template has the following format:
25964 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25965 ///
25966 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25967 /// of the template has the following format:
25968 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25969 ///
25970 pub name: std::string::String,
25971
25972 /// Optional. The version of workflow template to instantiate. If specified,
25973 /// the workflow will be instantiated only if the current version of
25974 /// the workflow template has the supplied version.
25975 ///
25976 /// This option cannot be used to instantiate a previous version of
25977 /// workflow template.
25978 pub version: i32,
25979
25980 /// Optional. A tag that prevents multiple concurrent workflow
25981 /// instances with the same tag from running. This mitigates risk of
25982 /// concurrent instances started due to retries.
25983 ///
25984 /// It is recommended to always set this value to a
25985 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
25986 ///
25987 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
25988 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
25989 pub request_id: std::string::String,
25990
25991 /// Optional. Map from parameter names to values that should be used for those
25992 /// parameters. Values may not exceed 1000 characters.
25993 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
25994
25995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25996}
25997
25998impl InstantiateWorkflowTemplateRequest {
25999 /// Creates a new default instance.
26000 pub fn new() -> Self {
26001 std::default::Default::default()
26002 }
26003
26004 /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
26005 ///
26006 /// # Example
26007 /// ```ignore,no_run
26008 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26009 /// # let project_id = "project_id";
26010 /// # let region_id = "region_id";
26011 /// # let workflow_template_id = "workflow_template_id";
26012 /// let x = InstantiateWorkflowTemplateRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
26013 /// ```
26014 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26015 self.name = v.into();
26016 self
26017 }
26018
26019 /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
26020 ///
26021 /// # Example
26022 /// ```ignore,no_run
26023 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26024 /// let x = InstantiateWorkflowTemplateRequest::new().set_version(42);
26025 /// ```
26026 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26027 self.version = v.into();
26028 self
26029 }
26030
26031 /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
26032 ///
26033 /// # Example
26034 /// ```ignore,no_run
26035 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26036 /// let x = InstantiateWorkflowTemplateRequest::new().set_request_id("example");
26037 /// ```
26038 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26039 self.request_id = v.into();
26040 self
26041 }
26042
26043 /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
26044 ///
26045 /// # Example
26046 /// ```ignore,no_run
26047 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
26048 /// let x = InstantiateWorkflowTemplateRequest::new().set_parameters([
26049 /// ("key0", "abc"),
26050 /// ("key1", "xyz"),
26051 /// ]);
26052 /// ```
26053 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
26054 where
26055 T: std::iter::IntoIterator<Item = (K, V)>,
26056 K: std::convert::Into<std::string::String>,
26057 V: std::convert::Into<std::string::String>,
26058 {
26059 use std::iter::Iterator;
26060 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26061 self
26062 }
26063}
26064
26065impl wkt::message::Message for InstantiateWorkflowTemplateRequest {
26066 fn typename() -> &'static str {
26067 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest"
26068 }
26069}
26070
26071/// A request to instantiate an inline workflow template.
26072#[derive(Clone, Default, PartialEq)]
26073#[non_exhaustive]
26074pub struct InstantiateInlineWorkflowTemplateRequest {
26075 /// Required. The resource name of the region or location, as described
26076 /// in <https://cloud.google.com/apis/design/resource_names>.
26077 ///
26078 /// * For `projects.regions.workflowTemplates,instantiateinline`, the resource
26079 /// name of the region has the following format:
26080 /// `projects/{project_id}/regions/{region}`
26081 ///
26082 /// * For `projects.locations.workflowTemplates.instantiateinline`, the
26083 /// resource name of the location has the following format:
26084 /// `projects/{project_id}/locations/{location}`
26085 ///
26086 pub parent: std::string::String,
26087
26088 /// Required. The workflow template to instantiate.
26089 pub template: std::option::Option<crate::model::WorkflowTemplate>,
26090
26091 /// Optional. A tag that prevents multiple concurrent workflow
26092 /// instances with the same tag from running. This mitigates risk of
26093 /// concurrent instances started due to retries.
26094 ///
26095 /// It is recommended to always set this value to a
26096 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
26097 ///
26098 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
26099 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
26100 pub request_id: std::string::String,
26101
26102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26103}
26104
26105impl InstantiateInlineWorkflowTemplateRequest {
26106 /// Creates a new default instance.
26107 pub fn new() -> Self {
26108 std::default::Default::default()
26109 }
26110
26111 /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
26112 ///
26113 /// # Example
26114 /// ```ignore,no_run
26115 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26116 /// # let project_id = "project_id";
26117 /// # let region_id = "region_id";
26118 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}"));
26119 /// ```
26120 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26121 self.parent = v.into();
26122 self
26123 }
26124
26125 /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
26126 ///
26127 /// # Example
26128 /// ```ignore,no_run
26129 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26130 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26131 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
26132 /// ```
26133 pub fn set_template<T>(mut self, v: T) -> Self
26134 where
26135 T: std::convert::Into<crate::model::WorkflowTemplate>,
26136 {
26137 self.template = std::option::Option::Some(v.into());
26138 self
26139 }
26140
26141 /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
26142 ///
26143 /// # Example
26144 /// ```ignore,no_run
26145 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26146 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26147 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
26148 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
26149 /// ```
26150 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
26151 where
26152 T: std::convert::Into<crate::model::WorkflowTemplate>,
26153 {
26154 self.template = v.map(|x| x.into());
26155 self
26156 }
26157
26158 /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
26159 ///
26160 /// # Example
26161 /// ```ignore,no_run
26162 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
26163 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_request_id("example");
26164 /// ```
26165 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26166 self.request_id = v.into();
26167 self
26168 }
26169}
26170
26171impl wkt::message::Message for InstantiateInlineWorkflowTemplateRequest {
26172 fn typename() -> &'static str {
26173 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest"
26174 }
26175}
26176
26177/// A request to update a workflow template.
26178#[derive(Clone, Default, PartialEq)]
26179#[non_exhaustive]
26180pub struct UpdateWorkflowTemplateRequest {
26181 /// Required. The updated workflow template.
26182 ///
26183 /// The `template.version` field must match the current version.
26184 pub template: std::option::Option<crate::model::WorkflowTemplate>,
26185
26186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26187}
26188
26189impl UpdateWorkflowTemplateRequest {
26190 /// Creates a new default instance.
26191 pub fn new() -> Self {
26192 std::default::Default::default()
26193 }
26194
26195 /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
26196 ///
26197 /// # Example
26198 /// ```ignore,no_run
26199 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
26200 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26201 /// let x = UpdateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
26202 /// ```
26203 pub fn set_template<T>(mut self, v: T) -> Self
26204 where
26205 T: std::convert::Into<crate::model::WorkflowTemplate>,
26206 {
26207 self.template = std::option::Option::Some(v.into());
26208 self
26209 }
26210
26211 /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
26212 ///
26213 /// # Example
26214 /// ```ignore,no_run
26215 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
26216 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26217 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
26218 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
26219 /// ```
26220 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
26221 where
26222 T: std::convert::Into<crate::model::WorkflowTemplate>,
26223 {
26224 self.template = v.map(|x| x.into());
26225 self
26226 }
26227}
26228
26229impl wkt::message::Message for UpdateWorkflowTemplateRequest {
26230 fn typename() -> &'static str {
26231 "type.googleapis.com/google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest"
26232 }
26233}
26234
26235/// A request to list workflow templates in a project.
26236#[derive(Clone, Default, PartialEq)]
26237#[non_exhaustive]
26238pub struct ListWorkflowTemplatesRequest {
26239 /// Required. The resource name of the region or location, as described
26240 /// in <https://cloud.google.com/apis/design/resource_names>.
26241 ///
26242 /// * For `projects.regions.workflowTemplates,list`, the resource
26243 /// name of the region has the following format:
26244 /// `projects/{project_id}/regions/{region}`
26245 ///
26246 /// * For `projects.locations.workflowTemplates.list`, the
26247 /// resource name of the location has the following format:
26248 /// `projects/{project_id}/locations/{location}`
26249 ///
26250 pub parent: std::string::String,
26251
26252 /// Optional. The maximum number of results to return in each response.
26253 pub page_size: i32,
26254
26255 /// Optional. The page token, returned by a previous call, to request the
26256 /// next page of results.
26257 pub page_token: std::string::String,
26258
26259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26260}
26261
26262impl ListWorkflowTemplatesRequest {
26263 /// Creates a new default instance.
26264 pub fn new() -> Self {
26265 std::default::Default::default()
26266 }
26267
26268 /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
26269 ///
26270 /// # Example
26271 /// ```ignore,no_run
26272 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
26273 /// # let project_id = "project_id";
26274 /// # let region_id = "region_id";
26275 /// let x = ListWorkflowTemplatesRequest::new().set_parent(format!("projects/{project_id}/regions/{region_id}"));
26276 /// ```
26277 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26278 self.parent = v.into();
26279 self
26280 }
26281
26282 /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
26283 ///
26284 /// # Example
26285 /// ```ignore,no_run
26286 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
26287 /// let x = ListWorkflowTemplatesRequest::new().set_page_size(42);
26288 /// ```
26289 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26290 self.page_size = v.into();
26291 self
26292 }
26293
26294 /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
26295 ///
26296 /// # Example
26297 /// ```ignore,no_run
26298 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
26299 /// let x = ListWorkflowTemplatesRequest::new().set_page_token("example");
26300 /// ```
26301 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26302 self.page_token = v.into();
26303 self
26304 }
26305}
26306
26307impl wkt::message::Message for ListWorkflowTemplatesRequest {
26308 fn typename() -> &'static str {
26309 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesRequest"
26310 }
26311}
26312
26313/// A response to a request to list workflow templates in a project.
26314#[derive(Clone, Default, PartialEq)]
26315#[non_exhaustive]
26316pub struct ListWorkflowTemplatesResponse {
26317 /// Output only. WorkflowTemplates list.
26318 pub templates: std::vec::Vec<crate::model::WorkflowTemplate>,
26319
26320 /// Output only. This token is included in the response if there are more
26321 /// results to fetch. To fetch additional results, provide this value as the
26322 /// page_token in a subsequent \<code\>ListWorkflowTemplatesRequest\</code\>.
26323 pub next_page_token: std::string::String,
26324
26325 /// Output only. List of workflow templates that could not be included in the
26326 /// response. Attempting to get one of these resources may indicate why it was
26327 /// not included in the list response.
26328 pub unreachable: std::vec::Vec<std::string::String>,
26329
26330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26331}
26332
26333impl ListWorkflowTemplatesResponse {
26334 /// Creates a new default instance.
26335 pub fn new() -> Self {
26336 std::default::Default::default()
26337 }
26338
26339 /// Sets the value of [templates][crate::model::ListWorkflowTemplatesResponse::templates].
26340 ///
26341 /// # Example
26342 /// ```ignore,no_run
26343 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
26344 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
26345 /// let x = ListWorkflowTemplatesResponse::new()
26346 /// .set_templates([
26347 /// WorkflowTemplate::default()/* use setters */,
26348 /// WorkflowTemplate::default()/* use (different) setters */,
26349 /// ]);
26350 /// ```
26351 pub fn set_templates<T, V>(mut self, v: T) -> Self
26352 where
26353 T: std::iter::IntoIterator<Item = V>,
26354 V: std::convert::Into<crate::model::WorkflowTemplate>,
26355 {
26356 use std::iter::Iterator;
26357 self.templates = v.into_iter().map(|i| i.into()).collect();
26358 self
26359 }
26360
26361 /// Sets the value of [next_page_token][crate::model::ListWorkflowTemplatesResponse::next_page_token].
26362 ///
26363 /// # Example
26364 /// ```ignore,no_run
26365 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
26366 /// let x = ListWorkflowTemplatesResponse::new().set_next_page_token("example");
26367 /// ```
26368 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26369 self.next_page_token = v.into();
26370 self
26371 }
26372
26373 /// Sets the value of [unreachable][crate::model::ListWorkflowTemplatesResponse::unreachable].
26374 ///
26375 /// # Example
26376 /// ```ignore,no_run
26377 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
26378 /// let x = ListWorkflowTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
26379 /// ```
26380 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
26381 where
26382 T: std::iter::IntoIterator<Item = V>,
26383 V: std::convert::Into<std::string::String>,
26384 {
26385 use std::iter::Iterator;
26386 self.unreachable = v.into_iter().map(|i| i.into()).collect();
26387 self
26388 }
26389}
26390
26391impl wkt::message::Message for ListWorkflowTemplatesResponse {
26392 fn typename() -> &'static str {
26393 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesResponse"
26394 }
26395}
26396
26397#[doc(hidden)]
26398impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowTemplatesResponse {
26399 type PageItem = crate::model::WorkflowTemplate;
26400
26401 fn items(self) -> std::vec::Vec<Self::PageItem> {
26402 self.templates
26403 }
26404
26405 fn next_page_token(&self) -> std::string::String {
26406 use std::clone::Clone;
26407 self.next_page_token.clone()
26408 }
26409}
26410
26411/// A request to delete a workflow template.
26412///
26413/// Currently started workflows will remain running.
26414#[derive(Clone, Default, PartialEq)]
26415#[non_exhaustive]
26416pub struct DeleteWorkflowTemplateRequest {
26417 /// Required. The resource name of the workflow template, as described
26418 /// in <https://cloud.google.com/apis/design/resource_names>.
26419 ///
26420 /// * For `projects.regions.workflowTemplates.delete`, the resource name
26421 /// of the template has the following format:
26422 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
26423 ///
26424 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
26425 /// of the template has the following format:
26426 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
26427 ///
26428 pub name: std::string::String,
26429
26430 /// Optional. The version of workflow template to delete. If specified,
26431 /// will only delete the template if the current server version matches
26432 /// specified version.
26433 pub version: i32,
26434
26435 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26436}
26437
26438impl DeleteWorkflowTemplateRequest {
26439 /// Creates a new default instance.
26440 pub fn new() -> Self {
26441 std::default::Default::default()
26442 }
26443
26444 /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
26445 ///
26446 /// # Example
26447 /// ```ignore,no_run
26448 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
26449 /// # let project_id = "project_id";
26450 /// # let region_id = "region_id";
26451 /// # let workflow_template_id = "workflow_template_id";
26452 /// let x = DeleteWorkflowTemplateRequest::new().set_name(format!("projects/{project_id}/regions/{region_id}/workflowTemplates/{workflow_template_id}"));
26453 /// ```
26454 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26455 self.name = v.into();
26456 self
26457 }
26458
26459 /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
26460 ///
26461 /// # Example
26462 /// ```ignore,no_run
26463 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
26464 /// let x = DeleteWorkflowTemplateRequest::new().set_version(42);
26465 /// ```
26466 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26467 self.version = v.into();
26468 self
26469 }
26470}
26471
26472impl wkt::message::Message for DeleteWorkflowTemplateRequest {
26473 fn typename() -> &'static str {
26474 "type.googleapis.com/google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest"
26475 }
26476}
26477
26478/// Cluster components that can be activated.
26479///
26480/// # Working with unknown values
26481///
26482/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26483/// additional enum variants at any time. Adding new variants is not considered
26484/// a breaking change. Applications should write their code in anticipation of:
26485///
26486/// - New values appearing in future releases of the client library, **and**
26487/// - New values received dynamically, without application changes.
26488///
26489/// Please consult the [Working with enums] section in the user guide for some
26490/// guidelines.
26491///
26492/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
26493#[derive(Clone, Debug, PartialEq)]
26494#[non_exhaustive]
26495pub enum Component {
26496 /// Unspecified component. Specifying this will cause Cluster creation to fail.
26497 Unspecified,
26498 /// The Anaconda component is no longer supported or applicable to
26499 /// [supported Dataproc on Compute Engine image versions]
26500 /// (<https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-version-clusters#supported-dataproc-image-versions>).
26501 /// It cannot be activated on clusters created with supported Dataproc on
26502 /// Compute Engine image versions.
26503 Anaconda,
26504 /// Delta Lake.
26505 Delta,
26506 /// Docker
26507 Docker,
26508 /// The Druid query engine. (alpha)
26509 Druid,
26510 /// Flink
26511 Flink,
26512 /// HBase. (beta)
26513 Hbase,
26514 /// The Hive Web HCatalog (the REST service for accessing HCatalog).
26515 HiveWebhcat,
26516 /// Hudi.
26517 Hudi,
26518 /// Iceberg.
26519 Iceberg,
26520 /// The Jupyter Notebook.
26521 Jupyter,
26522 /// The Pig component.
26523 Pig,
26524 /// The Presto query engine.
26525 Presto,
26526 /// The Trino query engine.
26527 Trino,
26528 /// The Ranger service.
26529 Ranger,
26530 /// The Solr service.
26531 Solr,
26532 /// The Zeppelin notebook.
26533 Zeppelin,
26534 /// The Zookeeper service.
26535 Zookeeper,
26536 /// The Jupyter Kernel Gateway.
26537 JupyterKernelGateway,
26538 /// If set, the enum was initialized with an unknown value.
26539 ///
26540 /// Applications can examine the value using [Component::value] or
26541 /// [Component::name].
26542 UnknownValue(component::UnknownValue),
26543}
26544
26545#[doc(hidden)]
26546pub mod component {
26547 #[allow(unused_imports)]
26548 use super::*;
26549 #[derive(Clone, Debug, PartialEq)]
26550 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26551}
26552
26553impl Component {
26554 /// Gets the enum value.
26555 ///
26556 /// Returns `None` if the enum contains an unknown value deserialized from
26557 /// the string representation of enums.
26558 pub fn value(&self) -> std::option::Option<i32> {
26559 match self {
26560 Self::Unspecified => std::option::Option::Some(0),
26561 Self::Anaconda => std::option::Option::Some(5),
26562 Self::Delta => std::option::Option::Some(20),
26563 Self::Docker => std::option::Option::Some(13),
26564 Self::Druid => std::option::Option::Some(9),
26565 Self::Flink => std::option::Option::Some(14),
26566 Self::Hbase => std::option::Option::Some(11),
26567 Self::HiveWebhcat => std::option::Option::Some(3),
26568 Self::Hudi => std::option::Option::Some(18),
26569 Self::Iceberg => std::option::Option::Some(19),
26570 Self::Jupyter => std::option::Option::Some(1),
26571 Self::Pig => std::option::Option::Some(21),
26572 Self::Presto => std::option::Option::Some(6),
26573 Self::Trino => std::option::Option::Some(17),
26574 Self::Ranger => std::option::Option::Some(12),
26575 Self::Solr => std::option::Option::Some(10),
26576 Self::Zeppelin => std::option::Option::Some(4),
26577 Self::Zookeeper => std::option::Option::Some(8),
26578 Self::JupyterKernelGateway => std::option::Option::Some(22),
26579 Self::UnknownValue(u) => u.0.value(),
26580 }
26581 }
26582
26583 /// Gets the enum value as a string.
26584 ///
26585 /// Returns `None` if the enum contains an unknown value deserialized from
26586 /// the integer representation of enums.
26587 pub fn name(&self) -> std::option::Option<&str> {
26588 match self {
26589 Self::Unspecified => std::option::Option::Some("COMPONENT_UNSPECIFIED"),
26590 Self::Anaconda => std::option::Option::Some("ANACONDA"),
26591 Self::Delta => std::option::Option::Some("DELTA"),
26592 Self::Docker => std::option::Option::Some("DOCKER"),
26593 Self::Druid => std::option::Option::Some("DRUID"),
26594 Self::Flink => std::option::Option::Some("FLINK"),
26595 Self::Hbase => std::option::Option::Some("HBASE"),
26596 Self::HiveWebhcat => std::option::Option::Some("HIVE_WEBHCAT"),
26597 Self::Hudi => std::option::Option::Some("HUDI"),
26598 Self::Iceberg => std::option::Option::Some("ICEBERG"),
26599 Self::Jupyter => std::option::Option::Some("JUPYTER"),
26600 Self::Pig => std::option::Option::Some("PIG"),
26601 Self::Presto => std::option::Option::Some("PRESTO"),
26602 Self::Trino => std::option::Option::Some("TRINO"),
26603 Self::Ranger => std::option::Option::Some("RANGER"),
26604 Self::Solr => std::option::Option::Some("SOLR"),
26605 Self::Zeppelin => std::option::Option::Some("ZEPPELIN"),
26606 Self::Zookeeper => std::option::Option::Some("ZOOKEEPER"),
26607 Self::JupyterKernelGateway => std::option::Option::Some("JUPYTER_KERNEL_GATEWAY"),
26608 Self::UnknownValue(u) => u.0.name(),
26609 }
26610 }
26611}
26612
26613impl std::default::Default for Component {
26614 fn default() -> Self {
26615 use std::convert::From;
26616 Self::from(0)
26617 }
26618}
26619
26620impl std::fmt::Display for Component {
26621 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26622 wkt::internal::display_enum(f, self.name(), self.value())
26623 }
26624}
26625
26626impl std::convert::From<i32> for Component {
26627 fn from(value: i32) -> Self {
26628 match value {
26629 0 => Self::Unspecified,
26630 1 => Self::Jupyter,
26631 3 => Self::HiveWebhcat,
26632 4 => Self::Zeppelin,
26633 5 => Self::Anaconda,
26634 6 => Self::Presto,
26635 8 => Self::Zookeeper,
26636 9 => Self::Druid,
26637 10 => Self::Solr,
26638 11 => Self::Hbase,
26639 12 => Self::Ranger,
26640 13 => Self::Docker,
26641 14 => Self::Flink,
26642 17 => Self::Trino,
26643 18 => Self::Hudi,
26644 19 => Self::Iceberg,
26645 20 => Self::Delta,
26646 21 => Self::Pig,
26647 22 => Self::JupyterKernelGateway,
26648 _ => Self::UnknownValue(component::UnknownValue(
26649 wkt::internal::UnknownEnumValue::Integer(value),
26650 )),
26651 }
26652 }
26653}
26654
26655impl std::convert::From<&str> for Component {
26656 fn from(value: &str) -> Self {
26657 use std::string::ToString;
26658 match value {
26659 "COMPONENT_UNSPECIFIED" => Self::Unspecified,
26660 "ANACONDA" => Self::Anaconda,
26661 "DELTA" => Self::Delta,
26662 "DOCKER" => Self::Docker,
26663 "DRUID" => Self::Druid,
26664 "FLINK" => Self::Flink,
26665 "HBASE" => Self::Hbase,
26666 "HIVE_WEBHCAT" => Self::HiveWebhcat,
26667 "HUDI" => Self::Hudi,
26668 "ICEBERG" => Self::Iceberg,
26669 "JUPYTER" => Self::Jupyter,
26670 "PIG" => Self::Pig,
26671 "PRESTO" => Self::Presto,
26672 "TRINO" => Self::Trino,
26673 "RANGER" => Self::Ranger,
26674 "SOLR" => Self::Solr,
26675 "ZEPPELIN" => Self::Zeppelin,
26676 "ZOOKEEPER" => Self::Zookeeper,
26677 "JUPYTER_KERNEL_GATEWAY" => Self::JupyterKernelGateway,
26678 _ => Self::UnknownValue(component::UnknownValue(
26679 wkt::internal::UnknownEnumValue::String(value.to_string()),
26680 )),
26681 }
26682 }
26683}
26684
26685impl serde::ser::Serialize for Component {
26686 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26687 where
26688 S: serde::Serializer,
26689 {
26690 match self {
26691 Self::Unspecified => serializer.serialize_i32(0),
26692 Self::Anaconda => serializer.serialize_i32(5),
26693 Self::Delta => serializer.serialize_i32(20),
26694 Self::Docker => serializer.serialize_i32(13),
26695 Self::Druid => serializer.serialize_i32(9),
26696 Self::Flink => serializer.serialize_i32(14),
26697 Self::Hbase => serializer.serialize_i32(11),
26698 Self::HiveWebhcat => serializer.serialize_i32(3),
26699 Self::Hudi => serializer.serialize_i32(18),
26700 Self::Iceberg => serializer.serialize_i32(19),
26701 Self::Jupyter => serializer.serialize_i32(1),
26702 Self::Pig => serializer.serialize_i32(21),
26703 Self::Presto => serializer.serialize_i32(6),
26704 Self::Trino => serializer.serialize_i32(17),
26705 Self::Ranger => serializer.serialize_i32(12),
26706 Self::Solr => serializer.serialize_i32(10),
26707 Self::Zeppelin => serializer.serialize_i32(4),
26708 Self::Zookeeper => serializer.serialize_i32(8),
26709 Self::JupyterKernelGateway => serializer.serialize_i32(22),
26710 Self::UnknownValue(u) => u.0.serialize(serializer),
26711 }
26712 }
26713}
26714
26715impl<'de> serde::de::Deserialize<'de> for Component {
26716 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26717 where
26718 D: serde::Deserializer<'de>,
26719 {
26720 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Component>::new(
26721 ".google.cloud.dataproc.v1.Component",
26722 ))
26723 }
26724}
26725
26726/// Actions in response to failure of a resource associated with a cluster.
26727///
26728/// # Working with unknown values
26729///
26730/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26731/// additional enum variants at any time. Adding new variants is not considered
26732/// a breaking change. Applications should write their code in anticipation of:
26733///
26734/// - New values appearing in future releases of the client library, **and**
26735/// - New values received dynamically, without application changes.
26736///
26737/// Please consult the [Working with enums] section in the user guide for some
26738/// guidelines.
26739///
26740/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
26741#[derive(Clone, Debug, PartialEq)]
26742#[non_exhaustive]
26743pub enum FailureAction {
26744 /// When FailureAction is unspecified, failure action defaults to NO_ACTION.
26745 Unspecified,
26746 /// Take no action on failure to create a cluster resource. NO_ACTION is the
26747 /// default.
26748 NoAction,
26749 /// Delete the failed cluster resource.
26750 Delete,
26751 /// If set, the enum was initialized with an unknown value.
26752 ///
26753 /// Applications can examine the value using [FailureAction::value] or
26754 /// [FailureAction::name].
26755 UnknownValue(failure_action::UnknownValue),
26756}
26757
26758#[doc(hidden)]
26759pub mod failure_action {
26760 #[allow(unused_imports)]
26761 use super::*;
26762 #[derive(Clone, Debug, PartialEq)]
26763 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26764}
26765
26766impl FailureAction {
26767 /// Gets the enum value.
26768 ///
26769 /// Returns `None` if the enum contains an unknown value deserialized from
26770 /// the string representation of enums.
26771 pub fn value(&self) -> std::option::Option<i32> {
26772 match self {
26773 Self::Unspecified => std::option::Option::Some(0),
26774 Self::NoAction => std::option::Option::Some(1),
26775 Self::Delete => std::option::Option::Some(2),
26776 Self::UnknownValue(u) => u.0.value(),
26777 }
26778 }
26779
26780 /// Gets the enum value as a string.
26781 ///
26782 /// Returns `None` if the enum contains an unknown value deserialized from
26783 /// the integer representation of enums.
26784 pub fn name(&self) -> std::option::Option<&str> {
26785 match self {
26786 Self::Unspecified => std::option::Option::Some("FAILURE_ACTION_UNSPECIFIED"),
26787 Self::NoAction => std::option::Option::Some("NO_ACTION"),
26788 Self::Delete => std::option::Option::Some("DELETE"),
26789 Self::UnknownValue(u) => u.0.name(),
26790 }
26791 }
26792}
26793
26794impl std::default::Default for FailureAction {
26795 fn default() -> Self {
26796 use std::convert::From;
26797 Self::from(0)
26798 }
26799}
26800
26801impl std::fmt::Display for FailureAction {
26802 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26803 wkt::internal::display_enum(f, self.name(), self.value())
26804 }
26805}
26806
26807impl std::convert::From<i32> for FailureAction {
26808 fn from(value: i32) -> Self {
26809 match value {
26810 0 => Self::Unspecified,
26811 1 => Self::NoAction,
26812 2 => Self::Delete,
26813 _ => Self::UnknownValue(failure_action::UnknownValue(
26814 wkt::internal::UnknownEnumValue::Integer(value),
26815 )),
26816 }
26817 }
26818}
26819
26820impl std::convert::From<&str> for FailureAction {
26821 fn from(value: &str) -> Self {
26822 use std::string::ToString;
26823 match value {
26824 "FAILURE_ACTION_UNSPECIFIED" => Self::Unspecified,
26825 "NO_ACTION" => Self::NoAction,
26826 "DELETE" => Self::Delete,
26827 _ => Self::UnknownValue(failure_action::UnknownValue(
26828 wkt::internal::UnknownEnumValue::String(value.to_string()),
26829 )),
26830 }
26831 }
26832}
26833
26834impl serde::ser::Serialize for FailureAction {
26835 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26836 where
26837 S: serde::Serializer,
26838 {
26839 match self {
26840 Self::Unspecified => serializer.serialize_i32(0),
26841 Self::NoAction => serializer.serialize_i32(1),
26842 Self::Delete => serializer.serialize_i32(2),
26843 Self::UnknownValue(u) => u.0.serialize(serializer),
26844 }
26845 }
26846}
26847
26848impl<'de> serde::de::Deserialize<'de> for FailureAction {
26849 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26850 where
26851 D: serde::Deserializer<'de>,
26852 {
26853 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureAction>::new(
26854 ".google.cloud.dataproc.v1.FailureAction",
26855 ))
26856 }
26857}