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 pub fn new() -> Self {
91 std::default::Default::default()
92 }
93
94 /// Sets the value of [id][crate::model::AutoscalingPolicy::id].
95 ///
96 /// # Example
97 /// ```ignore,no_run
98 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
99 /// let x = AutoscalingPolicy::new().set_id("example");
100 /// ```
101 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
102 self.id = v.into();
103 self
104 }
105
106 /// Sets the value of [name][crate::model::AutoscalingPolicy::name].
107 ///
108 /// # Example
109 /// ```ignore,no_run
110 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
111 /// let x = AutoscalingPolicy::new().set_name("example");
112 /// ```
113 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
114 self.name = v.into();
115 self
116 }
117
118 /// Sets the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
119 ///
120 /// # Example
121 /// ```ignore,no_run
122 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
123 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
124 /// let x = AutoscalingPolicy::new().set_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
125 /// ```
126 pub fn set_worker_config<T>(mut self, v: T) -> Self
127 where
128 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
129 {
130 self.worker_config = std::option::Option::Some(v.into());
131 self
132 }
133
134 /// Sets or clears the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
135 ///
136 /// # Example
137 /// ```ignore,no_run
138 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
139 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
140 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
141 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
142 /// ```
143 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
144 where
145 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
146 {
147 self.worker_config = v.map(|x| x.into());
148 self
149 }
150
151 /// Sets the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
152 ///
153 /// # Example
154 /// ```ignore,no_run
155 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
156 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
157 /// let x = AutoscalingPolicy::new().set_secondary_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
158 /// ```
159 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
160 where
161 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
162 {
163 self.secondary_worker_config = std::option::Option::Some(v.into());
164 self
165 }
166
167 /// Sets or clears the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
168 ///
169 /// # Example
170 /// ```ignore,no_run
171 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
172 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
173 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
174 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
175 /// ```
176 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
177 where
178 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
179 {
180 self.secondary_worker_config = v.map(|x| x.into());
181 self
182 }
183
184 /// Sets the value of [labels][crate::model::AutoscalingPolicy::labels].
185 ///
186 /// # Example
187 /// ```ignore,no_run
188 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
189 /// let x = AutoscalingPolicy::new().set_labels([
190 /// ("key0", "abc"),
191 /// ("key1", "xyz"),
192 /// ]);
193 /// ```
194 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
195 where
196 T: std::iter::IntoIterator<Item = (K, V)>,
197 K: std::convert::Into<std::string::String>,
198 V: std::convert::Into<std::string::String>,
199 {
200 use std::iter::Iterator;
201 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
202 self
203 }
204
205 /// Sets the value of [cluster_type][crate::model::AutoscalingPolicy::cluster_type].
206 ///
207 /// # Example
208 /// ```ignore,no_run
209 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
210 /// use google_cloud_dataproc_v1::model::autoscaling_policy::ClusterType;
211 /// let x0 = AutoscalingPolicy::new().set_cluster_type(ClusterType::Standard);
212 /// let x1 = AutoscalingPolicy::new().set_cluster_type(ClusterType::ZeroScale);
213 /// ```
214 pub fn set_cluster_type<
215 T: std::convert::Into<crate::model::autoscaling_policy::ClusterType>,
216 >(
217 mut self,
218 v: T,
219 ) -> Self {
220 self.cluster_type = v.into();
221 self
222 }
223
224 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm].
225 ///
226 /// Note that all the setters affecting `algorithm` are mutually
227 /// exclusive.
228 ///
229 /// # Example
230 /// ```ignore,no_run
231 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
232 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
233 /// let x = AutoscalingPolicy::new().set_algorithm(Some(
234 /// google_cloud_dataproc_v1::model::autoscaling_policy::Algorithm::BasicAlgorithm(BasicAutoscalingAlgorithm::default().into())));
235 /// ```
236 pub fn set_algorithm<
237 T: std::convert::Into<std::option::Option<crate::model::autoscaling_policy::Algorithm>>,
238 >(
239 mut self,
240 v: T,
241 ) -> Self {
242 self.algorithm = v.into();
243 self
244 }
245
246 /// The value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
247 /// if it holds a `BasicAlgorithm`, `None` if the field is not set or
248 /// holds a different branch.
249 pub fn basic_algorithm(
250 &self,
251 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>> {
252 #[allow(unreachable_patterns)]
253 self.algorithm.as_ref().and_then(|v| match v {
254 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v) => {
255 std::option::Option::Some(v)
256 }
257 _ => std::option::Option::None,
258 })
259 }
260
261 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
262 /// to hold a `BasicAlgorithm`.
263 ///
264 /// Note that all the setters affecting `algorithm` are
265 /// mutually exclusive.
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
270 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
271 /// let x = AutoscalingPolicy::new().set_basic_algorithm(BasicAutoscalingAlgorithm::default()/* use setters */);
272 /// assert!(x.basic_algorithm().is_some());
273 /// ```
274 pub fn set_basic_algorithm<
275 T: std::convert::Into<std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>>,
276 >(
277 mut self,
278 v: T,
279 ) -> Self {
280 self.algorithm = std::option::Option::Some(
281 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v.into()),
282 );
283 self
284 }
285}
286
287impl wkt::message::Message for AutoscalingPolicy {
288 fn typename() -> &'static str {
289 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingPolicy"
290 }
291}
292
293/// Defines additional types related to [AutoscalingPolicy].
294pub mod autoscaling_policy {
295 #[allow(unused_imports)]
296 use super::*;
297
298 /// The type of the clusters for which this autoscaling policy is to be
299 /// configured.
300 ///
301 /// # Working with unknown values
302 ///
303 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
304 /// additional enum variants at any time. Adding new variants is not considered
305 /// a breaking change. Applications should write their code in anticipation of:
306 ///
307 /// - New values appearing in future releases of the client library, **and**
308 /// - New values received dynamically, without application changes.
309 ///
310 /// Please consult the [Working with enums] section in the user guide for some
311 /// guidelines.
312 ///
313 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
314 #[derive(Clone, Debug, PartialEq)]
315 #[non_exhaustive]
316 pub enum ClusterType {
317 /// Not set.
318 Unspecified,
319 /// Standard dataproc cluster with a minimum of two primary workers.
320 Standard,
321 /// Clusters that can use only secondary workers and be scaled down to zero
322 /// secondary worker nodes.
323 ZeroScale,
324 /// If set, the enum was initialized with an unknown value.
325 ///
326 /// Applications can examine the value using [ClusterType::value] or
327 /// [ClusterType::name].
328 UnknownValue(cluster_type::UnknownValue),
329 }
330
331 #[doc(hidden)]
332 pub mod cluster_type {
333 #[allow(unused_imports)]
334 use super::*;
335 #[derive(Clone, Debug, PartialEq)]
336 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
337 }
338
339 impl ClusterType {
340 /// Gets the enum value.
341 ///
342 /// Returns `None` if the enum contains an unknown value deserialized from
343 /// the string representation of enums.
344 pub fn value(&self) -> std::option::Option<i32> {
345 match self {
346 Self::Unspecified => std::option::Option::Some(0),
347 Self::Standard => std::option::Option::Some(1),
348 Self::ZeroScale => std::option::Option::Some(2),
349 Self::UnknownValue(u) => u.0.value(),
350 }
351 }
352
353 /// Gets the enum value as a string.
354 ///
355 /// Returns `None` if the enum contains an unknown value deserialized from
356 /// the integer representation of enums.
357 pub fn name(&self) -> std::option::Option<&str> {
358 match self {
359 Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
360 Self::Standard => std::option::Option::Some("STANDARD"),
361 Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
362 Self::UnknownValue(u) => u.0.name(),
363 }
364 }
365 }
366
367 impl std::default::Default for ClusterType {
368 fn default() -> Self {
369 use std::convert::From;
370 Self::from(0)
371 }
372 }
373
374 impl std::fmt::Display for ClusterType {
375 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
376 wkt::internal::display_enum(f, self.name(), self.value())
377 }
378 }
379
380 impl std::convert::From<i32> for ClusterType {
381 fn from(value: i32) -> Self {
382 match value {
383 0 => Self::Unspecified,
384 1 => Self::Standard,
385 2 => Self::ZeroScale,
386 _ => Self::UnknownValue(cluster_type::UnknownValue(
387 wkt::internal::UnknownEnumValue::Integer(value),
388 )),
389 }
390 }
391 }
392
393 impl std::convert::From<&str> for ClusterType {
394 fn from(value: &str) -> Self {
395 use std::string::ToString;
396 match value {
397 "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
398 "STANDARD" => Self::Standard,
399 "ZERO_SCALE" => Self::ZeroScale,
400 _ => Self::UnknownValue(cluster_type::UnknownValue(
401 wkt::internal::UnknownEnumValue::String(value.to_string()),
402 )),
403 }
404 }
405 }
406
407 impl serde::ser::Serialize for ClusterType {
408 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
409 where
410 S: serde::Serializer,
411 {
412 match self {
413 Self::Unspecified => serializer.serialize_i32(0),
414 Self::Standard => serializer.serialize_i32(1),
415 Self::ZeroScale => serializer.serialize_i32(2),
416 Self::UnknownValue(u) => u.0.serialize(serializer),
417 }
418 }
419 }
420
421 impl<'de> serde::de::Deserialize<'de> for ClusterType {
422 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
423 where
424 D: serde::Deserializer<'de>,
425 {
426 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
427 ".google.cloud.dataproc.v1.AutoscalingPolicy.ClusterType",
428 ))
429 }
430 }
431
432 /// Autoscaling algorithm for policy.
433 #[derive(Clone, Debug, PartialEq)]
434 #[non_exhaustive]
435 pub enum Algorithm {
436 BasicAlgorithm(std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>),
437 }
438}
439
440/// Basic algorithm for autoscaling.
441#[derive(Clone, Default, PartialEq)]
442#[non_exhaustive]
443pub struct BasicAutoscalingAlgorithm {
444 /// Optional. Duration between scaling events. A scaling period starts after
445 /// the update operation from the previous event has completed.
446 ///
447 /// Bounds: [2m, 1d]. Default: 2m.
448 pub cooldown_period: std::option::Option<wkt::Duration>,
449
450 pub config: std::option::Option<crate::model::basic_autoscaling_algorithm::Config>,
451
452 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
453}
454
455impl BasicAutoscalingAlgorithm {
456 pub fn new() -> Self {
457 std::default::Default::default()
458 }
459
460 /// Sets the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
461 ///
462 /// # Example
463 /// ```ignore,no_run
464 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
465 /// use wkt::Duration;
466 /// let x = BasicAutoscalingAlgorithm::new().set_cooldown_period(Duration::default()/* use setters */);
467 /// ```
468 pub fn set_cooldown_period<T>(mut self, v: T) -> Self
469 where
470 T: std::convert::Into<wkt::Duration>,
471 {
472 self.cooldown_period = std::option::Option::Some(v.into());
473 self
474 }
475
476 /// Sets or clears the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
477 ///
478 /// # Example
479 /// ```ignore,no_run
480 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
481 /// use wkt::Duration;
482 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(Some(Duration::default()/* use setters */));
483 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(None::<Duration>);
484 /// ```
485 pub fn set_or_clear_cooldown_period<T>(mut self, v: std::option::Option<T>) -> Self
486 where
487 T: std::convert::Into<wkt::Duration>,
488 {
489 self.cooldown_period = v.map(|x| x.into());
490 self
491 }
492
493 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config].
494 ///
495 /// Note that all the setters affecting `config` are mutually
496 /// exclusive.
497 ///
498 /// # Example
499 /// ```ignore,no_run
500 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
501 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
502 /// let x = BasicAutoscalingAlgorithm::new().set_config(Some(
503 /// google_cloud_dataproc_v1::model::basic_autoscaling_algorithm::Config::YarnConfig(BasicYarnAutoscalingConfig::default().into())));
504 /// ```
505 pub fn set_config<
506 T: std::convert::Into<std::option::Option<crate::model::basic_autoscaling_algorithm::Config>>,
507 >(
508 mut self,
509 v: T,
510 ) -> Self {
511 self.config = v.into();
512 self
513 }
514
515 /// The value of [config][crate::model::BasicAutoscalingAlgorithm::config]
516 /// if it holds a `YarnConfig`, `None` if the field is not set or
517 /// holds a different branch.
518 pub fn yarn_config(
519 &self,
520 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>> {
521 #[allow(unreachable_patterns)]
522 self.config.as_ref().and_then(|v| match v {
523 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v) => {
524 std::option::Option::Some(v)
525 }
526 _ => std::option::Option::None,
527 })
528 }
529
530 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config]
531 /// to hold a `YarnConfig`.
532 ///
533 /// Note that all the setters affecting `config` are
534 /// mutually exclusive.
535 ///
536 /// # Example
537 /// ```ignore,no_run
538 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
539 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
540 /// let x = BasicAutoscalingAlgorithm::new().set_yarn_config(BasicYarnAutoscalingConfig::default()/* use setters */);
541 /// assert!(x.yarn_config().is_some());
542 /// ```
543 pub fn set_yarn_config<
544 T: std::convert::Into<std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>>,
545 >(
546 mut self,
547 v: T,
548 ) -> Self {
549 self.config = std::option::Option::Some(
550 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v.into()),
551 );
552 self
553 }
554}
555
556impl wkt::message::Message for BasicAutoscalingAlgorithm {
557 fn typename() -> &'static str {
558 "type.googleapis.com/google.cloud.dataproc.v1.BasicAutoscalingAlgorithm"
559 }
560}
561
562/// Defines additional types related to [BasicAutoscalingAlgorithm].
563pub mod basic_autoscaling_algorithm {
564 #[allow(unused_imports)]
565 use super::*;
566
567 #[derive(Clone, Debug, PartialEq)]
568 #[non_exhaustive]
569 pub enum Config {
570 /// Required. YARN autoscaling configuration.
571 YarnConfig(std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>),
572 }
573}
574
575/// Basic autoscaling configurations for YARN.
576#[derive(Clone, Default, PartialEq)]
577#[non_exhaustive]
578pub struct BasicYarnAutoscalingConfig {
579 /// Required. Timeout for YARN graceful decommissioning of Node Managers.
580 /// Specifies the duration to wait for jobs to complete before forcefully
581 /// removing workers (and potentially interrupting jobs). Only applicable to
582 /// downscaling operations.
583 ///
584 /// Bounds: [0s, 1d].
585 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
586
587 /// Required. Fraction of average YARN pending memory in the last cooldown
588 /// period for which to add workers. A scale-up factor of 1.0 will result in
589 /// scaling up so that there is no pending memory remaining after the update
590 /// (more aggressive scaling). A scale-up factor closer to 0 will result in a
591 /// smaller magnitude of scaling up (less aggressive scaling). See [How
592 /// autoscaling
593 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
594 /// for more information.
595 ///
596 /// Bounds: [0.0, 1.0].
597 pub scale_up_factor: f64,
598
599 /// Required. Fraction of average YARN pending memory in the last cooldown
600 /// period for which to remove workers. A scale-down factor of 1 will result in
601 /// scaling down so that there is no available memory remaining after the
602 /// update (more aggressive scaling). A scale-down factor of 0 disables
603 /// removing workers, which can be beneficial for autoscaling a single job.
604 /// See [How autoscaling
605 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
606 /// for more information.
607 ///
608 /// Bounds: [0.0, 1.0].
609 pub scale_down_factor: f64,
610
611 /// Optional. Minimum scale-up threshold as a fraction of total cluster size
612 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
613 /// 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
614 /// the cluster to scale. A threshold of 0 means the autoscaler will scale up
615 /// on any recommended change.
616 ///
617 /// Bounds: [0.0, 1.0]. Default: 0.0.
618 pub scale_up_min_worker_fraction: f64,
619
620 /// Optional. Minimum scale-down threshold as a fraction of total cluster size
621 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
622 /// 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
623 /// the cluster to scale. A threshold of 0 means the autoscaler will scale down
624 /// on any recommended change.
625 ///
626 /// Bounds: [0.0, 1.0]. Default: 0.0.
627 pub scale_down_min_worker_fraction: f64,
628
629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
630}
631
632impl BasicYarnAutoscalingConfig {
633 pub fn new() -> Self {
634 std::default::Default::default()
635 }
636
637 /// Sets the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
638 ///
639 /// # Example
640 /// ```ignore,no_run
641 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
642 /// use wkt::Duration;
643 /// let x = BasicYarnAutoscalingConfig::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
644 /// ```
645 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
646 where
647 T: std::convert::Into<wkt::Duration>,
648 {
649 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
650 self
651 }
652
653 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
654 ///
655 /// # Example
656 /// ```ignore,no_run
657 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
658 /// use wkt::Duration;
659 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
660 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
661 /// ```
662 pub fn set_or_clear_graceful_decommission_timeout<T>(
663 mut self,
664 v: std::option::Option<T>,
665 ) -> Self
666 where
667 T: std::convert::Into<wkt::Duration>,
668 {
669 self.graceful_decommission_timeout = v.map(|x| x.into());
670 self
671 }
672
673 /// Sets the value of [scale_up_factor][crate::model::BasicYarnAutoscalingConfig::scale_up_factor].
674 ///
675 /// # Example
676 /// ```ignore,no_run
677 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
678 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_factor(42.0);
679 /// ```
680 pub fn set_scale_up_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
681 self.scale_up_factor = v.into();
682 self
683 }
684
685 /// Sets the value of [scale_down_factor][crate::model::BasicYarnAutoscalingConfig::scale_down_factor].
686 ///
687 /// # Example
688 /// ```ignore,no_run
689 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
690 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_factor(42.0);
691 /// ```
692 pub fn set_scale_down_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
693 self.scale_down_factor = v.into();
694 self
695 }
696
697 /// Sets the value of [scale_up_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_up_min_worker_fraction].
698 ///
699 /// # Example
700 /// ```ignore,no_run
701 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
702 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_min_worker_fraction(42.0);
703 /// ```
704 pub fn set_scale_up_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
705 self.scale_up_min_worker_fraction = v.into();
706 self
707 }
708
709 /// Sets the value of [scale_down_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_down_min_worker_fraction].
710 ///
711 /// # Example
712 /// ```ignore,no_run
713 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
714 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_min_worker_fraction(42.0);
715 /// ```
716 pub fn set_scale_down_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
717 self.scale_down_min_worker_fraction = v.into();
718 self
719 }
720}
721
722impl wkt::message::Message for BasicYarnAutoscalingConfig {
723 fn typename() -> &'static str {
724 "type.googleapis.com/google.cloud.dataproc.v1.BasicYarnAutoscalingConfig"
725 }
726}
727
728/// Configuration for the size bounds of an instance group, including its
729/// proportional size to other groups.
730#[derive(Clone, Default, PartialEq)]
731#[non_exhaustive]
732pub struct InstanceGroupAutoscalingPolicyConfig {
733 /// Optional. Minimum number of instances for this group.
734 ///
735 /// Primary workers - Bounds: [2, max_instances]. Default: 2.
736 /// Secondary workers - Bounds: [0, max_instances]. Default: 0.
737 pub min_instances: i32,
738
739 /// Required. Maximum number of instances for this group. Required for primary
740 /// workers. Note that by default, clusters will not use secondary workers.
741 /// Required for secondary workers if the minimum secondary instances is set.
742 ///
743 /// Primary workers - Bounds: [min_instances, ).
744 /// Secondary workers - Bounds: [min_instances, ). Default: 0.
745 pub max_instances: i32,
746
747 /// Optional. Weight for the instance group, which is used to determine the
748 /// fraction of total workers in the cluster from this instance group.
749 /// For example, if primary workers have weight 2, and secondary workers have
750 /// weight 1, the cluster will have approximately 2 primary workers for each
751 /// secondary worker.
752 ///
753 /// The cluster may not reach the specified balance if constrained
754 /// by min/max bounds or other autoscaling settings. For example, if
755 /// `max_instances` for secondary workers is 0, then only primary workers will
756 /// be added. The cluster can also be out of balance when created.
757 ///
758 /// If weight is not set on any instance group, the cluster will default to
759 /// equal weight for all groups: the cluster will attempt to maintain an equal
760 /// number of workers in each group within the configured size bounds for each
761 /// group. If weight is set for one group only, the cluster will default to
762 /// zero weight on the unset group. For example if weight is set only on
763 /// primary workers, the cluster will use primary workers only and no
764 /// secondary workers.
765 pub weight: i32,
766
767 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
768}
769
770impl InstanceGroupAutoscalingPolicyConfig {
771 pub fn new() -> Self {
772 std::default::Default::default()
773 }
774
775 /// Sets the value of [min_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::min_instances].
776 ///
777 /// # Example
778 /// ```ignore,no_run
779 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
780 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_min_instances(42);
781 /// ```
782 pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
783 self.min_instances = v.into();
784 self
785 }
786
787 /// Sets the value of [max_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::max_instances].
788 ///
789 /// # Example
790 /// ```ignore,no_run
791 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
792 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_max_instances(42);
793 /// ```
794 pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
795 self.max_instances = v.into();
796 self
797 }
798
799 /// Sets the value of [weight][crate::model::InstanceGroupAutoscalingPolicyConfig::weight].
800 ///
801 /// # Example
802 /// ```ignore,no_run
803 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
804 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_weight(42);
805 /// ```
806 pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
807 self.weight = v.into();
808 self
809 }
810}
811
812impl wkt::message::Message for InstanceGroupAutoscalingPolicyConfig {
813 fn typename() -> &'static str {
814 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig"
815 }
816}
817
818/// A request to create an autoscaling policy.
819#[derive(Clone, Default, PartialEq)]
820#[non_exhaustive]
821pub struct CreateAutoscalingPolicyRequest {
822 /// Required. The "resource name" of the region or location, as described
823 /// in <https://cloud.google.com/apis/design/resource_names>.
824 ///
825 /// * For `projects.regions.autoscalingPolicies.create`, the resource name
826 /// of the region has the following format:
827 /// `projects/{project_id}/regions/{region}`
828 ///
829 /// * For `projects.locations.autoscalingPolicies.create`, the resource name
830 /// of the location has the following format:
831 /// `projects/{project_id}/locations/{location}`
832 ///
833 pub parent: std::string::String,
834
835 /// Required. The autoscaling policy to create.
836 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
837
838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
839}
840
841impl CreateAutoscalingPolicyRequest {
842 pub fn new() -> Self {
843 std::default::Default::default()
844 }
845
846 /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
847 ///
848 /// # Example
849 /// ```ignore,no_run
850 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
851 /// let x = CreateAutoscalingPolicyRequest::new().set_parent("example");
852 /// ```
853 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
854 self.parent = v.into();
855 self
856 }
857
858 /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
859 ///
860 /// # Example
861 /// ```ignore,no_run
862 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
863 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
864 /// let x = CreateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
865 /// ```
866 pub fn set_policy<T>(mut self, v: T) -> Self
867 where
868 T: std::convert::Into<crate::model::AutoscalingPolicy>,
869 {
870 self.policy = std::option::Option::Some(v.into());
871 self
872 }
873
874 /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
875 ///
876 /// # Example
877 /// ```ignore,no_run
878 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
879 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
880 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
881 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
882 /// ```
883 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
884 where
885 T: std::convert::Into<crate::model::AutoscalingPolicy>,
886 {
887 self.policy = v.map(|x| x.into());
888 self
889 }
890}
891
892impl wkt::message::Message for CreateAutoscalingPolicyRequest {
893 fn typename() -> &'static str {
894 "type.googleapis.com/google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest"
895 }
896}
897
898/// A request to fetch an autoscaling policy.
899#[derive(Clone, Default, PartialEq)]
900#[non_exhaustive]
901pub struct GetAutoscalingPolicyRequest {
902 /// Required. The "resource name" of the autoscaling policy, as described
903 /// in <https://cloud.google.com/apis/design/resource_names>.
904 ///
905 /// * For `projects.regions.autoscalingPolicies.get`, the resource name
906 /// of the policy has the following format:
907 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
908 ///
909 /// * For `projects.locations.autoscalingPolicies.get`, the resource name
910 /// of the policy has the following format:
911 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
912 ///
913 pub name: std::string::String,
914
915 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
916}
917
918impl GetAutoscalingPolicyRequest {
919 pub fn new() -> Self {
920 std::default::Default::default()
921 }
922
923 /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
924 ///
925 /// # Example
926 /// ```ignore,no_run
927 /// # use google_cloud_dataproc_v1::model::GetAutoscalingPolicyRequest;
928 /// let x = GetAutoscalingPolicyRequest::new().set_name("example");
929 /// ```
930 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
931 self.name = v.into();
932 self
933 }
934}
935
936impl wkt::message::Message for GetAutoscalingPolicyRequest {
937 fn typename() -> &'static str {
938 "type.googleapis.com/google.cloud.dataproc.v1.GetAutoscalingPolicyRequest"
939 }
940}
941
942/// A request to update an autoscaling policy.
943#[derive(Clone, Default, PartialEq)]
944#[non_exhaustive]
945pub struct UpdateAutoscalingPolicyRequest {
946 /// Required. The updated autoscaling policy.
947 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
948
949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
950}
951
952impl UpdateAutoscalingPolicyRequest {
953 pub fn new() -> Self {
954 std::default::Default::default()
955 }
956
957 /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
958 ///
959 /// # Example
960 /// ```ignore,no_run
961 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
962 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
963 /// let x = UpdateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
964 /// ```
965 pub fn set_policy<T>(mut self, v: T) -> Self
966 where
967 T: std::convert::Into<crate::model::AutoscalingPolicy>,
968 {
969 self.policy = std::option::Option::Some(v.into());
970 self
971 }
972
973 /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
974 ///
975 /// # Example
976 /// ```ignore,no_run
977 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
978 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
979 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
980 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
981 /// ```
982 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
983 where
984 T: std::convert::Into<crate::model::AutoscalingPolicy>,
985 {
986 self.policy = v.map(|x| x.into());
987 self
988 }
989}
990
991impl wkt::message::Message for UpdateAutoscalingPolicyRequest {
992 fn typename() -> &'static str {
993 "type.googleapis.com/google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest"
994 }
995}
996
997/// A request to delete an autoscaling policy.
998///
999/// Autoscaling policies in use by one or more clusters will not be deleted.
1000#[derive(Clone, Default, PartialEq)]
1001#[non_exhaustive]
1002pub struct DeleteAutoscalingPolicyRequest {
1003 /// Required. The "resource name" of the autoscaling policy, as described
1004 /// in <https://cloud.google.com/apis/design/resource_names>.
1005 ///
1006 /// * For `projects.regions.autoscalingPolicies.delete`, the resource name
1007 /// of the policy has the following format:
1008 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
1009 ///
1010 /// * For `projects.locations.autoscalingPolicies.delete`, the resource name
1011 /// of the policy has the following format:
1012 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
1013 ///
1014 pub name: std::string::String,
1015
1016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1017}
1018
1019impl DeleteAutoscalingPolicyRequest {
1020 pub fn new() -> Self {
1021 std::default::Default::default()
1022 }
1023
1024 /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
1025 ///
1026 /// # Example
1027 /// ```ignore,no_run
1028 /// # use google_cloud_dataproc_v1::model::DeleteAutoscalingPolicyRequest;
1029 /// let x = DeleteAutoscalingPolicyRequest::new().set_name("example");
1030 /// ```
1031 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1032 self.name = v.into();
1033 self
1034 }
1035}
1036
1037impl wkt::message::Message for DeleteAutoscalingPolicyRequest {
1038 fn typename() -> &'static str {
1039 "type.googleapis.com/google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest"
1040 }
1041}
1042
1043/// A request to list autoscaling policies in a project.
1044#[derive(Clone, Default, PartialEq)]
1045#[non_exhaustive]
1046pub struct ListAutoscalingPoliciesRequest {
1047 /// Required. The "resource name" of the region or location, as described
1048 /// in <https://cloud.google.com/apis/design/resource_names>.
1049 ///
1050 /// * For `projects.regions.autoscalingPolicies.list`, the resource name
1051 /// of the region has the following format:
1052 /// `projects/{project_id}/regions/{region}`
1053 ///
1054 /// * For `projects.locations.autoscalingPolicies.list`, the resource name
1055 /// of the location has the following format:
1056 /// `projects/{project_id}/locations/{location}`
1057 ///
1058 pub parent: std::string::String,
1059
1060 /// Optional. The maximum number of results to return in each response.
1061 /// Must be less than or equal to 1000. Defaults to 100.
1062 pub page_size: i32,
1063
1064 /// Optional. The page token, returned by a previous call, to request the
1065 /// next page of results.
1066 pub page_token: std::string::String,
1067
1068 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1069}
1070
1071impl ListAutoscalingPoliciesRequest {
1072 pub fn new() -> Self {
1073 std::default::Default::default()
1074 }
1075
1076 /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
1077 ///
1078 /// # Example
1079 /// ```ignore,no_run
1080 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1081 /// let x = ListAutoscalingPoliciesRequest::new().set_parent("example");
1082 /// ```
1083 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1084 self.parent = v.into();
1085 self
1086 }
1087
1088 /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
1089 ///
1090 /// # Example
1091 /// ```ignore,no_run
1092 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1093 /// let x = ListAutoscalingPoliciesRequest::new().set_page_size(42);
1094 /// ```
1095 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1096 self.page_size = v.into();
1097 self
1098 }
1099
1100 /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
1101 ///
1102 /// # Example
1103 /// ```ignore,no_run
1104 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1105 /// let x = ListAutoscalingPoliciesRequest::new().set_page_token("example");
1106 /// ```
1107 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1108 self.page_token = v.into();
1109 self
1110 }
1111}
1112
1113impl wkt::message::Message for ListAutoscalingPoliciesRequest {
1114 fn typename() -> &'static str {
1115 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest"
1116 }
1117}
1118
1119/// A response to a request to list autoscaling policies in a project.
1120#[derive(Clone, Default, PartialEq)]
1121#[non_exhaustive]
1122pub struct ListAutoscalingPoliciesResponse {
1123 /// Output only. Autoscaling policies list.
1124 pub policies: std::vec::Vec<crate::model::AutoscalingPolicy>,
1125
1126 /// Output only. This token is included in the response if there are more
1127 /// results to fetch.
1128 pub next_page_token: std::string::String,
1129
1130 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1131}
1132
1133impl ListAutoscalingPoliciesResponse {
1134 pub fn new() -> Self {
1135 std::default::Default::default()
1136 }
1137
1138 /// Sets the value of [policies][crate::model::ListAutoscalingPoliciesResponse::policies].
1139 ///
1140 /// # Example
1141 /// ```ignore,no_run
1142 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1143 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
1144 /// let x = ListAutoscalingPoliciesResponse::new()
1145 /// .set_policies([
1146 /// AutoscalingPolicy::default()/* use setters */,
1147 /// AutoscalingPolicy::default()/* use (different) setters */,
1148 /// ]);
1149 /// ```
1150 pub fn set_policies<T, V>(mut self, v: T) -> Self
1151 where
1152 T: std::iter::IntoIterator<Item = V>,
1153 V: std::convert::Into<crate::model::AutoscalingPolicy>,
1154 {
1155 use std::iter::Iterator;
1156 self.policies = v.into_iter().map(|i| i.into()).collect();
1157 self
1158 }
1159
1160 /// Sets the value of [next_page_token][crate::model::ListAutoscalingPoliciesResponse::next_page_token].
1161 ///
1162 /// # Example
1163 /// ```ignore,no_run
1164 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1165 /// let x = ListAutoscalingPoliciesResponse::new().set_next_page_token("example");
1166 /// ```
1167 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1168 self.next_page_token = v.into();
1169 self
1170 }
1171}
1172
1173impl wkt::message::Message for ListAutoscalingPoliciesResponse {
1174 fn typename() -> &'static str {
1175 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse"
1176 }
1177}
1178
1179#[doc(hidden)]
1180impl google_cloud_gax::paginator::internal::PageableResponse for ListAutoscalingPoliciesResponse {
1181 type PageItem = crate::model::AutoscalingPolicy;
1182
1183 fn items(self) -> std::vec::Vec<Self::PageItem> {
1184 self.policies
1185 }
1186
1187 fn next_page_token(&self) -> std::string::String {
1188 use std::clone::Clone;
1189 self.next_page_token.clone()
1190 }
1191}
1192
1193/// A request to create a batch workload.
1194#[derive(Clone, Default, PartialEq)]
1195#[non_exhaustive]
1196pub struct CreateBatchRequest {
1197 /// Required. The parent resource where this batch will be created.
1198 pub parent: std::string::String,
1199
1200 /// Required. The batch to create.
1201 pub batch: std::option::Option<crate::model::Batch>,
1202
1203 /// Optional. The ID to use for the batch, which will become the final
1204 /// component of the batch's resource name.
1205 ///
1206 /// This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
1207 pub batch_id: std::string::String,
1208
1209 /// Optional. A unique ID used to identify the request. If the service
1210 /// receives two
1211 /// [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
1212 /// with the same request_id, the second request is ignored and the
1213 /// Operation that corresponds to the first Batch created and stored
1214 /// in the backend is returned.
1215 ///
1216 /// Recommendation: Set this value to a
1217 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
1218 ///
1219 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
1220 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
1221 pub request_id: std::string::String,
1222
1223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1224}
1225
1226impl CreateBatchRequest {
1227 pub fn new() -> Self {
1228 std::default::Default::default()
1229 }
1230
1231 /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1232 ///
1233 /// # Example
1234 /// ```ignore,no_run
1235 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1236 /// let x = CreateBatchRequest::new().set_parent("example");
1237 /// ```
1238 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1239 self.parent = v.into();
1240 self
1241 }
1242
1243 /// Sets the value of [batch][crate::model::CreateBatchRequest::batch].
1244 ///
1245 /// # Example
1246 /// ```ignore,no_run
1247 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1248 /// use google_cloud_dataproc_v1::model::Batch;
1249 /// let x = CreateBatchRequest::new().set_batch(Batch::default()/* use setters */);
1250 /// ```
1251 pub fn set_batch<T>(mut self, v: T) -> Self
1252 where
1253 T: std::convert::Into<crate::model::Batch>,
1254 {
1255 self.batch = std::option::Option::Some(v.into());
1256 self
1257 }
1258
1259 /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1260 ///
1261 /// # Example
1262 /// ```ignore,no_run
1263 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1264 /// use google_cloud_dataproc_v1::model::Batch;
1265 /// let x = CreateBatchRequest::new().set_or_clear_batch(Some(Batch::default()/* use setters */));
1266 /// let x = CreateBatchRequest::new().set_or_clear_batch(None::<Batch>);
1267 /// ```
1268 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1269 where
1270 T: std::convert::Into<crate::model::Batch>,
1271 {
1272 self.batch = v.map(|x| x.into());
1273 self
1274 }
1275
1276 /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1277 ///
1278 /// # Example
1279 /// ```ignore,no_run
1280 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1281 /// let x = CreateBatchRequest::new().set_batch_id("example");
1282 /// ```
1283 pub fn set_batch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1284 self.batch_id = v.into();
1285 self
1286 }
1287
1288 /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1289 ///
1290 /// # Example
1291 /// ```ignore,no_run
1292 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1293 /// let x = CreateBatchRequest::new().set_request_id("example");
1294 /// ```
1295 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1296 self.request_id = v.into();
1297 self
1298 }
1299}
1300
1301impl wkt::message::Message for CreateBatchRequest {
1302 fn typename() -> &'static str {
1303 "type.googleapis.com/google.cloud.dataproc.v1.CreateBatchRequest"
1304 }
1305}
1306
1307/// A request to get the resource representation for a batch workload.
1308#[derive(Clone, Default, PartialEq)]
1309#[non_exhaustive]
1310pub struct GetBatchRequest {
1311 /// Required. The fully qualified name of the batch to retrieve
1312 /// in the format
1313 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1314 pub name: std::string::String,
1315
1316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1317}
1318
1319impl GetBatchRequest {
1320 pub fn new() -> Self {
1321 std::default::Default::default()
1322 }
1323
1324 /// Sets the value of [name][crate::model::GetBatchRequest::name].
1325 ///
1326 /// # Example
1327 /// ```ignore,no_run
1328 /// # use google_cloud_dataproc_v1::model::GetBatchRequest;
1329 /// let x = GetBatchRequest::new().set_name("example");
1330 /// ```
1331 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1332 self.name = v.into();
1333 self
1334 }
1335}
1336
1337impl wkt::message::Message for GetBatchRequest {
1338 fn typename() -> &'static str {
1339 "type.googleapis.com/google.cloud.dataproc.v1.GetBatchRequest"
1340 }
1341}
1342
1343/// A request to list batch workloads in a project.
1344#[derive(Clone, Default, PartialEq)]
1345#[non_exhaustive]
1346pub struct ListBatchesRequest {
1347 /// Required. The parent, which owns this collection of batches.
1348 pub parent: std::string::String,
1349
1350 /// Optional. The maximum number of batches to return in each response.
1351 /// The service may return fewer than this value.
1352 /// The default page size is 20; the maximum page size is 1000.
1353 pub page_size: i32,
1354
1355 /// Optional. A page token received from a previous `ListBatches` call.
1356 /// Provide this token to retrieve the subsequent page.
1357 pub page_token: std::string::String,
1358
1359 /// Optional. A filter for the batches to return in the response.
1360 ///
1361 /// A filter is a logical expression constraining the values of various fields
1362 /// in each batch resource. Filters are case sensitive, and may contain
1363 /// multiple clauses combined with logical operators (AND/OR).
1364 /// Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`.
1365 ///
1366 /// e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"`
1367 /// filters for batches in state RUNNING that were created before 2023-01-01
1368 ///
1369 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
1370 /// description of the filter syntax and a list of supported comparisons.
1371 pub filter: std::string::String,
1372
1373 /// Optional. Field(s) on which to sort the list of batches.
1374 ///
1375 /// Currently the only supported sort orders are unspecified (empty) and
1376 /// `create_time desc` to sort by most recently created batches first.
1377 ///
1378 /// See <https://google.aip.dev/132#ordering> for more details.
1379 pub order_by: std::string::String,
1380
1381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1382}
1383
1384impl ListBatchesRequest {
1385 pub fn new() -> Self {
1386 std::default::Default::default()
1387 }
1388
1389 /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1390 ///
1391 /// # Example
1392 /// ```ignore,no_run
1393 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1394 /// let x = ListBatchesRequest::new().set_parent("example");
1395 /// ```
1396 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1397 self.parent = v.into();
1398 self
1399 }
1400
1401 /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1402 ///
1403 /// # Example
1404 /// ```ignore,no_run
1405 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1406 /// let x = ListBatchesRequest::new().set_page_size(42);
1407 /// ```
1408 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1409 self.page_size = v.into();
1410 self
1411 }
1412
1413 /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1414 ///
1415 /// # Example
1416 /// ```ignore,no_run
1417 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1418 /// let x = ListBatchesRequest::new().set_page_token("example");
1419 /// ```
1420 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1421 self.page_token = v.into();
1422 self
1423 }
1424
1425 /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1426 ///
1427 /// # Example
1428 /// ```ignore,no_run
1429 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1430 /// let x = ListBatchesRequest::new().set_filter("example");
1431 /// ```
1432 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1433 self.filter = v.into();
1434 self
1435 }
1436
1437 /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1438 ///
1439 /// # Example
1440 /// ```ignore,no_run
1441 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1442 /// let x = ListBatchesRequest::new().set_order_by("example");
1443 /// ```
1444 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1445 self.order_by = v.into();
1446 self
1447 }
1448}
1449
1450impl wkt::message::Message for ListBatchesRequest {
1451 fn typename() -> &'static str {
1452 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesRequest"
1453 }
1454}
1455
1456/// A list of batch workloads.
1457#[derive(Clone, Default, PartialEq)]
1458#[non_exhaustive]
1459pub struct ListBatchesResponse {
1460 /// The batches from the specified collection.
1461 pub batches: std::vec::Vec<crate::model::Batch>,
1462
1463 /// A token, which can be sent as `page_token` to retrieve the next page.
1464 /// If this field is omitted, there are no subsequent pages.
1465 pub next_page_token: std::string::String,
1466
1467 /// Output only. List of Batches that could not be included in the response.
1468 /// Attempting to get one of these resources may indicate why it was not
1469 /// included in the list response.
1470 pub unreachable: std::vec::Vec<std::string::String>,
1471
1472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1473}
1474
1475impl ListBatchesResponse {
1476 pub fn new() -> Self {
1477 std::default::Default::default()
1478 }
1479
1480 /// Sets the value of [batches][crate::model::ListBatchesResponse::batches].
1481 ///
1482 /// # Example
1483 /// ```ignore,no_run
1484 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1485 /// use google_cloud_dataproc_v1::model::Batch;
1486 /// let x = ListBatchesResponse::new()
1487 /// .set_batches([
1488 /// Batch::default()/* use setters */,
1489 /// Batch::default()/* use (different) setters */,
1490 /// ]);
1491 /// ```
1492 pub fn set_batches<T, V>(mut self, v: T) -> Self
1493 where
1494 T: std::iter::IntoIterator<Item = V>,
1495 V: std::convert::Into<crate::model::Batch>,
1496 {
1497 use std::iter::Iterator;
1498 self.batches = v.into_iter().map(|i| i.into()).collect();
1499 self
1500 }
1501
1502 /// Sets the value of [next_page_token][crate::model::ListBatchesResponse::next_page_token].
1503 ///
1504 /// # Example
1505 /// ```ignore,no_run
1506 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1507 /// let x = ListBatchesResponse::new().set_next_page_token("example");
1508 /// ```
1509 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1510 self.next_page_token = v.into();
1511 self
1512 }
1513
1514 /// Sets the value of [unreachable][crate::model::ListBatchesResponse::unreachable].
1515 ///
1516 /// # Example
1517 /// ```ignore,no_run
1518 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1519 /// let x = ListBatchesResponse::new().set_unreachable(["a", "b", "c"]);
1520 /// ```
1521 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1522 where
1523 T: std::iter::IntoIterator<Item = V>,
1524 V: std::convert::Into<std::string::String>,
1525 {
1526 use std::iter::Iterator;
1527 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1528 self
1529 }
1530}
1531
1532impl wkt::message::Message for ListBatchesResponse {
1533 fn typename() -> &'static str {
1534 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesResponse"
1535 }
1536}
1537
1538#[doc(hidden)]
1539impl google_cloud_gax::paginator::internal::PageableResponse for ListBatchesResponse {
1540 type PageItem = crate::model::Batch;
1541
1542 fn items(self) -> std::vec::Vec<Self::PageItem> {
1543 self.batches
1544 }
1545
1546 fn next_page_token(&self) -> std::string::String {
1547 use std::clone::Clone;
1548 self.next_page_token.clone()
1549 }
1550}
1551
1552/// A request to delete a batch workload.
1553#[derive(Clone, Default, PartialEq)]
1554#[non_exhaustive]
1555pub struct DeleteBatchRequest {
1556 /// Required. The fully qualified name of the batch to retrieve
1557 /// in the format
1558 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1559 pub name: std::string::String,
1560
1561 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1562}
1563
1564impl DeleteBatchRequest {
1565 pub fn new() -> Self {
1566 std::default::Default::default()
1567 }
1568
1569 /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1570 ///
1571 /// # Example
1572 /// ```ignore,no_run
1573 /// # use google_cloud_dataproc_v1::model::DeleteBatchRequest;
1574 /// let x = DeleteBatchRequest::new().set_name("example");
1575 /// ```
1576 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1577 self.name = v.into();
1578 self
1579 }
1580}
1581
1582impl wkt::message::Message for DeleteBatchRequest {
1583 fn typename() -> &'static str {
1584 "type.googleapis.com/google.cloud.dataproc.v1.DeleteBatchRequest"
1585 }
1586}
1587
1588/// A representation of a batch workload in the service.
1589#[derive(Clone, Default, PartialEq)]
1590#[non_exhaustive]
1591pub struct Batch {
1592 /// Output only. The resource name of the batch.
1593 pub name: std::string::String,
1594
1595 /// Output only. A batch UUID (Unique Universal Identifier). The service
1596 /// generates this value when it creates the batch.
1597 pub uuid: std::string::String,
1598
1599 /// Output only. The time when the batch was created.
1600 pub create_time: std::option::Option<wkt::Timestamp>,
1601
1602 /// Output only. Runtime information about batch execution.
1603 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
1604
1605 /// Output only. The state of the batch.
1606 pub state: crate::model::batch::State,
1607
1608 /// Output only. Batch state details, such as a failure
1609 /// description if the state is `FAILED`.
1610 pub state_message: std::string::String,
1611
1612 /// Output only. The time when the batch entered a current state.
1613 pub state_time: std::option::Option<wkt::Timestamp>,
1614
1615 /// Output only. The email address of the user who created the batch.
1616 pub creator: std::string::String,
1617
1618 /// Optional. The labels to associate with this batch.
1619 /// Label **keys** must contain 1 to 63 characters, and must conform to
1620 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
1621 /// Label **values** may be empty, but, if present, must contain 1 to 63
1622 /// characters, and must conform to [RFC
1623 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
1624 /// associated with a batch.
1625 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1626
1627 /// Optional. Runtime configuration for the batch execution.
1628 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
1629
1630 /// Optional. Environment configuration for the batch execution.
1631 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
1632
1633 /// Output only. The resource name of the operation associated with this batch.
1634 pub operation: std::string::String,
1635
1636 /// Output only. Historical state information for the batch.
1637 pub state_history: std::vec::Vec<crate::model::batch::StateHistory>,
1638
1639 /// The application/framework-specific portion of the batch configuration.
1640 pub batch_config: std::option::Option<crate::model::batch::BatchConfig>,
1641
1642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1643}
1644
1645impl Batch {
1646 pub fn new() -> Self {
1647 std::default::Default::default()
1648 }
1649
1650 /// Sets the value of [name][crate::model::Batch::name].
1651 ///
1652 /// # Example
1653 /// ```ignore,no_run
1654 /// # use google_cloud_dataproc_v1::model::Batch;
1655 /// let x = Batch::new().set_name("example");
1656 /// ```
1657 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1658 self.name = v.into();
1659 self
1660 }
1661
1662 /// Sets the value of [uuid][crate::model::Batch::uuid].
1663 ///
1664 /// # Example
1665 /// ```ignore,no_run
1666 /// # use google_cloud_dataproc_v1::model::Batch;
1667 /// let x = Batch::new().set_uuid("example");
1668 /// ```
1669 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1670 self.uuid = v.into();
1671 self
1672 }
1673
1674 /// Sets the value of [create_time][crate::model::Batch::create_time].
1675 ///
1676 /// # Example
1677 /// ```ignore,no_run
1678 /// # use google_cloud_dataproc_v1::model::Batch;
1679 /// use wkt::Timestamp;
1680 /// let x = Batch::new().set_create_time(Timestamp::default()/* use setters */);
1681 /// ```
1682 pub fn set_create_time<T>(mut self, v: T) -> Self
1683 where
1684 T: std::convert::Into<wkt::Timestamp>,
1685 {
1686 self.create_time = std::option::Option::Some(v.into());
1687 self
1688 }
1689
1690 /// Sets or clears the value of [create_time][crate::model::Batch::create_time].
1691 ///
1692 /// # Example
1693 /// ```ignore,no_run
1694 /// # use google_cloud_dataproc_v1::model::Batch;
1695 /// use wkt::Timestamp;
1696 /// let x = Batch::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1697 /// let x = Batch::new().set_or_clear_create_time(None::<Timestamp>);
1698 /// ```
1699 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1700 where
1701 T: std::convert::Into<wkt::Timestamp>,
1702 {
1703 self.create_time = v.map(|x| x.into());
1704 self
1705 }
1706
1707 /// Sets the value of [runtime_info][crate::model::Batch::runtime_info].
1708 ///
1709 /// # Example
1710 /// ```ignore,no_run
1711 /// # use google_cloud_dataproc_v1::model::Batch;
1712 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1713 /// let x = Batch::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
1714 /// ```
1715 pub fn set_runtime_info<T>(mut self, v: T) -> Self
1716 where
1717 T: std::convert::Into<crate::model::RuntimeInfo>,
1718 {
1719 self.runtime_info = std::option::Option::Some(v.into());
1720 self
1721 }
1722
1723 /// Sets or clears the value of [runtime_info][crate::model::Batch::runtime_info].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_dataproc_v1::model::Batch;
1728 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1729 /// let x = Batch::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
1730 /// let x = Batch::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
1731 /// ```
1732 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
1733 where
1734 T: std::convert::Into<crate::model::RuntimeInfo>,
1735 {
1736 self.runtime_info = v.map(|x| x.into());
1737 self
1738 }
1739
1740 /// Sets the value of [state][crate::model::Batch::state].
1741 ///
1742 /// # Example
1743 /// ```ignore,no_run
1744 /// # use google_cloud_dataproc_v1::model::Batch;
1745 /// use google_cloud_dataproc_v1::model::batch::State;
1746 /// let x0 = Batch::new().set_state(State::Pending);
1747 /// let x1 = Batch::new().set_state(State::Running);
1748 /// let x2 = Batch::new().set_state(State::Cancelling);
1749 /// ```
1750 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(mut self, v: T) -> Self {
1751 self.state = v.into();
1752 self
1753 }
1754
1755 /// Sets the value of [state_message][crate::model::Batch::state_message].
1756 ///
1757 /// # Example
1758 /// ```ignore,no_run
1759 /// # use google_cloud_dataproc_v1::model::Batch;
1760 /// let x = Batch::new().set_state_message("example");
1761 /// ```
1762 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1763 self.state_message = v.into();
1764 self
1765 }
1766
1767 /// Sets the value of [state_time][crate::model::Batch::state_time].
1768 ///
1769 /// # Example
1770 /// ```ignore,no_run
1771 /// # use google_cloud_dataproc_v1::model::Batch;
1772 /// use wkt::Timestamp;
1773 /// let x = Batch::new().set_state_time(Timestamp::default()/* use setters */);
1774 /// ```
1775 pub fn set_state_time<T>(mut self, v: T) -> Self
1776 where
1777 T: std::convert::Into<wkt::Timestamp>,
1778 {
1779 self.state_time = std::option::Option::Some(v.into());
1780 self
1781 }
1782
1783 /// Sets or clears the value of [state_time][crate::model::Batch::state_time].
1784 ///
1785 /// # Example
1786 /// ```ignore,no_run
1787 /// # use google_cloud_dataproc_v1::model::Batch;
1788 /// use wkt::Timestamp;
1789 /// let x = Batch::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
1790 /// let x = Batch::new().set_or_clear_state_time(None::<Timestamp>);
1791 /// ```
1792 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
1793 where
1794 T: std::convert::Into<wkt::Timestamp>,
1795 {
1796 self.state_time = v.map(|x| x.into());
1797 self
1798 }
1799
1800 /// Sets the value of [creator][crate::model::Batch::creator].
1801 ///
1802 /// # Example
1803 /// ```ignore,no_run
1804 /// # use google_cloud_dataproc_v1::model::Batch;
1805 /// let x = Batch::new().set_creator("example");
1806 /// ```
1807 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1808 self.creator = v.into();
1809 self
1810 }
1811
1812 /// Sets the value of [labels][crate::model::Batch::labels].
1813 ///
1814 /// # Example
1815 /// ```ignore,no_run
1816 /// # use google_cloud_dataproc_v1::model::Batch;
1817 /// let x = Batch::new().set_labels([
1818 /// ("key0", "abc"),
1819 /// ("key1", "xyz"),
1820 /// ]);
1821 /// ```
1822 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1823 where
1824 T: std::iter::IntoIterator<Item = (K, V)>,
1825 K: std::convert::Into<std::string::String>,
1826 V: std::convert::Into<std::string::String>,
1827 {
1828 use std::iter::Iterator;
1829 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1830 self
1831 }
1832
1833 /// Sets the value of [runtime_config][crate::model::Batch::runtime_config].
1834 ///
1835 /// # Example
1836 /// ```ignore,no_run
1837 /// # use google_cloud_dataproc_v1::model::Batch;
1838 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1839 /// let x = Batch::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
1840 /// ```
1841 pub fn set_runtime_config<T>(mut self, v: T) -> Self
1842 where
1843 T: std::convert::Into<crate::model::RuntimeConfig>,
1844 {
1845 self.runtime_config = std::option::Option::Some(v.into());
1846 self
1847 }
1848
1849 /// Sets or clears the value of [runtime_config][crate::model::Batch::runtime_config].
1850 ///
1851 /// # Example
1852 /// ```ignore,no_run
1853 /// # use google_cloud_dataproc_v1::model::Batch;
1854 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1855 /// let x = Batch::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
1856 /// let x = Batch::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
1857 /// ```
1858 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
1859 where
1860 T: std::convert::Into<crate::model::RuntimeConfig>,
1861 {
1862 self.runtime_config = v.map(|x| x.into());
1863 self
1864 }
1865
1866 /// Sets the value of [environment_config][crate::model::Batch::environment_config].
1867 ///
1868 /// # Example
1869 /// ```ignore,no_run
1870 /// # use google_cloud_dataproc_v1::model::Batch;
1871 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1872 /// let x = Batch::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
1873 /// ```
1874 pub fn set_environment_config<T>(mut self, v: T) -> Self
1875 where
1876 T: std::convert::Into<crate::model::EnvironmentConfig>,
1877 {
1878 self.environment_config = std::option::Option::Some(v.into());
1879 self
1880 }
1881
1882 /// Sets or clears the value of [environment_config][crate::model::Batch::environment_config].
1883 ///
1884 /// # Example
1885 /// ```ignore,no_run
1886 /// # use google_cloud_dataproc_v1::model::Batch;
1887 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1888 /// let x = Batch::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
1889 /// let x = Batch::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
1890 /// ```
1891 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
1892 where
1893 T: std::convert::Into<crate::model::EnvironmentConfig>,
1894 {
1895 self.environment_config = v.map(|x| x.into());
1896 self
1897 }
1898
1899 /// Sets the value of [operation][crate::model::Batch::operation].
1900 ///
1901 /// # Example
1902 /// ```ignore,no_run
1903 /// # use google_cloud_dataproc_v1::model::Batch;
1904 /// let x = Batch::new().set_operation("example");
1905 /// ```
1906 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1907 self.operation = v.into();
1908 self
1909 }
1910
1911 /// Sets the value of [state_history][crate::model::Batch::state_history].
1912 ///
1913 /// # Example
1914 /// ```ignore,no_run
1915 /// # use google_cloud_dataproc_v1::model::Batch;
1916 /// use google_cloud_dataproc_v1::model::batch::StateHistory;
1917 /// let x = Batch::new()
1918 /// .set_state_history([
1919 /// StateHistory::default()/* use setters */,
1920 /// StateHistory::default()/* use (different) setters */,
1921 /// ]);
1922 /// ```
1923 pub fn set_state_history<T, V>(mut self, v: T) -> Self
1924 where
1925 T: std::iter::IntoIterator<Item = V>,
1926 V: std::convert::Into<crate::model::batch::StateHistory>,
1927 {
1928 use std::iter::Iterator;
1929 self.state_history = v.into_iter().map(|i| i.into()).collect();
1930 self
1931 }
1932
1933 /// Sets the value of [batch_config][crate::model::Batch::batch_config].
1934 ///
1935 /// Note that all the setters affecting `batch_config` are mutually
1936 /// exclusive.
1937 ///
1938 /// # Example
1939 /// ```ignore,no_run
1940 /// # use google_cloud_dataproc_v1::model::Batch;
1941 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1942 /// let x = Batch::new().set_batch_config(Some(
1943 /// google_cloud_dataproc_v1::model::batch::BatchConfig::PysparkBatch(PySparkBatch::default().into())));
1944 /// ```
1945 pub fn set_batch_config<
1946 T: std::convert::Into<std::option::Option<crate::model::batch::BatchConfig>>,
1947 >(
1948 mut self,
1949 v: T,
1950 ) -> Self {
1951 self.batch_config = v.into();
1952 self
1953 }
1954
1955 /// The value of [batch_config][crate::model::Batch::batch_config]
1956 /// if it holds a `PysparkBatch`, `None` if the field is not set or
1957 /// holds a different branch.
1958 pub fn pyspark_batch(
1959 &self,
1960 ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkBatch>> {
1961 #[allow(unreachable_patterns)]
1962 self.batch_config.as_ref().and_then(|v| match v {
1963 crate::model::batch::BatchConfig::PysparkBatch(v) => std::option::Option::Some(v),
1964 _ => std::option::Option::None,
1965 })
1966 }
1967
1968 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1969 /// to hold a `PysparkBatch`.
1970 ///
1971 /// Note that all the setters affecting `batch_config` are
1972 /// mutually exclusive.
1973 ///
1974 /// # Example
1975 /// ```ignore,no_run
1976 /// # use google_cloud_dataproc_v1::model::Batch;
1977 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1978 /// let x = Batch::new().set_pyspark_batch(PySparkBatch::default()/* use setters */);
1979 /// assert!(x.pyspark_batch().is_some());
1980 /// assert!(x.spark_batch().is_none());
1981 /// assert!(x.spark_r_batch().is_none());
1982 /// assert!(x.spark_sql_batch().is_none());
1983 /// ```
1984 pub fn set_pyspark_batch<T: std::convert::Into<std::boxed::Box<crate::model::PySparkBatch>>>(
1985 mut self,
1986 v: T,
1987 ) -> Self {
1988 self.batch_config =
1989 std::option::Option::Some(crate::model::batch::BatchConfig::PysparkBatch(v.into()));
1990 self
1991 }
1992
1993 /// The value of [batch_config][crate::model::Batch::batch_config]
1994 /// if it holds a `SparkBatch`, `None` if the field is not set or
1995 /// holds a different branch.
1996 pub fn spark_batch(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkBatch>> {
1997 #[allow(unreachable_patterns)]
1998 self.batch_config.as_ref().and_then(|v| match v {
1999 crate::model::batch::BatchConfig::SparkBatch(v) => std::option::Option::Some(v),
2000 _ => std::option::Option::None,
2001 })
2002 }
2003
2004 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2005 /// to hold a `SparkBatch`.
2006 ///
2007 /// Note that all the setters affecting `batch_config` are
2008 /// mutually exclusive.
2009 ///
2010 /// # Example
2011 /// ```ignore,no_run
2012 /// # use google_cloud_dataproc_v1::model::Batch;
2013 /// use google_cloud_dataproc_v1::model::SparkBatch;
2014 /// let x = Batch::new().set_spark_batch(SparkBatch::default()/* use setters */);
2015 /// assert!(x.spark_batch().is_some());
2016 /// assert!(x.pyspark_batch().is_none());
2017 /// assert!(x.spark_r_batch().is_none());
2018 /// assert!(x.spark_sql_batch().is_none());
2019 /// ```
2020 pub fn set_spark_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkBatch>>>(
2021 mut self,
2022 v: T,
2023 ) -> Self {
2024 self.batch_config =
2025 std::option::Option::Some(crate::model::batch::BatchConfig::SparkBatch(v.into()));
2026 self
2027 }
2028
2029 /// The value of [batch_config][crate::model::Batch::batch_config]
2030 /// if it holds a `SparkRBatch`, `None` if the field is not set or
2031 /// holds a different branch.
2032 pub fn spark_r_batch(
2033 &self,
2034 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkRBatch>> {
2035 #[allow(unreachable_patterns)]
2036 self.batch_config.as_ref().and_then(|v| match v {
2037 crate::model::batch::BatchConfig::SparkRBatch(v) => std::option::Option::Some(v),
2038 _ => std::option::Option::None,
2039 })
2040 }
2041
2042 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2043 /// to hold a `SparkRBatch`.
2044 ///
2045 /// Note that all the setters affecting `batch_config` are
2046 /// mutually exclusive.
2047 ///
2048 /// # Example
2049 /// ```ignore,no_run
2050 /// # use google_cloud_dataproc_v1::model::Batch;
2051 /// use google_cloud_dataproc_v1::model::SparkRBatch;
2052 /// let x = Batch::new().set_spark_r_batch(SparkRBatch::default()/* use setters */);
2053 /// assert!(x.spark_r_batch().is_some());
2054 /// assert!(x.pyspark_batch().is_none());
2055 /// assert!(x.spark_batch().is_none());
2056 /// assert!(x.spark_sql_batch().is_none());
2057 /// ```
2058 pub fn set_spark_r_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkRBatch>>>(
2059 mut self,
2060 v: T,
2061 ) -> Self {
2062 self.batch_config =
2063 std::option::Option::Some(crate::model::batch::BatchConfig::SparkRBatch(v.into()));
2064 self
2065 }
2066
2067 /// The value of [batch_config][crate::model::Batch::batch_config]
2068 /// if it holds a `SparkSqlBatch`, `None` if the field is not set or
2069 /// holds a different branch.
2070 pub fn spark_sql_batch(
2071 &self,
2072 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlBatch>> {
2073 #[allow(unreachable_patterns)]
2074 self.batch_config.as_ref().and_then(|v| match v {
2075 crate::model::batch::BatchConfig::SparkSqlBatch(v) => std::option::Option::Some(v),
2076 _ => std::option::Option::None,
2077 })
2078 }
2079
2080 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2081 /// to hold a `SparkSqlBatch`.
2082 ///
2083 /// Note that all the setters affecting `batch_config` are
2084 /// mutually exclusive.
2085 ///
2086 /// # Example
2087 /// ```ignore,no_run
2088 /// # use google_cloud_dataproc_v1::model::Batch;
2089 /// use google_cloud_dataproc_v1::model::SparkSqlBatch;
2090 /// let x = Batch::new().set_spark_sql_batch(SparkSqlBatch::default()/* use setters */);
2091 /// assert!(x.spark_sql_batch().is_some());
2092 /// assert!(x.pyspark_batch().is_none());
2093 /// assert!(x.spark_batch().is_none());
2094 /// assert!(x.spark_r_batch().is_none());
2095 /// ```
2096 pub fn set_spark_sql_batch<
2097 T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlBatch>>,
2098 >(
2099 mut self,
2100 v: T,
2101 ) -> Self {
2102 self.batch_config =
2103 std::option::Option::Some(crate::model::batch::BatchConfig::SparkSqlBatch(v.into()));
2104 self
2105 }
2106}
2107
2108impl wkt::message::Message for Batch {
2109 fn typename() -> &'static str {
2110 "type.googleapis.com/google.cloud.dataproc.v1.Batch"
2111 }
2112}
2113
2114/// Defines additional types related to [Batch].
2115pub mod batch {
2116 #[allow(unused_imports)]
2117 use super::*;
2118
2119 /// Historical state information.
2120 #[derive(Clone, Default, PartialEq)]
2121 #[non_exhaustive]
2122 pub struct StateHistory {
2123 /// Output only. The state of the batch at this point in history.
2124 pub state: crate::model::batch::State,
2125
2126 /// Output only. Details about the state at this point in history.
2127 pub state_message: std::string::String,
2128
2129 /// Output only. The time when the batch entered the historical state.
2130 pub state_start_time: std::option::Option<wkt::Timestamp>,
2131
2132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2133 }
2134
2135 impl StateHistory {
2136 pub fn new() -> Self {
2137 std::default::Default::default()
2138 }
2139
2140 /// Sets the value of [state][crate::model::batch::StateHistory::state].
2141 ///
2142 /// # Example
2143 /// ```ignore,no_run
2144 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2145 /// use google_cloud_dataproc_v1::model::batch::State;
2146 /// let x0 = StateHistory::new().set_state(State::Pending);
2147 /// let x1 = StateHistory::new().set_state(State::Running);
2148 /// let x2 = StateHistory::new().set_state(State::Cancelling);
2149 /// ```
2150 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(
2151 mut self,
2152 v: T,
2153 ) -> Self {
2154 self.state = v.into();
2155 self
2156 }
2157
2158 /// Sets the value of [state_message][crate::model::batch::StateHistory::state_message].
2159 ///
2160 /// # Example
2161 /// ```ignore,no_run
2162 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2163 /// let x = StateHistory::new().set_state_message("example");
2164 /// ```
2165 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
2166 mut self,
2167 v: T,
2168 ) -> Self {
2169 self.state_message = v.into();
2170 self
2171 }
2172
2173 /// Sets the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2174 ///
2175 /// # Example
2176 /// ```ignore,no_run
2177 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2178 /// use wkt::Timestamp;
2179 /// let x = StateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
2180 /// ```
2181 pub fn set_state_start_time<T>(mut self, v: T) -> Self
2182 where
2183 T: std::convert::Into<wkt::Timestamp>,
2184 {
2185 self.state_start_time = std::option::Option::Some(v.into());
2186 self
2187 }
2188
2189 /// Sets or clears the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2190 ///
2191 /// # Example
2192 /// ```ignore,no_run
2193 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2194 /// use wkt::Timestamp;
2195 /// let x = StateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
2196 /// let x = StateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
2197 /// ```
2198 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2199 where
2200 T: std::convert::Into<wkt::Timestamp>,
2201 {
2202 self.state_start_time = v.map(|x| x.into());
2203 self
2204 }
2205 }
2206
2207 impl wkt::message::Message for StateHistory {
2208 fn typename() -> &'static str {
2209 "type.googleapis.com/google.cloud.dataproc.v1.Batch.StateHistory"
2210 }
2211 }
2212
2213 /// The batch state.
2214 ///
2215 /// # Working with unknown values
2216 ///
2217 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2218 /// additional enum variants at any time. Adding new variants is not considered
2219 /// a breaking change. Applications should write their code in anticipation of:
2220 ///
2221 /// - New values appearing in future releases of the client library, **and**
2222 /// - New values received dynamically, without application changes.
2223 ///
2224 /// Please consult the [Working with enums] section in the user guide for some
2225 /// guidelines.
2226 ///
2227 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2228 #[derive(Clone, Debug, PartialEq)]
2229 #[non_exhaustive]
2230 pub enum State {
2231 /// The batch state is unknown.
2232 Unspecified,
2233 /// The batch is created before running.
2234 Pending,
2235 /// The batch is running.
2236 Running,
2237 /// The batch is cancelling.
2238 Cancelling,
2239 /// The batch cancellation was successful.
2240 Cancelled,
2241 /// The batch completed successfully.
2242 Succeeded,
2243 /// The batch is no longer running due to an error.
2244 Failed,
2245 /// If set, the enum was initialized with an unknown value.
2246 ///
2247 /// Applications can examine the value using [State::value] or
2248 /// [State::name].
2249 UnknownValue(state::UnknownValue),
2250 }
2251
2252 #[doc(hidden)]
2253 pub mod state {
2254 #[allow(unused_imports)]
2255 use super::*;
2256 #[derive(Clone, Debug, PartialEq)]
2257 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2258 }
2259
2260 impl State {
2261 /// Gets the enum value.
2262 ///
2263 /// Returns `None` if the enum contains an unknown value deserialized from
2264 /// the string representation of enums.
2265 pub fn value(&self) -> std::option::Option<i32> {
2266 match self {
2267 Self::Unspecified => std::option::Option::Some(0),
2268 Self::Pending => std::option::Option::Some(1),
2269 Self::Running => std::option::Option::Some(2),
2270 Self::Cancelling => std::option::Option::Some(3),
2271 Self::Cancelled => std::option::Option::Some(4),
2272 Self::Succeeded => std::option::Option::Some(5),
2273 Self::Failed => std::option::Option::Some(6),
2274 Self::UnknownValue(u) => u.0.value(),
2275 }
2276 }
2277
2278 /// Gets the enum value as a string.
2279 ///
2280 /// Returns `None` if the enum contains an unknown value deserialized from
2281 /// the integer representation of enums.
2282 pub fn name(&self) -> std::option::Option<&str> {
2283 match self {
2284 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2285 Self::Pending => std::option::Option::Some("PENDING"),
2286 Self::Running => std::option::Option::Some("RUNNING"),
2287 Self::Cancelling => std::option::Option::Some("CANCELLING"),
2288 Self::Cancelled => std::option::Option::Some("CANCELLED"),
2289 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2290 Self::Failed => std::option::Option::Some("FAILED"),
2291 Self::UnknownValue(u) => u.0.name(),
2292 }
2293 }
2294 }
2295
2296 impl std::default::Default for State {
2297 fn default() -> Self {
2298 use std::convert::From;
2299 Self::from(0)
2300 }
2301 }
2302
2303 impl std::fmt::Display for State {
2304 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2305 wkt::internal::display_enum(f, self.name(), self.value())
2306 }
2307 }
2308
2309 impl std::convert::From<i32> for State {
2310 fn from(value: i32) -> Self {
2311 match value {
2312 0 => Self::Unspecified,
2313 1 => Self::Pending,
2314 2 => Self::Running,
2315 3 => Self::Cancelling,
2316 4 => Self::Cancelled,
2317 5 => Self::Succeeded,
2318 6 => Self::Failed,
2319 _ => Self::UnknownValue(state::UnknownValue(
2320 wkt::internal::UnknownEnumValue::Integer(value),
2321 )),
2322 }
2323 }
2324 }
2325
2326 impl std::convert::From<&str> for State {
2327 fn from(value: &str) -> Self {
2328 use std::string::ToString;
2329 match value {
2330 "STATE_UNSPECIFIED" => Self::Unspecified,
2331 "PENDING" => Self::Pending,
2332 "RUNNING" => Self::Running,
2333 "CANCELLING" => Self::Cancelling,
2334 "CANCELLED" => Self::Cancelled,
2335 "SUCCEEDED" => Self::Succeeded,
2336 "FAILED" => Self::Failed,
2337 _ => Self::UnknownValue(state::UnknownValue(
2338 wkt::internal::UnknownEnumValue::String(value.to_string()),
2339 )),
2340 }
2341 }
2342 }
2343
2344 impl serde::ser::Serialize for State {
2345 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2346 where
2347 S: serde::Serializer,
2348 {
2349 match self {
2350 Self::Unspecified => serializer.serialize_i32(0),
2351 Self::Pending => serializer.serialize_i32(1),
2352 Self::Running => serializer.serialize_i32(2),
2353 Self::Cancelling => serializer.serialize_i32(3),
2354 Self::Cancelled => serializer.serialize_i32(4),
2355 Self::Succeeded => serializer.serialize_i32(5),
2356 Self::Failed => serializer.serialize_i32(6),
2357 Self::UnknownValue(u) => u.0.serialize(serializer),
2358 }
2359 }
2360 }
2361
2362 impl<'de> serde::de::Deserialize<'de> for State {
2363 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2364 where
2365 D: serde::Deserializer<'de>,
2366 {
2367 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2368 ".google.cloud.dataproc.v1.Batch.State",
2369 ))
2370 }
2371 }
2372
2373 /// The application/framework-specific portion of the batch configuration.
2374 #[derive(Clone, Debug, PartialEq)]
2375 #[non_exhaustive]
2376 pub enum BatchConfig {
2377 /// Optional. PySpark batch config.
2378 PysparkBatch(std::boxed::Box<crate::model::PySparkBatch>),
2379 /// Optional. Spark batch config.
2380 SparkBatch(std::boxed::Box<crate::model::SparkBatch>),
2381 /// Optional. SparkR batch config.
2382 SparkRBatch(std::boxed::Box<crate::model::SparkRBatch>),
2383 /// Optional. SparkSql batch config.
2384 SparkSqlBatch(std::boxed::Box<crate::model::SparkSqlBatch>),
2385 }
2386}
2387
2388/// A configuration for running an
2389/// [Apache
2390/// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html)
2391/// batch workload.
2392#[derive(Clone, Default, PartialEq)]
2393#[non_exhaustive]
2394pub struct PySparkBatch {
2395 /// Required. The HCFS URI of the main Python file to use as the Spark driver.
2396 /// Must be a .py file.
2397 pub main_python_file_uri: std::string::String,
2398
2399 /// Optional. The arguments to pass to the driver. Do not include arguments
2400 /// that can be set as batch properties, such as `--conf`, since a collision
2401 /// can occur that causes an incorrect batch submission.
2402 pub args: std::vec::Vec<std::string::String>,
2403
2404 /// Optional. HCFS file URIs of Python files to pass to the PySpark
2405 /// framework. Supported file types: `.py`, `.egg`, and `.zip`.
2406 pub python_file_uris: std::vec::Vec<std::string::String>,
2407
2408 /// Optional. HCFS URIs of jar files to add to the classpath of the
2409 /// Spark driver and tasks.
2410 pub jar_file_uris: std::vec::Vec<std::string::String>,
2411
2412 /// Optional. HCFS URIs of files to be placed in the working directory of
2413 /// each executor.
2414 pub file_uris: std::vec::Vec<std::string::String>,
2415
2416 /// Optional. HCFS URIs of archives to be extracted into the working directory
2417 /// of each executor. Supported file types:
2418 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2419 pub archive_uris: std::vec::Vec<std::string::String>,
2420
2421 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2422}
2423
2424impl PySparkBatch {
2425 pub fn new() -> Self {
2426 std::default::Default::default()
2427 }
2428
2429 /// Sets the value of [main_python_file_uri][crate::model::PySparkBatch::main_python_file_uri].
2430 ///
2431 /// # Example
2432 /// ```ignore,no_run
2433 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2434 /// let x = PySparkBatch::new().set_main_python_file_uri("example");
2435 /// ```
2436 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
2437 mut self,
2438 v: T,
2439 ) -> Self {
2440 self.main_python_file_uri = v.into();
2441 self
2442 }
2443
2444 /// Sets the value of [args][crate::model::PySparkBatch::args].
2445 ///
2446 /// # Example
2447 /// ```ignore,no_run
2448 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2449 /// let x = PySparkBatch::new().set_args(["a", "b", "c"]);
2450 /// ```
2451 pub fn set_args<T, V>(mut self, v: T) -> Self
2452 where
2453 T: std::iter::IntoIterator<Item = V>,
2454 V: std::convert::Into<std::string::String>,
2455 {
2456 use std::iter::Iterator;
2457 self.args = v.into_iter().map(|i| i.into()).collect();
2458 self
2459 }
2460
2461 /// Sets the value of [python_file_uris][crate::model::PySparkBatch::python_file_uris].
2462 ///
2463 /// # Example
2464 /// ```ignore,no_run
2465 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2466 /// let x = PySparkBatch::new().set_python_file_uris(["a", "b", "c"]);
2467 /// ```
2468 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
2469 where
2470 T: std::iter::IntoIterator<Item = V>,
2471 V: std::convert::Into<std::string::String>,
2472 {
2473 use std::iter::Iterator;
2474 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
2475 self
2476 }
2477
2478 /// Sets the value of [jar_file_uris][crate::model::PySparkBatch::jar_file_uris].
2479 ///
2480 /// # Example
2481 /// ```ignore,no_run
2482 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2483 /// let x = PySparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2484 /// ```
2485 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2486 where
2487 T: std::iter::IntoIterator<Item = V>,
2488 V: std::convert::Into<std::string::String>,
2489 {
2490 use std::iter::Iterator;
2491 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2492 self
2493 }
2494
2495 /// Sets the value of [file_uris][crate::model::PySparkBatch::file_uris].
2496 ///
2497 /// # Example
2498 /// ```ignore,no_run
2499 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2500 /// let x = PySparkBatch::new().set_file_uris(["a", "b", "c"]);
2501 /// ```
2502 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2503 where
2504 T: std::iter::IntoIterator<Item = V>,
2505 V: std::convert::Into<std::string::String>,
2506 {
2507 use std::iter::Iterator;
2508 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2509 self
2510 }
2511
2512 /// Sets the value of [archive_uris][crate::model::PySparkBatch::archive_uris].
2513 ///
2514 /// # Example
2515 /// ```ignore,no_run
2516 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2517 /// let x = PySparkBatch::new().set_archive_uris(["a", "b", "c"]);
2518 /// ```
2519 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2520 where
2521 T: std::iter::IntoIterator<Item = V>,
2522 V: std::convert::Into<std::string::String>,
2523 {
2524 use std::iter::Iterator;
2525 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2526 self
2527 }
2528}
2529
2530impl wkt::message::Message for PySparkBatch {
2531 fn typename() -> &'static str {
2532 "type.googleapis.com/google.cloud.dataproc.v1.PySparkBatch"
2533 }
2534}
2535
2536/// A configuration for running an [Apache Spark](https://spark.apache.org/)
2537/// batch workload.
2538#[derive(Clone, Default, PartialEq)]
2539#[non_exhaustive]
2540pub struct SparkBatch {
2541 /// Optional. The arguments to pass to the driver. Do not include arguments
2542 /// that can be set as batch properties, such as `--conf`, since a collision
2543 /// can occur that causes an incorrect batch submission.
2544 pub args: std::vec::Vec<std::string::String>,
2545
2546 /// Optional. HCFS URIs of jar files to add to the classpath of the
2547 /// Spark driver and tasks.
2548 pub jar_file_uris: std::vec::Vec<std::string::String>,
2549
2550 /// Optional. HCFS URIs of files to be placed in the working directory of
2551 /// each executor.
2552 pub file_uris: std::vec::Vec<std::string::String>,
2553
2554 /// Optional. HCFS URIs of archives to be extracted into the working directory
2555 /// of each executor. Supported file types:
2556 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2557 pub archive_uris: std::vec::Vec<std::string::String>,
2558
2559 /// The specification of the main method to call to drive the Spark
2560 /// workload. Specify either the jar file that contains the main class or the
2561 /// main class name. To pass both a main jar and a main class in that jar, add
2562 /// the jar to `jar_file_uris`, and then specify the main class
2563 /// name in `main_class`.
2564 pub driver: std::option::Option<crate::model::spark_batch::Driver>,
2565
2566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2567}
2568
2569impl SparkBatch {
2570 pub fn new() -> Self {
2571 std::default::Default::default()
2572 }
2573
2574 /// Sets the value of [args][crate::model::SparkBatch::args].
2575 ///
2576 /// # Example
2577 /// ```ignore,no_run
2578 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2579 /// let x = SparkBatch::new().set_args(["a", "b", "c"]);
2580 /// ```
2581 pub fn set_args<T, V>(mut self, v: T) -> Self
2582 where
2583 T: std::iter::IntoIterator<Item = V>,
2584 V: std::convert::Into<std::string::String>,
2585 {
2586 use std::iter::Iterator;
2587 self.args = v.into_iter().map(|i| i.into()).collect();
2588 self
2589 }
2590
2591 /// Sets the value of [jar_file_uris][crate::model::SparkBatch::jar_file_uris].
2592 ///
2593 /// # Example
2594 /// ```ignore,no_run
2595 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2596 /// let x = SparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2597 /// ```
2598 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2599 where
2600 T: std::iter::IntoIterator<Item = V>,
2601 V: std::convert::Into<std::string::String>,
2602 {
2603 use std::iter::Iterator;
2604 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2605 self
2606 }
2607
2608 /// Sets the value of [file_uris][crate::model::SparkBatch::file_uris].
2609 ///
2610 /// # Example
2611 /// ```ignore,no_run
2612 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2613 /// let x = SparkBatch::new().set_file_uris(["a", "b", "c"]);
2614 /// ```
2615 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2616 where
2617 T: std::iter::IntoIterator<Item = V>,
2618 V: std::convert::Into<std::string::String>,
2619 {
2620 use std::iter::Iterator;
2621 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2622 self
2623 }
2624
2625 /// Sets the value of [archive_uris][crate::model::SparkBatch::archive_uris].
2626 ///
2627 /// # Example
2628 /// ```ignore,no_run
2629 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2630 /// let x = SparkBatch::new().set_archive_uris(["a", "b", "c"]);
2631 /// ```
2632 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2633 where
2634 T: std::iter::IntoIterator<Item = V>,
2635 V: std::convert::Into<std::string::String>,
2636 {
2637 use std::iter::Iterator;
2638 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2639 self
2640 }
2641
2642 /// Sets the value of [driver][crate::model::SparkBatch::driver].
2643 ///
2644 /// Note that all the setters affecting `driver` are mutually
2645 /// exclusive.
2646 ///
2647 /// # Example
2648 /// ```ignore,no_run
2649 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2650 /// use google_cloud_dataproc_v1::model::spark_batch::Driver;
2651 /// let x = SparkBatch::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
2652 /// ```
2653 pub fn set_driver<
2654 T: std::convert::Into<std::option::Option<crate::model::spark_batch::Driver>>,
2655 >(
2656 mut self,
2657 v: T,
2658 ) -> Self {
2659 self.driver = v.into();
2660 self
2661 }
2662
2663 /// The value of [driver][crate::model::SparkBatch::driver]
2664 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
2665 /// holds a different branch.
2666 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
2667 #[allow(unreachable_patterns)]
2668 self.driver.as_ref().and_then(|v| match v {
2669 crate::model::spark_batch::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
2670 _ => std::option::Option::None,
2671 })
2672 }
2673
2674 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2675 /// to hold a `MainJarFileUri`.
2676 ///
2677 /// Note that all the setters affecting `driver` are
2678 /// mutually exclusive.
2679 ///
2680 /// # Example
2681 /// ```ignore,no_run
2682 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2683 /// let x = SparkBatch::new().set_main_jar_file_uri("example");
2684 /// assert!(x.main_jar_file_uri().is_some());
2685 /// assert!(x.main_class().is_none());
2686 /// ```
2687 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
2688 mut self,
2689 v: T,
2690 ) -> Self {
2691 self.driver =
2692 std::option::Option::Some(crate::model::spark_batch::Driver::MainJarFileUri(v.into()));
2693 self
2694 }
2695
2696 /// The value of [driver][crate::model::SparkBatch::driver]
2697 /// if it holds a `MainClass`, `None` if the field is not set or
2698 /// holds a different branch.
2699 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
2700 #[allow(unreachable_patterns)]
2701 self.driver.as_ref().and_then(|v| match v {
2702 crate::model::spark_batch::Driver::MainClass(v) => std::option::Option::Some(v),
2703 _ => std::option::Option::None,
2704 })
2705 }
2706
2707 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2708 /// to hold a `MainClass`.
2709 ///
2710 /// Note that all the setters affecting `driver` are
2711 /// mutually exclusive.
2712 ///
2713 /// # Example
2714 /// ```ignore,no_run
2715 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2716 /// let x = SparkBatch::new().set_main_class("example");
2717 /// assert!(x.main_class().is_some());
2718 /// assert!(x.main_jar_file_uri().is_none());
2719 /// ```
2720 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2721 self.driver =
2722 std::option::Option::Some(crate::model::spark_batch::Driver::MainClass(v.into()));
2723 self
2724 }
2725}
2726
2727impl wkt::message::Message for SparkBatch {
2728 fn typename() -> &'static str {
2729 "type.googleapis.com/google.cloud.dataproc.v1.SparkBatch"
2730 }
2731}
2732
2733/// Defines additional types related to [SparkBatch].
2734pub mod spark_batch {
2735 #[allow(unused_imports)]
2736 use super::*;
2737
2738 /// The specification of the main method to call to drive the Spark
2739 /// workload. Specify either the jar file that contains the main class or the
2740 /// main class name. To pass both a main jar and a main class in that jar, add
2741 /// the jar to `jar_file_uris`, and then specify the main class
2742 /// name in `main_class`.
2743 #[derive(Clone, Debug, PartialEq)]
2744 #[non_exhaustive]
2745 pub enum Driver {
2746 /// Optional. The HCFS URI of the jar file that contains the main class.
2747 MainJarFileUri(std::string::String),
2748 /// Optional. The name of the driver main class. The jar file that contains
2749 /// the class must be in the classpath or specified in `jar_file_uris`.
2750 MainClass(std::string::String),
2751 }
2752}
2753
2754/// A configuration for running an
2755/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
2756/// batch workload.
2757#[derive(Clone, Default, PartialEq)]
2758#[non_exhaustive]
2759pub struct SparkRBatch {
2760 /// Required. The HCFS URI of the main R file to use as the driver.
2761 /// Must be a `.R` or `.r` file.
2762 pub main_r_file_uri: std::string::String,
2763
2764 /// Optional. The arguments to pass to the Spark driver. Do not include
2765 /// arguments that can be set as batch properties, such as `--conf`, since a
2766 /// collision can occur that causes an incorrect batch submission.
2767 pub args: std::vec::Vec<std::string::String>,
2768
2769 /// Optional. HCFS URIs of files to be placed in the working directory of
2770 /// each executor.
2771 pub file_uris: std::vec::Vec<std::string::String>,
2772
2773 /// Optional. HCFS URIs of archives to be extracted into the working directory
2774 /// of each executor. Supported file types:
2775 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2776 pub archive_uris: std::vec::Vec<std::string::String>,
2777
2778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2779}
2780
2781impl SparkRBatch {
2782 pub fn new() -> Self {
2783 std::default::Default::default()
2784 }
2785
2786 /// Sets the value of [main_r_file_uri][crate::model::SparkRBatch::main_r_file_uri].
2787 ///
2788 /// # Example
2789 /// ```ignore,no_run
2790 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2791 /// let x = SparkRBatch::new().set_main_r_file_uri("example");
2792 /// ```
2793 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2794 self.main_r_file_uri = v.into();
2795 self
2796 }
2797
2798 /// Sets the value of [args][crate::model::SparkRBatch::args].
2799 ///
2800 /// # Example
2801 /// ```ignore,no_run
2802 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2803 /// let x = SparkRBatch::new().set_args(["a", "b", "c"]);
2804 /// ```
2805 pub fn set_args<T, V>(mut self, v: T) -> Self
2806 where
2807 T: std::iter::IntoIterator<Item = V>,
2808 V: std::convert::Into<std::string::String>,
2809 {
2810 use std::iter::Iterator;
2811 self.args = v.into_iter().map(|i| i.into()).collect();
2812 self
2813 }
2814
2815 /// Sets the value of [file_uris][crate::model::SparkRBatch::file_uris].
2816 ///
2817 /// # Example
2818 /// ```ignore,no_run
2819 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2820 /// let x = SparkRBatch::new().set_file_uris(["a", "b", "c"]);
2821 /// ```
2822 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2823 where
2824 T: std::iter::IntoIterator<Item = V>,
2825 V: std::convert::Into<std::string::String>,
2826 {
2827 use std::iter::Iterator;
2828 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2829 self
2830 }
2831
2832 /// Sets the value of [archive_uris][crate::model::SparkRBatch::archive_uris].
2833 ///
2834 /// # Example
2835 /// ```ignore,no_run
2836 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2837 /// let x = SparkRBatch::new().set_archive_uris(["a", "b", "c"]);
2838 /// ```
2839 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2840 where
2841 T: std::iter::IntoIterator<Item = V>,
2842 V: std::convert::Into<std::string::String>,
2843 {
2844 use std::iter::Iterator;
2845 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2846 self
2847 }
2848}
2849
2850impl wkt::message::Message for SparkRBatch {
2851 fn typename() -> &'static str {
2852 "type.googleapis.com/google.cloud.dataproc.v1.SparkRBatch"
2853 }
2854}
2855
2856/// A configuration for running
2857/// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch
2858/// workload.
2859#[derive(Clone, Default, PartialEq)]
2860#[non_exhaustive]
2861pub struct SparkSqlBatch {
2862 /// Required. The HCFS URI of the script that contains Spark SQL queries to
2863 /// execute.
2864 pub query_file_uri: std::string::String,
2865
2866 /// Optional. Mapping of query variable names to values (equivalent to the
2867 /// Spark SQL command: `SET name="value";`).
2868 pub query_variables: std::collections::HashMap<std::string::String, std::string::String>,
2869
2870 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2871 pub jar_file_uris: std::vec::Vec<std::string::String>,
2872
2873 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2874}
2875
2876impl SparkSqlBatch {
2877 pub fn new() -> Self {
2878 std::default::Default::default()
2879 }
2880
2881 /// Sets the value of [query_file_uri][crate::model::SparkSqlBatch::query_file_uri].
2882 ///
2883 /// # Example
2884 /// ```ignore,no_run
2885 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2886 /// let x = SparkSqlBatch::new().set_query_file_uri("example");
2887 /// ```
2888 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2889 self.query_file_uri = v.into();
2890 self
2891 }
2892
2893 /// Sets the value of [query_variables][crate::model::SparkSqlBatch::query_variables].
2894 ///
2895 /// # Example
2896 /// ```ignore,no_run
2897 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2898 /// let x = SparkSqlBatch::new().set_query_variables([
2899 /// ("key0", "abc"),
2900 /// ("key1", "xyz"),
2901 /// ]);
2902 /// ```
2903 pub fn set_query_variables<T, K, V>(mut self, v: T) -> Self
2904 where
2905 T: std::iter::IntoIterator<Item = (K, V)>,
2906 K: std::convert::Into<std::string::String>,
2907 V: std::convert::Into<std::string::String>,
2908 {
2909 use std::iter::Iterator;
2910 self.query_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2911 self
2912 }
2913
2914 /// Sets the value of [jar_file_uris][crate::model::SparkSqlBatch::jar_file_uris].
2915 ///
2916 /// # Example
2917 /// ```ignore,no_run
2918 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2919 /// let x = SparkSqlBatch::new().set_jar_file_uris(["a", "b", "c"]);
2920 /// ```
2921 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2922 where
2923 T: std::iter::IntoIterator<Item = V>,
2924 V: std::convert::Into<std::string::String>,
2925 {
2926 use std::iter::Iterator;
2927 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2928 self
2929 }
2930}
2931
2932impl wkt::message::Message for SparkSqlBatch {
2933 fn typename() -> &'static str {
2934 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlBatch"
2935 }
2936}
2937
2938/// Describes the identifying information, config, and status of
2939/// a Dataproc cluster
2940#[derive(Clone, Default, PartialEq)]
2941#[non_exhaustive]
2942pub struct Cluster {
2943 /// Required. The Google Cloud Platform project ID that the cluster belongs to.
2944 pub project_id: std::string::String,
2945
2946 /// Required. The cluster name, which must be unique within a project.
2947 /// The name must start with a lowercase letter, and can contain
2948 /// up to 51 lowercase letters, numbers, and hyphens. It cannot end
2949 /// with a hyphen. The name of a deleted cluster can be reused.
2950 pub cluster_name: std::string::String,
2951
2952 /// Optional. The cluster config for a cluster of Compute Engine Instances.
2953 /// Note that Dataproc may set default values, and values may change
2954 /// when clusters are updated.
2955 ///
2956 /// Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
2957 pub config: std::option::Option<crate::model::ClusterConfig>,
2958
2959 /// Optional. The virtual cluster config is used when creating a Dataproc
2960 /// cluster that does not directly control the underlying compute resources,
2961 /// for example, when creating a [Dataproc-on-GKE
2962 /// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
2963 /// Dataproc may set default values, and values may change when
2964 /// clusters are updated. Exactly one of
2965 /// [config][google.cloud.dataproc.v1.Cluster.config] or
2966 /// [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config]
2967 /// must be specified.
2968 ///
2969 /// [google.cloud.dataproc.v1.Cluster.config]: crate::model::Cluster::config
2970 /// [google.cloud.dataproc.v1.Cluster.virtual_cluster_config]: crate::model::Cluster::virtual_cluster_config
2971 pub virtual_cluster_config: std::option::Option<crate::model::VirtualClusterConfig>,
2972
2973 /// Optional. The labels to associate with this cluster.
2974 /// Label **keys** must contain 1 to 63 characters, and must conform to
2975 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
2976 /// Label **values** may be empty, but, if present, must contain 1 to 63
2977 /// characters, and must conform to [RFC
2978 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
2979 /// associated with a cluster.
2980 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2981
2982 /// Output only. Cluster status.
2983 pub status: std::option::Option<crate::model::ClusterStatus>,
2984
2985 /// Output only. The previous cluster status.
2986 pub status_history: std::vec::Vec<crate::model::ClusterStatus>,
2987
2988 /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc
2989 /// generates this value when it creates the cluster.
2990 pub cluster_uuid: std::string::String,
2991
2992 /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.
2993 ///
2994 /// **Beta Feature**: This report is available for testing purposes only. It
2995 /// may be changed before final release.
2996 pub metrics: std::option::Option<crate::model::ClusterMetrics>,
2997
2998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2999}
3000
3001impl Cluster {
3002 pub fn new() -> Self {
3003 std::default::Default::default()
3004 }
3005
3006 /// Sets the value of [project_id][crate::model::Cluster::project_id].
3007 ///
3008 /// # Example
3009 /// ```ignore,no_run
3010 /// # use google_cloud_dataproc_v1::model::Cluster;
3011 /// let x = Cluster::new().set_project_id("example");
3012 /// ```
3013 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3014 self.project_id = v.into();
3015 self
3016 }
3017
3018 /// Sets the value of [cluster_name][crate::model::Cluster::cluster_name].
3019 ///
3020 /// # Example
3021 /// ```ignore,no_run
3022 /// # use google_cloud_dataproc_v1::model::Cluster;
3023 /// let x = Cluster::new().set_cluster_name("example");
3024 /// ```
3025 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3026 self.cluster_name = v.into();
3027 self
3028 }
3029
3030 /// Sets the value of [config][crate::model::Cluster::config].
3031 ///
3032 /// # Example
3033 /// ```ignore,no_run
3034 /// # use google_cloud_dataproc_v1::model::Cluster;
3035 /// use google_cloud_dataproc_v1::model::ClusterConfig;
3036 /// let x = Cluster::new().set_config(ClusterConfig::default()/* use setters */);
3037 /// ```
3038 pub fn set_config<T>(mut self, v: T) -> Self
3039 where
3040 T: std::convert::Into<crate::model::ClusterConfig>,
3041 {
3042 self.config = std::option::Option::Some(v.into());
3043 self
3044 }
3045
3046 /// Sets or clears the value of [config][crate::model::Cluster::config].
3047 ///
3048 /// # Example
3049 /// ```ignore,no_run
3050 /// # use google_cloud_dataproc_v1::model::Cluster;
3051 /// use google_cloud_dataproc_v1::model::ClusterConfig;
3052 /// let x = Cluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
3053 /// let x = Cluster::new().set_or_clear_config(None::<ClusterConfig>);
3054 /// ```
3055 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
3056 where
3057 T: std::convert::Into<crate::model::ClusterConfig>,
3058 {
3059 self.config = v.map(|x| x.into());
3060 self
3061 }
3062
3063 /// Sets the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3064 ///
3065 /// # Example
3066 /// ```ignore,no_run
3067 /// # use google_cloud_dataproc_v1::model::Cluster;
3068 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3069 /// let x = Cluster::new().set_virtual_cluster_config(VirtualClusterConfig::default()/* use setters */);
3070 /// ```
3071 pub fn set_virtual_cluster_config<T>(mut self, v: T) -> Self
3072 where
3073 T: std::convert::Into<crate::model::VirtualClusterConfig>,
3074 {
3075 self.virtual_cluster_config = std::option::Option::Some(v.into());
3076 self
3077 }
3078
3079 /// Sets or clears the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3080 ///
3081 /// # Example
3082 /// ```ignore,no_run
3083 /// # use google_cloud_dataproc_v1::model::Cluster;
3084 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3085 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(Some(VirtualClusterConfig::default()/* use setters */));
3086 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(None::<VirtualClusterConfig>);
3087 /// ```
3088 pub fn set_or_clear_virtual_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3089 where
3090 T: std::convert::Into<crate::model::VirtualClusterConfig>,
3091 {
3092 self.virtual_cluster_config = v.map(|x| x.into());
3093 self
3094 }
3095
3096 /// Sets the value of [labels][crate::model::Cluster::labels].
3097 ///
3098 /// # Example
3099 /// ```ignore,no_run
3100 /// # use google_cloud_dataproc_v1::model::Cluster;
3101 /// let x = Cluster::new().set_labels([
3102 /// ("key0", "abc"),
3103 /// ("key1", "xyz"),
3104 /// ]);
3105 /// ```
3106 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3107 where
3108 T: std::iter::IntoIterator<Item = (K, V)>,
3109 K: std::convert::Into<std::string::String>,
3110 V: std::convert::Into<std::string::String>,
3111 {
3112 use std::iter::Iterator;
3113 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3114 self
3115 }
3116
3117 /// Sets the value of [status][crate::model::Cluster::status].
3118 ///
3119 /// # Example
3120 /// ```ignore,no_run
3121 /// # use google_cloud_dataproc_v1::model::Cluster;
3122 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3123 /// let x = Cluster::new().set_status(ClusterStatus::default()/* use setters */);
3124 /// ```
3125 pub fn set_status<T>(mut self, v: T) -> Self
3126 where
3127 T: std::convert::Into<crate::model::ClusterStatus>,
3128 {
3129 self.status = std::option::Option::Some(v.into());
3130 self
3131 }
3132
3133 /// Sets or clears the value of [status][crate::model::Cluster::status].
3134 ///
3135 /// # Example
3136 /// ```ignore,no_run
3137 /// # use google_cloud_dataproc_v1::model::Cluster;
3138 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3139 /// let x = Cluster::new().set_or_clear_status(Some(ClusterStatus::default()/* use setters */));
3140 /// let x = Cluster::new().set_or_clear_status(None::<ClusterStatus>);
3141 /// ```
3142 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
3143 where
3144 T: std::convert::Into<crate::model::ClusterStatus>,
3145 {
3146 self.status = v.map(|x| x.into());
3147 self
3148 }
3149
3150 /// Sets the value of [status_history][crate::model::Cluster::status_history].
3151 ///
3152 /// # Example
3153 /// ```ignore,no_run
3154 /// # use google_cloud_dataproc_v1::model::Cluster;
3155 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3156 /// let x = Cluster::new()
3157 /// .set_status_history([
3158 /// ClusterStatus::default()/* use setters */,
3159 /// ClusterStatus::default()/* use (different) setters */,
3160 /// ]);
3161 /// ```
3162 pub fn set_status_history<T, V>(mut self, v: T) -> Self
3163 where
3164 T: std::iter::IntoIterator<Item = V>,
3165 V: std::convert::Into<crate::model::ClusterStatus>,
3166 {
3167 use std::iter::Iterator;
3168 self.status_history = v.into_iter().map(|i| i.into()).collect();
3169 self
3170 }
3171
3172 /// Sets the value of [cluster_uuid][crate::model::Cluster::cluster_uuid].
3173 ///
3174 /// # Example
3175 /// ```ignore,no_run
3176 /// # use google_cloud_dataproc_v1::model::Cluster;
3177 /// let x = Cluster::new().set_cluster_uuid("example");
3178 /// ```
3179 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3180 self.cluster_uuid = v.into();
3181 self
3182 }
3183
3184 /// Sets the value of [metrics][crate::model::Cluster::metrics].
3185 ///
3186 /// # Example
3187 /// ```ignore,no_run
3188 /// # use google_cloud_dataproc_v1::model::Cluster;
3189 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3190 /// let x = Cluster::new().set_metrics(ClusterMetrics::default()/* use setters */);
3191 /// ```
3192 pub fn set_metrics<T>(mut self, v: T) -> Self
3193 where
3194 T: std::convert::Into<crate::model::ClusterMetrics>,
3195 {
3196 self.metrics = std::option::Option::Some(v.into());
3197 self
3198 }
3199
3200 /// Sets or clears the value of [metrics][crate::model::Cluster::metrics].
3201 ///
3202 /// # Example
3203 /// ```ignore,no_run
3204 /// # use google_cloud_dataproc_v1::model::Cluster;
3205 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3206 /// let x = Cluster::new().set_or_clear_metrics(Some(ClusterMetrics::default()/* use setters */));
3207 /// let x = Cluster::new().set_or_clear_metrics(None::<ClusterMetrics>);
3208 /// ```
3209 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
3210 where
3211 T: std::convert::Into<crate::model::ClusterMetrics>,
3212 {
3213 self.metrics = v.map(|x| x.into());
3214 self
3215 }
3216}
3217
3218impl wkt::message::Message for Cluster {
3219 fn typename() -> &'static str {
3220 "type.googleapis.com/google.cloud.dataproc.v1.Cluster"
3221 }
3222}
3223
3224/// The cluster config.
3225#[derive(Clone, Default, PartialEq)]
3226#[non_exhaustive]
3227pub struct ClusterConfig {
3228 /// Optional. The type of the cluster.
3229 pub cluster_type: crate::model::cluster_config::ClusterType,
3230
3231 /// Optional. The cluster tier.
3232 pub cluster_tier: crate::model::cluster_config::ClusterTier,
3233
3234 /// Optional. A Cloud Storage bucket used to stage job
3235 /// dependencies, config files, and job driver console output.
3236 /// If you do not specify a staging bucket, Cloud
3237 /// Dataproc will determine a Cloud Storage location (US,
3238 /// ASIA, or EU) for your cluster's staging bucket according to the
3239 /// Compute Engine zone where your cluster is deployed, and then create
3240 /// and manage this project-level, per-location bucket (see
3241 /// [Dataproc staging and temp
3242 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3243 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3244 /// a Cloud Storage bucket.**
3245 pub config_bucket: std::string::String,
3246
3247 /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs
3248 /// data, such as Spark and MapReduce history files. If you do not specify a
3249 /// temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or
3250 /// EU) for your cluster's temp bucket according to the Compute Engine zone
3251 /// where your cluster is deployed, and then create and manage this
3252 /// project-level, per-location bucket. The default bucket has a TTL of 90
3253 /// days, but you can use any TTL (or none) if you specify a bucket (see
3254 /// [Dataproc staging and temp
3255 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3256 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3257 /// a Cloud Storage bucket.**
3258 pub temp_bucket: std::string::String,
3259
3260 /// Optional. The shared Compute Engine config settings for
3261 /// all instances in a cluster.
3262 pub gce_cluster_config: std::option::Option<crate::model::GceClusterConfig>,
3263
3264 /// Optional. The Compute Engine config settings for
3265 /// the cluster's master instance.
3266 pub master_config: std::option::Option<crate::model::InstanceGroupConfig>,
3267
3268 /// Optional. The Compute Engine config settings for
3269 /// the cluster's worker instances.
3270 pub worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3271
3272 /// Optional. The Compute Engine config settings for
3273 /// a cluster's secondary worker instances
3274 pub secondary_worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3275
3276 /// Optional. The config settings for cluster software.
3277 pub software_config: std::option::Option<crate::model::SoftwareConfig>,
3278
3279 /// Optional. Commands to execute on each node after config is
3280 /// completed. By default, executables are run on master and all worker nodes.
3281 /// You can test a node's `role` metadata to run an executable on
3282 /// a master or worker node, as shown below using `curl` (you can also use
3283 /// `wget`):
3284 ///
3285 /// ```norust
3286 /// ROLE=$(curl -H Metadata-Flavor:Google
3287 /// http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
3288 /// if [[ "${ROLE}" == 'Master' ]]; then
3289 /// ... master specific actions ...
3290 /// else
3291 /// ... worker specific actions ...
3292 /// fi
3293 /// ```
3294 pub initialization_actions: std::vec::Vec<crate::model::NodeInitializationAction>,
3295
3296 /// Optional. Encryption settings for the cluster.
3297 pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
3298
3299 /// Optional. Autoscaling config for the policy associated with the cluster.
3300 /// Cluster does not autoscale if this field is unset.
3301 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
3302
3303 /// Optional. Security settings for the cluster.
3304 pub security_config: std::option::Option<crate::model::SecurityConfig>,
3305
3306 /// Optional. Lifecycle setting for the cluster.
3307 pub lifecycle_config: std::option::Option<crate::model::LifecycleConfig>,
3308
3309 /// Optional. Port/endpoint configuration for this cluster
3310 pub endpoint_config: std::option::Option<crate::model::EndpointConfig>,
3311
3312 /// Optional. Metastore configuration.
3313 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3314
3315 /// Optional. The config for Dataproc metrics.
3316 pub dataproc_metric_config: std::option::Option<crate::model::DataprocMetricConfig>,
3317
3318 /// Optional. The node group settings.
3319 pub auxiliary_node_groups: std::vec::Vec<crate::model::AuxiliaryNodeGroup>,
3320
3321 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3322}
3323
3324impl ClusterConfig {
3325 pub fn new() -> Self {
3326 std::default::Default::default()
3327 }
3328
3329 /// Sets the value of [cluster_type][crate::model::ClusterConfig::cluster_type].
3330 ///
3331 /// # Example
3332 /// ```ignore,no_run
3333 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3334 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterType;
3335 /// let x0 = ClusterConfig::new().set_cluster_type(ClusterType::Standard);
3336 /// let x1 = ClusterConfig::new().set_cluster_type(ClusterType::SingleNode);
3337 /// let x2 = ClusterConfig::new().set_cluster_type(ClusterType::ZeroScale);
3338 /// ```
3339 pub fn set_cluster_type<T: std::convert::Into<crate::model::cluster_config::ClusterType>>(
3340 mut self,
3341 v: T,
3342 ) -> Self {
3343 self.cluster_type = v.into();
3344 self
3345 }
3346
3347 /// Sets the value of [cluster_tier][crate::model::ClusterConfig::cluster_tier].
3348 ///
3349 /// # Example
3350 /// ```ignore,no_run
3351 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3352 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterTier;
3353 /// let x0 = ClusterConfig::new().set_cluster_tier(ClusterTier::Standard);
3354 /// let x1 = ClusterConfig::new().set_cluster_tier(ClusterTier::Premium);
3355 /// ```
3356 pub fn set_cluster_tier<T: std::convert::Into<crate::model::cluster_config::ClusterTier>>(
3357 mut self,
3358 v: T,
3359 ) -> Self {
3360 self.cluster_tier = v.into();
3361 self
3362 }
3363
3364 /// Sets the value of [config_bucket][crate::model::ClusterConfig::config_bucket].
3365 ///
3366 /// # Example
3367 /// ```ignore,no_run
3368 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3369 /// let x = ClusterConfig::new().set_config_bucket("example");
3370 /// ```
3371 pub fn set_config_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3372 self.config_bucket = v.into();
3373 self
3374 }
3375
3376 /// Sets the value of [temp_bucket][crate::model::ClusterConfig::temp_bucket].
3377 ///
3378 /// # Example
3379 /// ```ignore,no_run
3380 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3381 /// let x = ClusterConfig::new().set_temp_bucket("example");
3382 /// ```
3383 pub fn set_temp_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3384 self.temp_bucket = v.into();
3385 self
3386 }
3387
3388 /// Sets the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3389 ///
3390 /// # Example
3391 /// ```ignore,no_run
3392 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3393 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3394 /// let x = ClusterConfig::new().set_gce_cluster_config(GceClusterConfig::default()/* use setters */);
3395 /// ```
3396 pub fn set_gce_cluster_config<T>(mut self, v: T) -> Self
3397 where
3398 T: std::convert::Into<crate::model::GceClusterConfig>,
3399 {
3400 self.gce_cluster_config = std::option::Option::Some(v.into());
3401 self
3402 }
3403
3404 /// Sets or clears the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3405 ///
3406 /// # Example
3407 /// ```ignore,no_run
3408 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3409 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3410 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(Some(GceClusterConfig::default()/* use setters */));
3411 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(None::<GceClusterConfig>);
3412 /// ```
3413 pub fn set_or_clear_gce_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3414 where
3415 T: std::convert::Into<crate::model::GceClusterConfig>,
3416 {
3417 self.gce_cluster_config = v.map(|x| x.into());
3418 self
3419 }
3420
3421 /// Sets the value of [master_config][crate::model::ClusterConfig::master_config].
3422 ///
3423 /// # Example
3424 /// ```ignore,no_run
3425 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3426 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3427 /// let x = ClusterConfig::new().set_master_config(InstanceGroupConfig::default()/* use setters */);
3428 /// ```
3429 pub fn set_master_config<T>(mut self, v: T) -> Self
3430 where
3431 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3432 {
3433 self.master_config = std::option::Option::Some(v.into());
3434 self
3435 }
3436
3437 /// Sets or clears the value of [master_config][crate::model::ClusterConfig::master_config].
3438 ///
3439 /// # Example
3440 /// ```ignore,no_run
3441 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3442 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3443 /// let x = ClusterConfig::new().set_or_clear_master_config(Some(InstanceGroupConfig::default()/* use setters */));
3444 /// let x = ClusterConfig::new().set_or_clear_master_config(None::<InstanceGroupConfig>);
3445 /// ```
3446 pub fn set_or_clear_master_config<T>(mut self, v: std::option::Option<T>) -> Self
3447 where
3448 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3449 {
3450 self.master_config = v.map(|x| x.into());
3451 self
3452 }
3453
3454 /// Sets the value of [worker_config][crate::model::ClusterConfig::worker_config].
3455 ///
3456 /// # Example
3457 /// ```ignore,no_run
3458 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3459 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3460 /// let x = ClusterConfig::new().set_worker_config(InstanceGroupConfig::default()/* use setters */);
3461 /// ```
3462 pub fn set_worker_config<T>(mut self, v: T) -> Self
3463 where
3464 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3465 {
3466 self.worker_config = std::option::Option::Some(v.into());
3467 self
3468 }
3469
3470 /// Sets or clears the value of [worker_config][crate::model::ClusterConfig::worker_config].
3471 ///
3472 /// # Example
3473 /// ```ignore,no_run
3474 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3475 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3476 /// let x = ClusterConfig::new().set_or_clear_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3477 /// let x = ClusterConfig::new().set_or_clear_worker_config(None::<InstanceGroupConfig>);
3478 /// ```
3479 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3480 where
3481 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3482 {
3483 self.worker_config = v.map(|x| x.into());
3484 self
3485 }
3486
3487 /// Sets the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3488 ///
3489 /// # Example
3490 /// ```ignore,no_run
3491 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3492 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3493 /// let x = ClusterConfig::new().set_secondary_worker_config(InstanceGroupConfig::default()/* use setters */);
3494 /// ```
3495 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
3496 where
3497 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3498 {
3499 self.secondary_worker_config = std::option::Option::Some(v.into());
3500 self
3501 }
3502
3503 /// Sets or clears the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3504 ///
3505 /// # Example
3506 /// ```ignore,no_run
3507 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3508 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3509 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3510 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(None::<InstanceGroupConfig>);
3511 /// ```
3512 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3513 where
3514 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3515 {
3516 self.secondary_worker_config = v.map(|x| x.into());
3517 self
3518 }
3519
3520 /// Sets the value of [software_config][crate::model::ClusterConfig::software_config].
3521 ///
3522 /// # Example
3523 /// ```ignore,no_run
3524 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3525 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3526 /// let x = ClusterConfig::new().set_software_config(SoftwareConfig::default()/* use setters */);
3527 /// ```
3528 pub fn set_software_config<T>(mut self, v: T) -> Self
3529 where
3530 T: std::convert::Into<crate::model::SoftwareConfig>,
3531 {
3532 self.software_config = std::option::Option::Some(v.into());
3533 self
3534 }
3535
3536 /// Sets or clears the value of [software_config][crate::model::ClusterConfig::software_config].
3537 ///
3538 /// # Example
3539 /// ```ignore,no_run
3540 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3541 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3542 /// let x = ClusterConfig::new().set_or_clear_software_config(Some(SoftwareConfig::default()/* use setters */));
3543 /// let x = ClusterConfig::new().set_or_clear_software_config(None::<SoftwareConfig>);
3544 /// ```
3545 pub fn set_or_clear_software_config<T>(mut self, v: std::option::Option<T>) -> Self
3546 where
3547 T: std::convert::Into<crate::model::SoftwareConfig>,
3548 {
3549 self.software_config = v.map(|x| x.into());
3550 self
3551 }
3552
3553 /// Sets the value of [initialization_actions][crate::model::ClusterConfig::initialization_actions].
3554 ///
3555 /// # Example
3556 /// ```ignore,no_run
3557 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3558 /// use google_cloud_dataproc_v1::model::NodeInitializationAction;
3559 /// let x = ClusterConfig::new()
3560 /// .set_initialization_actions([
3561 /// NodeInitializationAction::default()/* use setters */,
3562 /// NodeInitializationAction::default()/* use (different) setters */,
3563 /// ]);
3564 /// ```
3565 pub fn set_initialization_actions<T, V>(mut self, v: T) -> Self
3566 where
3567 T: std::iter::IntoIterator<Item = V>,
3568 V: std::convert::Into<crate::model::NodeInitializationAction>,
3569 {
3570 use std::iter::Iterator;
3571 self.initialization_actions = v.into_iter().map(|i| i.into()).collect();
3572 self
3573 }
3574
3575 /// Sets the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3576 ///
3577 /// # Example
3578 /// ```ignore,no_run
3579 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3580 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3581 /// let x = ClusterConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3582 /// ```
3583 pub fn set_encryption_config<T>(mut self, v: T) -> Self
3584 where
3585 T: std::convert::Into<crate::model::EncryptionConfig>,
3586 {
3587 self.encryption_config = std::option::Option::Some(v.into());
3588 self
3589 }
3590
3591 /// Sets or clears the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3592 ///
3593 /// # Example
3594 /// ```ignore,no_run
3595 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3596 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3597 /// let x = ClusterConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3598 /// let x = ClusterConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3599 /// ```
3600 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3601 where
3602 T: std::convert::Into<crate::model::EncryptionConfig>,
3603 {
3604 self.encryption_config = v.map(|x| x.into());
3605 self
3606 }
3607
3608 /// Sets the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3609 ///
3610 /// # Example
3611 /// ```ignore,no_run
3612 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3613 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3614 /// let x = ClusterConfig::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
3615 /// ```
3616 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
3617 where
3618 T: std::convert::Into<crate::model::AutoscalingConfig>,
3619 {
3620 self.autoscaling_config = std::option::Option::Some(v.into());
3621 self
3622 }
3623
3624 /// Sets or clears the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3625 ///
3626 /// # Example
3627 /// ```ignore,no_run
3628 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3629 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3630 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
3631 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
3632 /// ```
3633 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
3634 where
3635 T: std::convert::Into<crate::model::AutoscalingConfig>,
3636 {
3637 self.autoscaling_config = v.map(|x| x.into());
3638 self
3639 }
3640
3641 /// Sets the value of [security_config][crate::model::ClusterConfig::security_config].
3642 ///
3643 /// # Example
3644 /// ```ignore,no_run
3645 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3646 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3647 /// let x = ClusterConfig::new().set_security_config(SecurityConfig::default()/* use setters */);
3648 /// ```
3649 pub fn set_security_config<T>(mut self, v: T) -> Self
3650 where
3651 T: std::convert::Into<crate::model::SecurityConfig>,
3652 {
3653 self.security_config = std::option::Option::Some(v.into());
3654 self
3655 }
3656
3657 /// Sets or clears the value of [security_config][crate::model::ClusterConfig::security_config].
3658 ///
3659 /// # Example
3660 /// ```ignore,no_run
3661 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3662 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3663 /// let x = ClusterConfig::new().set_or_clear_security_config(Some(SecurityConfig::default()/* use setters */));
3664 /// let x = ClusterConfig::new().set_or_clear_security_config(None::<SecurityConfig>);
3665 /// ```
3666 pub fn set_or_clear_security_config<T>(mut self, v: std::option::Option<T>) -> Self
3667 where
3668 T: std::convert::Into<crate::model::SecurityConfig>,
3669 {
3670 self.security_config = v.map(|x| x.into());
3671 self
3672 }
3673
3674 /// Sets the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3675 ///
3676 /// # Example
3677 /// ```ignore,no_run
3678 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3679 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3680 /// let x = ClusterConfig::new().set_lifecycle_config(LifecycleConfig::default()/* use setters */);
3681 /// ```
3682 pub fn set_lifecycle_config<T>(mut self, v: T) -> Self
3683 where
3684 T: std::convert::Into<crate::model::LifecycleConfig>,
3685 {
3686 self.lifecycle_config = std::option::Option::Some(v.into());
3687 self
3688 }
3689
3690 /// Sets or clears the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3691 ///
3692 /// # Example
3693 /// ```ignore,no_run
3694 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3695 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3696 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(Some(LifecycleConfig::default()/* use setters */));
3697 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(None::<LifecycleConfig>);
3698 /// ```
3699 pub fn set_or_clear_lifecycle_config<T>(mut self, v: std::option::Option<T>) -> Self
3700 where
3701 T: std::convert::Into<crate::model::LifecycleConfig>,
3702 {
3703 self.lifecycle_config = v.map(|x| x.into());
3704 self
3705 }
3706
3707 /// Sets the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3708 ///
3709 /// # Example
3710 /// ```ignore,no_run
3711 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3712 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3713 /// let x = ClusterConfig::new().set_endpoint_config(EndpointConfig::default()/* use setters */);
3714 /// ```
3715 pub fn set_endpoint_config<T>(mut self, v: T) -> Self
3716 where
3717 T: std::convert::Into<crate::model::EndpointConfig>,
3718 {
3719 self.endpoint_config = std::option::Option::Some(v.into());
3720 self
3721 }
3722
3723 /// Sets or clears the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3724 ///
3725 /// # Example
3726 /// ```ignore,no_run
3727 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3728 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3729 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(Some(EndpointConfig::default()/* use setters */));
3730 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(None::<EndpointConfig>);
3731 /// ```
3732 pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
3733 where
3734 T: std::convert::Into<crate::model::EndpointConfig>,
3735 {
3736 self.endpoint_config = v.map(|x| x.into());
3737 self
3738 }
3739
3740 /// Sets the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3741 ///
3742 /// # Example
3743 /// ```ignore,no_run
3744 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3745 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3746 /// let x = ClusterConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
3747 /// ```
3748 pub fn set_metastore_config<T>(mut self, v: T) -> Self
3749 where
3750 T: std::convert::Into<crate::model::MetastoreConfig>,
3751 {
3752 self.metastore_config = std::option::Option::Some(v.into());
3753 self
3754 }
3755
3756 /// Sets or clears the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3757 ///
3758 /// # Example
3759 /// ```ignore,no_run
3760 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3761 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3762 /// let x = ClusterConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
3763 /// let x = ClusterConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
3764 /// ```
3765 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
3766 where
3767 T: std::convert::Into<crate::model::MetastoreConfig>,
3768 {
3769 self.metastore_config = v.map(|x| x.into());
3770 self
3771 }
3772
3773 /// Sets the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3774 ///
3775 /// # Example
3776 /// ```ignore,no_run
3777 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3778 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3779 /// let x = ClusterConfig::new().set_dataproc_metric_config(DataprocMetricConfig::default()/* use setters */);
3780 /// ```
3781 pub fn set_dataproc_metric_config<T>(mut self, v: T) -> Self
3782 where
3783 T: std::convert::Into<crate::model::DataprocMetricConfig>,
3784 {
3785 self.dataproc_metric_config = std::option::Option::Some(v.into());
3786 self
3787 }
3788
3789 /// Sets or clears the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3790 ///
3791 /// # Example
3792 /// ```ignore,no_run
3793 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3794 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3795 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(Some(DataprocMetricConfig::default()/* use setters */));
3796 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(None::<DataprocMetricConfig>);
3797 /// ```
3798 pub fn set_or_clear_dataproc_metric_config<T>(mut self, v: std::option::Option<T>) -> Self
3799 where
3800 T: std::convert::Into<crate::model::DataprocMetricConfig>,
3801 {
3802 self.dataproc_metric_config = v.map(|x| x.into());
3803 self
3804 }
3805
3806 /// Sets the value of [auxiliary_node_groups][crate::model::ClusterConfig::auxiliary_node_groups].
3807 ///
3808 /// # Example
3809 /// ```ignore,no_run
3810 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3811 /// use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
3812 /// let x = ClusterConfig::new()
3813 /// .set_auxiliary_node_groups([
3814 /// AuxiliaryNodeGroup::default()/* use setters */,
3815 /// AuxiliaryNodeGroup::default()/* use (different) setters */,
3816 /// ]);
3817 /// ```
3818 pub fn set_auxiliary_node_groups<T, V>(mut self, v: T) -> Self
3819 where
3820 T: std::iter::IntoIterator<Item = V>,
3821 V: std::convert::Into<crate::model::AuxiliaryNodeGroup>,
3822 {
3823 use std::iter::Iterator;
3824 self.auxiliary_node_groups = v.into_iter().map(|i| i.into()).collect();
3825 self
3826 }
3827}
3828
3829impl wkt::message::Message for ClusterConfig {
3830 fn typename() -> &'static str {
3831 "type.googleapis.com/google.cloud.dataproc.v1.ClusterConfig"
3832 }
3833}
3834
3835/// Defines additional types related to [ClusterConfig].
3836pub mod cluster_config {
3837 #[allow(unused_imports)]
3838 use super::*;
3839
3840 /// The type of the cluster.
3841 ///
3842 /// # Working with unknown values
3843 ///
3844 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3845 /// additional enum variants at any time. Adding new variants is not considered
3846 /// a breaking change. Applications should write their code in anticipation of:
3847 ///
3848 /// - New values appearing in future releases of the client library, **and**
3849 /// - New values received dynamically, without application changes.
3850 ///
3851 /// Please consult the [Working with enums] section in the user guide for some
3852 /// guidelines.
3853 ///
3854 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3855 #[derive(Clone, Debug, PartialEq)]
3856 #[non_exhaustive]
3857 pub enum ClusterType {
3858 /// Not set.
3859 Unspecified,
3860 /// Standard dataproc cluster with a minimum of two primary workers.
3861 Standard,
3862 /// <https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/single-node-clusters>
3863 SingleNode,
3864 /// Clusters that can use only secondary workers and be scaled down to zero
3865 /// secondary worker nodes.
3866 ZeroScale,
3867 /// If set, the enum was initialized with an unknown value.
3868 ///
3869 /// Applications can examine the value using [ClusterType::value] or
3870 /// [ClusterType::name].
3871 UnknownValue(cluster_type::UnknownValue),
3872 }
3873
3874 #[doc(hidden)]
3875 pub mod cluster_type {
3876 #[allow(unused_imports)]
3877 use super::*;
3878 #[derive(Clone, Debug, PartialEq)]
3879 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3880 }
3881
3882 impl ClusterType {
3883 /// Gets the enum value.
3884 ///
3885 /// Returns `None` if the enum contains an unknown value deserialized from
3886 /// the string representation of enums.
3887 pub fn value(&self) -> std::option::Option<i32> {
3888 match self {
3889 Self::Unspecified => std::option::Option::Some(0),
3890 Self::Standard => std::option::Option::Some(1),
3891 Self::SingleNode => std::option::Option::Some(2),
3892 Self::ZeroScale => std::option::Option::Some(3),
3893 Self::UnknownValue(u) => u.0.value(),
3894 }
3895 }
3896
3897 /// Gets the enum value as a string.
3898 ///
3899 /// Returns `None` if the enum contains an unknown value deserialized from
3900 /// the integer representation of enums.
3901 pub fn name(&self) -> std::option::Option<&str> {
3902 match self {
3903 Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
3904 Self::Standard => std::option::Option::Some("STANDARD"),
3905 Self::SingleNode => std::option::Option::Some("SINGLE_NODE"),
3906 Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
3907 Self::UnknownValue(u) => u.0.name(),
3908 }
3909 }
3910 }
3911
3912 impl std::default::Default for ClusterType {
3913 fn default() -> Self {
3914 use std::convert::From;
3915 Self::from(0)
3916 }
3917 }
3918
3919 impl std::fmt::Display for ClusterType {
3920 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3921 wkt::internal::display_enum(f, self.name(), self.value())
3922 }
3923 }
3924
3925 impl std::convert::From<i32> for ClusterType {
3926 fn from(value: i32) -> Self {
3927 match value {
3928 0 => Self::Unspecified,
3929 1 => Self::Standard,
3930 2 => Self::SingleNode,
3931 3 => Self::ZeroScale,
3932 _ => Self::UnknownValue(cluster_type::UnknownValue(
3933 wkt::internal::UnknownEnumValue::Integer(value),
3934 )),
3935 }
3936 }
3937 }
3938
3939 impl std::convert::From<&str> for ClusterType {
3940 fn from(value: &str) -> Self {
3941 use std::string::ToString;
3942 match value {
3943 "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
3944 "STANDARD" => Self::Standard,
3945 "SINGLE_NODE" => Self::SingleNode,
3946 "ZERO_SCALE" => Self::ZeroScale,
3947 _ => Self::UnknownValue(cluster_type::UnknownValue(
3948 wkt::internal::UnknownEnumValue::String(value.to_string()),
3949 )),
3950 }
3951 }
3952 }
3953
3954 impl serde::ser::Serialize for ClusterType {
3955 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3956 where
3957 S: serde::Serializer,
3958 {
3959 match self {
3960 Self::Unspecified => serializer.serialize_i32(0),
3961 Self::Standard => serializer.serialize_i32(1),
3962 Self::SingleNode => serializer.serialize_i32(2),
3963 Self::ZeroScale => serializer.serialize_i32(3),
3964 Self::UnknownValue(u) => u.0.serialize(serializer),
3965 }
3966 }
3967 }
3968
3969 impl<'de> serde::de::Deserialize<'de> for ClusterType {
3970 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3971 where
3972 D: serde::Deserializer<'de>,
3973 {
3974 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
3975 ".google.cloud.dataproc.v1.ClusterConfig.ClusterType",
3976 ))
3977 }
3978 }
3979
3980 /// The cluster tier.
3981 ///
3982 /// # Working with unknown values
3983 ///
3984 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3985 /// additional enum variants at any time. Adding new variants is not considered
3986 /// a breaking change. Applications should write their code in anticipation of:
3987 ///
3988 /// - New values appearing in future releases of the client library, **and**
3989 /// - New values received dynamically, without application changes.
3990 ///
3991 /// Please consult the [Working with enums] section in the user guide for some
3992 /// guidelines.
3993 ///
3994 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3995 #[derive(Clone, Debug, PartialEq)]
3996 #[non_exhaustive]
3997 pub enum ClusterTier {
3998 /// Not set. Works the same as CLUSTER_TIER_STANDARD.
3999 Unspecified,
4000 /// Standard Dataproc cluster.
4001 Standard,
4002 /// Premium Dataproc cluster.
4003 Premium,
4004 /// If set, the enum was initialized with an unknown value.
4005 ///
4006 /// Applications can examine the value using [ClusterTier::value] or
4007 /// [ClusterTier::name].
4008 UnknownValue(cluster_tier::UnknownValue),
4009 }
4010
4011 #[doc(hidden)]
4012 pub mod cluster_tier {
4013 #[allow(unused_imports)]
4014 use super::*;
4015 #[derive(Clone, Debug, PartialEq)]
4016 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4017 }
4018
4019 impl ClusterTier {
4020 /// Gets the enum value.
4021 ///
4022 /// Returns `None` if the enum contains an unknown value deserialized from
4023 /// the string representation of enums.
4024 pub fn value(&self) -> std::option::Option<i32> {
4025 match self {
4026 Self::Unspecified => std::option::Option::Some(0),
4027 Self::Standard => std::option::Option::Some(1),
4028 Self::Premium => std::option::Option::Some(2),
4029 Self::UnknownValue(u) => u.0.value(),
4030 }
4031 }
4032
4033 /// Gets the enum value as a string.
4034 ///
4035 /// Returns `None` if the enum contains an unknown value deserialized from
4036 /// the integer representation of enums.
4037 pub fn name(&self) -> std::option::Option<&str> {
4038 match self {
4039 Self::Unspecified => std::option::Option::Some("CLUSTER_TIER_UNSPECIFIED"),
4040 Self::Standard => std::option::Option::Some("CLUSTER_TIER_STANDARD"),
4041 Self::Premium => std::option::Option::Some("CLUSTER_TIER_PREMIUM"),
4042 Self::UnknownValue(u) => u.0.name(),
4043 }
4044 }
4045 }
4046
4047 impl std::default::Default for ClusterTier {
4048 fn default() -> Self {
4049 use std::convert::From;
4050 Self::from(0)
4051 }
4052 }
4053
4054 impl std::fmt::Display for ClusterTier {
4055 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4056 wkt::internal::display_enum(f, self.name(), self.value())
4057 }
4058 }
4059
4060 impl std::convert::From<i32> for ClusterTier {
4061 fn from(value: i32) -> Self {
4062 match value {
4063 0 => Self::Unspecified,
4064 1 => Self::Standard,
4065 2 => Self::Premium,
4066 _ => Self::UnknownValue(cluster_tier::UnknownValue(
4067 wkt::internal::UnknownEnumValue::Integer(value),
4068 )),
4069 }
4070 }
4071 }
4072
4073 impl std::convert::From<&str> for ClusterTier {
4074 fn from(value: &str) -> Self {
4075 use std::string::ToString;
4076 match value {
4077 "CLUSTER_TIER_UNSPECIFIED" => Self::Unspecified,
4078 "CLUSTER_TIER_STANDARD" => Self::Standard,
4079 "CLUSTER_TIER_PREMIUM" => Self::Premium,
4080 _ => Self::UnknownValue(cluster_tier::UnknownValue(
4081 wkt::internal::UnknownEnumValue::String(value.to_string()),
4082 )),
4083 }
4084 }
4085 }
4086
4087 impl serde::ser::Serialize for ClusterTier {
4088 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4089 where
4090 S: serde::Serializer,
4091 {
4092 match self {
4093 Self::Unspecified => serializer.serialize_i32(0),
4094 Self::Standard => serializer.serialize_i32(1),
4095 Self::Premium => serializer.serialize_i32(2),
4096 Self::UnknownValue(u) => u.0.serialize(serializer),
4097 }
4098 }
4099 }
4100
4101 impl<'de> serde::de::Deserialize<'de> for ClusterTier {
4102 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4103 where
4104 D: serde::Deserializer<'de>,
4105 {
4106 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterTier>::new(
4107 ".google.cloud.dataproc.v1.ClusterConfig.ClusterTier",
4108 ))
4109 }
4110 }
4111}
4112
4113/// The Dataproc cluster config for a cluster that does not directly control the
4114/// underlying compute resources, such as a [Dataproc-on-GKE
4115/// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
4116#[derive(Clone, Default, PartialEq)]
4117#[non_exhaustive]
4118pub struct VirtualClusterConfig {
4119 /// Optional. A Cloud Storage bucket used to stage job
4120 /// dependencies, config files, and job driver console output.
4121 /// If you do not specify a staging bucket, Cloud
4122 /// Dataproc will determine a Cloud Storage location (US,
4123 /// ASIA, or EU) for your cluster's staging bucket according to the
4124 /// Compute Engine zone where your cluster is deployed, and then create
4125 /// and manage this project-level, per-location bucket (see
4126 /// [Dataproc staging and temp
4127 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
4128 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
4129 /// a Cloud Storage bucket.**
4130 pub staging_bucket: std::string::String,
4131
4132 /// Optional. Configuration of auxiliary services used by this cluster.
4133 pub auxiliary_services_config: std::option::Option<crate::model::AuxiliaryServicesConfig>,
4134
4135 pub infrastructure_config:
4136 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4137
4138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4139}
4140
4141impl VirtualClusterConfig {
4142 pub fn new() -> Self {
4143 std::default::Default::default()
4144 }
4145
4146 /// Sets the value of [staging_bucket][crate::model::VirtualClusterConfig::staging_bucket].
4147 ///
4148 /// # Example
4149 /// ```ignore,no_run
4150 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4151 /// let x = VirtualClusterConfig::new().set_staging_bucket("example");
4152 /// ```
4153 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4154 self.staging_bucket = v.into();
4155 self
4156 }
4157
4158 /// Sets the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4159 ///
4160 /// # Example
4161 /// ```ignore,no_run
4162 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4163 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4164 /// let x = VirtualClusterConfig::new().set_auxiliary_services_config(AuxiliaryServicesConfig::default()/* use setters */);
4165 /// ```
4166 pub fn set_auxiliary_services_config<T>(mut self, v: T) -> Self
4167 where
4168 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4169 {
4170 self.auxiliary_services_config = std::option::Option::Some(v.into());
4171 self
4172 }
4173
4174 /// Sets or clears the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4175 ///
4176 /// # Example
4177 /// ```ignore,no_run
4178 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4179 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4180 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(Some(AuxiliaryServicesConfig::default()/* use setters */));
4181 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(None::<AuxiliaryServicesConfig>);
4182 /// ```
4183 pub fn set_or_clear_auxiliary_services_config<T>(mut self, v: std::option::Option<T>) -> Self
4184 where
4185 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4186 {
4187 self.auxiliary_services_config = v.map(|x| x.into());
4188 self
4189 }
4190
4191 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config].
4192 ///
4193 /// Note that all the setters affecting `infrastructure_config` are mutually
4194 /// exclusive.
4195 ///
4196 /// # Example
4197 /// ```ignore,no_run
4198 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4199 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4200 /// let x = VirtualClusterConfig::new().set_infrastructure_config(Some(
4201 /// google_cloud_dataproc_v1::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(KubernetesClusterConfig::default().into())));
4202 /// ```
4203 pub fn set_infrastructure_config<
4204 T: std::convert::Into<
4205 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4206 >,
4207 >(
4208 mut self,
4209 v: T,
4210 ) -> Self {
4211 self.infrastructure_config = v.into();
4212 self
4213 }
4214
4215 /// The value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4216 /// if it holds a `KubernetesClusterConfig`, `None` if the field is not set or
4217 /// holds a different branch.
4218 pub fn kubernetes_cluster_config(
4219 &self,
4220 ) -> std::option::Option<&std::boxed::Box<crate::model::KubernetesClusterConfig>> {
4221 #[allow(unreachable_patterns)]
4222 self.infrastructure_config.as_ref().and_then(|v| match v {
4223 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4224 v,
4225 ) => std::option::Option::Some(v),
4226 _ => std::option::Option::None,
4227 })
4228 }
4229
4230 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4231 /// to hold a `KubernetesClusterConfig`.
4232 ///
4233 /// Note that all the setters affecting `infrastructure_config` are
4234 /// mutually exclusive.
4235 ///
4236 /// # Example
4237 /// ```ignore,no_run
4238 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4239 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4240 /// let x = VirtualClusterConfig::new().set_kubernetes_cluster_config(KubernetesClusterConfig::default()/* use setters */);
4241 /// assert!(x.kubernetes_cluster_config().is_some());
4242 /// ```
4243 pub fn set_kubernetes_cluster_config<
4244 T: std::convert::Into<std::boxed::Box<crate::model::KubernetesClusterConfig>>,
4245 >(
4246 mut self,
4247 v: T,
4248 ) -> Self {
4249 self.infrastructure_config = std::option::Option::Some(
4250 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4251 v.into(),
4252 ),
4253 );
4254 self
4255 }
4256}
4257
4258impl wkt::message::Message for VirtualClusterConfig {
4259 fn typename() -> &'static str {
4260 "type.googleapis.com/google.cloud.dataproc.v1.VirtualClusterConfig"
4261 }
4262}
4263
4264/// Defines additional types related to [VirtualClusterConfig].
4265pub mod virtual_cluster_config {
4266 #[allow(unused_imports)]
4267 use super::*;
4268
4269 #[derive(Clone, Debug, PartialEq)]
4270 #[non_exhaustive]
4271 pub enum InfrastructureConfig {
4272 /// Required. The configuration for running the Dataproc cluster on
4273 /// Kubernetes.
4274 KubernetesClusterConfig(std::boxed::Box<crate::model::KubernetesClusterConfig>),
4275 }
4276}
4277
4278/// Auxiliary services configuration for a Cluster.
4279#[derive(Clone, Default, PartialEq)]
4280#[non_exhaustive]
4281pub struct AuxiliaryServicesConfig {
4282 /// Optional. The Hive Metastore configuration for this workload.
4283 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
4284
4285 /// Optional. The Spark History Server configuration for the workload.
4286 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
4287
4288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4289}
4290
4291impl AuxiliaryServicesConfig {
4292 pub fn new() -> Self {
4293 std::default::Default::default()
4294 }
4295
4296 /// Sets the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4297 ///
4298 /// # Example
4299 /// ```ignore,no_run
4300 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4301 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4302 /// let x = AuxiliaryServicesConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
4303 /// ```
4304 pub fn set_metastore_config<T>(mut self, v: T) -> Self
4305 where
4306 T: std::convert::Into<crate::model::MetastoreConfig>,
4307 {
4308 self.metastore_config = std::option::Option::Some(v.into());
4309 self
4310 }
4311
4312 /// Sets or clears the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4313 ///
4314 /// # Example
4315 /// ```ignore,no_run
4316 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4317 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4318 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4319 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4320 /// ```
4321 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4322 where
4323 T: std::convert::Into<crate::model::MetastoreConfig>,
4324 {
4325 self.metastore_config = v.map(|x| x.into());
4326 self
4327 }
4328
4329 /// Sets the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4330 ///
4331 /// # Example
4332 /// ```ignore,no_run
4333 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4334 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4335 /// let x = AuxiliaryServicesConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
4336 /// ```
4337 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
4338 where
4339 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4340 {
4341 self.spark_history_server_config = std::option::Option::Some(v.into());
4342 self
4343 }
4344
4345 /// Sets or clears the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4346 ///
4347 /// # Example
4348 /// ```ignore,no_run
4349 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4350 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4351 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
4352 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
4353 /// ```
4354 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
4355 where
4356 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4357 {
4358 self.spark_history_server_config = v.map(|x| x.into());
4359 self
4360 }
4361}
4362
4363impl wkt::message::Message for AuxiliaryServicesConfig {
4364 fn typename() -> &'static str {
4365 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryServicesConfig"
4366 }
4367}
4368
4369/// Endpoint config for this cluster
4370#[derive(Clone, Default, PartialEq)]
4371#[non_exhaustive]
4372pub struct EndpointConfig {
4373 /// Output only. The map of port descriptions to URLs. Will only be populated
4374 /// if enable_http_port_access is true.
4375 pub http_ports: std::collections::HashMap<std::string::String, std::string::String>,
4376
4377 /// Optional. If true, enable http access to specific ports on the cluster
4378 /// from external sources. Defaults to false.
4379 pub enable_http_port_access: bool,
4380
4381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4382}
4383
4384impl EndpointConfig {
4385 pub fn new() -> Self {
4386 std::default::Default::default()
4387 }
4388
4389 /// Sets the value of [http_ports][crate::model::EndpointConfig::http_ports].
4390 ///
4391 /// # Example
4392 /// ```ignore,no_run
4393 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4394 /// let x = EndpointConfig::new().set_http_ports([
4395 /// ("key0", "abc"),
4396 /// ("key1", "xyz"),
4397 /// ]);
4398 /// ```
4399 pub fn set_http_ports<T, K, V>(mut self, v: T) -> Self
4400 where
4401 T: std::iter::IntoIterator<Item = (K, V)>,
4402 K: std::convert::Into<std::string::String>,
4403 V: std::convert::Into<std::string::String>,
4404 {
4405 use std::iter::Iterator;
4406 self.http_ports = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4407 self
4408 }
4409
4410 /// Sets the value of [enable_http_port_access][crate::model::EndpointConfig::enable_http_port_access].
4411 ///
4412 /// # Example
4413 /// ```ignore,no_run
4414 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4415 /// let x = EndpointConfig::new().set_enable_http_port_access(true);
4416 /// ```
4417 pub fn set_enable_http_port_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4418 self.enable_http_port_access = v.into();
4419 self
4420 }
4421}
4422
4423impl wkt::message::Message for EndpointConfig {
4424 fn typename() -> &'static str {
4425 "type.googleapis.com/google.cloud.dataproc.v1.EndpointConfig"
4426 }
4427}
4428
4429/// Autoscaling Policy config associated with the cluster.
4430#[derive(Clone, Default, PartialEq)]
4431#[non_exhaustive]
4432pub struct AutoscalingConfig {
4433 /// Optional. The autoscaling policy used by the cluster.
4434 ///
4435 /// Only resource names including projectid and location (region) are valid.
4436 /// Examples:
4437 ///
4438 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4439 /// * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4440 ///
4441 /// Note that the policy must be in the same project and Dataproc region.
4442 pub policy_uri: std::string::String,
4443
4444 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4445}
4446
4447impl AutoscalingConfig {
4448 pub fn new() -> Self {
4449 std::default::Default::default()
4450 }
4451
4452 /// Sets the value of [policy_uri][crate::model::AutoscalingConfig::policy_uri].
4453 ///
4454 /// # Example
4455 /// ```ignore,no_run
4456 /// # use google_cloud_dataproc_v1::model::AutoscalingConfig;
4457 /// let x = AutoscalingConfig::new().set_policy_uri("example");
4458 /// ```
4459 pub fn set_policy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4460 self.policy_uri = v.into();
4461 self
4462 }
4463}
4464
4465impl wkt::message::Message for AutoscalingConfig {
4466 fn typename() -> &'static str {
4467 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingConfig"
4468 }
4469}
4470
4471/// Encryption settings for the cluster.
4472#[derive(Clone, Default, PartialEq)]
4473#[non_exhaustive]
4474pub struct EncryptionConfig {
4475 /// Optional. The Cloud KMS key resource name to use for persistent disk
4476 /// encryption for all instances in the cluster. See [Use CMEK with cluster
4477 /// data]
4478 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4479 /// for more information.
4480 pub gce_pd_kms_key_name: std::string::String,
4481
4482 /// Optional. The Cloud KMS key resource name to use for cluster persistent
4483 /// disk and job argument encryption. See [Use CMEK with cluster data]
4484 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4485 /// for more information.
4486 ///
4487 /// When this key resource name is provided, the following job arguments of
4488 /// the following job types submitted to the cluster are encrypted using CMEK:
4489 ///
4490 /// * [FlinkJob
4491 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
4492 /// * [HadoopJob
4493 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
4494 /// * [SparkJob
4495 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
4496 /// * [SparkRJob
4497 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
4498 /// * [PySparkJob
4499 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
4500 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
4501 /// scriptVariables and queryList.queries
4502 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
4503 /// scriptVariables and queryList.queries
4504 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
4505 /// scriptVariables and queryList.queries
4506 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
4507 /// scriptVariables and queryList.queries
4508 pub kms_key: std::string::String,
4509
4510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4511}
4512
4513impl EncryptionConfig {
4514 pub fn new() -> Self {
4515 std::default::Default::default()
4516 }
4517
4518 /// Sets the value of [gce_pd_kms_key_name][crate::model::EncryptionConfig::gce_pd_kms_key_name].
4519 ///
4520 /// # Example
4521 /// ```ignore,no_run
4522 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4523 /// let x = EncryptionConfig::new().set_gce_pd_kms_key_name("example");
4524 /// ```
4525 pub fn set_gce_pd_kms_key_name<T: std::convert::Into<std::string::String>>(
4526 mut self,
4527 v: T,
4528 ) -> Self {
4529 self.gce_pd_kms_key_name = v.into();
4530 self
4531 }
4532
4533 /// Sets the value of [kms_key][crate::model::EncryptionConfig::kms_key].
4534 ///
4535 /// # Example
4536 /// ```ignore,no_run
4537 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4538 /// let x = EncryptionConfig::new().set_kms_key("example");
4539 /// ```
4540 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4541 self.kms_key = v.into();
4542 self
4543 }
4544}
4545
4546impl wkt::message::Message for EncryptionConfig {
4547 fn typename() -> &'static str {
4548 "type.googleapis.com/google.cloud.dataproc.v1.EncryptionConfig"
4549 }
4550}
4551
4552/// Common config settings for resources of Compute Engine cluster
4553/// instances, applicable to all instances in the cluster.
4554#[derive(Clone, Default, PartialEq)]
4555#[non_exhaustive]
4556pub struct GceClusterConfig {
4557 /// Optional. The Compute Engine zone where the Dataproc cluster will be
4558 /// located. If omitted, the service will pick a zone in the cluster's Compute
4559 /// Engine region. On a get request, zone will always be present.
4560 ///
4561 /// A full URL, partial URI, or short name are valid. Examples:
4562 ///
4563 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]`
4564 /// * `projects/[project_id]/zones/[zone]`
4565 /// * `[zone]`
4566 pub zone_uri: std::string::String,
4567
4568 /// Optional. The Compute Engine network to be used for machine
4569 /// communications. Cannot be specified with subnetwork_uri. If neither
4570 /// `network_uri` nor `subnetwork_uri` is specified, the "default" network of
4571 /// the project is used, if it exists. Cannot be a "Custom Subnet Network" (see
4572 /// [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for
4573 /// more information).
4574 ///
4575 /// A full URL, partial URI, or short name are valid. Examples:
4576 ///
4577 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/networks/default`
4578 /// * `projects/[project_id]/global/networks/default`
4579 /// * `default`
4580 pub network_uri: std::string::String,
4581
4582 /// Optional. The Compute Engine subnetwork to be used for machine
4583 /// communications. Cannot be specified with network_uri.
4584 ///
4585 /// A full URL, partial URI, or short name are valid. Examples:
4586 ///
4587 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/regions/[region]/subnetworks/sub0`
4588 /// * `projects/[project_id]/regions/[region]/subnetworks/sub0`
4589 /// * `sub0`
4590 pub subnetwork_uri: std::string::String,
4591
4592 /// Optional. This setting applies to subnetwork-enabled networks. It is set to
4593 /// `true` by default in clusters created with image versions 2.2.x.
4594 ///
4595 /// When set to `true`:
4596 ///
4597 /// * All cluster VMs have internal IP addresses.
4598 /// * [Google Private Access]
4599 /// (<https://cloud.google.com/vpc/docs/private-google-access>)
4600 /// must be enabled to access Dataproc and other Google Cloud APIs.
4601 /// * Off-cluster dependencies must be configured to be accessible
4602 /// without external IP addresses.
4603 ///
4604 /// When set to `false`:
4605 ///
4606 /// * Cluster VMs are not restricted to internal IP addresses.
4607 /// * Ephemeral external IP addresses are assigned to each cluster VM.
4608 pub internal_ip_only: std::option::Option<bool>,
4609
4610 /// Optional. The type of IPv6 access for a cluster.
4611 pub private_ipv6_google_access: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess,
4612
4613 /// Optional. The [Dataproc service
4614 /// account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc)
4615 /// (also see [VM Data Plane
4616 /// identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity))
4617 /// used by Dataproc cluster VM instances to access Google Cloud Platform
4618 /// services.
4619 ///
4620 /// If not specified, the
4621 /// [Compute Engine default service
4622 /// account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
4623 /// is used.
4624 pub service_account: std::string::String,
4625
4626 /// Optional. The URIs of service account scopes to be included in
4627 /// Compute Engine instances. The following base set of scopes is always
4628 /// included:
4629 ///
4630 /// * <https://www.googleapis.com/auth/cloud.useraccounts.readonly>
4631 /// * <https://www.googleapis.com/auth/devstorage.read_write>
4632 /// * <https://www.googleapis.com/auth/logging.write>
4633 ///
4634 /// If no scopes are specified, the following defaults are also provided:
4635 ///
4636 /// * <https://www.googleapis.com/auth/bigquery>
4637 /// * <https://www.googleapis.com/auth/bigtable.admin.table>
4638 /// * <https://www.googleapis.com/auth/bigtable.data>
4639 /// * <https://www.googleapis.com/auth/devstorage.full_control>
4640 pub service_account_scopes: std::vec::Vec<std::string::String>,
4641
4642 /// The Compute Engine network tags to add to all instances (see [Tagging
4643 /// instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
4644 pub tags: std::vec::Vec<std::string::String>,
4645
4646 /// Optional. The Compute Engine metadata entries to add to all instances (see
4647 /// [Project and instance
4648 /// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
4649 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
4650
4651 /// Optional. Reservation Affinity for consuming Zonal reservation.
4652 pub reservation_affinity: std::option::Option<crate::model::ReservationAffinity>,
4653
4654 /// Optional. Node Group Affinity for sole-tenant clusters.
4655 pub node_group_affinity: std::option::Option<crate::model::NodeGroupAffinity>,
4656
4657 /// Optional. Shielded Instance Config for clusters using [Compute Engine
4658 /// Shielded
4659 /// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
4660 pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
4661
4662 /// Optional. Confidential Instance Config for clusters using [Confidential
4663 /// VMs](https://cloud.google.com/compute/confidential-vm/docs).
4664 pub confidential_instance_config: std::option::Option<crate::model::ConfidentialInstanceConfig>,
4665
4666 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4667}
4668
4669impl GceClusterConfig {
4670 pub fn new() -> Self {
4671 std::default::Default::default()
4672 }
4673
4674 /// Sets the value of [zone_uri][crate::model::GceClusterConfig::zone_uri].
4675 ///
4676 /// # Example
4677 /// ```ignore,no_run
4678 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4679 /// let x = GceClusterConfig::new().set_zone_uri("example");
4680 /// ```
4681 pub fn set_zone_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4682 self.zone_uri = v.into();
4683 self
4684 }
4685
4686 /// Sets the value of [network_uri][crate::model::GceClusterConfig::network_uri].
4687 ///
4688 /// # Example
4689 /// ```ignore,no_run
4690 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4691 /// let x = GceClusterConfig::new().set_network_uri("example");
4692 /// ```
4693 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4694 self.network_uri = v.into();
4695 self
4696 }
4697
4698 /// Sets the value of [subnetwork_uri][crate::model::GceClusterConfig::subnetwork_uri].
4699 ///
4700 /// # Example
4701 /// ```ignore,no_run
4702 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4703 /// let x = GceClusterConfig::new().set_subnetwork_uri("example");
4704 /// ```
4705 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4706 self.subnetwork_uri = v.into();
4707 self
4708 }
4709
4710 /// Sets the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4711 ///
4712 /// # Example
4713 /// ```ignore,no_run
4714 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4715 /// let x = GceClusterConfig::new().set_internal_ip_only(true);
4716 /// ```
4717 pub fn set_internal_ip_only<T>(mut self, v: T) -> Self
4718 where
4719 T: std::convert::Into<bool>,
4720 {
4721 self.internal_ip_only = std::option::Option::Some(v.into());
4722 self
4723 }
4724
4725 /// Sets or clears the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4726 ///
4727 /// # Example
4728 /// ```ignore,no_run
4729 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4730 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(Some(false));
4731 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(None::<bool>);
4732 /// ```
4733 pub fn set_or_clear_internal_ip_only<T>(mut self, v: std::option::Option<T>) -> Self
4734 where
4735 T: std::convert::Into<bool>,
4736 {
4737 self.internal_ip_only = v.map(|x| x.into());
4738 self
4739 }
4740
4741 /// Sets the value of [private_ipv6_google_access][crate::model::GceClusterConfig::private_ipv6_google_access].
4742 ///
4743 /// # Example
4744 /// ```ignore,no_run
4745 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4746 /// use google_cloud_dataproc_v1::model::gce_cluster_config::PrivateIpv6GoogleAccess;
4747 /// let x0 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::InheritFromSubnetwork);
4748 /// let x1 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Outbound);
4749 /// let x2 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Bidirectional);
4750 /// ```
4751 pub fn set_private_ipv6_google_access<
4752 T: std::convert::Into<crate::model::gce_cluster_config::PrivateIpv6GoogleAccess>,
4753 >(
4754 mut self,
4755 v: T,
4756 ) -> Self {
4757 self.private_ipv6_google_access = v.into();
4758 self
4759 }
4760
4761 /// Sets the value of [service_account][crate::model::GceClusterConfig::service_account].
4762 ///
4763 /// # Example
4764 /// ```ignore,no_run
4765 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4766 /// let x = GceClusterConfig::new().set_service_account("example");
4767 /// ```
4768 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4769 self.service_account = v.into();
4770 self
4771 }
4772
4773 /// Sets the value of [service_account_scopes][crate::model::GceClusterConfig::service_account_scopes].
4774 ///
4775 /// # Example
4776 /// ```ignore,no_run
4777 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4778 /// let x = GceClusterConfig::new().set_service_account_scopes(["a", "b", "c"]);
4779 /// ```
4780 pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
4781 where
4782 T: std::iter::IntoIterator<Item = V>,
4783 V: std::convert::Into<std::string::String>,
4784 {
4785 use std::iter::Iterator;
4786 self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
4787 self
4788 }
4789
4790 /// Sets the value of [tags][crate::model::GceClusterConfig::tags].
4791 ///
4792 /// # Example
4793 /// ```ignore,no_run
4794 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4795 /// let x = GceClusterConfig::new().set_tags(["a", "b", "c"]);
4796 /// ```
4797 pub fn set_tags<T, V>(mut self, v: T) -> Self
4798 where
4799 T: std::iter::IntoIterator<Item = V>,
4800 V: std::convert::Into<std::string::String>,
4801 {
4802 use std::iter::Iterator;
4803 self.tags = v.into_iter().map(|i| i.into()).collect();
4804 self
4805 }
4806
4807 /// Sets the value of [metadata][crate::model::GceClusterConfig::metadata].
4808 ///
4809 /// # Example
4810 /// ```ignore,no_run
4811 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4812 /// let x = GceClusterConfig::new().set_metadata([
4813 /// ("key0", "abc"),
4814 /// ("key1", "xyz"),
4815 /// ]);
4816 /// ```
4817 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
4818 where
4819 T: std::iter::IntoIterator<Item = (K, V)>,
4820 K: std::convert::Into<std::string::String>,
4821 V: std::convert::Into<std::string::String>,
4822 {
4823 use std::iter::Iterator;
4824 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4825 self
4826 }
4827
4828 /// Sets the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4829 ///
4830 /// # Example
4831 /// ```ignore,no_run
4832 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4833 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4834 /// let x = GceClusterConfig::new().set_reservation_affinity(ReservationAffinity::default()/* use setters */);
4835 /// ```
4836 pub fn set_reservation_affinity<T>(mut self, v: T) -> Self
4837 where
4838 T: std::convert::Into<crate::model::ReservationAffinity>,
4839 {
4840 self.reservation_affinity = std::option::Option::Some(v.into());
4841 self
4842 }
4843
4844 /// Sets or clears the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4845 ///
4846 /// # Example
4847 /// ```ignore,no_run
4848 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4849 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4850 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(Some(ReservationAffinity::default()/* use setters */));
4851 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(None::<ReservationAffinity>);
4852 /// ```
4853 pub fn set_or_clear_reservation_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4854 where
4855 T: std::convert::Into<crate::model::ReservationAffinity>,
4856 {
4857 self.reservation_affinity = v.map(|x| x.into());
4858 self
4859 }
4860
4861 /// Sets the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4862 ///
4863 /// # Example
4864 /// ```ignore,no_run
4865 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4866 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4867 /// let x = GceClusterConfig::new().set_node_group_affinity(NodeGroupAffinity::default()/* use setters */);
4868 /// ```
4869 pub fn set_node_group_affinity<T>(mut self, v: T) -> Self
4870 where
4871 T: std::convert::Into<crate::model::NodeGroupAffinity>,
4872 {
4873 self.node_group_affinity = std::option::Option::Some(v.into());
4874 self
4875 }
4876
4877 /// Sets or clears the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4878 ///
4879 /// # Example
4880 /// ```ignore,no_run
4881 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4882 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4883 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(Some(NodeGroupAffinity::default()/* use setters */));
4884 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(None::<NodeGroupAffinity>);
4885 /// ```
4886 pub fn set_or_clear_node_group_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4887 where
4888 T: std::convert::Into<crate::model::NodeGroupAffinity>,
4889 {
4890 self.node_group_affinity = v.map(|x| x.into());
4891 self
4892 }
4893
4894 /// Sets the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4895 ///
4896 /// # Example
4897 /// ```ignore,no_run
4898 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4899 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4900 /// let x = GceClusterConfig::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
4901 /// ```
4902 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
4903 where
4904 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4905 {
4906 self.shielded_instance_config = std::option::Option::Some(v.into());
4907 self
4908 }
4909
4910 /// Sets or clears the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4911 ///
4912 /// # Example
4913 /// ```ignore,no_run
4914 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4915 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4916 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
4917 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
4918 /// ```
4919 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4920 where
4921 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4922 {
4923 self.shielded_instance_config = v.map(|x| x.into());
4924 self
4925 }
4926
4927 /// Sets the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4928 ///
4929 /// # Example
4930 /// ```ignore,no_run
4931 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4932 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4933 /// let x = GceClusterConfig::new().set_confidential_instance_config(ConfidentialInstanceConfig::default()/* use setters */);
4934 /// ```
4935 pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
4936 where
4937 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4938 {
4939 self.confidential_instance_config = std::option::Option::Some(v.into());
4940 self
4941 }
4942
4943 /// Sets or clears the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4944 ///
4945 /// # Example
4946 /// ```ignore,no_run
4947 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4948 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4949 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(Some(ConfidentialInstanceConfig::default()/* use setters */));
4950 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(None::<ConfidentialInstanceConfig>);
4951 /// ```
4952 pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4953 where
4954 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4955 {
4956 self.confidential_instance_config = v.map(|x| x.into());
4957 self
4958 }
4959}
4960
4961impl wkt::message::Message for GceClusterConfig {
4962 fn typename() -> &'static str {
4963 "type.googleapis.com/google.cloud.dataproc.v1.GceClusterConfig"
4964 }
4965}
4966
4967/// Defines additional types related to [GceClusterConfig].
4968pub mod gce_cluster_config {
4969 #[allow(unused_imports)]
4970 use super::*;
4971
4972 /// `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes
4973 /// can communicate with Google Services through gRPC over IPv6.
4974 /// These values are directly mapped to corresponding values in the
4975 /// [Compute Engine Instance
4976 /// fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
4977 ///
4978 /// # Working with unknown values
4979 ///
4980 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4981 /// additional enum variants at any time. Adding new variants is not considered
4982 /// a breaking change. Applications should write their code in anticipation of:
4983 ///
4984 /// - New values appearing in future releases of the client library, **and**
4985 /// - New values received dynamically, without application changes.
4986 ///
4987 /// Please consult the [Working with enums] section in the user guide for some
4988 /// guidelines.
4989 ///
4990 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4991 #[derive(Clone, Debug, PartialEq)]
4992 #[non_exhaustive]
4993 pub enum PrivateIpv6GoogleAccess {
4994 /// If unspecified, Compute Engine default behavior will apply, which
4995 /// is the same as
4996 /// [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK].
4997 ///
4998 /// [google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess::InheritFromSubnetwork
4999 Unspecified,
5000 /// Private access to and from Google Services configuration
5001 /// inherited from the subnetwork configuration. This is the
5002 /// default Compute Engine behavior.
5003 InheritFromSubnetwork,
5004 /// Enables outbound private IPv6 access to Google Services from the Dataproc
5005 /// cluster.
5006 Outbound,
5007 /// Enables bidirectional private IPv6 access between Google Services and the
5008 /// Dataproc cluster.
5009 Bidirectional,
5010 /// If set, the enum was initialized with an unknown value.
5011 ///
5012 /// Applications can examine the value using [PrivateIpv6GoogleAccess::value] or
5013 /// [PrivateIpv6GoogleAccess::name].
5014 UnknownValue(private_ipv_6_google_access::UnknownValue),
5015 }
5016
5017 #[doc(hidden)]
5018 pub mod private_ipv_6_google_access {
5019 #[allow(unused_imports)]
5020 use super::*;
5021 #[derive(Clone, Debug, PartialEq)]
5022 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5023 }
5024
5025 impl PrivateIpv6GoogleAccess {
5026 /// Gets the enum value.
5027 ///
5028 /// Returns `None` if the enum contains an unknown value deserialized from
5029 /// the string representation of enums.
5030 pub fn value(&self) -> std::option::Option<i32> {
5031 match self {
5032 Self::Unspecified => std::option::Option::Some(0),
5033 Self::InheritFromSubnetwork => std::option::Option::Some(1),
5034 Self::Outbound => std::option::Option::Some(2),
5035 Self::Bidirectional => std::option::Option::Some(3),
5036 Self::UnknownValue(u) => u.0.value(),
5037 }
5038 }
5039
5040 /// Gets the enum value as a string.
5041 ///
5042 /// Returns `None` if the enum contains an unknown value deserialized from
5043 /// the integer representation of enums.
5044 pub fn name(&self) -> std::option::Option<&str> {
5045 match self {
5046 Self::Unspecified => {
5047 std::option::Option::Some("PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED")
5048 }
5049 Self::InheritFromSubnetwork => std::option::Option::Some("INHERIT_FROM_SUBNETWORK"),
5050 Self::Outbound => std::option::Option::Some("OUTBOUND"),
5051 Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
5052 Self::UnknownValue(u) => u.0.name(),
5053 }
5054 }
5055 }
5056
5057 impl std::default::Default for PrivateIpv6GoogleAccess {
5058 fn default() -> Self {
5059 use std::convert::From;
5060 Self::from(0)
5061 }
5062 }
5063
5064 impl std::fmt::Display for PrivateIpv6GoogleAccess {
5065 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5066 wkt::internal::display_enum(f, self.name(), self.value())
5067 }
5068 }
5069
5070 impl std::convert::From<i32> for PrivateIpv6GoogleAccess {
5071 fn from(value: i32) -> Self {
5072 match value {
5073 0 => Self::Unspecified,
5074 1 => Self::InheritFromSubnetwork,
5075 2 => Self::Outbound,
5076 3 => Self::Bidirectional,
5077 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5078 wkt::internal::UnknownEnumValue::Integer(value),
5079 )),
5080 }
5081 }
5082 }
5083
5084 impl std::convert::From<&str> for PrivateIpv6GoogleAccess {
5085 fn from(value: &str) -> Self {
5086 use std::string::ToString;
5087 match value {
5088 "PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED" => Self::Unspecified,
5089 "INHERIT_FROM_SUBNETWORK" => Self::InheritFromSubnetwork,
5090 "OUTBOUND" => Self::Outbound,
5091 "BIDIRECTIONAL" => Self::Bidirectional,
5092 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5093 wkt::internal::UnknownEnumValue::String(value.to_string()),
5094 )),
5095 }
5096 }
5097 }
5098
5099 impl serde::ser::Serialize for PrivateIpv6GoogleAccess {
5100 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5101 where
5102 S: serde::Serializer,
5103 {
5104 match self {
5105 Self::Unspecified => serializer.serialize_i32(0),
5106 Self::InheritFromSubnetwork => serializer.serialize_i32(1),
5107 Self::Outbound => serializer.serialize_i32(2),
5108 Self::Bidirectional => serializer.serialize_i32(3),
5109 Self::UnknownValue(u) => u.0.serialize(serializer),
5110 }
5111 }
5112 }
5113
5114 impl<'de> serde::de::Deserialize<'de> for PrivateIpv6GoogleAccess {
5115 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5116 where
5117 D: serde::Deserializer<'de>,
5118 {
5119 deserializer.deserialize_any(
5120 wkt::internal::EnumVisitor::<PrivateIpv6GoogleAccess>::new(
5121 ".google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess",
5122 ),
5123 )
5124 }
5125 }
5126}
5127
5128/// Node Group Affinity for clusters using sole-tenant node groups.
5129/// **The Dataproc `NodeGroupAffinity` resource is not related to the
5130/// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.**
5131///
5132/// [google.cloud.dataproc.v1.NodeGroup]: crate::model::NodeGroup
5133#[derive(Clone, Default, PartialEq)]
5134#[non_exhaustive]
5135pub struct NodeGroupAffinity {
5136 /// Required. The URI of a
5137 /// sole-tenant [node group
5138 /// resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups)
5139 /// that the cluster will be created on.
5140 ///
5141 /// A full URL, partial URI, or node group name are valid. Examples:
5142 ///
5143 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/nodeGroups/node-group-1`
5144 /// * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1`
5145 /// * `node-group-1`
5146 pub node_group_uri: std::string::String,
5147
5148 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5149}
5150
5151impl NodeGroupAffinity {
5152 pub fn new() -> Self {
5153 std::default::Default::default()
5154 }
5155
5156 /// Sets the value of [node_group_uri][crate::model::NodeGroupAffinity::node_group_uri].
5157 ///
5158 /// # Example
5159 /// ```ignore,no_run
5160 /// # use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5161 /// let x = NodeGroupAffinity::new().set_node_group_uri("example");
5162 /// ```
5163 pub fn set_node_group_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5164 self.node_group_uri = v.into();
5165 self
5166 }
5167}
5168
5169impl wkt::message::Message for NodeGroupAffinity {
5170 fn typename() -> &'static str {
5171 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupAffinity"
5172 }
5173}
5174
5175/// Shielded Instance Config for clusters using [Compute Engine Shielded
5176/// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
5177#[derive(Clone, Default, PartialEq)]
5178#[non_exhaustive]
5179pub struct ShieldedInstanceConfig {
5180 /// Optional. Defines whether instances have Secure Boot enabled.
5181 pub enable_secure_boot: std::option::Option<bool>,
5182
5183 /// Optional. Defines whether instances have the vTPM enabled.
5184 pub enable_vtpm: std::option::Option<bool>,
5185
5186 /// Optional. Defines whether instances have integrity monitoring enabled.
5187 pub enable_integrity_monitoring: std::option::Option<bool>,
5188
5189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5190}
5191
5192impl ShieldedInstanceConfig {
5193 pub fn new() -> Self {
5194 std::default::Default::default()
5195 }
5196
5197 /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5198 ///
5199 /// # Example
5200 /// ```ignore,no_run
5201 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5202 /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
5203 /// ```
5204 pub fn set_enable_secure_boot<T>(mut self, v: T) -> Self
5205 where
5206 T: std::convert::Into<bool>,
5207 {
5208 self.enable_secure_boot = std::option::Option::Some(v.into());
5209 self
5210 }
5211
5212 /// Sets or clears the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5213 ///
5214 /// # Example
5215 /// ```ignore,no_run
5216 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5217 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(Some(false));
5218 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(None::<bool>);
5219 /// ```
5220 pub fn set_or_clear_enable_secure_boot<T>(mut self, v: std::option::Option<T>) -> Self
5221 where
5222 T: std::convert::Into<bool>,
5223 {
5224 self.enable_secure_boot = v.map(|x| x.into());
5225 self
5226 }
5227
5228 /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5229 ///
5230 /// # Example
5231 /// ```ignore,no_run
5232 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5233 /// let x = ShieldedInstanceConfig::new().set_enable_vtpm(true);
5234 /// ```
5235 pub fn set_enable_vtpm<T>(mut self, v: T) -> Self
5236 where
5237 T: std::convert::Into<bool>,
5238 {
5239 self.enable_vtpm = std::option::Option::Some(v.into());
5240 self
5241 }
5242
5243 /// Sets or clears the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5244 ///
5245 /// # Example
5246 /// ```ignore,no_run
5247 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5248 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(Some(false));
5249 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(None::<bool>);
5250 /// ```
5251 pub fn set_or_clear_enable_vtpm<T>(mut self, v: std::option::Option<T>) -> Self
5252 where
5253 T: std::convert::Into<bool>,
5254 {
5255 self.enable_vtpm = v.map(|x| x.into());
5256 self
5257 }
5258
5259 /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5260 ///
5261 /// # Example
5262 /// ```ignore,no_run
5263 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5264 /// let x = ShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
5265 /// ```
5266 pub fn set_enable_integrity_monitoring<T>(mut self, v: T) -> Self
5267 where
5268 T: std::convert::Into<bool>,
5269 {
5270 self.enable_integrity_monitoring = std::option::Option::Some(v.into());
5271 self
5272 }
5273
5274 /// Sets or clears the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5275 ///
5276 /// # Example
5277 /// ```ignore,no_run
5278 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5279 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(Some(false));
5280 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(None::<bool>);
5281 /// ```
5282 pub fn set_or_clear_enable_integrity_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
5283 where
5284 T: std::convert::Into<bool>,
5285 {
5286 self.enable_integrity_monitoring = v.map(|x| x.into());
5287 self
5288 }
5289}
5290
5291impl wkt::message::Message for ShieldedInstanceConfig {
5292 fn typename() -> &'static str {
5293 "type.googleapis.com/google.cloud.dataproc.v1.ShieldedInstanceConfig"
5294 }
5295}
5296
5297/// Confidential Instance Config for clusters using [Confidential
5298/// VMs](https://cloud.google.com/compute/confidential-vm/docs)
5299#[derive(Clone, Default, PartialEq)]
5300#[non_exhaustive]
5301pub struct ConfidentialInstanceConfig {
5302 /// Optional. Defines whether the instance should have confidential compute
5303 /// enabled.
5304 pub enable_confidential_compute: bool,
5305
5306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5307}
5308
5309impl ConfidentialInstanceConfig {
5310 pub fn new() -> Self {
5311 std::default::Default::default()
5312 }
5313
5314 /// Sets the value of [enable_confidential_compute][crate::model::ConfidentialInstanceConfig::enable_confidential_compute].
5315 ///
5316 /// # Example
5317 /// ```ignore,no_run
5318 /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5319 /// let x = ConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
5320 /// ```
5321 pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5322 self.enable_confidential_compute = v.into();
5323 self
5324 }
5325}
5326
5327impl wkt::message::Message for ConfidentialInstanceConfig {
5328 fn typename() -> &'static str {
5329 "type.googleapis.com/google.cloud.dataproc.v1.ConfidentialInstanceConfig"
5330 }
5331}
5332
5333/// The config settings for Compute Engine resources in
5334/// an instance group, such as a master or worker group.
5335#[derive(Clone, Default, PartialEq)]
5336#[non_exhaustive]
5337pub struct InstanceGroupConfig {
5338 /// Optional. The number of VM instances in the instance group.
5339 /// For [HA
5340 /// cluster](/dataproc/docs/concepts/configuring-clusters/high-availability)
5341 /// [master_config](#FIELDS.master_config) groups, **must be set to 3**.
5342 /// For standard cluster [master_config](#FIELDS.master_config) groups,
5343 /// **must be set to 1**.
5344 pub num_instances: i32,
5345
5346 /// Output only. The list of instance names. Dataproc derives the names
5347 /// from `cluster_name`, `num_instances`, and the instance group.
5348 pub instance_names: std::vec::Vec<std::string::String>,
5349
5350 /// Output only. List of references to Compute Engine instances.
5351 pub instance_references: std::vec::Vec<crate::model::InstanceReference>,
5352
5353 /// Optional. The Compute Engine image resource used for cluster instances.
5354 ///
5355 /// The URI can represent an image or image family.
5356 ///
5357 /// Image examples:
5358 ///
5359 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/[image-id]`
5360 /// * `projects/[project_id]/global/images/[image-id]`
5361 /// * `image-id`
5362 ///
5363 /// Image family examples. Dataproc will use the most recent
5364 /// image from the family:
5365 ///
5366 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/family/[custom-image-family-name]`
5367 /// * `projects/[project_id]/global/images/family/[custom-image-family-name]`
5368 ///
5369 /// If the URI is unspecified, it will be inferred from
5370 /// `SoftwareConfig.image_version` or the system default.
5371 pub image_uri: std::string::String,
5372
5373 /// Optional. The Compute Engine machine type used for cluster instances.
5374 ///
5375 /// A full URL, partial URI, or short name are valid. Examples:
5376 ///
5377 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5378 /// * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5379 /// * `n1-standard-2`
5380 ///
5381 /// **Auto Zone Exception**: If you are using the Dataproc
5382 /// [Auto Zone
5383 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
5384 /// feature, you must use the short name of the machine type
5385 /// resource, for example, `n1-standard-2`.
5386 pub machine_type_uri: std::string::String,
5387
5388 /// Optional. Disk option config settings.
5389 pub disk_config: std::option::Option<crate::model::DiskConfig>,
5390
5391 /// Output only. Specifies that this instance group contains preemptible
5392 /// instances.
5393 pub is_preemptible: bool,
5394
5395 /// Optional. Specifies the preemptibility of the instance group.
5396 ///
5397 /// The default value for master and worker groups is
5398 /// `NON_PREEMPTIBLE`. This default cannot be changed.
5399 ///
5400 /// The default value for secondary instances is
5401 /// `PREEMPTIBLE`.
5402 pub preemptibility: crate::model::instance_group_config::Preemptibility,
5403
5404 /// Output only. The config for Compute Engine Instance Group
5405 /// Manager that manages this group.
5406 /// This is only used for preemptible instance groups.
5407 pub managed_group_config: std::option::Option<crate::model::ManagedGroupConfig>,
5408
5409 /// Optional. The Compute Engine accelerator configuration for these
5410 /// instances.
5411 pub accelerators: std::vec::Vec<crate::model::AcceleratorConfig>,
5412
5413 /// Optional. Specifies the minimum cpu platform for the Instance Group.
5414 /// See [Dataproc -> Minimum CPU
5415 /// Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
5416 pub min_cpu_platform: std::string::String,
5417
5418 /// Optional. The minimum number of primary worker instances to create.
5419 /// If `min_num_instances` is set, cluster creation will succeed if
5420 /// the number of primary workers created is at least equal to the
5421 /// `min_num_instances` number.
5422 ///
5423 /// Example: Cluster creation request with `num_instances` = `5` and
5424 /// `min_num_instances` = `3`:
5425 ///
5426 /// * If 4 VMs are created and 1 instance fails,
5427 /// the failed VM is deleted. The cluster is
5428 /// resized to 4 instances and placed in a `RUNNING` state.
5429 /// * If 2 instances are created and 3 instances fail,
5430 /// the cluster in placed in an `ERROR` state. The failed VMs
5431 /// are not deleted.
5432 pub min_num_instances: i32,
5433
5434 /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and
5435 /// provisioning models.
5436 pub instance_flexibility_policy: std::option::Option<crate::model::InstanceFlexibilityPolicy>,
5437
5438 /// Optional. Configuration to handle the startup of instances during cluster
5439 /// create and update process.
5440 pub startup_config: std::option::Option<crate::model::StartupConfig>,
5441
5442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5443}
5444
5445impl InstanceGroupConfig {
5446 pub fn new() -> Self {
5447 std::default::Default::default()
5448 }
5449
5450 /// Sets the value of [num_instances][crate::model::InstanceGroupConfig::num_instances].
5451 ///
5452 /// # Example
5453 /// ```ignore,no_run
5454 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5455 /// let x = InstanceGroupConfig::new().set_num_instances(42);
5456 /// ```
5457 pub fn set_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5458 self.num_instances = v.into();
5459 self
5460 }
5461
5462 /// Sets the value of [instance_names][crate::model::InstanceGroupConfig::instance_names].
5463 ///
5464 /// # Example
5465 /// ```ignore,no_run
5466 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5467 /// let x = InstanceGroupConfig::new().set_instance_names(["a", "b", "c"]);
5468 /// ```
5469 pub fn set_instance_names<T, V>(mut self, v: T) -> Self
5470 where
5471 T: std::iter::IntoIterator<Item = V>,
5472 V: std::convert::Into<std::string::String>,
5473 {
5474 use std::iter::Iterator;
5475 self.instance_names = v.into_iter().map(|i| i.into()).collect();
5476 self
5477 }
5478
5479 /// Sets the value of [instance_references][crate::model::InstanceGroupConfig::instance_references].
5480 ///
5481 /// # Example
5482 /// ```ignore,no_run
5483 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5484 /// use google_cloud_dataproc_v1::model::InstanceReference;
5485 /// let x = InstanceGroupConfig::new()
5486 /// .set_instance_references([
5487 /// InstanceReference::default()/* use setters */,
5488 /// InstanceReference::default()/* use (different) setters */,
5489 /// ]);
5490 /// ```
5491 pub fn set_instance_references<T, V>(mut self, v: T) -> Self
5492 where
5493 T: std::iter::IntoIterator<Item = V>,
5494 V: std::convert::Into<crate::model::InstanceReference>,
5495 {
5496 use std::iter::Iterator;
5497 self.instance_references = v.into_iter().map(|i| i.into()).collect();
5498 self
5499 }
5500
5501 /// Sets the value of [image_uri][crate::model::InstanceGroupConfig::image_uri].
5502 ///
5503 /// # Example
5504 /// ```ignore,no_run
5505 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5506 /// let x = InstanceGroupConfig::new().set_image_uri("example");
5507 /// ```
5508 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5509 self.image_uri = v.into();
5510 self
5511 }
5512
5513 /// Sets the value of [machine_type_uri][crate::model::InstanceGroupConfig::machine_type_uri].
5514 ///
5515 /// # Example
5516 /// ```ignore,no_run
5517 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5518 /// let x = InstanceGroupConfig::new().set_machine_type_uri("example");
5519 /// ```
5520 pub fn set_machine_type_uri<T: std::convert::Into<std::string::String>>(
5521 mut self,
5522 v: T,
5523 ) -> Self {
5524 self.machine_type_uri = v.into();
5525 self
5526 }
5527
5528 /// Sets the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5529 ///
5530 /// # Example
5531 /// ```ignore,no_run
5532 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5533 /// use google_cloud_dataproc_v1::model::DiskConfig;
5534 /// let x = InstanceGroupConfig::new().set_disk_config(DiskConfig::default()/* use setters */);
5535 /// ```
5536 pub fn set_disk_config<T>(mut self, v: T) -> Self
5537 where
5538 T: std::convert::Into<crate::model::DiskConfig>,
5539 {
5540 self.disk_config = std::option::Option::Some(v.into());
5541 self
5542 }
5543
5544 /// Sets or clears the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5545 ///
5546 /// # Example
5547 /// ```ignore,no_run
5548 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5549 /// use google_cloud_dataproc_v1::model::DiskConfig;
5550 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
5551 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(None::<DiskConfig>);
5552 /// ```
5553 pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
5554 where
5555 T: std::convert::Into<crate::model::DiskConfig>,
5556 {
5557 self.disk_config = v.map(|x| x.into());
5558 self
5559 }
5560
5561 /// Sets the value of [is_preemptible][crate::model::InstanceGroupConfig::is_preemptible].
5562 ///
5563 /// # Example
5564 /// ```ignore,no_run
5565 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5566 /// let x = InstanceGroupConfig::new().set_is_preemptible(true);
5567 /// ```
5568 pub fn set_is_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5569 self.is_preemptible = v.into();
5570 self
5571 }
5572
5573 /// Sets the value of [preemptibility][crate::model::InstanceGroupConfig::preemptibility].
5574 ///
5575 /// # Example
5576 /// ```ignore,no_run
5577 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5578 /// use google_cloud_dataproc_v1::model::instance_group_config::Preemptibility;
5579 /// let x0 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::NonPreemptible);
5580 /// let x1 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Preemptible);
5581 /// let x2 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Spot);
5582 /// ```
5583 pub fn set_preemptibility<
5584 T: std::convert::Into<crate::model::instance_group_config::Preemptibility>,
5585 >(
5586 mut self,
5587 v: T,
5588 ) -> Self {
5589 self.preemptibility = v.into();
5590 self
5591 }
5592
5593 /// Sets the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5594 ///
5595 /// # Example
5596 /// ```ignore,no_run
5597 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5598 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5599 /// let x = InstanceGroupConfig::new().set_managed_group_config(ManagedGroupConfig::default()/* use setters */);
5600 /// ```
5601 pub fn set_managed_group_config<T>(mut self, v: T) -> Self
5602 where
5603 T: std::convert::Into<crate::model::ManagedGroupConfig>,
5604 {
5605 self.managed_group_config = std::option::Option::Some(v.into());
5606 self
5607 }
5608
5609 /// Sets or clears the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5610 ///
5611 /// # Example
5612 /// ```ignore,no_run
5613 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5614 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5615 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(Some(ManagedGroupConfig::default()/* use setters */));
5616 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(None::<ManagedGroupConfig>);
5617 /// ```
5618 pub fn set_or_clear_managed_group_config<T>(mut self, v: std::option::Option<T>) -> Self
5619 where
5620 T: std::convert::Into<crate::model::ManagedGroupConfig>,
5621 {
5622 self.managed_group_config = v.map(|x| x.into());
5623 self
5624 }
5625
5626 /// Sets the value of [accelerators][crate::model::InstanceGroupConfig::accelerators].
5627 ///
5628 /// # Example
5629 /// ```ignore,no_run
5630 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5631 /// use google_cloud_dataproc_v1::model::AcceleratorConfig;
5632 /// let x = InstanceGroupConfig::new()
5633 /// .set_accelerators([
5634 /// AcceleratorConfig::default()/* use setters */,
5635 /// AcceleratorConfig::default()/* use (different) setters */,
5636 /// ]);
5637 /// ```
5638 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
5639 where
5640 T: std::iter::IntoIterator<Item = V>,
5641 V: std::convert::Into<crate::model::AcceleratorConfig>,
5642 {
5643 use std::iter::Iterator;
5644 self.accelerators = v.into_iter().map(|i| i.into()).collect();
5645 self
5646 }
5647
5648 /// Sets the value of [min_cpu_platform][crate::model::InstanceGroupConfig::min_cpu_platform].
5649 ///
5650 /// # Example
5651 /// ```ignore,no_run
5652 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5653 /// let x = InstanceGroupConfig::new().set_min_cpu_platform("example");
5654 /// ```
5655 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
5656 mut self,
5657 v: T,
5658 ) -> Self {
5659 self.min_cpu_platform = v.into();
5660 self
5661 }
5662
5663 /// Sets the value of [min_num_instances][crate::model::InstanceGroupConfig::min_num_instances].
5664 ///
5665 /// # Example
5666 /// ```ignore,no_run
5667 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5668 /// let x = InstanceGroupConfig::new().set_min_num_instances(42);
5669 /// ```
5670 pub fn set_min_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5671 self.min_num_instances = v.into();
5672 self
5673 }
5674
5675 /// Sets the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5676 ///
5677 /// # Example
5678 /// ```ignore,no_run
5679 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5680 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5681 /// let x = InstanceGroupConfig::new().set_instance_flexibility_policy(InstanceFlexibilityPolicy::default()/* use setters */);
5682 /// ```
5683 pub fn set_instance_flexibility_policy<T>(mut self, v: T) -> Self
5684 where
5685 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5686 {
5687 self.instance_flexibility_policy = std::option::Option::Some(v.into());
5688 self
5689 }
5690
5691 /// Sets or clears the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5692 ///
5693 /// # Example
5694 /// ```ignore,no_run
5695 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5696 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5697 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(Some(InstanceFlexibilityPolicy::default()/* use setters */));
5698 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(None::<InstanceFlexibilityPolicy>);
5699 /// ```
5700 pub fn set_or_clear_instance_flexibility_policy<T>(mut self, v: std::option::Option<T>) -> Self
5701 where
5702 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5703 {
5704 self.instance_flexibility_policy = v.map(|x| x.into());
5705 self
5706 }
5707
5708 /// Sets the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5709 ///
5710 /// # Example
5711 /// ```ignore,no_run
5712 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5713 /// use google_cloud_dataproc_v1::model::StartupConfig;
5714 /// let x = InstanceGroupConfig::new().set_startup_config(StartupConfig::default()/* use setters */);
5715 /// ```
5716 pub fn set_startup_config<T>(mut self, v: T) -> Self
5717 where
5718 T: std::convert::Into<crate::model::StartupConfig>,
5719 {
5720 self.startup_config = std::option::Option::Some(v.into());
5721 self
5722 }
5723
5724 /// Sets or clears the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5725 ///
5726 /// # Example
5727 /// ```ignore,no_run
5728 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5729 /// use google_cloud_dataproc_v1::model::StartupConfig;
5730 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(Some(StartupConfig::default()/* use setters */));
5731 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(None::<StartupConfig>);
5732 /// ```
5733 pub fn set_or_clear_startup_config<T>(mut self, v: std::option::Option<T>) -> Self
5734 where
5735 T: std::convert::Into<crate::model::StartupConfig>,
5736 {
5737 self.startup_config = v.map(|x| x.into());
5738 self
5739 }
5740}
5741
5742impl wkt::message::Message for InstanceGroupConfig {
5743 fn typename() -> &'static str {
5744 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupConfig"
5745 }
5746}
5747
5748/// Defines additional types related to [InstanceGroupConfig].
5749pub mod instance_group_config {
5750 #[allow(unused_imports)]
5751 use super::*;
5752
5753 /// Controls the use of preemptible instances within the group.
5754 ///
5755 /// # Working with unknown values
5756 ///
5757 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5758 /// additional enum variants at any time. Adding new variants is not considered
5759 /// a breaking change. Applications should write their code in anticipation of:
5760 ///
5761 /// - New values appearing in future releases of the client library, **and**
5762 /// - New values received dynamically, without application changes.
5763 ///
5764 /// Please consult the [Working with enums] section in the user guide for some
5765 /// guidelines.
5766 ///
5767 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5768 #[derive(Clone, Debug, PartialEq)]
5769 #[non_exhaustive]
5770 pub enum Preemptibility {
5771 /// Preemptibility is unspecified, the system will choose the
5772 /// appropriate setting for each instance group.
5773 Unspecified,
5774 /// Instances are non-preemptible.
5775 ///
5776 /// This option is allowed for all instance groups and is the only valid
5777 /// value for Master and Worker instance groups.
5778 NonPreemptible,
5779 /// Instances are [preemptible]
5780 /// (<https://cloud.google.com/compute/docs/instances/preemptible>).
5781 ///
5782 /// This option is allowed only for [secondary worker]
5783 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5784 /// groups.
5785 Preemptible,
5786 /// Instances are [Spot VMs]
5787 /// (<https://cloud.google.com/compute/docs/instances/spot>).
5788 ///
5789 /// This option is allowed only for [secondary worker]
5790 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5791 /// groups. Spot VMs are the latest version of [preemptible VMs]
5792 /// (<https://cloud.google.com/compute/docs/instances/preemptible>), and
5793 /// provide additional features.
5794 Spot,
5795 /// If set, the enum was initialized with an unknown value.
5796 ///
5797 /// Applications can examine the value using [Preemptibility::value] or
5798 /// [Preemptibility::name].
5799 UnknownValue(preemptibility::UnknownValue),
5800 }
5801
5802 #[doc(hidden)]
5803 pub mod preemptibility {
5804 #[allow(unused_imports)]
5805 use super::*;
5806 #[derive(Clone, Debug, PartialEq)]
5807 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5808 }
5809
5810 impl Preemptibility {
5811 /// Gets the enum value.
5812 ///
5813 /// Returns `None` if the enum contains an unknown value deserialized from
5814 /// the string representation of enums.
5815 pub fn value(&self) -> std::option::Option<i32> {
5816 match self {
5817 Self::Unspecified => std::option::Option::Some(0),
5818 Self::NonPreemptible => std::option::Option::Some(1),
5819 Self::Preemptible => std::option::Option::Some(2),
5820 Self::Spot => std::option::Option::Some(3),
5821 Self::UnknownValue(u) => u.0.value(),
5822 }
5823 }
5824
5825 /// Gets the enum value as a string.
5826 ///
5827 /// Returns `None` if the enum contains an unknown value deserialized from
5828 /// the integer representation of enums.
5829 pub fn name(&self) -> std::option::Option<&str> {
5830 match self {
5831 Self::Unspecified => std::option::Option::Some("PREEMPTIBILITY_UNSPECIFIED"),
5832 Self::NonPreemptible => std::option::Option::Some("NON_PREEMPTIBLE"),
5833 Self::Preemptible => std::option::Option::Some("PREEMPTIBLE"),
5834 Self::Spot => std::option::Option::Some("SPOT"),
5835 Self::UnknownValue(u) => u.0.name(),
5836 }
5837 }
5838 }
5839
5840 impl std::default::Default for Preemptibility {
5841 fn default() -> Self {
5842 use std::convert::From;
5843 Self::from(0)
5844 }
5845 }
5846
5847 impl std::fmt::Display for Preemptibility {
5848 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5849 wkt::internal::display_enum(f, self.name(), self.value())
5850 }
5851 }
5852
5853 impl std::convert::From<i32> for Preemptibility {
5854 fn from(value: i32) -> Self {
5855 match value {
5856 0 => Self::Unspecified,
5857 1 => Self::NonPreemptible,
5858 2 => Self::Preemptible,
5859 3 => Self::Spot,
5860 _ => Self::UnknownValue(preemptibility::UnknownValue(
5861 wkt::internal::UnknownEnumValue::Integer(value),
5862 )),
5863 }
5864 }
5865 }
5866
5867 impl std::convert::From<&str> for Preemptibility {
5868 fn from(value: &str) -> Self {
5869 use std::string::ToString;
5870 match value {
5871 "PREEMPTIBILITY_UNSPECIFIED" => Self::Unspecified,
5872 "NON_PREEMPTIBLE" => Self::NonPreemptible,
5873 "PREEMPTIBLE" => Self::Preemptible,
5874 "SPOT" => Self::Spot,
5875 _ => Self::UnknownValue(preemptibility::UnknownValue(
5876 wkt::internal::UnknownEnumValue::String(value.to_string()),
5877 )),
5878 }
5879 }
5880 }
5881
5882 impl serde::ser::Serialize for Preemptibility {
5883 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5884 where
5885 S: serde::Serializer,
5886 {
5887 match self {
5888 Self::Unspecified => serializer.serialize_i32(0),
5889 Self::NonPreemptible => serializer.serialize_i32(1),
5890 Self::Preemptible => serializer.serialize_i32(2),
5891 Self::Spot => serializer.serialize_i32(3),
5892 Self::UnknownValue(u) => u.0.serialize(serializer),
5893 }
5894 }
5895 }
5896
5897 impl<'de> serde::de::Deserialize<'de> for Preemptibility {
5898 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5899 where
5900 D: serde::Deserializer<'de>,
5901 {
5902 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Preemptibility>::new(
5903 ".google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility",
5904 ))
5905 }
5906 }
5907}
5908
5909/// Configuration to handle the startup of instances during cluster create and
5910/// update process.
5911#[derive(Clone, Default, PartialEq)]
5912#[non_exhaustive]
5913pub struct StartupConfig {
5914 /// Optional. The config setting to enable cluster creation/ updation to be
5915 /// successful only after required_registration_fraction of instances are up
5916 /// and running. This configuration is applicable to only secondary workers for
5917 /// now. The cluster will fail if required_registration_fraction of instances
5918 /// are not available. This will include instance creation, agent registration,
5919 /// and service registration (if enabled).
5920 pub required_registration_fraction: std::option::Option<f64>,
5921
5922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5923}
5924
5925impl StartupConfig {
5926 pub fn new() -> Self {
5927 std::default::Default::default()
5928 }
5929
5930 /// Sets the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5931 ///
5932 /// # Example
5933 /// ```ignore,no_run
5934 /// # use google_cloud_dataproc_v1::model::StartupConfig;
5935 /// let x = StartupConfig::new().set_required_registration_fraction(42.0);
5936 /// ```
5937 pub fn set_required_registration_fraction<T>(mut self, v: T) -> Self
5938 where
5939 T: std::convert::Into<f64>,
5940 {
5941 self.required_registration_fraction = std::option::Option::Some(v.into());
5942 self
5943 }
5944
5945 /// Sets or clears the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5946 ///
5947 /// # Example
5948 /// ```ignore,no_run
5949 /// # use google_cloud_dataproc_v1::model::StartupConfig;
5950 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(Some(42.0));
5951 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(None::<f32>);
5952 /// ```
5953 pub fn set_or_clear_required_registration_fraction<T>(
5954 mut self,
5955 v: std::option::Option<T>,
5956 ) -> Self
5957 where
5958 T: std::convert::Into<f64>,
5959 {
5960 self.required_registration_fraction = v.map(|x| x.into());
5961 self
5962 }
5963}
5964
5965impl wkt::message::Message for StartupConfig {
5966 fn typename() -> &'static str {
5967 "type.googleapis.com/google.cloud.dataproc.v1.StartupConfig"
5968 }
5969}
5970
5971/// A reference to a Compute Engine instance.
5972#[derive(Clone, Default, PartialEq)]
5973#[non_exhaustive]
5974pub struct InstanceReference {
5975 /// The user-friendly name of the Compute Engine instance.
5976 pub instance_name: std::string::String,
5977
5978 /// The unique identifier of the Compute Engine instance.
5979 pub instance_id: std::string::String,
5980
5981 /// The public RSA key used for sharing data with this instance.
5982 pub public_key: std::string::String,
5983
5984 /// The public ECIES key used for sharing data with this instance.
5985 pub public_ecies_key: std::string::String,
5986
5987 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5988}
5989
5990impl InstanceReference {
5991 pub fn new() -> Self {
5992 std::default::Default::default()
5993 }
5994
5995 /// Sets the value of [instance_name][crate::model::InstanceReference::instance_name].
5996 ///
5997 /// # Example
5998 /// ```ignore,no_run
5999 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6000 /// let x = InstanceReference::new().set_instance_name("example");
6001 /// ```
6002 pub fn set_instance_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6003 self.instance_name = v.into();
6004 self
6005 }
6006
6007 /// Sets the value of [instance_id][crate::model::InstanceReference::instance_id].
6008 ///
6009 /// # Example
6010 /// ```ignore,no_run
6011 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6012 /// let x = InstanceReference::new().set_instance_id("example");
6013 /// ```
6014 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6015 self.instance_id = v.into();
6016 self
6017 }
6018
6019 /// Sets the value of [public_key][crate::model::InstanceReference::public_key].
6020 ///
6021 /// # Example
6022 /// ```ignore,no_run
6023 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6024 /// let x = InstanceReference::new().set_public_key("example");
6025 /// ```
6026 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6027 self.public_key = v.into();
6028 self
6029 }
6030
6031 /// Sets the value of [public_ecies_key][crate::model::InstanceReference::public_ecies_key].
6032 ///
6033 /// # Example
6034 /// ```ignore,no_run
6035 /// # use google_cloud_dataproc_v1::model::InstanceReference;
6036 /// let x = InstanceReference::new().set_public_ecies_key("example");
6037 /// ```
6038 pub fn set_public_ecies_key<T: std::convert::Into<std::string::String>>(
6039 mut self,
6040 v: T,
6041 ) -> Self {
6042 self.public_ecies_key = v.into();
6043 self
6044 }
6045}
6046
6047impl wkt::message::Message for InstanceReference {
6048 fn typename() -> &'static str {
6049 "type.googleapis.com/google.cloud.dataproc.v1.InstanceReference"
6050 }
6051}
6052
6053/// Specifies the resources used to actively manage an instance group.
6054#[derive(Clone, Default, PartialEq)]
6055#[non_exhaustive]
6056pub struct ManagedGroupConfig {
6057 /// Output only. The name of the Instance Template used for the Managed
6058 /// Instance Group.
6059 pub instance_template_name: std::string::String,
6060
6061 /// Output only. The name of the Instance Group Manager for this group.
6062 pub instance_group_manager_name: std::string::String,
6063
6064 /// Output only. The partial URI to the instance group manager for this group.
6065 /// E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
6066 pub instance_group_manager_uri: std::string::String,
6067
6068 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6069}
6070
6071impl ManagedGroupConfig {
6072 pub fn new() -> Self {
6073 std::default::Default::default()
6074 }
6075
6076 /// Sets the value of [instance_template_name][crate::model::ManagedGroupConfig::instance_template_name].
6077 ///
6078 /// # Example
6079 /// ```ignore,no_run
6080 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6081 /// let x = ManagedGroupConfig::new().set_instance_template_name("example");
6082 /// ```
6083 pub fn set_instance_template_name<T: std::convert::Into<std::string::String>>(
6084 mut self,
6085 v: T,
6086 ) -> Self {
6087 self.instance_template_name = v.into();
6088 self
6089 }
6090
6091 /// Sets the value of [instance_group_manager_name][crate::model::ManagedGroupConfig::instance_group_manager_name].
6092 ///
6093 /// # Example
6094 /// ```ignore,no_run
6095 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6096 /// let x = ManagedGroupConfig::new().set_instance_group_manager_name("example");
6097 /// ```
6098 pub fn set_instance_group_manager_name<T: std::convert::Into<std::string::String>>(
6099 mut self,
6100 v: T,
6101 ) -> Self {
6102 self.instance_group_manager_name = v.into();
6103 self
6104 }
6105
6106 /// Sets the value of [instance_group_manager_uri][crate::model::ManagedGroupConfig::instance_group_manager_uri].
6107 ///
6108 /// # Example
6109 /// ```ignore,no_run
6110 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6111 /// let x = ManagedGroupConfig::new().set_instance_group_manager_uri("example");
6112 /// ```
6113 pub fn set_instance_group_manager_uri<T: std::convert::Into<std::string::String>>(
6114 mut self,
6115 v: T,
6116 ) -> Self {
6117 self.instance_group_manager_uri = v.into();
6118 self
6119 }
6120}
6121
6122impl wkt::message::Message for ManagedGroupConfig {
6123 fn typename() -> &'static str {
6124 "type.googleapis.com/google.cloud.dataproc.v1.ManagedGroupConfig"
6125 }
6126}
6127
6128/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning
6129/// models.
6130#[derive(Clone, Default, PartialEq)]
6131#[non_exhaustive]
6132pub struct InstanceFlexibilityPolicy {
6133 /// Optional. Defines how the Group selects the provisioning model to ensure
6134 /// required reliability.
6135 pub provisioning_model_mix:
6136 std::option::Option<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6137
6138 /// Optional. List of instance selection options that the group will use when
6139 /// creating new VMs.
6140 pub instance_selection_list:
6141 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelection>,
6142
6143 /// Output only. A list of instance selection results in the group.
6144 pub instance_selection_results:
6145 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6146
6147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6148}
6149
6150impl InstanceFlexibilityPolicy {
6151 pub fn new() -> Self {
6152 std::default::Default::default()
6153 }
6154
6155 /// Sets the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6156 ///
6157 /// # Example
6158 /// ```ignore,no_run
6159 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6160 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6161 /// let x = InstanceFlexibilityPolicy::new().set_provisioning_model_mix(ProvisioningModelMix::default()/* use setters */);
6162 /// ```
6163 pub fn set_provisioning_model_mix<T>(mut self, v: T) -> Self
6164 where
6165 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6166 {
6167 self.provisioning_model_mix = std::option::Option::Some(v.into());
6168 self
6169 }
6170
6171 /// Sets or clears the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6172 ///
6173 /// # Example
6174 /// ```ignore,no_run
6175 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6176 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6177 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(Some(ProvisioningModelMix::default()/* use setters */));
6178 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(None::<ProvisioningModelMix>);
6179 /// ```
6180 pub fn set_or_clear_provisioning_model_mix<T>(mut self, v: std::option::Option<T>) -> Self
6181 where
6182 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6183 {
6184 self.provisioning_model_mix = v.map(|x| x.into());
6185 self
6186 }
6187
6188 /// Sets the value of [instance_selection_list][crate::model::InstanceFlexibilityPolicy::instance_selection_list].
6189 ///
6190 /// # Example
6191 /// ```ignore,no_run
6192 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6193 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6194 /// let x = InstanceFlexibilityPolicy::new()
6195 /// .set_instance_selection_list([
6196 /// InstanceSelection::default()/* use setters */,
6197 /// InstanceSelection::default()/* use (different) setters */,
6198 /// ]);
6199 /// ```
6200 pub fn set_instance_selection_list<T, V>(mut self, v: T) -> Self
6201 where
6202 T: std::iter::IntoIterator<Item = V>,
6203 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelection>,
6204 {
6205 use std::iter::Iterator;
6206 self.instance_selection_list = v.into_iter().map(|i| i.into()).collect();
6207 self
6208 }
6209
6210 /// Sets the value of [instance_selection_results][crate::model::InstanceFlexibilityPolicy::instance_selection_results].
6211 ///
6212 /// # Example
6213 /// ```ignore,no_run
6214 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6215 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6216 /// let x = InstanceFlexibilityPolicy::new()
6217 /// .set_instance_selection_results([
6218 /// InstanceSelectionResult::default()/* use setters */,
6219 /// InstanceSelectionResult::default()/* use (different) setters */,
6220 /// ]);
6221 /// ```
6222 pub fn set_instance_selection_results<T, V>(mut self, v: T) -> Self
6223 where
6224 T: std::iter::IntoIterator<Item = V>,
6225 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6226 {
6227 use std::iter::Iterator;
6228 self.instance_selection_results = v.into_iter().map(|i| i.into()).collect();
6229 self
6230 }
6231}
6232
6233impl wkt::message::Message for InstanceFlexibilityPolicy {
6234 fn typename() -> &'static str {
6235 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy"
6236 }
6237}
6238
6239/// Defines additional types related to [InstanceFlexibilityPolicy].
6240pub mod instance_flexibility_policy {
6241 #[allow(unused_imports)]
6242 use super::*;
6243
6244 /// Defines how Dataproc should create VMs with a mixture of provisioning
6245 /// models.
6246 #[derive(Clone, Default, PartialEq)]
6247 #[non_exhaustive]
6248 pub struct ProvisioningModelMix {
6249 /// Optional. The base capacity that will always use Standard VMs to avoid
6250 /// risk of more preemption than the minimum capacity you need. Dataproc will
6251 /// create only standard VMs until it reaches standard_capacity_base, then it
6252 /// will start using standard_capacity_percent_above_base to mix Spot with
6253 /// Standard VMs. eg. If 15 instances are requested and
6254 /// standard_capacity_base is 5, Dataproc will create 5 standard VMs and then
6255 /// start mixing spot and standard VMs for remaining 10 instances.
6256 pub standard_capacity_base: std::option::Option<i32>,
6257
6258 /// Optional. The percentage of target capacity that should use Standard VM.
6259 /// The remaining percentage will use Spot VMs. The percentage applies only
6260 /// to the capacity above standard_capacity_base. eg. If 15 instances are
6261 /// requested and standard_capacity_base is 5 and
6262 /// standard_capacity_percent_above_base is 30, Dataproc will create 5
6263 /// standard VMs and then start mixing spot and standard VMs for remaining 10
6264 /// instances. The mix will be 30% standard and 70% spot.
6265 pub standard_capacity_percent_above_base: std::option::Option<i32>,
6266
6267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6268 }
6269
6270 impl ProvisioningModelMix {
6271 pub fn new() -> Self {
6272 std::default::Default::default()
6273 }
6274
6275 /// Sets the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6276 ///
6277 /// # Example
6278 /// ```ignore,no_run
6279 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6280 /// let x = ProvisioningModelMix::new().set_standard_capacity_base(42);
6281 /// ```
6282 pub fn set_standard_capacity_base<T>(mut self, v: T) -> Self
6283 where
6284 T: std::convert::Into<i32>,
6285 {
6286 self.standard_capacity_base = std::option::Option::Some(v.into());
6287 self
6288 }
6289
6290 /// Sets or clears the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6291 ///
6292 /// # Example
6293 /// ```ignore,no_run
6294 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6295 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(Some(42));
6296 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(None::<i32>);
6297 /// ```
6298 pub fn set_or_clear_standard_capacity_base<T>(mut self, v: std::option::Option<T>) -> Self
6299 where
6300 T: std::convert::Into<i32>,
6301 {
6302 self.standard_capacity_base = v.map(|x| x.into());
6303 self
6304 }
6305
6306 /// Sets the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6307 ///
6308 /// # Example
6309 /// ```ignore,no_run
6310 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6311 /// let x = ProvisioningModelMix::new().set_standard_capacity_percent_above_base(42);
6312 /// ```
6313 pub fn set_standard_capacity_percent_above_base<T>(mut self, v: T) -> Self
6314 where
6315 T: std::convert::Into<i32>,
6316 {
6317 self.standard_capacity_percent_above_base = std::option::Option::Some(v.into());
6318 self
6319 }
6320
6321 /// Sets or clears the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6322 ///
6323 /// # Example
6324 /// ```ignore,no_run
6325 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6326 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(Some(42));
6327 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(None::<i32>);
6328 /// ```
6329 pub fn set_or_clear_standard_capacity_percent_above_base<T>(
6330 mut self,
6331 v: std::option::Option<T>,
6332 ) -> Self
6333 where
6334 T: std::convert::Into<i32>,
6335 {
6336 self.standard_capacity_percent_above_base = v.map(|x| x.into());
6337 self
6338 }
6339 }
6340
6341 impl wkt::message::Message for ProvisioningModelMix {
6342 fn typename() -> &'static str {
6343 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.ProvisioningModelMix"
6344 }
6345 }
6346
6347 /// Defines machines types and a rank to which the machines types belong.
6348 #[derive(Clone, Default, PartialEq)]
6349 #[non_exhaustive]
6350 pub struct InstanceSelection {
6351 /// Optional. Full machine-type names, e.g. "n1-standard-16".
6352 pub machine_types: std::vec::Vec<std::string::String>,
6353
6354 /// Optional. Preference of this instance selection. Lower number means
6355 /// higher preference. Dataproc will first try to create a VM based on the
6356 /// machine-type with priority rank and fallback to next rank based on
6357 /// availability. Machine types and instance selections with the same
6358 /// priority have the same preference.
6359 pub rank: i32,
6360
6361 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6362 }
6363
6364 impl InstanceSelection {
6365 pub fn new() -> Self {
6366 std::default::Default::default()
6367 }
6368
6369 /// Sets the value of [machine_types][crate::model::instance_flexibility_policy::InstanceSelection::machine_types].
6370 ///
6371 /// # Example
6372 /// ```ignore,no_run
6373 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6374 /// let x = InstanceSelection::new().set_machine_types(["a", "b", "c"]);
6375 /// ```
6376 pub fn set_machine_types<T, V>(mut self, v: T) -> Self
6377 where
6378 T: std::iter::IntoIterator<Item = V>,
6379 V: std::convert::Into<std::string::String>,
6380 {
6381 use std::iter::Iterator;
6382 self.machine_types = v.into_iter().map(|i| i.into()).collect();
6383 self
6384 }
6385
6386 /// Sets the value of [rank][crate::model::instance_flexibility_policy::InstanceSelection::rank].
6387 ///
6388 /// # Example
6389 /// ```ignore,no_run
6390 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6391 /// let x = InstanceSelection::new().set_rank(42);
6392 /// ```
6393 pub fn set_rank<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6394 self.rank = v.into();
6395 self
6396 }
6397 }
6398
6399 impl wkt::message::Message for InstanceSelection {
6400 fn typename() -> &'static str {
6401 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelection"
6402 }
6403 }
6404
6405 /// Defines a mapping from machine types to the number of VMs that are created
6406 /// with each machine type.
6407 #[derive(Clone, Default, PartialEq)]
6408 #[non_exhaustive]
6409 pub struct InstanceSelectionResult {
6410 /// Output only. Full machine-type names, e.g. "n1-standard-16".
6411 pub machine_type: std::option::Option<std::string::String>,
6412
6413 /// Output only. Number of VM provisioned with the machine_type.
6414 pub vm_count: std::option::Option<i32>,
6415
6416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6417 }
6418
6419 impl InstanceSelectionResult {
6420 pub fn new() -> Self {
6421 std::default::Default::default()
6422 }
6423
6424 /// Sets the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6425 ///
6426 /// # Example
6427 /// ```ignore,no_run
6428 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6429 /// let x = InstanceSelectionResult::new().set_machine_type("example");
6430 /// ```
6431 pub fn set_machine_type<T>(mut self, v: T) -> Self
6432 where
6433 T: std::convert::Into<std::string::String>,
6434 {
6435 self.machine_type = std::option::Option::Some(v.into());
6436 self
6437 }
6438
6439 /// Sets or clears the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6440 ///
6441 /// # Example
6442 /// ```ignore,no_run
6443 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6444 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(Some("example"));
6445 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(None::<String>);
6446 /// ```
6447 pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
6448 where
6449 T: std::convert::Into<std::string::String>,
6450 {
6451 self.machine_type = v.map(|x| x.into());
6452 self
6453 }
6454
6455 /// Sets the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6456 ///
6457 /// # Example
6458 /// ```ignore,no_run
6459 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6460 /// let x = InstanceSelectionResult::new().set_vm_count(42);
6461 /// ```
6462 pub fn set_vm_count<T>(mut self, v: T) -> Self
6463 where
6464 T: std::convert::Into<i32>,
6465 {
6466 self.vm_count = std::option::Option::Some(v.into());
6467 self
6468 }
6469
6470 /// Sets or clears the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6471 ///
6472 /// # Example
6473 /// ```ignore,no_run
6474 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6475 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(Some(42));
6476 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(None::<i32>);
6477 /// ```
6478 pub fn set_or_clear_vm_count<T>(mut self, v: std::option::Option<T>) -> Self
6479 where
6480 T: std::convert::Into<i32>,
6481 {
6482 self.vm_count = v.map(|x| x.into());
6483 self
6484 }
6485 }
6486
6487 impl wkt::message::Message for InstanceSelectionResult {
6488 fn typename() -> &'static str {
6489 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelectionResult"
6490 }
6491 }
6492}
6493
6494/// Specifies the type and number of accelerator cards attached to the instances
6495/// of an instance. See [GPUs on Compute
6496/// Engine](https://cloud.google.com/compute/docs/gpus/).
6497#[derive(Clone, Default, PartialEq)]
6498#[non_exhaustive]
6499pub struct AcceleratorConfig {
6500 /// Full URL, partial URI, or short name of the accelerator type resource to
6501 /// expose to this instance. See
6502 /// [Compute Engine
6503 /// AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).
6504 ///
6505 /// Examples:
6506 ///
6507 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6508 /// * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6509 /// * `nvidia-tesla-t4`
6510 ///
6511 /// **Auto Zone Exception**: If you are using the Dataproc
6512 /// [Auto Zone
6513 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
6514 /// feature, you must use the short name of the accelerator type
6515 /// resource, for example, `nvidia-tesla-t4`.
6516 pub accelerator_type_uri: std::string::String,
6517
6518 /// The number of the accelerator cards of this type exposed to this instance.
6519 pub accelerator_count: i32,
6520
6521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6522}
6523
6524impl AcceleratorConfig {
6525 pub fn new() -> Self {
6526 std::default::Default::default()
6527 }
6528
6529 /// Sets the value of [accelerator_type_uri][crate::model::AcceleratorConfig::accelerator_type_uri].
6530 ///
6531 /// # Example
6532 /// ```ignore,no_run
6533 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6534 /// let x = AcceleratorConfig::new().set_accelerator_type_uri("example");
6535 /// ```
6536 pub fn set_accelerator_type_uri<T: std::convert::Into<std::string::String>>(
6537 mut self,
6538 v: T,
6539 ) -> Self {
6540 self.accelerator_type_uri = v.into();
6541 self
6542 }
6543
6544 /// Sets the value of [accelerator_count][crate::model::AcceleratorConfig::accelerator_count].
6545 ///
6546 /// # Example
6547 /// ```ignore,no_run
6548 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6549 /// let x = AcceleratorConfig::new().set_accelerator_count(42);
6550 /// ```
6551 pub fn set_accelerator_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6552 self.accelerator_count = v.into();
6553 self
6554 }
6555}
6556
6557impl wkt::message::Message for AcceleratorConfig {
6558 fn typename() -> &'static str {
6559 "type.googleapis.com/google.cloud.dataproc.v1.AcceleratorConfig"
6560 }
6561}
6562
6563/// Specifies the config of disk options for a group of VM instances.
6564#[derive(Clone, Default, PartialEq)]
6565#[non_exhaustive]
6566pub struct DiskConfig {
6567 /// Optional. Type of the boot disk (default is "pd-standard").
6568 /// Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive),
6569 /// "pd-ssd" (Persistent Disk Solid State Drive),
6570 /// or "pd-standard" (Persistent Disk Hard Disk Drive).
6571 /// See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types).
6572 pub boot_disk_type: std::string::String,
6573
6574 /// Optional. Size in GB of the boot disk (default is 500GB).
6575 pub boot_disk_size_gb: i32,
6576
6577 /// Optional. Number of attached SSDs, from 0 to 8 (default is 0).
6578 /// If SSDs are not attached, the boot disk is used to store runtime logs and
6579 /// [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data.
6580 /// If one or more SSDs are attached, this runtime bulk
6581 /// data is spread across them, and the boot disk contains only basic
6582 /// config and installed binaries.
6583 ///
6584 /// Note: Local SSD options may vary by machine type and number of vCPUs
6585 /// selected.
6586 pub num_local_ssds: i32,
6587
6588 /// Optional. Interface type of local SSDs (default is "scsi").
6589 /// Valid values: "scsi" (Small Computer System Interface),
6590 /// "nvme" (Non-Volatile Memory Express).
6591 /// See [local SSD
6592 /// performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance).
6593 pub local_ssd_interface: std::string::String,
6594
6595 /// Optional. Indicates how many IOPS to provision for the disk. This sets the
6596 /// number of I/O operations per second that the disk can handle. Note: This
6597 /// field is only supported if boot_disk_type is hyperdisk-balanced.
6598 pub boot_disk_provisioned_iops: std::option::Option<i64>,
6599
6600 /// Optional. Indicates how much throughput to provision for the disk. This
6601 /// sets the number of throughput mb per second that the disk can handle.
6602 /// Values must be greater than or equal to 1. Note: This field is only
6603 /// supported if boot_disk_type is hyperdisk-balanced.
6604 pub boot_disk_provisioned_throughput: std::option::Option<i64>,
6605
6606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6607}
6608
6609impl DiskConfig {
6610 pub fn new() -> Self {
6611 std::default::Default::default()
6612 }
6613
6614 /// Sets the value of [boot_disk_type][crate::model::DiskConfig::boot_disk_type].
6615 ///
6616 /// # Example
6617 /// ```ignore,no_run
6618 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6619 /// let x = DiskConfig::new().set_boot_disk_type("example");
6620 /// ```
6621 pub fn set_boot_disk_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6622 self.boot_disk_type = v.into();
6623 self
6624 }
6625
6626 /// Sets the value of [boot_disk_size_gb][crate::model::DiskConfig::boot_disk_size_gb].
6627 ///
6628 /// # Example
6629 /// ```ignore,no_run
6630 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6631 /// let x = DiskConfig::new().set_boot_disk_size_gb(42);
6632 /// ```
6633 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6634 self.boot_disk_size_gb = v.into();
6635 self
6636 }
6637
6638 /// Sets the value of [num_local_ssds][crate::model::DiskConfig::num_local_ssds].
6639 ///
6640 /// # Example
6641 /// ```ignore,no_run
6642 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6643 /// let x = DiskConfig::new().set_num_local_ssds(42);
6644 /// ```
6645 pub fn set_num_local_ssds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6646 self.num_local_ssds = v.into();
6647 self
6648 }
6649
6650 /// Sets the value of [local_ssd_interface][crate::model::DiskConfig::local_ssd_interface].
6651 ///
6652 /// # Example
6653 /// ```ignore,no_run
6654 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6655 /// let x = DiskConfig::new().set_local_ssd_interface("example");
6656 /// ```
6657 pub fn set_local_ssd_interface<T: std::convert::Into<std::string::String>>(
6658 mut self,
6659 v: T,
6660 ) -> Self {
6661 self.local_ssd_interface = v.into();
6662 self
6663 }
6664
6665 /// Sets the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6666 ///
6667 /// # Example
6668 /// ```ignore,no_run
6669 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6670 /// let x = DiskConfig::new().set_boot_disk_provisioned_iops(42);
6671 /// ```
6672 pub fn set_boot_disk_provisioned_iops<T>(mut self, v: T) -> Self
6673 where
6674 T: std::convert::Into<i64>,
6675 {
6676 self.boot_disk_provisioned_iops = std::option::Option::Some(v.into());
6677 self
6678 }
6679
6680 /// Sets or clears the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6681 ///
6682 /// # Example
6683 /// ```ignore,no_run
6684 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6685 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(Some(42));
6686 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(None::<i32>);
6687 /// ```
6688 pub fn set_or_clear_boot_disk_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
6689 where
6690 T: std::convert::Into<i64>,
6691 {
6692 self.boot_disk_provisioned_iops = v.map(|x| x.into());
6693 self
6694 }
6695
6696 /// Sets the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6697 ///
6698 /// # Example
6699 /// ```ignore,no_run
6700 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6701 /// let x = DiskConfig::new().set_boot_disk_provisioned_throughput(42);
6702 /// ```
6703 pub fn set_boot_disk_provisioned_throughput<T>(mut self, v: T) -> Self
6704 where
6705 T: std::convert::Into<i64>,
6706 {
6707 self.boot_disk_provisioned_throughput = std::option::Option::Some(v.into());
6708 self
6709 }
6710
6711 /// Sets or clears the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6712 ///
6713 /// # Example
6714 /// ```ignore,no_run
6715 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6716 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(Some(42));
6717 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(None::<i32>);
6718 /// ```
6719 pub fn set_or_clear_boot_disk_provisioned_throughput<T>(
6720 mut self,
6721 v: std::option::Option<T>,
6722 ) -> Self
6723 where
6724 T: std::convert::Into<i64>,
6725 {
6726 self.boot_disk_provisioned_throughput = v.map(|x| x.into());
6727 self
6728 }
6729}
6730
6731impl wkt::message::Message for DiskConfig {
6732 fn typename() -> &'static str {
6733 "type.googleapis.com/google.cloud.dataproc.v1.DiskConfig"
6734 }
6735}
6736
6737/// Node group identification and configuration information.
6738#[derive(Clone, Default, PartialEq)]
6739#[non_exhaustive]
6740pub struct AuxiliaryNodeGroup {
6741 /// Required. Node group configuration.
6742 pub node_group: std::option::Option<crate::model::NodeGroup>,
6743
6744 /// Optional. A node group ID. Generated if not specified.
6745 ///
6746 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
6747 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
6748 /// or hyphen. Must consist of from 3 to 33 characters.
6749 pub node_group_id: std::string::String,
6750
6751 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6752}
6753
6754impl AuxiliaryNodeGroup {
6755 pub fn new() -> Self {
6756 std::default::Default::default()
6757 }
6758
6759 /// Sets the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6760 ///
6761 /// # Example
6762 /// ```ignore,no_run
6763 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6764 /// use google_cloud_dataproc_v1::model::NodeGroup;
6765 /// let x = AuxiliaryNodeGroup::new().set_node_group(NodeGroup::default()/* use setters */);
6766 /// ```
6767 pub fn set_node_group<T>(mut self, v: T) -> Self
6768 where
6769 T: std::convert::Into<crate::model::NodeGroup>,
6770 {
6771 self.node_group = std::option::Option::Some(v.into());
6772 self
6773 }
6774
6775 /// Sets or clears the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6776 ///
6777 /// # Example
6778 /// ```ignore,no_run
6779 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6780 /// use google_cloud_dataproc_v1::model::NodeGroup;
6781 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
6782 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(None::<NodeGroup>);
6783 /// ```
6784 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
6785 where
6786 T: std::convert::Into<crate::model::NodeGroup>,
6787 {
6788 self.node_group = v.map(|x| x.into());
6789 self
6790 }
6791
6792 /// Sets the value of [node_group_id][crate::model::AuxiliaryNodeGroup::node_group_id].
6793 ///
6794 /// # Example
6795 /// ```ignore,no_run
6796 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6797 /// let x = AuxiliaryNodeGroup::new().set_node_group_id("example");
6798 /// ```
6799 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6800 self.node_group_id = v.into();
6801 self
6802 }
6803}
6804
6805impl wkt::message::Message for AuxiliaryNodeGroup {
6806 fn typename() -> &'static str {
6807 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryNodeGroup"
6808 }
6809}
6810
6811/// Dataproc Node Group.
6812/// **The Dataproc `NodeGroup` resource is not related to the
6813/// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity]
6814/// resource.**
6815///
6816/// [google.cloud.dataproc.v1.NodeGroupAffinity]: crate::model::NodeGroupAffinity
6817#[derive(Clone, Default, PartialEq)]
6818#[non_exhaustive]
6819pub struct NodeGroup {
6820 /// The Node group [resource name](https://aip.dev/122).
6821 pub name: std::string::String,
6822
6823 /// Required. Node group roles.
6824 pub roles: std::vec::Vec<crate::model::node_group::Role>,
6825
6826 /// Optional. The node group instance group configuration.
6827 pub node_group_config: std::option::Option<crate::model::InstanceGroupConfig>,
6828
6829 /// Optional. Node group labels.
6830 ///
6831 /// * Label **keys** must consist of from 1 to 63 characters and conform to
6832 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
6833 /// * Label **values** can be empty. If specified, they must consist of from
6834 /// 1 to 63 characters and conform to [RFC 1035]
6835 /// (<https://www.ietf.org/rfc/rfc1035.txt>).
6836 /// * The node group must have no more than 32 labels.
6837 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6838
6839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6840}
6841
6842impl NodeGroup {
6843 pub fn new() -> Self {
6844 std::default::Default::default()
6845 }
6846
6847 /// Sets the value of [name][crate::model::NodeGroup::name].
6848 ///
6849 /// # Example
6850 /// ```ignore,no_run
6851 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6852 /// let x = NodeGroup::new().set_name("example");
6853 /// ```
6854 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6855 self.name = v.into();
6856 self
6857 }
6858
6859 /// Sets the value of [roles][crate::model::NodeGroup::roles].
6860 ///
6861 /// # Example
6862 /// ```ignore,no_run
6863 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6864 /// use google_cloud_dataproc_v1::model::node_group::Role;
6865 /// let x = NodeGroup::new().set_roles([
6866 /// Role::Driver,
6867 /// ]);
6868 /// ```
6869 pub fn set_roles<T, V>(mut self, v: T) -> Self
6870 where
6871 T: std::iter::IntoIterator<Item = V>,
6872 V: std::convert::Into<crate::model::node_group::Role>,
6873 {
6874 use std::iter::Iterator;
6875 self.roles = v.into_iter().map(|i| i.into()).collect();
6876 self
6877 }
6878
6879 /// Sets the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6880 ///
6881 /// # Example
6882 /// ```ignore,no_run
6883 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6884 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6885 /// let x = NodeGroup::new().set_node_group_config(InstanceGroupConfig::default()/* use setters */);
6886 /// ```
6887 pub fn set_node_group_config<T>(mut self, v: T) -> Self
6888 where
6889 T: std::convert::Into<crate::model::InstanceGroupConfig>,
6890 {
6891 self.node_group_config = std::option::Option::Some(v.into());
6892 self
6893 }
6894
6895 /// Sets or clears the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6896 ///
6897 /// # Example
6898 /// ```ignore,no_run
6899 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6900 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6901 /// let x = NodeGroup::new().set_or_clear_node_group_config(Some(InstanceGroupConfig::default()/* use setters */));
6902 /// let x = NodeGroup::new().set_or_clear_node_group_config(None::<InstanceGroupConfig>);
6903 /// ```
6904 pub fn set_or_clear_node_group_config<T>(mut self, v: std::option::Option<T>) -> Self
6905 where
6906 T: std::convert::Into<crate::model::InstanceGroupConfig>,
6907 {
6908 self.node_group_config = v.map(|x| x.into());
6909 self
6910 }
6911
6912 /// Sets the value of [labels][crate::model::NodeGroup::labels].
6913 ///
6914 /// # Example
6915 /// ```ignore,no_run
6916 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6917 /// let x = NodeGroup::new().set_labels([
6918 /// ("key0", "abc"),
6919 /// ("key1", "xyz"),
6920 /// ]);
6921 /// ```
6922 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6923 where
6924 T: std::iter::IntoIterator<Item = (K, V)>,
6925 K: std::convert::Into<std::string::String>,
6926 V: std::convert::Into<std::string::String>,
6927 {
6928 use std::iter::Iterator;
6929 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6930 self
6931 }
6932}
6933
6934impl wkt::message::Message for NodeGroup {
6935 fn typename() -> &'static str {
6936 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroup"
6937 }
6938}
6939
6940/// Defines additional types related to [NodeGroup].
6941pub mod node_group {
6942 #[allow(unused_imports)]
6943 use super::*;
6944
6945 /// Node pool roles.
6946 ///
6947 /// # Working with unknown values
6948 ///
6949 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6950 /// additional enum variants at any time. Adding new variants is not considered
6951 /// a breaking change. Applications should write their code in anticipation of:
6952 ///
6953 /// - New values appearing in future releases of the client library, **and**
6954 /// - New values received dynamically, without application changes.
6955 ///
6956 /// Please consult the [Working with enums] section in the user guide for some
6957 /// guidelines.
6958 ///
6959 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6960 #[derive(Clone, Debug, PartialEq)]
6961 #[non_exhaustive]
6962 pub enum Role {
6963 /// Required unspecified role.
6964 Unspecified,
6965 /// Job drivers run on the node pool.
6966 Driver,
6967 /// If set, the enum was initialized with an unknown value.
6968 ///
6969 /// Applications can examine the value using [Role::value] or
6970 /// [Role::name].
6971 UnknownValue(role::UnknownValue),
6972 }
6973
6974 #[doc(hidden)]
6975 pub mod role {
6976 #[allow(unused_imports)]
6977 use super::*;
6978 #[derive(Clone, Debug, PartialEq)]
6979 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6980 }
6981
6982 impl Role {
6983 /// Gets the enum value.
6984 ///
6985 /// Returns `None` if the enum contains an unknown value deserialized from
6986 /// the string representation of enums.
6987 pub fn value(&self) -> std::option::Option<i32> {
6988 match self {
6989 Self::Unspecified => std::option::Option::Some(0),
6990 Self::Driver => std::option::Option::Some(1),
6991 Self::UnknownValue(u) => u.0.value(),
6992 }
6993 }
6994
6995 /// Gets the enum value as a string.
6996 ///
6997 /// Returns `None` if the enum contains an unknown value deserialized from
6998 /// the integer representation of enums.
6999 pub fn name(&self) -> std::option::Option<&str> {
7000 match self {
7001 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
7002 Self::Driver => std::option::Option::Some("DRIVER"),
7003 Self::UnknownValue(u) => u.0.name(),
7004 }
7005 }
7006 }
7007
7008 impl std::default::Default for Role {
7009 fn default() -> Self {
7010 use std::convert::From;
7011 Self::from(0)
7012 }
7013 }
7014
7015 impl std::fmt::Display for Role {
7016 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7017 wkt::internal::display_enum(f, self.name(), self.value())
7018 }
7019 }
7020
7021 impl std::convert::From<i32> for Role {
7022 fn from(value: i32) -> Self {
7023 match value {
7024 0 => Self::Unspecified,
7025 1 => Self::Driver,
7026 _ => Self::UnknownValue(role::UnknownValue(
7027 wkt::internal::UnknownEnumValue::Integer(value),
7028 )),
7029 }
7030 }
7031 }
7032
7033 impl std::convert::From<&str> for Role {
7034 fn from(value: &str) -> Self {
7035 use std::string::ToString;
7036 match value {
7037 "ROLE_UNSPECIFIED" => Self::Unspecified,
7038 "DRIVER" => Self::Driver,
7039 _ => Self::UnknownValue(role::UnknownValue(
7040 wkt::internal::UnknownEnumValue::String(value.to_string()),
7041 )),
7042 }
7043 }
7044 }
7045
7046 impl serde::ser::Serialize for Role {
7047 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7048 where
7049 S: serde::Serializer,
7050 {
7051 match self {
7052 Self::Unspecified => serializer.serialize_i32(0),
7053 Self::Driver => serializer.serialize_i32(1),
7054 Self::UnknownValue(u) => u.0.serialize(serializer),
7055 }
7056 }
7057 }
7058
7059 impl<'de> serde::de::Deserialize<'de> for Role {
7060 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7061 where
7062 D: serde::Deserializer<'de>,
7063 {
7064 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
7065 ".google.cloud.dataproc.v1.NodeGroup.Role",
7066 ))
7067 }
7068 }
7069}
7070
7071/// Specifies an executable to run on a fully configured node and a
7072/// timeout period for executable completion.
7073#[derive(Clone, Default, PartialEq)]
7074#[non_exhaustive]
7075pub struct NodeInitializationAction {
7076 /// Required. Cloud Storage URI of executable file.
7077 pub executable_file: std::string::String,
7078
7079 /// Optional. Amount of time executable has to complete. Default is
7080 /// 10 minutes (see JSON representation of
7081 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7082 ///
7083 /// Cluster creation fails with an explanatory error message (the
7084 /// name of the executable that caused the error and the exceeded timeout
7085 /// period) if the executable is not completed at end of the timeout period.
7086 pub execution_timeout: std::option::Option<wkt::Duration>,
7087
7088 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7089}
7090
7091impl NodeInitializationAction {
7092 pub fn new() -> Self {
7093 std::default::Default::default()
7094 }
7095
7096 /// Sets the value of [executable_file][crate::model::NodeInitializationAction::executable_file].
7097 ///
7098 /// # Example
7099 /// ```ignore,no_run
7100 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7101 /// let x = NodeInitializationAction::new().set_executable_file("example");
7102 /// ```
7103 pub fn set_executable_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7104 self.executable_file = v.into();
7105 self
7106 }
7107
7108 /// Sets the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7109 ///
7110 /// # Example
7111 /// ```ignore,no_run
7112 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7113 /// use wkt::Duration;
7114 /// let x = NodeInitializationAction::new().set_execution_timeout(Duration::default()/* use setters */);
7115 /// ```
7116 pub fn set_execution_timeout<T>(mut self, v: T) -> Self
7117 where
7118 T: std::convert::Into<wkt::Duration>,
7119 {
7120 self.execution_timeout = std::option::Option::Some(v.into());
7121 self
7122 }
7123
7124 /// Sets or clears the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7125 ///
7126 /// # Example
7127 /// ```ignore,no_run
7128 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7129 /// use wkt::Duration;
7130 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
7131 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(None::<Duration>);
7132 /// ```
7133 pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7134 where
7135 T: std::convert::Into<wkt::Duration>,
7136 {
7137 self.execution_timeout = v.map(|x| x.into());
7138 self
7139 }
7140}
7141
7142impl wkt::message::Message for NodeInitializationAction {
7143 fn typename() -> &'static str {
7144 "type.googleapis.com/google.cloud.dataproc.v1.NodeInitializationAction"
7145 }
7146}
7147
7148/// The status of a cluster and its instances.
7149#[derive(Clone, Default, PartialEq)]
7150#[non_exhaustive]
7151pub struct ClusterStatus {
7152 /// Output only. The cluster's state.
7153 pub state: crate::model::cluster_status::State,
7154
7155 /// Optional. Output only. Details of cluster's state.
7156 pub detail: std::string::String,
7157
7158 /// Output only. Time when this state was entered (see JSON representation of
7159 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7160 pub state_start_time: std::option::Option<wkt::Timestamp>,
7161
7162 /// Output only. Additional state information that includes
7163 /// status reported by the agent.
7164 pub substate: crate::model::cluster_status::Substate,
7165
7166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7167}
7168
7169impl ClusterStatus {
7170 pub fn new() -> Self {
7171 std::default::Default::default()
7172 }
7173
7174 /// Sets the value of [state][crate::model::ClusterStatus::state].
7175 ///
7176 /// # Example
7177 /// ```ignore,no_run
7178 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7179 /// use google_cloud_dataproc_v1::model::cluster_status::State;
7180 /// let x0 = ClusterStatus::new().set_state(State::Creating);
7181 /// let x1 = ClusterStatus::new().set_state(State::Running);
7182 /// let x2 = ClusterStatus::new().set_state(State::Error);
7183 /// ```
7184 pub fn set_state<T: std::convert::Into<crate::model::cluster_status::State>>(
7185 mut self,
7186 v: T,
7187 ) -> Self {
7188 self.state = v.into();
7189 self
7190 }
7191
7192 /// Sets the value of [detail][crate::model::ClusterStatus::detail].
7193 ///
7194 /// # Example
7195 /// ```ignore,no_run
7196 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7197 /// let x = ClusterStatus::new().set_detail("example");
7198 /// ```
7199 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7200 self.detail = v.into();
7201 self
7202 }
7203
7204 /// Sets the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7205 ///
7206 /// # Example
7207 /// ```ignore,no_run
7208 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7209 /// use wkt::Timestamp;
7210 /// let x = ClusterStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
7211 /// ```
7212 pub fn set_state_start_time<T>(mut self, v: T) -> Self
7213 where
7214 T: std::convert::Into<wkt::Timestamp>,
7215 {
7216 self.state_start_time = std::option::Option::Some(v.into());
7217 self
7218 }
7219
7220 /// Sets or clears the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7221 ///
7222 /// # Example
7223 /// ```ignore,no_run
7224 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7225 /// use wkt::Timestamp;
7226 /// let x = ClusterStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
7227 /// let x = ClusterStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
7228 /// ```
7229 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7230 where
7231 T: std::convert::Into<wkt::Timestamp>,
7232 {
7233 self.state_start_time = v.map(|x| x.into());
7234 self
7235 }
7236
7237 /// Sets the value of [substate][crate::model::ClusterStatus::substate].
7238 ///
7239 /// # Example
7240 /// ```ignore,no_run
7241 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7242 /// use google_cloud_dataproc_v1::model::cluster_status::Substate;
7243 /// let x0 = ClusterStatus::new().set_substate(Substate::Unhealthy);
7244 /// let x1 = ClusterStatus::new().set_substate(Substate::StaleStatus);
7245 /// ```
7246 pub fn set_substate<T: std::convert::Into<crate::model::cluster_status::Substate>>(
7247 mut self,
7248 v: T,
7249 ) -> Self {
7250 self.substate = v.into();
7251 self
7252 }
7253}
7254
7255impl wkt::message::Message for ClusterStatus {
7256 fn typename() -> &'static str {
7257 "type.googleapis.com/google.cloud.dataproc.v1.ClusterStatus"
7258 }
7259}
7260
7261/// Defines additional types related to [ClusterStatus].
7262pub mod cluster_status {
7263 #[allow(unused_imports)]
7264 use super::*;
7265
7266 /// The cluster state.
7267 ///
7268 /// # Working with unknown values
7269 ///
7270 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7271 /// additional enum variants at any time. Adding new variants is not considered
7272 /// a breaking change. Applications should write their code in anticipation of:
7273 ///
7274 /// - New values appearing in future releases of the client library, **and**
7275 /// - New values received dynamically, without application changes.
7276 ///
7277 /// Please consult the [Working with enums] section in the user guide for some
7278 /// guidelines.
7279 ///
7280 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7281 #[derive(Clone, Debug, PartialEq)]
7282 #[non_exhaustive]
7283 pub enum State {
7284 /// The cluster state is unknown.
7285 Unknown,
7286 /// The cluster is being created and set up. It is not ready for use.
7287 Creating,
7288 /// The cluster is currently running and healthy. It is ready for use.
7289 ///
7290 /// **Note:** The cluster state changes from "creating" to "running" status
7291 /// after the master node(s), first two primary worker nodes (and the last
7292 /// primary worker node if primary workers > 2) are running.
7293 Running,
7294 /// The cluster encountered an error. It is not ready for use.
7295 Error,
7296 /// The cluster has encountered an error while being updated. Jobs can
7297 /// be submitted to the cluster, but the cluster cannot be updated.
7298 ErrorDueToUpdate,
7299 /// The cluster is being deleted. It cannot be used.
7300 Deleting,
7301 /// The cluster is being updated. It continues to accept and process jobs.
7302 Updating,
7303 /// The cluster is being stopped. It cannot be used.
7304 Stopping,
7305 /// The cluster is currently stopped. It is not ready for use.
7306 Stopped,
7307 /// The cluster is being started. It is not ready for use.
7308 Starting,
7309 /// The cluster is being repaired. It is not ready for use.
7310 Repairing,
7311 /// If set, the enum was initialized with an unknown value.
7312 ///
7313 /// Applications can examine the value using [State::value] or
7314 /// [State::name].
7315 UnknownValue(state::UnknownValue),
7316 }
7317
7318 #[doc(hidden)]
7319 pub mod state {
7320 #[allow(unused_imports)]
7321 use super::*;
7322 #[derive(Clone, Debug, PartialEq)]
7323 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7324 }
7325
7326 impl State {
7327 /// Gets the enum value.
7328 ///
7329 /// Returns `None` if the enum contains an unknown value deserialized from
7330 /// the string representation of enums.
7331 pub fn value(&self) -> std::option::Option<i32> {
7332 match self {
7333 Self::Unknown => std::option::Option::Some(0),
7334 Self::Creating => std::option::Option::Some(1),
7335 Self::Running => std::option::Option::Some(2),
7336 Self::Error => std::option::Option::Some(3),
7337 Self::ErrorDueToUpdate => std::option::Option::Some(9),
7338 Self::Deleting => std::option::Option::Some(4),
7339 Self::Updating => std::option::Option::Some(5),
7340 Self::Stopping => std::option::Option::Some(6),
7341 Self::Stopped => std::option::Option::Some(7),
7342 Self::Starting => std::option::Option::Some(8),
7343 Self::Repairing => std::option::Option::Some(10),
7344 Self::UnknownValue(u) => u.0.value(),
7345 }
7346 }
7347
7348 /// Gets the enum value as a string.
7349 ///
7350 /// Returns `None` if the enum contains an unknown value deserialized from
7351 /// the integer representation of enums.
7352 pub fn name(&self) -> std::option::Option<&str> {
7353 match self {
7354 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7355 Self::Creating => std::option::Option::Some("CREATING"),
7356 Self::Running => std::option::Option::Some("RUNNING"),
7357 Self::Error => std::option::Option::Some("ERROR"),
7358 Self::ErrorDueToUpdate => std::option::Option::Some("ERROR_DUE_TO_UPDATE"),
7359 Self::Deleting => std::option::Option::Some("DELETING"),
7360 Self::Updating => std::option::Option::Some("UPDATING"),
7361 Self::Stopping => std::option::Option::Some("STOPPING"),
7362 Self::Stopped => std::option::Option::Some("STOPPED"),
7363 Self::Starting => std::option::Option::Some("STARTING"),
7364 Self::Repairing => std::option::Option::Some("REPAIRING"),
7365 Self::UnknownValue(u) => u.0.name(),
7366 }
7367 }
7368 }
7369
7370 impl std::default::Default for State {
7371 fn default() -> Self {
7372 use std::convert::From;
7373 Self::from(0)
7374 }
7375 }
7376
7377 impl std::fmt::Display for State {
7378 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7379 wkt::internal::display_enum(f, self.name(), self.value())
7380 }
7381 }
7382
7383 impl std::convert::From<i32> for State {
7384 fn from(value: i32) -> Self {
7385 match value {
7386 0 => Self::Unknown,
7387 1 => Self::Creating,
7388 2 => Self::Running,
7389 3 => Self::Error,
7390 4 => Self::Deleting,
7391 5 => Self::Updating,
7392 6 => Self::Stopping,
7393 7 => Self::Stopped,
7394 8 => Self::Starting,
7395 9 => Self::ErrorDueToUpdate,
7396 10 => Self::Repairing,
7397 _ => Self::UnknownValue(state::UnknownValue(
7398 wkt::internal::UnknownEnumValue::Integer(value),
7399 )),
7400 }
7401 }
7402 }
7403
7404 impl std::convert::From<&str> for State {
7405 fn from(value: &str) -> Self {
7406 use std::string::ToString;
7407 match value {
7408 "UNKNOWN" => Self::Unknown,
7409 "CREATING" => Self::Creating,
7410 "RUNNING" => Self::Running,
7411 "ERROR" => Self::Error,
7412 "ERROR_DUE_TO_UPDATE" => Self::ErrorDueToUpdate,
7413 "DELETING" => Self::Deleting,
7414 "UPDATING" => Self::Updating,
7415 "STOPPING" => Self::Stopping,
7416 "STOPPED" => Self::Stopped,
7417 "STARTING" => Self::Starting,
7418 "REPAIRING" => Self::Repairing,
7419 _ => Self::UnknownValue(state::UnknownValue(
7420 wkt::internal::UnknownEnumValue::String(value.to_string()),
7421 )),
7422 }
7423 }
7424 }
7425
7426 impl serde::ser::Serialize for State {
7427 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7428 where
7429 S: serde::Serializer,
7430 {
7431 match self {
7432 Self::Unknown => serializer.serialize_i32(0),
7433 Self::Creating => serializer.serialize_i32(1),
7434 Self::Running => serializer.serialize_i32(2),
7435 Self::Error => serializer.serialize_i32(3),
7436 Self::ErrorDueToUpdate => serializer.serialize_i32(9),
7437 Self::Deleting => serializer.serialize_i32(4),
7438 Self::Updating => serializer.serialize_i32(5),
7439 Self::Stopping => serializer.serialize_i32(6),
7440 Self::Stopped => serializer.serialize_i32(7),
7441 Self::Starting => serializer.serialize_i32(8),
7442 Self::Repairing => serializer.serialize_i32(10),
7443 Self::UnknownValue(u) => u.0.serialize(serializer),
7444 }
7445 }
7446 }
7447
7448 impl<'de> serde::de::Deserialize<'de> for State {
7449 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7450 where
7451 D: serde::Deserializer<'de>,
7452 {
7453 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7454 ".google.cloud.dataproc.v1.ClusterStatus.State",
7455 ))
7456 }
7457 }
7458
7459 /// The cluster substate.
7460 ///
7461 /// # Working with unknown values
7462 ///
7463 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7464 /// additional enum variants at any time. Adding new variants is not considered
7465 /// a breaking change. Applications should write their code in anticipation of:
7466 ///
7467 /// - New values appearing in future releases of the client library, **and**
7468 /// - New values received dynamically, without application changes.
7469 ///
7470 /// Please consult the [Working with enums] section in the user guide for some
7471 /// guidelines.
7472 ///
7473 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7474 #[derive(Clone, Debug, PartialEq)]
7475 #[non_exhaustive]
7476 pub enum Substate {
7477 /// The cluster substate is unknown.
7478 Unspecified,
7479 /// The cluster is known to be in an unhealthy state
7480 /// (for example, critical daemons are not running or HDFS capacity is
7481 /// exhausted).
7482 ///
7483 /// Applies to RUNNING state.
7484 Unhealthy,
7485 /// The agent-reported status is out of date (may occur if
7486 /// Dataproc loses communication with Agent).
7487 ///
7488 /// Applies to RUNNING state.
7489 StaleStatus,
7490 /// If set, the enum was initialized with an unknown value.
7491 ///
7492 /// Applications can examine the value using [Substate::value] or
7493 /// [Substate::name].
7494 UnknownValue(substate::UnknownValue),
7495 }
7496
7497 #[doc(hidden)]
7498 pub mod substate {
7499 #[allow(unused_imports)]
7500 use super::*;
7501 #[derive(Clone, Debug, PartialEq)]
7502 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7503 }
7504
7505 impl Substate {
7506 /// Gets the enum value.
7507 ///
7508 /// Returns `None` if the enum contains an unknown value deserialized from
7509 /// the string representation of enums.
7510 pub fn value(&self) -> std::option::Option<i32> {
7511 match self {
7512 Self::Unspecified => std::option::Option::Some(0),
7513 Self::Unhealthy => std::option::Option::Some(1),
7514 Self::StaleStatus => std::option::Option::Some(2),
7515 Self::UnknownValue(u) => u.0.value(),
7516 }
7517 }
7518
7519 /// Gets the enum value as a string.
7520 ///
7521 /// Returns `None` if the enum contains an unknown value deserialized from
7522 /// the integer representation of enums.
7523 pub fn name(&self) -> std::option::Option<&str> {
7524 match self {
7525 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
7526 Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
7527 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
7528 Self::UnknownValue(u) => u.0.name(),
7529 }
7530 }
7531 }
7532
7533 impl std::default::Default for Substate {
7534 fn default() -> Self {
7535 use std::convert::From;
7536 Self::from(0)
7537 }
7538 }
7539
7540 impl std::fmt::Display for Substate {
7541 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7542 wkt::internal::display_enum(f, self.name(), self.value())
7543 }
7544 }
7545
7546 impl std::convert::From<i32> for Substate {
7547 fn from(value: i32) -> Self {
7548 match value {
7549 0 => Self::Unspecified,
7550 1 => Self::Unhealthy,
7551 2 => Self::StaleStatus,
7552 _ => Self::UnknownValue(substate::UnknownValue(
7553 wkt::internal::UnknownEnumValue::Integer(value),
7554 )),
7555 }
7556 }
7557 }
7558
7559 impl std::convert::From<&str> for Substate {
7560 fn from(value: &str) -> Self {
7561 use std::string::ToString;
7562 match value {
7563 "UNSPECIFIED" => Self::Unspecified,
7564 "UNHEALTHY" => Self::Unhealthy,
7565 "STALE_STATUS" => Self::StaleStatus,
7566 _ => Self::UnknownValue(substate::UnknownValue(
7567 wkt::internal::UnknownEnumValue::String(value.to_string()),
7568 )),
7569 }
7570 }
7571 }
7572
7573 impl serde::ser::Serialize for Substate {
7574 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7575 where
7576 S: serde::Serializer,
7577 {
7578 match self {
7579 Self::Unspecified => serializer.serialize_i32(0),
7580 Self::Unhealthy => serializer.serialize_i32(1),
7581 Self::StaleStatus => serializer.serialize_i32(2),
7582 Self::UnknownValue(u) => u.0.serialize(serializer),
7583 }
7584 }
7585 }
7586
7587 impl<'de> serde::de::Deserialize<'de> for Substate {
7588 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7589 where
7590 D: serde::Deserializer<'de>,
7591 {
7592 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
7593 ".google.cloud.dataproc.v1.ClusterStatus.Substate",
7594 ))
7595 }
7596 }
7597}
7598
7599/// Security related configuration, including encryption, Kerberos, etc.
7600#[derive(Clone, Default, PartialEq)]
7601#[non_exhaustive]
7602pub struct SecurityConfig {
7603 /// Optional. Kerberos related configuration.
7604 pub kerberos_config: std::option::Option<crate::model::KerberosConfig>,
7605
7606 /// Optional. Identity related configuration, including service account based
7607 /// secure multi-tenancy user mappings.
7608 pub identity_config: std::option::Option<crate::model::IdentityConfig>,
7609
7610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7611}
7612
7613impl SecurityConfig {
7614 pub fn new() -> Self {
7615 std::default::Default::default()
7616 }
7617
7618 /// Sets the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7619 ///
7620 /// # Example
7621 /// ```ignore,no_run
7622 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7623 /// use google_cloud_dataproc_v1::model::KerberosConfig;
7624 /// let x = SecurityConfig::new().set_kerberos_config(KerberosConfig::default()/* use setters */);
7625 /// ```
7626 pub fn set_kerberos_config<T>(mut self, v: T) -> Self
7627 where
7628 T: std::convert::Into<crate::model::KerberosConfig>,
7629 {
7630 self.kerberos_config = std::option::Option::Some(v.into());
7631 self
7632 }
7633
7634 /// Sets or clears the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7635 ///
7636 /// # Example
7637 /// ```ignore,no_run
7638 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7639 /// use google_cloud_dataproc_v1::model::KerberosConfig;
7640 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(Some(KerberosConfig::default()/* use setters */));
7641 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(None::<KerberosConfig>);
7642 /// ```
7643 pub fn set_or_clear_kerberos_config<T>(mut self, v: std::option::Option<T>) -> Self
7644 where
7645 T: std::convert::Into<crate::model::KerberosConfig>,
7646 {
7647 self.kerberos_config = v.map(|x| x.into());
7648 self
7649 }
7650
7651 /// Sets the value of [identity_config][crate::model::SecurityConfig::identity_config].
7652 ///
7653 /// # Example
7654 /// ```ignore,no_run
7655 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7656 /// use google_cloud_dataproc_v1::model::IdentityConfig;
7657 /// let x = SecurityConfig::new().set_identity_config(IdentityConfig::default()/* use setters */);
7658 /// ```
7659 pub fn set_identity_config<T>(mut self, v: T) -> Self
7660 where
7661 T: std::convert::Into<crate::model::IdentityConfig>,
7662 {
7663 self.identity_config = std::option::Option::Some(v.into());
7664 self
7665 }
7666
7667 /// Sets or clears the value of [identity_config][crate::model::SecurityConfig::identity_config].
7668 ///
7669 /// # Example
7670 /// ```ignore,no_run
7671 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7672 /// use google_cloud_dataproc_v1::model::IdentityConfig;
7673 /// let x = SecurityConfig::new().set_or_clear_identity_config(Some(IdentityConfig::default()/* use setters */));
7674 /// let x = SecurityConfig::new().set_or_clear_identity_config(None::<IdentityConfig>);
7675 /// ```
7676 pub fn set_or_clear_identity_config<T>(mut self, v: std::option::Option<T>) -> Self
7677 where
7678 T: std::convert::Into<crate::model::IdentityConfig>,
7679 {
7680 self.identity_config = v.map(|x| x.into());
7681 self
7682 }
7683}
7684
7685impl wkt::message::Message for SecurityConfig {
7686 fn typename() -> &'static str {
7687 "type.googleapis.com/google.cloud.dataproc.v1.SecurityConfig"
7688 }
7689}
7690
7691/// Specifies Kerberos related configuration.
7692#[derive(Clone, Default, PartialEq)]
7693#[non_exhaustive]
7694pub struct KerberosConfig {
7695 /// Optional. Flag to indicate whether to Kerberize the cluster (default:
7696 /// false). Set this field to true to enable Kerberos on a cluster.
7697 pub enable_kerberos: bool,
7698
7699 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root
7700 /// principal password.
7701 pub root_principal_password_uri: std::string::String,
7702
7703 /// Optional. The URI of the KMS key used to encrypt sensitive
7704 /// files.
7705 pub kms_key_uri: std::string::String,
7706
7707 /// Optional. The Cloud Storage URI of the keystore file used for SSL
7708 /// encryption. If not provided, Dataproc will provide a self-signed
7709 /// certificate.
7710 pub keystore_uri: std::string::String,
7711
7712 /// Optional. The Cloud Storage URI of the truststore file used for SSL
7713 /// encryption. If not provided, Dataproc will provide a self-signed
7714 /// certificate.
7715 pub truststore_uri: std::string::String,
7716
7717 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7718 /// password to the user provided keystore. For the self-signed certificate,
7719 /// this password is generated by Dataproc.
7720 pub keystore_password_uri: std::string::String,
7721
7722 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7723 /// password to the user provided key. For the self-signed certificate, this
7724 /// password is generated by Dataproc.
7725 pub key_password_uri: std::string::String,
7726
7727 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7728 /// password to the user provided truststore. For the self-signed certificate,
7729 /// this password is generated by Dataproc.
7730 pub truststore_password_uri: std::string::String,
7731
7732 /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should
7733 /// the user enable cross realm trust.
7734 pub cross_realm_trust_realm: std::string::String,
7735
7736 /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross
7737 /// realm trust relationship.
7738 pub cross_realm_trust_kdc: std::string::String,
7739
7740 /// Optional. The admin server (IP or hostname) for the remote trusted realm in
7741 /// a cross realm trust relationship.
7742 pub cross_realm_trust_admin_server: std::string::String,
7743
7744 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7745 /// shared password between the on-cluster Kerberos realm and the remote
7746 /// trusted realm, in a cross realm trust relationship.
7747 pub cross_realm_trust_shared_password_uri: std::string::String,
7748
7749 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7750 /// master key of the KDC database.
7751 pub kdc_db_key_uri: std::string::String,
7752
7753 /// Optional. The lifetime of the ticket granting ticket, in hours.
7754 /// If not specified, or user specifies 0, then default value 10
7755 /// will be used.
7756 pub tgt_lifetime_hours: i32,
7757
7758 /// Optional. The name of the on-cluster Kerberos realm.
7759 /// If not specified, the uppercased domain of hostnames will be the realm.
7760 pub realm: std::string::String,
7761
7762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7763}
7764
7765impl KerberosConfig {
7766 pub fn new() -> Self {
7767 std::default::Default::default()
7768 }
7769
7770 /// Sets the value of [enable_kerberos][crate::model::KerberosConfig::enable_kerberos].
7771 ///
7772 /// # Example
7773 /// ```ignore,no_run
7774 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7775 /// let x = KerberosConfig::new().set_enable_kerberos(true);
7776 /// ```
7777 pub fn set_enable_kerberos<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7778 self.enable_kerberos = v.into();
7779 self
7780 }
7781
7782 /// Sets the value of [root_principal_password_uri][crate::model::KerberosConfig::root_principal_password_uri].
7783 ///
7784 /// # Example
7785 /// ```ignore,no_run
7786 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7787 /// let x = KerberosConfig::new().set_root_principal_password_uri("example");
7788 /// ```
7789 pub fn set_root_principal_password_uri<T: std::convert::Into<std::string::String>>(
7790 mut self,
7791 v: T,
7792 ) -> Self {
7793 self.root_principal_password_uri = v.into();
7794 self
7795 }
7796
7797 /// Sets the value of [kms_key_uri][crate::model::KerberosConfig::kms_key_uri].
7798 ///
7799 /// # Example
7800 /// ```ignore,no_run
7801 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7802 /// let x = KerberosConfig::new().set_kms_key_uri("example");
7803 /// ```
7804 pub fn set_kms_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7805 self.kms_key_uri = v.into();
7806 self
7807 }
7808
7809 /// Sets the value of [keystore_uri][crate::model::KerberosConfig::keystore_uri].
7810 ///
7811 /// # Example
7812 /// ```ignore,no_run
7813 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7814 /// let x = KerberosConfig::new().set_keystore_uri("example");
7815 /// ```
7816 pub fn set_keystore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7817 self.keystore_uri = v.into();
7818 self
7819 }
7820
7821 /// Sets the value of [truststore_uri][crate::model::KerberosConfig::truststore_uri].
7822 ///
7823 /// # Example
7824 /// ```ignore,no_run
7825 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7826 /// let x = KerberosConfig::new().set_truststore_uri("example");
7827 /// ```
7828 pub fn set_truststore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7829 self.truststore_uri = v.into();
7830 self
7831 }
7832
7833 /// Sets the value of [keystore_password_uri][crate::model::KerberosConfig::keystore_password_uri].
7834 ///
7835 /// # Example
7836 /// ```ignore,no_run
7837 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7838 /// let x = KerberosConfig::new().set_keystore_password_uri("example");
7839 /// ```
7840 pub fn set_keystore_password_uri<T: std::convert::Into<std::string::String>>(
7841 mut self,
7842 v: T,
7843 ) -> Self {
7844 self.keystore_password_uri = v.into();
7845 self
7846 }
7847
7848 /// Sets the value of [key_password_uri][crate::model::KerberosConfig::key_password_uri].
7849 ///
7850 /// # Example
7851 /// ```ignore,no_run
7852 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7853 /// let x = KerberosConfig::new().set_key_password_uri("example");
7854 /// ```
7855 pub fn set_key_password_uri<T: std::convert::Into<std::string::String>>(
7856 mut self,
7857 v: T,
7858 ) -> Self {
7859 self.key_password_uri = v.into();
7860 self
7861 }
7862
7863 /// Sets the value of [truststore_password_uri][crate::model::KerberosConfig::truststore_password_uri].
7864 ///
7865 /// # Example
7866 /// ```ignore,no_run
7867 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7868 /// let x = KerberosConfig::new().set_truststore_password_uri("example");
7869 /// ```
7870 pub fn set_truststore_password_uri<T: std::convert::Into<std::string::String>>(
7871 mut self,
7872 v: T,
7873 ) -> Self {
7874 self.truststore_password_uri = v.into();
7875 self
7876 }
7877
7878 /// Sets the value of [cross_realm_trust_realm][crate::model::KerberosConfig::cross_realm_trust_realm].
7879 ///
7880 /// # Example
7881 /// ```ignore,no_run
7882 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7883 /// let x = KerberosConfig::new().set_cross_realm_trust_realm("example");
7884 /// ```
7885 pub fn set_cross_realm_trust_realm<T: std::convert::Into<std::string::String>>(
7886 mut self,
7887 v: T,
7888 ) -> Self {
7889 self.cross_realm_trust_realm = v.into();
7890 self
7891 }
7892
7893 /// Sets the value of [cross_realm_trust_kdc][crate::model::KerberosConfig::cross_realm_trust_kdc].
7894 ///
7895 /// # Example
7896 /// ```ignore,no_run
7897 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7898 /// let x = KerberosConfig::new().set_cross_realm_trust_kdc("example");
7899 /// ```
7900 pub fn set_cross_realm_trust_kdc<T: std::convert::Into<std::string::String>>(
7901 mut self,
7902 v: T,
7903 ) -> Self {
7904 self.cross_realm_trust_kdc = v.into();
7905 self
7906 }
7907
7908 /// Sets the value of [cross_realm_trust_admin_server][crate::model::KerberosConfig::cross_realm_trust_admin_server].
7909 ///
7910 /// # Example
7911 /// ```ignore,no_run
7912 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7913 /// let x = KerberosConfig::new().set_cross_realm_trust_admin_server("example");
7914 /// ```
7915 pub fn set_cross_realm_trust_admin_server<T: std::convert::Into<std::string::String>>(
7916 mut self,
7917 v: T,
7918 ) -> Self {
7919 self.cross_realm_trust_admin_server = v.into();
7920 self
7921 }
7922
7923 /// Sets the value of [cross_realm_trust_shared_password_uri][crate::model::KerberosConfig::cross_realm_trust_shared_password_uri].
7924 ///
7925 /// # Example
7926 /// ```ignore,no_run
7927 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7928 /// let x = KerberosConfig::new().set_cross_realm_trust_shared_password_uri("example");
7929 /// ```
7930 pub fn set_cross_realm_trust_shared_password_uri<T: std::convert::Into<std::string::String>>(
7931 mut self,
7932 v: T,
7933 ) -> Self {
7934 self.cross_realm_trust_shared_password_uri = v.into();
7935 self
7936 }
7937
7938 /// Sets the value of [kdc_db_key_uri][crate::model::KerberosConfig::kdc_db_key_uri].
7939 ///
7940 /// # Example
7941 /// ```ignore,no_run
7942 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7943 /// let x = KerberosConfig::new().set_kdc_db_key_uri("example");
7944 /// ```
7945 pub fn set_kdc_db_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7946 self.kdc_db_key_uri = v.into();
7947 self
7948 }
7949
7950 /// Sets the value of [tgt_lifetime_hours][crate::model::KerberosConfig::tgt_lifetime_hours].
7951 ///
7952 /// # Example
7953 /// ```ignore,no_run
7954 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7955 /// let x = KerberosConfig::new().set_tgt_lifetime_hours(42);
7956 /// ```
7957 pub fn set_tgt_lifetime_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7958 self.tgt_lifetime_hours = v.into();
7959 self
7960 }
7961
7962 /// Sets the value of [realm][crate::model::KerberosConfig::realm].
7963 ///
7964 /// # Example
7965 /// ```ignore,no_run
7966 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7967 /// let x = KerberosConfig::new().set_realm("example");
7968 /// ```
7969 pub fn set_realm<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7970 self.realm = v.into();
7971 self
7972 }
7973}
7974
7975impl wkt::message::Message for KerberosConfig {
7976 fn typename() -> &'static str {
7977 "type.googleapis.com/google.cloud.dataproc.v1.KerberosConfig"
7978 }
7979}
7980
7981/// Identity related configuration, including service account based
7982/// secure multi-tenancy user mappings.
7983#[derive(Clone, Default, PartialEq)]
7984#[non_exhaustive]
7985pub struct IdentityConfig {
7986 /// Required. Map of user to service account.
7987 pub user_service_account_mapping:
7988 std::collections::HashMap<std::string::String, std::string::String>,
7989
7990 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7991}
7992
7993impl IdentityConfig {
7994 pub fn new() -> Self {
7995 std::default::Default::default()
7996 }
7997
7998 /// Sets the value of [user_service_account_mapping][crate::model::IdentityConfig::user_service_account_mapping].
7999 ///
8000 /// # Example
8001 /// ```ignore,no_run
8002 /// # use google_cloud_dataproc_v1::model::IdentityConfig;
8003 /// let x = IdentityConfig::new().set_user_service_account_mapping([
8004 /// ("key0", "abc"),
8005 /// ("key1", "xyz"),
8006 /// ]);
8007 /// ```
8008 pub fn set_user_service_account_mapping<T, K, V>(mut self, v: T) -> Self
8009 where
8010 T: std::iter::IntoIterator<Item = (K, V)>,
8011 K: std::convert::Into<std::string::String>,
8012 V: std::convert::Into<std::string::String>,
8013 {
8014 use std::iter::Iterator;
8015 self.user_service_account_mapping =
8016 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8017 self
8018 }
8019}
8020
8021impl wkt::message::Message for IdentityConfig {
8022 fn typename() -> &'static str {
8023 "type.googleapis.com/google.cloud.dataproc.v1.IdentityConfig"
8024 }
8025}
8026
8027/// Specifies the selection and config of software inside the cluster.
8028#[derive(Clone, Default, PartialEq)]
8029#[non_exhaustive]
8030pub struct SoftwareConfig {
8031 /// Optional. The version of software inside the cluster. It must be one of the
8032 /// supported [Dataproc
8033 /// Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported-dataproc-image-versions),
8034 /// such as "1.2" (including a subminor version, such as "1.2.29"), or the
8035 /// ["preview"
8036 /// version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
8037 /// If unspecified, it defaults to the latest Debian version.
8038 pub image_version: std::string::String,
8039
8040 /// Optional. The properties to set on daemon config files.
8041 ///
8042 /// Property keys are specified in `prefix:property` format, for example
8043 /// `core:hadoop.tmp.dir`. The following are supported prefixes
8044 /// and their mappings:
8045 ///
8046 /// * capacity-scheduler: `capacity-scheduler.xml`
8047 /// * core: `core-site.xml`
8048 /// * distcp: `distcp-default.xml`
8049 /// * hdfs: `hdfs-site.xml`
8050 /// * hive: `hive-site.xml`
8051 /// * mapred: `mapred-site.xml`
8052 /// * pig: `pig.properties`
8053 /// * spark: `spark-defaults.conf`
8054 /// * yarn: `yarn-site.xml`
8055 ///
8056 /// For more information, see [Cluster
8057 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
8058 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
8059
8060 /// Optional. The set of components to activate on the cluster.
8061 pub optional_components: std::vec::Vec<crate::model::Component>,
8062
8063 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8064}
8065
8066impl SoftwareConfig {
8067 pub fn new() -> Self {
8068 std::default::Default::default()
8069 }
8070
8071 /// Sets the value of [image_version][crate::model::SoftwareConfig::image_version].
8072 ///
8073 /// # Example
8074 /// ```ignore,no_run
8075 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8076 /// let x = SoftwareConfig::new().set_image_version("example");
8077 /// ```
8078 pub fn set_image_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8079 self.image_version = v.into();
8080 self
8081 }
8082
8083 /// Sets the value of [properties][crate::model::SoftwareConfig::properties].
8084 ///
8085 /// # Example
8086 /// ```ignore,no_run
8087 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8088 /// let x = SoftwareConfig::new().set_properties([
8089 /// ("key0", "abc"),
8090 /// ("key1", "xyz"),
8091 /// ]);
8092 /// ```
8093 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
8094 where
8095 T: std::iter::IntoIterator<Item = (K, V)>,
8096 K: std::convert::Into<std::string::String>,
8097 V: std::convert::Into<std::string::String>,
8098 {
8099 use std::iter::Iterator;
8100 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8101 self
8102 }
8103
8104 /// Sets the value of [optional_components][crate::model::SoftwareConfig::optional_components].
8105 ///
8106 /// # Example
8107 /// ```ignore,no_run
8108 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8109 /// use google_cloud_dataproc_v1::model::Component;
8110 /// let x = SoftwareConfig::new().set_optional_components([
8111 /// Component::Anaconda,
8112 /// Component::Delta,
8113 /// Component::Docker,
8114 /// ]);
8115 /// ```
8116 pub fn set_optional_components<T, V>(mut self, v: T) -> Self
8117 where
8118 T: std::iter::IntoIterator<Item = V>,
8119 V: std::convert::Into<crate::model::Component>,
8120 {
8121 use std::iter::Iterator;
8122 self.optional_components = v.into_iter().map(|i| i.into()).collect();
8123 self
8124 }
8125}
8126
8127impl wkt::message::Message for SoftwareConfig {
8128 fn typename() -> &'static str {
8129 "type.googleapis.com/google.cloud.dataproc.v1.SoftwareConfig"
8130 }
8131}
8132
8133/// Specifies the cluster auto-delete schedule configuration.
8134#[derive(Clone, Default, PartialEq)]
8135#[non_exhaustive]
8136pub struct LifecycleConfig {
8137 /// Optional. The duration to keep the cluster alive while idling (when no jobs
8138 /// are running). Passing this threshold will cause the cluster to be
8139 /// deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON
8140 /// representation of
8141 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8142 pub idle_delete_ttl: std::option::Option<wkt::Duration>,
8143
8144 /// Output only. The time when cluster became idle (most recent job finished)
8145 /// and became eligible for deletion due to idleness (see JSON representation
8146 /// of
8147 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8148 pub idle_start_time: std::option::Option<wkt::Timestamp>,
8149
8150 /// Either the exact time the cluster should be deleted at or
8151 /// the cluster maximum age.
8152 pub ttl: std::option::Option<crate::model::lifecycle_config::Ttl>,
8153
8154 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8155}
8156
8157impl LifecycleConfig {
8158 pub fn new() -> Self {
8159 std::default::Default::default()
8160 }
8161
8162 /// Sets the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8163 ///
8164 /// # Example
8165 /// ```ignore,no_run
8166 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8167 /// use wkt::Duration;
8168 /// let x = LifecycleConfig::new().set_idle_delete_ttl(Duration::default()/* use setters */);
8169 /// ```
8170 pub fn set_idle_delete_ttl<T>(mut self, v: T) -> Self
8171 where
8172 T: std::convert::Into<wkt::Duration>,
8173 {
8174 self.idle_delete_ttl = std::option::Option::Some(v.into());
8175 self
8176 }
8177
8178 /// Sets or clears the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8179 ///
8180 /// # Example
8181 /// ```ignore,no_run
8182 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8183 /// use wkt::Duration;
8184 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(Some(Duration::default()/* use setters */));
8185 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(None::<Duration>);
8186 /// ```
8187 pub fn set_or_clear_idle_delete_ttl<T>(mut self, v: std::option::Option<T>) -> Self
8188 where
8189 T: std::convert::Into<wkt::Duration>,
8190 {
8191 self.idle_delete_ttl = v.map(|x| x.into());
8192 self
8193 }
8194
8195 /// Sets the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8196 ///
8197 /// # Example
8198 /// ```ignore,no_run
8199 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8200 /// use wkt::Timestamp;
8201 /// let x = LifecycleConfig::new().set_idle_start_time(Timestamp::default()/* use setters */);
8202 /// ```
8203 pub fn set_idle_start_time<T>(mut self, v: T) -> Self
8204 where
8205 T: std::convert::Into<wkt::Timestamp>,
8206 {
8207 self.idle_start_time = std::option::Option::Some(v.into());
8208 self
8209 }
8210
8211 /// Sets or clears the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8212 ///
8213 /// # Example
8214 /// ```ignore,no_run
8215 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8216 /// use wkt::Timestamp;
8217 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(Some(Timestamp::default()/* use setters */));
8218 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(None::<Timestamp>);
8219 /// ```
8220 pub fn set_or_clear_idle_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8221 where
8222 T: std::convert::Into<wkt::Timestamp>,
8223 {
8224 self.idle_start_time = v.map(|x| x.into());
8225 self
8226 }
8227
8228 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl].
8229 ///
8230 /// Note that all the setters affecting `ttl` are mutually
8231 /// exclusive.
8232 ///
8233 /// # Example
8234 /// ```ignore,no_run
8235 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8236 /// use wkt::Timestamp;
8237 /// let x = LifecycleConfig::new().set_ttl(Some(
8238 /// google_cloud_dataproc_v1::model::lifecycle_config::Ttl::AutoDeleteTime(Timestamp::default().into())));
8239 /// ```
8240 pub fn set_ttl<
8241 T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::Ttl>>,
8242 >(
8243 mut self,
8244 v: T,
8245 ) -> Self {
8246 self.ttl = v.into();
8247 self
8248 }
8249
8250 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8251 /// if it holds a `AutoDeleteTime`, `None` if the field is not set or
8252 /// holds a different branch.
8253 pub fn auto_delete_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
8254 #[allow(unreachable_patterns)]
8255 self.ttl.as_ref().and_then(|v| match v {
8256 crate::model::lifecycle_config::Ttl::AutoDeleteTime(v) => std::option::Option::Some(v),
8257 _ => std::option::Option::None,
8258 })
8259 }
8260
8261 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8262 /// to hold a `AutoDeleteTime`.
8263 ///
8264 /// Note that all the setters affecting `ttl` are
8265 /// mutually exclusive.
8266 ///
8267 /// # Example
8268 /// ```ignore,no_run
8269 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8270 /// use wkt::Timestamp;
8271 /// let x = LifecycleConfig::new().set_auto_delete_time(Timestamp::default()/* use setters */);
8272 /// assert!(x.auto_delete_time().is_some());
8273 /// assert!(x.auto_delete_ttl().is_none());
8274 /// ```
8275 pub fn set_auto_delete_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
8276 mut self,
8277 v: T,
8278 ) -> Self {
8279 self.ttl = std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTime(
8280 v.into(),
8281 ));
8282 self
8283 }
8284
8285 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8286 /// if it holds a `AutoDeleteTtl`, `None` if the field is not set or
8287 /// holds a different branch.
8288 pub fn auto_delete_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
8289 #[allow(unreachable_patterns)]
8290 self.ttl.as_ref().and_then(|v| match v {
8291 crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v) => std::option::Option::Some(v),
8292 _ => std::option::Option::None,
8293 })
8294 }
8295
8296 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8297 /// to hold a `AutoDeleteTtl`.
8298 ///
8299 /// Note that all the setters affecting `ttl` are
8300 /// mutually exclusive.
8301 ///
8302 /// # Example
8303 /// ```ignore,no_run
8304 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8305 /// use wkt::Duration;
8306 /// let x = LifecycleConfig::new().set_auto_delete_ttl(Duration::default()/* use setters */);
8307 /// assert!(x.auto_delete_ttl().is_some());
8308 /// assert!(x.auto_delete_time().is_none());
8309 /// ```
8310 pub fn set_auto_delete_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
8311 mut self,
8312 v: T,
8313 ) -> Self {
8314 self.ttl =
8315 std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v.into()));
8316 self
8317 }
8318}
8319
8320impl wkt::message::Message for LifecycleConfig {
8321 fn typename() -> &'static str {
8322 "type.googleapis.com/google.cloud.dataproc.v1.LifecycleConfig"
8323 }
8324}
8325
8326/// Defines additional types related to [LifecycleConfig].
8327pub mod lifecycle_config {
8328 #[allow(unused_imports)]
8329 use super::*;
8330
8331 /// Either the exact time the cluster should be deleted at or
8332 /// the cluster maximum age.
8333 #[derive(Clone, Debug, PartialEq)]
8334 #[non_exhaustive]
8335 pub enum Ttl {
8336 /// Optional. The time when cluster will be auto-deleted (see JSON
8337 /// representation of
8338 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8339 AutoDeleteTime(std::boxed::Box<wkt::Timestamp>),
8340 /// Optional. The lifetime duration of cluster. The cluster will be
8341 /// auto-deleted at the end of this period. Minimum value is 10 minutes;
8342 /// maximum value is 14 days (see JSON representation of
8343 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8344 AutoDeleteTtl(std::boxed::Box<wkt::Duration>),
8345 }
8346}
8347
8348/// Specifies a Metastore configuration.
8349#[derive(Clone, Default, PartialEq)]
8350#[non_exhaustive]
8351pub struct MetastoreConfig {
8352 /// Required. Resource name of an existing Dataproc Metastore service.
8353 ///
8354 /// Example:
8355 ///
8356 /// * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]`
8357 pub dataproc_metastore_service: std::string::String,
8358
8359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8360}
8361
8362impl MetastoreConfig {
8363 pub fn new() -> Self {
8364 std::default::Default::default()
8365 }
8366
8367 /// Sets the value of [dataproc_metastore_service][crate::model::MetastoreConfig::dataproc_metastore_service].
8368 ///
8369 /// # Example
8370 /// ```ignore,no_run
8371 /// # use google_cloud_dataproc_v1::model::MetastoreConfig;
8372 /// let x = MetastoreConfig::new().set_dataproc_metastore_service("example");
8373 /// ```
8374 pub fn set_dataproc_metastore_service<T: std::convert::Into<std::string::String>>(
8375 mut self,
8376 v: T,
8377 ) -> Self {
8378 self.dataproc_metastore_service = v.into();
8379 self
8380 }
8381}
8382
8383impl wkt::message::Message for MetastoreConfig {
8384 fn typename() -> &'static str {
8385 "type.googleapis.com/google.cloud.dataproc.v1.MetastoreConfig"
8386 }
8387}
8388
8389/// Contains cluster daemon metrics, such as HDFS and YARN stats.
8390///
8391/// **Beta Feature**: This report is available for testing purposes only. It may
8392/// be changed before final release.
8393#[derive(Clone, Default, PartialEq)]
8394#[non_exhaustive]
8395pub struct ClusterMetrics {
8396 /// The HDFS metrics.
8397 pub hdfs_metrics: std::collections::HashMap<std::string::String, i64>,
8398
8399 /// YARN metrics.
8400 pub yarn_metrics: std::collections::HashMap<std::string::String, i64>,
8401
8402 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8403}
8404
8405impl ClusterMetrics {
8406 pub fn new() -> Self {
8407 std::default::Default::default()
8408 }
8409
8410 /// Sets the value of [hdfs_metrics][crate::model::ClusterMetrics::hdfs_metrics].
8411 ///
8412 /// # Example
8413 /// ```ignore,no_run
8414 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8415 /// let x = ClusterMetrics::new().set_hdfs_metrics([
8416 /// ("key0", 123),
8417 /// ("key1", 456),
8418 /// ]);
8419 /// ```
8420 pub fn set_hdfs_metrics<T, K, V>(mut self, v: T) -> Self
8421 where
8422 T: std::iter::IntoIterator<Item = (K, V)>,
8423 K: std::convert::Into<std::string::String>,
8424 V: std::convert::Into<i64>,
8425 {
8426 use std::iter::Iterator;
8427 self.hdfs_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8428 self
8429 }
8430
8431 /// Sets the value of [yarn_metrics][crate::model::ClusterMetrics::yarn_metrics].
8432 ///
8433 /// # Example
8434 /// ```ignore,no_run
8435 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8436 /// let x = ClusterMetrics::new().set_yarn_metrics([
8437 /// ("key0", 123),
8438 /// ("key1", 456),
8439 /// ]);
8440 /// ```
8441 pub fn set_yarn_metrics<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<i64>,
8446 {
8447 use std::iter::Iterator;
8448 self.yarn_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8449 self
8450 }
8451}
8452
8453impl wkt::message::Message for ClusterMetrics {
8454 fn typename() -> &'static str {
8455 "type.googleapis.com/google.cloud.dataproc.v1.ClusterMetrics"
8456 }
8457}
8458
8459/// Dataproc metric config.
8460#[derive(Clone, Default, PartialEq)]
8461#[non_exhaustive]
8462pub struct DataprocMetricConfig {
8463 /// Required. Metrics sources to enable.
8464 pub metrics: std::vec::Vec<crate::model::dataproc_metric_config::Metric>,
8465
8466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8467}
8468
8469impl DataprocMetricConfig {
8470 pub fn new() -> Self {
8471 std::default::Default::default()
8472 }
8473
8474 /// Sets the value of [metrics][crate::model::DataprocMetricConfig::metrics].
8475 ///
8476 /// # Example
8477 /// ```ignore,no_run
8478 /// # use google_cloud_dataproc_v1::model::DataprocMetricConfig;
8479 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8480 /// let x = DataprocMetricConfig::new()
8481 /// .set_metrics([
8482 /// Metric::default()/* use setters */,
8483 /// Metric::default()/* use (different) setters */,
8484 /// ]);
8485 /// ```
8486 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8487 where
8488 T: std::iter::IntoIterator<Item = V>,
8489 V: std::convert::Into<crate::model::dataproc_metric_config::Metric>,
8490 {
8491 use std::iter::Iterator;
8492 self.metrics = v.into_iter().map(|i| i.into()).collect();
8493 self
8494 }
8495}
8496
8497impl wkt::message::Message for DataprocMetricConfig {
8498 fn typename() -> &'static str {
8499 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig"
8500 }
8501}
8502
8503/// Defines additional types related to [DataprocMetricConfig].
8504pub mod dataproc_metric_config {
8505 #[allow(unused_imports)]
8506 use super::*;
8507
8508 /// A Dataproc custom metric.
8509 #[derive(Clone, Default, PartialEq)]
8510 #[non_exhaustive]
8511 pub struct Metric {
8512 /// Required. A standard set of metrics is collected unless `metricOverrides`
8513 /// are specified for the metric source (see [Custom metrics]
8514 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8515 /// for more information).
8516 pub metric_source: crate::model::dataproc_metric_config::MetricSource,
8517
8518 /// Optional. Specify one or more [Custom metrics]
8519 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8520 /// to collect for the metric course (for the `SPARK` metric source (any
8521 /// [Spark metric]
8522 /// (<https://spark.apache.org/docs/latest/monitoring.html#metrics>) can be
8523 /// specified).
8524 ///
8525 /// Provide metrics in the following format:
8526 /// \<code\>\<var\>METRIC_SOURCE\</var\>:\<var\>INSTANCE\</var\>:\<var\>GROUP\</var\>:\<var\>METRIC\</var\>\</code\>
8527 /// Use camelcase as appropriate.
8528 ///
8529 /// Examples:
8530 ///
8531 /// ```norust
8532 /// yarn:ResourceManager:QueueMetrics:AppsCompleted
8533 /// spark:driver:DAGScheduler:job.allJobs
8534 /// sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed
8535 /// hiveserver2:JVM:Memory:NonHeapMemoryUsage.used
8536 /// ```
8537 ///
8538 /// Notes:
8539 ///
8540 /// * Only the specified overridden metrics are collected for the
8541 /// metric source. For example, if one or more `spark:executive` metrics
8542 /// are listed as metric overrides, other `SPARK` metrics are not
8543 /// collected. The collection of the metrics for other enabled custom
8544 /// metric sources is unaffected. For example, if both `SPARK` andd `YARN`
8545 /// metric sources are enabled, and overrides are provided for Spark
8546 /// metrics only, all YARN metrics are collected.
8547 pub metric_overrides: std::vec::Vec<std::string::String>,
8548
8549 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8550 }
8551
8552 impl Metric {
8553 pub fn new() -> Self {
8554 std::default::Default::default()
8555 }
8556
8557 /// Sets the value of [metric_source][crate::model::dataproc_metric_config::Metric::metric_source].
8558 ///
8559 /// # Example
8560 /// ```ignore,no_run
8561 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8562 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::MetricSource;
8563 /// let x0 = Metric::new().set_metric_source(MetricSource::MonitoringAgentDefaults);
8564 /// let x1 = Metric::new().set_metric_source(MetricSource::Hdfs);
8565 /// let x2 = Metric::new().set_metric_source(MetricSource::Spark);
8566 /// ```
8567 pub fn set_metric_source<
8568 T: std::convert::Into<crate::model::dataproc_metric_config::MetricSource>,
8569 >(
8570 mut self,
8571 v: T,
8572 ) -> Self {
8573 self.metric_source = v.into();
8574 self
8575 }
8576
8577 /// Sets the value of [metric_overrides][crate::model::dataproc_metric_config::Metric::metric_overrides].
8578 ///
8579 /// # Example
8580 /// ```ignore,no_run
8581 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8582 /// let x = Metric::new().set_metric_overrides(["a", "b", "c"]);
8583 /// ```
8584 pub fn set_metric_overrides<T, V>(mut self, v: T) -> Self
8585 where
8586 T: std::iter::IntoIterator<Item = V>,
8587 V: std::convert::Into<std::string::String>,
8588 {
8589 use std::iter::Iterator;
8590 self.metric_overrides = v.into_iter().map(|i| i.into()).collect();
8591 self
8592 }
8593 }
8594
8595 impl wkt::message::Message for Metric {
8596 fn typename() -> &'static str {
8597 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig.Metric"
8598 }
8599 }
8600
8601 /// A source for the collection of Dataproc custom metrics (see [Custom
8602 /// metrics]
8603 /// (<https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics>)).
8604 ///
8605 /// # Working with unknown values
8606 ///
8607 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8608 /// additional enum variants at any time. Adding new variants is not considered
8609 /// a breaking change. Applications should write their code in anticipation of:
8610 ///
8611 /// - New values appearing in future releases of the client library, **and**
8612 /// - New values received dynamically, without application changes.
8613 ///
8614 /// Please consult the [Working with enums] section in the user guide for some
8615 /// guidelines.
8616 ///
8617 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8618 #[derive(Clone, Debug, PartialEq)]
8619 #[non_exhaustive]
8620 pub enum MetricSource {
8621 /// Required unspecified metric source.
8622 Unspecified,
8623 /// Monitoring agent metrics. If this source is enabled,
8624 /// Dataproc enables the monitoring agent in Compute Engine,
8625 /// and collects monitoring agent metrics, which are published
8626 /// with an `agent.googleapis.com` prefix.
8627 MonitoringAgentDefaults,
8628 /// HDFS metric source.
8629 Hdfs,
8630 /// Spark metric source.
8631 Spark,
8632 /// YARN metric source.
8633 Yarn,
8634 /// Spark History Server metric source.
8635 SparkHistoryServer,
8636 /// Hiveserver2 metric source.
8637 Hiveserver2,
8638 /// hivemetastore metric source
8639 Hivemetastore,
8640 /// flink metric source
8641 Flink,
8642 /// If set, the enum was initialized with an unknown value.
8643 ///
8644 /// Applications can examine the value using [MetricSource::value] or
8645 /// [MetricSource::name].
8646 UnknownValue(metric_source::UnknownValue),
8647 }
8648
8649 #[doc(hidden)]
8650 pub mod metric_source {
8651 #[allow(unused_imports)]
8652 use super::*;
8653 #[derive(Clone, Debug, PartialEq)]
8654 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8655 }
8656
8657 impl MetricSource {
8658 /// Gets the enum value.
8659 ///
8660 /// Returns `None` if the enum contains an unknown value deserialized from
8661 /// the string representation of enums.
8662 pub fn value(&self) -> std::option::Option<i32> {
8663 match self {
8664 Self::Unspecified => std::option::Option::Some(0),
8665 Self::MonitoringAgentDefaults => std::option::Option::Some(1),
8666 Self::Hdfs => std::option::Option::Some(2),
8667 Self::Spark => std::option::Option::Some(3),
8668 Self::Yarn => std::option::Option::Some(4),
8669 Self::SparkHistoryServer => std::option::Option::Some(5),
8670 Self::Hiveserver2 => std::option::Option::Some(6),
8671 Self::Hivemetastore => std::option::Option::Some(7),
8672 Self::Flink => std::option::Option::Some(8),
8673 Self::UnknownValue(u) => u.0.value(),
8674 }
8675 }
8676
8677 /// Gets the enum value as a string.
8678 ///
8679 /// Returns `None` if the enum contains an unknown value deserialized from
8680 /// the integer representation of enums.
8681 pub fn name(&self) -> std::option::Option<&str> {
8682 match self {
8683 Self::Unspecified => std::option::Option::Some("METRIC_SOURCE_UNSPECIFIED"),
8684 Self::MonitoringAgentDefaults => {
8685 std::option::Option::Some("MONITORING_AGENT_DEFAULTS")
8686 }
8687 Self::Hdfs => std::option::Option::Some("HDFS"),
8688 Self::Spark => std::option::Option::Some("SPARK"),
8689 Self::Yarn => std::option::Option::Some("YARN"),
8690 Self::SparkHistoryServer => std::option::Option::Some("SPARK_HISTORY_SERVER"),
8691 Self::Hiveserver2 => std::option::Option::Some("HIVESERVER2"),
8692 Self::Hivemetastore => std::option::Option::Some("HIVEMETASTORE"),
8693 Self::Flink => std::option::Option::Some("FLINK"),
8694 Self::UnknownValue(u) => u.0.name(),
8695 }
8696 }
8697 }
8698
8699 impl std::default::Default for MetricSource {
8700 fn default() -> Self {
8701 use std::convert::From;
8702 Self::from(0)
8703 }
8704 }
8705
8706 impl std::fmt::Display for MetricSource {
8707 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8708 wkt::internal::display_enum(f, self.name(), self.value())
8709 }
8710 }
8711
8712 impl std::convert::From<i32> for MetricSource {
8713 fn from(value: i32) -> Self {
8714 match value {
8715 0 => Self::Unspecified,
8716 1 => Self::MonitoringAgentDefaults,
8717 2 => Self::Hdfs,
8718 3 => Self::Spark,
8719 4 => Self::Yarn,
8720 5 => Self::SparkHistoryServer,
8721 6 => Self::Hiveserver2,
8722 7 => Self::Hivemetastore,
8723 8 => Self::Flink,
8724 _ => Self::UnknownValue(metric_source::UnknownValue(
8725 wkt::internal::UnknownEnumValue::Integer(value),
8726 )),
8727 }
8728 }
8729 }
8730
8731 impl std::convert::From<&str> for MetricSource {
8732 fn from(value: &str) -> Self {
8733 use std::string::ToString;
8734 match value {
8735 "METRIC_SOURCE_UNSPECIFIED" => Self::Unspecified,
8736 "MONITORING_AGENT_DEFAULTS" => Self::MonitoringAgentDefaults,
8737 "HDFS" => Self::Hdfs,
8738 "SPARK" => Self::Spark,
8739 "YARN" => Self::Yarn,
8740 "SPARK_HISTORY_SERVER" => Self::SparkHistoryServer,
8741 "HIVESERVER2" => Self::Hiveserver2,
8742 "HIVEMETASTORE" => Self::Hivemetastore,
8743 "FLINK" => Self::Flink,
8744 _ => Self::UnknownValue(metric_source::UnknownValue(
8745 wkt::internal::UnknownEnumValue::String(value.to_string()),
8746 )),
8747 }
8748 }
8749 }
8750
8751 impl serde::ser::Serialize for MetricSource {
8752 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8753 where
8754 S: serde::Serializer,
8755 {
8756 match self {
8757 Self::Unspecified => serializer.serialize_i32(0),
8758 Self::MonitoringAgentDefaults => serializer.serialize_i32(1),
8759 Self::Hdfs => serializer.serialize_i32(2),
8760 Self::Spark => serializer.serialize_i32(3),
8761 Self::Yarn => serializer.serialize_i32(4),
8762 Self::SparkHistoryServer => serializer.serialize_i32(5),
8763 Self::Hiveserver2 => serializer.serialize_i32(6),
8764 Self::Hivemetastore => serializer.serialize_i32(7),
8765 Self::Flink => serializer.serialize_i32(8),
8766 Self::UnknownValue(u) => u.0.serialize(serializer),
8767 }
8768 }
8769 }
8770
8771 impl<'de> serde::de::Deserialize<'de> for MetricSource {
8772 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8773 where
8774 D: serde::Deserializer<'de>,
8775 {
8776 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricSource>::new(
8777 ".google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource",
8778 ))
8779 }
8780 }
8781}
8782
8783/// A request to create a cluster.
8784#[derive(Clone, Default, PartialEq)]
8785#[non_exhaustive]
8786pub struct CreateClusterRequest {
8787 /// Required. The ID of the Google Cloud Platform project that the cluster
8788 /// belongs to.
8789 pub project_id: std::string::String,
8790
8791 /// Required. The Dataproc region in which to handle the request.
8792 pub region: std::string::String,
8793
8794 /// Required. The cluster to create.
8795 pub cluster: std::option::Option<crate::model::Cluster>,
8796
8797 /// Optional. A unique ID used to identify the request. If the server receives
8798 /// two
8799 /// [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
8800 /// with the same id, then the second request will be ignored and the
8801 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8802 /// and stored in the backend is returned.
8803 ///
8804 /// It is recommended to always set this value to a
8805 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8806 ///
8807 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8808 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8809 ///
8810 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8811 pub request_id: std::string::String,
8812
8813 /// Optional. Failure action when primary worker creation fails.
8814 pub action_on_failed_primary_workers: crate::model::FailureAction,
8815
8816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8817}
8818
8819impl CreateClusterRequest {
8820 pub fn new() -> Self {
8821 std::default::Default::default()
8822 }
8823
8824 /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
8825 ///
8826 /// # Example
8827 /// ```ignore,no_run
8828 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8829 /// let x = CreateClusterRequest::new().set_project_id("example");
8830 /// ```
8831 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8832 self.project_id = v.into();
8833 self
8834 }
8835
8836 /// Sets the value of [region][crate::model::CreateClusterRequest::region].
8837 ///
8838 /// # Example
8839 /// ```ignore,no_run
8840 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8841 /// let x = CreateClusterRequest::new().set_region("example");
8842 /// ```
8843 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8844 self.region = v.into();
8845 self
8846 }
8847
8848 /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
8849 ///
8850 /// # Example
8851 /// ```ignore,no_run
8852 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8853 /// use google_cloud_dataproc_v1::model::Cluster;
8854 /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
8855 /// ```
8856 pub fn set_cluster<T>(mut self, v: T) -> Self
8857 where
8858 T: std::convert::Into<crate::model::Cluster>,
8859 {
8860 self.cluster = std::option::Option::Some(v.into());
8861 self
8862 }
8863
8864 /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
8865 ///
8866 /// # Example
8867 /// ```ignore,no_run
8868 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8869 /// use google_cloud_dataproc_v1::model::Cluster;
8870 /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
8871 /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
8872 /// ```
8873 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
8874 where
8875 T: std::convert::Into<crate::model::Cluster>,
8876 {
8877 self.cluster = v.map(|x| x.into());
8878 self
8879 }
8880
8881 /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
8882 ///
8883 /// # Example
8884 /// ```ignore,no_run
8885 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8886 /// let x = CreateClusterRequest::new().set_request_id("example");
8887 /// ```
8888 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8889 self.request_id = v.into();
8890 self
8891 }
8892
8893 /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
8894 ///
8895 /// # Example
8896 /// ```ignore,no_run
8897 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8898 /// use google_cloud_dataproc_v1::model::FailureAction;
8899 /// let x0 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::NoAction);
8900 /// let x1 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::Delete);
8901 /// ```
8902 pub fn set_action_on_failed_primary_workers<
8903 T: std::convert::Into<crate::model::FailureAction>,
8904 >(
8905 mut self,
8906 v: T,
8907 ) -> Self {
8908 self.action_on_failed_primary_workers = v.into();
8909 self
8910 }
8911}
8912
8913impl wkt::message::Message for CreateClusterRequest {
8914 fn typename() -> &'static str {
8915 "type.googleapis.com/google.cloud.dataproc.v1.CreateClusterRequest"
8916 }
8917}
8918
8919/// A request to update a cluster.
8920#[derive(Clone, Default, PartialEq)]
8921#[non_exhaustive]
8922pub struct UpdateClusterRequest {
8923 /// Required. The ID of the Google Cloud Platform project the
8924 /// cluster belongs to.
8925 pub project_id: std::string::String,
8926
8927 /// Required. The Dataproc region in which to handle the request.
8928 pub region: std::string::String,
8929
8930 /// Required. The cluster name.
8931 pub cluster_name: std::string::String,
8932
8933 /// Required. The changes to the cluster.
8934 pub cluster: std::option::Option<crate::model::Cluster>,
8935
8936 /// Optional. Timeout for graceful YARN decommissioning. Graceful
8937 /// decommissioning allows removing nodes from the cluster without
8938 /// interrupting jobs in progress. Timeout specifies how long to wait for jobs
8939 /// in progress to finish before forcefully removing nodes (and potentially
8940 /// interrupting jobs). Default timeout is 0 (for forceful decommission), and
8941 /// the maximum allowed timeout is 1 day. (see JSON representation of
8942 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8943 ///
8944 /// Only supported on Dataproc image versions 1.2 and higher.
8945 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
8946
8947 /// Required. Specifies the path, relative to `Cluster`, of
8948 /// the field to update. For example, to change the number of workers
8949 /// in a cluster to 5, the `update_mask` parameter would be
8950 /// specified as `config.worker_config.num_instances`,
8951 /// and the `PATCH` request body would specify the new value, as follows:
8952 ///
8953 /// ```norust
8954 /// {
8955 /// "config":{
8956 /// "workerConfig":{
8957 /// "numInstances":"5"
8958 /// }
8959 /// }
8960 /// }
8961 /// ```
8962 ///
8963 /// Similarly, to change the number of preemptible workers in a cluster to 5,
8964 /// the `update_mask` parameter would be
8965 /// `config.secondary_worker_config.num_instances`, and the `PATCH` request
8966 /// body would be set as follows:
8967 ///
8968 /// ```norust
8969 /// {
8970 /// "config":{
8971 /// "secondaryWorkerConfig":{
8972 /// "numInstances":"5"
8973 /// }
8974 /// }
8975 /// }
8976 /// ```
8977 ///
8978 /// \<strong\>Note:\</strong\> Currently, only the following fields can be updated:
8979 pub update_mask: std::option::Option<wkt::FieldMask>,
8980
8981 /// Optional. A unique ID used to identify the request. If the server
8982 /// receives two
8983 /// [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
8984 /// with the same id, then the second request will be ignored and the
8985 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8986 /// and stored in the backend is returned.
8987 ///
8988 /// It is recommended to always set this value to a
8989 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8990 ///
8991 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8992 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8993 ///
8994 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8995 pub request_id: std::string::String,
8996
8997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8998}
8999
9000impl UpdateClusterRequest {
9001 pub fn new() -> Self {
9002 std::default::Default::default()
9003 }
9004
9005 /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
9006 ///
9007 /// # Example
9008 /// ```ignore,no_run
9009 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9010 /// let x = UpdateClusterRequest::new().set_project_id("example");
9011 /// ```
9012 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9013 self.project_id = v.into();
9014 self
9015 }
9016
9017 /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
9018 ///
9019 /// # Example
9020 /// ```ignore,no_run
9021 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9022 /// let x = UpdateClusterRequest::new().set_region("example");
9023 /// ```
9024 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9025 self.region = v.into();
9026 self
9027 }
9028
9029 /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
9030 ///
9031 /// # Example
9032 /// ```ignore,no_run
9033 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9034 /// let x = UpdateClusterRequest::new().set_cluster_name("example");
9035 /// ```
9036 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9037 self.cluster_name = v.into();
9038 self
9039 }
9040
9041 /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9042 ///
9043 /// # Example
9044 /// ```ignore,no_run
9045 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9046 /// use google_cloud_dataproc_v1::model::Cluster;
9047 /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9048 /// ```
9049 pub fn set_cluster<T>(mut self, v: T) -> Self
9050 where
9051 T: std::convert::Into<crate::model::Cluster>,
9052 {
9053 self.cluster = std::option::Option::Some(v.into());
9054 self
9055 }
9056
9057 /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9058 ///
9059 /// # Example
9060 /// ```ignore,no_run
9061 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9062 /// use google_cloud_dataproc_v1::model::Cluster;
9063 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9064 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9065 /// ```
9066 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9067 where
9068 T: std::convert::Into<crate::model::Cluster>,
9069 {
9070 self.cluster = v.map(|x| x.into());
9071 self
9072 }
9073
9074 /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9075 ///
9076 /// # Example
9077 /// ```ignore,no_run
9078 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9079 /// use wkt::Duration;
9080 /// let x = UpdateClusterRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
9081 /// ```
9082 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
9083 where
9084 T: std::convert::Into<wkt::Duration>,
9085 {
9086 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
9087 self
9088 }
9089
9090 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9091 ///
9092 /// # Example
9093 /// ```ignore,no_run
9094 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9095 /// use wkt::Duration;
9096 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
9097 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
9098 /// ```
9099 pub fn set_or_clear_graceful_decommission_timeout<T>(
9100 mut self,
9101 v: std::option::Option<T>,
9102 ) -> Self
9103 where
9104 T: std::convert::Into<wkt::Duration>,
9105 {
9106 self.graceful_decommission_timeout = v.map(|x| x.into());
9107 self
9108 }
9109
9110 /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9111 ///
9112 /// # Example
9113 /// ```ignore,no_run
9114 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9115 /// use wkt::FieldMask;
9116 /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9117 /// ```
9118 pub fn set_update_mask<T>(mut self, v: T) -> Self
9119 where
9120 T: std::convert::Into<wkt::FieldMask>,
9121 {
9122 self.update_mask = std::option::Option::Some(v.into());
9123 self
9124 }
9125
9126 /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9127 ///
9128 /// # Example
9129 /// ```ignore,no_run
9130 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9131 /// use wkt::FieldMask;
9132 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9133 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9134 /// ```
9135 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9136 where
9137 T: std::convert::Into<wkt::FieldMask>,
9138 {
9139 self.update_mask = v.map(|x| x.into());
9140 self
9141 }
9142
9143 /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
9144 ///
9145 /// # Example
9146 /// ```ignore,no_run
9147 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9148 /// let x = UpdateClusterRequest::new().set_request_id("example");
9149 /// ```
9150 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9151 self.request_id = v.into();
9152 self
9153 }
9154}
9155
9156impl wkt::message::Message for UpdateClusterRequest {
9157 fn typename() -> &'static str {
9158 "type.googleapis.com/google.cloud.dataproc.v1.UpdateClusterRequest"
9159 }
9160}
9161
9162/// A request to stop a cluster.
9163#[derive(Clone, Default, PartialEq)]
9164#[non_exhaustive]
9165pub struct StopClusterRequest {
9166 /// Required. The ID of the Google Cloud Platform project the
9167 /// cluster belongs to.
9168 pub project_id: std::string::String,
9169
9170 /// Required. The Dataproc region in which to handle the request.
9171 pub region: std::string::String,
9172
9173 /// Required. The cluster name.
9174 pub cluster_name: std::string::String,
9175
9176 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9177 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9178 pub cluster_uuid: std::string::String,
9179
9180 /// Optional. A unique ID used to identify the request. If the server
9181 /// receives two
9182 /// [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
9183 /// with the same id, then the second request will be ignored and the
9184 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9185 /// and stored in the backend is returned.
9186 ///
9187 /// Recommendation: Set this value to a
9188 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9189 ///
9190 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9191 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9192 ///
9193 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9194 pub request_id: std::string::String,
9195
9196 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9197}
9198
9199impl StopClusterRequest {
9200 pub fn new() -> Self {
9201 std::default::Default::default()
9202 }
9203
9204 /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
9205 ///
9206 /// # Example
9207 /// ```ignore,no_run
9208 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9209 /// let x = StopClusterRequest::new().set_project_id("example");
9210 /// ```
9211 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9212 self.project_id = v.into();
9213 self
9214 }
9215
9216 /// Sets the value of [region][crate::model::StopClusterRequest::region].
9217 ///
9218 /// # Example
9219 /// ```ignore,no_run
9220 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9221 /// let x = StopClusterRequest::new().set_region("example");
9222 /// ```
9223 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9224 self.region = v.into();
9225 self
9226 }
9227
9228 /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
9229 ///
9230 /// # Example
9231 /// ```ignore,no_run
9232 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9233 /// let x = StopClusterRequest::new().set_cluster_name("example");
9234 /// ```
9235 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9236 self.cluster_name = v.into();
9237 self
9238 }
9239
9240 /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
9241 ///
9242 /// # Example
9243 /// ```ignore,no_run
9244 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9245 /// let x = StopClusterRequest::new().set_cluster_uuid("example");
9246 /// ```
9247 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9248 self.cluster_uuid = v.into();
9249 self
9250 }
9251
9252 /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
9253 ///
9254 /// # Example
9255 /// ```ignore,no_run
9256 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9257 /// let x = StopClusterRequest::new().set_request_id("example");
9258 /// ```
9259 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9260 self.request_id = v.into();
9261 self
9262 }
9263}
9264
9265impl wkt::message::Message for StopClusterRequest {
9266 fn typename() -> &'static str {
9267 "type.googleapis.com/google.cloud.dataproc.v1.StopClusterRequest"
9268 }
9269}
9270
9271/// A request to start a cluster.
9272#[derive(Clone, Default, PartialEq)]
9273#[non_exhaustive]
9274pub struct StartClusterRequest {
9275 /// Required. The ID of the Google Cloud Platform project the
9276 /// cluster belongs to.
9277 pub project_id: std::string::String,
9278
9279 /// Required. The Dataproc region in which to handle the request.
9280 pub region: std::string::String,
9281
9282 /// Required. The cluster name.
9283 pub cluster_name: std::string::String,
9284
9285 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9286 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9287 pub cluster_uuid: std::string::String,
9288
9289 /// Optional. A unique ID used to identify the request. If the server
9290 /// receives two
9291 /// [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
9292 /// with the same id, then the second request will be ignored and the
9293 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9294 /// and stored in the backend is returned.
9295 ///
9296 /// Recommendation: Set this value to a
9297 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9298 ///
9299 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9300 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9301 ///
9302 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9303 pub request_id: std::string::String,
9304
9305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9306}
9307
9308impl StartClusterRequest {
9309 pub fn new() -> Self {
9310 std::default::Default::default()
9311 }
9312
9313 /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
9314 ///
9315 /// # Example
9316 /// ```ignore,no_run
9317 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9318 /// let x = StartClusterRequest::new().set_project_id("example");
9319 /// ```
9320 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9321 self.project_id = v.into();
9322 self
9323 }
9324
9325 /// Sets the value of [region][crate::model::StartClusterRequest::region].
9326 ///
9327 /// # Example
9328 /// ```ignore,no_run
9329 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9330 /// let x = StartClusterRequest::new().set_region("example");
9331 /// ```
9332 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9333 self.region = v.into();
9334 self
9335 }
9336
9337 /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
9338 ///
9339 /// # Example
9340 /// ```ignore,no_run
9341 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9342 /// let x = StartClusterRequest::new().set_cluster_name("example");
9343 /// ```
9344 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9345 self.cluster_name = v.into();
9346 self
9347 }
9348
9349 /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
9350 ///
9351 /// # Example
9352 /// ```ignore,no_run
9353 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9354 /// let x = StartClusterRequest::new().set_cluster_uuid("example");
9355 /// ```
9356 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9357 self.cluster_uuid = v.into();
9358 self
9359 }
9360
9361 /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
9362 ///
9363 /// # Example
9364 /// ```ignore,no_run
9365 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9366 /// let x = StartClusterRequest::new().set_request_id("example");
9367 /// ```
9368 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9369 self.request_id = v.into();
9370 self
9371 }
9372}
9373
9374impl wkt::message::Message for StartClusterRequest {
9375 fn typename() -> &'static str {
9376 "type.googleapis.com/google.cloud.dataproc.v1.StartClusterRequest"
9377 }
9378}
9379
9380/// A request to delete a cluster.
9381#[derive(Clone, Default, PartialEq)]
9382#[non_exhaustive]
9383pub struct DeleteClusterRequest {
9384 /// Required. The ID of the Google Cloud Platform project that the cluster
9385 /// belongs to.
9386 pub project_id: std::string::String,
9387
9388 /// Required. The Dataproc region in which to handle the request.
9389 pub region: std::string::String,
9390
9391 /// Required. The cluster name.
9392 pub cluster_name: std::string::String,
9393
9394 /// Optional. Specifying the `cluster_uuid` means the RPC should fail
9395 /// (with error NOT_FOUND) if cluster with specified UUID does not exist.
9396 pub cluster_uuid: std::string::String,
9397
9398 /// Optional. A unique ID used to identify the request. If the server
9399 /// receives two
9400 /// [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
9401 /// with the same id, then the second request will be ignored and the
9402 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9403 /// and stored in the backend is returned.
9404 ///
9405 /// It is recommended to always set this value to a
9406 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9407 ///
9408 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9409 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9410 ///
9411 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9412 pub request_id: std::string::String,
9413
9414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9415}
9416
9417impl DeleteClusterRequest {
9418 pub fn new() -> Self {
9419 std::default::Default::default()
9420 }
9421
9422 /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
9423 ///
9424 /// # Example
9425 /// ```ignore,no_run
9426 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9427 /// let x = DeleteClusterRequest::new().set_project_id("example");
9428 /// ```
9429 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9430 self.project_id = v.into();
9431 self
9432 }
9433
9434 /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
9435 ///
9436 /// # Example
9437 /// ```ignore,no_run
9438 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9439 /// let x = DeleteClusterRequest::new().set_region("example");
9440 /// ```
9441 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9442 self.region = v.into();
9443 self
9444 }
9445
9446 /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
9447 ///
9448 /// # Example
9449 /// ```ignore,no_run
9450 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9451 /// let x = DeleteClusterRequest::new().set_cluster_name("example");
9452 /// ```
9453 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9454 self.cluster_name = v.into();
9455 self
9456 }
9457
9458 /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
9459 ///
9460 /// # Example
9461 /// ```ignore,no_run
9462 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9463 /// let x = DeleteClusterRequest::new().set_cluster_uuid("example");
9464 /// ```
9465 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9466 self.cluster_uuid = v.into();
9467 self
9468 }
9469
9470 /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
9471 ///
9472 /// # Example
9473 /// ```ignore,no_run
9474 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9475 /// let x = DeleteClusterRequest::new().set_request_id("example");
9476 /// ```
9477 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9478 self.request_id = v.into();
9479 self
9480 }
9481}
9482
9483impl wkt::message::Message for DeleteClusterRequest {
9484 fn typename() -> &'static str {
9485 "type.googleapis.com/google.cloud.dataproc.v1.DeleteClusterRequest"
9486 }
9487}
9488
9489/// Request to get the resource representation for a cluster in a project.
9490#[derive(Clone, Default, PartialEq)]
9491#[non_exhaustive]
9492pub struct GetClusterRequest {
9493 /// Required. The ID of the Google Cloud Platform project that the cluster
9494 /// belongs to.
9495 pub project_id: std::string::String,
9496
9497 /// Required. The Dataproc region in which to handle the request.
9498 pub region: std::string::String,
9499
9500 /// Required. The cluster name.
9501 pub cluster_name: std::string::String,
9502
9503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9504}
9505
9506impl GetClusterRequest {
9507 pub fn new() -> Self {
9508 std::default::Default::default()
9509 }
9510
9511 /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
9512 ///
9513 /// # Example
9514 /// ```ignore,no_run
9515 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9516 /// let x = GetClusterRequest::new().set_project_id("example");
9517 /// ```
9518 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9519 self.project_id = v.into();
9520 self
9521 }
9522
9523 /// Sets the value of [region][crate::model::GetClusterRequest::region].
9524 ///
9525 /// # Example
9526 /// ```ignore,no_run
9527 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9528 /// let x = GetClusterRequest::new().set_region("example");
9529 /// ```
9530 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9531 self.region = v.into();
9532 self
9533 }
9534
9535 /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
9536 ///
9537 /// # Example
9538 /// ```ignore,no_run
9539 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9540 /// let x = GetClusterRequest::new().set_cluster_name("example");
9541 /// ```
9542 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9543 self.cluster_name = v.into();
9544 self
9545 }
9546}
9547
9548impl wkt::message::Message for GetClusterRequest {
9549 fn typename() -> &'static str {
9550 "type.googleapis.com/google.cloud.dataproc.v1.GetClusterRequest"
9551 }
9552}
9553
9554/// A request to list the clusters in a project.
9555#[derive(Clone, Default, PartialEq)]
9556#[non_exhaustive]
9557pub struct ListClustersRequest {
9558 /// Required. The ID of the Google Cloud Platform project that the cluster
9559 /// belongs to.
9560 pub project_id: std::string::String,
9561
9562 /// Required. The Dataproc region in which to handle the request.
9563 pub region: std::string::String,
9564
9565 /// Optional. A filter constraining the clusters to list. Filters are
9566 /// case-sensitive and have the following syntax:
9567 ///
9568 /// field = value [AND [field = value]] ...
9569 ///
9570 /// where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
9571 /// and `[KEY]` is a label key. **value** can be `*` to match all values.
9572 /// `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
9573 /// `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
9574 /// `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
9575 /// states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
9576 /// `STOPPED` states. `clusterName` is the name of the cluster provided at
9577 /// creation time. Only the logical `AND` operator is supported;
9578 /// space-separated items are treated as having an implicit `AND` operator.
9579 ///
9580 /// Example filter:
9581 ///
9582 /// status.state = ACTIVE AND clusterName = mycluster
9583 /// AND labels.env = staging AND labels.starred = *
9584 pub filter: std::string::String,
9585
9586 /// Optional. The standard List page size.
9587 pub page_size: i32,
9588
9589 /// Optional. The standard List page token.
9590 pub page_token: std::string::String,
9591
9592 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9593}
9594
9595impl ListClustersRequest {
9596 pub fn new() -> Self {
9597 std::default::Default::default()
9598 }
9599
9600 /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
9601 ///
9602 /// # Example
9603 /// ```ignore,no_run
9604 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9605 /// let x = ListClustersRequest::new().set_project_id("example");
9606 /// ```
9607 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9608 self.project_id = v.into();
9609 self
9610 }
9611
9612 /// Sets the value of [region][crate::model::ListClustersRequest::region].
9613 ///
9614 /// # Example
9615 /// ```ignore,no_run
9616 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9617 /// let x = ListClustersRequest::new().set_region("example");
9618 /// ```
9619 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9620 self.region = v.into();
9621 self
9622 }
9623
9624 /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
9625 ///
9626 /// # Example
9627 /// ```ignore,no_run
9628 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9629 /// let x = ListClustersRequest::new().set_filter("example");
9630 /// ```
9631 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9632 self.filter = v.into();
9633 self
9634 }
9635
9636 /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
9637 ///
9638 /// # Example
9639 /// ```ignore,no_run
9640 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9641 /// let x = ListClustersRequest::new().set_page_size(42);
9642 /// ```
9643 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9644 self.page_size = v.into();
9645 self
9646 }
9647
9648 /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
9649 ///
9650 /// # Example
9651 /// ```ignore,no_run
9652 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9653 /// let x = ListClustersRequest::new().set_page_token("example");
9654 /// ```
9655 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9656 self.page_token = v.into();
9657 self
9658 }
9659}
9660
9661impl wkt::message::Message for ListClustersRequest {
9662 fn typename() -> &'static str {
9663 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersRequest"
9664 }
9665}
9666
9667/// The list of all clusters in a project.
9668#[derive(Clone, Default, PartialEq)]
9669#[non_exhaustive]
9670pub struct ListClustersResponse {
9671 /// Output only. The clusters in the project.
9672 pub clusters: std::vec::Vec<crate::model::Cluster>,
9673
9674 /// Output only. This token is included in the response if there are more
9675 /// results to fetch. To fetch additional results, provide this value as the
9676 /// `page_token` in a subsequent `ListClustersRequest`.
9677 pub next_page_token: std::string::String,
9678
9679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9680}
9681
9682impl ListClustersResponse {
9683 pub fn new() -> Self {
9684 std::default::Default::default()
9685 }
9686
9687 /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
9688 ///
9689 /// # Example
9690 /// ```ignore,no_run
9691 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9692 /// use google_cloud_dataproc_v1::model::Cluster;
9693 /// let x = ListClustersResponse::new()
9694 /// .set_clusters([
9695 /// Cluster::default()/* use setters */,
9696 /// Cluster::default()/* use (different) setters */,
9697 /// ]);
9698 /// ```
9699 pub fn set_clusters<T, V>(mut self, v: T) -> Self
9700 where
9701 T: std::iter::IntoIterator<Item = V>,
9702 V: std::convert::Into<crate::model::Cluster>,
9703 {
9704 use std::iter::Iterator;
9705 self.clusters = v.into_iter().map(|i| i.into()).collect();
9706 self
9707 }
9708
9709 /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
9710 ///
9711 /// # Example
9712 /// ```ignore,no_run
9713 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9714 /// let x = ListClustersResponse::new().set_next_page_token("example");
9715 /// ```
9716 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9717 self.next_page_token = v.into();
9718 self
9719 }
9720}
9721
9722impl wkt::message::Message for ListClustersResponse {
9723 fn typename() -> &'static str {
9724 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersResponse"
9725 }
9726}
9727
9728#[doc(hidden)]
9729impl google_cloud_gax::paginator::internal::PageableResponse for ListClustersResponse {
9730 type PageItem = crate::model::Cluster;
9731
9732 fn items(self) -> std::vec::Vec<Self::PageItem> {
9733 self.clusters
9734 }
9735
9736 fn next_page_token(&self) -> std::string::String {
9737 use std::clone::Clone;
9738 self.next_page_token.clone()
9739 }
9740}
9741
9742/// A request to collect cluster diagnostic information.
9743#[derive(Clone, Default, PartialEq)]
9744#[non_exhaustive]
9745pub struct DiagnoseClusterRequest {
9746 /// Required. The ID of the Google Cloud Platform project that the cluster
9747 /// belongs to.
9748 pub project_id: std::string::String,
9749
9750 /// Required. The Dataproc region in which to handle the request.
9751 pub region: std::string::String,
9752
9753 /// Required. The cluster name.
9754 pub cluster_name: std::string::String,
9755
9756 /// Optional. (Optional) The output Cloud Storage directory for the diagnostic
9757 /// tarball. If not specified, a task-specific directory in the cluster's
9758 /// staging bucket will be used.
9759 pub tarball_gcs_dir: std::string::String,
9760
9761 /// Optional. (Optional) The access type to the diagnostic tarball. If not
9762 /// specified, falls back to default access of the bucket
9763 pub tarball_access: crate::model::diagnose_cluster_request::TarballAccess,
9764
9765 /// Optional. Time interval in which diagnosis should be carried out on the
9766 /// cluster.
9767 pub diagnosis_interval: std::option::Option<google_cloud_type::model::Interval>,
9768
9769 /// Optional. Specifies a list of jobs on which diagnosis is to be performed.
9770 /// Format: projects/{project}/regions/{region}/jobs/{job}
9771 pub jobs: std::vec::Vec<std::string::String>,
9772
9773 /// Optional. Specifies a list of yarn applications on which diagnosis is to be
9774 /// performed.
9775 pub yarn_application_ids: std::vec::Vec<std::string::String>,
9776
9777 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9778}
9779
9780impl DiagnoseClusterRequest {
9781 pub fn new() -> Self {
9782 std::default::Default::default()
9783 }
9784
9785 /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9790 /// let x = DiagnoseClusterRequest::new().set_project_id("example");
9791 /// ```
9792 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9793 self.project_id = v.into();
9794 self
9795 }
9796
9797 /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
9798 ///
9799 /// # Example
9800 /// ```ignore,no_run
9801 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9802 /// let x = DiagnoseClusterRequest::new().set_region("example");
9803 /// ```
9804 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9805 self.region = v.into();
9806 self
9807 }
9808
9809 /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
9810 ///
9811 /// # Example
9812 /// ```ignore,no_run
9813 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9814 /// let x = DiagnoseClusterRequest::new().set_cluster_name("example");
9815 /// ```
9816 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9817 self.cluster_name = v.into();
9818 self
9819 }
9820
9821 /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
9822 ///
9823 /// # Example
9824 /// ```ignore,no_run
9825 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9826 /// let x = DiagnoseClusterRequest::new().set_tarball_gcs_dir("example");
9827 /// ```
9828 pub fn set_tarball_gcs_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9829 self.tarball_gcs_dir = v.into();
9830 self
9831 }
9832
9833 /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
9834 ///
9835 /// # Example
9836 /// ```ignore,no_run
9837 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9838 /// use google_cloud_dataproc_v1::model::diagnose_cluster_request::TarballAccess;
9839 /// let x0 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleCloudSupport);
9840 /// let x1 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleDataprocDiagnose);
9841 /// ```
9842 pub fn set_tarball_access<
9843 T: std::convert::Into<crate::model::diagnose_cluster_request::TarballAccess>,
9844 >(
9845 mut self,
9846 v: T,
9847 ) -> Self {
9848 self.tarball_access = v.into();
9849 self
9850 }
9851
9852 /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9853 ///
9854 /// # Example
9855 /// ```ignore,no_run
9856 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9857 /// use google_cloud_type::model::Interval;
9858 /// let x = DiagnoseClusterRequest::new().set_diagnosis_interval(Interval::default()/* use setters */);
9859 /// ```
9860 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
9861 where
9862 T: std::convert::Into<google_cloud_type::model::Interval>,
9863 {
9864 self.diagnosis_interval = std::option::Option::Some(v.into());
9865 self
9866 }
9867
9868 /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9869 ///
9870 /// # Example
9871 /// ```ignore,no_run
9872 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9873 /// use google_cloud_type::model::Interval;
9874 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(Some(Interval::default()/* use setters */));
9875 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(None::<Interval>);
9876 /// ```
9877 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
9878 where
9879 T: std::convert::Into<google_cloud_type::model::Interval>,
9880 {
9881 self.diagnosis_interval = v.map(|x| x.into());
9882 self
9883 }
9884
9885 /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
9886 ///
9887 /// # Example
9888 /// ```ignore,no_run
9889 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9890 /// let x = DiagnoseClusterRequest::new().set_jobs(["a", "b", "c"]);
9891 /// ```
9892 pub fn set_jobs<T, V>(mut self, v: T) -> Self
9893 where
9894 T: std::iter::IntoIterator<Item = V>,
9895 V: std::convert::Into<std::string::String>,
9896 {
9897 use std::iter::Iterator;
9898 self.jobs = v.into_iter().map(|i| i.into()).collect();
9899 self
9900 }
9901
9902 /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
9903 ///
9904 /// # Example
9905 /// ```ignore,no_run
9906 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9907 /// let x = DiagnoseClusterRequest::new().set_yarn_application_ids(["a", "b", "c"]);
9908 /// ```
9909 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
9910 where
9911 T: std::iter::IntoIterator<Item = V>,
9912 V: std::convert::Into<std::string::String>,
9913 {
9914 use std::iter::Iterator;
9915 self.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
9916 self
9917 }
9918}
9919
9920impl wkt::message::Message for DiagnoseClusterRequest {
9921 fn typename() -> &'static str {
9922 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterRequest"
9923 }
9924}
9925
9926/// Defines additional types related to [DiagnoseClusterRequest].
9927pub mod diagnose_cluster_request {
9928 #[allow(unused_imports)]
9929 use super::*;
9930
9931 /// Defines who has access to the diagnostic tarball
9932 ///
9933 /// # Working with unknown values
9934 ///
9935 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9936 /// additional enum variants at any time. Adding new variants is not considered
9937 /// a breaking change. Applications should write their code in anticipation of:
9938 ///
9939 /// - New values appearing in future releases of the client library, **and**
9940 /// - New values received dynamically, without application changes.
9941 ///
9942 /// Please consult the [Working with enums] section in the user guide for some
9943 /// guidelines.
9944 ///
9945 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9946 #[derive(Clone, Debug, PartialEq)]
9947 #[non_exhaustive]
9948 pub enum TarballAccess {
9949 /// Tarball Access unspecified. Falls back to default access of the bucket
9950 Unspecified,
9951 /// Google Cloud Support group has read access to the
9952 /// diagnostic tarball
9953 GoogleCloudSupport,
9954 /// Google Cloud Dataproc Diagnose service account has read access to the
9955 /// diagnostic tarball
9956 GoogleDataprocDiagnose,
9957 /// If set, the enum was initialized with an unknown value.
9958 ///
9959 /// Applications can examine the value using [TarballAccess::value] or
9960 /// [TarballAccess::name].
9961 UnknownValue(tarball_access::UnknownValue),
9962 }
9963
9964 #[doc(hidden)]
9965 pub mod tarball_access {
9966 #[allow(unused_imports)]
9967 use super::*;
9968 #[derive(Clone, Debug, PartialEq)]
9969 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9970 }
9971
9972 impl TarballAccess {
9973 /// Gets the enum value.
9974 ///
9975 /// Returns `None` if the enum contains an unknown value deserialized from
9976 /// the string representation of enums.
9977 pub fn value(&self) -> std::option::Option<i32> {
9978 match self {
9979 Self::Unspecified => std::option::Option::Some(0),
9980 Self::GoogleCloudSupport => std::option::Option::Some(1),
9981 Self::GoogleDataprocDiagnose => std::option::Option::Some(2),
9982 Self::UnknownValue(u) => u.0.value(),
9983 }
9984 }
9985
9986 /// Gets the enum value as a string.
9987 ///
9988 /// Returns `None` if the enum contains an unknown value deserialized from
9989 /// the integer representation of enums.
9990 pub fn name(&self) -> std::option::Option<&str> {
9991 match self {
9992 Self::Unspecified => std::option::Option::Some("TARBALL_ACCESS_UNSPECIFIED"),
9993 Self::GoogleCloudSupport => std::option::Option::Some("GOOGLE_CLOUD_SUPPORT"),
9994 Self::GoogleDataprocDiagnose => {
9995 std::option::Option::Some("GOOGLE_DATAPROC_DIAGNOSE")
9996 }
9997 Self::UnknownValue(u) => u.0.name(),
9998 }
9999 }
10000 }
10001
10002 impl std::default::Default for TarballAccess {
10003 fn default() -> Self {
10004 use std::convert::From;
10005 Self::from(0)
10006 }
10007 }
10008
10009 impl std::fmt::Display for TarballAccess {
10010 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10011 wkt::internal::display_enum(f, self.name(), self.value())
10012 }
10013 }
10014
10015 impl std::convert::From<i32> for TarballAccess {
10016 fn from(value: i32) -> Self {
10017 match value {
10018 0 => Self::Unspecified,
10019 1 => Self::GoogleCloudSupport,
10020 2 => Self::GoogleDataprocDiagnose,
10021 _ => Self::UnknownValue(tarball_access::UnknownValue(
10022 wkt::internal::UnknownEnumValue::Integer(value),
10023 )),
10024 }
10025 }
10026 }
10027
10028 impl std::convert::From<&str> for TarballAccess {
10029 fn from(value: &str) -> Self {
10030 use std::string::ToString;
10031 match value {
10032 "TARBALL_ACCESS_UNSPECIFIED" => Self::Unspecified,
10033 "GOOGLE_CLOUD_SUPPORT" => Self::GoogleCloudSupport,
10034 "GOOGLE_DATAPROC_DIAGNOSE" => Self::GoogleDataprocDiagnose,
10035 _ => Self::UnknownValue(tarball_access::UnknownValue(
10036 wkt::internal::UnknownEnumValue::String(value.to_string()),
10037 )),
10038 }
10039 }
10040 }
10041
10042 impl serde::ser::Serialize for TarballAccess {
10043 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10044 where
10045 S: serde::Serializer,
10046 {
10047 match self {
10048 Self::Unspecified => serializer.serialize_i32(0),
10049 Self::GoogleCloudSupport => serializer.serialize_i32(1),
10050 Self::GoogleDataprocDiagnose => serializer.serialize_i32(2),
10051 Self::UnknownValue(u) => u.0.serialize(serializer),
10052 }
10053 }
10054 }
10055
10056 impl<'de> serde::de::Deserialize<'de> for TarballAccess {
10057 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10058 where
10059 D: serde::Deserializer<'de>,
10060 {
10061 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TarballAccess>::new(
10062 ".google.cloud.dataproc.v1.DiagnoseClusterRequest.TarballAccess",
10063 ))
10064 }
10065 }
10066}
10067
10068/// The location of diagnostic output.
10069#[derive(Clone, Default, PartialEq)]
10070#[non_exhaustive]
10071pub struct DiagnoseClusterResults {
10072 /// Output only. The Cloud Storage URI of the diagnostic output.
10073 /// The output report is a plain text file with a summary of collected
10074 /// diagnostics.
10075 pub output_uri: std::string::String,
10076
10077 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10078}
10079
10080impl DiagnoseClusterResults {
10081 pub fn new() -> Self {
10082 std::default::Default::default()
10083 }
10084
10085 /// Sets the value of [output_uri][crate::model::DiagnoseClusterResults::output_uri].
10086 ///
10087 /// # Example
10088 /// ```ignore,no_run
10089 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterResults;
10090 /// let x = DiagnoseClusterResults::new().set_output_uri("example");
10091 /// ```
10092 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10093 self.output_uri = v.into();
10094 self
10095 }
10096}
10097
10098impl wkt::message::Message for DiagnoseClusterResults {
10099 fn typename() -> &'static str {
10100 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterResults"
10101 }
10102}
10103
10104/// Reservation Affinity for consuming Zonal reservation.
10105#[derive(Clone, Default, PartialEq)]
10106#[non_exhaustive]
10107pub struct ReservationAffinity {
10108 /// Optional. Type of reservation to consume
10109 pub consume_reservation_type: crate::model::reservation_affinity::Type,
10110
10111 /// Optional. Corresponds to the label key of reservation resource.
10112 pub key: std::string::String,
10113
10114 /// Optional. Corresponds to the label values of reservation resource.
10115 pub values: std::vec::Vec<std::string::String>,
10116
10117 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10118}
10119
10120impl ReservationAffinity {
10121 pub fn new() -> Self {
10122 std::default::Default::default()
10123 }
10124
10125 /// Sets the value of [consume_reservation_type][crate::model::ReservationAffinity::consume_reservation_type].
10126 ///
10127 /// # Example
10128 /// ```ignore,no_run
10129 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10130 /// use google_cloud_dataproc_v1::model::reservation_affinity::Type;
10131 /// let x0 = ReservationAffinity::new().set_consume_reservation_type(Type::NoReservation);
10132 /// let x1 = ReservationAffinity::new().set_consume_reservation_type(Type::AnyReservation);
10133 /// let x2 = ReservationAffinity::new().set_consume_reservation_type(Type::SpecificReservation);
10134 /// ```
10135 pub fn set_consume_reservation_type<
10136 T: std::convert::Into<crate::model::reservation_affinity::Type>,
10137 >(
10138 mut self,
10139 v: T,
10140 ) -> Self {
10141 self.consume_reservation_type = v.into();
10142 self
10143 }
10144
10145 /// Sets the value of [key][crate::model::ReservationAffinity::key].
10146 ///
10147 /// # Example
10148 /// ```ignore,no_run
10149 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10150 /// let x = ReservationAffinity::new().set_key("example");
10151 /// ```
10152 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10153 self.key = v.into();
10154 self
10155 }
10156
10157 /// Sets the value of [values][crate::model::ReservationAffinity::values].
10158 ///
10159 /// # Example
10160 /// ```ignore,no_run
10161 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10162 /// let x = ReservationAffinity::new().set_values(["a", "b", "c"]);
10163 /// ```
10164 pub fn set_values<T, V>(mut self, v: T) -> Self
10165 where
10166 T: std::iter::IntoIterator<Item = V>,
10167 V: std::convert::Into<std::string::String>,
10168 {
10169 use std::iter::Iterator;
10170 self.values = v.into_iter().map(|i| i.into()).collect();
10171 self
10172 }
10173}
10174
10175impl wkt::message::Message for ReservationAffinity {
10176 fn typename() -> &'static str {
10177 "type.googleapis.com/google.cloud.dataproc.v1.ReservationAffinity"
10178 }
10179}
10180
10181/// Defines additional types related to [ReservationAffinity].
10182pub mod reservation_affinity {
10183 #[allow(unused_imports)]
10184 use super::*;
10185
10186 /// Indicates whether to consume capacity from an reservation or not.
10187 ///
10188 /// # Working with unknown values
10189 ///
10190 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10191 /// additional enum variants at any time. Adding new variants is not considered
10192 /// a breaking change. Applications should write their code in anticipation of:
10193 ///
10194 /// - New values appearing in future releases of the client library, **and**
10195 /// - New values received dynamically, without application changes.
10196 ///
10197 /// Please consult the [Working with enums] section in the user guide for some
10198 /// guidelines.
10199 ///
10200 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10201 #[derive(Clone, Debug, PartialEq)]
10202 #[non_exhaustive]
10203 pub enum Type {
10204 Unspecified,
10205 /// Do not consume from any allocated capacity.
10206 NoReservation,
10207 /// Consume any reservation available.
10208 AnyReservation,
10209 /// Must consume from a specific reservation. Must specify key value fields
10210 /// for specifying the reservations.
10211 SpecificReservation,
10212 /// If set, the enum was initialized with an unknown value.
10213 ///
10214 /// Applications can examine the value using [Type::value] or
10215 /// [Type::name].
10216 UnknownValue(r#type::UnknownValue),
10217 }
10218
10219 #[doc(hidden)]
10220 pub mod r#type {
10221 #[allow(unused_imports)]
10222 use super::*;
10223 #[derive(Clone, Debug, PartialEq)]
10224 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10225 }
10226
10227 impl Type {
10228 /// Gets the enum value.
10229 ///
10230 /// Returns `None` if the enum contains an unknown value deserialized from
10231 /// the string representation of enums.
10232 pub fn value(&self) -> std::option::Option<i32> {
10233 match self {
10234 Self::Unspecified => std::option::Option::Some(0),
10235 Self::NoReservation => std::option::Option::Some(1),
10236 Self::AnyReservation => std::option::Option::Some(2),
10237 Self::SpecificReservation => std::option::Option::Some(3),
10238 Self::UnknownValue(u) => u.0.value(),
10239 }
10240 }
10241
10242 /// Gets the enum value as a string.
10243 ///
10244 /// Returns `None` if the enum contains an unknown value deserialized from
10245 /// the integer representation of enums.
10246 pub fn name(&self) -> std::option::Option<&str> {
10247 match self {
10248 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
10249 Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
10250 Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
10251 Self::SpecificReservation => std::option::Option::Some("SPECIFIC_RESERVATION"),
10252 Self::UnknownValue(u) => u.0.name(),
10253 }
10254 }
10255 }
10256
10257 impl std::default::Default for Type {
10258 fn default() -> Self {
10259 use std::convert::From;
10260 Self::from(0)
10261 }
10262 }
10263
10264 impl std::fmt::Display for Type {
10265 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10266 wkt::internal::display_enum(f, self.name(), self.value())
10267 }
10268 }
10269
10270 impl std::convert::From<i32> for Type {
10271 fn from(value: i32) -> Self {
10272 match value {
10273 0 => Self::Unspecified,
10274 1 => Self::NoReservation,
10275 2 => Self::AnyReservation,
10276 3 => Self::SpecificReservation,
10277 _ => Self::UnknownValue(r#type::UnknownValue(
10278 wkt::internal::UnknownEnumValue::Integer(value),
10279 )),
10280 }
10281 }
10282 }
10283
10284 impl std::convert::From<&str> for Type {
10285 fn from(value: &str) -> Self {
10286 use std::string::ToString;
10287 match value {
10288 "TYPE_UNSPECIFIED" => Self::Unspecified,
10289 "NO_RESERVATION" => Self::NoReservation,
10290 "ANY_RESERVATION" => Self::AnyReservation,
10291 "SPECIFIC_RESERVATION" => Self::SpecificReservation,
10292 _ => Self::UnknownValue(r#type::UnknownValue(
10293 wkt::internal::UnknownEnumValue::String(value.to_string()),
10294 )),
10295 }
10296 }
10297 }
10298
10299 impl serde::ser::Serialize for Type {
10300 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10301 where
10302 S: serde::Serializer,
10303 {
10304 match self {
10305 Self::Unspecified => serializer.serialize_i32(0),
10306 Self::NoReservation => serializer.serialize_i32(1),
10307 Self::AnyReservation => serializer.serialize_i32(2),
10308 Self::SpecificReservation => serializer.serialize_i32(3),
10309 Self::UnknownValue(u) => u.0.serialize(serializer),
10310 }
10311 }
10312 }
10313
10314 impl<'de> serde::de::Deserialize<'de> for Type {
10315 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10316 where
10317 D: serde::Deserializer<'de>,
10318 {
10319 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
10320 ".google.cloud.dataproc.v1.ReservationAffinity.Type",
10321 ))
10322 }
10323 }
10324}
10325
10326/// The runtime logging config of the job.
10327#[derive(Clone, Default, PartialEq)]
10328#[non_exhaustive]
10329pub struct LoggingConfig {
10330 /// The per-package log levels for the driver. This can include
10331 /// "root" package name to configure rootLogger.
10332 /// Examples:
10333 ///
10334 /// - 'com.google = FATAL'
10335 /// - 'root = INFO'
10336 /// - 'org.apache = DEBUG'
10337 pub driver_log_levels:
10338 std::collections::HashMap<std::string::String, crate::model::logging_config::Level>,
10339
10340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10341}
10342
10343impl LoggingConfig {
10344 pub fn new() -> Self {
10345 std::default::Default::default()
10346 }
10347
10348 /// Sets the value of [driver_log_levels][crate::model::LoggingConfig::driver_log_levels].
10349 ///
10350 /// # Example
10351 /// ```ignore,no_run
10352 /// # use google_cloud_dataproc_v1::model::LoggingConfig;
10353 /// use google_cloud_dataproc_v1::model::logging_config::Level;
10354 /// let x = LoggingConfig::new().set_driver_log_levels([
10355 /// ("key0", Level::All),
10356 /// ("key1", Level::Trace),
10357 /// ("key2", Level::Debug),
10358 /// ]);
10359 /// ```
10360 pub fn set_driver_log_levels<T, K, V>(mut self, v: T) -> Self
10361 where
10362 T: std::iter::IntoIterator<Item = (K, V)>,
10363 K: std::convert::Into<std::string::String>,
10364 V: std::convert::Into<crate::model::logging_config::Level>,
10365 {
10366 use std::iter::Iterator;
10367 self.driver_log_levels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10368 self
10369 }
10370}
10371
10372impl wkt::message::Message for LoggingConfig {
10373 fn typename() -> &'static str {
10374 "type.googleapis.com/google.cloud.dataproc.v1.LoggingConfig"
10375 }
10376}
10377
10378/// Defines additional types related to [LoggingConfig].
10379pub mod logging_config {
10380 #[allow(unused_imports)]
10381 use super::*;
10382
10383 /// The Log4j level for job execution. When running an
10384 /// [Apache Hive](https://hive.apache.org/) job, Cloud
10385 /// Dataproc configures the Hive client to an equivalent verbosity level.
10386 ///
10387 /// # Working with unknown values
10388 ///
10389 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10390 /// additional enum variants at any time. Adding new variants is not considered
10391 /// a breaking change. Applications should write their code in anticipation of:
10392 ///
10393 /// - New values appearing in future releases of the client library, **and**
10394 /// - New values received dynamically, without application changes.
10395 ///
10396 /// Please consult the [Working with enums] section in the user guide for some
10397 /// guidelines.
10398 ///
10399 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10400 #[derive(Clone, Debug, PartialEq)]
10401 #[non_exhaustive]
10402 pub enum Level {
10403 /// Level is unspecified. Use default level for log4j.
10404 Unspecified,
10405 /// Use ALL level for log4j.
10406 All,
10407 /// Use TRACE level for log4j.
10408 Trace,
10409 /// Use DEBUG level for log4j.
10410 Debug,
10411 /// Use INFO level for log4j.
10412 Info,
10413 /// Use WARN level for log4j.
10414 Warn,
10415 /// Use ERROR level for log4j.
10416 Error,
10417 /// Use FATAL level for log4j.
10418 Fatal,
10419 /// Turn off log4j.
10420 Off,
10421 /// If set, the enum was initialized with an unknown value.
10422 ///
10423 /// Applications can examine the value using [Level::value] or
10424 /// [Level::name].
10425 UnknownValue(level::UnknownValue),
10426 }
10427
10428 #[doc(hidden)]
10429 pub mod level {
10430 #[allow(unused_imports)]
10431 use super::*;
10432 #[derive(Clone, Debug, PartialEq)]
10433 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10434 }
10435
10436 impl Level {
10437 /// Gets the enum value.
10438 ///
10439 /// Returns `None` if the enum contains an unknown value deserialized from
10440 /// the string representation of enums.
10441 pub fn value(&self) -> std::option::Option<i32> {
10442 match self {
10443 Self::Unspecified => std::option::Option::Some(0),
10444 Self::All => std::option::Option::Some(1),
10445 Self::Trace => std::option::Option::Some(2),
10446 Self::Debug => std::option::Option::Some(3),
10447 Self::Info => std::option::Option::Some(4),
10448 Self::Warn => std::option::Option::Some(5),
10449 Self::Error => std::option::Option::Some(6),
10450 Self::Fatal => std::option::Option::Some(7),
10451 Self::Off => std::option::Option::Some(8),
10452 Self::UnknownValue(u) => u.0.value(),
10453 }
10454 }
10455
10456 /// Gets the enum value as a string.
10457 ///
10458 /// Returns `None` if the enum contains an unknown value deserialized from
10459 /// the integer representation of enums.
10460 pub fn name(&self) -> std::option::Option<&str> {
10461 match self {
10462 Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
10463 Self::All => std::option::Option::Some("ALL"),
10464 Self::Trace => std::option::Option::Some("TRACE"),
10465 Self::Debug => std::option::Option::Some("DEBUG"),
10466 Self::Info => std::option::Option::Some("INFO"),
10467 Self::Warn => std::option::Option::Some("WARN"),
10468 Self::Error => std::option::Option::Some("ERROR"),
10469 Self::Fatal => std::option::Option::Some("FATAL"),
10470 Self::Off => std::option::Option::Some("OFF"),
10471 Self::UnknownValue(u) => u.0.name(),
10472 }
10473 }
10474 }
10475
10476 impl std::default::Default for Level {
10477 fn default() -> Self {
10478 use std::convert::From;
10479 Self::from(0)
10480 }
10481 }
10482
10483 impl std::fmt::Display for Level {
10484 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10485 wkt::internal::display_enum(f, self.name(), self.value())
10486 }
10487 }
10488
10489 impl std::convert::From<i32> for Level {
10490 fn from(value: i32) -> Self {
10491 match value {
10492 0 => Self::Unspecified,
10493 1 => Self::All,
10494 2 => Self::Trace,
10495 3 => Self::Debug,
10496 4 => Self::Info,
10497 5 => Self::Warn,
10498 6 => Self::Error,
10499 7 => Self::Fatal,
10500 8 => Self::Off,
10501 _ => Self::UnknownValue(level::UnknownValue(
10502 wkt::internal::UnknownEnumValue::Integer(value),
10503 )),
10504 }
10505 }
10506 }
10507
10508 impl std::convert::From<&str> for Level {
10509 fn from(value: &str) -> Self {
10510 use std::string::ToString;
10511 match value {
10512 "LEVEL_UNSPECIFIED" => Self::Unspecified,
10513 "ALL" => Self::All,
10514 "TRACE" => Self::Trace,
10515 "DEBUG" => Self::Debug,
10516 "INFO" => Self::Info,
10517 "WARN" => Self::Warn,
10518 "ERROR" => Self::Error,
10519 "FATAL" => Self::Fatal,
10520 "OFF" => Self::Off,
10521 _ => Self::UnknownValue(level::UnknownValue(
10522 wkt::internal::UnknownEnumValue::String(value.to_string()),
10523 )),
10524 }
10525 }
10526 }
10527
10528 impl serde::ser::Serialize for Level {
10529 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10530 where
10531 S: serde::Serializer,
10532 {
10533 match self {
10534 Self::Unspecified => serializer.serialize_i32(0),
10535 Self::All => serializer.serialize_i32(1),
10536 Self::Trace => serializer.serialize_i32(2),
10537 Self::Debug => serializer.serialize_i32(3),
10538 Self::Info => serializer.serialize_i32(4),
10539 Self::Warn => serializer.serialize_i32(5),
10540 Self::Error => serializer.serialize_i32(6),
10541 Self::Fatal => serializer.serialize_i32(7),
10542 Self::Off => serializer.serialize_i32(8),
10543 Self::UnknownValue(u) => u.0.serialize(serializer),
10544 }
10545 }
10546 }
10547
10548 impl<'de> serde::de::Deserialize<'de> for Level {
10549 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10550 where
10551 D: serde::Deserializer<'de>,
10552 {
10553 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
10554 ".google.cloud.dataproc.v1.LoggingConfig.Level",
10555 ))
10556 }
10557 }
10558}
10559
10560/// A Dataproc job for running
10561/// [Apache Hadoop
10562/// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html)
10563/// jobs on [Apache Hadoop
10564/// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
10565#[derive(Clone, Default, PartialEq)]
10566#[non_exhaustive]
10567pub struct HadoopJob {
10568 /// Optional. The arguments to pass to the driver. Do not
10569 /// include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
10570 /// job properties, since a collision might occur that causes an incorrect job
10571 /// submission.
10572 pub args: std::vec::Vec<std::string::String>,
10573
10574 /// Optional. Jar file URIs to add to the CLASSPATHs of the
10575 /// Hadoop driver and tasks.
10576 pub jar_file_uris: std::vec::Vec<std::string::String>,
10577
10578 /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied
10579 /// to the working directory of Hadoop drivers and distributed tasks. Useful
10580 /// for naively parallel tasks.
10581 pub file_uris: std::vec::Vec<std::string::String>,
10582
10583 /// Optional. HCFS URIs of archives to be extracted in the working directory of
10584 /// Hadoop drivers and tasks. Supported file types:
10585 /// .jar, .tar, .tar.gz, .tgz, or .zip.
10586 pub archive_uris: std::vec::Vec<std::string::String>,
10587
10588 /// Optional. A mapping of property names to values, used to configure Hadoop.
10589 /// Properties that conflict with values set by the Dataproc API might be
10590 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and
10591 /// classes in user code.
10592 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10593
10594 /// Optional. The runtime log config for job execution.
10595 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10596
10597 /// Required. Indicates the location of the driver's main class. Specify
10598 /// either the jar file that contains the main class or the main class name.
10599 /// To specify both, add the jar file to `jar_file_uris`, and then specify
10600 /// the main class name in this property.
10601 pub driver: std::option::Option<crate::model::hadoop_job::Driver>,
10602
10603 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10604}
10605
10606impl HadoopJob {
10607 pub fn new() -> Self {
10608 std::default::Default::default()
10609 }
10610
10611 /// Sets the value of [args][crate::model::HadoopJob::args].
10612 ///
10613 /// # Example
10614 /// ```ignore,no_run
10615 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10616 /// let x = HadoopJob::new().set_args(["a", "b", "c"]);
10617 /// ```
10618 pub fn set_args<T, V>(mut self, v: T) -> Self
10619 where
10620 T: std::iter::IntoIterator<Item = V>,
10621 V: std::convert::Into<std::string::String>,
10622 {
10623 use std::iter::Iterator;
10624 self.args = v.into_iter().map(|i| i.into()).collect();
10625 self
10626 }
10627
10628 /// Sets the value of [jar_file_uris][crate::model::HadoopJob::jar_file_uris].
10629 ///
10630 /// # Example
10631 /// ```ignore,no_run
10632 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10633 /// let x = HadoopJob::new().set_jar_file_uris(["a", "b", "c"]);
10634 /// ```
10635 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10636 where
10637 T: std::iter::IntoIterator<Item = V>,
10638 V: std::convert::Into<std::string::String>,
10639 {
10640 use std::iter::Iterator;
10641 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10642 self
10643 }
10644
10645 /// Sets the value of [file_uris][crate::model::HadoopJob::file_uris].
10646 ///
10647 /// # Example
10648 /// ```ignore,no_run
10649 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10650 /// let x = HadoopJob::new().set_file_uris(["a", "b", "c"]);
10651 /// ```
10652 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10653 where
10654 T: std::iter::IntoIterator<Item = V>,
10655 V: std::convert::Into<std::string::String>,
10656 {
10657 use std::iter::Iterator;
10658 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10659 self
10660 }
10661
10662 /// Sets the value of [archive_uris][crate::model::HadoopJob::archive_uris].
10663 ///
10664 /// # Example
10665 /// ```ignore,no_run
10666 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10667 /// let x = HadoopJob::new().set_archive_uris(["a", "b", "c"]);
10668 /// ```
10669 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10670 where
10671 T: std::iter::IntoIterator<Item = V>,
10672 V: std::convert::Into<std::string::String>,
10673 {
10674 use std::iter::Iterator;
10675 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10676 self
10677 }
10678
10679 /// Sets the value of [properties][crate::model::HadoopJob::properties].
10680 ///
10681 /// # Example
10682 /// ```ignore,no_run
10683 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10684 /// let x = HadoopJob::new().set_properties([
10685 /// ("key0", "abc"),
10686 /// ("key1", "xyz"),
10687 /// ]);
10688 /// ```
10689 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10690 where
10691 T: std::iter::IntoIterator<Item = (K, V)>,
10692 K: std::convert::Into<std::string::String>,
10693 V: std::convert::Into<std::string::String>,
10694 {
10695 use std::iter::Iterator;
10696 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10697 self
10698 }
10699
10700 /// Sets the value of [logging_config][crate::model::HadoopJob::logging_config].
10701 ///
10702 /// # Example
10703 /// ```ignore,no_run
10704 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10705 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10706 /// let x = HadoopJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10707 /// ```
10708 pub fn set_logging_config<T>(mut self, v: T) -> Self
10709 where
10710 T: std::convert::Into<crate::model::LoggingConfig>,
10711 {
10712 self.logging_config = std::option::Option::Some(v.into());
10713 self
10714 }
10715
10716 /// Sets or clears the value of [logging_config][crate::model::HadoopJob::logging_config].
10717 ///
10718 /// # Example
10719 /// ```ignore,no_run
10720 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10721 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10722 /// let x = HadoopJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
10723 /// let x = HadoopJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
10724 /// ```
10725 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
10726 where
10727 T: std::convert::Into<crate::model::LoggingConfig>,
10728 {
10729 self.logging_config = v.map(|x| x.into());
10730 self
10731 }
10732
10733 /// Sets the value of [driver][crate::model::HadoopJob::driver].
10734 ///
10735 /// Note that all the setters affecting `driver` are mutually
10736 /// exclusive.
10737 ///
10738 /// # Example
10739 /// ```ignore,no_run
10740 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10741 /// use google_cloud_dataproc_v1::model::hadoop_job::Driver;
10742 /// let x = HadoopJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
10743 /// ```
10744 pub fn set_driver<
10745 T: std::convert::Into<std::option::Option<crate::model::hadoop_job::Driver>>,
10746 >(
10747 mut self,
10748 v: T,
10749 ) -> Self {
10750 self.driver = v.into();
10751 self
10752 }
10753
10754 /// The value of [driver][crate::model::HadoopJob::driver]
10755 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
10756 /// holds a different branch.
10757 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
10758 #[allow(unreachable_patterns)]
10759 self.driver.as_ref().and_then(|v| match v {
10760 crate::model::hadoop_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
10761 _ => std::option::Option::None,
10762 })
10763 }
10764
10765 /// Sets the value of [driver][crate::model::HadoopJob::driver]
10766 /// to hold a `MainJarFileUri`.
10767 ///
10768 /// Note that all the setters affecting `driver` are
10769 /// mutually exclusive.
10770 ///
10771 /// # Example
10772 /// ```ignore,no_run
10773 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10774 /// let x = HadoopJob::new().set_main_jar_file_uri("example");
10775 /// assert!(x.main_jar_file_uri().is_some());
10776 /// assert!(x.main_class().is_none());
10777 /// ```
10778 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
10779 mut self,
10780 v: T,
10781 ) -> Self {
10782 self.driver =
10783 std::option::Option::Some(crate::model::hadoop_job::Driver::MainJarFileUri(v.into()));
10784 self
10785 }
10786
10787 /// The value of [driver][crate::model::HadoopJob::driver]
10788 /// if it holds a `MainClass`, `None` if the field is not set or
10789 /// holds a different branch.
10790 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
10791 #[allow(unreachable_patterns)]
10792 self.driver.as_ref().and_then(|v| match v {
10793 crate::model::hadoop_job::Driver::MainClass(v) => std::option::Option::Some(v),
10794 _ => std::option::Option::None,
10795 })
10796 }
10797
10798 /// Sets the value of [driver][crate::model::HadoopJob::driver]
10799 /// to hold a `MainClass`.
10800 ///
10801 /// Note that all the setters affecting `driver` are
10802 /// mutually exclusive.
10803 ///
10804 /// # Example
10805 /// ```ignore,no_run
10806 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10807 /// let x = HadoopJob::new().set_main_class("example");
10808 /// assert!(x.main_class().is_some());
10809 /// assert!(x.main_jar_file_uri().is_none());
10810 /// ```
10811 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10812 self.driver =
10813 std::option::Option::Some(crate::model::hadoop_job::Driver::MainClass(v.into()));
10814 self
10815 }
10816}
10817
10818impl wkt::message::Message for HadoopJob {
10819 fn typename() -> &'static str {
10820 "type.googleapis.com/google.cloud.dataproc.v1.HadoopJob"
10821 }
10822}
10823
10824/// Defines additional types related to [HadoopJob].
10825pub mod hadoop_job {
10826 #[allow(unused_imports)]
10827 use super::*;
10828
10829 /// Required. Indicates the location of the driver's main class. Specify
10830 /// either the jar file that contains the main class or the main class name.
10831 /// To specify both, add the jar file to `jar_file_uris`, and then specify
10832 /// the main class name in this property.
10833 #[derive(Clone, Debug, PartialEq)]
10834 #[non_exhaustive]
10835 pub enum Driver {
10836 /// The HCFS URI of the jar file containing the main class.
10837 /// Examples:
10838 /// 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar'
10839 /// 'hdfs:/tmp/test-samples/custom-wordcount.jar'
10840 /// 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
10841 MainJarFileUri(std::string::String),
10842 /// The name of the driver's main class. The jar file containing the class
10843 /// must be in the default CLASSPATH or specified in `jar_file_uris`.
10844 MainClass(std::string::String),
10845 }
10846}
10847
10848/// A Dataproc job for running [Apache Spark](https://spark.apache.org/)
10849/// applications on YARN.
10850#[derive(Clone, Default, PartialEq)]
10851#[non_exhaustive]
10852pub struct SparkJob {
10853 /// Optional. The arguments to pass to the driver. Do not include arguments,
10854 /// such as `--conf`, that can be set as job properties, since a collision may
10855 /// occur that causes an incorrect job submission.
10856 pub args: std::vec::Vec<std::string::String>,
10857
10858 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
10859 /// Spark driver and tasks.
10860 pub jar_file_uris: std::vec::Vec<std::string::String>,
10861
10862 /// Optional. HCFS URIs of files to be placed in the working directory of
10863 /// each executor. Useful for naively parallel tasks.
10864 pub file_uris: std::vec::Vec<std::string::String>,
10865
10866 /// Optional. HCFS URIs of archives to be extracted into the working directory
10867 /// of each executor. Supported file types:
10868 /// .jar, .tar, .tar.gz, .tgz, and .zip.
10869 pub archive_uris: std::vec::Vec<std::string::String>,
10870
10871 /// Optional. A mapping of property names to values, used to configure Spark.
10872 /// Properties that conflict with values set by the Dataproc API might be
10873 /// overwritten. Can include properties set in
10874 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
10875 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10876
10877 /// Optional. The runtime log config for job execution.
10878 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10879
10880 /// Required. The specification of the main method to call to drive the job.
10881 /// Specify either the jar file that contains the main class or the main class
10882 /// name. To pass both a main jar and a main class in that jar, add the jar to
10883 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
10884 /// specify the main class name in
10885 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
10886 ///
10887 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
10888 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
10889 pub driver: std::option::Option<crate::model::spark_job::Driver>,
10890
10891 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10892}
10893
10894impl SparkJob {
10895 pub fn new() -> Self {
10896 std::default::Default::default()
10897 }
10898
10899 /// Sets the value of [args][crate::model::SparkJob::args].
10900 ///
10901 /// # Example
10902 /// ```ignore,no_run
10903 /// # use google_cloud_dataproc_v1::model::SparkJob;
10904 /// let x = SparkJob::new().set_args(["a", "b", "c"]);
10905 /// ```
10906 pub fn set_args<T, V>(mut self, v: T) -> Self
10907 where
10908 T: std::iter::IntoIterator<Item = V>,
10909 V: std::convert::Into<std::string::String>,
10910 {
10911 use std::iter::Iterator;
10912 self.args = v.into_iter().map(|i| i.into()).collect();
10913 self
10914 }
10915
10916 /// Sets the value of [jar_file_uris][crate::model::SparkJob::jar_file_uris].
10917 ///
10918 /// # Example
10919 /// ```ignore,no_run
10920 /// # use google_cloud_dataproc_v1::model::SparkJob;
10921 /// let x = SparkJob::new().set_jar_file_uris(["a", "b", "c"]);
10922 /// ```
10923 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10924 where
10925 T: std::iter::IntoIterator<Item = V>,
10926 V: std::convert::Into<std::string::String>,
10927 {
10928 use std::iter::Iterator;
10929 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10930 self
10931 }
10932
10933 /// Sets the value of [file_uris][crate::model::SparkJob::file_uris].
10934 ///
10935 /// # Example
10936 /// ```ignore,no_run
10937 /// # use google_cloud_dataproc_v1::model::SparkJob;
10938 /// let x = SparkJob::new().set_file_uris(["a", "b", "c"]);
10939 /// ```
10940 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10941 where
10942 T: std::iter::IntoIterator<Item = V>,
10943 V: std::convert::Into<std::string::String>,
10944 {
10945 use std::iter::Iterator;
10946 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10947 self
10948 }
10949
10950 /// Sets the value of [archive_uris][crate::model::SparkJob::archive_uris].
10951 ///
10952 /// # Example
10953 /// ```ignore,no_run
10954 /// # use google_cloud_dataproc_v1::model::SparkJob;
10955 /// let x = SparkJob::new().set_archive_uris(["a", "b", "c"]);
10956 /// ```
10957 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10958 where
10959 T: std::iter::IntoIterator<Item = V>,
10960 V: std::convert::Into<std::string::String>,
10961 {
10962 use std::iter::Iterator;
10963 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10964 self
10965 }
10966
10967 /// Sets the value of [properties][crate::model::SparkJob::properties].
10968 ///
10969 /// # Example
10970 /// ```ignore,no_run
10971 /// # use google_cloud_dataproc_v1::model::SparkJob;
10972 /// let x = SparkJob::new().set_properties([
10973 /// ("key0", "abc"),
10974 /// ("key1", "xyz"),
10975 /// ]);
10976 /// ```
10977 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10978 where
10979 T: std::iter::IntoIterator<Item = (K, V)>,
10980 K: std::convert::Into<std::string::String>,
10981 V: std::convert::Into<std::string::String>,
10982 {
10983 use std::iter::Iterator;
10984 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10985 self
10986 }
10987
10988 /// Sets the value of [logging_config][crate::model::SparkJob::logging_config].
10989 ///
10990 /// # Example
10991 /// ```ignore,no_run
10992 /// # use google_cloud_dataproc_v1::model::SparkJob;
10993 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10994 /// let x = SparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10995 /// ```
10996 pub fn set_logging_config<T>(mut self, v: T) -> Self
10997 where
10998 T: std::convert::Into<crate::model::LoggingConfig>,
10999 {
11000 self.logging_config = std::option::Option::Some(v.into());
11001 self
11002 }
11003
11004 /// Sets or clears the value of [logging_config][crate::model::SparkJob::logging_config].
11005 ///
11006 /// # Example
11007 /// ```ignore,no_run
11008 /// # use google_cloud_dataproc_v1::model::SparkJob;
11009 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11010 /// let x = SparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11011 /// let x = SparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11012 /// ```
11013 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11014 where
11015 T: std::convert::Into<crate::model::LoggingConfig>,
11016 {
11017 self.logging_config = v.map(|x| x.into());
11018 self
11019 }
11020
11021 /// Sets the value of [driver][crate::model::SparkJob::driver].
11022 ///
11023 /// Note that all the setters affecting `driver` are mutually
11024 /// exclusive.
11025 ///
11026 /// # Example
11027 /// ```ignore,no_run
11028 /// # use google_cloud_dataproc_v1::model::SparkJob;
11029 /// use google_cloud_dataproc_v1::model::spark_job::Driver;
11030 /// let x = SparkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
11031 /// ```
11032 pub fn set_driver<
11033 T: std::convert::Into<std::option::Option<crate::model::spark_job::Driver>>,
11034 >(
11035 mut self,
11036 v: T,
11037 ) -> Self {
11038 self.driver = v.into();
11039 self
11040 }
11041
11042 /// The value of [driver][crate::model::SparkJob::driver]
11043 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
11044 /// holds a different branch.
11045 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
11046 #[allow(unreachable_patterns)]
11047 self.driver.as_ref().and_then(|v| match v {
11048 crate::model::spark_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
11049 _ => std::option::Option::None,
11050 })
11051 }
11052
11053 /// Sets the value of [driver][crate::model::SparkJob::driver]
11054 /// to hold a `MainJarFileUri`.
11055 ///
11056 /// Note that all the setters affecting `driver` are
11057 /// mutually exclusive.
11058 ///
11059 /// # Example
11060 /// ```ignore,no_run
11061 /// # use google_cloud_dataproc_v1::model::SparkJob;
11062 /// let x = SparkJob::new().set_main_jar_file_uri("example");
11063 /// assert!(x.main_jar_file_uri().is_some());
11064 /// assert!(x.main_class().is_none());
11065 /// ```
11066 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
11067 mut self,
11068 v: T,
11069 ) -> Self {
11070 self.driver =
11071 std::option::Option::Some(crate::model::spark_job::Driver::MainJarFileUri(v.into()));
11072 self
11073 }
11074
11075 /// The value of [driver][crate::model::SparkJob::driver]
11076 /// if it holds a `MainClass`, `None` if the field is not set or
11077 /// holds a different branch.
11078 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
11079 #[allow(unreachable_patterns)]
11080 self.driver.as_ref().and_then(|v| match v {
11081 crate::model::spark_job::Driver::MainClass(v) => std::option::Option::Some(v),
11082 _ => std::option::Option::None,
11083 })
11084 }
11085
11086 /// Sets the value of [driver][crate::model::SparkJob::driver]
11087 /// to hold a `MainClass`.
11088 ///
11089 /// Note that all the setters affecting `driver` are
11090 /// mutually exclusive.
11091 ///
11092 /// # Example
11093 /// ```ignore,no_run
11094 /// # use google_cloud_dataproc_v1::model::SparkJob;
11095 /// let x = SparkJob::new().set_main_class("example");
11096 /// assert!(x.main_class().is_some());
11097 /// assert!(x.main_jar_file_uri().is_none());
11098 /// ```
11099 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11100 self.driver =
11101 std::option::Option::Some(crate::model::spark_job::Driver::MainClass(v.into()));
11102 self
11103 }
11104}
11105
11106impl wkt::message::Message for SparkJob {
11107 fn typename() -> &'static str {
11108 "type.googleapis.com/google.cloud.dataproc.v1.SparkJob"
11109 }
11110}
11111
11112/// Defines additional types related to [SparkJob].
11113pub mod spark_job {
11114 #[allow(unused_imports)]
11115 use super::*;
11116
11117 /// Required. The specification of the main method to call to drive the job.
11118 /// Specify either the jar file that contains the main class or the main class
11119 /// name. To pass both a main jar and a main class in that jar, add the jar to
11120 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
11121 /// specify the main class name in
11122 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
11123 ///
11124 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
11125 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
11126 #[derive(Clone, Debug, PartialEq)]
11127 #[non_exhaustive]
11128 pub enum Driver {
11129 /// The HCFS URI of the jar file that contains the main class.
11130 MainJarFileUri(std::string::String),
11131 /// The name of the driver's main class. The jar file that contains the class
11132 /// must be in the default CLASSPATH or specified in
11133 /// SparkJob.jar_file_uris.
11134 MainClass(std::string::String),
11135 }
11136}
11137
11138/// A Dataproc job for running
11139/// [Apache
11140/// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html)
11141/// applications on YARN.
11142#[derive(Clone, Default, PartialEq)]
11143#[non_exhaustive]
11144pub struct PySparkJob {
11145 /// Required. The HCFS URI of the main Python file to use as the driver. Must
11146 /// be a .py file.
11147 pub main_python_file_uri: std::string::String,
11148
11149 /// Optional. The arguments to pass to the driver. Do not include arguments,
11150 /// such as `--conf`, that can be set as job properties, since a collision may
11151 /// occur that causes an incorrect job submission.
11152 pub args: std::vec::Vec<std::string::String>,
11153
11154 /// Optional. HCFS file URIs of Python files to pass to the PySpark
11155 /// framework. Supported file types: .py, .egg, and .zip.
11156 pub python_file_uris: std::vec::Vec<std::string::String>,
11157
11158 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
11159 /// Python driver and tasks.
11160 pub jar_file_uris: std::vec::Vec<std::string::String>,
11161
11162 /// Optional. HCFS URIs of files to be placed in the working directory of
11163 /// each executor. Useful for naively parallel tasks.
11164 pub file_uris: std::vec::Vec<std::string::String>,
11165
11166 /// Optional. HCFS URIs of archives to be extracted into the working directory
11167 /// of each executor. Supported file types:
11168 /// .jar, .tar, .tar.gz, .tgz, and .zip.
11169 pub archive_uris: std::vec::Vec<std::string::String>,
11170
11171 /// Optional. A mapping of property names to values, used to configure PySpark.
11172 /// Properties that conflict with values set by the Dataproc API might be
11173 /// overwritten. Can include properties set in
11174 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11175 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11176
11177 /// Optional. The runtime log config for job execution.
11178 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11179
11180 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11181}
11182
11183impl PySparkJob {
11184 pub fn new() -> Self {
11185 std::default::Default::default()
11186 }
11187
11188 /// Sets the value of [main_python_file_uri][crate::model::PySparkJob::main_python_file_uri].
11189 ///
11190 /// # Example
11191 /// ```ignore,no_run
11192 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11193 /// let x = PySparkJob::new().set_main_python_file_uri("example");
11194 /// ```
11195 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
11196 mut self,
11197 v: T,
11198 ) -> Self {
11199 self.main_python_file_uri = v.into();
11200 self
11201 }
11202
11203 /// Sets the value of [args][crate::model::PySparkJob::args].
11204 ///
11205 /// # Example
11206 /// ```ignore,no_run
11207 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11208 /// let x = PySparkJob::new().set_args(["a", "b", "c"]);
11209 /// ```
11210 pub fn set_args<T, V>(mut self, v: T) -> Self
11211 where
11212 T: std::iter::IntoIterator<Item = V>,
11213 V: std::convert::Into<std::string::String>,
11214 {
11215 use std::iter::Iterator;
11216 self.args = v.into_iter().map(|i| i.into()).collect();
11217 self
11218 }
11219
11220 /// Sets the value of [python_file_uris][crate::model::PySparkJob::python_file_uris].
11221 ///
11222 /// # Example
11223 /// ```ignore,no_run
11224 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11225 /// let x = PySparkJob::new().set_python_file_uris(["a", "b", "c"]);
11226 /// ```
11227 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
11228 where
11229 T: std::iter::IntoIterator<Item = V>,
11230 V: std::convert::Into<std::string::String>,
11231 {
11232 use std::iter::Iterator;
11233 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
11234 self
11235 }
11236
11237 /// Sets the value of [jar_file_uris][crate::model::PySparkJob::jar_file_uris].
11238 ///
11239 /// # Example
11240 /// ```ignore,no_run
11241 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11242 /// let x = PySparkJob::new().set_jar_file_uris(["a", "b", "c"]);
11243 /// ```
11244 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11245 where
11246 T: std::iter::IntoIterator<Item = V>,
11247 V: std::convert::Into<std::string::String>,
11248 {
11249 use std::iter::Iterator;
11250 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11251 self
11252 }
11253
11254 /// Sets the value of [file_uris][crate::model::PySparkJob::file_uris].
11255 ///
11256 /// # Example
11257 /// ```ignore,no_run
11258 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11259 /// let x = PySparkJob::new().set_file_uris(["a", "b", "c"]);
11260 /// ```
11261 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11262 where
11263 T: std::iter::IntoIterator<Item = V>,
11264 V: std::convert::Into<std::string::String>,
11265 {
11266 use std::iter::Iterator;
11267 self.file_uris = v.into_iter().map(|i| i.into()).collect();
11268 self
11269 }
11270
11271 /// Sets the value of [archive_uris][crate::model::PySparkJob::archive_uris].
11272 ///
11273 /// # Example
11274 /// ```ignore,no_run
11275 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11276 /// let x = PySparkJob::new().set_archive_uris(["a", "b", "c"]);
11277 /// ```
11278 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11279 where
11280 T: std::iter::IntoIterator<Item = V>,
11281 V: std::convert::Into<std::string::String>,
11282 {
11283 use std::iter::Iterator;
11284 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11285 self
11286 }
11287
11288 /// Sets the value of [properties][crate::model::PySparkJob::properties].
11289 ///
11290 /// # Example
11291 /// ```ignore,no_run
11292 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11293 /// let x = PySparkJob::new().set_properties([
11294 /// ("key0", "abc"),
11295 /// ("key1", "xyz"),
11296 /// ]);
11297 /// ```
11298 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11299 where
11300 T: std::iter::IntoIterator<Item = (K, V)>,
11301 K: std::convert::Into<std::string::String>,
11302 V: std::convert::Into<std::string::String>,
11303 {
11304 use std::iter::Iterator;
11305 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11306 self
11307 }
11308
11309 /// Sets the value of [logging_config][crate::model::PySparkJob::logging_config].
11310 ///
11311 /// # Example
11312 /// ```ignore,no_run
11313 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11314 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11315 /// let x = PySparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11316 /// ```
11317 pub fn set_logging_config<T>(mut self, v: T) -> Self
11318 where
11319 T: std::convert::Into<crate::model::LoggingConfig>,
11320 {
11321 self.logging_config = std::option::Option::Some(v.into());
11322 self
11323 }
11324
11325 /// Sets or clears the value of [logging_config][crate::model::PySparkJob::logging_config].
11326 ///
11327 /// # Example
11328 /// ```ignore,no_run
11329 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11330 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11331 /// let x = PySparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11332 /// let x = PySparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11333 /// ```
11334 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11335 where
11336 T: std::convert::Into<crate::model::LoggingConfig>,
11337 {
11338 self.logging_config = v.map(|x| x.into());
11339 self
11340 }
11341}
11342
11343impl wkt::message::Message for PySparkJob {
11344 fn typename() -> &'static str {
11345 "type.googleapis.com/google.cloud.dataproc.v1.PySparkJob"
11346 }
11347}
11348
11349/// A list of queries to run on a cluster.
11350#[derive(Clone, Default, PartialEq)]
11351#[non_exhaustive]
11352pub struct QueryList {
11353 /// Required. The queries to execute. You do not need to end a query expression
11354 /// with a semicolon. Multiple queries can be specified in one
11355 /// string by separating each with a semicolon. Here is an example of a
11356 /// Dataproc API snippet that uses a QueryList to specify a HiveJob:
11357 ///
11358 /// ```norust
11359 /// "hiveJob": {
11360 /// "queryList": {
11361 /// "queries": [
11362 /// "query1",
11363 /// "query2",
11364 /// "query3;query4",
11365 /// ]
11366 /// }
11367 /// }
11368 /// ```
11369 pub queries: std::vec::Vec<std::string::String>,
11370
11371 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11372}
11373
11374impl QueryList {
11375 pub fn new() -> Self {
11376 std::default::Default::default()
11377 }
11378
11379 /// Sets the value of [queries][crate::model::QueryList::queries].
11380 ///
11381 /// # Example
11382 /// ```ignore,no_run
11383 /// # use google_cloud_dataproc_v1::model::QueryList;
11384 /// let x = QueryList::new().set_queries(["a", "b", "c"]);
11385 /// ```
11386 pub fn set_queries<T, V>(mut self, v: T) -> Self
11387 where
11388 T: std::iter::IntoIterator<Item = V>,
11389 V: std::convert::Into<std::string::String>,
11390 {
11391 use std::iter::Iterator;
11392 self.queries = v.into_iter().map(|i| i.into()).collect();
11393 self
11394 }
11395}
11396
11397impl wkt::message::Message for QueryList {
11398 fn typename() -> &'static str {
11399 "type.googleapis.com/google.cloud.dataproc.v1.QueryList"
11400 }
11401}
11402
11403/// A Dataproc job for running [Apache Hive](https://hive.apache.org/)
11404/// queries on YARN.
11405#[derive(Clone, Default, PartialEq)]
11406#[non_exhaustive]
11407pub struct HiveJob {
11408 /// Optional. Whether to continue executing queries if a query fails.
11409 /// The default value is `false`. Setting to `true` can be useful when
11410 /// executing independent parallel queries.
11411 pub continue_on_failure: bool,
11412
11413 /// Optional. Mapping of query variable names to values (equivalent to the
11414 /// Hive command: `SET name="value";`).
11415 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11416
11417 /// Optional. A mapping of property names and values, used to configure Hive.
11418 /// Properties that conflict with values set by the Dataproc API might be
11419 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11420 /// /etc/hive/conf/hive-site.xml, and classes in user code.
11421 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11422
11423 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the
11424 /// Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes
11425 /// and UDFs.
11426 pub jar_file_uris: std::vec::Vec<std::string::String>,
11427
11428 /// Required. The sequence of Hive queries to execute, specified as either
11429 /// an HCFS file URI or a list of queries.
11430 pub queries: std::option::Option<crate::model::hive_job::Queries>,
11431
11432 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11433}
11434
11435impl HiveJob {
11436 pub fn new() -> Self {
11437 std::default::Default::default()
11438 }
11439
11440 /// Sets the value of [continue_on_failure][crate::model::HiveJob::continue_on_failure].
11441 ///
11442 /// # Example
11443 /// ```ignore,no_run
11444 /// # use google_cloud_dataproc_v1::model::HiveJob;
11445 /// let x = HiveJob::new().set_continue_on_failure(true);
11446 /// ```
11447 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11448 self.continue_on_failure = v.into();
11449 self
11450 }
11451
11452 /// Sets the value of [script_variables][crate::model::HiveJob::script_variables].
11453 ///
11454 /// # Example
11455 /// ```ignore,no_run
11456 /// # use google_cloud_dataproc_v1::model::HiveJob;
11457 /// let x = HiveJob::new().set_script_variables([
11458 /// ("key0", "abc"),
11459 /// ("key1", "xyz"),
11460 /// ]);
11461 /// ```
11462 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11463 where
11464 T: std::iter::IntoIterator<Item = (K, V)>,
11465 K: std::convert::Into<std::string::String>,
11466 V: std::convert::Into<std::string::String>,
11467 {
11468 use std::iter::Iterator;
11469 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11470 self
11471 }
11472
11473 /// Sets the value of [properties][crate::model::HiveJob::properties].
11474 ///
11475 /// # Example
11476 /// ```ignore,no_run
11477 /// # use google_cloud_dataproc_v1::model::HiveJob;
11478 /// let x = HiveJob::new().set_properties([
11479 /// ("key0", "abc"),
11480 /// ("key1", "xyz"),
11481 /// ]);
11482 /// ```
11483 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11484 where
11485 T: std::iter::IntoIterator<Item = (K, V)>,
11486 K: std::convert::Into<std::string::String>,
11487 V: std::convert::Into<std::string::String>,
11488 {
11489 use std::iter::Iterator;
11490 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11491 self
11492 }
11493
11494 /// Sets the value of [jar_file_uris][crate::model::HiveJob::jar_file_uris].
11495 ///
11496 /// # Example
11497 /// ```ignore,no_run
11498 /// # use google_cloud_dataproc_v1::model::HiveJob;
11499 /// let x = HiveJob::new().set_jar_file_uris(["a", "b", "c"]);
11500 /// ```
11501 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11502 where
11503 T: std::iter::IntoIterator<Item = V>,
11504 V: std::convert::Into<std::string::String>,
11505 {
11506 use std::iter::Iterator;
11507 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11508 self
11509 }
11510
11511 /// Sets the value of [queries][crate::model::HiveJob::queries].
11512 ///
11513 /// Note that all the setters affecting `queries` are mutually
11514 /// exclusive.
11515 ///
11516 /// # Example
11517 /// ```ignore,no_run
11518 /// # use google_cloud_dataproc_v1::model::HiveJob;
11519 /// use google_cloud_dataproc_v1::model::hive_job::Queries;
11520 /// let x = HiveJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11521 /// ```
11522 pub fn set_queries<
11523 T: std::convert::Into<std::option::Option<crate::model::hive_job::Queries>>,
11524 >(
11525 mut self,
11526 v: T,
11527 ) -> Self {
11528 self.queries = v.into();
11529 self
11530 }
11531
11532 /// The value of [queries][crate::model::HiveJob::queries]
11533 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11534 /// holds a different branch.
11535 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11536 #[allow(unreachable_patterns)]
11537 self.queries.as_ref().and_then(|v| match v {
11538 crate::model::hive_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11539 _ => std::option::Option::None,
11540 })
11541 }
11542
11543 /// Sets the value of [queries][crate::model::HiveJob::queries]
11544 /// to hold a `QueryFileUri`.
11545 ///
11546 /// Note that all the setters affecting `queries` are
11547 /// mutually exclusive.
11548 ///
11549 /// # Example
11550 /// ```ignore,no_run
11551 /// # use google_cloud_dataproc_v1::model::HiveJob;
11552 /// let x = HiveJob::new().set_query_file_uri("example");
11553 /// assert!(x.query_file_uri().is_some());
11554 /// assert!(x.query_list().is_none());
11555 /// ```
11556 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11557 self.queries =
11558 std::option::Option::Some(crate::model::hive_job::Queries::QueryFileUri(v.into()));
11559 self
11560 }
11561
11562 /// The value of [queries][crate::model::HiveJob::queries]
11563 /// if it holds a `QueryList`, `None` if the field is not set or
11564 /// holds a different branch.
11565 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11566 #[allow(unreachable_patterns)]
11567 self.queries.as_ref().and_then(|v| match v {
11568 crate::model::hive_job::Queries::QueryList(v) => std::option::Option::Some(v),
11569 _ => std::option::Option::None,
11570 })
11571 }
11572
11573 /// Sets the value of [queries][crate::model::HiveJob::queries]
11574 /// to hold a `QueryList`.
11575 ///
11576 /// Note that all the setters affecting `queries` are
11577 /// mutually exclusive.
11578 ///
11579 /// # Example
11580 /// ```ignore,no_run
11581 /// # use google_cloud_dataproc_v1::model::HiveJob;
11582 /// use google_cloud_dataproc_v1::model::QueryList;
11583 /// let x = HiveJob::new().set_query_list(QueryList::default()/* use setters */);
11584 /// assert!(x.query_list().is_some());
11585 /// assert!(x.query_file_uri().is_none());
11586 /// ```
11587 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11588 mut self,
11589 v: T,
11590 ) -> Self {
11591 self.queries =
11592 std::option::Option::Some(crate::model::hive_job::Queries::QueryList(v.into()));
11593 self
11594 }
11595}
11596
11597impl wkt::message::Message for HiveJob {
11598 fn typename() -> &'static str {
11599 "type.googleapis.com/google.cloud.dataproc.v1.HiveJob"
11600 }
11601}
11602
11603/// Defines additional types related to [HiveJob].
11604pub mod hive_job {
11605 #[allow(unused_imports)]
11606 use super::*;
11607
11608 /// Required. The sequence of Hive queries to execute, specified as either
11609 /// an HCFS file URI or a list of queries.
11610 #[derive(Clone, Debug, PartialEq)]
11611 #[non_exhaustive]
11612 pub enum Queries {
11613 /// The HCFS URI of the script that contains Hive queries.
11614 QueryFileUri(std::string::String),
11615 /// A list of queries.
11616 QueryList(std::boxed::Box<crate::model::QueryList>),
11617 }
11618}
11619
11620/// A Dataproc job for running [Apache Spark
11621/// SQL](https://spark.apache.org/sql/) queries.
11622#[derive(Clone, Default, PartialEq)]
11623#[non_exhaustive]
11624pub struct SparkSqlJob {
11625 /// Optional. Mapping of query variable names to values (equivalent to the
11626 /// Spark SQL command: SET `name="value";`).
11627 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11628
11629 /// Optional. A mapping of property names to values, used to configure
11630 /// Spark SQL's SparkConf. Properties that conflict with values set by the
11631 /// Dataproc API might be overwritten.
11632 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11633
11634 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
11635 pub jar_file_uris: std::vec::Vec<std::string::String>,
11636
11637 /// Optional. The runtime log config for job execution.
11638 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11639
11640 /// Required. The sequence of Spark SQL queries to execute, specified as
11641 /// either an HCFS file URI or as a list of queries.
11642 pub queries: std::option::Option<crate::model::spark_sql_job::Queries>,
11643
11644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11645}
11646
11647impl SparkSqlJob {
11648 pub fn new() -> Self {
11649 std::default::Default::default()
11650 }
11651
11652 /// Sets the value of [script_variables][crate::model::SparkSqlJob::script_variables].
11653 ///
11654 /// # Example
11655 /// ```ignore,no_run
11656 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11657 /// let x = SparkSqlJob::new().set_script_variables([
11658 /// ("key0", "abc"),
11659 /// ("key1", "xyz"),
11660 /// ]);
11661 /// ```
11662 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11663 where
11664 T: std::iter::IntoIterator<Item = (K, V)>,
11665 K: std::convert::Into<std::string::String>,
11666 V: std::convert::Into<std::string::String>,
11667 {
11668 use std::iter::Iterator;
11669 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11670 self
11671 }
11672
11673 /// Sets the value of [properties][crate::model::SparkSqlJob::properties].
11674 ///
11675 /// # Example
11676 /// ```ignore,no_run
11677 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11678 /// let x = SparkSqlJob::new().set_properties([
11679 /// ("key0", "abc"),
11680 /// ("key1", "xyz"),
11681 /// ]);
11682 /// ```
11683 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11684 where
11685 T: std::iter::IntoIterator<Item = (K, V)>,
11686 K: std::convert::Into<std::string::String>,
11687 V: std::convert::Into<std::string::String>,
11688 {
11689 use std::iter::Iterator;
11690 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11691 self
11692 }
11693
11694 /// Sets the value of [jar_file_uris][crate::model::SparkSqlJob::jar_file_uris].
11695 ///
11696 /// # Example
11697 /// ```ignore,no_run
11698 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11699 /// let x = SparkSqlJob::new().set_jar_file_uris(["a", "b", "c"]);
11700 /// ```
11701 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11702 where
11703 T: std::iter::IntoIterator<Item = V>,
11704 V: std::convert::Into<std::string::String>,
11705 {
11706 use std::iter::Iterator;
11707 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11708 self
11709 }
11710
11711 /// Sets the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11712 ///
11713 /// # Example
11714 /// ```ignore,no_run
11715 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11716 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11717 /// let x = SparkSqlJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11718 /// ```
11719 pub fn set_logging_config<T>(mut self, v: T) -> Self
11720 where
11721 T: std::convert::Into<crate::model::LoggingConfig>,
11722 {
11723 self.logging_config = std::option::Option::Some(v.into());
11724 self
11725 }
11726
11727 /// Sets or clears the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11728 ///
11729 /// # Example
11730 /// ```ignore,no_run
11731 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11732 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11733 /// let x = SparkSqlJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11734 /// let x = SparkSqlJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11735 /// ```
11736 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11737 where
11738 T: std::convert::Into<crate::model::LoggingConfig>,
11739 {
11740 self.logging_config = v.map(|x| x.into());
11741 self
11742 }
11743
11744 /// Sets the value of [queries][crate::model::SparkSqlJob::queries].
11745 ///
11746 /// Note that all the setters affecting `queries` are mutually
11747 /// exclusive.
11748 ///
11749 /// # Example
11750 /// ```ignore,no_run
11751 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11752 /// use google_cloud_dataproc_v1::model::spark_sql_job::Queries;
11753 /// let x = SparkSqlJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11754 /// ```
11755 pub fn set_queries<
11756 T: std::convert::Into<std::option::Option<crate::model::spark_sql_job::Queries>>,
11757 >(
11758 mut self,
11759 v: T,
11760 ) -> Self {
11761 self.queries = v.into();
11762 self
11763 }
11764
11765 /// The value of [queries][crate::model::SparkSqlJob::queries]
11766 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11767 /// holds a different branch.
11768 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11769 #[allow(unreachable_patterns)]
11770 self.queries.as_ref().and_then(|v| match v {
11771 crate::model::spark_sql_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11772 _ => std::option::Option::None,
11773 })
11774 }
11775
11776 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11777 /// to hold a `QueryFileUri`.
11778 ///
11779 /// Note that all the setters affecting `queries` are
11780 /// mutually exclusive.
11781 ///
11782 /// # Example
11783 /// ```ignore,no_run
11784 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11785 /// let x = SparkSqlJob::new().set_query_file_uri("example");
11786 /// assert!(x.query_file_uri().is_some());
11787 /// assert!(x.query_list().is_none());
11788 /// ```
11789 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11790 self.queries =
11791 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryFileUri(v.into()));
11792 self
11793 }
11794
11795 /// The value of [queries][crate::model::SparkSqlJob::queries]
11796 /// if it holds a `QueryList`, `None` if the field is not set or
11797 /// holds a different branch.
11798 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11799 #[allow(unreachable_patterns)]
11800 self.queries.as_ref().and_then(|v| match v {
11801 crate::model::spark_sql_job::Queries::QueryList(v) => std::option::Option::Some(v),
11802 _ => std::option::Option::None,
11803 })
11804 }
11805
11806 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11807 /// to hold a `QueryList`.
11808 ///
11809 /// Note that all the setters affecting `queries` are
11810 /// mutually exclusive.
11811 ///
11812 /// # Example
11813 /// ```ignore,no_run
11814 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11815 /// use google_cloud_dataproc_v1::model::QueryList;
11816 /// let x = SparkSqlJob::new().set_query_list(QueryList::default()/* use setters */);
11817 /// assert!(x.query_list().is_some());
11818 /// assert!(x.query_file_uri().is_none());
11819 /// ```
11820 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11821 mut self,
11822 v: T,
11823 ) -> Self {
11824 self.queries =
11825 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryList(v.into()));
11826 self
11827 }
11828}
11829
11830impl wkt::message::Message for SparkSqlJob {
11831 fn typename() -> &'static str {
11832 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlJob"
11833 }
11834}
11835
11836/// Defines additional types related to [SparkSqlJob].
11837pub mod spark_sql_job {
11838 #[allow(unused_imports)]
11839 use super::*;
11840
11841 /// Required. The sequence of Spark SQL queries to execute, specified as
11842 /// either an HCFS file URI or as a list of queries.
11843 #[derive(Clone, Debug, PartialEq)]
11844 #[non_exhaustive]
11845 pub enum Queries {
11846 /// The HCFS URI of the script that contains SQL queries.
11847 QueryFileUri(std::string::String),
11848 /// A list of queries.
11849 QueryList(std::boxed::Box<crate::model::QueryList>),
11850 }
11851}
11852
11853/// A Dataproc job for running [Apache Pig](https://pig.apache.org/)
11854/// queries on YARN.
11855#[derive(Clone, Default, PartialEq)]
11856#[non_exhaustive]
11857pub struct PigJob {
11858 /// Optional. Whether to continue executing queries if a query fails.
11859 /// The default value is `false`. Setting to `true` can be useful when
11860 /// executing independent parallel queries.
11861 pub continue_on_failure: bool,
11862
11863 /// Optional. Mapping of query variable names to values (equivalent to the Pig
11864 /// command: `name=[value]`).
11865 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11866
11867 /// Optional. A mapping of property names to values, used to configure Pig.
11868 /// Properties that conflict with values set by the Dataproc API might be
11869 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11870 /// /etc/pig/conf/pig.properties, and classes in user code.
11871 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11872
11873 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of
11874 /// the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
11875 pub jar_file_uris: std::vec::Vec<std::string::String>,
11876
11877 /// Optional. The runtime log config for job execution.
11878 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11879
11880 /// Required. The sequence of Pig queries to execute, specified as an HCFS
11881 /// file URI or a list of queries.
11882 pub queries: std::option::Option<crate::model::pig_job::Queries>,
11883
11884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11885}
11886
11887impl PigJob {
11888 pub fn new() -> Self {
11889 std::default::Default::default()
11890 }
11891
11892 /// Sets the value of [continue_on_failure][crate::model::PigJob::continue_on_failure].
11893 ///
11894 /// # Example
11895 /// ```ignore,no_run
11896 /// # use google_cloud_dataproc_v1::model::PigJob;
11897 /// let x = PigJob::new().set_continue_on_failure(true);
11898 /// ```
11899 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11900 self.continue_on_failure = v.into();
11901 self
11902 }
11903
11904 /// Sets the value of [script_variables][crate::model::PigJob::script_variables].
11905 ///
11906 /// # Example
11907 /// ```ignore,no_run
11908 /// # use google_cloud_dataproc_v1::model::PigJob;
11909 /// let x = PigJob::new().set_script_variables([
11910 /// ("key0", "abc"),
11911 /// ("key1", "xyz"),
11912 /// ]);
11913 /// ```
11914 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11915 where
11916 T: std::iter::IntoIterator<Item = (K, V)>,
11917 K: std::convert::Into<std::string::String>,
11918 V: std::convert::Into<std::string::String>,
11919 {
11920 use std::iter::Iterator;
11921 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11922 self
11923 }
11924
11925 /// Sets the value of [properties][crate::model::PigJob::properties].
11926 ///
11927 /// # Example
11928 /// ```ignore,no_run
11929 /// # use google_cloud_dataproc_v1::model::PigJob;
11930 /// let x = PigJob::new().set_properties([
11931 /// ("key0", "abc"),
11932 /// ("key1", "xyz"),
11933 /// ]);
11934 /// ```
11935 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11936 where
11937 T: std::iter::IntoIterator<Item = (K, V)>,
11938 K: std::convert::Into<std::string::String>,
11939 V: std::convert::Into<std::string::String>,
11940 {
11941 use std::iter::Iterator;
11942 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11943 self
11944 }
11945
11946 /// Sets the value of [jar_file_uris][crate::model::PigJob::jar_file_uris].
11947 ///
11948 /// # Example
11949 /// ```ignore,no_run
11950 /// # use google_cloud_dataproc_v1::model::PigJob;
11951 /// let x = PigJob::new().set_jar_file_uris(["a", "b", "c"]);
11952 /// ```
11953 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11954 where
11955 T: std::iter::IntoIterator<Item = V>,
11956 V: std::convert::Into<std::string::String>,
11957 {
11958 use std::iter::Iterator;
11959 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11960 self
11961 }
11962
11963 /// Sets the value of [logging_config][crate::model::PigJob::logging_config].
11964 ///
11965 /// # Example
11966 /// ```ignore,no_run
11967 /// # use google_cloud_dataproc_v1::model::PigJob;
11968 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11969 /// let x = PigJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11970 /// ```
11971 pub fn set_logging_config<T>(mut self, v: T) -> Self
11972 where
11973 T: std::convert::Into<crate::model::LoggingConfig>,
11974 {
11975 self.logging_config = std::option::Option::Some(v.into());
11976 self
11977 }
11978
11979 /// Sets or clears the value of [logging_config][crate::model::PigJob::logging_config].
11980 ///
11981 /// # Example
11982 /// ```ignore,no_run
11983 /// # use google_cloud_dataproc_v1::model::PigJob;
11984 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11985 /// let x = PigJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11986 /// let x = PigJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11987 /// ```
11988 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11989 where
11990 T: std::convert::Into<crate::model::LoggingConfig>,
11991 {
11992 self.logging_config = v.map(|x| x.into());
11993 self
11994 }
11995
11996 /// Sets the value of [queries][crate::model::PigJob::queries].
11997 ///
11998 /// Note that all the setters affecting `queries` are mutually
11999 /// exclusive.
12000 ///
12001 /// # Example
12002 /// ```ignore,no_run
12003 /// # use google_cloud_dataproc_v1::model::PigJob;
12004 /// use google_cloud_dataproc_v1::model::pig_job::Queries;
12005 /// let x = PigJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12006 /// ```
12007 pub fn set_queries<
12008 T: std::convert::Into<std::option::Option<crate::model::pig_job::Queries>>,
12009 >(
12010 mut self,
12011 v: T,
12012 ) -> Self {
12013 self.queries = v.into();
12014 self
12015 }
12016
12017 /// The value of [queries][crate::model::PigJob::queries]
12018 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12019 /// holds a different branch.
12020 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12021 #[allow(unreachable_patterns)]
12022 self.queries.as_ref().and_then(|v| match v {
12023 crate::model::pig_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12024 _ => std::option::Option::None,
12025 })
12026 }
12027
12028 /// Sets the value of [queries][crate::model::PigJob::queries]
12029 /// to hold a `QueryFileUri`.
12030 ///
12031 /// Note that all the setters affecting `queries` are
12032 /// mutually exclusive.
12033 ///
12034 /// # Example
12035 /// ```ignore,no_run
12036 /// # use google_cloud_dataproc_v1::model::PigJob;
12037 /// let x = PigJob::new().set_query_file_uri("example");
12038 /// assert!(x.query_file_uri().is_some());
12039 /// assert!(x.query_list().is_none());
12040 /// ```
12041 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12042 self.queries =
12043 std::option::Option::Some(crate::model::pig_job::Queries::QueryFileUri(v.into()));
12044 self
12045 }
12046
12047 /// The value of [queries][crate::model::PigJob::queries]
12048 /// if it holds a `QueryList`, `None` if the field is not set or
12049 /// holds a different branch.
12050 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12051 #[allow(unreachable_patterns)]
12052 self.queries.as_ref().and_then(|v| match v {
12053 crate::model::pig_job::Queries::QueryList(v) => std::option::Option::Some(v),
12054 _ => std::option::Option::None,
12055 })
12056 }
12057
12058 /// Sets the value of [queries][crate::model::PigJob::queries]
12059 /// to hold a `QueryList`.
12060 ///
12061 /// Note that all the setters affecting `queries` are
12062 /// mutually exclusive.
12063 ///
12064 /// # Example
12065 /// ```ignore,no_run
12066 /// # use google_cloud_dataproc_v1::model::PigJob;
12067 /// use google_cloud_dataproc_v1::model::QueryList;
12068 /// let x = PigJob::new().set_query_list(QueryList::default()/* use setters */);
12069 /// assert!(x.query_list().is_some());
12070 /// assert!(x.query_file_uri().is_none());
12071 /// ```
12072 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12073 mut self,
12074 v: T,
12075 ) -> Self {
12076 self.queries =
12077 std::option::Option::Some(crate::model::pig_job::Queries::QueryList(v.into()));
12078 self
12079 }
12080}
12081
12082impl wkt::message::Message for PigJob {
12083 fn typename() -> &'static str {
12084 "type.googleapis.com/google.cloud.dataproc.v1.PigJob"
12085 }
12086}
12087
12088/// Defines additional types related to [PigJob].
12089pub mod pig_job {
12090 #[allow(unused_imports)]
12091 use super::*;
12092
12093 /// Required. The sequence of Pig queries to execute, specified as an HCFS
12094 /// file URI or a list of queries.
12095 #[derive(Clone, Debug, PartialEq)]
12096 #[non_exhaustive]
12097 pub enum Queries {
12098 /// The HCFS URI of the script that contains the Pig queries.
12099 QueryFileUri(std::string::String),
12100 /// A list of queries.
12101 QueryList(std::boxed::Box<crate::model::QueryList>),
12102 }
12103}
12104
12105/// A Dataproc job for running
12106/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
12107/// applications on YARN.
12108#[derive(Clone, Default, PartialEq)]
12109#[non_exhaustive]
12110pub struct SparkRJob {
12111 /// Required. The HCFS URI of the main R file to use as the driver.
12112 /// Must be a .R file.
12113 pub main_r_file_uri: std::string::String,
12114
12115 /// Optional. The arguments to pass to the driver. Do not include arguments,
12116 /// such as `--conf`, that can be set as job properties, since a collision may
12117 /// occur that causes an incorrect job submission.
12118 pub args: std::vec::Vec<std::string::String>,
12119
12120 /// Optional. HCFS URIs of files to be placed in the working directory of
12121 /// each executor. Useful for naively parallel tasks.
12122 pub file_uris: std::vec::Vec<std::string::String>,
12123
12124 /// Optional. HCFS URIs of archives to be extracted into the working directory
12125 /// of each executor. Supported file types:
12126 /// .jar, .tar, .tar.gz, .tgz, and .zip.
12127 pub archive_uris: std::vec::Vec<std::string::String>,
12128
12129 /// Optional. A mapping of property names to values, used to configure SparkR.
12130 /// Properties that conflict with values set by the Dataproc API might be
12131 /// overwritten. Can include properties set in
12132 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
12133 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12134
12135 /// Optional. The runtime log config for job execution.
12136 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12137
12138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12139}
12140
12141impl SparkRJob {
12142 pub fn new() -> Self {
12143 std::default::Default::default()
12144 }
12145
12146 /// Sets the value of [main_r_file_uri][crate::model::SparkRJob::main_r_file_uri].
12147 ///
12148 /// # Example
12149 /// ```ignore,no_run
12150 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12151 /// let x = SparkRJob::new().set_main_r_file_uri("example");
12152 /// ```
12153 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12154 self.main_r_file_uri = v.into();
12155 self
12156 }
12157
12158 /// Sets the value of [args][crate::model::SparkRJob::args].
12159 ///
12160 /// # Example
12161 /// ```ignore,no_run
12162 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12163 /// let x = SparkRJob::new().set_args(["a", "b", "c"]);
12164 /// ```
12165 pub fn set_args<T, V>(mut self, v: T) -> Self
12166 where
12167 T: std::iter::IntoIterator<Item = V>,
12168 V: std::convert::Into<std::string::String>,
12169 {
12170 use std::iter::Iterator;
12171 self.args = v.into_iter().map(|i| i.into()).collect();
12172 self
12173 }
12174
12175 /// Sets the value of [file_uris][crate::model::SparkRJob::file_uris].
12176 ///
12177 /// # Example
12178 /// ```ignore,no_run
12179 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12180 /// let x = SparkRJob::new().set_file_uris(["a", "b", "c"]);
12181 /// ```
12182 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
12183 where
12184 T: std::iter::IntoIterator<Item = V>,
12185 V: std::convert::Into<std::string::String>,
12186 {
12187 use std::iter::Iterator;
12188 self.file_uris = v.into_iter().map(|i| i.into()).collect();
12189 self
12190 }
12191
12192 /// Sets the value of [archive_uris][crate::model::SparkRJob::archive_uris].
12193 ///
12194 /// # Example
12195 /// ```ignore,no_run
12196 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12197 /// let x = SparkRJob::new().set_archive_uris(["a", "b", "c"]);
12198 /// ```
12199 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
12200 where
12201 T: std::iter::IntoIterator<Item = V>,
12202 V: std::convert::Into<std::string::String>,
12203 {
12204 use std::iter::Iterator;
12205 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
12206 self
12207 }
12208
12209 /// Sets the value of [properties][crate::model::SparkRJob::properties].
12210 ///
12211 /// # Example
12212 /// ```ignore,no_run
12213 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12214 /// let x = SparkRJob::new().set_properties([
12215 /// ("key0", "abc"),
12216 /// ("key1", "xyz"),
12217 /// ]);
12218 /// ```
12219 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12220 where
12221 T: std::iter::IntoIterator<Item = (K, V)>,
12222 K: std::convert::Into<std::string::String>,
12223 V: std::convert::Into<std::string::String>,
12224 {
12225 use std::iter::Iterator;
12226 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12227 self
12228 }
12229
12230 /// Sets the value of [logging_config][crate::model::SparkRJob::logging_config].
12231 ///
12232 /// # Example
12233 /// ```ignore,no_run
12234 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12235 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12236 /// let x = SparkRJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12237 /// ```
12238 pub fn set_logging_config<T>(mut self, v: T) -> Self
12239 where
12240 T: std::convert::Into<crate::model::LoggingConfig>,
12241 {
12242 self.logging_config = std::option::Option::Some(v.into());
12243 self
12244 }
12245
12246 /// Sets or clears the value of [logging_config][crate::model::SparkRJob::logging_config].
12247 ///
12248 /// # Example
12249 /// ```ignore,no_run
12250 /// # use google_cloud_dataproc_v1::model::SparkRJob;
12251 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12252 /// let x = SparkRJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12253 /// let x = SparkRJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12254 /// ```
12255 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12256 where
12257 T: std::convert::Into<crate::model::LoggingConfig>,
12258 {
12259 self.logging_config = v.map(|x| x.into());
12260 self
12261 }
12262}
12263
12264impl wkt::message::Message for SparkRJob {
12265 fn typename() -> &'static str {
12266 "type.googleapis.com/google.cloud.dataproc.v1.SparkRJob"
12267 }
12268}
12269
12270/// A Dataproc job for running [Presto](https://prestosql.io/) queries.
12271/// **IMPORTANT**: The [Dataproc Presto Optional
12272/// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto)
12273/// must be enabled when the cluster is created to submit a Presto job to the
12274/// cluster.
12275#[derive(Clone, Default, PartialEq)]
12276#[non_exhaustive]
12277pub struct PrestoJob {
12278 /// Optional. Whether to continue executing queries if a query fails.
12279 /// The default value is `false`. Setting to `true` can be useful when
12280 /// executing independent parallel queries.
12281 pub continue_on_failure: bool,
12282
12283 /// Optional. The format in which query output will be displayed. See the
12284 /// Presto documentation for supported output formats
12285 pub output_format: std::string::String,
12286
12287 /// Optional. Presto client tags to attach to this query
12288 pub client_tags: std::vec::Vec<std::string::String>,
12289
12290 /// Optional. A mapping of property names to values. Used to set Presto
12291 /// [session properties](https://prestodb.io/docs/current/sql/set-session.html)
12292 /// Equivalent to using the --session flag in the Presto CLI
12293 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12294
12295 /// Optional. The runtime log config for job execution.
12296 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12297
12298 /// Required. The sequence of Presto queries to execute, specified as
12299 /// either an HCFS file URI or as a list of queries.
12300 pub queries: std::option::Option<crate::model::presto_job::Queries>,
12301
12302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12303}
12304
12305impl PrestoJob {
12306 pub fn new() -> Self {
12307 std::default::Default::default()
12308 }
12309
12310 /// Sets the value of [continue_on_failure][crate::model::PrestoJob::continue_on_failure].
12311 ///
12312 /// # Example
12313 /// ```ignore,no_run
12314 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12315 /// let x = PrestoJob::new().set_continue_on_failure(true);
12316 /// ```
12317 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12318 self.continue_on_failure = v.into();
12319 self
12320 }
12321
12322 /// Sets the value of [output_format][crate::model::PrestoJob::output_format].
12323 ///
12324 /// # Example
12325 /// ```ignore,no_run
12326 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12327 /// let x = PrestoJob::new().set_output_format("example");
12328 /// ```
12329 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12330 self.output_format = v.into();
12331 self
12332 }
12333
12334 /// Sets the value of [client_tags][crate::model::PrestoJob::client_tags].
12335 ///
12336 /// # Example
12337 /// ```ignore,no_run
12338 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12339 /// let x = PrestoJob::new().set_client_tags(["a", "b", "c"]);
12340 /// ```
12341 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12342 where
12343 T: std::iter::IntoIterator<Item = V>,
12344 V: std::convert::Into<std::string::String>,
12345 {
12346 use std::iter::Iterator;
12347 self.client_tags = v.into_iter().map(|i| i.into()).collect();
12348 self
12349 }
12350
12351 /// Sets the value of [properties][crate::model::PrestoJob::properties].
12352 ///
12353 /// # Example
12354 /// ```ignore,no_run
12355 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12356 /// let x = PrestoJob::new().set_properties([
12357 /// ("key0", "abc"),
12358 /// ("key1", "xyz"),
12359 /// ]);
12360 /// ```
12361 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12362 where
12363 T: std::iter::IntoIterator<Item = (K, V)>,
12364 K: std::convert::Into<std::string::String>,
12365 V: std::convert::Into<std::string::String>,
12366 {
12367 use std::iter::Iterator;
12368 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12369 self
12370 }
12371
12372 /// Sets the value of [logging_config][crate::model::PrestoJob::logging_config].
12373 ///
12374 /// # Example
12375 /// ```ignore,no_run
12376 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12377 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12378 /// let x = PrestoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12379 /// ```
12380 pub fn set_logging_config<T>(mut self, v: T) -> Self
12381 where
12382 T: std::convert::Into<crate::model::LoggingConfig>,
12383 {
12384 self.logging_config = std::option::Option::Some(v.into());
12385 self
12386 }
12387
12388 /// Sets or clears the value of [logging_config][crate::model::PrestoJob::logging_config].
12389 ///
12390 /// # Example
12391 /// ```ignore,no_run
12392 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12393 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12394 /// let x = PrestoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12395 /// let x = PrestoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12396 /// ```
12397 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12398 where
12399 T: std::convert::Into<crate::model::LoggingConfig>,
12400 {
12401 self.logging_config = v.map(|x| x.into());
12402 self
12403 }
12404
12405 /// Sets the value of [queries][crate::model::PrestoJob::queries].
12406 ///
12407 /// Note that all the setters affecting `queries` are mutually
12408 /// exclusive.
12409 ///
12410 /// # Example
12411 /// ```ignore,no_run
12412 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12413 /// use google_cloud_dataproc_v1::model::presto_job::Queries;
12414 /// let x = PrestoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12415 /// ```
12416 pub fn set_queries<
12417 T: std::convert::Into<std::option::Option<crate::model::presto_job::Queries>>,
12418 >(
12419 mut self,
12420 v: T,
12421 ) -> Self {
12422 self.queries = v.into();
12423 self
12424 }
12425
12426 /// The value of [queries][crate::model::PrestoJob::queries]
12427 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12428 /// holds a different branch.
12429 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12430 #[allow(unreachable_patterns)]
12431 self.queries.as_ref().and_then(|v| match v {
12432 crate::model::presto_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12433 _ => std::option::Option::None,
12434 })
12435 }
12436
12437 /// Sets the value of [queries][crate::model::PrestoJob::queries]
12438 /// to hold a `QueryFileUri`.
12439 ///
12440 /// Note that all the setters affecting `queries` are
12441 /// mutually exclusive.
12442 ///
12443 /// # Example
12444 /// ```ignore,no_run
12445 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12446 /// let x = PrestoJob::new().set_query_file_uri("example");
12447 /// assert!(x.query_file_uri().is_some());
12448 /// assert!(x.query_list().is_none());
12449 /// ```
12450 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12451 self.queries =
12452 std::option::Option::Some(crate::model::presto_job::Queries::QueryFileUri(v.into()));
12453 self
12454 }
12455
12456 /// The value of [queries][crate::model::PrestoJob::queries]
12457 /// if it holds a `QueryList`, `None` if the field is not set or
12458 /// holds a different branch.
12459 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12460 #[allow(unreachable_patterns)]
12461 self.queries.as_ref().and_then(|v| match v {
12462 crate::model::presto_job::Queries::QueryList(v) => std::option::Option::Some(v),
12463 _ => std::option::Option::None,
12464 })
12465 }
12466
12467 /// Sets the value of [queries][crate::model::PrestoJob::queries]
12468 /// to hold a `QueryList`.
12469 ///
12470 /// Note that all the setters affecting `queries` are
12471 /// mutually exclusive.
12472 ///
12473 /// # Example
12474 /// ```ignore,no_run
12475 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12476 /// use google_cloud_dataproc_v1::model::QueryList;
12477 /// let x = PrestoJob::new().set_query_list(QueryList::default()/* use setters */);
12478 /// assert!(x.query_list().is_some());
12479 /// assert!(x.query_file_uri().is_none());
12480 /// ```
12481 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12482 mut self,
12483 v: T,
12484 ) -> Self {
12485 self.queries =
12486 std::option::Option::Some(crate::model::presto_job::Queries::QueryList(v.into()));
12487 self
12488 }
12489}
12490
12491impl wkt::message::Message for PrestoJob {
12492 fn typename() -> &'static str {
12493 "type.googleapis.com/google.cloud.dataproc.v1.PrestoJob"
12494 }
12495}
12496
12497/// Defines additional types related to [PrestoJob].
12498pub mod presto_job {
12499 #[allow(unused_imports)]
12500 use super::*;
12501
12502 /// Required. The sequence of Presto queries to execute, specified as
12503 /// either an HCFS file URI or as a list of queries.
12504 #[derive(Clone, Debug, PartialEq)]
12505 #[non_exhaustive]
12506 pub enum Queries {
12507 /// The HCFS URI of the script that contains SQL queries.
12508 QueryFileUri(std::string::String),
12509 /// A list of queries.
12510 QueryList(std::boxed::Box<crate::model::QueryList>),
12511 }
12512}
12513
12514/// A Dataproc job for running [Trino](https://trino.io/) queries.
12515/// **IMPORTANT**: The [Dataproc Trino Optional
12516/// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino)
12517/// must be enabled when the cluster is created to submit a Trino job to the
12518/// cluster.
12519#[derive(Clone, Default, PartialEq)]
12520#[non_exhaustive]
12521pub struct TrinoJob {
12522 /// Optional. Whether to continue executing queries if a query fails.
12523 /// The default value is `false`. Setting to `true` can be useful when
12524 /// executing independent parallel queries.
12525 pub continue_on_failure: bool,
12526
12527 /// Optional. The format in which query output will be displayed. See the
12528 /// Trino documentation for supported output formats
12529 pub output_format: std::string::String,
12530
12531 /// Optional. Trino client tags to attach to this query
12532 pub client_tags: std::vec::Vec<std::string::String>,
12533
12534 /// Optional. A mapping of property names to values. Used to set Trino
12535 /// [session properties](https://trino.io/docs/current/sql/set-session.html)
12536 /// Equivalent to using the --session flag in the Trino CLI
12537 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12538
12539 /// Optional. The runtime log config for job execution.
12540 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12541
12542 /// Required. The sequence of Trino queries to execute, specified as
12543 /// either an HCFS file URI or as a list of queries.
12544 pub queries: std::option::Option<crate::model::trino_job::Queries>,
12545
12546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12547}
12548
12549impl TrinoJob {
12550 pub fn new() -> Self {
12551 std::default::Default::default()
12552 }
12553
12554 /// Sets the value of [continue_on_failure][crate::model::TrinoJob::continue_on_failure].
12555 ///
12556 /// # Example
12557 /// ```ignore,no_run
12558 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12559 /// let x = TrinoJob::new().set_continue_on_failure(true);
12560 /// ```
12561 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12562 self.continue_on_failure = v.into();
12563 self
12564 }
12565
12566 /// Sets the value of [output_format][crate::model::TrinoJob::output_format].
12567 ///
12568 /// # Example
12569 /// ```ignore,no_run
12570 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12571 /// let x = TrinoJob::new().set_output_format("example");
12572 /// ```
12573 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12574 self.output_format = v.into();
12575 self
12576 }
12577
12578 /// Sets the value of [client_tags][crate::model::TrinoJob::client_tags].
12579 ///
12580 /// # Example
12581 /// ```ignore,no_run
12582 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12583 /// let x = TrinoJob::new().set_client_tags(["a", "b", "c"]);
12584 /// ```
12585 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12586 where
12587 T: std::iter::IntoIterator<Item = V>,
12588 V: std::convert::Into<std::string::String>,
12589 {
12590 use std::iter::Iterator;
12591 self.client_tags = v.into_iter().map(|i| i.into()).collect();
12592 self
12593 }
12594
12595 /// Sets the value of [properties][crate::model::TrinoJob::properties].
12596 ///
12597 /// # Example
12598 /// ```ignore,no_run
12599 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12600 /// let x = TrinoJob::new().set_properties([
12601 /// ("key0", "abc"),
12602 /// ("key1", "xyz"),
12603 /// ]);
12604 /// ```
12605 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12606 where
12607 T: std::iter::IntoIterator<Item = (K, V)>,
12608 K: std::convert::Into<std::string::String>,
12609 V: std::convert::Into<std::string::String>,
12610 {
12611 use std::iter::Iterator;
12612 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12613 self
12614 }
12615
12616 /// Sets the value of [logging_config][crate::model::TrinoJob::logging_config].
12617 ///
12618 /// # Example
12619 /// ```ignore,no_run
12620 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12621 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12622 /// let x = TrinoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12623 /// ```
12624 pub fn set_logging_config<T>(mut self, v: T) -> Self
12625 where
12626 T: std::convert::Into<crate::model::LoggingConfig>,
12627 {
12628 self.logging_config = std::option::Option::Some(v.into());
12629 self
12630 }
12631
12632 /// Sets or clears the value of [logging_config][crate::model::TrinoJob::logging_config].
12633 ///
12634 /// # Example
12635 /// ```ignore,no_run
12636 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12637 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12638 /// let x = TrinoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12639 /// let x = TrinoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12640 /// ```
12641 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12642 where
12643 T: std::convert::Into<crate::model::LoggingConfig>,
12644 {
12645 self.logging_config = v.map(|x| x.into());
12646 self
12647 }
12648
12649 /// Sets the value of [queries][crate::model::TrinoJob::queries].
12650 ///
12651 /// Note that all the setters affecting `queries` are mutually
12652 /// exclusive.
12653 ///
12654 /// # Example
12655 /// ```ignore,no_run
12656 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12657 /// use google_cloud_dataproc_v1::model::trino_job::Queries;
12658 /// let x = TrinoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12659 /// ```
12660 pub fn set_queries<
12661 T: std::convert::Into<std::option::Option<crate::model::trino_job::Queries>>,
12662 >(
12663 mut self,
12664 v: T,
12665 ) -> Self {
12666 self.queries = v.into();
12667 self
12668 }
12669
12670 /// The value of [queries][crate::model::TrinoJob::queries]
12671 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12672 /// holds a different branch.
12673 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12674 #[allow(unreachable_patterns)]
12675 self.queries.as_ref().and_then(|v| match v {
12676 crate::model::trino_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12677 _ => std::option::Option::None,
12678 })
12679 }
12680
12681 /// Sets the value of [queries][crate::model::TrinoJob::queries]
12682 /// to hold a `QueryFileUri`.
12683 ///
12684 /// Note that all the setters affecting `queries` are
12685 /// mutually exclusive.
12686 ///
12687 /// # Example
12688 /// ```ignore,no_run
12689 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12690 /// let x = TrinoJob::new().set_query_file_uri("example");
12691 /// assert!(x.query_file_uri().is_some());
12692 /// assert!(x.query_list().is_none());
12693 /// ```
12694 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12695 self.queries =
12696 std::option::Option::Some(crate::model::trino_job::Queries::QueryFileUri(v.into()));
12697 self
12698 }
12699
12700 /// The value of [queries][crate::model::TrinoJob::queries]
12701 /// if it holds a `QueryList`, `None` if the field is not set or
12702 /// holds a different branch.
12703 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12704 #[allow(unreachable_patterns)]
12705 self.queries.as_ref().and_then(|v| match v {
12706 crate::model::trino_job::Queries::QueryList(v) => std::option::Option::Some(v),
12707 _ => std::option::Option::None,
12708 })
12709 }
12710
12711 /// Sets the value of [queries][crate::model::TrinoJob::queries]
12712 /// to hold a `QueryList`.
12713 ///
12714 /// Note that all the setters affecting `queries` are
12715 /// mutually exclusive.
12716 ///
12717 /// # Example
12718 /// ```ignore,no_run
12719 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12720 /// use google_cloud_dataproc_v1::model::QueryList;
12721 /// let x = TrinoJob::new().set_query_list(QueryList::default()/* use setters */);
12722 /// assert!(x.query_list().is_some());
12723 /// assert!(x.query_file_uri().is_none());
12724 /// ```
12725 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12726 mut self,
12727 v: T,
12728 ) -> Self {
12729 self.queries =
12730 std::option::Option::Some(crate::model::trino_job::Queries::QueryList(v.into()));
12731 self
12732 }
12733}
12734
12735impl wkt::message::Message for TrinoJob {
12736 fn typename() -> &'static str {
12737 "type.googleapis.com/google.cloud.dataproc.v1.TrinoJob"
12738 }
12739}
12740
12741/// Defines additional types related to [TrinoJob].
12742pub mod trino_job {
12743 #[allow(unused_imports)]
12744 use super::*;
12745
12746 /// Required. The sequence of Trino queries to execute, specified as
12747 /// either an HCFS file URI or as a list of queries.
12748 #[derive(Clone, Debug, PartialEq)]
12749 #[non_exhaustive]
12750 pub enum Queries {
12751 /// The HCFS URI of the script that contains SQL queries.
12752 QueryFileUri(std::string::String),
12753 /// A list of queries.
12754 QueryList(std::boxed::Box<crate::model::QueryList>),
12755 }
12756}
12757
12758/// A Dataproc job for running Apache Flink applications on YARN.
12759#[derive(Clone, Default, PartialEq)]
12760#[non_exhaustive]
12761pub struct FlinkJob {
12762 /// Optional. The arguments to pass to the driver. Do not include arguments,
12763 /// such as `--conf`, that can be set as job properties, since a collision
12764 /// might occur that causes an incorrect job submission.
12765 pub args: std::vec::Vec<std::string::String>,
12766
12767 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
12768 /// Flink driver and tasks.
12769 pub jar_file_uris: std::vec::Vec<std::string::String>,
12770
12771 /// Optional. HCFS URI of the savepoint, which contains the last saved progress
12772 /// for starting the current job.
12773 pub savepoint_uri: std::string::String,
12774
12775 /// Optional. A mapping of property names to values, used to configure Flink.
12776 /// Properties that conflict with values set by the Dataproc API might be
12777 /// overwritten. Can include properties set in
12778 /// `/etc/flink/conf/flink-defaults.conf` and classes in user code.
12779 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12780
12781 /// Optional. The runtime log config for job execution.
12782 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12783
12784 /// Required. The specification of the main method to call to drive the job.
12785 /// Specify either the jar file that contains the main class or the main class
12786 /// name. To pass both a main jar and a main class in the jar, add the jar to
12787 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
12788 /// specify the main class name in
12789 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
12790 ///
12791 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12792 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
12793 pub driver: std::option::Option<crate::model::flink_job::Driver>,
12794
12795 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12796}
12797
12798impl FlinkJob {
12799 pub fn new() -> Self {
12800 std::default::Default::default()
12801 }
12802
12803 /// Sets the value of [args][crate::model::FlinkJob::args].
12804 ///
12805 /// # Example
12806 /// ```ignore,no_run
12807 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12808 /// let x = FlinkJob::new().set_args(["a", "b", "c"]);
12809 /// ```
12810 pub fn set_args<T, V>(mut self, v: T) -> Self
12811 where
12812 T: std::iter::IntoIterator<Item = V>,
12813 V: std::convert::Into<std::string::String>,
12814 {
12815 use std::iter::Iterator;
12816 self.args = v.into_iter().map(|i| i.into()).collect();
12817 self
12818 }
12819
12820 /// Sets the value of [jar_file_uris][crate::model::FlinkJob::jar_file_uris].
12821 ///
12822 /// # Example
12823 /// ```ignore,no_run
12824 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12825 /// let x = FlinkJob::new().set_jar_file_uris(["a", "b", "c"]);
12826 /// ```
12827 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12828 where
12829 T: std::iter::IntoIterator<Item = V>,
12830 V: std::convert::Into<std::string::String>,
12831 {
12832 use std::iter::Iterator;
12833 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12834 self
12835 }
12836
12837 /// Sets the value of [savepoint_uri][crate::model::FlinkJob::savepoint_uri].
12838 ///
12839 /// # Example
12840 /// ```ignore,no_run
12841 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12842 /// let x = FlinkJob::new().set_savepoint_uri("example");
12843 /// ```
12844 pub fn set_savepoint_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12845 self.savepoint_uri = v.into();
12846 self
12847 }
12848
12849 /// Sets the value of [properties][crate::model::FlinkJob::properties].
12850 ///
12851 /// # Example
12852 /// ```ignore,no_run
12853 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12854 /// let x = FlinkJob::new().set_properties([
12855 /// ("key0", "abc"),
12856 /// ("key1", "xyz"),
12857 /// ]);
12858 /// ```
12859 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12860 where
12861 T: std::iter::IntoIterator<Item = (K, V)>,
12862 K: std::convert::Into<std::string::String>,
12863 V: std::convert::Into<std::string::String>,
12864 {
12865 use std::iter::Iterator;
12866 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12867 self
12868 }
12869
12870 /// Sets the value of [logging_config][crate::model::FlinkJob::logging_config].
12871 ///
12872 /// # Example
12873 /// ```ignore,no_run
12874 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12875 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12876 /// let x = FlinkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12877 /// ```
12878 pub fn set_logging_config<T>(mut self, v: T) -> Self
12879 where
12880 T: std::convert::Into<crate::model::LoggingConfig>,
12881 {
12882 self.logging_config = std::option::Option::Some(v.into());
12883 self
12884 }
12885
12886 /// Sets or clears the value of [logging_config][crate::model::FlinkJob::logging_config].
12887 ///
12888 /// # Example
12889 /// ```ignore,no_run
12890 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12891 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12892 /// let x = FlinkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12893 /// let x = FlinkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12894 /// ```
12895 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12896 where
12897 T: std::convert::Into<crate::model::LoggingConfig>,
12898 {
12899 self.logging_config = v.map(|x| x.into());
12900 self
12901 }
12902
12903 /// Sets the value of [driver][crate::model::FlinkJob::driver].
12904 ///
12905 /// Note that all the setters affecting `driver` are mutually
12906 /// exclusive.
12907 ///
12908 /// # Example
12909 /// ```ignore,no_run
12910 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12911 /// use google_cloud_dataproc_v1::model::flink_job::Driver;
12912 /// let x = FlinkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
12913 /// ```
12914 pub fn set_driver<
12915 T: std::convert::Into<std::option::Option<crate::model::flink_job::Driver>>,
12916 >(
12917 mut self,
12918 v: T,
12919 ) -> Self {
12920 self.driver = v.into();
12921 self
12922 }
12923
12924 /// The value of [driver][crate::model::FlinkJob::driver]
12925 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
12926 /// holds a different branch.
12927 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
12928 #[allow(unreachable_patterns)]
12929 self.driver.as_ref().and_then(|v| match v {
12930 crate::model::flink_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
12931 _ => std::option::Option::None,
12932 })
12933 }
12934
12935 /// Sets the value of [driver][crate::model::FlinkJob::driver]
12936 /// to hold a `MainJarFileUri`.
12937 ///
12938 /// Note that all the setters affecting `driver` are
12939 /// mutually exclusive.
12940 ///
12941 /// # Example
12942 /// ```ignore,no_run
12943 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12944 /// let x = FlinkJob::new().set_main_jar_file_uri("example");
12945 /// assert!(x.main_jar_file_uri().is_some());
12946 /// assert!(x.main_class().is_none());
12947 /// ```
12948 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
12949 mut self,
12950 v: T,
12951 ) -> Self {
12952 self.driver =
12953 std::option::Option::Some(crate::model::flink_job::Driver::MainJarFileUri(v.into()));
12954 self
12955 }
12956
12957 /// The value of [driver][crate::model::FlinkJob::driver]
12958 /// if it holds a `MainClass`, `None` if the field is not set or
12959 /// holds a different branch.
12960 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
12961 #[allow(unreachable_patterns)]
12962 self.driver.as_ref().and_then(|v| match v {
12963 crate::model::flink_job::Driver::MainClass(v) => std::option::Option::Some(v),
12964 _ => std::option::Option::None,
12965 })
12966 }
12967
12968 /// Sets the value of [driver][crate::model::FlinkJob::driver]
12969 /// to hold a `MainClass`.
12970 ///
12971 /// Note that all the setters affecting `driver` are
12972 /// mutually exclusive.
12973 ///
12974 /// # Example
12975 /// ```ignore,no_run
12976 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12977 /// let x = FlinkJob::new().set_main_class("example");
12978 /// assert!(x.main_class().is_some());
12979 /// assert!(x.main_jar_file_uri().is_none());
12980 /// ```
12981 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12982 self.driver =
12983 std::option::Option::Some(crate::model::flink_job::Driver::MainClass(v.into()));
12984 self
12985 }
12986}
12987
12988impl wkt::message::Message for FlinkJob {
12989 fn typename() -> &'static str {
12990 "type.googleapis.com/google.cloud.dataproc.v1.FlinkJob"
12991 }
12992}
12993
12994/// Defines additional types related to [FlinkJob].
12995pub mod flink_job {
12996 #[allow(unused_imports)]
12997 use super::*;
12998
12999 /// Required. The specification of the main method to call to drive the job.
13000 /// Specify either the jar file that contains the main class or the main class
13001 /// name. To pass both a main jar and a main class in the jar, add the jar to
13002 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
13003 /// specify the main class name in
13004 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
13005 ///
13006 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13007 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
13008 #[derive(Clone, Debug, PartialEq)]
13009 #[non_exhaustive]
13010 pub enum Driver {
13011 /// The HCFS URI of the jar file that contains the main class.
13012 MainJarFileUri(std::string::String),
13013 /// The name of the driver's main class. The jar file that contains the class
13014 /// must be in the default CLASSPATH or specified in
13015 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris].
13016 ///
13017 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13018 MainClass(std::string::String),
13019 }
13020}
13021
13022/// Dataproc job config.
13023#[derive(Clone, Default, PartialEq)]
13024#[non_exhaustive]
13025pub struct JobPlacement {
13026 /// Required. The name of the cluster where the job will be submitted.
13027 pub cluster_name: std::string::String,
13028
13029 /// Output only. A cluster UUID generated by the Dataproc service when
13030 /// the job is submitted.
13031 pub cluster_uuid: std::string::String,
13032
13033 /// Optional. Cluster labels to identify a cluster where the job will be
13034 /// submitted.
13035 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
13036
13037 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13038}
13039
13040impl JobPlacement {
13041 pub fn new() -> Self {
13042 std::default::Default::default()
13043 }
13044
13045 /// Sets the value of [cluster_name][crate::model::JobPlacement::cluster_name].
13046 ///
13047 /// # Example
13048 /// ```ignore,no_run
13049 /// # use google_cloud_dataproc_v1::model::JobPlacement;
13050 /// let x = JobPlacement::new().set_cluster_name("example");
13051 /// ```
13052 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13053 self.cluster_name = v.into();
13054 self
13055 }
13056
13057 /// Sets the value of [cluster_uuid][crate::model::JobPlacement::cluster_uuid].
13058 ///
13059 /// # Example
13060 /// ```ignore,no_run
13061 /// # use google_cloud_dataproc_v1::model::JobPlacement;
13062 /// let x = JobPlacement::new().set_cluster_uuid("example");
13063 /// ```
13064 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13065 self.cluster_uuid = v.into();
13066 self
13067 }
13068
13069 /// Sets the value of [cluster_labels][crate::model::JobPlacement::cluster_labels].
13070 ///
13071 /// # Example
13072 /// ```ignore,no_run
13073 /// # use google_cloud_dataproc_v1::model::JobPlacement;
13074 /// let x = JobPlacement::new().set_cluster_labels([
13075 /// ("key0", "abc"),
13076 /// ("key1", "xyz"),
13077 /// ]);
13078 /// ```
13079 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
13080 where
13081 T: std::iter::IntoIterator<Item = (K, V)>,
13082 K: std::convert::Into<std::string::String>,
13083 V: std::convert::Into<std::string::String>,
13084 {
13085 use std::iter::Iterator;
13086 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13087 self
13088 }
13089}
13090
13091impl wkt::message::Message for JobPlacement {
13092 fn typename() -> &'static str {
13093 "type.googleapis.com/google.cloud.dataproc.v1.JobPlacement"
13094 }
13095}
13096
13097/// Dataproc job status.
13098#[derive(Clone, Default, PartialEq)]
13099#[non_exhaustive]
13100pub struct JobStatus {
13101 /// Output only. A state message specifying the overall job state.
13102 pub state: crate::model::job_status::State,
13103
13104 /// Optional. Output only. Job state details, such as an error
13105 /// description if the state is `ERROR`.
13106 pub details: std::string::String,
13107
13108 /// Output only. The time when this state was entered.
13109 pub state_start_time: std::option::Option<wkt::Timestamp>,
13110
13111 /// Output only. Additional state information, which includes
13112 /// status reported by the agent.
13113 pub substate: crate::model::job_status::Substate,
13114
13115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13116}
13117
13118impl JobStatus {
13119 pub fn new() -> Self {
13120 std::default::Default::default()
13121 }
13122
13123 /// Sets the value of [state][crate::model::JobStatus::state].
13124 ///
13125 /// # Example
13126 /// ```ignore,no_run
13127 /// # use google_cloud_dataproc_v1::model::JobStatus;
13128 /// use google_cloud_dataproc_v1::model::job_status::State;
13129 /// let x0 = JobStatus::new().set_state(State::Pending);
13130 /// let x1 = JobStatus::new().set_state(State::SetupDone);
13131 /// let x2 = JobStatus::new().set_state(State::Running);
13132 /// ```
13133 pub fn set_state<T: std::convert::Into<crate::model::job_status::State>>(
13134 mut self,
13135 v: T,
13136 ) -> Self {
13137 self.state = v.into();
13138 self
13139 }
13140
13141 /// Sets the value of [details][crate::model::JobStatus::details].
13142 ///
13143 /// # Example
13144 /// ```ignore,no_run
13145 /// # use google_cloud_dataproc_v1::model::JobStatus;
13146 /// let x = JobStatus::new().set_details("example");
13147 /// ```
13148 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13149 self.details = v.into();
13150 self
13151 }
13152
13153 /// Sets the value of [state_start_time][crate::model::JobStatus::state_start_time].
13154 ///
13155 /// # Example
13156 /// ```ignore,no_run
13157 /// # use google_cloud_dataproc_v1::model::JobStatus;
13158 /// use wkt::Timestamp;
13159 /// let x = JobStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
13160 /// ```
13161 pub fn set_state_start_time<T>(mut self, v: T) -> Self
13162 where
13163 T: std::convert::Into<wkt::Timestamp>,
13164 {
13165 self.state_start_time = std::option::Option::Some(v.into());
13166 self
13167 }
13168
13169 /// Sets or clears the value of [state_start_time][crate::model::JobStatus::state_start_time].
13170 ///
13171 /// # Example
13172 /// ```ignore,no_run
13173 /// # use google_cloud_dataproc_v1::model::JobStatus;
13174 /// use wkt::Timestamp;
13175 /// let x = JobStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
13176 /// let x = JobStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
13177 /// ```
13178 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
13179 where
13180 T: std::convert::Into<wkt::Timestamp>,
13181 {
13182 self.state_start_time = v.map(|x| x.into());
13183 self
13184 }
13185
13186 /// Sets the value of [substate][crate::model::JobStatus::substate].
13187 ///
13188 /// # Example
13189 /// ```ignore,no_run
13190 /// # use google_cloud_dataproc_v1::model::JobStatus;
13191 /// use google_cloud_dataproc_v1::model::job_status::Substate;
13192 /// let x0 = JobStatus::new().set_substate(Substate::Submitted);
13193 /// let x1 = JobStatus::new().set_substate(Substate::Queued);
13194 /// let x2 = JobStatus::new().set_substate(Substate::StaleStatus);
13195 /// ```
13196 pub fn set_substate<T: std::convert::Into<crate::model::job_status::Substate>>(
13197 mut self,
13198 v: T,
13199 ) -> Self {
13200 self.substate = v.into();
13201 self
13202 }
13203}
13204
13205impl wkt::message::Message for JobStatus {
13206 fn typename() -> &'static str {
13207 "type.googleapis.com/google.cloud.dataproc.v1.JobStatus"
13208 }
13209}
13210
13211/// Defines additional types related to [JobStatus].
13212pub mod job_status {
13213 #[allow(unused_imports)]
13214 use super::*;
13215
13216 /// The job state.
13217 ///
13218 /// # Working with unknown values
13219 ///
13220 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13221 /// additional enum variants at any time. Adding new variants is not considered
13222 /// a breaking change. Applications should write their code in anticipation of:
13223 ///
13224 /// - New values appearing in future releases of the client library, **and**
13225 /// - New values received dynamically, without application changes.
13226 ///
13227 /// Please consult the [Working with enums] section in the user guide for some
13228 /// guidelines.
13229 ///
13230 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13231 #[derive(Clone, Debug, PartialEq)]
13232 #[non_exhaustive]
13233 pub enum State {
13234 /// The job state is unknown.
13235 Unspecified,
13236 /// The job is pending; it has been submitted, but is not yet running.
13237 Pending,
13238 /// Job has been received by the service and completed initial setup;
13239 /// it will soon be submitted to the cluster.
13240 SetupDone,
13241 /// The job is running on the cluster.
13242 Running,
13243 /// A CancelJob request has been received, but is pending.
13244 CancelPending,
13245 /// Transient in-flight resources have been canceled, and the request to
13246 /// cancel the running job has been issued to the cluster.
13247 CancelStarted,
13248 /// The job cancellation was successful.
13249 Cancelled,
13250 /// The job has completed successfully.
13251 Done,
13252 /// The job has completed, but encountered an error.
13253 Error,
13254 /// Job attempt has failed. The detail field contains failure details for
13255 /// this attempt.
13256 ///
13257 /// Applies to restartable jobs only.
13258 AttemptFailure,
13259 /// If set, the enum was initialized with an unknown value.
13260 ///
13261 /// Applications can examine the value using [State::value] or
13262 /// [State::name].
13263 UnknownValue(state::UnknownValue),
13264 }
13265
13266 #[doc(hidden)]
13267 pub mod state {
13268 #[allow(unused_imports)]
13269 use super::*;
13270 #[derive(Clone, Debug, PartialEq)]
13271 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13272 }
13273
13274 impl State {
13275 /// Gets the enum value.
13276 ///
13277 /// Returns `None` if the enum contains an unknown value deserialized from
13278 /// the string representation of enums.
13279 pub fn value(&self) -> std::option::Option<i32> {
13280 match self {
13281 Self::Unspecified => std::option::Option::Some(0),
13282 Self::Pending => std::option::Option::Some(1),
13283 Self::SetupDone => std::option::Option::Some(8),
13284 Self::Running => std::option::Option::Some(2),
13285 Self::CancelPending => std::option::Option::Some(3),
13286 Self::CancelStarted => std::option::Option::Some(7),
13287 Self::Cancelled => std::option::Option::Some(4),
13288 Self::Done => std::option::Option::Some(5),
13289 Self::Error => std::option::Option::Some(6),
13290 Self::AttemptFailure => std::option::Option::Some(9),
13291 Self::UnknownValue(u) => u.0.value(),
13292 }
13293 }
13294
13295 /// Gets the enum value as a string.
13296 ///
13297 /// Returns `None` if the enum contains an unknown value deserialized from
13298 /// the integer representation of enums.
13299 pub fn name(&self) -> std::option::Option<&str> {
13300 match self {
13301 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13302 Self::Pending => std::option::Option::Some("PENDING"),
13303 Self::SetupDone => std::option::Option::Some("SETUP_DONE"),
13304 Self::Running => std::option::Option::Some("RUNNING"),
13305 Self::CancelPending => std::option::Option::Some("CANCEL_PENDING"),
13306 Self::CancelStarted => std::option::Option::Some("CANCEL_STARTED"),
13307 Self::Cancelled => std::option::Option::Some("CANCELLED"),
13308 Self::Done => std::option::Option::Some("DONE"),
13309 Self::Error => std::option::Option::Some("ERROR"),
13310 Self::AttemptFailure => std::option::Option::Some("ATTEMPT_FAILURE"),
13311 Self::UnknownValue(u) => u.0.name(),
13312 }
13313 }
13314 }
13315
13316 impl std::default::Default for State {
13317 fn default() -> Self {
13318 use std::convert::From;
13319 Self::from(0)
13320 }
13321 }
13322
13323 impl std::fmt::Display for State {
13324 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13325 wkt::internal::display_enum(f, self.name(), self.value())
13326 }
13327 }
13328
13329 impl std::convert::From<i32> for State {
13330 fn from(value: i32) -> Self {
13331 match value {
13332 0 => Self::Unspecified,
13333 1 => Self::Pending,
13334 2 => Self::Running,
13335 3 => Self::CancelPending,
13336 4 => Self::Cancelled,
13337 5 => Self::Done,
13338 6 => Self::Error,
13339 7 => Self::CancelStarted,
13340 8 => Self::SetupDone,
13341 9 => Self::AttemptFailure,
13342 _ => Self::UnknownValue(state::UnknownValue(
13343 wkt::internal::UnknownEnumValue::Integer(value),
13344 )),
13345 }
13346 }
13347 }
13348
13349 impl std::convert::From<&str> for State {
13350 fn from(value: &str) -> Self {
13351 use std::string::ToString;
13352 match value {
13353 "STATE_UNSPECIFIED" => Self::Unspecified,
13354 "PENDING" => Self::Pending,
13355 "SETUP_DONE" => Self::SetupDone,
13356 "RUNNING" => Self::Running,
13357 "CANCEL_PENDING" => Self::CancelPending,
13358 "CANCEL_STARTED" => Self::CancelStarted,
13359 "CANCELLED" => Self::Cancelled,
13360 "DONE" => Self::Done,
13361 "ERROR" => Self::Error,
13362 "ATTEMPT_FAILURE" => Self::AttemptFailure,
13363 _ => Self::UnknownValue(state::UnknownValue(
13364 wkt::internal::UnknownEnumValue::String(value.to_string()),
13365 )),
13366 }
13367 }
13368 }
13369
13370 impl serde::ser::Serialize for State {
13371 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13372 where
13373 S: serde::Serializer,
13374 {
13375 match self {
13376 Self::Unspecified => serializer.serialize_i32(0),
13377 Self::Pending => serializer.serialize_i32(1),
13378 Self::SetupDone => serializer.serialize_i32(8),
13379 Self::Running => serializer.serialize_i32(2),
13380 Self::CancelPending => serializer.serialize_i32(3),
13381 Self::CancelStarted => serializer.serialize_i32(7),
13382 Self::Cancelled => serializer.serialize_i32(4),
13383 Self::Done => serializer.serialize_i32(5),
13384 Self::Error => serializer.serialize_i32(6),
13385 Self::AttemptFailure => serializer.serialize_i32(9),
13386 Self::UnknownValue(u) => u.0.serialize(serializer),
13387 }
13388 }
13389 }
13390
13391 impl<'de> serde::de::Deserialize<'de> for State {
13392 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13393 where
13394 D: serde::Deserializer<'de>,
13395 {
13396 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13397 ".google.cloud.dataproc.v1.JobStatus.State",
13398 ))
13399 }
13400 }
13401
13402 /// The job substate.
13403 ///
13404 /// # Working with unknown values
13405 ///
13406 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13407 /// additional enum variants at any time. Adding new variants is not considered
13408 /// a breaking change. Applications should write their code in anticipation of:
13409 ///
13410 /// - New values appearing in future releases of the client library, **and**
13411 /// - New values received dynamically, without application changes.
13412 ///
13413 /// Please consult the [Working with enums] section in the user guide for some
13414 /// guidelines.
13415 ///
13416 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13417 #[derive(Clone, Debug, PartialEq)]
13418 #[non_exhaustive]
13419 pub enum Substate {
13420 /// The job substate is unknown.
13421 Unspecified,
13422 /// The Job is submitted to the agent.
13423 ///
13424 /// Applies to RUNNING state.
13425 Submitted,
13426 /// The Job has been received and is awaiting execution (it might be waiting
13427 /// for a condition to be met). See the "details" field for the reason for
13428 /// the delay.
13429 ///
13430 /// Applies to RUNNING state.
13431 Queued,
13432 /// The agent-reported status is out of date, which can be caused by a
13433 /// loss of communication between the agent and Dataproc. If the
13434 /// agent does not send a timely update, the job will fail.
13435 ///
13436 /// Applies to RUNNING state.
13437 StaleStatus,
13438 /// If set, the enum was initialized with an unknown value.
13439 ///
13440 /// Applications can examine the value using [Substate::value] or
13441 /// [Substate::name].
13442 UnknownValue(substate::UnknownValue),
13443 }
13444
13445 #[doc(hidden)]
13446 pub mod substate {
13447 #[allow(unused_imports)]
13448 use super::*;
13449 #[derive(Clone, Debug, PartialEq)]
13450 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13451 }
13452
13453 impl Substate {
13454 /// Gets the enum value.
13455 ///
13456 /// Returns `None` if the enum contains an unknown value deserialized from
13457 /// the string representation of enums.
13458 pub fn value(&self) -> std::option::Option<i32> {
13459 match self {
13460 Self::Unspecified => std::option::Option::Some(0),
13461 Self::Submitted => std::option::Option::Some(1),
13462 Self::Queued => std::option::Option::Some(2),
13463 Self::StaleStatus => std::option::Option::Some(3),
13464 Self::UnknownValue(u) => u.0.value(),
13465 }
13466 }
13467
13468 /// Gets the enum value as a string.
13469 ///
13470 /// Returns `None` if the enum contains an unknown value deserialized from
13471 /// the integer representation of enums.
13472 pub fn name(&self) -> std::option::Option<&str> {
13473 match self {
13474 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
13475 Self::Submitted => std::option::Option::Some("SUBMITTED"),
13476 Self::Queued => std::option::Option::Some("QUEUED"),
13477 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
13478 Self::UnknownValue(u) => u.0.name(),
13479 }
13480 }
13481 }
13482
13483 impl std::default::Default for Substate {
13484 fn default() -> Self {
13485 use std::convert::From;
13486 Self::from(0)
13487 }
13488 }
13489
13490 impl std::fmt::Display for Substate {
13491 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13492 wkt::internal::display_enum(f, self.name(), self.value())
13493 }
13494 }
13495
13496 impl std::convert::From<i32> for Substate {
13497 fn from(value: i32) -> Self {
13498 match value {
13499 0 => Self::Unspecified,
13500 1 => Self::Submitted,
13501 2 => Self::Queued,
13502 3 => Self::StaleStatus,
13503 _ => Self::UnknownValue(substate::UnknownValue(
13504 wkt::internal::UnknownEnumValue::Integer(value),
13505 )),
13506 }
13507 }
13508 }
13509
13510 impl std::convert::From<&str> for Substate {
13511 fn from(value: &str) -> Self {
13512 use std::string::ToString;
13513 match value {
13514 "UNSPECIFIED" => Self::Unspecified,
13515 "SUBMITTED" => Self::Submitted,
13516 "QUEUED" => Self::Queued,
13517 "STALE_STATUS" => Self::StaleStatus,
13518 _ => Self::UnknownValue(substate::UnknownValue(
13519 wkt::internal::UnknownEnumValue::String(value.to_string()),
13520 )),
13521 }
13522 }
13523 }
13524
13525 impl serde::ser::Serialize for Substate {
13526 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13527 where
13528 S: serde::Serializer,
13529 {
13530 match self {
13531 Self::Unspecified => serializer.serialize_i32(0),
13532 Self::Submitted => serializer.serialize_i32(1),
13533 Self::Queued => serializer.serialize_i32(2),
13534 Self::StaleStatus => serializer.serialize_i32(3),
13535 Self::UnknownValue(u) => u.0.serialize(serializer),
13536 }
13537 }
13538 }
13539
13540 impl<'de> serde::de::Deserialize<'de> for Substate {
13541 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13542 where
13543 D: serde::Deserializer<'de>,
13544 {
13545 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
13546 ".google.cloud.dataproc.v1.JobStatus.Substate",
13547 ))
13548 }
13549 }
13550}
13551
13552/// Encapsulates the full scoping used to reference a job.
13553#[derive(Clone, Default, PartialEq)]
13554#[non_exhaustive]
13555pub struct JobReference {
13556 /// Optional. The ID of the Google Cloud Platform project that the job belongs
13557 /// to. If specified, must match the request project ID.
13558 pub project_id: std::string::String,
13559
13560 /// Optional. The job ID, which must be unique within the project.
13561 ///
13562 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
13563 /// underscores (_), or hyphens (-). The maximum length is 100 characters.
13564 ///
13565 /// If not specified by the caller, the job ID will be provided by the server.
13566 pub job_id: std::string::String,
13567
13568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13569}
13570
13571impl JobReference {
13572 pub fn new() -> Self {
13573 std::default::Default::default()
13574 }
13575
13576 /// Sets the value of [project_id][crate::model::JobReference::project_id].
13577 ///
13578 /// # Example
13579 /// ```ignore,no_run
13580 /// # use google_cloud_dataproc_v1::model::JobReference;
13581 /// let x = JobReference::new().set_project_id("example");
13582 /// ```
13583 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13584 self.project_id = v.into();
13585 self
13586 }
13587
13588 /// Sets the value of [job_id][crate::model::JobReference::job_id].
13589 ///
13590 /// # Example
13591 /// ```ignore,no_run
13592 /// # use google_cloud_dataproc_v1::model::JobReference;
13593 /// let x = JobReference::new().set_job_id("example");
13594 /// ```
13595 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13596 self.job_id = v.into();
13597 self
13598 }
13599}
13600
13601impl wkt::message::Message for JobReference {
13602 fn typename() -> &'static str {
13603 "type.googleapis.com/google.cloud.dataproc.v1.JobReference"
13604 }
13605}
13606
13607/// A YARN application created by a job. Application information is a subset of
13608/// \<code\>org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto\</code\>.
13609///
13610/// **Beta Feature**: This report is available for testing purposes only. It may
13611/// be changed before final release.
13612#[derive(Clone, Default, PartialEq)]
13613#[non_exhaustive]
13614pub struct YarnApplication {
13615 /// Required. The application name.
13616 pub name: std::string::String,
13617
13618 /// Required. The application state.
13619 pub state: crate::model::yarn_application::State,
13620
13621 /// Required. The numerical progress of the application, from 1 to 100.
13622 pub progress: f32,
13623
13624 /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or
13625 /// TimelineServer that provides application-specific information. The URL uses
13626 /// the internal hostname, and requires a proxy server for resolution and,
13627 /// possibly, access.
13628 pub tracking_url: std::string::String,
13629
13630 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13631}
13632
13633impl YarnApplication {
13634 pub fn new() -> Self {
13635 std::default::Default::default()
13636 }
13637
13638 /// Sets the value of [name][crate::model::YarnApplication::name].
13639 ///
13640 /// # Example
13641 /// ```ignore,no_run
13642 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13643 /// let x = YarnApplication::new().set_name("example");
13644 /// ```
13645 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13646 self.name = v.into();
13647 self
13648 }
13649
13650 /// Sets the value of [state][crate::model::YarnApplication::state].
13651 ///
13652 /// # Example
13653 /// ```ignore,no_run
13654 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13655 /// use google_cloud_dataproc_v1::model::yarn_application::State;
13656 /// let x0 = YarnApplication::new().set_state(State::New);
13657 /// let x1 = YarnApplication::new().set_state(State::NewSaving);
13658 /// let x2 = YarnApplication::new().set_state(State::Submitted);
13659 /// ```
13660 pub fn set_state<T: std::convert::Into<crate::model::yarn_application::State>>(
13661 mut self,
13662 v: T,
13663 ) -> Self {
13664 self.state = v.into();
13665 self
13666 }
13667
13668 /// Sets the value of [progress][crate::model::YarnApplication::progress].
13669 ///
13670 /// # Example
13671 /// ```ignore,no_run
13672 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13673 /// let x = YarnApplication::new().set_progress(42.0);
13674 /// ```
13675 pub fn set_progress<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
13676 self.progress = v.into();
13677 self
13678 }
13679
13680 /// Sets the value of [tracking_url][crate::model::YarnApplication::tracking_url].
13681 ///
13682 /// # Example
13683 /// ```ignore,no_run
13684 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13685 /// let x = YarnApplication::new().set_tracking_url("example");
13686 /// ```
13687 pub fn set_tracking_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13688 self.tracking_url = v.into();
13689 self
13690 }
13691}
13692
13693impl wkt::message::Message for YarnApplication {
13694 fn typename() -> &'static str {
13695 "type.googleapis.com/google.cloud.dataproc.v1.YarnApplication"
13696 }
13697}
13698
13699/// Defines additional types related to [YarnApplication].
13700pub mod yarn_application {
13701 #[allow(unused_imports)]
13702 use super::*;
13703
13704 /// The application state, corresponding to
13705 /// \<code\>YarnProtos.YarnApplicationStateProto\</code\>.
13706 ///
13707 /// # Working with unknown values
13708 ///
13709 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13710 /// additional enum variants at any time. Adding new variants is not considered
13711 /// a breaking change. Applications should write their code in anticipation of:
13712 ///
13713 /// - New values appearing in future releases of the client library, **and**
13714 /// - New values received dynamically, without application changes.
13715 ///
13716 /// Please consult the [Working with enums] section in the user guide for some
13717 /// guidelines.
13718 ///
13719 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13720 #[derive(Clone, Debug, PartialEq)]
13721 #[non_exhaustive]
13722 pub enum State {
13723 /// Status is unspecified.
13724 Unspecified,
13725 /// Status is NEW.
13726 New,
13727 /// Status is NEW_SAVING.
13728 NewSaving,
13729 /// Status is SUBMITTED.
13730 Submitted,
13731 /// Status is ACCEPTED.
13732 Accepted,
13733 /// Status is RUNNING.
13734 Running,
13735 /// Status is FINISHED.
13736 Finished,
13737 /// Status is FAILED.
13738 Failed,
13739 /// Status is KILLED.
13740 Killed,
13741 /// If set, the enum was initialized with an unknown value.
13742 ///
13743 /// Applications can examine the value using [State::value] or
13744 /// [State::name].
13745 UnknownValue(state::UnknownValue),
13746 }
13747
13748 #[doc(hidden)]
13749 pub mod state {
13750 #[allow(unused_imports)]
13751 use super::*;
13752 #[derive(Clone, Debug, PartialEq)]
13753 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13754 }
13755
13756 impl State {
13757 /// Gets the enum value.
13758 ///
13759 /// Returns `None` if the enum contains an unknown value deserialized from
13760 /// the string representation of enums.
13761 pub fn value(&self) -> std::option::Option<i32> {
13762 match self {
13763 Self::Unspecified => std::option::Option::Some(0),
13764 Self::New => std::option::Option::Some(1),
13765 Self::NewSaving => std::option::Option::Some(2),
13766 Self::Submitted => std::option::Option::Some(3),
13767 Self::Accepted => std::option::Option::Some(4),
13768 Self::Running => std::option::Option::Some(5),
13769 Self::Finished => std::option::Option::Some(6),
13770 Self::Failed => std::option::Option::Some(7),
13771 Self::Killed => std::option::Option::Some(8),
13772 Self::UnknownValue(u) => u.0.value(),
13773 }
13774 }
13775
13776 /// Gets the enum value as a string.
13777 ///
13778 /// Returns `None` if the enum contains an unknown value deserialized from
13779 /// the integer representation of enums.
13780 pub fn name(&self) -> std::option::Option<&str> {
13781 match self {
13782 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13783 Self::New => std::option::Option::Some("NEW"),
13784 Self::NewSaving => std::option::Option::Some("NEW_SAVING"),
13785 Self::Submitted => std::option::Option::Some("SUBMITTED"),
13786 Self::Accepted => std::option::Option::Some("ACCEPTED"),
13787 Self::Running => std::option::Option::Some("RUNNING"),
13788 Self::Finished => std::option::Option::Some("FINISHED"),
13789 Self::Failed => std::option::Option::Some("FAILED"),
13790 Self::Killed => std::option::Option::Some("KILLED"),
13791 Self::UnknownValue(u) => u.0.name(),
13792 }
13793 }
13794 }
13795
13796 impl std::default::Default for State {
13797 fn default() -> Self {
13798 use std::convert::From;
13799 Self::from(0)
13800 }
13801 }
13802
13803 impl std::fmt::Display for State {
13804 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13805 wkt::internal::display_enum(f, self.name(), self.value())
13806 }
13807 }
13808
13809 impl std::convert::From<i32> for State {
13810 fn from(value: i32) -> Self {
13811 match value {
13812 0 => Self::Unspecified,
13813 1 => Self::New,
13814 2 => Self::NewSaving,
13815 3 => Self::Submitted,
13816 4 => Self::Accepted,
13817 5 => Self::Running,
13818 6 => Self::Finished,
13819 7 => Self::Failed,
13820 8 => Self::Killed,
13821 _ => Self::UnknownValue(state::UnknownValue(
13822 wkt::internal::UnknownEnumValue::Integer(value),
13823 )),
13824 }
13825 }
13826 }
13827
13828 impl std::convert::From<&str> for State {
13829 fn from(value: &str) -> Self {
13830 use std::string::ToString;
13831 match value {
13832 "STATE_UNSPECIFIED" => Self::Unspecified,
13833 "NEW" => Self::New,
13834 "NEW_SAVING" => Self::NewSaving,
13835 "SUBMITTED" => Self::Submitted,
13836 "ACCEPTED" => Self::Accepted,
13837 "RUNNING" => Self::Running,
13838 "FINISHED" => Self::Finished,
13839 "FAILED" => Self::Failed,
13840 "KILLED" => Self::Killed,
13841 _ => Self::UnknownValue(state::UnknownValue(
13842 wkt::internal::UnknownEnumValue::String(value.to_string()),
13843 )),
13844 }
13845 }
13846 }
13847
13848 impl serde::ser::Serialize for State {
13849 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13850 where
13851 S: serde::Serializer,
13852 {
13853 match self {
13854 Self::Unspecified => serializer.serialize_i32(0),
13855 Self::New => serializer.serialize_i32(1),
13856 Self::NewSaving => serializer.serialize_i32(2),
13857 Self::Submitted => serializer.serialize_i32(3),
13858 Self::Accepted => serializer.serialize_i32(4),
13859 Self::Running => serializer.serialize_i32(5),
13860 Self::Finished => serializer.serialize_i32(6),
13861 Self::Failed => serializer.serialize_i32(7),
13862 Self::Killed => serializer.serialize_i32(8),
13863 Self::UnknownValue(u) => u.0.serialize(serializer),
13864 }
13865 }
13866 }
13867
13868 impl<'de> serde::de::Deserialize<'de> for State {
13869 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13870 where
13871 D: serde::Deserializer<'de>,
13872 {
13873 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13874 ".google.cloud.dataproc.v1.YarnApplication.State",
13875 ))
13876 }
13877 }
13878}
13879
13880/// A Dataproc job resource.
13881#[derive(Clone, Default, PartialEq)]
13882#[non_exhaustive]
13883pub struct Job {
13884 /// Optional. The fully qualified reference to the job, which can be used to
13885 /// obtain the equivalent REST path of the job resource. If this property
13886 /// is not specified when a job is created, the server generates a
13887 /// \<code\>job_id\</code\>.
13888 pub reference: std::option::Option<crate::model::JobReference>,
13889
13890 /// Required. Job information, including how, when, and where to
13891 /// run the job.
13892 pub placement: std::option::Option<crate::model::JobPlacement>,
13893
13894 /// Output only. The job status. Additional application-specific
13895 /// status information might be contained in the \<code\>type_job\</code\>
13896 /// and \<code\>yarn_applications\</code\> fields.
13897 pub status: std::option::Option<crate::model::JobStatus>,
13898
13899 /// Output only. The previous job status.
13900 pub status_history: std::vec::Vec<crate::model::JobStatus>,
13901
13902 /// Output only. The collection of YARN applications spun up by this job.
13903 ///
13904 /// **Beta** Feature: This report is available for testing purposes only. It
13905 /// might be changed before final release.
13906 pub yarn_applications: std::vec::Vec<crate::model::YarnApplication>,
13907
13908 /// Output only. A URI pointing to the location of the stdout of the job's
13909 /// driver program.
13910 pub driver_output_resource_uri: std::string::String,
13911
13912 /// Output only. If present, the location of miscellaneous control files
13913 /// which can be used as part of job setup and handling. If not present,
13914 /// control files might be placed in the same location as `driver_output_uri`.
13915 pub driver_control_files_uri: std::string::String,
13916
13917 /// Optional. The labels to associate with this job.
13918 /// Label **keys** must contain 1 to 63 characters, and must conform to
13919 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
13920 /// Label **values** can be empty, but, if present, must contain 1 to 63
13921 /// characters, and must conform to [RFC
13922 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
13923 /// associated with a job.
13924 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
13925
13926 /// Optional. Job scheduling configuration.
13927 pub scheduling: std::option::Option<crate::model::JobScheduling>,
13928
13929 /// Output only. A UUID that uniquely identifies a job within the project
13930 /// over time. This is in contrast to a user-settable reference.job_id that
13931 /// might be reused over time.
13932 pub job_uuid: std::string::String,
13933
13934 /// Output only. Indicates whether the job is completed. If the value is
13935 /// `false`, the job is still in progress. If `true`, the job is completed, and
13936 /// `status.state` field will indicate if it was successful, failed,
13937 /// or cancelled.
13938 pub done: bool,
13939
13940 /// Optional. Driver scheduling configuration.
13941 pub driver_scheduling_config: std::option::Option<crate::model::DriverSchedulingConfig>,
13942
13943 /// Required. The application/framework-specific portion of the job.
13944 pub type_job: std::option::Option<crate::model::job::TypeJob>,
13945
13946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13947}
13948
13949impl Job {
13950 pub fn new() -> Self {
13951 std::default::Default::default()
13952 }
13953
13954 /// Sets the value of [reference][crate::model::Job::reference].
13955 ///
13956 /// # Example
13957 /// ```ignore,no_run
13958 /// # use google_cloud_dataproc_v1::model::Job;
13959 /// use google_cloud_dataproc_v1::model::JobReference;
13960 /// let x = Job::new().set_reference(JobReference::default()/* use setters */);
13961 /// ```
13962 pub fn set_reference<T>(mut self, v: T) -> Self
13963 where
13964 T: std::convert::Into<crate::model::JobReference>,
13965 {
13966 self.reference = std::option::Option::Some(v.into());
13967 self
13968 }
13969
13970 /// Sets or clears the value of [reference][crate::model::Job::reference].
13971 ///
13972 /// # Example
13973 /// ```ignore,no_run
13974 /// # use google_cloud_dataproc_v1::model::Job;
13975 /// use google_cloud_dataproc_v1::model::JobReference;
13976 /// let x = Job::new().set_or_clear_reference(Some(JobReference::default()/* use setters */));
13977 /// let x = Job::new().set_or_clear_reference(None::<JobReference>);
13978 /// ```
13979 pub fn set_or_clear_reference<T>(mut self, v: std::option::Option<T>) -> Self
13980 where
13981 T: std::convert::Into<crate::model::JobReference>,
13982 {
13983 self.reference = v.map(|x| x.into());
13984 self
13985 }
13986
13987 /// Sets the value of [placement][crate::model::Job::placement].
13988 ///
13989 /// # Example
13990 /// ```ignore,no_run
13991 /// # use google_cloud_dataproc_v1::model::Job;
13992 /// use google_cloud_dataproc_v1::model::JobPlacement;
13993 /// let x = Job::new().set_placement(JobPlacement::default()/* use setters */);
13994 /// ```
13995 pub fn set_placement<T>(mut self, v: T) -> Self
13996 where
13997 T: std::convert::Into<crate::model::JobPlacement>,
13998 {
13999 self.placement = std::option::Option::Some(v.into());
14000 self
14001 }
14002
14003 /// Sets or clears the value of [placement][crate::model::Job::placement].
14004 ///
14005 /// # Example
14006 /// ```ignore,no_run
14007 /// # use google_cloud_dataproc_v1::model::Job;
14008 /// use google_cloud_dataproc_v1::model::JobPlacement;
14009 /// let x = Job::new().set_or_clear_placement(Some(JobPlacement::default()/* use setters */));
14010 /// let x = Job::new().set_or_clear_placement(None::<JobPlacement>);
14011 /// ```
14012 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
14013 where
14014 T: std::convert::Into<crate::model::JobPlacement>,
14015 {
14016 self.placement = v.map(|x| x.into());
14017 self
14018 }
14019
14020 /// Sets the value of [status][crate::model::Job::status].
14021 ///
14022 /// # Example
14023 /// ```ignore,no_run
14024 /// # use google_cloud_dataproc_v1::model::Job;
14025 /// use google_cloud_dataproc_v1::model::JobStatus;
14026 /// let x = Job::new().set_status(JobStatus::default()/* use setters */);
14027 /// ```
14028 pub fn set_status<T>(mut self, v: T) -> Self
14029 where
14030 T: std::convert::Into<crate::model::JobStatus>,
14031 {
14032 self.status = std::option::Option::Some(v.into());
14033 self
14034 }
14035
14036 /// Sets or clears the value of [status][crate::model::Job::status].
14037 ///
14038 /// # Example
14039 /// ```ignore,no_run
14040 /// # use google_cloud_dataproc_v1::model::Job;
14041 /// use google_cloud_dataproc_v1::model::JobStatus;
14042 /// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
14043 /// let x = Job::new().set_or_clear_status(None::<JobStatus>);
14044 /// ```
14045 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
14046 where
14047 T: std::convert::Into<crate::model::JobStatus>,
14048 {
14049 self.status = v.map(|x| x.into());
14050 self
14051 }
14052
14053 /// Sets the value of [status_history][crate::model::Job::status_history].
14054 ///
14055 /// # Example
14056 /// ```ignore,no_run
14057 /// # use google_cloud_dataproc_v1::model::Job;
14058 /// use google_cloud_dataproc_v1::model::JobStatus;
14059 /// let x = Job::new()
14060 /// .set_status_history([
14061 /// JobStatus::default()/* use setters */,
14062 /// JobStatus::default()/* use (different) setters */,
14063 /// ]);
14064 /// ```
14065 pub fn set_status_history<T, V>(mut self, v: T) -> Self
14066 where
14067 T: std::iter::IntoIterator<Item = V>,
14068 V: std::convert::Into<crate::model::JobStatus>,
14069 {
14070 use std::iter::Iterator;
14071 self.status_history = v.into_iter().map(|i| i.into()).collect();
14072 self
14073 }
14074
14075 /// Sets the value of [yarn_applications][crate::model::Job::yarn_applications].
14076 ///
14077 /// # Example
14078 /// ```ignore,no_run
14079 /// # use google_cloud_dataproc_v1::model::Job;
14080 /// use google_cloud_dataproc_v1::model::YarnApplication;
14081 /// let x = Job::new()
14082 /// .set_yarn_applications([
14083 /// YarnApplication::default()/* use setters */,
14084 /// YarnApplication::default()/* use (different) setters */,
14085 /// ]);
14086 /// ```
14087 pub fn set_yarn_applications<T, V>(mut self, v: T) -> Self
14088 where
14089 T: std::iter::IntoIterator<Item = V>,
14090 V: std::convert::Into<crate::model::YarnApplication>,
14091 {
14092 use std::iter::Iterator;
14093 self.yarn_applications = v.into_iter().map(|i| i.into()).collect();
14094 self
14095 }
14096
14097 /// Sets the value of [driver_output_resource_uri][crate::model::Job::driver_output_resource_uri].
14098 ///
14099 /// # Example
14100 /// ```ignore,no_run
14101 /// # use google_cloud_dataproc_v1::model::Job;
14102 /// let x = Job::new().set_driver_output_resource_uri("example");
14103 /// ```
14104 pub fn set_driver_output_resource_uri<T: std::convert::Into<std::string::String>>(
14105 mut self,
14106 v: T,
14107 ) -> Self {
14108 self.driver_output_resource_uri = v.into();
14109 self
14110 }
14111
14112 /// Sets the value of [driver_control_files_uri][crate::model::Job::driver_control_files_uri].
14113 ///
14114 /// # Example
14115 /// ```ignore,no_run
14116 /// # use google_cloud_dataproc_v1::model::Job;
14117 /// let x = Job::new().set_driver_control_files_uri("example");
14118 /// ```
14119 pub fn set_driver_control_files_uri<T: std::convert::Into<std::string::String>>(
14120 mut self,
14121 v: T,
14122 ) -> Self {
14123 self.driver_control_files_uri = v.into();
14124 self
14125 }
14126
14127 /// Sets the value of [labels][crate::model::Job::labels].
14128 ///
14129 /// # Example
14130 /// ```ignore,no_run
14131 /// # use google_cloud_dataproc_v1::model::Job;
14132 /// let x = Job::new().set_labels([
14133 /// ("key0", "abc"),
14134 /// ("key1", "xyz"),
14135 /// ]);
14136 /// ```
14137 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14138 where
14139 T: std::iter::IntoIterator<Item = (K, V)>,
14140 K: std::convert::Into<std::string::String>,
14141 V: std::convert::Into<std::string::String>,
14142 {
14143 use std::iter::Iterator;
14144 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14145 self
14146 }
14147
14148 /// Sets the value of [scheduling][crate::model::Job::scheduling].
14149 ///
14150 /// # Example
14151 /// ```ignore,no_run
14152 /// # use google_cloud_dataproc_v1::model::Job;
14153 /// use google_cloud_dataproc_v1::model::JobScheduling;
14154 /// let x = Job::new().set_scheduling(JobScheduling::default()/* use setters */);
14155 /// ```
14156 pub fn set_scheduling<T>(mut self, v: T) -> Self
14157 where
14158 T: std::convert::Into<crate::model::JobScheduling>,
14159 {
14160 self.scheduling = std::option::Option::Some(v.into());
14161 self
14162 }
14163
14164 /// Sets or clears the value of [scheduling][crate::model::Job::scheduling].
14165 ///
14166 /// # Example
14167 /// ```ignore,no_run
14168 /// # use google_cloud_dataproc_v1::model::Job;
14169 /// use google_cloud_dataproc_v1::model::JobScheduling;
14170 /// let x = Job::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
14171 /// let x = Job::new().set_or_clear_scheduling(None::<JobScheduling>);
14172 /// ```
14173 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
14174 where
14175 T: std::convert::Into<crate::model::JobScheduling>,
14176 {
14177 self.scheduling = v.map(|x| x.into());
14178 self
14179 }
14180
14181 /// Sets the value of [job_uuid][crate::model::Job::job_uuid].
14182 ///
14183 /// # Example
14184 /// ```ignore,no_run
14185 /// # use google_cloud_dataproc_v1::model::Job;
14186 /// let x = Job::new().set_job_uuid("example");
14187 /// ```
14188 pub fn set_job_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14189 self.job_uuid = v.into();
14190 self
14191 }
14192
14193 /// Sets the value of [done][crate::model::Job::done].
14194 ///
14195 /// # Example
14196 /// ```ignore,no_run
14197 /// # use google_cloud_dataproc_v1::model::Job;
14198 /// let x = Job::new().set_done(true);
14199 /// ```
14200 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14201 self.done = v.into();
14202 self
14203 }
14204
14205 /// Sets the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14206 ///
14207 /// # Example
14208 /// ```ignore,no_run
14209 /// # use google_cloud_dataproc_v1::model::Job;
14210 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14211 /// let x = Job::new().set_driver_scheduling_config(DriverSchedulingConfig::default()/* use setters */);
14212 /// ```
14213 pub fn set_driver_scheduling_config<T>(mut self, v: T) -> Self
14214 where
14215 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14216 {
14217 self.driver_scheduling_config = std::option::Option::Some(v.into());
14218 self
14219 }
14220
14221 /// Sets or clears the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14222 ///
14223 /// # Example
14224 /// ```ignore,no_run
14225 /// # use google_cloud_dataproc_v1::model::Job;
14226 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14227 /// let x = Job::new().set_or_clear_driver_scheduling_config(Some(DriverSchedulingConfig::default()/* use setters */));
14228 /// let x = Job::new().set_or_clear_driver_scheduling_config(None::<DriverSchedulingConfig>);
14229 /// ```
14230 pub fn set_or_clear_driver_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
14231 where
14232 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14233 {
14234 self.driver_scheduling_config = v.map(|x| x.into());
14235 self
14236 }
14237
14238 /// Sets the value of [type_job][crate::model::Job::type_job].
14239 ///
14240 /// Note that all the setters affecting `type_job` are mutually
14241 /// exclusive.
14242 ///
14243 /// # Example
14244 /// ```ignore,no_run
14245 /// # use google_cloud_dataproc_v1::model::Job;
14246 /// use google_cloud_dataproc_v1::model::HadoopJob;
14247 /// let x = Job::new().set_type_job(Some(
14248 /// google_cloud_dataproc_v1::model::job::TypeJob::HadoopJob(HadoopJob::default().into())));
14249 /// ```
14250 pub fn set_type_job<T: std::convert::Into<std::option::Option<crate::model::job::TypeJob>>>(
14251 mut self,
14252 v: T,
14253 ) -> Self {
14254 self.type_job = v.into();
14255 self
14256 }
14257
14258 /// The value of [type_job][crate::model::Job::type_job]
14259 /// if it holds a `HadoopJob`, `None` if the field is not set or
14260 /// holds a different branch.
14261 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
14262 #[allow(unreachable_patterns)]
14263 self.type_job.as_ref().and_then(|v| match v {
14264 crate::model::job::TypeJob::HadoopJob(v) => std::option::Option::Some(v),
14265 _ => std::option::Option::None,
14266 })
14267 }
14268
14269 /// Sets the value of [type_job][crate::model::Job::type_job]
14270 /// to hold a `HadoopJob`.
14271 ///
14272 /// Note that all the setters affecting `type_job` are
14273 /// mutually exclusive.
14274 ///
14275 /// # Example
14276 /// ```ignore,no_run
14277 /// # use google_cloud_dataproc_v1::model::Job;
14278 /// use google_cloud_dataproc_v1::model::HadoopJob;
14279 /// let x = Job::new().set_hadoop_job(HadoopJob::default()/* use setters */);
14280 /// assert!(x.hadoop_job().is_some());
14281 /// assert!(x.spark_job().is_none());
14282 /// assert!(x.pyspark_job().is_none());
14283 /// assert!(x.hive_job().is_none());
14284 /// assert!(x.pig_job().is_none());
14285 /// assert!(x.spark_r_job().is_none());
14286 /// assert!(x.spark_sql_job().is_none());
14287 /// assert!(x.presto_job().is_none());
14288 /// assert!(x.trino_job().is_none());
14289 /// assert!(x.flink_job().is_none());
14290 /// ```
14291 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
14292 mut self,
14293 v: T,
14294 ) -> Self {
14295 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HadoopJob(v.into()));
14296 self
14297 }
14298
14299 /// The value of [type_job][crate::model::Job::type_job]
14300 /// if it holds a `SparkJob`, `None` if the field is not set or
14301 /// holds a different branch.
14302 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
14303 #[allow(unreachable_patterns)]
14304 self.type_job.as_ref().and_then(|v| match v {
14305 crate::model::job::TypeJob::SparkJob(v) => std::option::Option::Some(v),
14306 _ => std::option::Option::None,
14307 })
14308 }
14309
14310 /// Sets the value of [type_job][crate::model::Job::type_job]
14311 /// to hold a `SparkJob`.
14312 ///
14313 /// Note that all the setters affecting `type_job` are
14314 /// mutually exclusive.
14315 ///
14316 /// # Example
14317 /// ```ignore,no_run
14318 /// # use google_cloud_dataproc_v1::model::Job;
14319 /// use google_cloud_dataproc_v1::model::SparkJob;
14320 /// let x = Job::new().set_spark_job(SparkJob::default()/* use setters */);
14321 /// assert!(x.spark_job().is_some());
14322 /// assert!(x.hadoop_job().is_none());
14323 /// assert!(x.pyspark_job().is_none());
14324 /// assert!(x.hive_job().is_none());
14325 /// assert!(x.pig_job().is_none());
14326 /// assert!(x.spark_r_job().is_none());
14327 /// assert!(x.spark_sql_job().is_none());
14328 /// assert!(x.presto_job().is_none());
14329 /// assert!(x.trino_job().is_none());
14330 /// assert!(x.flink_job().is_none());
14331 /// ```
14332 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
14333 mut self,
14334 v: T,
14335 ) -> Self {
14336 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkJob(v.into()));
14337 self
14338 }
14339
14340 /// The value of [type_job][crate::model::Job::type_job]
14341 /// if it holds a `PysparkJob`, `None` if the field is not set or
14342 /// holds a different branch.
14343 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
14344 #[allow(unreachable_patterns)]
14345 self.type_job.as_ref().and_then(|v| match v {
14346 crate::model::job::TypeJob::PysparkJob(v) => std::option::Option::Some(v),
14347 _ => std::option::Option::None,
14348 })
14349 }
14350
14351 /// Sets the value of [type_job][crate::model::Job::type_job]
14352 /// to hold a `PysparkJob`.
14353 ///
14354 /// Note that all the setters affecting `type_job` are
14355 /// mutually exclusive.
14356 ///
14357 /// # Example
14358 /// ```ignore,no_run
14359 /// # use google_cloud_dataproc_v1::model::Job;
14360 /// use google_cloud_dataproc_v1::model::PySparkJob;
14361 /// let x = Job::new().set_pyspark_job(PySparkJob::default()/* use setters */);
14362 /// assert!(x.pyspark_job().is_some());
14363 /// assert!(x.hadoop_job().is_none());
14364 /// assert!(x.spark_job().is_none());
14365 /// assert!(x.hive_job().is_none());
14366 /// assert!(x.pig_job().is_none());
14367 /// assert!(x.spark_r_job().is_none());
14368 /// assert!(x.spark_sql_job().is_none());
14369 /// assert!(x.presto_job().is_none());
14370 /// assert!(x.trino_job().is_none());
14371 /// assert!(x.flink_job().is_none());
14372 /// ```
14373 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
14374 mut self,
14375 v: T,
14376 ) -> Self {
14377 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PysparkJob(v.into()));
14378 self
14379 }
14380
14381 /// The value of [type_job][crate::model::Job::type_job]
14382 /// if it holds a `HiveJob`, `None` if the field is not set or
14383 /// holds a different branch.
14384 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
14385 #[allow(unreachable_patterns)]
14386 self.type_job.as_ref().and_then(|v| match v {
14387 crate::model::job::TypeJob::HiveJob(v) => std::option::Option::Some(v),
14388 _ => std::option::Option::None,
14389 })
14390 }
14391
14392 /// Sets the value of [type_job][crate::model::Job::type_job]
14393 /// to hold a `HiveJob`.
14394 ///
14395 /// Note that all the setters affecting `type_job` are
14396 /// mutually exclusive.
14397 ///
14398 /// # Example
14399 /// ```ignore,no_run
14400 /// # use google_cloud_dataproc_v1::model::Job;
14401 /// use google_cloud_dataproc_v1::model::HiveJob;
14402 /// let x = Job::new().set_hive_job(HiveJob::default()/* use setters */);
14403 /// assert!(x.hive_job().is_some());
14404 /// assert!(x.hadoop_job().is_none());
14405 /// assert!(x.spark_job().is_none());
14406 /// assert!(x.pyspark_job().is_none());
14407 /// assert!(x.pig_job().is_none());
14408 /// assert!(x.spark_r_job().is_none());
14409 /// assert!(x.spark_sql_job().is_none());
14410 /// assert!(x.presto_job().is_none());
14411 /// assert!(x.trino_job().is_none());
14412 /// assert!(x.flink_job().is_none());
14413 /// ```
14414 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
14415 mut self,
14416 v: T,
14417 ) -> Self {
14418 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HiveJob(v.into()));
14419 self
14420 }
14421
14422 /// The value of [type_job][crate::model::Job::type_job]
14423 /// if it holds a `PigJob`, `None` if the field is not set or
14424 /// holds a different branch.
14425 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
14426 #[allow(unreachable_patterns)]
14427 self.type_job.as_ref().and_then(|v| match v {
14428 crate::model::job::TypeJob::PigJob(v) => std::option::Option::Some(v),
14429 _ => std::option::Option::None,
14430 })
14431 }
14432
14433 /// Sets the value of [type_job][crate::model::Job::type_job]
14434 /// to hold a `PigJob`.
14435 ///
14436 /// Note that all the setters affecting `type_job` are
14437 /// mutually exclusive.
14438 ///
14439 /// # Example
14440 /// ```ignore,no_run
14441 /// # use google_cloud_dataproc_v1::model::Job;
14442 /// use google_cloud_dataproc_v1::model::PigJob;
14443 /// let x = Job::new().set_pig_job(PigJob::default()/* use setters */);
14444 /// assert!(x.pig_job().is_some());
14445 /// assert!(x.hadoop_job().is_none());
14446 /// assert!(x.spark_job().is_none());
14447 /// assert!(x.pyspark_job().is_none());
14448 /// assert!(x.hive_job().is_none());
14449 /// assert!(x.spark_r_job().is_none());
14450 /// assert!(x.spark_sql_job().is_none());
14451 /// assert!(x.presto_job().is_none());
14452 /// assert!(x.trino_job().is_none());
14453 /// assert!(x.flink_job().is_none());
14454 /// ```
14455 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
14456 mut self,
14457 v: T,
14458 ) -> Self {
14459 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PigJob(v.into()));
14460 self
14461 }
14462
14463 /// The value of [type_job][crate::model::Job::type_job]
14464 /// if it holds a `SparkRJob`, `None` if the field is not set or
14465 /// holds a different branch.
14466 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
14467 #[allow(unreachable_patterns)]
14468 self.type_job.as_ref().and_then(|v| match v {
14469 crate::model::job::TypeJob::SparkRJob(v) => std::option::Option::Some(v),
14470 _ => std::option::Option::None,
14471 })
14472 }
14473
14474 /// Sets the value of [type_job][crate::model::Job::type_job]
14475 /// to hold a `SparkRJob`.
14476 ///
14477 /// Note that all the setters affecting `type_job` are
14478 /// mutually exclusive.
14479 ///
14480 /// # Example
14481 /// ```ignore,no_run
14482 /// # use google_cloud_dataproc_v1::model::Job;
14483 /// use google_cloud_dataproc_v1::model::SparkRJob;
14484 /// let x = Job::new().set_spark_r_job(SparkRJob::default()/* use setters */);
14485 /// assert!(x.spark_r_job().is_some());
14486 /// assert!(x.hadoop_job().is_none());
14487 /// assert!(x.spark_job().is_none());
14488 /// assert!(x.pyspark_job().is_none());
14489 /// assert!(x.hive_job().is_none());
14490 /// assert!(x.pig_job().is_none());
14491 /// assert!(x.spark_sql_job().is_none());
14492 /// assert!(x.presto_job().is_none());
14493 /// assert!(x.trino_job().is_none());
14494 /// assert!(x.flink_job().is_none());
14495 /// ```
14496 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
14497 mut self,
14498 v: T,
14499 ) -> Self {
14500 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkRJob(v.into()));
14501 self
14502 }
14503
14504 /// The value of [type_job][crate::model::Job::type_job]
14505 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
14506 /// holds a different branch.
14507 pub fn spark_sql_job(
14508 &self,
14509 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
14510 #[allow(unreachable_patterns)]
14511 self.type_job.as_ref().and_then(|v| match v {
14512 crate::model::job::TypeJob::SparkSqlJob(v) => std::option::Option::Some(v),
14513 _ => std::option::Option::None,
14514 })
14515 }
14516
14517 /// Sets the value of [type_job][crate::model::Job::type_job]
14518 /// to hold a `SparkSqlJob`.
14519 ///
14520 /// Note that all the setters affecting `type_job` are
14521 /// mutually exclusive.
14522 ///
14523 /// # Example
14524 /// ```ignore,no_run
14525 /// # use google_cloud_dataproc_v1::model::Job;
14526 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
14527 /// let x = Job::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
14528 /// assert!(x.spark_sql_job().is_some());
14529 /// assert!(x.hadoop_job().is_none());
14530 /// assert!(x.spark_job().is_none());
14531 /// assert!(x.pyspark_job().is_none());
14532 /// assert!(x.hive_job().is_none());
14533 /// assert!(x.pig_job().is_none());
14534 /// assert!(x.spark_r_job().is_none());
14535 /// assert!(x.presto_job().is_none());
14536 /// assert!(x.trino_job().is_none());
14537 /// assert!(x.flink_job().is_none());
14538 /// ```
14539 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
14540 mut self,
14541 v: T,
14542 ) -> Self {
14543 self.type_job =
14544 std::option::Option::Some(crate::model::job::TypeJob::SparkSqlJob(v.into()));
14545 self
14546 }
14547
14548 /// The value of [type_job][crate::model::Job::type_job]
14549 /// if it holds a `PrestoJob`, `None` if the field is not set or
14550 /// holds a different branch.
14551 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
14552 #[allow(unreachable_patterns)]
14553 self.type_job.as_ref().and_then(|v| match v {
14554 crate::model::job::TypeJob::PrestoJob(v) => std::option::Option::Some(v),
14555 _ => std::option::Option::None,
14556 })
14557 }
14558
14559 /// Sets the value of [type_job][crate::model::Job::type_job]
14560 /// to hold a `PrestoJob`.
14561 ///
14562 /// Note that all the setters affecting `type_job` are
14563 /// mutually exclusive.
14564 ///
14565 /// # Example
14566 /// ```ignore,no_run
14567 /// # use google_cloud_dataproc_v1::model::Job;
14568 /// use google_cloud_dataproc_v1::model::PrestoJob;
14569 /// let x = Job::new().set_presto_job(PrestoJob::default()/* use setters */);
14570 /// assert!(x.presto_job().is_some());
14571 /// assert!(x.hadoop_job().is_none());
14572 /// assert!(x.spark_job().is_none());
14573 /// assert!(x.pyspark_job().is_none());
14574 /// assert!(x.hive_job().is_none());
14575 /// assert!(x.pig_job().is_none());
14576 /// assert!(x.spark_r_job().is_none());
14577 /// assert!(x.spark_sql_job().is_none());
14578 /// assert!(x.trino_job().is_none());
14579 /// assert!(x.flink_job().is_none());
14580 /// ```
14581 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
14582 mut self,
14583 v: T,
14584 ) -> Self {
14585 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PrestoJob(v.into()));
14586 self
14587 }
14588
14589 /// The value of [type_job][crate::model::Job::type_job]
14590 /// if it holds a `TrinoJob`, `None` if the field is not set or
14591 /// holds a different branch.
14592 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
14593 #[allow(unreachable_patterns)]
14594 self.type_job.as_ref().and_then(|v| match v {
14595 crate::model::job::TypeJob::TrinoJob(v) => std::option::Option::Some(v),
14596 _ => std::option::Option::None,
14597 })
14598 }
14599
14600 /// Sets the value of [type_job][crate::model::Job::type_job]
14601 /// to hold a `TrinoJob`.
14602 ///
14603 /// Note that all the setters affecting `type_job` are
14604 /// mutually exclusive.
14605 ///
14606 /// # Example
14607 /// ```ignore,no_run
14608 /// # use google_cloud_dataproc_v1::model::Job;
14609 /// use google_cloud_dataproc_v1::model::TrinoJob;
14610 /// let x = Job::new().set_trino_job(TrinoJob::default()/* use setters */);
14611 /// assert!(x.trino_job().is_some());
14612 /// assert!(x.hadoop_job().is_none());
14613 /// assert!(x.spark_job().is_none());
14614 /// assert!(x.pyspark_job().is_none());
14615 /// assert!(x.hive_job().is_none());
14616 /// assert!(x.pig_job().is_none());
14617 /// assert!(x.spark_r_job().is_none());
14618 /// assert!(x.spark_sql_job().is_none());
14619 /// assert!(x.presto_job().is_none());
14620 /// assert!(x.flink_job().is_none());
14621 /// ```
14622 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
14623 mut self,
14624 v: T,
14625 ) -> Self {
14626 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::TrinoJob(v.into()));
14627 self
14628 }
14629
14630 /// The value of [type_job][crate::model::Job::type_job]
14631 /// if it holds a `FlinkJob`, `None` if the field is not set or
14632 /// holds a different branch.
14633 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
14634 #[allow(unreachable_patterns)]
14635 self.type_job.as_ref().and_then(|v| match v {
14636 crate::model::job::TypeJob::FlinkJob(v) => std::option::Option::Some(v),
14637 _ => std::option::Option::None,
14638 })
14639 }
14640
14641 /// Sets the value of [type_job][crate::model::Job::type_job]
14642 /// to hold a `FlinkJob`.
14643 ///
14644 /// Note that all the setters affecting `type_job` are
14645 /// mutually exclusive.
14646 ///
14647 /// # Example
14648 /// ```ignore,no_run
14649 /// # use google_cloud_dataproc_v1::model::Job;
14650 /// use google_cloud_dataproc_v1::model::FlinkJob;
14651 /// let x = Job::new().set_flink_job(FlinkJob::default()/* use setters */);
14652 /// assert!(x.flink_job().is_some());
14653 /// assert!(x.hadoop_job().is_none());
14654 /// assert!(x.spark_job().is_none());
14655 /// assert!(x.pyspark_job().is_none());
14656 /// assert!(x.hive_job().is_none());
14657 /// assert!(x.pig_job().is_none());
14658 /// assert!(x.spark_r_job().is_none());
14659 /// assert!(x.spark_sql_job().is_none());
14660 /// assert!(x.presto_job().is_none());
14661 /// assert!(x.trino_job().is_none());
14662 /// ```
14663 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
14664 mut self,
14665 v: T,
14666 ) -> Self {
14667 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::FlinkJob(v.into()));
14668 self
14669 }
14670}
14671
14672impl wkt::message::Message for Job {
14673 fn typename() -> &'static str {
14674 "type.googleapis.com/google.cloud.dataproc.v1.Job"
14675 }
14676}
14677
14678/// Defines additional types related to [Job].
14679pub mod job {
14680 #[allow(unused_imports)]
14681 use super::*;
14682
14683 /// Required. The application/framework-specific portion of the job.
14684 #[derive(Clone, Debug, PartialEq)]
14685 #[non_exhaustive]
14686 pub enum TypeJob {
14687 /// Optional. Job is a Hadoop job.
14688 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
14689 /// Optional. Job is a Spark job.
14690 SparkJob(std::boxed::Box<crate::model::SparkJob>),
14691 /// Optional. Job is a PySpark job.
14692 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
14693 /// Optional. Job is a Hive job.
14694 HiveJob(std::boxed::Box<crate::model::HiveJob>),
14695 /// Optional. Job is a Pig job.
14696 PigJob(std::boxed::Box<crate::model::PigJob>),
14697 /// Optional. Job is a SparkR job.
14698 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
14699 /// Optional. Job is a SparkSql job.
14700 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
14701 /// Optional. Job is a Presto job.
14702 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
14703 /// Optional. Job is a Trino job.
14704 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
14705 /// Optional. Job is a Flink job.
14706 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
14707 }
14708}
14709
14710/// Driver scheduling configuration.
14711#[derive(Clone, Default, PartialEq)]
14712#[non_exhaustive]
14713pub struct DriverSchedulingConfig {
14714 /// Required. The amount of memory in MB the driver is requesting.
14715 pub memory_mb: i32,
14716
14717 /// Required. The number of vCPUs the driver is requesting.
14718 pub vcores: i32,
14719
14720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14721}
14722
14723impl DriverSchedulingConfig {
14724 pub fn new() -> Self {
14725 std::default::Default::default()
14726 }
14727
14728 /// Sets the value of [memory_mb][crate::model::DriverSchedulingConfig::memory_mb].
14729 ///
14730 /// # Example
14731 /// ```ignore,no_run
14732 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14733 /// let x = DriverSchedulingConfig::new().set_memory_mb(42);
14734 /// ```
14735 pub fn set_memory_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14736 self.memory_mb = v.into();
14737 self
14738 }
14739
14740 /// Sets the value of [vcores][crate::model::DriverSchedulingConfig::vcores].
14741 ///
14742 /// # Example
14743 /// ```ignore,no_run
14744 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14745 /// let x = DriverSchedulingConfig::new().set_vcores(42);
14746 /// ```
14747 pub fn set_vcores<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14748 self.vcores = v.into();
14749 self
14750 }
14751}
14752
14753impl wkt::message::Message for DriverSchedulingConfig {
14754 fn typename() -> &'static str {
14755 "type.googleapis.com/google.cloud.dataproc.v1.DriverSchedulingConfig"
14756 }
14757}
14758
14759/// Job scheduling options.
14760#[derive(Clone, Default, PartialEq)]
14761#[non_exhaustive]
14762pub struct JobScheduling {
14763 /// Optional. Maximum number of times per hour a driver can be restarted as
14764 /// a result of driver exiting with non-zero code before job is
14765 /// reported failed.
14766 ///
14767 /// A job might be reported as thrashing if the driver exits with a non-zero
14768 /// code four times within a 10-minute window.
14769 ///
14770 /// Maximum value is 10.
14771 ///
14772 /// **Note:** This restartable job option is not supported in Dataproc
14773 /// [workflow templates]
14774 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template>).
14775 pub max_failures_per_hour: i32,
14776
14777 /// Optional. Maximum total number of times a driver can be restarted as a
14778 /// result of the driver exiting with a non-zero code. After the maximum number
14779 /// is reached, the job will be reported as failed.
14780 ///
14781 /// Maximum value is 240.
14782 ///
14783 /// **Note:** Currently, this restartable job option is
14784 /// not supported in Dataproc
14785 /// [workflow
14786 /// templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
14787 pub max_failures_total: i32,
14788
14789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14790}
14791
14792impl JobScheduling {
14793 pub fn new() -> Self {
14794 std::default::Default::default()
14795 }
14796
14797 /// Sets the value of [max_failures_per_hour][crate::model::JobScheduling::max_failures_per_hour].
14798 ///
14799 /// # Example
14800 /// ```ignore,no_run
14801 /// # use google_cloud_dataproc_v1::model::JobScheduling;
14802 /// let x = JobScheduling::new().set_max_failures_per_hour(42);
14803 /// ```
14804 pub fn set_max_failures_per_hour<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14805 self.max_failures_per_hour = v.into();
14806 self
14807 }
14808
14809 /// Sets the value of [max_failures_total][crate::model::JobScheduling::max_failures_total].
14810 ///
14811 /// # Example
14812 /// ```ignore,no_run
14813 /// # use google_cloud_dataproc_v1::model::JobScheduling;
14814 /// let x = JobScheduling::new().set_max_failures_total(42);
14815 /// ```
14816 pub fn set_max_failures_total<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14817 self.max_failures_total = v.into();
14818 self
14819 }
14820}
14821
14822impl wkt::message::Message for JobScheduling {
14823 fn typename() -> &'static str {
14824 "type.googleapis.com/google.cloud.dataproc.v1.JobScheduling"
14825 }
14826}
14827
14828/// A request to submit a job.
14829#[derive(Clone, Default, PartialEq)]
14830#[non_exhaustive]
14831pub struct SubmitJobRequest {
14832 /// Required. The ID of the Google Cloud Platform project that the job
14833 /// belongs to.
14834 pub project_id: std::string::String,
14835
14836 /// Required. The Dataproc region in which to handle the request.
14837 pub region: std::string::String,
14838
14839 /// Required. The job resource.
14840 pub job: std::option::Option<crate::model::Job>,
14841
14842 /// Optional. A unique id used to identify the request. If the server
14843 /// receives two
14844 /// [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
14845 /// with the same id, then the second request will be ignored and the
14846 /// first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend
14847 /// is returned.
14848 ///
14849 /// It is recommended to always set this value to a
14850 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
14851 ///
14852 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
14853 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
14854 ///
14855 /// [google.cloud.dataproc.v1.Job]: crate::model::Job
14856 pub request_id: std::string::String,
14857
14858 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14859}
14860
14861impl SubmitJobRequest {
14862 pub fn new() -> Self {
14863 std::default::Default::default()
14864 }
14865
14866 /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
14867 ///
14868 /// # Example
14869 /// ```ignore,no_run
14870 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14871 /// let x = SubmitJobRequest::new().set_project_id("example");
14872 /// ```
14873 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14874 self.project_id = v.into();
14875 self
14876 }
14877
14878 /// Sets the value of [region][crate::model::SubmitJobRequest::region].
14879 ///
14880 /// # Example
14881 /// ```ignore,no_run
14882 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14883 /// let x = SubmitJobRequest::new().set_region("example");
14884 /// ```
14885 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14886 self.region = v.into();
14887 self
14888 }
14889
14890 /// Sets the value of [job][crate::model::SubmitJobRequest::job].
14891 ///
14892 /// # Example
14893 /// ```ignore,no_run
14894 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14895 /// use google_cloud_dataproc_v1::model::Job;
14896 /// let x = SubmitJobRequest::new().set_job(Job::default()/* use setters */);
14897 /// ```
14898 pub fn set_job<T>(mut self, v: T) -> Self
14899 where
14900 T: std::convert::Into<crate::model::Job>,
14901 {
14902 self.job = std::option::Option::Some(v.into());
14903 self
14904 }
14905
14906 /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
14907 ///
14908 /// # Example
14909 /// ```ignore,no_run
14910 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14911 /// use google_cloud_dataproc_v1::model::Job;
14912 /// let x = SubmitJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
14913 /// let x = SubmitJobRequest::new().set_or_clear_job(None::<Job>);
14914 /// ```
14915 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
14916 where
14917 T: std::convert::Into<crate::model::Job>,
14918 {
14919 self.job = v.map(|x| x.into());
14920 self
14921 }
14922
14923 /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
14924 ///
14925 /// # Example
14926 /// ```ignore,no_run
14927 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14928 /// let x = SubmitJobRequest::new().set_request_id("example");
14929 /// ```
14930 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14931 self.request_id = v.into();
14932 self
14933 }
14934}
14935
14936impl wkt::message::Message for SubmitJobRequest {
14937 fn typename() -> &'static str {
14938 "type.googleapis.com/google.cloud.dataproc.v1.SubmitJobRequest"
14939 }
14940}
14941
14942/// Job Operation metadata.
14943#[derive(Clone, Default, PartialEq)]
14944#[non_exhaustive]
14945pub struct JobMetadata {
14946 /// Output only. The job id.
14947 pub job_id: std::string::String,
14948
14949 /// Output only. Most recent job status.
14950 pub status: std::option::Option<crate::model::JobStatus>,
14951
14952 /// Output only. Operation type.
14953 pub operation_type: std::string::String,
14954
14955 /// Output only. Job submission time.
14956 pub start_time: std::option::Option<wkt::Timestamp>,
14957
14958 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14959}
14960
14961impl JobMetadata {
14962 pub fn new() -> Self {
14963 std::default::Default::default()
14964 }
14965
14966 /// Sets the value of [job_id][crate::model::JobMetadata::job_id].
14967 ///
14968 /// # Example
14969 /// ```ignore,no_run
14970 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14971 /// let x = JobMetadata::new().set_job_id("example");
14972 /// ```
14973 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14974 self.job_id = v.into();
14975 self
14976 }
14977
14978 /// Sets the value of [status][crate::model::JobMetadata::status].
14979 ///
14980 /// # Example
14981 /// ```ignore,no_run
14982 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14983 /// use google_cloud_dataproc_v1::model::JobStatus;
14984 /// let x = JobMetadata::new().set_status(JobStatus::default()/* use setters */);
14985 /// ```
14986 pub fn set_status<T>(mut self, v: T) -> Self
14987 where
14988 T: std::convert::Into<crate::model::JobStatus>,
14989 {
14990 self.status = std::option::Option::Some(v.into());
14991 self
14992 }
14993
14994 /// Sets or clears the value of [status][crate::model::JobMetadata::status].
14995 ///
14996 /// # Example
14997 /// ```ignore,no_run
14998 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14999 /// use google_cloud_dataproc_v1::model::JobStatus;
15000 /// let x = JobMetadata::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
15001 /// let x = JobMetadata::new().set_or_clear_status(None::<JobStatus>);
15002 /// ```
15003 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
15004 where
15005 T: std::convert::Into<crate::model::JobStatus>,
15006 {
15007 self.status = v.map(|x| x.into());
15008 self
15009 }
15010
15011 /// Sets the value of [operation_type][crate::model::JobMetadata::operation_type].
15012 ///
15013 /// # Example
15014 /// ```ignore,no_run
15015 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15016 /// let x = JobMetadata::new().set_operation_type("example");
15017 /// ```
15018 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15019 self.operation_type = v.into();
15020 self
15021 }
15022
15023 /// Sets the value of [start_time][crate::model::JobMetadata::start_time].
15024 ///
15025 /// # Example
15026 /// ```ignore,no_run
15027 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15028 /// use wkt::Timestamp;
15029 /// let x = JobMetadata::new().set_start_time(Timestamp::default()/* use setters */);
15030 /// ```
15031 pub fn set_start_time<T>(mut self, v: T) -> Self
15032 where
15033 T: std::convert::Into<wkt::Timestamp>,
15034 {
15035 self.start_time = std::option::Option::Some(v.into());
15036 self
15037 }
15038
15039 /// Sets or clears the value of [start_time][crate::model::JobMetadata::start_time].
15040 ///
15041 /// # Example
15042 /// ```ignore,no_run
15043 /// # use google_cloud_dataproc_v1::model::JobMetadata;
15044 /// use wkt::Timestamp;
15045 /// let x = JobMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
15046 /// let x = JobMetadata::new().set_or_clear_start_time(None::<Timestamp>);
15047 /// ```
15048 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
15049 where
15050 T: std::convert::Into<wkt::Timestamp>,
15051 {
15052 self.start_time = v.map(|x| x.into());
15053 self
15054 }
15055}
15056
15057impl wkt::message::Message for JobMetadata {
15058 fn typename() -> &'static str {
15059 "type.googleapis.com/google.cloud.dataproc.v1.JobMetadata"
15060 }
15061}
15062
15063/// A request to get the resource representation for a job in a project.
15064#[derive(Clone, Default, PartialEq)]
15065#[non_exhaustive]
15066pub struct GetJobRequest {
15067 /// Required. The ID of the Google Cloud Platform project that the job
15068 /// belongs to.
15069 pub project_id: std::string::String,
15070
15071 /// Required. The Dataproc region in which to handle the request.
15072 pub region: std::string::String,
15073
15074 /// Required. The job ID.
15075 pub job_id: std::string::String,
15076
15077 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15078}
15079
15080impl GetJobRequest {
15081 pub fn new() -> Self {
15082 std::default::Default::default()
15083 }
15084
15085 /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
15086 ///
15087 /// # Example
15088 /// ```ignore,no_run
15089 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15090 /// let x = GetJobRequest::new().set_project_id("example");
15091 /// ```
15092 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15093 self.project_id = v.into();
15094 self
15095 }
15096
15097 /// Sets the value of [region][crate::model::GetJobRequest::region].
15098 ///
15099 /// # Example
15100 /// ```ignore,no_run
15101 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15102 /// let x = GetJobRequest::new().set_region("example");
15103 /// ```
15104 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15105 self.region = v.into();
15106 self
15107 }
15108
15109 /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
15110 ///
15111 /// # Example
15112 /// ```ignore,no_run
15113 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15114 /// let x = GetJobRequest::new().set_job_id("example");
15115 /// ```
15116 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15117 self.job_id = v.into();
15118 self
15119 }
15120}
15121
15122impl wkt::message::Message for GetJobRequest {
15123 fn typename() -> &'static str {
15124 "type.googleapis.com/google.cloud.dataproc.v1.GetJobRequest"
15125 }
15126}
15127
15128/// A request to list jobs in a project.
15129#[derive(Clone, Default, PartialEq)]
15130#[non_exhaustive]
15131pub struct ListJobsRequest {
15132 /// Required. The ID of the Google Cloud Platform project that the job
15133 /// belongs to.
15134 pub project_id: std::string::String,
15135
15136 /// Required. The Dataproc region in which to handle the request.
15137 pub region: std::string::String,
15138
15139 /// Optional. The number of results to return in each response.
15140 pub page_size: i32,
15141
15142 /// Optional. The page token, returned by a previous call, to request the
15143 /// next page of results.
15144 pub page_token: std::string::String,
15145
15146 /// Optional. If set, the returned jobs list includes only jobs that were
15147 /// submitted to the named cluster.
15148 pub cluster_name: std::string::String,
15149
15150 /// Optional. Specifies enumerated categories of jobs to list.
15151 /// (default = match ALL jobs).
15152 ///
15153 /// If `filter` is provided, `jobStateMatcher` will be ignored.
15154 pub job_state_matcher: crate::model::list_jobs_request::JobStateMatcher,
15155
15156 /// Optional. A filter constraining the jobs to list. Filters are
15157 /// case-sensitive and have the following syntax:
15158 ///
15159 /// [field = value] AND [field [= value]] ...
15160 ///
15161 /// where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
15162 /// key. **value** can be `*` to match all values.
15163 /// `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
15164 /// Only the logical `AND` operator is supported; space-separated items are
15165 /// treated as having an implicit `AND` operator.
15166 ///
15167 /// Example filter:
15168 ///
15169 /// status.state = ACTIVE AND labels.env = staging AND labels.starred = *
15170 pub filter: std::string::String,
15171
15172 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15173}
15174
15175impl ListJobsRequest {
15176 pub fn new() -> Self {
15177 std::default::Default::default()
15178 }
15179
15180 /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
15181 ///
15182 /// # Example
15183 /// ```ignore,no_run
15184 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15185 /// let x = ListJobsRequest::new().set_project_id("example");
15186 /// ```
15187 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15188 self.project_id = v.into();
15189 self
15190 }
15191
15192 /// Sets the value of [region][crate::model::ListJobsRequest::region].
15193 ///
15194 /// # Example
15195 /// ```ignore,no_run
15196 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15197 /// let x = ListJobsRequest::new().set_region("example");
15198 /// ```
15199 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15200 self.region = v.into();
15201 self
15202 }
15203
15204 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
15205 ///
15206 /// # Example
15207 /// ```ignore,no_run
15208 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15209 /// let x = ListJobsRequest::new().set_page_size(42);
15210 /// ```
15211 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15212 self.page_size = v.into();
15213 self
15214 }
15215
15216 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
15217 ///
15218 /// # Example
15219 /// ```ignore,no_run
15220 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15221 /// let x = ListJobsRequest::new().set_page_token("example");
15222 /// ```
15223 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15224 self.page_token = v.into();
15225 self
15226 }
15227
15228 /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
15229 ///
15230 /// # Example
15231 /// ```ignore,no_run
15232 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15233 /// let x = ListJobsRequest::new().set_cluster_name("example");
15234 /// ```
15235 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15236 self.cluster_name = v.into();
15237 self
15238 }
15239
15240 /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
15241 ///
15242 /// # Example
15243 /// ```ignore,no_run
15244 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15245 /// use google_cloud_dataproc_v1::model::list_jobs_request::JobStateMatcher;
15246 /// let x0 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::Active);
15247 /// let x1 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::NonActive);
15248 /// ```
15249 pub fn set_job_state_matcher<
15250 T: std::convert::Into<crate::model::list_jobs_request::JobStateMatcher>,
15251 >(
15252 mut self,
15253 v: T,
15254 ) -> Self {
15255 self.job_state_matcher = v.into();
15256 self
15257 }
15258
15259 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
15260 ///
15261 /// # Example
15262 /// ```ignore,no_run
15263 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15264 /// let x = ListJobsRequest::new().set_filter("example");
15265 /// ```
15266 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15267 self.filter = v.into();
15268 self
15269 }
15270}
15271
15272impl wkt::message::Message for ListJobsRequest {
15273 fn typename() -> &'static str {
15274 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsRequest"
15275 }
15276}
15277
15278/// Defines additional types related to [ListJobsRequest].
15279pub mod list_jobs_request {
15280 #[allow(unused_imports)]
15281 use super::*;
15282
15283 /// A matcher that specifies categories of job states.
15284 ///
15285 /// # Working with unknown values
15286 ///
15287 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15288 /// additional enum variants at any time. Adding new variants is not considered
15289 /// a breaking change. Applications should write their code in anticipation of:
15290 ///
15291 /// - New values appearing in future releases of the client library, **and**
15292 /// - New values received dynamically, without application changes.
15293 ///
15294 /// Please consult the [Working with enums] section in the user guide for some
15295 /// guidelines.
15296 ///
15297 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15298 #[derive(Clone, Debug, PartialEq)]
15299 #[non_exhaustive]
15300 pub enum JobStateMatcher {
15301 /// Match all jobs, regardless of state.
15302 All,
15303 /// Only match jobs in non-terminal states: PENDING, RUNNING, or
15304 /// CANCEL_PENDING.
15305 Active,
15306 /// Only match jobs in terminal states: CANCELLED, DONE, or ERROR.
15307 NonActive,
15308 /// If set, the enum was initialized with an unknown value.
15309 ///
15310 /// Applications can examine the value using [JobStateMatcher::value] or
15311 /// [JobStateMatcher::name].
15312 UnknownValue(job_state_matcher::UnknownValue),
15313 }
15314
15315 #[doc(hidden)]
15316 pub mod job_state_matcher {
15317 #[allow(unused_imports)]
15318 use super::*;
15319 #[derive(Clone, Debug, PartialEq)]
15320 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15321 }
15322
15323 impl JobStateMatcher {
15324 /// Gets the enum value.
15325 ///
15326 /// Returns `None` if the enum contains an unknown value deserialized from
15327 /// the string representation of enums.
15328 pub fn value(&self) -> std::option::Option<i32> {
15329 match self {
15330 Self::All => std::option::Option::Some(0),
15331 Self::Active => std::option::Option::Some(1),
15332 Self::NonActive => std::option::Option::Some(2),
15333 Self::UnknownValue(u) => u.0.value(),
15334 }
15335 }
15336
15337 /// Gets the enum value as a string.
15338 ///
15339 /// Returns `None` if the enum contains an unknown value deserialized from
15340 /// the integer representation of enums.
15341 pub fn name(&self) -> std::option::Option<&str> {
15342 match self {
15343 Self::All => std::option::Option::Some("ALL"),
15344 Self::Active => std::option::Option::Some("ACTIVE"),
15345 Self::NonActive => std::option::Option::Some("NON_ACTIVE"),
15346 Self::UnknownValue(u) => u.0.name(),
15347 }
15348 }
15349 }
15350
15351 impl std::default::Default for JobStateMatcher {
15352 fn default() -> Self {
15353 use std::convert::From;
15354 Self::from(0)
15355 }
15356 }
15357
15358 impl std::fmt::Display for JobStateMatcher {
15359 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15360 wkt::internal::display_enum(f, self.name(), self.value())
15361 }
15362 }
15363
15364 impl std::convert::From<i32> for JobStateMatcher {
15365 fn from(value: i32) -> Self {
15366 match value {
15367 0 => Self::All,
15368 1 => Self::Active,
15369 2 => Self::NonActive,
15370 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15371 wkt::internal::UnknownEnumValue::Integer(value),
15372 )),
15373 }
15374 }
15375 }
15376
15377 impl std::convert::From<&str> for JobStateMatcher {
15378 fn from(value: &str) -> Self {
15379 use std::string::ToString;
15380 match value {
15381 "ALL" => Self::All,
15382 "ACTIVE" => Self::Active,
15383 "NON_ACTIVE" => Self::NonActive,
15384 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15385 wkt::internal::UnknownEnumValue::String(value.to_string()),
15386 )),
15387 }
15388 }
15389 }
15390
15391 impl serde::ser::Serialize for JobStateMatcher {
15392 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15393 where
15394 S: serde::Serializer,
15395 {
15396 match self {
15397 Self::All => serializer.serialize_i32(0),
15398 Self::Active => serializer.serialize_i32(1),
15399 Self::NonActive => serializer.serialize_i32(2),
15400 Self::UnknownValue(u) => u.0.serialize(serializer),
15401 }
15402 }
15403 }
15404
15405 impl<'de> serde::de::Deserialize<'de> for JobStateMatcher {
15406 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15407 where
15408 D: serde::Deserializer<'de>,
15409 {
15410 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobStateMatcher>::new(
15411 ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher",
15412 ))
15413 }
15414 }
15415}
15416
15417/// A request to update a job.
15418#[derive(Clone, Default, PartialEq)]
15419#[non_exhaustive]
15420pub struct UpdateJobRequest {
15421 /// Required. The ID of the Google Cloud Platform project that the job
15422 /// belongs to.
15423 pub project_id: std::string::String,
15424
15425 /// Required. The Dataproc region in which to handle the request.
15426 pub region: std::string::String,
15427
15428 /// Required. The job ID.
15429 pub job_id: std::string::String,
15430
15431 /// Required. The changes to the job.
15432 pub job: std::option::Option<crate::model::Job>,
15433
15434 /// Required. Specifies the path, relative to \<code\>Job\</code\>, of
15435 /// the field to update. For example, to update the labels of a Job the
15436 /// \<code\>update_mask\</code\> parameter would be specified as
15437 /// \<code\>labels\</code\>, and the `PATCH` request body would specify the new
15438 /// value. \<strong\>Note:\</strong\> Currently, \<code\>labels\</code\> is the only
15439 /// field that can be updated.
15440 pub update_mask: std::option::Option<wkt::FieldMask>,
15441
15442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15443}
15444
15445impl UpdateJobRequest {
15446 pub fn new() -> Self {
15447 std::default::Default::default()
15448 }
15449
15450 /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
15451 ///
15452 /// # Example
15453 /// ```ignore,no_run
15454 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15455 /// let x = UpdateJobRequest::new().set_project_id("example");
15456 /// ```
15457 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15458 self.project_id = v.into();
15459 self
15460 }
15461
15462 /// Sets the value of [region][crate::model::UpdateJobRequest::region].
15463 ///
15464 /// # Example
15465 /// ```ignore,no_run
15466 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15467 /// let x = UpdateJobRequest::new().set_region("example");
15468 /// ```
15469 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15470 self.region = v.into();
15471 self
15472 }
15473
15474 /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
15475 ///
15476 /// # Example
15477 /// ```ignore,no_run
15478 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15479 /// let x = UpdateJobRequest::new().set_job_id("example");
15480 /// ```
15481 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15482 self.job_id = v.into();
15483 self
15484 }
15485
15486 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
15487 ///
15488 /// # Example
15489 /// ```ignore,no_run
15490 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15491 /// use google_cloud_dataproc_v1::model::Job;
15492 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
15493 /// ```
15494 pub fn set_job<T>(mut self, v: T) -> Self
15495 where
15496 T: std::convert::Into<crate::model::Job>,
15497 {
15498 self.job = std::option::Option::Some(v.into());
15499 self
15500 }
15501
15502 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
15503 ///
15504 /// # Example
15505 /// ```ignore,no_run
15506 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15507 /// use google_cloud_dataproc_v1::model::Job;
15508 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
15509 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
15510 /// ```
15511 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
15512 where
15513 T: std::convert::Into<crate::model::Job>,
15514 {
15515 self.job = v.map(|x| x.into());
15516 self
15517 }
15518
15519 /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15520 ///
15521 /// # Example
15522 /// ```ignore,no_run
15523 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15524 /// use wkt::FieldMask;
15525 /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15526 /// ```
15527 pub fn set_update_mask<T>(mut self, v: T) -> Self
15528 where
15529 T: std::convert::Into<wkt::FieldMask>,
15530 {
15531 self.update_mask = std::option::Option::Some(v.into());
15532 self
15533 }
15534
15535 /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15536 ///
15537 /// # Example
15538 /// ```ignore,no_run
15539 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15540 /// use wkt::FieldMask;
15541 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15542 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15543 /// ```
15544 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15545 where
15546 T: std::convert::Into<wkt::FieldMask>,
15547 {
15548 self.update_mask = v.map(|x| x.into());
15549 self
15550 }
15551}
15552
15553impl wkt::message::Message for UpdateJobRequest {
15554 fn typename() -> &'static str {
15555 "type.googleapis.com/google.cloud.dataproc.v1.UpdateJobRequest"
15556 }
15557}
15558
15559/// A list of jobs in a project.
15560#[derive(Clone, Default, PartialEq)]
15561#[non_exhaustive]
15562pub struct ListJobsResponse {
15563 /// Output only. Jobs list.
15564 pub jobs: std::vec::Vec<crate::model::Job>,
15565
15566 /// Optional. This token is included in the response if there are more results
15567 /// to fetch. To fetch additional results, provide this value as the
15568 /// `page_token` in a subsequent \<code\>ListJobsRequest\</code\>.
15569 pub next_page_token: std::string::String,
15570
15571 /// Output only. List of jobs with
15572 /// [kms_key][google.cloud.dataproc.v1.EncryptionConfig.kms_key]-encrypted
15573 /// parameters that could not be decrypted. A response to a `jobs.get` request
15574 /// may indicate the reason for the decryption failure for a specific job.
15575 ///
15576 /// [google.cloud.dataproc.v1.EncryptionConfig.kms_key]: crate::model::EncryptionConfig::kms_key
15577 pub unreachable: std::vec::Vec<std::string::String>,
15578
15579 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15580}
15581
15582impl ListJobsResponse {
15583 pub fn new() -> Self {
15584 std::default::Default::default()
15585 }
15586
15587 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
15588 ///
15589 /// # Example
15590 /// ```ignore,no_run
15591 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15592 /// use google_cloud_dataproc_v1::model::Job;
15593 /// let x = ListJobsResponse::new()
15594 /// .set_jobs([
15595 /// Job::default()/* use setters */,
15596 /// Job::default()/* use (different) setters */,
15597 /// ]);
15598 /// ```
15599 pub fn set_jobs<T, V>(mut self, v: T) -> Self
15600 where
15601 T: std::iter::IntoIterator<Item = V>,
15602 V: std::convert::Into<crate::model::Job>,
15603 {
15604 use std::iter::Iterator;
15605 self.jobs = v.into_iter().map(|i| i.into()).collect();
15606 self
15607 }
15608
15609 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
15610 ///
15611 /// # Example
15612 /// ```ignore,no_run
15613 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15614 /// let x = ListJobsResponse::new().set_next_page_token("example");
15615 /// ```
15616 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15617 self.next_page_token = v.into();
15618 self
15619 }
15620
15621 /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
15622 ///
15623 /// # Example
15624 /// ```ignore,no_run
15625 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15626 /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
15627 /// ```
15628 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15629 where
15630 T: std::iter::IntoIterator<Item = V>,
15631 V: std::convert::Into<std::string::String>,
15632 {
15633 use std::iter::Iterator;
15634 self.unreachable = v.into_iter().map(|i| i.into()).collect();
15635 self
15636 }
15637}
15638
15639impl wkt::message::Message for ListJobsResponse {
15640 fn typename() -> &'static str {
15641 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsResponse"
15642 }
15643}
15644
15645#[doc(hidden)]
15646impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
15647 type PageItem = crate::model::Job;
15648
15649 fn items(self) -> std::vec::Vec<Self::PageItem> {
15650 self.jobs
15651 }
15652
15653 fn next_page_token(&self) -> std::string::String {
15654 use std::clone::Clone;
15655 self.next_page_token.clone()
15656 }
15657}
15658
15659/// A request to cancel a job.
15660#[derive(Clone, Default, PartialEq)]
15661#[non_exhaustive]
15662pub struct CancelJobRequest {
15663 /// Required. The ID of the Google Cloud Platform project that the job
15664 /// belongs to.
15665 pub project_id: std::string::String,
15666
15667 /// Required. The Dataproc region in which to handle the request.
15668 pub region: std::string::String,
15669
15670 /// Required. The job ID.
15671 pub job_id: std::string::String,
15672
15673 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15674}
15675
15676impl CancelJobRequest {
15677 pub fn new() -> Self {
15678 std::default::Default::default()
15679 }
15680
15681 /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
15682 ///
15683 /// # Example
15684 /// ```ignore,no_run
15685 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15686 /// let x = CancelJobRequest::new().set_project_id("example");
15687 /// ```
15688 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15689 self.project_id = v.into();
15690 self
15691 }
15692
15693 /// Sets the value of [region][crate::model::CancelJobRequest::region].
15694 ///
15695 /// # Example
15696 /// ```ignore,no_run
15697 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15698 /// let x = CancelJobRequest::new().set_region("example");
15699 /// ```
15700 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15701 self.region = v.into();
15702 self
15703 }
15704
15705 /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
15706 ///
15707 /// # Example
15708 /// ```ignore,no_run
15709 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15710 /// let x = CancelJobRequest::new().set_job_id("example");
15711 /// ```
15712 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15713 self.job_id = v.into();
15714 self
15715 }
15716}
15717
15718impl wkt::message::Message for CancelJobRequest {
15719 fn typename() -> &'static str {
15720 "type.googleapis.com/google.cloud.dataproc.v1.CancelJobRequest"
15721 }
15722}
15723
15724/// A request to delete a job.
15725#[derive(Clone, Default, PartialEq)]
15726#[non_exhaustive]
15727pub struct DeleteJobRequest {
15728 /// Required. The ID of the Google Cloud Platform project that the job
15729 /// belongs to.
15730 pub project_id: std::string::String,
15731
15732 /// Required. The Dataproc region in which to handle the request.
15733 pub region: std::string::String,
15734
15735 /// Required. The job ID.
15736 pub job_id: std::string::String,
15737
15738 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15739}
15740
15741impl DeleteJobRequest {
15742 pub fn new() -> Self {
15743 std::default::Default::default()
15744 }
15745
15746 /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
15747 ///
15748 /// # Example
15749 /// ```ignore,no_run
15750 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15751 /// let x = DeleteJobRequest::new().set_project_id("example");
15752 /// ```
15753 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15754 self.project_id = v.into();
15755 self
15756 }
15757
15758 /// Sets the value of [region][crate::model::DeleteJobRequest::region].
15759 ///
15760 /// # Example
15761 /// ```ignore,no_run
15762 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15763 /// let x = DeleteJobRequest::new().set_region("example");
15764 /// ```
15765 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15766 self.region = v.into();
15767 self
15768 }
15769
15770 /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
15771 ///
15772 /// # Example
15773 /// ```ignore,no_run
15774 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15775 /// let x = DeleteJobRequest::new().set_job_id("example");
15776 /// ```
15777 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15778 self.job_id = v.into();
15779 self
15780 }
15781}
15782
15783impl wkt::message::Message for DeleteJobRequest {
15784 fn typename() -> &'static str {
15785 "type.googleapis.com/google.cloud.dataproc.v1.DeleteJobRequest"
15786 }
15787}
15788
15789/// A request to create a node group.
15790#[derive(Clone, Default, PartialEq)]
15791#[non_exhaustive]
15792pub struct CreateNodeGroupRequest {
15793 /// Required. The parent resource where this node group will be created.
15794 /// Format: `projects/{project}/regions/{region}/clusters/{cluster}`
15795 pub parent: std::string::String,
15796
15797 /// Required. The node group to create.
15798 pub node_group: std::option::Option<crate::model::NodeGroup>,
15799
15800 /// Optional. An optional node group ID. Generated if not specified.
15801 ///
15802 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15803 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
15804 /// or hyphen. Must consist of from 3 to 33 characters.
15805 pub node_group_id: std::string::String,
15806
15807 /// Optional. A unique ID used to identify the request. If the server receives
15808 /// two
15809 /// [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
15810 /// with the same ID, the second request is ignored and the
15811 /// first [google.longrunning.Operation][google.longrunning.Operation] created
15812 /// and stored in the backend is returned.
15813 ///
15814 /// Recommendation: Set this value to a
15815 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15816 ///
15817 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15818 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15819 ///
15820 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
15821 pub request_id: std::string::String,
15822
15823 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15824}
15825
15826impl CreateNodeGroupRequest {
15827 pub fn new() -> Self {
15828 std::default::Default::default()
15829 }
15830
15831 /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
15832 ///
15833 /// # Example
15834 /// ```ignore,no_run
15835 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15836 /// let x = CreateNodeGroupRequest::new().set_parent("example");
15837 /// ```
15838 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15839 self.parent = v.into();
15840 self
15841 }
15842
15843 /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15844 ///
15845 /// # Example
15846 /// ```ignore,no_run
15847 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15848 /// use google_cloud_dataproc_v1::model::NodeGroup;
15849 /// let x = CreateNodeGroupRequest::new().set_node_group(NodeGroup::default()/* use setters */);
15850 /// ```
15851 pub fn set_node_group<T>(mut self, v: T) -> Self
15852 where
15853 T: std::convert::Into<crate::model::NodeGroup>,
15854 {
15855 self.node_group = std::option::Option::Some(v.into());
15856 self
15857 }
15858
15859 /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15860 ///
15861 /// # Example
15862 /// ```ignore,no_run
15863 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15864 /// use google_cloud_dataproc_v1::model::NodeGroup;
15865 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
15866 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(None::<NodeGroup>);
15867 /// ```
15868 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
15869 where
15870 T: std::convert::Into<crate::model::NodeGroup>,
15871 {
15872 self.node_group = v.map(|x| x.into());
15873 self
15874 }
15875
15876 /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
15877 ///
15878 /// # Example
15879 /// ```ignore,no_run
15880 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15881 /// let x = CreateNodeGroupRequest::new().set_node_group_id("example");
15882 /// ```
15883 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15884 self.node_group_id = v.into();
15885 self
15886 }
15887
15888 /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
15889 ///
15890 /// # Example
15891 /// ```ignore,no_run
15892 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15893 /// let x = CreateNodeGroupRequest::new().set_request_id("example");
15894 /// ```
15895 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15896 self.request_id = v.into();
15897 self
15898 }
15899}
15900
15901impl wkt::message::Message for CreateNodeGroupRequest {
15902 fn typename() -> &'static str {
15903 "type.googleapis.com/google.cloud.dataproc.v1.CreateNodeGroupRequest"
15904 }
15905}
15906
15907/// A request to resize a node group.
15908#[derive(Clone, Default, PartialEq)]
15909#[non_exhaustive]
15910pub struct ResizeNodeGroupRequest {
15911 /// Required. The name of the node group to resize.
15912 /// Format:
15913 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
15914 pub name: std::string::String,
15915
15916 /// Required. The number of running instances for the node group to maintain.
15917 /// The group adds or removes instances to maintain the number of instances
15918 /// specified by this parameter.
15919 pub size: i32,
15920
15921 /// Optional. A unique ID used to identify the request. If the server receives
15922 /// two
15923 /// [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
15924 /// with the same ID, the second request is ignored and the
15925 /// first [google.longrunning.Operation][google.longrunning.Operation] created
15926 /// and stored in the backend is returned.
15927 ///
15928 /// Recommendation: Set this value to a
15929 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15930 ///
15931 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15932 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15933 ///
15934 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
15935 pub request_id: std::string::String,
15936
15937 /// Optional. Timeout for graceful YARN decommissioning. [Graceful
15938 /// decommissioning]
15939 /// (<https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning>)
15940 /// allows the removal of nodes from the Compute Engine node group
15941 /// without interrupting jobs in progress. This timeout specifies how long to
15942 /// wait for jobs in progress to finish before forcefully removing nodes (and
15943 /// potentially interrupting jobs). Default timeout is 0 (for forceful
15944 /// decommission), and the maximum allowed timeout is 1 day. (see JSON
15945 /// representation of
15946 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
15947 ///
15948 /// Only supported on Dataproc image versions 1.2 and higher.
15949 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
15950
15951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15952}
15953
15954impl ResizeNodeGroupRequest {
15955 pub fn new() -> Self {
15956 std::default::Default::default()
15957 }
15958
15959 /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
15960 ///
15961 /// # Example
15962 /// ```ignore,no_run
15963 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15964 /// let x = ResizeNodeGroupRequest::new().set_name("example");
15965 /// ```
15966 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15967 self.name = v.into();
15968 self
15969 }
15970
15971 /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
15972 ///
15973 /// # Example
15974 /// ```ignore,no_run
15975 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15976 /// let x = ResizeNodeGroupRequest::new().set_size(42);
15977 /// ```
15978 pub fn set_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15979 self.size = v.into();
15980 self
15981 }
15982
15983 /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
15984 ///
15985 /// # Example
15986 /// ```ignore,no_run
15987 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15988 /// let x = ResizeNodeGroupRequest::new().set_request_id("example");
15989 /// ```
15990 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15991 self.request_id = v.into();
15992 self
15993 }
15994
15995 /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
15996 ///
15997 /// # Example
15998 /// ```ignore,no_run
15999 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16000 /// use wkt::Duration;
16001 /// let x = ResizeNodeGroupRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
16002 /// ```
16003 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
16004 where
16005 T: std::convert::Into<wkt::Duration>,
16006 {
16007 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
16008 self
16009 }
16010
16011 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
16012 ///
16013 /// # Example
16014 /// ```ignore,no_run
16015 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16016 /// use wkt::Duration;
16017 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
16018 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
16019 /// ```
16020 pub fn set_or_clear_graceful_decommission_timeout<T>(
16021 mut self,
16022 v: std::option::Option<T>,
16023 ) -> Self
16024 where
16025 T: std::convert::Into<wkt::Duration>,
16026 {
16027 self.graceful_decommission_timeout = v.map(|x| x.into());
16028 self
16029 }
16030}
16031
16032impl wkt::message::Message for ResizeNodeGroupRequest {
16033 fn typename() -> &'static str {
16034 "type.googleapis.com/google.cloud.dataproc.v1.ResizeNodeGroupRequest"
16035 }
16036}
16037
16038/// A request to get a node group .
16039#[derive(Clone, Default, PartialEq)]
16040#[non_exhaustive]
16041pub struct GetNodeGroupRequest {
16042 /// Required. The name of the node group to retrieve.
16043 /// Format:
16044 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
16045 pub name: std::string::String,
16046
16047 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16048}
16049
16050impl GetNodeGroupRequest {
16051 pub fn new() -> Self {
16052 std::default::Default::default()
16053 }
16054
16055 /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
16056 ///
16057 /// # Example
16058 /// ```ignore,no_run
16059 /// # use google_cloud_dataproc_v1::model::GetNodeGroupRequest;
16060 /// let x = GetNodeGroupRequest::new().set_name("example");
16061 /// ```
16062 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16063 self.name = v.into();
16064 self
16065 }
16066}
16067
16068impl wkt::message::Message for GetNodeGroupRequest {
16069 fn typename() -> &'static str {
16070 "type.googleapis.com/google.cloud.dataproc.v1.GetNodeGroupRequest"
16071 }
16072}
16073
16074/// Metadata describing the Batch operation.
16075#[derive(Clone, Default, PartialEq)]
16076#[non_exhaustive]
16077pub struct BatchOperationMetadata {
16078 /// Name of the batch for the operation.
16079 pub batch: std::string::String,
16080
16081 /// Batch UUID for the operation.
16082 pub batch_uuid: std::string::String,
16083
16084 /// The time when the operation was created.
16085 pub create_time: std::option::Option<wkt::Timestamp>,
16086
16087 /// The time when the operation finished.
16088 pub done_time: std::option::Option<wkt::Timestamp>,
16089
16090 /// The operation type.
16091 pub operation_type: crate::model::batch_operation_metadata::BatchOperationType,
16092
16093 /// Short description of the operation.
16094 pub description: std::string::String,
16095
16096 /// Labels associated with the operation.
16097 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16098
16099 /// Warnings encountered during operation execution.
16100 pub warnings: std::vec::Vec<std::string::String>,
16101
16102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16103}
16104
16105impl BatchOperationMetadata {
16106 pub fn new() -> Self {
16107 std::default::Default::default()
16108 }
16109
16110 /// Sets the value of [batch][crate::model::BatchOperationMetadata::batch].
16111 ///
16112 /// # Example
16113 /// ```ignore,no_run
16114 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16115 /// let x = BatchOperationMetadata::new().set_batch("example");
16116 /// ```
16117 pub fn set_batch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16118 self.batch = v.into();
16119 self
16120 }
16121
16122 /// Sets the value of [batch_uuid][crate::model::BatchOperationMetadata::batch_uuid].
16123 ///
16124 /// # Example
16125 /// ```ignore,no_run
16126 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16127 /// let x = BatchOperationMetadata::new().set_batch_uuid("example");
16128 /// ```
16129 pub fn set_batch_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16130 self.batch_uuid = v.into();
16131 self
16132 }
16133
16134 /// Sets the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16135 ///
16136 /// # Example
16137 /// ```ignore,no_run
16138 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16139 /// use wkt::Timestamp;
16140 /// let x = BatchOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16141 /// ```
16142 pub fn set_create_time<T>(mut self, v: T) -> Self
16143 where
16144 T: std::convert::Into<wkt::Timestamp>,
16145 {
16146 self.create_time = std::option::Option::Some(v.into());
16147 self
16148 }
16149
16150 /// Sets or clears the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16151 ///
16152 /// # Example
16153 /// ```ignore,no_run
16154 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16155 /// use wkt::Timestamp;
16156 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16157 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16158 /// ```
16159 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16160 where
16161 T: std::convert::Into<wkt::Timestamp>,
16162 {
16163 self.create_time = v.map(|x| x.into());
16164 self
16165 }
16166
16167 /// Sets the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16168 ///
16169 /// # Example
16170 /// ```ignore,no_run
16171 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16172 /// use wkt::Timestamp;
16173 /// let x = BatchOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16174 /// ```
16175 pub fn set_done_time<T>(mut self, v: T) -> Self
16176 where
16177 T: std::convert::Into<wkt::Timestamp>,
16178 {
16179 self.done_time = std::option::Option::Some(v.into());
16180 self
16181 }
16182
16183 /// Sets or clears the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16184 ///
16185 /// # Example
16186 /// ```ignore,no_run
16187 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16188 /// use wkt::Timestamp;
16189 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16190 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16191 /// ```
16192 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16193 where
16194 T: std::convert::Into<wkt::Timestamp>,
16195 {
16196 self.done_time = v.map(|x| x.into());
16197 self
16198 }
16199
16200 /// Sets the value of [operation_type][crate::model::BatchOperationMetadata::operation_type].
16201 ///
16202 /// # Example
16203 /// ```ignore,no_run
16204 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16205 /// use google_cloud_dataproc_v1::model::batch_operation_metadata::BatchOperationType;
16206 /// let x0 = BatchOperationMetadata::new().set_operation_type(BatchOperationType::Batch);
16207 /// ```
16208 pub fn set_operation_type<
16209 T: std::convert::Into<crate::model::batch_operation_metadata::BatchOperationType>,
16210 >(
16211 mut self,
16212 v: T,
16213 ) -> Self {
16214 self.operation_type = v.into();
16215 self
16216 }
16217
16218 /// Sets the value of [description][crate::model::BatchOperationMetadata::description].
16219 ///
16220 /// # Example
16221 /// ```ignore,no_run
16222 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16223 /// let x = BatchOperationMetadata::new().set_description("example");
16224 /// ```
16225 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16226 self.description = v.into();
16227 self
16228 }
16229
16230 /// Sets the value of [labels][crate::model::BatchOperationMetadata::labels].
16231 ///
16232 /// # Example
16233 /// ```ignore,no_run
16234 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16235 /// let x = BatchOperationMetadata::new().set_labels([
16236 /// ("key0", "abc"),
16237 /// ("key1", "xyz"),
16238 /// ]);
16239 /// ```
16240 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16241 where
16242 T: std::iter::IntoIterator<Item = (K, V)>,
16243 K: std::convert::Into<std::string::String>,
16244 V: std::convert::Into<std::string::String>,
16245 {
16246 use std::iter::Iterator;
16247 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16248 self
16249 }
16250
16251 /// Sets the value of [warnings][crate::model::BatchOperationMetadata::warnings].
16252 ///
16253 /// # Example
16254 /// ```ignore,no_run
16255 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16256 /// let x = BatchOperationMetadata::new().set_warnings(["a", "b", "c"]);
16257 /// ```
16258 pub fn set_warnings<T, V>(mut self, v: T) -> Self
16259 where
16260 T: std::iter::IntoIterator<Item = V>,
16261 V: std::convert::Into<std::string::String>,
16262 {
16263 use std::iter::Iterator;
16264 self.warnings = v.into_iter().map(|i| i.into()).collect();
16265 self
16266 }
16267}
16268
16269impl wkt::message::Message for BatchOperationMetadata {
16270 fn typename() -> &'static str {
16271 "type.googleapis.com/google.cloud.dataproc.v1.BatchOperationMetadata"
16272 }
16273}
16274
16275/// Defines additional types related to [BatchOperationMetadata].
16276pub mod batch_operation_metadata {
16277 #[allow(unused_imports)]
16278 use super::*;
16279
16280 /// Operation type for Batch resources
16281 ///
16282 /// # Working with unknown values
16283 ///
16284 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16285 /// additional enum variants at any time. Adding new variants is not considered
16286 /// a breaking change. Applications should write their code in anticipation of:
16287 ///
16288 /// - New values appearing in future releases of the client library, **and**
16289 /// - New values received dynamically, without application changes.
16290 ///
16291 /// Please consult the [Working with enums] section in the user guide for some
16292 /// guidelines.
16293 ///
16294 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16295 #[derive(Clone, Debug, PartialEq)]
16296 #[non_exhaustive]
16297 pub enum BatchOperationType {
16298 /// Batch operation type is unknown.
16299 Unspecified,
16300 /// Batch operation type.
16301 Batch,
16302 /// If set, the enum was initialized with an unknown value.
16303 ///
16304 /// Applications can examine the value using [BatchOperationType::value] or
16305 /// [BatchOperationType::name].
16306 UnknownValue(batch_operation_type::UnknownValue),
16307 }
16308
16309 #[doc(hidden)]
16310 pub mod batch_operation_type {
16311 #[allow(unused_imports)]
16312 use super::*;
16313 #[derive(Clone, Debug, PartialEq)]
16314 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16315 }
16316
16317 impl BatchOperationType {
16318 /// Gets the enum value.
16319 ///
16320 /// Returns `None` if the enum contains an unknown value deserialized from
16321 /// the string representation of enums.
16322 pub fn value(&self) -> std::option::Option<i32> {
16323 match self {
16324 Self::Unspecified => std::option::Option::Some(0),
16325 Self::Batch => std::option::Option::Some(1),
16326 Self::UnknownValue(u) => u.0.value(),
16327 }
16328 }
16329
16330 /// Gets the enum value as a string.
16331 ///
16332 /// Returns `None` if the enum contains an unknown value deserialized from
16333 /// the integer representation of enums.
16334 pub fn name(&self) -> std::option::Option<&str> {
16335 match self {
16336 Self::Unspecified => std::option::Option::Some("BATCH_OPERATION_TYPE_UNSPECIFIED"),
16337 Self::Batch => std::option::Option::Some("BATCH"),
16338 Self::UnknownValue(u) => u.0.name(),
16339 }
16340 }
16341 }
16342
16343 impl std::default::Default for BatchOperationType {
16344 fn default() -> Self {
16345 use std::convert::From;
16346 Self::from(0)
16347 }
16348 }
16349
16350 impl std::fmt::Display for BatchOperationType {
16351 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16352 wkt::internal::display_enum(f, self.name(), self.value())
16353 }
16354 }
16355
16356 impl std::convert::From<i32> for BatchOperationType {
16357 fn from(value: i32) -> Self {
16358 match value {
16359 0 => Self::Unspecified,
16360 1 => Self::Batch,
16361 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16362 wkt::internal::UnknownEnumValue::Integer(value),
16363 )),
16364 }
16365 }
16366 }
16367
16368 impl std::convert::From<&str> for BatchOperationType {
16369 fn from(value: &str) -> Self {
16370 use std::string::ToString;
16371 match value {
16372 "BATCH_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16373 "BATCH" => Self::Batch,
16374 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16375 wkt::internal::UnknownEnumValue::String(value.to_string()),
16376 )),
16377 }
16378 }
16379 }
16380
16381 impl serde::ser::Serialize for BatchOperationType {
16382 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16383 where
16384 S: serde::Serializer,
16385 {
16386 match self {
16387 Self::Unspecified => serializer.serialize_i32(0),
16388 Self::Batch => serializer.serialize_i32(1),
16389 Self::UnknownValue(u) => u.0.serialize(serializer),
16390 }
16391 }
16392 }
16393
16394 impl<'de> serde::de::Deserialize<'de> for BatchOperationType {
16395 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16396 where
16397 D: serde::Deserializer<'de>,
16398 {
16399 deserializer.deserialize_any(wkt::internal::EnumVisitor::<BatchOperationType>::new(
16400 ".google.cloud.dataproc.v1.BatchOperationMetadata.BatchOperationType",
16401 ))
16402 }
16403 }
16404}
16405
16406/// Metadata describing the Session operation.
16407#[derive(Clone, Default, PartialEq)]
16408#[non_exhaustive]
16409pub struct SessionOperationMetadata {
16410 /// Name of the session for the operation.
16411 pub session: std::string::String,
16412
16413 /// Session UUID for the operation.
16414 pub session_uuid: std::string::String,
16415
16416 /// The time when the operation was created.
16417 pub create_time: std::option::Option<wkt::Timestamp>,
16418
16419 /// The time when the operation was finished.
16420 pub done_time: std::option::Option<wkt::Timestamp>,
16421
16422 /// The operation type.
16423 pub operation_type: crate::model::session_operation_metadata::SessionOperationType,
16424
16425 /// Short description of the operation.
16426 pub description: std::string::String,
16427
16428 /// Labels associated with the operation.
16429 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16430
16431 /// Warnings encountered during operation execution.
16432 pub warnings: std::vec::Vec<std::string::String>,
16433
16434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16435}
16436
16437impl SessionOperationMetadata {
16438 pub fn new() -> Self {
16439 std::default::Default::default()
16440 }
16441
16442 /// Sets the value of [session][crate::model::SessionOperationMetadata::session].
16443 ///
16444 /// # Example
16445 /// ```ignore,no_run
16446 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16447 /// let x = SessionOperationMetadata::new().set_session("example");
16448 /// ```
16449 pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16450 self.session = v.into();
16451 self
16452 }
16453
16454 /// Sets the value of [session_uuid][crate::model::SessionOperationMetadata::session_uuid].
16455 ///
16456 /// # Example
16457 /// ```ignore,no_run
16458 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16459 /// let x = SessionOperationMetadata::new().set_session_uuid("example");
16460 /// ```
16461 pub fn set_session_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16462 self.session_uuid = v.into();
16463 self
16464 }
16465
16466 /// Sets the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16467 ///
16468 /// # Example
16469 /// ```ignore,no_run
16470 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16471 /// use wkt::Timestamp;
16472 /// let x = SessionOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16473 /// ```
16474 pub fn set_create_time<T>(mut self, v: T) -> Self
16475 where
16476 T: std::convert::Into<wkt::Timestamp>,
16477 {
16478 self.create_time = std::option::Option::Some(v.into());
16479 self
16480 }
16481
16482 /// Sets or clears the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16483 ///
16484 /// # Example
16485 /// ```ignore,no_run
16486 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16487 /// use wkt::Timestamp;
16488 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16489 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16490 /// ```
16491 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16492 where
16493 T: std::convert::Into<wkt::Timestamp>,
16494 {
16495 self.create_time = v.map(|x| x.into());
16496 self
16497 }
16498
16499 /// Sets the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16500 ///
16501 /// # Example
16502 /// ```ignore,no_run
16503 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16504 /// use wkt::Timestamp;
16505 /// let x = SessionOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16506 /// ```
16507 pub fn set_done_time<T>(mut self, v: T) -> Self
16508 where
16509 T: std::convert::Into<wkt::Timestamp>,
16510 {
16511 self.done_time = std::option::Option::Some(v.into());
16512 self
16513 }
16514
16515 /// Sets or clears the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16516 ///
16517 /// # Example
16518 /// ```ignore,no_run
16519 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16520 /// use wkt::Timestamp;
16521 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16522 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16523 /// ```
16524 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16525 where
16526 T: std::convert::Into<wkt::Timestamp>,
16527 {
16528 self.done_time = v.map(|x| x.into());
16529 self
16530 }
16531
16532 /// Sets the value of [operation_type][crate::model::SessionOperationMetadata::operation_type].
16533 ///
16534 /// # Example
16535 /// ```ignore,no_run
16536 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16537 /// use google_cloud_dataproc_v1::model::session_operation_metadata::SessionOperationType;
16538 /// let x0 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Create);
16539 /// let x1 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Terminate);
16540 /// let x2 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Delete);
16541 /// ```
16542 pub fn set_operation_type<
16543 T: std::convert::Into<crate::model::session_operation_metadata::SessionOperationType>,
16544 >(
16545 mut self,
16546 v: T,
16547 ) -> Self {
16548 self.operation_type = v.into();
16549 self
16550 }
16551
16552 /// Sets the value of [description][crate::model::SessionOperationMetadata::description].
16553 ///
16554 /// # Example
16555 /// ```ignore,no_run
16556 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16557 /// let x = SessionOperationMetadata::new().set_description("example");
16558 /// ```
16559 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16560 self.description = v.into();
16561 self
16562 }
16563
16564 /// Sets the value of [labels][crate::model::SessionOperationMetadata::labels].
16565 ///
16566 /// # Example
16567 /// ```ignore,no_run
16568 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16569 /// let x = SessionOperationMetadata::new().set_labels([
16570 /// ("key0", "abc"),
16571 /// ("key1", "xyz"),
16572 /// ]);
16573 /// ```
16574 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16575 where
16576 T: std::iter::IntoIterator<Item = (K, V)>,
16577 K: std::convert::Into<std::string::String>,
16578 V: std::convert::Into<std::string::String>,
16579 {
16580 use std::iter::Iterator;
16581 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16582 self
16583 }
16584
16585 /// Sets the value of [warnings][crate::model::SessionOperationMetadata::warnings].
16586 ///
16587 /// # Example
16588 /// ```ignore,no_run
16589 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16590 /// let x = SessionOperationMetadata::new().set_warnings(["a", "b", "c"]);
16591 /// ```
16592 pub fn set_warnings<T, V>(mut self, v: T) -> Self
16593 where
16594 T: std::iter::IntoIterator<Item = V>,
16595 V: std::convert::Into<std::string::String>,
16596 {
16597 use std::iter::Iterator;
16598 self.warnings = v.into_iter().map(|i| i.into()).collect();
16599 self
16600 }
16601}
16602
16603impl wkt::message::Message for SessionOperationMetadata {
16604 fn typename() -> &'static str {
16605 "type.googleapis.com/google.cloud.dataproc.v1.SessionOperationMetadata"
16606 }
16607}
16608
16609/// Defines additional types related to [SessionOperationMetadata].
16610pub mod session_operation_metadata {
16611 #[allow(unused_imports)]
16612 use super::*;
16613
16614 /// Operation type for Session resources
16615 ///
16616 /// # Working with unknown values
16617 ///
16618 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16619 /// additional enum variants at any time. Adding new variants is not considered
16620 /// a breaking change. Applications should write their code in anticipation of:
16621 ///
16622 /// - New values appearing in future releases of the client library, **and**
16623 /// - New values received dynamically, without application changes.
16624 ///
16625 /// Please consult the [Working with enums] section in the user guide for some
16626 /// guidelines.
16627 ///
16628 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16629 #[derive(Clone, Debug, PartialEq)]
16630 #[non_exhaustive]
16631 pub enum SessionOperationType {
16632 /// Session operation type is unknown.
16633 Unspecified,
16634 /// Create Session operation type.
16635 Create,
16636 /// Terminate Session operation type.
16637 Terminate,
16638 /// Delete Session operation type.
16639 Delete,
16640 /// If set, the enum was initialized with an unknown value.
16641 ///
16642 /// Applications can examine the value using [SessionOperationType::value] or
16643 /// [SessionOperationType::name].
16644 UnknownValue(session_operation_type::UnknownValue),
16645 }
16646
16647 #[doc(hidden)]
16648 pub mod session_operation_type {
16649 #[allow(unused_imports)]
16650 use super::*;
16651 #[derive(Clone, Debug, PartialEq)]
16652 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16653 }
16654
16655 impl SessionOperationType {
16656 /// Gets the enum value.
16657 ///
16658 /// Returns `None` if the enum contains an unknown value deserialized from
16659 /// the string representation of enums.
16660 pub fn value(&self) -> std::option::Option<i32> {
16661 match self {
16662 Self::Unspecified => std::option::Option::Some(0),
16663 Self::Create => std::option::Option::Some(1),
16664 Self::Terminate => std::option::Option::Some(2),
16665 Self::Delete => std::option::Option::Some(3),
16666 Self::UnknownValue(u) => u.0.value(),
16667 }
16668 }
16669
16670 /// Gets the enum value as a string.
16671 ///
16672 /// Returns `None` if the enum contains an unknown value deserialized from
16673 /// the integer representation of enums.
16674 pub fn name(&self) -> std::option::Option<&str> {
16675 match self {
16676 Self::Unspecified => {
16677 std::option::Option::Some("SESSION_OPERATION_TYPE_UNSPECIFIED")
16678 }
16679 Self::Create => std::option::Option::Some("CREATE"),
16680 Self::Terminate => std::option::Option::Some("TERMINATE"),
16681 Self::Delete => std::option::Option::Some("DELETE"),
16682 Self::UnknownValue(u) => u.0.name(),
16683 }
16684 }
16685 }
16686
16687 impl std::default::Default for SessionOperationType {
16688 fn default() -> Self {
16689 use std::convert::From;
16690 Self::from(0)
16691 }
16692 }
16693
16694 impl std::fmt::Display for SessionOperationType {
16695 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16696 wkt::internal::display_enum(f, self.name(), self.value())
16697 }
16698 }
16699
16700 impl std::convert::From<i32> for SessionOperationType {
16701 fn from(value: i32) -> Self {
16702 match value {
16703 0 => Self::Unspecified,
16704 1 => Self::Create,
16705 2 => Self::Terminate,
16706 3 => Self::Delete,
16707 _ => Self::UnknownValue(session_operation_type::UnknownValue(
16708 wkt::internal::UnknownEnumValue::Integer(value),
16709 )),
16710 }
16711 }
16712 }
16713
16714 impl std::convert::From<&str> for SessionOperationType {
16715 fn from(value: &str) -> Self {
16716 use std::string::ToString;
16717 match value {
16718 "SESSION_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16719 "CREATE" => Self::Create,
16720 "TERMINATE" => Self::Terminate,
16721 "DELETE" => Self::Delete,
16722 _ => Self::UnknownValue(session_operation_type::UnknownValue(
16723 wkt::internal::UnknownEnumValue::String(value.to_string()),
16724 )),
16725 }
16726 }
16727 }
16728
16729 impl serde::ser::Serialize for SessionOperationType {
16730 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16731 where
16732 S: serde::Serializer,
16733 {
16734 match self {
16735 Self::Unspecified => serializer.serialize_i32(0),
16736 Self::Create => serializer.serialize_i32(1),
16737 Self::Terminate => serializer.serialize_i32(2),
16738 Self::Delete => serializer.serialize_i32(3),
16739 Self::UnknownValue(u) => u.0.serialize(serializer),
16740 }
16741 }
16742 }
16743
16744 impl<'de> serde::de::Deserialize<'de> for SessionOperationType {
16745 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16746 where
16747 D: serde::Deserializer<'de>,
16748 {
16749 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionOperationType>::new(
16750 ".google.cloud.dataproc.v1.SessionOperationMetadata.SessionOperationType",
16751 ))
16752 }
16753 }
16754}
16755
16756/// The status of the operation.
16757#[derive(Clone, Default, PartialEq)]
16758#[non_exhaustive]
16759pub struct ClusterOperationStatus {
16760 /// Output only. A message containing the operation state.
16761 pub state: crate::model::cluster_operation_status::State,
16762
16763 /// Output only. A message containing the detailed operation state.
16764 pub inner_state: std::string::String,
16765
16766 /// Output only. A message containing any operation metadata details.
16767 pub details: std::string::String,
16768
16769 /// Output only. The time this state was entered.
16770 pub state_start_time: std::option::Option<wkt::Timestamp>,
16771
16772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16773}
16774
16775impl ClusterOperationStatus {
16776 pub fn new() -> Self {
16777 std::default::Default::default()
16778 }
16779
16780 /// Sets the value of [state][crate::model::ClusterOperationStatus::state].
16781 ///
16782 /// # Example
16783 /// ```ignore,no_run
16784 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16785 /// use google_cloud_dataproc_v1::model::cluster_operation_status::State;
16786 /// let x0 = ClusterOperationStatus::new().set_state(State::Pending);
16787 /// let x1 = ClusterOperationStatus::new().set_state(State::Running);
16788 /// let x2 = ClusterOperationStatus::new().set_state(State::Done);
16789 /// ```
16790 pub fn set_state<T: std::convert::Into<crate::model::cluster_operation_status::State>>(
16791 mut self,
16792 v: T,
16793 ) -> Self {
16794 self.state = v.into();
16795 self
16796 }
16797
16798 /// Sets the value of [inner_state][crate::model::ClusterOperationStatus::inner_state].
16799 ///
16800 /// # Example
16801 /// ```ignore,no_run
16802 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16803 /// let x = ClusterOperationStatus::new().set_inner_state("example");
16804 /// ```
16805 pub fn set_inner_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16806 self.inner_state = v.into();
16807 self
16808 }
16809
16810 /// Sets the value of [details][crate::model::ClusterOperationStatus::details].
16811 ///
16812 /// # Example
16813 /// ```ignore,no_run
16814 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16815 /// let x = ClusterOperationStatus::new().set_details("example");
16816 /// ```
16817 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16818 self.details = v.into();
16819 self
16820 }
16821
16822 /// Sets the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16823 ///
16824 /// # Example
16825 /// ```ignore,no_run
16826 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16827 /// use wkt::Timestamp;
16828 /// let x = ClusterOperationStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
16829 /// ```
16830 pub fn set_state_start_time<T>(mut self, v: T) -> Self
16831 where
16832 T: std::convert::Into<wkt::Timestamp>,
16833 {
16834 self.state_start_time = std::option::Option::Some(v.into());
16835 self
16836 }
16837
16838 /// Sets or clears the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16839 ///
16840 /// # Example
16841 /// ```ignore,no_run
16842 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16843 /// use wkt::Timestamp;
16844 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
16845 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
16846 /// ```
16847 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16848 where
16849 T: std::convert::Into<wkt::Timestamp>,
16850 {
16851 self.state_start_time = v.map(|x| x.into());
16852 self
16853 }
16854}
16855
16856impl wkt::message::Message for ClusterOperationStatus {
16857 fn typename() -> &'static str {
16858 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationStatus"
16859 }
16860}
16861
16862/// Defines additional types related to [ClusterOperationStatus].
16863pub mod cluster_operation_status {
16864 #[allow(unused_imports)]
16865 use super::*;
16866
16867 /// The operation state.
16868 ///
16869 /// # Working with unknown values
16870 ///
16871 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16872 /// additional enum variants at any time. Adding new variants is not considered
16873 /// a breaking change. Applications should write their code in anticipation of:
16874 ///
16875 /// - New values appearing in future releases of the client library, **and**
16876 /// - New values received dynamically, without application changes.
16877 ///
16878 /// Please consult the [Working with enums] section in the user guide for some
16879 /// guidelines.
16880 ///
16881 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16882 #[derive(Clone, Debug, PartialEq)]
16883 #[non_exhaustive]
16884 pub enum State {
16885 /// Unused.
16886 Unknown,
16887 /// The operation has been created.
16888 Pending,
16889 /// The operation is running.
16890 Running,
16891 /// The operation is done; either cancelled or completed.
16892 Done,
16893 /// If set, the enum was initialized with an unknown value.
16894 ///
16895 /// Applications can examine the value using [State::value] or
16896 /// [State::name].
16897 UnknownValue(state::UnknownValue),
16898 }
16899
16900 #[doc(hidden)]
16901 pub mod state {
16902 #[allow(unused_imports)]
16903 use super::*;
16904 #[derive(Clone, Debug, PartialEq)]
16905 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16906 }
16907
16908 impl State {
16909 /// Gets the enum value.
16910 ///
16911 /// Returns `None` if the enum contains an unknown value deserialized from
16912 /// the string representation of enums.
16913 pub fn value(&self) -> std::option::Option<i32> {
16914 match self {
16915 Self::Unknown => std::option::Option::Some(0),
16916 Self::Pending => std::option::Option::Some(1),
16917 Self::Running => std::option::Option::Some(2),
16918 Self::Done => std::option::Option::Some(3),
16919 Self::UnknownValue(u) => u.0.value(),
16920 }
16921 }
16922
16923 /// Gets the enum value as a string.
16924 ///
16925 /// Returns `None` if the enum contains an unknown value deserialized from
16926 /// the integer representation of enums.
16927 pub fn name(&self) -> std::option::Option<&str> {
16928 match self {
16929 Self::Unknown => std::option::Option::Some("UNKNOWN"),
16930 Self::Pending => std::option::Option::Some("PENDING"),
16931 Self::Running => std::option::Option::Some("RUNNING"),
16932 Self::Done => std::option::Option::Some("DONE"),
16933 Self::UnknownValue(u) => u.0.name(),
16934 }
16935 }
16936 }
16937
16938 impl std::default::Default for State {
16939 fn default() -> Self {
16940 use std::convert::From;
16941 Self::from(0)
16942 }
16943 }
16944
16945 impl std::fmt::Display for State {
16946 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16947 wkt::internal::display_enum(f, self.name(), self.value())
16948 }
16949 }
16950
16951 impl std::convert::From<i32> for State {
16952 fn from(value: i32) -> Self {
16953 match value {
16954 0 => Self::Unknown,
16955 1 => Self::Pending,
16956 2 => Self::Running,
16957 3 => Self::Done,
16958 _ => Self::UnknownValue(state::UnknownValue(
16959 wkt::internal::UnknownEnumValue::Integer(value),
16960 )),
16961 }
16962 }
16963 }
16964
16965 impl std::convert::From<&str> for State {
16966 fn from(value: &str) -> Self {
16967 use std::string::ToString;
16968 match value {
16969 "UNKNOWN" => Self::Unknown,
16970 "PENDING" => Self::Pending,
16971 "RUNNING" => Self::Running,
16972 "DONE" => Self::Done,
16973 _ => Self::UnknownValue(state::UnknownValue(
16974 wkt::internal::UnknownEnumValue::String(value.to_string()),
16975 )),
16976 }
16977 }
16978 }
16979
16980 impl serde::ser::Serialize for State {
16981 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16982 where
16983 S: serde::Serializer,
16984 {
16985 match self {
16986 Self::Unknown => serializer.serialize_i32(0),
16987 Self::Pending => serializer.serialize_i32(1),
16988 Self::Running => serializer.serialize_i32(2),
16989 Self::Done => serializer.serialize_i32(3),
16990 Self::UnknownValue(u) => u.0.serialize(serializer),
16991 }
16992 }
16993 }
16994
16995 impl<'de> serde::de::Deserialize<'de> for State {
16996 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16997 where
16998 D: serde::Deserializer<'de>,
16999 {
17000 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17001 ".google.cloud.dataproc.v1.ClusterOperationStatus.State",
17002 ))
17003 }
17004 }
17005}
17006
17007/// Metadata describing the operation.
17008#[derive(Clone, Default, PartialEq)]
17009#[non_exhaustive]
17010pub struct ClusterOperationMetadata {
17011 /// Output only. Name of the cluster for the operation.
17012 pub cluster_name: std::string::String,
17013
17014 /// Output only. Cluster UUID for the operation.
17015 pub cluster_uuid: std::string::String,
17016
17017 /// Output only. Current operation status.
17018 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17019
17020 /// Output only. The previous operation status.
17021 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17022
17023 /// Output only. The operation type.
17024 pub operation_type: std::string::String,
17025
17026 /// Output only. Short description of operation.
17027 pub description: std::string::String,
17028
17029 /// Output only. Labels associated with the operation
17030 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17031
17032 /// Output only. Errors encountered during operation execution.
17033 pub warnings: std::vec::Vec<std::string::String>,
17034
17035 /// Output only. Child operation ids
17036 pub child_operation_ids: std::vec::Vec<std::string::String>,
17037
17038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17039}
17040
17041impl ClusterOperationMetadata {
17042 pub fn new() -> Self {
17043 std::default::Default::default()
17044 }
17045
17046 /// Sets the value of [cluster_name][crate::model::ClusterOperationMetadata::cluster_name].
17047 ///
17048 /// # Example
17049 /// ```ignore,no_run
17050 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17051 /// let x = ClusterOperationMetadata::new().set_cluster_name("example");
17052 /// ```
17053 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17054 self.cluster_name = v.into();
17055 self
17056 }
17057
17058 /// Sets the value of [cluster_uuid][crate::model::ClusterOperationMetadata::cluster_uuid].
17059 ///
17060 /// # Example
17061 /// ```ignore,no_run
17062 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17063 /// let x = ClusterOperationMetadata::new().set_cluster_uuid("example");
17064 /// ```
17065 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17066 self.cluster_uuid = v.into();
17067 self
17068 }
17069
17070 /// Sets the value of [status][crate::model::ClusterOperationMetadata::status].
17071 ///
17072 /// # Example
17073 /// ```ignore,no_run
17074 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17075 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17076 /// let x = ClusterOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17077 /// ```
17078 pub fn set_status<T>(mut self, v: T) -> Self
17079 where
17080 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17081 {
17082 self.status = std::option::Option::Some(v.into());
17083 self
17084 }
17085
17086 /// Sets or clears the value of [status][crate::model::ClusterOperationMetadata::status].
17087 ///
17088 /// # Example
17089 /// ```ignore,no_run
17090 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17091 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17092 /// let x = ClusterOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17093 /// let x = ClusterOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17094 /// ```
17095 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17096 where
17097 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17098 {
17099 self.status = v.map(|x| x.into());
17100 self
17101 }
17102
17103 /// Sets the value of [status_history][crate::model::ClusterOperationMetadata::status_history].
17104 ///
17105 /// # Example
17106 /// ```ignore,no_run
17107 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17108 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17109 /// let x = ClusterOperationMetadata::new()
17110 /// .set_status_history([
17111 /// ClusterOperationStatus::default()/* use setters */,
17112 /// ClusterOperationStatus::default()/* use (different) setters */,
17113 /// ]);
17114 /// ```
17115 pub fn set_status_history<T, V>(mut self, v: T) -> Self
17116 where
17117 T: std::iter::IntoIterator<Item = V>,
17118 V: std::convert::Into<crate::model::ClusterOperationStatus>,
17119 {
17120 use std::iter::Iterator;
17121 self.status_history = v.into_iter().map(|i| i.into()).collect();
17122 self
17123 }
17124
17125 /// Sets the value of [operation_type][crate::model::ClusterOperationMetadata::operation_type].
17126 ///
17127 /// # Example
17128 /// ```ignore,no_run
17129 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17130 /// let x = ClusterOperationMetadata::new().set_operation_type("example");
17131 /// ```
17132 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17133 self.operation_type = v.into();
17134 self
17135 }
17136
17137 /// Sets the value of [description][crate::model::ClusterOperationMetadata::description].
17138 ///
17139 /// # Example
17140 /// ```ignore,no_run
17141 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17142 /// let x = ClusterOperationMetadata::new().set_description("example");
17143 /// ```
17144 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17145 self.description = v.into();
17146 self
17147 }
17148
17149 /// Sets the value of [labels][crate::model::ClusterOperationMetadata::labels].
17150 ///
17151 /// # Example
17152 /// ```ignore,no_run
17153 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17154 /// let x = ClusterOperationMetadata::new().set_labels([
17155 /// ("key0", "abc"),
17156 /// ("key1", "xyz"),
17157 /// ]);
17158 /// ```
17159 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17160 where
17161 T: std::iter::IntoIterator<Item = (K, V)>,
17162 K: std::convert::Into<std::string::String>,
17163 V: std::convert::Into<std::string::String>,
17164 {
17165 use std::iter::Iterator;
17166 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17167 self
17168 }
17169
17170 /// Sets the value of [warnings][crate::model::ClusterOperationMetadata::warnings].
17171 ///
17172 /// # Example
17173 /// ```ignore,no_run
17174 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17175 /// let x = ClusterOperationMetadata::new().set_warnings(["a", "b", "c"]);
17176 /// ```
17177 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17178 where
17179 T: std::iter::IntoIterator<Item = V>,
17180 V: std::convert::Into<std::string::String>,
17181 {
17182 use std::iter::Iterator;
17183 self.warnings = v.into_iter().map(|i| i.into()).collect();
17184 self
17185 }
17186
17187 /// Sets the value of [child_operation_ids][crate::model::ClusterOperationMetadata::child_operation_ids].
17188 ///
17189 /// # Example
17190 /// ```ignore,no_run
17191 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17192 /// let x = ClusterOperationMetadata::new().set_child_operation_ids(["a", "b", "c"]);
17193 /// ```
17194 pub fn set_child_operation_ids<T, V>(mut self, v: T) -> Self
17195 where
17196 T: std::iter::IntoIterator<Item = V>,
17197 V: std::convert::Into<std::string::String>,
17198 {
17199 use std::iter::Iterator;
17200 self.child_operation_ids = v.into_iter().map(|i| i.into()).collect();
17201 self
17202 }
17203}
17204
17205impl wkt::message::Message for ClusterOperationMetadata {
17206 fn typename() -> &'static str {
17207 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationMetadata"
17208 }
17209}
17210
17211/// Metadata describing the node group operation.
17212#[derive(Clone, Default, PartialEq)]
17213#[non_exhaustive]
17214pub struct NodeGroupOperationMetadata {
17215 /// Output only. Node group ID for the operation.
17216 pub node_group_id: std::string::String,
17217
17218 /// Output only. Cluster UUID associated with the node group operation.
17219 pub cluster_uuid: std::string::String,
17220
17221 /// Output only. Current operation status.
17222 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17223
17224 /// Output only. The previous operation status.
17225 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17226
17227 /// The operation type.
17228 pub operation_type: crate::model::node_group_operation_metadata::NodeGroupOperationType,
17229
17230 /// Output only. Short description of operation.
17231 pub description: std::string::String,
17232
17233 /// Output only. Labels associated with the operation.
17234 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17235
17236 /// Output only. Errors encountered during operation execution.
17237 pub warnings: std::vec::Vec<std::string::String>,
17238
17239 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17240}
17241
17242impl NodeGroupOperationMetadata {
17243 pub fn new() -> Self {
17244 std::default::Default::default()
17245 }
17246
17247 /// Sets the value of [node_group_id][crate::model::NodeGroupOperationMetadata::node_group_id].
17248 ///
17249 /// # Example
17250 /// ```ignore,no_run
17251 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17252 /// let x = NodeGroupOperationMetadata::new().set_node_group_id("example");
17253 /// ```
17254 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17255 self.node_group_id = v.into();
17256 self
17257 }
17258
17259 /// Sets the value of [cluster_uuid][crate::model::NodeGroupOperationMetadata::cluster_uuid].
17260 ///
17261 /// # Example
17262 /// ```ignore,no_run
17263 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17264 /// let x = NodeGroupOperationMetadata::new().set_cluster_uuid("example");
17265 /// ```
17266 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17267 self.cluster_uuid = v.into();
17268 self
17269 }
17270
17271 /// Sets the value of [status][crate::model::NodeGroupOperationMetadata::status].
17272 ///
17273 /// # Example
17274 /// ```ignore,no_run
17275 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17276 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17277 /// let x = NodeGroupOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17278 /// ```
17279 pub fn set_status<T>(mut self, v: T) -> Self
17280 where
17281 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17282 {
17283 self.status = std::option::Option::Some(v.into());
17284 self
17285 }
17286
17287 /// Sets or clears the value of [status][crate::model::NodeGroupOperationMetadata::status].
17288 ///
17289 /// # Example
17290 /// ```ignore,no_run
17291 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17292 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17293 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17294 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17295 /// ```
17296 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17297 where
17298 T: std::convert::Into<crate::model::ClusterOperationStatus>,
17299 {
17300 self.status = v.map(|x| x.into());
17301 self
17302 }
17303
17304 /// Sets the value of [status_history][crate::model::NodeGroupOperationMetadata::status_history].
17305 ///
17306 /// # Example
17307 /// ```ignore,no_run
17308 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17309 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17310 /// let x = NodeGroupOperationMetadata::new()
17311 /// .set_status_history([
17312 /// ClusterOperationStatus::default()/* use setters */,
17313 /// ClusterOperationStatus::default()/* use (different) setters */,
17314 /// ]);
17315 /// ```
17316 pub fn set_status_history<T, V>(mut self, v: T) -> Self
17317 where
17318 T: std::iter::IntoIterator<Item = V>,
17319 V: std::convert::Into<crate::model::ClusterOperationStatus>,
17320 {
17321 use std::iter::Iterator;
17322 self.status_history = v.into_iter().map(|i| i.into()).collect();
17323 self
17324 }
17325
17326 /// Sets the value of [operation_type][crate::model::NodeGroupOperationMetadata::operation_type].
17327 ///
17328 /// # Example
17329 /// ```ignore,no_run
17330 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17331 /// use google_cloud_dataproc_v1::model::node_group_operation_metadata::NodeGroupOperationType;
17332 /// let x0 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Create);
17333 /// let x1 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Update);
17334 /// let x2 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Delete);
17335 /// ```
17336 pub fn set_operation_type<
17337 T: std::convert::Into<crate::model::node_group_operation_metadata::NodeGroupOperationType>,
17338 >(
17339 mut self,
17340 v: T,
17341 ) -> Self {
17342 self.operation_type = v.into();
17343 self
17344 }
17345
17346 /// Sets the value of [description][crate::model::NodeGroupOperationMetadata::description].
17347 ///
17348 /// # Example
17349 /// ```ignore,no_run
17350 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17351 /// let x = NodeGroupOperationMetadata::new().set_description("example");
17352 /// ```
17353 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17354 self.description = v.into();
17355 self
17356 }
17357
17358 /// Sets the value of [labels][crate::model::NodeGroupOperationMetadata::labels].
17359 ///
17360 /// # Example
17361 /// ```ignore,no_run
17362 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17363 /// let x = NodeGroupOperationMetadata::new().set_labels([
17364 /// ("key0", "abc"),
17365 /// ("key1", "xyz"),
17366 /// ]);
17367 /// ```
17368 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17369 where
17370 T: std::iter::IntoIterator<Item = (K, V)>,
17371 K: std::convert::Into<std::string::String>,
17372 V: std::convert::Into<std::string::String>,
17373 {
17374 use std::iter::Iterator;
17375 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17376 self
17377 }
17378
17379 /// Sets the value of [warnings][crate::model::NodeGroupOperationMetadata::warnings].
17380 ///
17381 /// # Example
17382 /// ```ignore,no_run
17383 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17384 /// let x = NodeGroupOperationMetadata::new().set_warnings(["a", "b", "c"]);
17385 /// ```
17386 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17387 where
17388 T: std::iter::IntoIterator<Item = V>,
17389 V: std::convert::Into<std::string::String>,
17390 {
17391 use std::iter::Iterator;
17392 self.warnings = v.into_iter().map(|i| i.into()).collect();
17393 self
17394 }
17395}
17396
17397impl wkt::message::Message for NodeGroupOperationMetadata {
17398 fn typename() -> &'static str {
17399 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupOperationMetadata"
17400 }
17401}
17402
17403/// Defines additional types related to [NodeGroupOperationMetadata].
17404pub mod node_group_operation_metadata {
17405 #[allow(unused_imports)]
17406 use super::*;
17407
17408 /// Operation type for node group resources.
17409 ///
17410 /// # Working with unknown values
17411 ///
17412 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17413 /// additional enum variants at any time. Adding new variants is not considered
17414 /// a breaking change. Applications should write their code in anticipation of:
17415 ///
17416 /// - New values appearing in future releases of the client library, **and**
17417 /// - New values received dynamically, without application changes.
17418 ///
17419 /// Please consult the [Working with enums] section in the user guide for some
17420 /// guidelines.
17421 ///
17422 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17423 #[derive(Clone, Debug, PartialEq)]
17424 #[non_exhaustive]
17425 pub enum NodeGroupOperationType {
17426 /// Node group operation type is unknown.
17427 Unspecified,
17428 /// Create node group operation type.
17429 Create,
17430 /// Update node group operation type.
17431 Update,
17432 /// Delete node group operation type.
17433 Delete,
17434 /// Resize node group operation type.
17435 Resize,
17436 /// If set, the enum was initialized with an unknown value.
17437 ///
17438 /// Applications can examine the value using [NodeGroupOperationType::value] or
17439 /// [NodeGroupOperationType::name].
17440 UnknownValue(node_group_operation_type::UnknownValue),
17441 }
17442
17443 #[doc(hidden)]
17444 pub mod node_group_operation_type {
17445 #[allow(unused_imports)]
17446 use super::*;
17447 #[derive(Clone, Debug, PartialEq)]
17448 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17449 }
17450
17451 impl NodeGroupOperationType {
17452 /// Gets the enum value.
17453 ///
17454 /// Returns `None` if the enum contains an unknown value deserialized from
17455 /// the string representation of enums.
17456 pub fn value(&self) -> std::option::Option<i32> {
17457 match self {
17458 Self::Unspecified => std::option::Option::Some(0),
17459 Self::Create => std::option::Option::Some(1),
17460 Self::Update => std::option::Option::Some(2),
17461 Self::Delete => std::option::Option::Some(3),
17462 Self::Resize => std::option::Option::Some(4),
17463 Self::UnknownValue(u) => u.0.value(),
17464 }
17465 }
17466
17467 /// Gets the enum value as a string.
17468 ///
17469 /// Returns `None` if the enum contains an unknown value deserialized from
17470 /// the integer representation of enums.
17471 pub fn name(&self) -> std::option::Option<&str> {
17472 match self {
17473 Self::Unspecified => {
17474 std::option::Option::Some("NODE_GROUP_OPERATION_TYPE_UNSPECIFIED")
17475 }
17476 Self::Create => std::option::Option::Some("CREATE"),
17477 Self::Update => std::option::Option::Some("UPDATE"),
17478 Self::Delete => std::option::Option::Some("DELETE"),
17479 Self::Resize => std::option::Option::Some("RESIZE"),
17480 Self::UnknownValue(u) => u.0.name(),
17481 }
17482 }
17483 }
17484
17485 impl std::default::Default for NodeGroupOperationType {
17486 fn default() -> Self {
17487 use std::convert::From;
17488 Self::from(0)
17489 }
17490 }
17491
17492 impl std::fmt::Display for NodeGroupOperationType {
17493 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17494 wkt::internal::display_enum(f, self.name(), self.value())
17495 }
17496 }
17497
17498 impl std::convert::From<i32> for NodeGroupOperationType {
17499 fn from(value: i32) -> Self {
17500 match value {
17501 0 => Self::Unspecified,
17502 1 => Self::Create,
17503 2 => Self::Update,
17504 3 => Self::Delete,
17505 4 => Self::Resize,
17506 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17507 wkt::internal::UnknownEnumValue::Integer(value),
17508 )),
17509 }
17510 }
17511 }
17512
17513 impl std::convert::From<&str> for NodeGroupOperationType {
17514 fn from(value: &str) -> Self {
17515 use std::string::ToString;
17516 match value {
17517 "NODE_GROUP_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17518 "CREATE" => Self::Create,
17519 "UPDATE" => Self::Update,
17520 "DELETE" => Self::Delete,
17521 "RESIZE" => Self::Resize,
17522 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17523 wkt::internal::UnknownEnumValue::String(value.to_string()),
17524 )),
17525 }
17526 }
17527 }
17528
17529 impl serde::ser::Serialize for NodeGroupOperationType {
17530 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17531 where
17532 S: serde::Serializer,
17533 {
17534 match self {
17535 Self::Unspecified => serializer.serialize_i32(0),
17536 Self::Create => serializer.serialize_i32(1),
17537 Self::Update => serializer.serialize_i32(2),
17538 Self::Delete => serializer.serialize_i32(3),
17539 Self::Resize => serializer.serialize_i32(4),
17540 Self::UnknownValue(u) => u.0.serialize(serializer),
17541 }
17542 }
17543 }
17544
17545 impl<'de> serde::de::Deserialize<'de> for NodeGroupOperationType {
17546 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17547 where
17548 D: serde::Deserializer<'de>,
17549 {
17550 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeGroupOperationType>::new(
17551 ".google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType",
17552 ))
17553 }
17554 }
17555}
17556
17557/// A request to create a session template.
17558#[derive(Clone, Default, PartialEq)]
17559#[non_exhaustive]
17560pub struct CreateSessionTemplateRequest {
17561 /// Required. The parent resource where this session template will be created.
17562 pub parent: std::string::String,
17563
17564 /// Required. The session template to create.
17565 pub session_template: std::option::Option<crate::model::SessionTemplate>,
17566
17567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17568}
17569
17570impl CreateSessionTemplateRequest {
17571 pub fn new() -> Self {
17572 std::default::Default::default()
17573 }
17574
17575 /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
17576 ///
17577 /// # Example
17578 /// ```ignore,no_run
17579 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17580 /// let x = CreateSessionTemplateRequest::new().set_parent("example");
17581 /// ```
17582 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17583 self.parent = v.into();
17584 self
17585 }
17586
17587 /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17588 ///
17589 /// # Example
17590 /// ```ignore,no_run
17591 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17592 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17593 /// let x = CreateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17594 /// ```
17595 pub fn set_session_template<T>(mut self, v: T) -> Self
17596 where
17597 T: std::convert::Into<crate::model::SessionTemplate>,
17598 {
17599 self.session_template = std::option::Option::Some(v.into());
17600 self
17601 }
17602
17603 /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17604 ///
17605 /// # Example
17606 /// ```ignore,no_run
17607 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17608 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17609 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17610 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17611 /// ```
17612 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17613 where
17614 T: std::convert::Into<crate::model::SessionTemplate>,
17615 {
17616 self.session_template = v.map(|x| x.into());
17617 self
17618 }
17619}
17620
17621impl wkt::message::Message for CreateSessionTemplateRequest {
17622 fn typename() -> &'static str {
17623 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionTemplateRequest"
17624 }
17625}
17626
17627/// A request to update a session template.
17628#[derive(Clone, Default, PartialEq)]
17629#[non_exhaustive]
17630pub struct UpdateSessionTemplateRequest {
17631 /// Required. The updated session template.
17632 pub session_template: std::option::Option<crate::model::SessionTemplate>,
17633
17634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17635}
17636
17637impl UpdateSessionTemplateRequest {
17638 pub fn new() -> Self {
17639 std::default::Default::default()
17640 }
17641
17642 /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17643 ///
17644 /// # Example
17645 /// ```ignore,no_run
17646 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17647 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17648 /// let x = UpdateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17649 /// ```
17650 pub fn set_session_template<T>(mut self, v: T) -> Self
17651 where
17652 T: std::convert::Into<crate::model::SessionTemplate>,
17653 {
17654 self.session_template = std::option::Option::Some(v.into());
17655 self
17656 }
17657
17658 /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17659 ///
17660 /// # Example
17661 /// ```ignore,no_run
17662 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17663 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17664 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17665 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17666 /// ```
17667 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17668 where
17669 T: std::convert::Into<crate::model::SessionTemplate>,
17670 {
17671 self.session_template = v.map(|x| x.into());
17672 self
17673 }
17674}
17675
17676impl wkt::message::Message for UpdateSessionTemplateRequest {
17677 fn typename() -> &'static str {
17678 "type.googleapis.com/google.cloud.dataproc.v1.UpdateSessionTemplateRequest"
17679 }
17680}
17681
17682/// A request to get the resource representation for a session template.
17683#[derive(Clone, Default, PartialEq)]
17684#[non_exhaustive]
17685pub struct GetSessionTemplateRequest {
17686 /// Required. The name of the session template to retrieve.
17687 pub name: std::string::String,
17688
17689 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17690}
17691
17692impl GetSessionTemplateRequest {
17693 pub fn new() -> Self {
17694 std::default::Default::default()
17695 }
17696
17697 /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
17698 ///
17699 /// # Example
17700 /// ```ignore,no_run
17701 /// # use google_cloud_dataproc_v1::model::GetSessionTemplateRequest;
17702 /// let x = GetSessionTemplateRequest::new().set_name("example");
17703 /// ```
17704 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17705 self.name = v.into();
17706 self
17707 }
17708}
17709
17710impl wkt::message::Message for GetSessionTemplateRequest {
17711 fn typename() -> &'static str {
17712 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionTemplateRequest"
17713 }
17714}
17715
17716/// A request to list session templates in a project.
17717#[derive(Clone, Default, PartialEq)]
17718#[non_exhaustive]
17719pub struct ListSessionTemplatesRequest {
17720 /// Required. The parent that owns this collection of session templates.
17721 pub parent: std::string::String,
17722
17723 /// Optional. The maximum number of sessions to return in each response.
17724 /// The service may return fewer than this value.
17725 pub page_size: i32,
17726
17727 /// Optional. A page token received from a previous `ListSessions` call.
17728 /// Provide this token to retrieve the subsequent page.
17729 pub page_token: std::string::String,
17730
17731 /// Optional. A filter for the session templates to return in the response.
17732 /// Filters are case sensitive and have the following syntax:
17733 ///
17734 /// [field = value] AND [field [= value]] ...
17735 pub filter: std::string::String,
17736
17737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17738}
17739
17740impl ListSessionTemplatesRequest {
17741 pub fn new() -> Self {
17742 std::default::Default::default()
17743 }
17744
17745 /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
17746 ///
17747 /// # Example
17748 /// ```ignore,no_run
17749 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17750 /// let x = ListSessionTemplatesRequest::new().set_parent("example");
17751 /// ```
17752 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17753 self.parent = v.into();
17754 self
17755 }
17756
17757 /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
17758 ///
17759 /// # Example
17760 /// ```ignore,no_run
17761 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17762 /// let x = ListSessionTemplatesRequest::new().set_page_size(42);
17763 /// ```
17764 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17765 self.page_size = v.into();
17766 self
17767 }
17768
17769 /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
17770 ///
17771 /// # Example
17772 /// ```ignore,no_run
17773 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17774 /// let x = ListSessionTemplatesRequest::new().set_page_token("example");
17775 /// ```
17776 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17777 self.page_token = v.into();
17778 self
17779 }
17780
17781 /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
17782 ///
17783 /// # Example
17784 /// ```ignore,no_run
17785 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17786 /// let x = ListSessionTemplatesRequest::new().set_filter("example");
17787 /// ```
17788 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17789 self.filter = v.into();
17790 self
17791 }
17792}
17793
17794impl wkt::message::Message for ListSessionTemplatesRequest {
17795 fn typename() -> &'static str {
17796 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesRequest"
17797 }
17798}
17799
17800/// A list of session templates.
17801#[derive(Clone, Default, PartialEq)]
17802#[non_exhaustive]
17803pub struct ListSessionTemplatesResponse {
17804 /// Output only. Session template list
17805 pub session_templates: std::vec::Vec<crate::model::SessionTemplate>,
17806
17807 /// A token, which can be sent as `page_token` to retrieve the next page.
17808 /// If this field is omitted, there are no subsequent pages.
17809 pub next_page_token: std::string::String,
17810
17811 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17812}
17813
17814impl ListSessionTemplatesResponse {
17815 pub fn new() -> Self {
17816 std::default::Default::default()
17817 }
17818
17819 /// Sets the value of [session_templates][crate::model::ListSessionTemplatesResponse::session_templates].
17820 ///
17821 /// # Example
17822 /// ```ignore,no_run
17823 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17824 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17825 /// let x = ListSessionTemplatesResponse::new()
17826 /// .set_session_templates([
17827 /// SessionTemplate::default()/* use setters */,
17828 /// SessionTemplate::default()/* use (different) setters */,
17829 /// ]);
17830 /// ```
17831 pub fn set_session_templates<T, V>(mut self, v: T) -> Self
17832 where
17833 T: std::iter::IntoIterator<Item = V>,
17834 V: std::convert::Into<crate::model::SessionTemplate>,
17835 {
17836 use std::iter::Iterator;
17837 self.session_templates = v.into_iter().map(|i| i.into()).collect();
17838 self
17839 }
17840
17841 /// Sets the value of [next_page_token][crate::model::ListSessionTemplatesResponse::next_page_token].
17842 ///
17843 /// # Example
17844 /// ```ignore,no_run
17845 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17846 /// let x = ListSessionTemplatesResponse::new().set_next_page_token("example");
17847 /// ```
17848 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17849 self.next_page_token = v.into();
17850 self
17851 }
17852}
17853
17854impl wkt::message::Message for ListSessionTemplatesResponse {
17855 fn typename() -> &'static str {
17856 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesResponse"
17857 }
17858}
17859
17860#[doc(hidden)]
17861impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionTemplatesResponse {
17862 type PageItem = crate::model::SessionTemplate;
17863
17864 fn items(self) -> std::vec::Vec<Self::PageItem> {
17865 self.session_templates
17866 }
17867
17868 fn next_page_token(&self) -> std::string::String {
17869 use std::clone::Clone;
17870 self.next_page_token.clone()
17871 }
17872}
17873
17874/// A request to delete a session template.
17875#[derive(Clone, Default, PartialEq)]
17876#[non_exhaustive]
17877pub struct DeleteSessionTemplateRequest {
17878 /// Required. The name of the session template resource to delete.
17879 pub name: std::string::String,
17880
17881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17882}
17883
17884impl DeleteSessionTemplateRequest {
17885 pub fn new() -> Self {
17886 std::default::Default::default()
17887 }
17888
17889 /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
17890 ///
17891 /// # Example
17892 /// ```ignore,no_run
17893 /// # use google_cloud_dataproc_v1::model::DeleteSessionTemplateRequest;
17894 /// let x = DeleteSessionTemplateRequest::new().set_name("example");
17895 /// ```
17896 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17897 self.name = v.into();
17898 self
17899 }
17900}
17901
17902impl wkt::message::Message for DeleteSessionTemplateRequest {
17903 fn typename() -> &'static str {
17904 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionTemplateRequest"
17905 }
17906}
17907
17908/// A representation of a session template.
17909#[derive(Clone, Default, PartialEq)]
17910#[non_exhaustive]
17911pub struct SessionTemplate {
17912 /// Required. The resource name of the session template.
17913 pub name: std::string::String,
17914
17915 /// Optional. Brief description of the template.
17916 pub description: std::string::String,
17917
17918 /// Output only. The time when the template was created.
17919 pub create_time: std::option::Option<wkt::Timestamp>,
17920
17921 /// Output only. The email address of the user who created the template.
17922 pub creator: std::string::String,
17923
17924 /// Optional. Labels to associate with sessions created using this template.
17925 /// Label **keys** must contain 1 to 63 characters, and must conform to
17926 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
17927 /// Label **values** can be empty, but, if present, must contain 1 to 63
17928 /// characters and conform to [RFC
17929 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
17930 /// associated with a session.
17931 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17932
17933 /// Optional. Runtime configuration for session execution.
17934 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
17935
17936 /// Optional. Environment configuration for session execution.
17937 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
17938
17939 /// Output only. The time the template was last updated.
17940 pub update_time: std::option::Option<wkt::Timestamp>,
17941
17942 /// Output only. A session template UUID (Unique Universal Identifier). The
17943 /// service generates this value when it creates the session template.
17944 pub uuid: std::string::String,
17945
17946 /// The session configuration.
17947 pub session_config: std::option::Option<crate::model::session_template::SessionConfig>,
17948
17949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17950}
17951
17952impl SessionTemplate {
17953 pub fn new() -> Self {
17954 std::default::Default::default()
17955 }
17956
17957 /// Sets the value of [name][crate::model::SessionTemplate::name].
17958 ///
17959 /// # Example
17960 /// ```ignore,no_run
17961 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17962 /// let x = SessionTemplate::new().set_name("example");
17963 /// ```
17964 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17965 self.name = v.into();
17966 self
17967 }
17968
17969 /// Sets the value of [description][crate::model::SessionTemplate::description].
17970 ///
17971 /// # Example
17972 /// ```ignore,no_run
17973 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17974 /// let x = SessionTemplate::new().set_description("example");
17975 /// ```
17976 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17977 self.description = v.into();
17978 self
17979 }
17980
17981 /// Sets the value of [create_time][crate::model::SessionTemplate::create_time].
17982 ///
17983 /// # Example
17984 /// ```ignore,no_run
17985 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17986 /// use wkt::Timestamp;
17987 /// let x = SessionTemplate::new().set_create_time(Timestamp::default()/* use setters */);
17988 /// ```
17989 pub fn set_create_time<T>(mut self, v: T) -> Self
17990 where
17991 T: std::convert::Into<wkt::Timestamp>,
17992 {
17993 self.create_time = std::option::Option::Some(v.into());
17994 self
17995 }
17996
17997 /// Sets or clears the value of [create_time][crate::model::SessionTemplate::create_time].
17998 ///
17999 /// # Example
18000 /// ```ignore,no_run
18001 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18002 /// use wkt::Timestamp;
18003 /// let x = SessionTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18004 /// let x = SessionTemplate::new().set_or_clear_create_time(None::<Timestamp>);
18005 /// ```
18006 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18007 where
18008 T: std::convert::Into<wkt::Timestamp>,
18009 {
18010 self.create_time = v.map(|x| x.into());
18011 self
18012 }
18013
18014 /// Sets the value of [creator][crate::model::SessionTemplate::creator].
18015 ///
18016 /// # Example
18017 /// ```ignore,no_run
18018 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18019 /// let x = SessionTemplate::new().set_creator("example");
18020 /// ```
18021 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18022 self.creator = v.into();
18023 self
18024 }
18025
18026 /// Sets the value of [labels][crate::model::SessionTemplate::labels].
18027 ///
18028 /// # Example
18029 /// ```ignore,no_run
18030 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18031 /// let x = SessionTemplate::new().set_labels([
18032 /// ("key0", "abc"),
18033 /// ("key1", "xyz"),
18034 /// ]);
18035 /// ```
18036 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18037 where
18038 T: std::iter::IntoIterator<Item = (K, V)>,
18039 K: std::convert::Into<std::string::String>,
18040 V: std::convert::Into<std::string::String>,
18041 {
18042 use std::iter::Iterator;
18043 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18044 self
18045 }
18046
18047 /// Sets the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18048 ///
18049 /// # Example
18050 /// ```ignore,no_run
18051 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18052 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18053 /// let x = SessionTemplate::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18054 /// ```
18055 pub fn set_runtime_config<T>(mut self, v: T) -> Self
18056 where
18057 T: std::convert::Into<crate::model::RuntimeConfig>,
18058 {
18059 self.runtime_config = std::option::Option::Some(v.into());
18060 self
18061 }
18062
18063 /// Sets or clears the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18064 ///
18065 /// # Example
18066 /// ```ignore,no_run
18067 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18068 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18069 /// let x = SessionTemplate::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
18070 /// let x = SessionTemplate::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
18071 /// ```
18072 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
18073 where
18074 T: std::convert::Into<crate::model::RuntimeConfig>,
18075 {
18076 self.runtime_config = v.map(|x| x.into());
18077 self
18078 }
18079
18080 /// Sets the value of [environment_config][crate::model::SessionTemplate::environment_config].
18081 ///
18082 /// # Example
18083 /// ```ignore,no_run
18084 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18085 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18086 /// let x = SessionTemplate::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
18087 /// ```
18088 pub fn set_environment_config<T>(mut self, v: T) -> Self
18089 where
18090 T: std::convert::Into<crate::model::EnvironmentConfig>,
18091 {
18092 self.environment_config = std::option::Option::Some(v.into());
18093 self
18094 }
18095
18096 /// Sets or clears the value of [environment_config][crate::model::SessionTemplate::environment_config].
18097 ///
18098 /// # Example
18099 /// ```ignore,no_run
18100 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18101 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18102 /// let x = SessionTemplate::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
18103 /// let x = SessionTemplate::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
18104 /// ```
18105 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
18106 where
18107 T: std::convert::Into<crate::model::EnvironmentConfig>,
18108 {
18109 self.environment_config = v.map(|x| x.into());
18110 self
18111 }
18112
18113 /// Sets the value of [update_time][crate::model::SessionTemplate::update_time].
18114 ///
18115 /// # Example
18116 /// ```ignore,no_run
18117 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18118 /// use wkt::Timestamp;
18119 /// let x = SessionTemplate::new().set_update_time(Timestamp::default()/* use setters */);
18120 /// ```
18121 pub fn set_update_time<T>(mut self, v: T) -> Self
18122 where
18123 T: std::convert::Into<wkt::Timestamp>,
18124 {
18125 self.update_time = std::option::Option::Some(v.into());
18126 self
18127 }
18128
18129 /// Sets or clears the value of [update_time][crate::model::SessionTemplate::update_time].
18130 ///
18131 /// # Example
18132 /// ```ignore,no_run
18133 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18134 /// use wkt::Timestamp;
18135 /// let x = SessionTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
18136 /// let x = SessionTemplate::new().set_or_clear_update_time(None::<Timestamp>);
18137 /// ```
18138 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
18139 where
18140 T: std::convert::Into<wkt::Timestamp>,
18141 {
18142 self.update_time = v.map(|x| x.into());
18143 self
18144 }
18145
18146 /// Sets the value of [uuid][crate::model::SessionTemplate::uuid].
18147 ///
18148 /// # Example
18149 /// ```ignore,no_run
18150 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18151 /// let x = SessionTemplate::new().set_uuid("example");
18152 /// ```
18153 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18154 self.uuid = v.into();
18155 self
18156 }
18157
18158 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config].
18159 ///
18160 /// Note that all the setters affecting `session_config` are mutually
18161 /// exclusive.
18162 ///
18163 /// # Example
18164 /// ```ignore,no_run
18165 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18166 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18167 /// let x = SessionTemplate::new().set_session_config(Some(
18168 /// google_cloud_dataproc_v1::model::session_template::SessionConfig::JupyterSession(JupyterConfig::default().into())));
18169 /// ```
18170 pub fn set_session_config<
18171 T: std::convert::Into<std::option::Option<crate::model::session_template::SessionConfig>>,
18172 >(
18173 mut self,
18174 v: T,
18175 ) -> Self {
18176 self.session_config = v.into();
18177 self
18178 }
18179
18180 /// The value of [session_config][crate::model::SessionTemplate::session_config]
18181 /// if it holds a `JupyterSession`, `None` if the field is not set or
18182 /// holds a different branch.
18183 pub fn jupyter_session(
18184 &self,
18185 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
18186 #[allow(unreachable_patterns)]
18187 self.session_config.as_ref().and_then(|v| match v {
18188 crate::model::session_template::SessionConfig::JupyterSession(v) => {
18189 std::option::Option::Some(v)
18190 }
18191 _ => std::option::Option::None,
18192 })
18193 }
18194
18195 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18196 /// to hold a `JupyterSession`.
18197 ///
18198 /// Note that all the setters affecting `session_config` are
18199 /// mutually exclusive.
18200 ///
18201 /// # Example
18202 /// ```ignore,no_run
18203 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18204 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18205 /// let x = SessionTemplate::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
18206 /// assert!(x.jupyter_session().is_some());
18207 /// assert!(x.spark_connect_session().is_none());
18208 /// ```
18209 pub fn set_jupyter_session<
18210 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
18211 >(
18212 mut self,
18213 v: T,
18214 ) -> Self {
18215 self.session_config = std::option::Option::Some(
18216 crate::model::session_template::SessionConfig::JupyterSession(v.into()),
18217 );
18218 self
18219 }
18220
18221 /// The value of [session_config][crate::model::SessionTemplate::session_config]
18222 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
18223 /// holds a different branch.
18224 pub fn spark_connect_session(
18225 &self,
18226 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
18227 #[allow(unreachable_patterns)]
18228 self.session_config.as_ref().and_then(|v| match v {
18229 crate::model::session_template::SessionConfig::SparkConnectSession(v) => {
18230 std::option::Option::Some(v)
18231 }
18232 _ => std::option::Option::None,
18233 })
18234 }
18235
18236 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18237 /// to hold a `SparkConnectSession`.
18238 ///
18239 /// Note that all the setters affecting `session_config` are
18240 /// mutually exclusive.
18241 ///
18242 /// # Example
18243 /// ```ignore,no_run
18244 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18245 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
18246 /// let x = SessionTemplate::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
18247 /// assert!(x.spark_connect_session().is_some());
18248 /// assert!(x.jupyter_session().is_none());
18249 /// ```
18250 pub fn set_spark_connect_session<
18251 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
18252 >(
18253 mut self,
18254 v: T,
18255 ) -> Self {
18256 self.session_config = std::option::Option::Some(
18257 crate::model::session_template::SessionConfig::SparkConnectSession(v.into()),
18258 );
18259 self
18260 }
18261}
18262
18263impl wkt::message::Message for SessionTemplate {
18264 fn typename() -> &'static str {
18265 "type.googleapis.com/google.cloud.dataproc.v1.SessionTemplate"
18266 }
18267}
18268
18269/// Defines additional types related to [SessionTemplate].
18270pub mod session_template {
18271 #[allow(unused_imports)]
18272 use super::*;
18273
18274 /// The session configuration.
18275 #[derive(Clone, Debug, PartialEq)]
18276 #[non_exhaustive]
18277 pub enum SessionConfig {
18278 /// Optional. Jupyter session config.
18279 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
18280 /// Optional. Spark Connect session config.
18281 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
18282 }
18283}
18284
18285/// A request to create a session.
18286#[derive(Clone, Default, PartialEq)]
18287#[non_exhaustive]
18288pub struct CreateSessionRequest {
18289 /// Required. The parent resource where this session will be created.
18290 pub parent: std::string::String,
18291
18292 /// Required. The interactive session to create.
18293 pub session: std::option::Option<crate::model::Session>,
18294
18295 /// Required. The ID to use for the session, which becomes the final component
18296 /// of the session's resource name.
18297 ///
18298 /// This value must be 4-63 characters. Valid characters
18299 /// are /[a-z][0-9]-/.
18300 pub session_id: std::string::String,
18301
18302 /// Optional. A unique ID used to identify the request. If the service
18303 /// receives two
18304 /// [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
18305 /// with the same ID, the second request is ignored, and the
18306 /// first [Session][google.cloud.dataproc.v1.Session] is created and stored in
18307 /// the backend.
18308 ///
18309 /// Recommendation: Set this value to a
18310 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18311 ///
18312 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18313 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18314 ///
18315 /// [google.cloud.dataproc.v1.Session]: crate::model::Session
18316 pub request_id: std::string::String,
18317
18318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18319}
18320
18321impl CreateSessionRequest {
18322 pub fn new() -> Self {
18323 std::default::Default::default()
18324 }
18325
18326 /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
18327 ///
18328 /// # Example
18329 /// ```ignore,no_run
18330 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18331 /// let x = CreateSessionRequest::new().set_parent("example");
18332 /// ```
18333 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18334 self.parent = v.into();
18335 self
18336 }
18337
18338 /// Sets the value of [session][crate::model::CreateSessionRequest::session].
18339 ///
18340 /// # Example
18341 /// ```ignore,no_run
18342 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18343 /// use google_cloud_dataproc_v1::model::Session;
18344 /// let x = CreateSessionRequest::new().set_session(Session::default()/* use setters */);
18345 /// ```
18346 pub fn set_session<T>(mut self, v: T) -> Self
18347 where
18348 T: std::convert::Into<crate::model::Session>,
18349 {
18350 self.session = std::option::Option::Some(v.into());
18351 self
18352 }
18353
18354 /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
18355 ///
18356 /// # Example
18357 /// ```ignore,no_run
18358 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18359 /// use google_cloud_dataproc_v1::model::Session;
18360 /// let x = CreateSessionRequest::new().set_or_clear_session(Some(Session::default()/* use setters */));
18361 /// let x = CreateSessionRequest::new().set_or_clear_session(None::<Session>);
18362 /// ```
18363 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
18364 where
18365 T: std::convert::Into<crate::model::Session>,
18366 {
18367 self.session = v.map(|x| x.into());
18368 self
18369 }
18370
18371 /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
18372 ///
18373 /// # Example
18374 /// ```ignore,no_run
18375 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18376 /// let x = CreateSessionRequest::new().set_session_id("example");
18377 /// ```
18378 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18379 self.session_id = v.into();
18380 self
18381 }
18382
18383 /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
18384 ///
18385 /// # Example
18386 /// ```ignore,no_run
18387 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18388 /// let x = CreateSessionRequest::new().set_request_id("example");
18389 /// ```
18390 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18391 self.request_id = v.into();
18392 self
18393 }
18394}
18395
18396impl wkt::message::Message for CreateSessionRequest {
18397 fn typename() -> &'static str {
18398 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionRequest"
18399 }
18400}
18401
18402/// A request to get the resource representation for a session.
18403#[derive(Clone, Default, PartialEq)]
18404#[non_exhaustive]
18405pub struct GetSessionRequest {
18406 /// Required. The name of the session to retrieve.
18407 pub name: std::string::String,
18408
18409 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18410}
18411
18412impl GetSessionRequest {
18413 pub fn new() -> Self {
18414 std::default::Default::default()
18415 }
18416
18417 /// Sets the value of [name][crate::model::GetSessionRequest::name].
18418 ///
18419 /// # Example
18420 /// ```ignore,no_run
18421 /// # use google_cloud_dataproc_v1::model::GetSessionRequest;
18422 /// let x = GetSessionRequest::new().set_name("example");
18423 /// ```
18424 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18425 self.name = v.into();
18426 self
18427 }
18428}
18429
18430impl wkt::message::Message for GetSessionRequest {
18431 fn typename() -> &'static str {
18432 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionRequest"
18433 }
18434}
18435
18436/// A request to list sessions in a project.
18437#[derive(Clone, Default, PartialEq)]
18438#[non_exhaustive]
18439pub struct ListSessionsRequest {
18440 /// Required. The parent, which owns this collection of sessions.
18441 pub parent: std::string::String,
18442
18443 /// Optional. The maximum number of sessions to return in each response.
18444 /// The service may return fewer than this value.
18445 pub page_size: i32,
18446
18447 /// Optional. A page token received from a previous `ListSessions` call.
18448 /// Provide this token to retrieve the subsequent page.
18449 pub page_token: std::string::String,
18450
18451 /// Optional. A filter for the sessions to return in the response.
18452 ///
18453 /// A filter is a logical expression constraining the values of various fields
18454 /// in each session resource. Filters are case sensitive, and may contain
18455 /// multiple clauses combined with logical operators (AND, OR).
18456 /// Supported fields are `session_id`, `session_uuid`, `state`, `create_time`,
18457 /// and `labels`.
18458 ///
18459 /// Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
18460 /// is a filter for sessions in an ACTIVE state that were created before
18461 /// 2023-01-01. `state = ACTIVE and labels.environment=production` is a filter
18462 /// for sessions in an ACTIVE state that have a production environment label.
18463 ///
18464 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
18465 /// description of the filter syntax and a list of supported comparators.
18466 pub filter: std::string::String,
18467
18468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18469}
18470
18471impl ListSessionsRequest {
18472 pub fn new() -> Self {
18473 std::default::Default::default()
18474 }
18475
18476 /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
18477 ///
18478 /// # Example
18479 /// ```ignore,no_run
18480 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18481 /// let x = ListSessionsRequest::new().set_parent("example");
18482 /// ```
18483 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18484 self.parent = v.into();
18485 self
18486 }
18487
18488 /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
18489 ///
18490 /// # Example
18491 /// ```ignore,no_run
18492 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18493 /// let x = ListSessionsRequest::new().set_page_size(42);
18494 /// ```
18495 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18496 self.page_size = v.into();
18497 self
18498 }
18499
18500 /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
18501 ///
18502 /// # Example
18503 /// ```ignore,no_run
18504 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18505 /// let x = ListSessionsRequest::new().set_page_token("example");
18506 /// ```
18507 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18508 self.page_token = v.into();
18509 self
18510 }
18511
18512 /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
18513 ///
18514 /// # Example
18515 /// ```ignore,no_run
18516 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18517 /// let x = ListSessionsRequest::new().set_filter("example");
18518 /// ```
18519 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18520 self.filter = v.into();
18521 self
18522 }
18523}
18524
18525impl wkt::message::Message for ListSessionsRequest {
18526 fn typename() -> &'static str {
18527 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsRequest"
18528 }
18529}
18530
18531/// A list of interactive sessions.
18532#[derive(Clone, Default, PartialEq)]
18533#[non_exhaustive]
18534pub struct ListSessionsResponse {
18535 /// Output only. The sessions from the specified collection.
18536 pub sessions: std::vec::Vec<crate::model::Session>,
18537
18538 /// A token, which can be sent as `page_token`, to retrieve the next page.
18539 /// If this field is omitted, there are no subsequent pages.
18540 pub next_page_token: std::string::String,
18541
18542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18543}
18544
18545impl ListSessionsResponse {
18546 pub fn new() -> Self {
18547 std::default::Default::default()
18548 }
18549
18550 /// Sets the value of [sessions][crate::model::ListSessionsResponse::sessions].
18551 ///
18552 /// # Example
18553 /// ```ignore,no_run
18554 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18555 /// use google_cloud_dataproc_v1::model::Session;
18556 /// let x = ListSessionsResponse::new()
18557 /// .set_sessions([
18558 /// Session::default()/* use setters */,
18559 /// Session::default()/* use (different) setters */,
18560 /// ]);
18561 /// ```
18562 pub fn set_sessions<T, V>(mut self, v: T) -> Self
18563 where
18564 T: std::iter::IntoIterator<Item = V>,
18565 V: std::convert::Into<crate::model::Session>,
18566 {
18567 use std::iter::Iterator;
18568 self.sessions = v.into_iter().map(|i| i.into()).collect();
18569 self
18570 }
18571
18572 /// Sets the value of [next_page_token][crate::model::ListSessionsResponse::next_page_token].
18573 ///
18574 /// # Example
18575 /// ```ignore,no_run
18576 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18577 /// let x = ListSessionsResponse::new().set_next_page_token("example");
18578 /// ```
18579 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18580 self.next_page_token = v.into();
18581 self
18582 }
18583}
18584
18585impl wkt::message::Message for ListSessionsResponse {
18586 fn typename() -> &'static str {
18587 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsResponse"
18588 }
18589}
18590
18591#[doc(hidden)]
18592impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionsResponse {
18593 type PageItem = crate::model::Session;
18594
18595 fn items(self) -> std::vec::Vec<Self::PageItem> {
18596 self.sessions
18597 }
18598
18599 fn next_page_token(&self) -> std::string::String {
18600 use std::clone::Clone;
18601 self.next_page_token.clone()
18602 }
18603}
18604
18605/// A request to terminate an interactive session.
18606#[derive(Clone, Default, PartialEq)]
18607#[non_exhaustive]
18608pub struct TerminateSessionRequest {
18609 /// Required. The name of the session resource to terminate.
18610 pub name: std::string::String,
18611
18612 /// Optional. A unique ID used to identify the request. If the service
18613 /// receives two
18614 /// [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
18615 /// with the same ID, the second request is ignored.
18616 ///
18617 /// Recommendation: Set this value to a
18618 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18619 ///
18620 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18621 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18622 pub request_id: std::string::String,
18623
18624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18625}
18626
18627impl TerminateSessionRequest {
18628 pub fn new() -> Self {
18629 std::default::Default::default()
18630 }
18631
18632 /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
18633 ///
18634 /// # Example
18635 /// ```ignore,no_run
18636 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18637 /// let x = TerminateSessionRequest::new().set_name("example");
18638 /// ```
18639 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18640 self.name = v.into();
18641 self
18642 }
18643
18644 /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
18645 ///
18646 /// # Example
18647 /// ```ignore,no_run
18648 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18649 /// let x = TerminateSessionRequest::new().set_request_id("example");
18650 /// ```
18651 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18652 self.request_id = v.into();
18653 self
18654 }
18655}
18656
18657impl wkt::message::Message for TerminateSessionRequest {
18658 fn typename() -> &'static str {
18659 "type.googleapis.com/google.cloud.dataproc.v1.TerminateSessionRequest"
18660 }
18661}
18662
18663/// A request to delete a session.
18664#[derive(Clone, Default, PartialEq)]
18665#[non_exhaustive]
18666pub struct DeleteSessionRequest {
18667 /// Required. The name of the session resource to delete.
18668 pub name: std::string::String,
18669
18670 /// Optional. A unique ID used to identify the request. If the service
18671 /// receives two
18672 /// [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
18673 /// with the same ID, the second request is ignored.
18674 ///
18675 /// Recommendation: Set this value to a
18676 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18677 ///
18678 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18679 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18680 pub request_id: std::string::String,
18681
18682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18683}
18684
18685impl DeleteSessionRequest {
18686 pub fn new() -> Self {
18687 std::default::Default::default()
18688 }
18689
18690 /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
18691 ///
18692 /// # Example
18693 /// ```ignore,no_run
18694 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18695 /// let x = DeleteSessionRequest::new().set_name("example");
18696 /// ```
18697 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18698 self.name = v.into();
18699 self
18700 }
18701
18702 /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
18703 ///
18704 /// # Example
18705 /// ```ignore,no_run
18706 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18707 /// let x = DeleteSessionRequest::new().set_request_id("example");
18708 /// ```
18709 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18710 self.request_id = v.into();
18711 self
18712 }
18713}
18714
18715impl wkt::message::Message for DeleteSessionRequest {
18716 fn typename() -> &'static str {
18717 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionRequest"
18718 }
18719}
18720
18721/// A representation of a session.
18722#[derive(Clone, Default, PartialEq)]
18723#[non_exhaustive]
18724pub struct Session {
18725 /// Required. The resource name of the session.
18726 pub name: std::string::String,
18727
18728 /// Output only. A session UUID (Unique Universal Identifier). The service
18729 /// generates this value when it creates the session.
18730 pub uuid: std::string::String,
18731
18732 /// Output only. The time when the session was created.
18733 pub create_time: std::option::Option<wkt::Timestamp>,
18734
18735 /// Output only. Runtime information about session execution.
18736 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
18737
18738 /// Output only. A state of the session.
18739 pub state: crate::model::session::State,
18740
18741 /// Output only. Session state details, such as the failure
18742 /// description if the state is `FAILED`.
18743 pub state_message: std::string::String,
18744
18745 /// Output only. The time when the session entered the current state.
18746 pub state_time: std::option::Option<wkt::Timestamp>,
18747
18748 /// Output only. The email address of the user who created the session.
18749 pub creator: std::string::String,
18750
18751 /// Optional. The labels to associate with the session.
18752 /// Label **keys** must contain 1 to 63 characters, and must conform to
18753 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
18754 /// Label **values** may be empty, but, if present, must contain 1 to 63
18755 /// characters, and must conform to [RFC
18756 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
18757 /// associated with a session.
18758 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18759
18760 /// Optional. Runtime configuration for the session execution.
18761 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
18762
18763 /// Optional. Environment configuration for the session execution.
18764 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
18765
18766 /// Optional. The email address of the user who owns the session.
18767 pub user: std::string::String,
18768
18769 /// Output only. Historical state information for the session.
18770 pub state_history: std::vec::Vec<crate::model::session::SessionStateHistory>,
18771
18772 /// Optional. The session template used by the session.
18773 ///
18774 /// Only resource names, including project ID and location, are valid.
18775 ///
18776 /// Example:
18777 ///
18778 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18779 /// * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18780 ///
18781 /// The template must be in the same project and Dataproc region as the
18782 /// session.
18783 pub session_template: std::string::String,
18784
18785 /// The session configuration.
18786 pub session_config: std::option::Option<crate::model::session::SessionConfig>,
18787
18788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18789}
18790
18791impl Session {
18792 pub fn new() -> Self {
18793 std::default::Default::default()
18794 }
18795
18796 /// Sets the value of [name][crate::model::Session::name].
18797 ///
18798 /// # Example
18799 /// ```ignore,no_run
18800 /// # use google_cloud_dataproc_v1::model::Session;
18801 /// let x = Session::new().set_name("example");
18802 /// ```
18803 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18804 self.name = v.into();
18805 self
18806 }
18807
18808 /// Sets the value of [uuid][crate::model::Session::uuid].
18809 ///
18810 /// # Example
18811 /// ```ignore,no_run
18812 /// # use google_cloud_dataproc_v1::model::Session;
18813 /// let x = Session::new().set_uuid("example");
18814 /// ```
18815 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18816 self.uuid = v.into();
18817 self
18818 }
18819
18820 /// Sets the value of [create_time][crate::model::Session::create_time].
18821 ///
18822 /// # Example
18823 /// ```ignore,no_run
18824 /// # use google_cloud_dataproc_v1::model::Session;
18825 /// use wkt::Timestamp;
18826 /// let x = Session::new().set_create_time(Timestamp::default()/* use setters */);
18827 /// ```
18828 pub fn set_create_time<T>(mut self, v: T) -> Self
18829 where
18830 T: std::convert::Into<wkt::Timestamp>,
18831 {
18832 self.create_time = std::option::Option::Some(v.into());
18833 self
18834 }
18835
18836 /// Sets or clears the value of [create_time][crate::model::Session::create_time].
18837 ///
18838 /// # Example
18839 /// ```ignore,no_run
18840 /// # use google_cloud_dataproc_v1::model::Session;
18841 /// use wkt::Timestamp;
18842 /// let x = Session::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18843 /// let x = Session::new().set_or_clear_create_time(None::<Timestamp>);
18844 /// ```
18845 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18846 where
18847 T: std::convert::Into<wkt::Timestamp>,
18848 {
18849 self.create_time = v.map(|x| x.into());
18850 self
18851 }
18852
18853 /// Sets the value of [runtime_info][crate::model::Session::runtime_info].
18854 ///
18855 /// # Example
18856 /// ```ignore,no_run
18857 /// # use google_cloud_dataproc_v1::model::Session;
18858 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18859 /// let x = Session::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
18860 /// ```
18861 pub fn set_runtime_info<T>(mut self, v: T) -> Self
18862 where
18863 T: std::convert::Into<crate::model::RuntimeInfo>,
18864 {
18865 self.runtime_info = std::option::Option::Some(v.into());
18866 self
18867 }
18868
18869 /// Sets or clears the value of [runtime_info][crate::model::Session::runtime_info].
18870 ///
18871 /// # Example
18872 /// ```ignore,no_run
18873 /// # use google_cloud_dataproc_v1::model::Session;
18874 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18875 /// let x = Session::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
18876 /// let x = Session::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
18877 /// ```
18878 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
18879 where
18880 T: std::convert::Into<crate::model::RuntimeInfo>,
18881 {
18882 self.runtime_info = v.map(|x| x.into());
18883 self
18884 }
18885
18886 /// Sets the value of [state][crate::model::Session::state].
18887 ///
18888 /// # Example
18889 /// ```ignore,no_run
18890 /// # use google_cloud_dataproc_v1::model::Session;
18891 /// use google_cloud_dataproc_v1::model::session::State;
18892 /// let x0 = Session::new().set_state(State::Creating);
18893 /// let x1 = Session::new().set_state(State::Active);
18894 /// let x2 = Session::new().set_state(State::Terminating);
18895 /// ```
18896 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(mut self, v: T) -> Self {
18897 self.state = v.into();
18898 self
18899 }
18900
18901 /// Sets the value of [state_message][crate::model::Session::state_message].
18902 ///
18903 /// # Example
18904 /// ```ignore,no_run
18905 /// # use google_cloud_dataproc_v1::model::Session;
18906 /// let x = Session::new().set_state_message("example");
18907 /// ```
18908 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18909 self.state_message = v.into();
18910 self
18911 }
18912
18913 /// Sets the value of [state_time][crate::model::Session::state_time].
18914 ///
18915 /// # Example
18916 /// ```ignore,no_run
18917 /// # use google_cloud_dataproc_v1::model::Session;
18918 /// use wkt::Timestamp;
18919 /// let x = Session::new().set_state_time(Timestamp::default()/* use setters */);
18920 /// ```
18921 pub fn set_state_time<T>(mut self, v: T) -> Self
18922 where
18923 T: std::convert::Into<wkt::Timestamp>,
18924 {
18925 self.state_time = std::option::Option::Some(v.into());
18926 self
18927 }
18928
18929 /// Sets or clears the value of [state_time][crate::model::Session::state_time].
18930 ///
18931 /// # Example
18932 /// ```ignore,no_run
18933 /// # use google_cloud_dataproc_v1::model::Session;
18934 /// use wkt::Timestamp;
18935 /// let x = Session::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
18936 /// let x = Session::new().set_or_clear_state_time(None::<Timestamp>);
18937 /// ```
18938 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
18939 where
18940 T: std::convert::Into<wkt::Timestamp>,
18941 {
18942 self.state_time = v.map(|x| x.into());
18943 self
18944 }
18945
18946 /// Sets the value of [creator][crate::model::Session::creator].
18947 ///
18948 /// # Example
18949 /// ```ignore,no_run
18950 /// # use google_cloud_dataproc_v1::model::Session;
18951 /// let x = Session::new().set_creator("example");
18952 /// ```
18953 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18954 self.creator = v.into();
18955 self
18956 }
18957
18958 /// Sets the value of [labels][crate::model::Session::labels].
18959 ///
18960 /// # Example
18961 /// ```ignore,no_run
18962 /// # use google_cloud_dataproc_v1::model::Session;
18963 /// let x = Session::new().set_labels([
18964 /// ("key0", "abc"),
18965 /// ("key1", "xyz"),
18966 /// ]);
18967 /// ```
18968 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18969 where
18970 T: std::iter::IntoIterator<Item = (K, V)>,
18971 K: std::convert::Into<std::string::String>,
18972 V: std::convert::Into<std::string::String>,
18973 {
18974 use std::iter::Iterator;
18975 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18976 self
18977 }
18978
18979 /// Sets the value of [runtime_config][crate::model::Session::runtime_config].
18980 ///
18981 /// # Example
18982 /// ```ignore,no_run
18983 /// # use google_cloud_dataproc_v1::model::Session;
18984 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18985 /// let x = Session::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18986 /// ```
18987 pub fn set_runtime_config<T>(mut self, v: T) -> Self
18988 where
18989 T: std::convert::Into<crate::model::RuntimeConfig>,
18990 {
18991 self.runtime_config = std::option::Option::Some(v.into());
18992 self
18993 }
18994
18995 /// Sets or clears the value of [runtime_config][crate::model::Session::runtime_config].
18996 ///
18997 /// # Example
18998 /// ```ignore,no_run
18999 /// # use google_cloud_dataproc_v1::model::Session;
19000 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19001 /// let x = Session::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
19002 /// let x = Session::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
19003 /// ```
19004 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
19005 where
19006 T: std::convert::Into<crate::model::RuntimeConfig>,
19007 {
19008 self.runtime_config = v.map(|x| x.into());
19009 self
19010 }
19011
19012 /// Sets the value of [environment_config][crate::model::Session::environment_config].
19013 ///
19014 /// # Example
19015 /// ```ignore,no_run
19016 /// # use google_cloud_dataproc_v1::model::Session;
19017 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19018 /// let x = Session::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
19019 /// ```
19020 pub fn set_environment_config<T>(mut self, v: T) -> Self
19021 where
19022 T: std::convert::Into<crate::model::EnvironmentConfig>,
19023 {
19024 self.environment_config = std::option::Option::Some(v.into());
19025 self
19026 }
19027
19028 /// Sets or clears the value of [environment_config][crate::model::Session::environment_config].
19029 ///
19030 /// # Example
19031 /// ```ignore,no_run
19032 /// # use google_cloud_dataproc_v1::model::Session;
19033 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19034 /// let x = Session::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
19035 /// let x = Session::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
19036 /// ```
19037 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
19038 where
19039 T: std::convert::Into<crate::model::EnvironmentConfig>,
19040 {
19041 self.environment_config = v.map(|x| x.into());
19042 self
19043 }
19044
19045 /// Sets the value of [user][crate::model::Session::user].
19046 ///
19047 /// # Example
19048 /// ```ignore,no_run
19049 /// # use google_cloud_dataproc_v1::model::Session;
19050 /// let x = Session::new().set_user("example");
19051 /// ```
19052 pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19053 self.user = v.into();
19054 self
19055 }
19056
19057 /// Sets the value of [state_history][crate::model::Session::state_history].
19058 ///
19059 /// # Example
19060 /// ```ignore,no_run
19061 /// # use google_cloud_dataproc_v1::model::Session;
19062 /// use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19063 /// let x = Session::new()
19064 /// .set_state_history([
19065 /// SessionStateHistory::default()/* use setters */,
19066 /// SessionStateHistory::default()/* use (different) setters */,
19067 /// ]);
19068 /// ```
19069 pub fn set_state_history<T, V>(mut self, v: T) -> Self
19070 where
19071 T: std::iter::IntoIterator<Item = V>,
19072 V: std::convert::Into<crate::model::session::SessionStateHistory>,
19073 {
19074 use std::iter::Iterator;
19075 self.state_history = v.into_iter().map(|i| i.into()).collect();
19076 self
19077 }
19078
19079 /// Sets the value of [session_template][crate::model::Session::session_template].
19080 ///
19081 /// # Example
19082 /// ```ignore,no_run
19083 /// # use google_cloud_dataproc_v1::model::Session;
19084 /// let x = Session::new().set_session_template("example");
19085 /// ```
19086 pub fn set_session_template<T: std::convert::Into<std::string::String>>(
19087 mut self,
19088 v: T,
19089 ) -> Self {
19090 self.session_template = v.into();
19091 self
19092 }
19093
19094 /// Sets the value of [session_config][crate::model::Session::session_config].
19095 ///
19096 /// Note that all the setters affecting `session_config` are mutually
19097 /// exclusive.
19098 ///
19099 /// # Example
19100 /// ```ignore,no_run
19101 /// # use google_cloud_dataproc_v1::model::Session;
19102 /// use google_cloud_dataproc_v1::model::JupyterConfig;
19103 /// let x = Session::new().set_session_config(Some(
19104 /// google_cloud_dataproc_v1::model::session::SessionConfig::JupyterSession(JupyterConfig::default().into())));
19105 /// ```
19106 pub fn set_session_config<
19107 T: std::convert::Into<std::option::Option<crate::model::session::SessionConfig>>,
19108 >(
19109 mut self,
19110 v: T,
19111 ) -> Self {
19112 self.session_config = v.into();
19113 self
19114 }
19115
19116 /// The value of [session_config][crate::model::Session::session_config]
19117 /// if it holds a `JupyterSession`, `None` if the field is not set or
19118 /// holds a different branch.
19119 pub fn jupyter_session(
19120 &self,
19121 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
19122 #[allow(unreachable_patterns)]
19123 self.session_config.as_ref().and_then(|v| match v {
19124 crate::model::session::SessionConfig::JupyterSession(v) => std::option::Option::Some(v),
19125 _ => std::option::Option::None,
19126 })
19127 }
19128
19129 /// Sets the value of [session_config][crate::model::Session::session_config]
19130 /// to hold a `JupyterSession`.
19131 ///
19132 /// Note that all the setters affecting `session_config` are
19133 /// mutually exclusive.
19134 ///
19135 /// # Example
19136 /// ```ignore,no_run
19137 /// # use google_cloud_dataproc_v1::model::Session;
19138 /// use google_cloud_dataproc_v1::model::JupyterConfig;
19139 /// let x = Session::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
19140 /// assert!(x.jupyter_session().is_some());
19141 /// assert!(x.spark_connect_session().is_none());
19142 /// ```
19143 pub fn set_jupyter_session<
19144 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
19145 >(
19146 mut self,
19147 v: T,
19148 ) -> Self {
19149 self.session_config = std::option::Option::Some(
19150 crate::model::session::SessionConfig::JupyterSession(v.into()),
19151 );
19152 self
19153 }
19154
19155 /// The value of [session_config][crate::model::Session::session_config]
19156 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
19157 /// holds a different branch.
19158 pub fn spark_connect_session(
19159 &self,
19160 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
19161 #[allow(unreachable_patterns)]
19162 self.session_config.as_ref().and_then(|v| match v {
19163 crate::model::session::SessionConfig::SparkConnectSession(v) => {
19164 std::option::Option::Some(v)
19165 }
19166 _ => std::option::Option::None,
19167 })
19168 }
19169
19170 /// Sets the value of [session_config][crate::model::Session::session_config]
19171 /// to hold a `SparkConnectSession`.
19172 ///
19173 /// Note that all the setters affecting `session_config` are
19174 /// mutually exclusive.
19175 ///
19176 /// # Example
19177 /// ```ignore,no_run
19178 /// # use google_cloud_dataproc_v1::model::Session;
19179 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
19180 /// let x = Session::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
19181 /// assert!(x.spark_connect_session().is_some());
19182 /// assert!(x.jupyter_session().is_none());
19183 /// ```
19184 pub fn set_spark_connect_session<
19185 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
19186 >(
19187 mut self,
19188 v: T,
19189 ) -> Self {
19190 self.session_config = std::option::Option::Some(
19191 crate::model::session::SessionConfig::SparkConnectSession(v.into()),
19192 );
19193 self
19194 }
19195}
19196
19197impl wkt::message::Message for Session {
19198 fn typename() -> &'static str {
19199 "type.googleapis.com/google.cloud.dataproc.v1.Session"
19200 }
19201}
19202
19203/// Defines additional types related to [Session].
19204pub mod session {
19205 #[allow(unused_imports)]
19206 use super::*;
19207
19208 /// Historical state information.
19209 #[derive(Clone, Default, PartialEq)]
19210 #[non_exhaustive]
19211 pub struct SessionStateHistory {
19212 /// Output only. The state of the session at this point in the session
19213 /// history.
19214 pub state: crate::model::session::State,
19215
19216 /// Output only. Details about the state at this point in the session
19217 /// history.
19218 pub state_message: std::string::String,
19219
19220 /// Output only. The time when the session entered the historical state.
19221 pub state_start_time: std::option::Option<wkt::Timestamp>,
19222
19223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19224 }
19225
19226 impl SessionStateHistory {
19227 pub fn new() -> Self {
19228 std::default::Default::default()
19229 }
19230
19231 /// Sets the value of [state][crate::model::session::SessionStateHistory::state].
19232 ///
19233 /// # Example
19234 /// ```ignore,no_run
19235 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19236 /// use google_cloud_dataproc_v1::model::session::State;
19237 /// let x0 = SessionStateHistory::new().set_state(State::Creating);
19238 /// let x1 = SessionStateHistory::new().set_state(State::Active);
19239 /// let x2 = SessionStateHistory::new().set_state(State::Terminating);
19240 /// ```
19241 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(
19242 mut self,
19243 v: T,
19244 ) -> Self {
19245 self.state = v.into();
19246 self
19247 }
19248
19249 /// Sets the value of [state_message][crate::model::session::SessionStateHistory::state_message].
19250 ///
19251 /// # Example
19252 /// ```ignore,no_run
19253 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19254 /// let x = SessionStateHistory::new().set_state_message("example");
19255 /// ```
19256 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
19257 mut self,
19258 v: T,
19259 ) -> Self {
19260 self.state_message = v.into();
19261 self
19262 }
19263
19264 /// Sets the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
19265 ///
19266 /// # Example
19267 /// ```ignore,no_run
19268 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19269 /// use wkt::Timestamp;
19270 /// let x = SessionStateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
19271 /// ```
19272 pub fn set_state_start_time<T>(mut self, v: T) -> Self
19273 where
19274 T: std::convert::Into<wkt::Timestamp>,
19275 {
19276 self.state_start_time = std::option::Option::Some(v.into());
19277 self
19278 }
19279
19280 /// Sets or clears the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
19281 ///
19282 /// # Example
19283 /// ```ignore,no_run
19284 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19285 /// use wkt::Timestamp;
19286 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
19287 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
19288 /// ```
19289 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
19290 where
19291 T: std::convert::Into<wkt::Timestamp>,
19292 {
19293 self.state_start_time = v.map(|x| x.into());
19294 self
19295 }
19296 }
19297
19298 impl wkt::message::Message for SessionStateHistory {
19299 fn typename() -> &'static str {
19300 "type.googleapis.com/google.cloud.dataproc.v1.Session.SessionStateHistory"
19301 }
19302 }
19303
19304 /// The session state.
19305 ///
19306 /// # Working with unknown values
19307 ///
19308 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19309 /// additional enum variants at any time. Adding new variants is not considered
19310 /// a breaking change. Applications should write their code in anticipation of:
19311 ///
19312 /// - New values appearing in future releases of the client library, **and**
19313 /// - New values received dynamically, without application changes.
19314 ///
19315 /// Please consult the [Working with enums] section in the user guide for some
19316 /// guidelines.
19317 ///
19318 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19319 #[derive(Clone, Debug, PartialEq)]
19320 #[non_exhaustive]
19321 pub enum State {
19322 /// The session state is unknown.
19323 Unspecified,
19324 /// The session is created prior to running.
19325 Creating,
19326 /// The session is running.
19327 Active,
19328 /// The session is terminating.
19329 Terminating,
19330 /// The session is terminated successfully.
19331 Terminated,
19332 /// The session is no longer running due to an error.
19333 Failed,
19334 /// If set, the enum was initialized with an unknown value.
19335 ///
19336 /// Applications can examine the value using [State::value] or
19337 /// [State::name].
19338 UnknownValue(state::UnknownValue),
19339 }
19340
19341 #[doc(hidden)]
19342 pub mod state {
19343 #[allow(unused_imports)]
19344 use super::*;
19345 #[derive(Clone, Debug, PartialEq)]
19346 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19347 }
19348
19349 impl State {
19350 /// Gets the enum value.
19351 ///
19352 /// Returns `None` if the enum contains an unknown value deserialized from
19353 /// the string representation of enums.
19354 pub fn value(&self) -> std::option::Option<i32> {
19355 match self {
19356 Self::Unspecified => std::option::Option::Some(0),
19357 Self::Creating => std::option::Option::Some(1),
19358 Self::Active => std::option::Option::Some(2),
19359 Self::Terminating => std::option::Option::Some(3),
19360 Self::Terminated => std::option::Option::Some(4),
19361 Self::Failed => std::option::Option::Some(5),
19362 Self::UnknownValue(u) => u.0.value(),
19363 }
19364 }
19365
19366 /// Gets the enum value as a string.
19367 ///
19368 /// Returns `None` if the enum contains an unknown value deserialized from
19369 /// the integer representation of enums.
19370 pub fn name(&self) -> std::option::Option<&str> {
19371 match self {
19372 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19373 Self::Creating => std::option::Option::Some("CREATING"),
19374 Self::Active => std::option::Option::Some("ACTIVE"),
19375 Self::Terminating => std::option::Option::Some("TERMINATING"),
19376 Self::Terminated => std::option::Option::Some("TERMINATED"),
19377 Self::Failed => std::option::Option::Some("FAILED"),
19378 Self::UnknownValue(u) => u.0.name(),
19379 }
19380 }
19381 }
19382
19383 impl std::default::Default for State {
19384 fn default() -> Self {
19385 use std::convert::From;
19386 Self::from(0)
19387 }
19388 }
19389
19390 impl std::fmt::Display for State {
19391 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19392 wkt::internal::display_enum(f, self.name(), self.value())
19393 }
19394 }
19395
19396 impl std::convert::From<i32> for State {
19397 fn from(value: i32) -> Self {
19398 match value {
19399 0 => Self::Unspecified,
19400 1 => Self::Creating,
19401 2 => Self::Active,
19402 3 => Self::Terminating,
19403 4 => Self::Terminated,
19404 5 => Self::Failed,
19405 _ => Self::UnknownValue(state::UnknownValue(
19406 wkt::internal::UnknownEnumValue::Integer(value),
19407 )),
19408 }
19409 }
19410 }
19411
19412 impl std::convert::From<&str> for State {
19413 fn from(value: &str) -> Self {
19414 use std::string::ToString;
19415 match value {
19416 "STATE_UNSPECIFIED" => Self::Unspecified,
19417 "CREATING" => Self::Creating,
19418 "ACTIVE" => Self::Active,
19419 "TERMINATING" => Self::Terminating,
19420 "TERMINATED" => Self::Terminated,
19421 "FAILED" => Self::Failed,
19422 _ => Self::UnknownValue(state::UnknownValue(
19423 wkt::internal::UnknownEnumValue::String(value.to_string()),
19424 )),
19425 }
19426 }
19427 }
19428
19429 impl serde::ser::Serialize for State {
19430 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19431 where
19432 S: serde::Serializer,
19433 {
19434 match self {
19435 Self::Unspecified => serializer.serialize_i32(0),
19436 Self::Creating => serializer.serialize_i32(1),
19437 Self::Active => serializer.serialize_i32(2),
19438 Self::Terminating => serializer.serialize_i32(3),
19439 Self::Terminated => serializer.serialize_i32(4),
19440 Self::Failed => serializer.serialize_i32(5),
19441 Self::UnknownValue(u) => u.0.serialize(serializer),
19442 }
19443 }
19444 }
19445
19446 impl<'de> serde::de::Deserialize<'de> for State {
19447 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19448 where
19449 D: serde::Deserializer<'de>,
19450 {
19451 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19452 ".google.cloud.dataproc.v1.Session.State",
19453 ))
19454 }
19455 }
19456
19457 /// The session configuration.
19458 #[derive(Clone, Debug, PartialEq)]
19459 #[non_exhaustive]
19460 pub enum SessionConfig {
19461 /// Optional. Jupyter session config.
19462 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
19463 /// Optional. Spark Connect session config.
19464 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
19465 }
19466}
19467
19468/// Jupyter configuration for an interactive session.
19469#[derive(Clone, Default, PartialEq)]
19470#[non_exhaustive]
19471pub struct JupyterConfig {
19472 /// Optional. Kernel
19473 pub kernel: crate::model::jupyter_config::Kernel,
19474
19475 /// Optional. Display name, shown in the Jupyter kernelspec card.
19476 pub display_name: std::string::String,
19477
19478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19479}
19480
19481impl JupyterConfig {
19482 pub fn new() -> Self {
19483 std::default::Default::default()
19484 }
19485
19486 /// Sets the value of [kernel][crate::model::JupyterConfig::kernel].
19487 ///
19488 /// # Example
19489 /// ```ignore,no_run
19490 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19491 /// use google_cloud_dataproc_v1::model::jupyter_config::Kernel;
19492 /// let x0 = JupyterConfig::new().set_kernel(Kernel::Python);
19493 /// let x1 = JupyterConfig::new().set_kernel(Kernel::Scala);
19494 /// ```
19495 pub fn set_kernel<T: std::convert::Into<crate::model::jupyter_config::Kernel>>(
19496 mut self,
19497 v: T,
19498 ) -> Self {
19499 self.kernel = v.into();
19500 self
19501 }
19502
19503 /// Sets the value of [display_name][crate::model::JupyterConfig::display_name].
19504 ///
19505 /// # Example
19506 /// ```ignore,no_run
19507 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19508 /// let x = JupyterConfig::new().set_display_name("example");
19509 /// ```
19510 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19511 self.display_name = v.into();
19512 self
19513 }
19514}
19515
19516impl wkt::message::Message for JupyterConfig {
19517 fn typename() -> &'static str {
19518 "type.googleapis.com/google.cloud.dataproc.v1.JupyterConfig"
19519 }
19520}
19521
19522/// Defines additional types related to [JupyterConfig].
19523pub mod jupyter_config {
19524 #[allow(unused_imports)]
19525 use super::*;
19526
19527 /// Jupyter kernel types.
19528 ///
19529 /// # Working with unknown values
19530 ///
19531 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19532 /// additional enum variants at any time. Adding new variants is not considered
19533 /// a breaking change. Applications should write their code in anticipation of:
19534 ///
19535 /// - New values appearing in future releases of the client library, **and**
19536 /// - New values received dynamically, without application changes.
19537 ///
19538 /// Please consult the [Working with enums] section in the user guide for some
19539 /// guidelines.
19540 ///
19541 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19542 #[derive(Clone, Debug, PartialEq)]
19543 #[non_exhaustive]
19544 pub enum Kernel {
19545 /// The kernel is unknown.
19546 Unspecified,
19547 /// Python kernel.
19548 Python,
19549 /// Scala kernel.
19550 Scala,
19551 /// If set, the enum was initialized with an unknown value.
19552 ///
19553 /// Applications can examine the value using [Kernel::value] or
19554 /// [Kernel::name].
19555 UnknownValue(kernel::UnknownValue),
19556 }
19557
19558 #[doc(hidden)]
19559 pub mod kernel {
19560 #[allow(unused_imports)]
19561 use super::*;
19562 #[derive(Clone, Debug, PartialEq)]
19563 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19564 }
19565
19566 impl Kernel {
19567 /// Gets the enum value.
19568 ///
19569 /// Returns `None` if the enum contains an unknown value deserialized from
19570 /// the string representation of enums.
19571 pub fn value(&self) -> std::option::Option<i32> {
19572 match self {
19573 Self::Unspecified => std::option::Option::Some(0),
19574 Self::Python => std::option::Option::Some(1),
19575 Self::Scala => std::option::Option::Some(2),
19576 Self::UnknownValue(u) => u.0.value(),
19577 }
19578 }
19579
19580 /// Gets the enum value as a string.
19581 ///
19582 /// Returns `None` if the enum contains an unknown value deserialized from
19583 /// the integer representation of enums.
19584 pub fn name(&self) -> std::option::Option<&str> {
19585 match self {
19586 Self::Unspecified => std::option::Option::Some("KERNEL_UNSPECIFIED"),
19587 Self::Python => std::option::Option::Some("PYTHON"),
19588 Self::Scala => std::option::Option::Some("SCALA"),
19589 Self::UnknownValue(u) => u.0.name(),
19590 }
19591 }
19592 }
19593
19594 impl std::default::Default for Kernel {
19595 fn default() -> Self {
19596 use std::convert::From;
19597 Self::from(0)
19598 }
19599 }
19600
19601 impl std::fmt::Display for Kernel {
19602 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19603 wkt::internal::display_enum(f, self.name(), self.value())
19604 }
19605 }
19606
19607 impl std::convert::From<i32> for Kernel {
19608 fn from(value: i32) -> Self {
19609 match value {
19610 0 => Self::Unspecified,
19611 1 => Self::Python,
19612 2 => Self::Scala,
19613 _ => Self::UnknownValue(kernel::UnknownValue(
19614 wkt::internal::UnknownEnumValue::Integer(value),
19615 )),
19616 }
19617 }
19618 }
19619
19620 impl std::convert::From<&str> for Kernel {
19621 fn from(value: &str) -> Self {
19622 use std::string::ToString;
19623 match value {
19624 "KERNEL_UNSPECIFIED" => Self::Unspecified,
19625 "PYTHON" => Self::Python,
19626 "SCALA" => Self::Scala,
19627 _ => Self::UnknownValue(kernel::UnknownValue(
19628 wkt::internal::UnknownEnumValue::String(value.to_string()),
19629 )),
19630 }
19631 }
19632 }
19633
19634 impl serde::ser::Serialize for Kernel {
19635 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19636 where
19637 S: serde::Serializer,
19638 {
19639 match self {
19640 Self::Unspecified => serializer.serialize_i32(0),
19641 Self::Python => serializer.serialize_i32(1),
19642 Self::Scala => serializer.serialize_i32(2),
19643 Self::UnknownValue(u) => u.0.serialize(serializer),
19644 }
19645 }
19646 }
19647
19648 impl<'de> serde::de::Deserialize<'de> for Kernel {
19649 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19650 where
19651 D: serde::Deserializer<'de>,
19652 {
19653 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kernel>::new(
19654 ".google.cloud.dataproc.v1.JupyterConfig.Kernel",
19655 ))
19656 }
19657 }
19658}
19659
19660/// Spark Connect configuration for an interactive session.
19661#[derive(Clone, Default, PartialEq)]
19662#[non_exhaustive]
19663pub struct SparkConnectConfig {
19664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19665}
19666
19667impl SparkConnectConfig {
19668 pub fn new() -> Self {
19669 std::default::Default::default()
19670 }
19671}
19672
19673impl wkt::message::Message for SparkConnectConfig {
19674 fn typename() -> &'static str {
19675 "type.googleapis.com/google.cloud.dataproc.v1.SparkConnectConfig"
19676 }
19677}
19678
19679/// Runtime configuration for a workload.
19680#[derive(Clone, Default, PartialEq)]
19681#[non_exhaustive]
19682pub struct RuntimeConfig {
19683 /// Optional. Version of the batch runtime.
19684 pub version: std::string::String,
19685
19686 /// Optional. Optional custom container image for the job runtime environment.
19687 /// If not specified, a default container image will be used.
19688 pub container_image: std::string::String,
19689
19690 /// Optional. A mapping of property names to values, which are used to
19691 /// configure workload execution.
19692 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
19693
19694 /// Optional. Dependency repository configuration.
19695 pub repository_config: std::option::Option<crate::model::RepositoryConfig>,
19696
19697 /// Optional. Autotuning configuration of the workload.
19698 pub autotuning_config: std::option::Option<crate::model::AutotuningConfig>,
19699
19700 /// Optional. Cohort identifier. Identifies families of the workloads having
19701 /// the same shape, e.g. daily ETL jobs.
19702 pub cohort: std::string::String,
19703
19704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19705}
19706
19707impl RuntimeConfig {
19708 pub fn new() -> Self {
19709 std::default::Default::default()
19710 }
19711
19712 /// Sets the value of [version][crate::model::RuntimeConfig::version].
19713 ///
19714 /// # Example
19715 /// ```ignore,no_run
19716 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19717 /// let x = RuntimeConfig::new().set_version("example");
19718 /// ```
19719 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19720 self.version = v.into();
19721 self
19722 }
19723
19724 /// Sets the value of [container_image][crate::model::RuntimeConfig::container_image].
19725 ///
19726 /// # Example
19727 /// ```ignore,no_run
19728 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19729 /// let x = RuntimeConfig::new().set_container_image("example");
19730 /// ```
19731 pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19732 self.container_image = v.into();
19733 self
19734 }
19735
19736 /// Sets the value of [properties][crate::model::RuntimeConfig::properties].
19737 ///
19738 /// # Example
19739 /// ```ignore,no_run
19740 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19741 /// let x = RuntimeConfig::new().set_properties([
19742 /// ("key0", "abc"),
19743 /// ("key1", "xyz"),
19744 /// ]);
19745 /// ```
19746 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
19747 where
19748 T: std::iter::IntoIterator<Item = (K, V)>,
19749 K: std::convert::Into<std::string::String>,
19750 V: std::convert::Into<std::string::String>,
19751 {
19752 use std::iter::Iterator;
19753 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
19754 self
19755 }
19756
19757 /// Sets the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19758 ///
19759 /// # Example
19760 /// ```ignore,no_run
19761 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19762 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19763 /// let x = RuntimeConfig::new().set_repository_config(RepositoryConfig::default()/* use setters */);
19764 /// ```
19765 pub fn set_repository_config<T>(mut self, v: T) -> Self
19766 where
19767 T: std::convert::Into<crate::model::RepositoryConfig>,
19768 {
19769 self.repository_config = std::option::Option::Some(v.into());
19770 self
19771 }
19772
19773 /// Sets or clears the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19774 ///
19775 /// # Example
19776 /// ```ignore,no_run
19777 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19778 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19779 /// let x = RuntimeConfig::new().set_or_clear_repository_config(Some(RepositoryConfig::default()/* use setters */));
19780 /// let x = RuntimeConfig::new().set_or_clear_repository_config(None::<RepositoryConfig>);
19781 /// ```
19782 pub fn set_or_clear_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
19783 where
19784 T: std::convert::Into<crate::model::RepositoryConfig>,
19785 {
19786 self.repository_config = v.map(|x| x.into());
19787 self
19788 }
19789
19790 /// Sets the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19791 ///
19792 /// # Example
19793 /// ```ignore,no_run
19794 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19795 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19796 /// let x = RuntimeConfig::new().set_autotuning_config(AutotuningConfig::default()/* use setters */);
19797 /// ```
19798 pub fn set_autotuning_config<T>(mut self, v: T) -> Self
19799 where
19800 T: std::convert::Into<crate::model::AutotuningConfig>,
19801 {
19802 self.autotuning_config = std::option::Option::Some(v.into());
19803 self
19804 }
19805
19806 /// Sets or clears the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19807 ///
19808 /// # Example
19809 /// ```ignore,no_run
19810 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19811 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19812 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(Some(AutotuningConfig::default()/* use setters */));
19813 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(None::<AutotuningConfig>);
19814 /// ```
19815 pub fn set_or_clear_autotuning_config<T>(mut self, v: std::option::Option<T>) -> Self
19816 where
19817 T: std::convert::Into<crate::model::AutotuningConfig>,
19818 {
19819 self.autotuning_config = v.map(|x| x.into());
19820 self
19821 }
19822
19823 /// Sets the value of [cohort][crate::model::RuntimeConfig::cohort].
19824 ///
19825 /// # Example
19826 /// ```ignore,no_run
19827 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19828 /// let x = RuntimeConfig::new().set_cohort("example");
19829 /// ```
19830 pub fn set_cohort<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19831 self.cohort = v.into();
19832 self
19833 }
19834}
19835
19836impl wkt::message::Message for RuntimeConfig {
19837 fn typename() -> &'static str {
19838 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeConfig"
19839 }
19840}
19841
19842/// Environment configuration for a workload.
19843#[derive(Clone, Default, PartialEq)]
19844#[non_exhaustive]
19845pub struct EnvironmentConfig {
19846 /// Optional. Execution configuration for a workload.
19847 pub execution_config: std::option::Option<crate::model::ExecutionConfig>,
19848
19849 /// Optional. Peripherals configuration that workload has access to.
19850 pub peripherals_config: std::option::Option<crate::model::PeripheralsConfig>,
19851
19852 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19853}
19854
19855impl EnvironmentConfig {
19856 pub fn new() -> Self {
19857 std::default::Default::default()
19858 }
19859
19860 /// Sets the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19861 ///
19862 /// # Example
19863 /// ```ignore,no_run
19864 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19865 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19866 /// let x = EnvironmentConfig::new().set_execution_config(ExecutionConfig::default()/* use setters */);
19867 /// ```
19868 pub fn set_execution_config<T>(mut self, v: T) -> Self
19869 where
19870 T: std::convert::Into<crate::model::ExecutionConfig>,
19871 {
19872 self.execution_config = std::option::Option::Some(v.into());
19873 self
19874 }
19875
19876 /// Sets or clears the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19877 ///
19878 /// # Example
19879 /// ```ignore,no_run
19880 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19881 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19882 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(Some(ExecutionConfig::default()/* use setters */));
19883 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(None::<ExecutionConfig>);
19884 /// ```
19885 pub fn set_or_clear_execution_config<T>(mut self, v: std::option::Option<T>) -> Self
19886 where
19887 T: std::convert::Into<crate::model::ExecutionConfig>,
19888 {
19889 self.execution_config = v.map(|x| x.into());
19890 self
19891 }
19892
19893 /// Sets the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19894 ///
19895 /// # Example
19896 /// ```ignore,no_run
19897 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19898 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19899 /// let x = EnvironmentConfig::new().set_peripherals_config(PeripheralsConfig::default()/* use setters */);
19900 /// ```
19901 pub fn set_peripherals_config<T>(mut self, v: T) -> Self
19902 where
19903 T: std::convert::Into<crate::model::PeripheralsConfig>,
19904 {
19905 self.peripherals_config = std::option::Option::Some(v.into());
19906 self
19907 }
19908
19909 /// Sets or clears the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19910 ///
19911 /// # Example
19912 /// ```ignore,no_run
19913 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19914 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19915 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(Some(PeripheralsConfig::default()/* use setters */));
19916 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(None::<PeripheralsConfig>);
19917 /// ```
19918 pub fn set_or_clear_peripherals_config<T>(mut self, v: std::option::Option<T>) -> Self
19919 where
19920 T: std::convert::Into<crate::model::PeripheralsConfig>,
19921 {
19922 self.peripherals_config = v.map(|x| x.into());
19923 self
19924 }
19925}
19926
19927impl wkt::message::Message for EnvironmentConfig {
19928 fn typename() -> &'static str {
19929 "type.googleapis.com/google.cloud.dataproc.v1.EnvironmentConfig"
19930 }
19931}
19932
19933/// Execution configuration for a workload.
19934#[derive(Clone, Default, PartialEq)]
19935#[non_exhaustive]
19936pub struct ExecutionConfig {
19937 /// Optional. Service account that used to execute workload.
19938 pub service_account: std::string::String,
19939
19940 /// Optional. Tags used for network traffic control.
19941 pub network_tags: std::vec::Vec<std::string::String>,
19942
19943 /// Optional. The Cloud KMS key to use for encryption.
19944 pub kms_key: std::string::String,
19945
19946 /// Optional. Applies to sessions only. The duration to keep the session alive
19947 /// while it's idling. Exceeding this threshold causes the session to
19948 /// terminate. This field cannot be set on a batch workload. Minimum value is
19949 /// 10 minutes; maximum value is 14 days (see JSON representation of
19950 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
19951 /// Defaults to 1 hour if not set.
19952 /// If both `ttl` and `idle_ttl` are specified for an interactive session,
19953 /// the conditions are treated as `OR` conditions: the workload will be
19954 /// terminated when it has been idle for `idle_ttl` or when `ttl` has been
19955 /// exceeded, whichever occurs first.
19956 pub idle_ttl: std::option::Option<wkt::Duration>,
19957
19958 /// Optional. The duration after which the workload will be terminated,
19959 /// specified as the JSON representation for
19960 /// [Duration](https://protobuf.dev/programming-guides/proto3/#json).
19961 /// When the workload exceeds this duration, it will be unconditionally
19962 /// terminated without waiting for ongoing work to finish. If `ttl` is not
19963 /// specified for a batch workload, the workload will be allowed to run until
19964 /// it exits naturally (or run forever without exiting). If `ttl` is not
19965 /// specified for an interactive session, it defaults to 24 hours. If `ttl` is
19966 /// not specified for a batch that uses 2.1+ runtime version, it defaults to 4
19967 /// hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl`
19968 /// and `idle_ttl` are specified (for an interactive session), the conditions
19969 /// are treated as `OR` conditions: the workload will be terminated when it has
19970 /// been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs
19971 /// first.
19972 pub ttl: std::option::Option<wkt::Duration>,
19973
19974 /// Optional. A Cloud Storage bucket used to stage workload dependencies,
19975 /// config files, and store workload output and other ephemeral data, such as
19976 /// Spark history files. If you do not specify a staging bucket, Cloud Dataproc
19977 /// will determine a Cloud Storage location according to the region where your
19978 /// workload is running, and then create and manage project-level, per-location
19979 /// staging and temporary buckets.
19980 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
19981 /// a Cloud Storage bucket.**
19982 pub staging_bucket: std::string::String,
19983
19984 /// Optional. Authentication configuration used to set the default identity for
19985 /// the workload execution. The config specifies the type of identity
19986 /// (service account or user) that will be used by workloads to access
19987 /// resources on the project(s).
19988 pub authentication_config: std::option::Option<crate::model::AuthenticationConfig>,
19989
19990 /// Network configuration for workload execution.
19991 pub network: std::option::Option<crate::model::execution_config::Network>,
19992
19993 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19994}
19995
19996impl ExecutionConfig {
19997 pub fn new() -> Self {
19998 std::default::Default::default()
19999 }
20000
20001 /// Sets the value of [service_account][crate::model::ExecutionConfig::service_account].
20002 ///
20003 /// # Example
20004 /// ```ignore,no_run
20005 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20006 /// let x = ExecutionConfig::new().set_service_account("example");
20007 /// ```
20008 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20009 self.service_account = v.into();
20010 self
20011 }
20012
20013 /// Sets the value of [network_tags][crate::model::ExecutionConfig::network_tags].
20014 ///
20015 /// # Example
20016 /// ```ignore,no_run
20017 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20018 /// let x = ExecutionConfig::new().set_network_tags(["a", "b", "c"]);
20019 /// ```
20020 pub fn set_network_tags<T, V>(mut self, v: T) -> Self
20021 where
20022 T: std::iter::IntoIterator<Item = V>,
20023 V: std::convert::Into<std::string::String>,
20024 {
20025 use std::iter::Iterator;
20026 self.network_tags = v.into_iter().map(|i| i.into()).collect();
20027 self
20028 }
20029
20030 /// Sets the value of [kms_key][crate::model::ExecutionConfig::kms_key].
20031 ///
20032 /// # Example
20033 /// ```ignore,no_run
20034 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20035 /// let x = ExecutionConfig::new().set_kms_key("example");
20036 /// ```
20037 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20038 self.kms_key = v.into();
20039 self
20040 }
20041
20042 /// Sets the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20043 ///
20044 /// # Example
20045 /// ```ignore,no_run
20046 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20047 /// use wkt::Duration;
20048 /// let x = ExecutionConfig::new().set_idle_ttl(Duration::default()/* use setters */);
20049 /// ```
20050 pub fn set_idle_ttl<T>(mut self, v: T) -> Self
20051 where
20052 T: std::convert::Into<wkt::Duration>,
20053 {
20054 self.idle_ttl = std::option::Option::Some(v.into());
20055 self
20056 }
20057
20058 /// Sets or clears the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20059 ///
20060 /// # Example
20061 /// ```ignore,no_run
20062 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20063 /// use wkt::Duration;
20064 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(Some(Duration::default()/* use setters */));
20065 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(None::<Duration>);
20066 /// ```
20067 pub fn set_or_clear_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20068 where
20069 T: std::convert::Into<wkt::Duration>,
20070 {
20071 self.idle_ttl = v.map(|x| x.into());
20072 self
20073 }
20074
20075 /// Sets the value of [ttl][crate::model::ExecutionConfig::ttl].
20076 ///
20077 /// # Example
20078 /// ```ignore,no_run
20079 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20080 /// use wkt::Duration;
20081 /// let x = ExecutionConfig::new().set_ttl(Duration::default()/* use setters */);
20082 /// ```
20083 pub fn set_ttl<T>(mut self, v: T) -> Self
20084 where
20085 T: std::convert::Into<wkt::Duration>,
20086 {
20087 self.ttl = std::option::Option::Some(v.into());
20088 self
20089 }
20090
20091 /// Sets or clears the value of [ttl][crate::model::ExecutionConfig::ttl].
20092 ///
20093 /// # Example
20094 /// ```ignore,no_run
20095 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20096 /// use wkt::Duration;
20097 /// let x = ExecutionConfig::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
20098 /// let x = ExecutionConfig::new().set_or_clear_ttl(None::<Duration>);
20099 /// ```
20100 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20101 where
20102 T: std::convert::Into<wkt::Duration>,
20103 {
20104 self.ttl = v.map(|x| x.into());
20105 self
20106 }
20107
20108 /// Sets the value of [staging_bucket][crate::model::ExecutionConfig::staging_bucket].
20109 ///
20110 /// # Example
20111 /// ```ignore,no_run
20112 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20113 /// let x = ExecutionConfig::new().set_staging_bucket("example");
20114 /// ```
20115 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20116 self.staging_bucket = v.into();
20117 self
20118 }
20119
20120 /// Sets the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20121 ///
20122 /// # Example
20123 /// ```ignore,no_run
20124 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20125 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20126 /// let x = ExecutionConfig::new().set_authentication_config(AuthenticationConfig::default()/* use setters */);
20127 /// ```
20128 pub fn set_authentication_config<T>(mut self, v: T) -> Self
20129 where
20130 T: std::convert::Into<crate::model::AuthenticationConfig>,
20131 {
20132 self.authentication_config = std::option::Option::Some(v.into());
20133 self
20134 }
20135
20136 /// Sets or clears the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20137 ///
20138 /// # Example
20139 /// ```ignore,no_run
20140 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20141 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20142 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(Some(AuthenticationConfig::default()/* use setters */));
20143 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(None::<AuthenticationConfig>);
20144 /// ```
20145 pub fn set_or_clear_authentication_config<T>(mut self, v: std::option::Option<T>) -> Self
20146 where
20147 T: std::convert::Into<crate::model::AuthenticationConfig>,
20148 {
20149 self.authentication_config = v.map(|x| x.into());
20150 self
20151 }
20152
20153 /// Sets the value of [network][crate::model::ExecutionConfig::network].
20154 ///
20155 /// Note that all the setters affecting `network` are mutually
20156 /// exclusive.
20157 ///
20158 /// # Example
20159 /// ```ignore,no_run
20160 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20161 /// use google_cloud_dataproc_v1::model::execution_config::Network;
20162 /// let x = ExecutionConfig::new().set_network(Some(Network::NetworkUri("example".to_string())));
20163 /// ```
20164 pub fn set_network<
20165 T: std::convert::Into<std::option::Option<crate::model::execution_config::Network>>,
20166 >(
20167 mut self,
20168 v: T,
20169 ) -> Self {
20170 self.network = v.into();
20171 self
20172 }
20173
20174 /// The value of [network][crate::model::ExecutionConfig::network]
20175 /// if it holds a `NetworkUri`, `None` if the field is not set or
20176 /// holds a different branch.
20177 pub fn network_uri(&self) -> std::option::Option<&std::string::String> {
20178 #[allow(unreachable_patterns)]
20179 self.network.as_ref().and_then(|v| match v {
20180 crate::model::execution_config::Network::NetworkUri(v) => std::option::Option::Some(v),
20181 _ => std::option::Option::None,
20182 })
20183 }
20184
20185 /// Sets the value of [network][crate::model::ExecutionConfig::network]
20186 /// to hold a `NetworkUri`.
20187 ///
20188 /// Note that all the setters affecting `network` are
20189 /// mutually exclusive.
20190 ///
20191 /// # Example
20192 /// ```ignore,no_run
20193 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20194 /// let x = ExecutionConfig::new().set_network_uri("example");
20195 /// assert!(x.network_uri().is_some());
20196 /// assert!(x.subnetwork_uri().is_none());
20197 /// ```
20198 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20199 self.network = std::option::Option::Some(
20200 crate::model::execution_config::Network::NetworkUri(v.into()),
20201 );
20202 self
20203 }
20204
20205 /// The value of [network][crate::model::ExecutionConfig::network]
20206 /// if it holds a `SubnetworkUri`, `None` if the field is not set or
20207 /// holds a different branch.
20208 pub fn subnetwork_uri(&self) -> std::option::Option<&std::string::String> {
20209 #[allow(unreachable_patterns)]
20210 self.network.as_ref().and_then(|v| match v {
20211 crate::model::execution_config::Network::SubnetworkUri(v) => {
20212 std::option::Option::Some(v)
20213 }
20214 _ => std::option::Option::None,
20215 })
20216 }
20217
20218 /// Sets the value of [network][crate::model::ExecutionConfig::network]
20219 /// to hold a `SubnetworkUri`.
20220 ///
20221 /// Note that all the setters affecting `network` are
20222 /// mutually exclusive.
20223 ///
20224 /// # Example
20225 /// ```ignore,no_run
20226 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20227 /// let x = ExecutionConfig::new().set_subnetwork_uri("example");
20228 /// assert!(x.subnetwork_uri().is_some());
20229 /// assert!(x.network_uri().is_none());
20230 /// ```
20231 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20232 self.network = std::option::Option::Some(
20233 crate::model::execution_config::Network::SubnetworkUri(v.into()),
20234 );
20235 self
20236 }
20237}
20238
20239impl wkt::message::Message for ExecutionConfig {
20240 fn typename() -> &'static str {
20241 "type.googleapis.com/google.cloud.dataproc.v1.ExecutionConfig"
20242 }
20243}
20244
20245/// Defines additional types related to [ExecutionConfig].
20246pub mod execution_config {
20247 #[allow(unused_imports)]
20248 use super::*;
20249
20250 /// Network configuration for workload execution.
20251 #[derive(Clone, Debug, PartialEq)]
20252 #[non_exhaustive]
20253 pub enum Network {
20254 /// Optional. Network URI to connect workload to.
20255 NetworkUri(std::string::String),
20256 /// Optional. Subnetwork URI to connect workload to.
20257 SubnetworkUri(std::string::String),
20258 }
20259}
20260
20261/// Spark History Server configuration for the workload.
20262#[derive(Clone, Default, PartialEq)]
20263#[non_exhaustive]
20264pub struct SparkHistoryServerConfig {
20265 /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark
20266 /// History Server for the workload.
20267 ///
20268 /// Example:
20269 ///
20270 /// * `projects/[project_id]/regions/[region]/clusters/[cluster_name]`
20271 pub dataproc_cluster: std::string::String,
20272
20273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20274}
20275
20276impl SparkHistoryServerConfig {
20277 pub fn new() -> Self {
20278 std::default::Default::default()
20279 }
20280
20281 /// Sets the value of [dataproc_cluster][crate::model::SparkHistoryServerConfig::dataproc_cluster].
20282 ///
20283 /// # Example
20284 /// ```ignore,no_run
20285 /// # use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20286 /// let x = SparkHistoryServerConfig::new().set_dataproc_cluster("example");
20287 /// ```
20288 pub fn set_dataproc_cluster<T: std::convert::Into<std::string::String>>(
20289 mut self,
20290 v: T,
20291 ) -> Self {
20292 self.dataproc_cluster = v.into();
20293 self
20294 }
20295}
20296
20297impl wkt::message::Message for SparkHistoryServerConfig {
20298 fn typename() -> &'static str {
20299 "type.googleapis.com/google.cloud.dataproc.v1.SparkHistoryServerConfig"
20300 }
20301}
20302
20303/// Auxiliary services configuration for a workload.
20304#[derive(Clone, Default, PartialEq)]
20305#[non_exhaustive]
20306pub struct PeripheralsConfig {
20307 /// Optional. Resource name of an existing Dataproc Metastore service.
20308 ///
20309 /// Example:
20310 ///
20311 /// * `projects/[project_id]/locations/[region]/services/[service_id]`
20312 pub metastore_service: std::string::String,
20313
20314 /// Optional. The Spark History Server configuration for the workload.
20315 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
20316
20317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20318}
20319
20320impl PeripheralsConfig {
20321 pub fn new() -> Self {
20322 std::default::Default::default()
20323 }
20324
20325 /// Sets the value of [metastore_service][crate::model::PeripheralsConfig::metastore_service].
20326 ///
20327 /// # Example
20328 /// ```ignore,no_run
20329 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20330 /// let x = PeripheralsConfig::new().set_metastore_service("example");
20331 /// ```
20332 pub fn set_metastore_service<T: std::convert::Into<std::string::String>>(
20333 mut self,
20334 v: T,
20335 ) -> Self {
20336 self.metastore_service = v.into();
20337 self
20338 }
20339
20340 /// Sets the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20341 ///
20342 /// # Example
20343 /// ```ignore,no_run
20344 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20345 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20346 /// let x = PeripheralsConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
20347 /// ```
20348 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
20349 where
20350 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20351 {
20352 self.spark_history_server_config = std::option::Option::Some(v.into());
20353 self
20354 }
20355
20356 /// Sets or clears the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20357 ///
20358 /// # Example
20359 /// ```ignore,no_run
20360 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20361 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20362 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
20363 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
20364 /// ```
20365 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
20366 where
20367 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20368 {
20369 self.spark_history_server_config = v.map(|x| x.into());
20370 self
20371 }
20372}
20373
20374impl wkt::message::Message for PeripheralsConfig {
20375 fn typename() -> &'static str {
20376 "type.googleapis.com/google.cloud.dataproc.v1.PeripheralsConfig"
20377 }
20378}
20379
20380/// Runtime information about workload execution.
20381#[derive(Clone, Default, PartialEq)]
20382#[non_exhaustive]
20383pub struct RuntimeInfo {
20384 /// Output only. Map of remote access endpoints (such as web interfaces and
20385 /// APIs) to their URIs.
20386 pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
20387
20388 /// Output only. A URI pointing to the location of the stdout and stderr of the
20389 /// workload.
20390 pub output_uri: std::string::String,
20391
20392 /// Output only. A URI pointing to the location of the diagnostics tarball.
20393 pub diagnostic_output_uri: std::string::String,
20394
20395 /// Output only. Approximate workload resource usage, calculated when
20396 /// the workload completes (see [Dataproc Serverless pricing]
20397 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20398 ///
20399 /// **Note:** This metric calculation may change in the future, for
20400 /// example, to capture cumulative workload resource
20401 /// consumption during workload execution (see the
20402 /// [Dataproc Serverless release notes]
20403 /// (<https://cloud.google.com/dataproc-serverless/docs/release-notes>)
20404 /// for announcements, changes, fixes
20405 /// and other Dataproc developments).
20406 pub approximate_usage: std::option::Option<crate::model::UsageMetrics>,
20407
20408 /// Output only. Snapshot of current workload resource usage.
20409 pub current_usage: std::option::Option<crate::model::UsageSnapshot>,
20410
20411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20412}
20413
20414impl RuntimeInfo {
20415 pub fn new() -> Self {
20416 std::default::Default::default()
20417 }
20418
20419 /// Sets the value of [endpoints][crate::model::RuntimeInfo::endpoints].
20420 ///
20421 /// # Example
20422 /// ```ignore,no_run
20423 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20424 /// let x = RuntimeInfo::new().set_endpoints([
20425 /// ("key0", "abc"),
20426 /// ("key1", "xyz"),
20427 /// ]);
20428 /// ```
20429 pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
20430 where
20431 T: std::iter::IntoIterator<Item = (K, V)>,
20432 K: std::convert::Into<std::string::String>,
20433 V: std::convert::Into<std::string::String>,
20434 {
20435 use std::iter::Iterator;
20436 self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20437 self
20438 }
20439
20440 /// Sets the value of [output_uri][crate::model::RuntimeInfo::output_uri].
20441 ///
20442 /// # Example
20443 /// ```ignore,no_run
20444 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20445 /// let x = RuntimeInfo::new().set_output_uri("example");
20446 /// ```
20447 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20448 self.output_uri = v.into();
20449 self
20450 }
20451
20452 /// Sets the value of [diagnostic_output_uri][crate::model::RuntimeInfo::diagnostic_output_uri].
20453 ///
20454 /// # Example
20455 /// ```ignore,no_run
20456 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20457 /// let x = RuntimeInfo::new().set_diagnostic_output_uri("example");
20458 /// ```
20459 pub fn set_diagnostic_output_uri<T: std::convert::Into<std::string::String>>(
20460 mut self,
20461 v: T,
20462 ) -> Self {
20463 self.diagnostic_output_uri = v.into();
20464 self
20465 }
20466
20467 /// Sets the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20468 ///
20469 /// # Example
20470 /// ```ignore,no_run
20471 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20472 /// use google_cloud_dataproc_v1::model::UsageMetrics;
20473 /// let x = RuntimeInfo::new().set_approximate_usage(UsageMetrics::default()/* use setters */);
20474 /// ```
20475 pub fn set_approximate_usage<T>(mut self, v: T) -> Self
20476 where
20477 T: std::convert::Into<crate::model::UsageMetrics>,
20478 {
20479 self.approximate_usage = std::option::Option::Some(v.into());
20480 self
20481 }
20482
20483 /// Sets or clears the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20484 ///
20485 /// # Example
20486 /// ```ignore,no_run
20487 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20488 /// use google_cloud_dataproc_v1::model::UsageMetrics;
20489 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(Some(UsageMetrics::default()/* use setters */));
20490 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(None::<UsageMetrics>);
20491 /// ```
20492 pub fn set_or_clear_approximate_usage<T>(mut self, v: std::option::Option<T>) -> Self
20493 where
20494 T: std::convert::Into<crate::model::UsageMetrics>,
20495 {
20496 self.approximate_usage = v.map(|x| x.into());
20497 self
20498 }
20499
20500 /// Sets the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20501 ///
20502 /// # Example
20503 /// ```ignore,no_run
20504 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20505 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20506 /// let x = RuntimeInfo::new().set_current_usage(UsageSnapshot::default()/* use setters */);
20507 /// ```
20508 pub fn set_current_usage<T>(mut self, v: T) -> Self
20509 where
20510 T: std::convert::Into<crate::model::UsageSnapshot>,
20511 {
20512 self.current_usage = std::option::Option::Some(v.into());
20513 self
20514 }
20515
20516 /// Sets or clears the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20517 ///
20518 /// # Example
20519 /// ```ignore,no_run
20520 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20521 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20522 /// let x = RuntimeInfo::new().set_or_clear_current_usage(Some(UsageSnapshot::default()/* use setters */));
20523 /// let x = RuntimeInfo::new().set_or_clear_current_usage(None::<UsageSnapshot>);
20524 /// ```
20525 pub fn set_or_clear_current_usage<T>(mut self, v: std::option::Option<T>) -> Self
20526 where
20527 T: std::convert::Into<crate::model::UsageSnapshot>,
20528 {
20529 self.current_usage = v.map(|x| x.into());
20530 self
20531 }
20532}
20533
20534impl wkt::message::Message for RuntimeInfo {
20535 fn typename() -> &'static str {
20536 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeInfo"
20537 }
20538}
20539
20540/// Usage metrics represent approximate total resources consumed by a workload.
20541#[derive(Clone, Default, PartialEq)]
20542#[non_exhaustive]
20543pub struct UsageMetrics {
20544 /// Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`)
20545 /// (see [Dataproc Serverless pricing]
20546 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20547 pub milli_dcu_seconds: i64,
20548
20549 /// Optional. Shuffle storage usage in (`GB` x `seconds`) (see
20550 /// [Dataproc Serverless pricing]
20551 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20552 pub shuffle_storage_gb_seconds: i64,
20553
20554 /// Optional. Accelerator usage in (`milliAccelerator` x `seconds`) (see
20555 /// [Dataproc Serverless pricing]
20556 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20557 pub milli_accelerator_seconds: i64,
20558
20559 /// Optional. Accelerator type being used, if any
20560 pub accelerator_type: std::string::String,
20561
20562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20563}
20564
20565impl UsageMetrics {
20566 pub fn new() -> Self {
20567 std::default::Default::default()
20568 }
20569
20570 /// Sets the value of [milli_dcu_seconds][crate::model::UsageMetrics::milli_dcu_seconds].
20571 ///
20572 /// # Example
20573 /// ```ignore,no_run
20574 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20575 /// let x = UsageMetrics::new().set_milli_dcu_seconds(42);
20576 /// ```
20577 pub fn set_milli_dcu_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20578 self.milli_dcu_seconds = v.into();
20579 self
20580 }
20581
20582 /// Sets the value of [shuffle_storage_gb_seconds][crate::model::UsageMetrics::shuffle_storage_gb_seconds].
20583 ///
20584 /// # Example
20585 /// ```ignore,no_run
20586 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20587 /// let x = UsageMetrics::new().set_shuffle_storage_gb_seconds(42);
20588 /// ```
20589 pub fn set_shuffle_storage_gb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20590 self.shuffle_storage_gb_seconds = v.into();
20591 self
20592 }
20593
20594 /// Sets the value of [milli_accelerator_seconds][crate::model::UsageMetrics::milli_accelerator_seconds].
20595 ///
20596 /// # Example
20597 /// ```ignore,no_run
20598 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20599 /// let x = UsageMetrics::new().set_milli_accelerator_seconds(42);
20600 /// ```
20601 pub fn set_milli_accelerator_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20602 self.milli_accelerator_seconds = v.into();
20603 self
20604 }
20605
20606 /// Sets the value of [accelerator_type][crate::model::UsageMetrics::accelerator_type].
20607 ///
20608 /// # Example
20609 /// ```ignore,no_run
20610 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20611 /// let x = UsageMetrics::new().set_accelerator_type("example");
20612 /// ```
20613 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20614 mut self,
20615 v: T,
20616 ) -> Self {
20617 self.accelerator_type = v.into();
20618 self
20619 }
20620}
20621
20622impl wkt::message::Message for UsageMetrics {
20623 fn typename() -> &'static str {
20624 "type.googleapis.com/google.cloud.dataproc.v1.UsageMetrics"
20625 }
20626}
20627
20628/// The usage snapshot represents the resources consumed by a workload at a
20629/// specified time.
20630#[derive(Clone, Default, PartialEq)]
20631#[non_exhaustive]
20632pub struct UsageSnapshot {
20633 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see
20634 /// [Dataproc Serverless pricing]
20635 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20636 pub milli_dcu: i64,
20637
20638 /// Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless
20639 /// pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20640 pub shuffle_storage_gb: i64,
20641
20642 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at
20643 /// premium tier (see [Dataproc Serverless pricing]
20644 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20645 pub milli_dcu_premium: i64,
20646
20647 /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see
20648 /// [Dataproc Serverless pricing]
20649 /// (<https://cloud.google.com/dataproc-serverless/pricing>))
20650 pub shuffle_storage_gb_premium: i64,
20651
20652 /// Optional. Milli (one-thousandth) accelerator. (see [Dataproc
20653 /// Serverless pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20654 pub milli_accelerator: i64,
20655
20656 /// Optional. Accelerator type being used, if any
20657 pub accelerator_type: std::string::String,
20658
20659 /// Optional. The timestamp of the usage snapshot.
20660 pub snapshot_time: std::option::Option<wkt::Timestamp>,
20661
20662 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20663}
20664
20665impl UsageSnapshot {
20666 pub fn new() -> Self {
20667 std::default::Default::default()
20668 }
20669
20670 /// Sets the value of [milli_dcu][crate::model::UsageSnapshot::milli_dcu].
20671 ///
20672 /// # Example
20673 /// ```ignore,no_run
20674 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20675 /// let x = UsageSnapshot::new().set_milli_dcu(42);
20676 /// ```
20677 pub fn set_milli_dcu<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20678 self.milli_dcu = v.into();
20679 self
20680 }
20681
20682 /// Sets the value of [shuffle_storage_gb][crate::model::UsageSnapshot::shuffle_storage_gb].
20683 ///
20684 /// # Example
20685 /// ```ignore,no_run
20686 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20687 /// let x = UsageSnapshot::new().set_shuffle_storage_gb(42);
20688 /// ```
20689 pub fn set_shuffle_storage_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20690 self.shuffle_storage_gb = v.into();
20691 self
20692 }
20693
20694 /// Sets the value of [milli_dcu_premium][crate::model::UsageSnapshot::milli_dcu_premium].
20695 ///
20696 /// # Example
20697 /// ```ignore,no_run
20698 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20699 /// let x = UsageSnapshot::new().set_milli_dcu_premium(42);
20700 /// ```
20701 pub fn set_milli_dcu_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20702 self.milli_dcu_premium = v.into();
20703 self
20704 }
20705
20706 /// Sets the value of [shuffle_storage_gb_premium][crate::model::UsageSnapshot::shuffle_storage_gb_premium].
20707 ///
20708 /// # Example
20709 /// ```ignore,no_run
20710 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20711 /// let x = UsageSnapshot::new().set_shuffle_storage_gb_premium(42);
20712 /// ```
20713 pub fn set_shuffle_storage_gb_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20714 self.shuffle_storage_gb_premium = v.into();
20715 self
20716 }
20717
20718 /// Sets the value of [milli_accelerator][crate::model::UsageSnapshot::milli_accelerator].
20719 ///
20720 /// # Example
20721 /// ```ignore,no_run
20722 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20723 /// let x = UsageSnapshot::new().set_milli_accelerator(42);
20724 /// ```
20725 pub fn set_milli_accelerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20726 self.milli_accelerator = v.into();
20727 self
20728 }
20729
20730 /// Sets the value of [accelerator_type][crate::model::UsageSnapshot::accelerator_type].
20731 ///
20732 /// # Example
20733 /// ```ignore,no_run
20734 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20735 /// let x = UsageSnapshot::new().set_accelerator_type("example");
20736 /// ```
20737 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20738 mut self,
20739 v: T,
20740 ) -> Self {
20741 self.accelerator_type = v.into();
20742 self
20743 }
20744
20745 /// Sets the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20746 ///
20747 /// # Example
20748 /// ```ignore,no_run
20749 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20750 /// use wkt::Timestamp;
20751 /// let x = UsageSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
20752 /// ```
20753 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
20754 where
20755 T: std::convert::Into<wkt::Timestamp>,
20756 {
20757 self.snapshot_time = std::option::Option::Some(v.into());
20758 self
20759 }
20760
20761 /// Sets or clears the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20762 ///
20763 /// # Example
20764 /// ```ignore,no_run
20765 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20766 /// use wkt::Timestamp;
20767 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
20768 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
20769 /// ```
20770 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
20771 where
20772 T: std::convert::Into<wkt::Timestamp>,
20773 {
20774 self.snapshot_time = v.map(|x| x.into());
20775 self
20776 }
20777}
20778
20779impl wkt::message::Message for UsageSnapshot {
20780 fn typename() -> &'static str {
20781 "type.googleapis.com/google.cloud.dataproc.v1.UsageSnapshot"
20782 }
20783}
20784
20785/// The cluster's GKE config.
20786#[derive(Clone, Default, PartialEq)]
20787#[non_exhaustive]
20788pub struct GkeClusterConfig {
20789 /// Optional. A target GKE cluster to deploy to. It must be in the same project
20790 /// and region as the Dataproc cluster (the GKE cluster can be zonal or
20791 /// regional). Format:
20792 /// 'projects/{project}/locations/{location}/clusters/{cluster_id}'
20793 pub gke_cluster_target: std::string::String,
20794
20795 /// Optional. GKE node pools where workloads will be scheduled. At least one
20796 /// node pool must be assigned the `DEFAULT`
20797 /// [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role].
20798 /// If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT`
20799 /// `GkeNodePoolTarget`. Each role can be given to only one
20800 /// `GkeNodePoolTarget`. All node pools must have the same location settings.
20801 ///
20802 /// [google.cloud.dataproc.v1.GkeNodePoolTarget.Role]: crate::model::gke_node_pool_target::Role
20803 pub node_pool_target: std::vec::Vec<crate::model::GkeNodePoolTarget>,
20804
20805 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20806}
20807
20808impl GkeClusterConfig {
20809 pub fn new() -> Self {
20810 std::default::Default::default()
20811 }
20812
20813 /// Sets the value of [gke_cluster_target][crate::model::GkeClusterConfig::gke_cluster_target].
20814 ///
20815 /// # Example
20816 /// ```ignore,no_run
20817 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20818 /// let x = GkeClusterConfig::new().set_gke_cluster_target("example");
20819 /// ```
20820 pub fn set_gke_cluster_target<T: std::convert::Into<std::string::String>>(
20821 mut self,
20822 v: T,
20823 ) -> Self {
20824 self.gke_cluster_target = v.into();
20825 self
20826 }
20827
20828 /// Sets the value of [node_pool_target][crate::model::GkeClusterConfig::node_pool_target].
20829 ///
20830 /// # Example
20831 /// ```ignore,no_run
20832 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20833 /// use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20834 /// let x = GkeClusterConfig::new()
20835 /// .set_node_pool_target([
20836 /// GkeNodePoolTarget::default()/* use setters */,
20837 /// GkeNodePoolTarget::default()/* use (different) setters */,
20838 /// ]);
20839 /// ```
20840 pub fn set_node_pool_target<T, V>(mut self, v: T) -> Self
20841 where
20842 T: std::iter::IntoIterator<Item = V>,
20843 V: std::convert::Into<crate::model::GkeNodePoolTarget>,
20844 {
20845 use std::iter::Iterator;
20846 self.node_pool_target = v.into_iter().map(|i| i.into()).collect();
20847 self
20848 }
20849}
20850
20851impl wkt::message::Message for GkeClusterConfig {
20852 fn typename() -> &'static str {
20853 "type.googleapis.com/google.cloud.dataproc.v1.GkeClusterConfig"
20854 }
20855}
20856
20857/// The configuration for running the Dataproc cluster on Kubernetes.
20858#[derive(Clone, Default, PartialEq)]
20859#[non_exhaustive]
20860pub struct KubernetesClusterConfig {
20861 /// Optional. A namespace within the Kubernetes cluster to deploy into. If this
20862 /// namespace does not exist, it is created. If it exists, Dataproc verifies
20863 /// that another Dataproc VirtualCluster is not installed into it. If not
20864 /// specified, the name of the Dataproc Cluster is used.
20865 pub kubernetes_namespace: std::string::String,
20866
20867 /// Optional. The software configuration for this Dataproc cluster running on
20868 /// Kubernetes.
20869 pub kubernetes_software_config: std::option::Option<crate::model::KubernetesSoftwareConfig>,
20870
20871 pub config: std::option::Option<crate::model::kubernetes_cluster_config::Config>,
20872
20873 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20874}
20875
20876impl KubernetesClusterConfig {
20877 pub fn new() -> Self {
20878 std::default::Default::default()
20879 }
20880
20881 /// Sets the value of [kubernetes_namespace][crate::model::KubernetesClusterConfig::kubernetes_namespace].
20882 ///
20883 /// # Example
20884 /// ```ignore,no_run
20885 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20886 /// let x = KubernetesClusterConfig::new().set_kubernetes_namespace("example");
20887 /// ```
20888 pub fn set_kubernetes_namespace<T: std::convert::Into<std::string::String>>(
20889 mut self,
20890 v: T,
20891 ) -> Self {
20892 self.kubernetes_namespace = v.into();
20893 self
20894 }
20895
20896 /// Sets the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20897 ///
20898 /// # Example
20899 /// ```ignore,no_run
20900 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20901 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20902 /// let x = KubernetesClusterConfig::new().set_kubernetes_software_config(KubernetesSoftwareConfig::default()/* use setters */);
20903 /// ```
20904 pub fn set_kubernetes_software_config<T>(mut self, v: T) -> Self
20905 where
20906 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20907 {
20908 self.kubernetes_software_config = std::option::Option::Some(v.into());
20909 self
20910 }
20911
20912 /// Sets or clears the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20913 ///
20914 /// # Example
20915 /// ```ignore,no_run
20916 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20917 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20918 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(Some(KubernetesSoftwareConfig::default()/* use setters */));
20919 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(None::<KubernetesSoftwareConfig>);
20920 /// ```
20921 pub fn set_or_clear_kubernetes_software_config<T>(mut self, v: std::option::Option<T>) -> Self
20922 where
20923 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20924 {
20925 self.kubernetes_software_config = v.map(|x| x.into());
20926 self
20927 }
20928
20929 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config].
20930 ///
20931 /// Note that all the setters affecting `config` are mutually
20932 /// exclusive.
20933 ///
20934 /// # Example
20935 /// ```ignore,no_run
20936 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20937 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20938 /// let x = KubernetesClusterConfig::new().set_config(Some(
20939 /// google_cloud_dataproc_v1::model::kubernetes_cluster_config::Config::GkeClusterConfig(GkeClusterConfig::default().into())));
20940 /// ```
20941 pub fn set_config<
20942 T: std::convert::Into<std::option::Option<crate::model::kubernetes_cluster_config::Config>>,
20943 >(
20944 mut self,
20945 v: T,
20946 ) -> Self {
20947 self.config = v.into();
20948 self
20949 }
20950
20951 /// The value of [config][crate::model::KubernetesClusterConfig::config]
20952 /// if it holds a `GkeClusterConfig`, `None` if the field is not set or
20953 /// holds a different branch.
20954 pub fn gke_cluster_config(
20955 &self,
20956 ) -> std::option::Option<&std::boxed::Box<crate::model::GkeClusterConfig>> {
20957 #[allow(unreachable_patterns)]
20958 self.config.as_ref().and_then(|v| match v {
20959 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v) => {
20960 std::option::Option::Some(v)
20961 }
20962 _ => std::option::Option::None,
20963 })
20964 }
20965
20966 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config]
20967 /// to hold a `GkeClusterConfig`.
20968 ///
20969 /// Note that all the setters affecting `config` are
20970 /// mutually exclusive.
20971 ///
20972 /// # Example
20973 /// ```ignore,no_run
20974 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20975 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20976 /// let x = KubernetesClusterConfig::new().set_gke_cluster_config(GkeClusterConfig::default()/* use setters */);
20977 /// assert!(x.gke_cluster_config().is_some());
20978 /// ```
20979 pub fn set_gke_cluster_config<
20980 T: std::convert::Into<std::boxed::Box<crate::model::GkeClusterConfig>>,
20981 >(
20982 mut self,
20983 v: T,
20984 ) -> Self {
20985 self.config = std::option::Option::Some(
20986 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v.into()),
20987 );
20988 self
20989 }
20990}
20991
20992impl wkt::message::Message for KubernetesClusterConfig {
20993 fn typename() -> &'static str {
20994 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesClusterConfig"
20995 }
20996}
20997
20998/// Defines additional types related to [KubernetesClusterConfig].
20999pub mod kubernetes_cluster_config {
21000 #[allow(unused_imports)]
21001 use super::*;
21002
21003 #[derive(Clone, Debug, PartialEq)]
21004 #[non_exhaustive]
21005 pub enum Config {
21006 /// Required. The configuration for running the Dataproc cluster on GKE.
21007 GkeClusterConfig(std::boxed::Box<crate::model::GkeClusterConfig>),
21008 }
21009}
21010
21011/// The software configuration for this Dataproc cluster running on Kubernetes.
21012#[derive(Clone, Default, PartialEq)]
21013#[non_exhaustive]
21014pub struct KubernetesSoftwareConfig {
21015 /// The components that should be installed in this Dataproc cluster. The key
21016 /// must be a string from the KubernetesComponent enumeration. The value is
21017 /// the version of the software to be installed.
21018 /// At least one entry must be specified.
21019 pub component_version: std::collections::HashMap<std::string::String, std::string::String>,
21020
21021 /// The properties to set on daemon config files.
21022 ///
21023 /// Property keys are specified in `prefix:property` format, for example
21024 /// `spark:spark.kubernetes.container.image`. The following are supported
21025 /// prefixes and their mappings:
21026 ///
21027 /// * spark: `spark-defaults.conf`
21028 ///
21029 /// For more information, see [Cluster
21030 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
21031 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
21032
21033 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21034}
21035
21036impl KubernetesSoftwareConfig {
21037 pub fn new() -> Self {
21038 std::default::Default::default()
21039 }
21040
21041 /// Sets the value of [component_version][crate::model::KubernetesSoftwareConfig::component_version].
21042 ///
21043 /// # Example
21044 /// ```ignore,no_run
21045 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21046 /// let x = KubernetesSoftwareConfig::new().set_component_version([
21047 /// ("key0", "abc"),
21048 /// ("key1", "xyz"),
21049 /// ]);
21050 /// ```
21051 pub fn set_component_version<T, K, V>(mut self, v: T) -> Self
21052 where
21053 T: std::iter::IntoIterator<Item = (K, V)>,
21054 K: std::convert::Into<std::string::String>,
21055 V: std::convert::Into<std::string::String>,
21056 {
21057 use std::iter::Iterator;
21058 self.component_version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21059 self
21060 }
21061
21062 /// Sets the value of [properties][crate::model::KubernetesSoftwareConfig::properties].
21063 ///
21064 /// # Example
21065 /// ```ignore,no_run
21066 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21067 /// let x = KubernetesSoftwareConfig::new().set_properties([
21068 /// ("key0", "abc"),
21069 /// ("key1", "xyz"),
21070 /// ]);
21071 /// ```
21072 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
21073 where
21074 T: std::iter::IntoIterator<Item = (K, V)>,
21075 K: std::convert::Into<std::string::String>,
21076 V: std::convert::Into<std::string::String>,
21077 {
21078 use std::iter::Iterator;
21079 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21080 self
21081 }
21082}
21083
21084impl wkt::message::Message for KubernetesSoftwareConfig {
21085 fn typename() -> &'static str {
21086 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesSoftwareConfig"
21087 }
21088}
21089
21090/// GKE node pools that Dataproc workloads run on.
21091#[derive(Clone, Default, PartialEq)]
21092#[non_exhaustive]
21093pub struct GkeNodePoolTarget {
21094 /// Required. The target GKE node pool.
21095 /// Format:
21096 /// 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
21097 pub node_pool: std::string::String,
21098
21099 /// Required. The roles associated with the GKE node pool.
21100 pub roles: std::vec::Vec<crate::model::gke_node_pool_target::Role>,
21101
21102 /// Input only. The configuration for the GKE node pool.
21103 ///
21104 /// If specified, Dataproc attempts to create a node pool with the
21105 /// specified shape. If one with the same name already exists, it is
21106 /// verified against all specified fields. If a field differs, the
21107 /// virtual cluster creation will fail.
21108 ///
21109 /// If omitted, any node pool with the specified name is used. If a
21110 /// node pool with the specified name does not exist, Dataproc create a
21111 /// node pool with default values.
21112 ///
21113 /// This is an input only field. It will not be returned by the API.
21114 pub node_pool_config: std::option::Option<crate::model::GkeNodePoolConfig>,
21115
21116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21117}
21118
21119impl GkeNodePoolTarget {
21120 pub fn new() -> Self {
21121 std::default::Default::default()
21122 }
21123
21124 /// Sets the value of [node_pool][crate::model::GkeNodePoolTarget::node_pool].
21125 ///
21126 /// # Example
21127 /// ```ignore,no_run
21128 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21129 /// let x = GkeNodePoolTarget::new().set_node_pool("example");
21130 /// ```
21131 pub fn set_node_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21132 self.node_pool = v.into();
21133 self
21134 }
21135
21136 /// Sets the value of [roles][crate::model::GkeNodePoolTarget::roles].
21137 ///
21138 /// # Example
21139 /// ```ignore,no_run
21140 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21141 /// use google_cloud_dataproc_v1::model::gke_node_pool_target::Role;
21142 /// let x = GkeNodePoolTarget::new().set_roles([
21143 /// Role::Default,
21144 /// Role::Controller,
21145 /// Role::SparkDriver,
21146 /// ]);
21147 /// ```
21148 pub fn set_roles<T, V>(mut self, v: T) -> Self
21149 where
21150 T: std::iter::IntoIterator<Item = V>,
21151 V: std::convert::Into<crate::model::gke_node_pool_target::Role>,
21152 {
21153 use std::iter::Iterator;
21154 self.roles = v.into_iter().map(|i| i.into()).collect();
21155 self
21156 }
21157
21158 /// Sets the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21159 ///
21160 /// # Example
21161 /// ```ignore,no_run
21162 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21163 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21164 /// let x = GkeNodePoolTarget::new().set_node_pool_config(GkeNodePoolConfig::default()/* use setters */);
21165 /// ```
21166 pub fn set_node_pool_config<T>(mut self, v: T) -> Self
21167 where
21168 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21169 {
21170 self.node_pool_config = std::option::Option::Some(v.into());
21171 self
21172 }
21173
21174 /// Sets or clears the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21175 ///
21176 /// # Example
21177 /// ```ignore,no_run
21178 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21179 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21180 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(Some(GkeNodePoolConfig::default()/* use setters */));
21181 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(None::<GkeNodePoolConfig>);
21182 /// ```
21183 pub fn set_or_clear_node_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
21184 where
21185 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21186 {
21187 self.node_pool_config = v.map(|x| x.into());
21188 self
21189 }
21190}
21191
21192impl wkt::message::Message for GkeNodePoolTarget {
21193 fn typename() -> &'static str {
21194 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolTarget"
21195 }
21196}
21197
21198/// Defines additional types related to [GkeNodePoolTarget].
21199pub mod gke_node_pool_target {
21200 #[allow(unused_imports)]
21201 use super::*;
21202
21203 /// `Role` specifies the tasks that will run on the node pool. Roles can be
21204 /// specific to workloads. Exactly one
21205 /// [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the
21206 /// virtual cluster must have the `DEFAULT` role, which is used to run all
21207 /// workloads that are not associated with a node pool.
21208 ///
21209 /// [google.cloud.dataproc.v1.GkeNodePoolTarget]: crate::model::GkeNodePoolTarget
21210 ///
21211 /// # Working with unknown values
21212 ///
21213 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21214 /// additional enum variants at any time. Adding new variants is not considered
21215 /// a breaking change. Applications should write their code in anticipation of:
21216 ///
21217 /// - New values appearing in future releases of the client library, **and**
21218 /// - New values received dynamically, without application changes.
21219 ///
21220 /// Please consult the [Working with enums] section in the user guide for some
21221 /// guidelines.
21222 ///
21223 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21224 #[derive(Clone, Debug, PartialEq)]
21225 #[non_exhaustive]
21226 pub enum Role {
21227 /// Role is unspecified.
21228 Unspecified,
21229 /// At least one node pool must have the `DEFAULT` role.
21230 /// Work assigned to a role that is not associated with a node pool
21231 /// is assigned to the node pool with the `DEFAULT` role. For example,
21232 /// work assigned to the `CONTROLLER` role will be assigned to the node pool
21233 /// with the `DEFAULT` role if no node pool has the `CONTROLLER` role.
21234 Default,
21235 /// Run work associated with the Dataproc control plane (for example,
21236 /// controllers and webhooks). Very low resource requirements.
21237 Controller,
21238 /// Run work associated with a Spark driver of a job.
21239 SparkDriver,
21240 /// Run work associated with a Spark executor of a job.
21241 SparkExecutor,
21242 /// If set, the enum was initialized with an unknown value.
21243 ///
21244 /// Applications can examine the value using [Role::value] or
21245 /// [Role::name].
21246 UnknownValue(role::UnknownValue),
21247 }
21248
21249 #[doc(hidden)]
21250 pub mod role {
21251 #[allow(unused_imports)]
21252 use super::*;
21253 #[derive(Clone, Debug, PartialEq)]
21254 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21255 }
21256
21257 impl Role {
21258 /// Gets the enum value.
21259 ///
21260 /// Returns `None` if the enum contains an unknown value deserialized from
21261 /// the string representation of enums.
21262 pub fn value(&self) -> std::option::Option<i32> {
21263 match self {
21264 Self::Unspecified => std::option::Option::Some(0),
21265 Self::Default => std::option::Option::Some(1),
21266 Self::Controller => std::option::Option::Some(2),
21267 Self::SparkDriver => std::option::Option::Some(3),
21268 Self::SparkExecutor => std::option::Option::Some(4),
21269 Self::UnknownValue(u) => u.0.value(),
21270 }
21271 }
21272
21273 /// Gets the enum value as a string.
21274 ///
21275 /// Returns `None` if the enum contains an unknown value deserialized from
21276 /// the integer representation of enums.
21277 pub fn name(&self) -> std::option::Option<&str> {
21278 match self {
21279 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
21280 Self::Default => std::option::Option::Some("DEFAULT"),
21281 Self::Controller => std::option::Option::Some("CONTROLLER"),
21282 Self::SparkDriver => std::option::Option::Some("SPARK_DRIVER"),
21283 Self::SparkExecutor => std::option::Option::Some("SPARK_EXECUTOR"),
21284 Self::UnknownValue(u) => u.0.name(),
21285 }
21286 }
21287 }
21288
21289 impl std::default::Default for Role {
21290 fn default() -> Self {
21291 use std::convert::From;
21292 Self::from(0)
21293 }
21294 }
21295
21296 impl std::fmt::Display for Role {
21297 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21298 wkt::internal::display_enum(f, self.name(), self.value())
21299 }
21300 }
21301
21302 impl std::convert::From<i32> for Role {
21303 fn from(value: i32) -> Self {
21304 match value {
21305 0 => Self::Unspecified,
21306 1 => Self::Default,
21307 2 => Self::Controller,
21308 3 => Self::SparkDriver,
21309 4 => Self::SparkExecutor,
21310 _ => Self::UnknownValue(role::UnknownValue(
21311 wkt::internal::UnknownEnumValue::Integer(value),
21312 )),
21313 }
21314 }
21315 }
21316
21317 impl std::convert::From<&str> for Role {
21318 fn from(value: &str) -> Self {
21319 use std::string::ToString;
21320 match value {
21321 "ROLE_UNSPECIFIED" => Self::Unspecified,
21322 "DEFAULT" => Self::Default,
21323 "CONTROLLER" => Self::Controller,
21324 "SPARK_DRIVER" => Self::SparkDriver,
21325 "SPARK_EXECUTOR" => Self::SparkExecutor,
21326 _ => Self::UnknownValue(role::UnknownValue(
21327 wkt::internal::UnknownEnumValue::String(value.to_string()),
21328 )),
21329 }
21330 }
21331 }
21332
21333 impl serde::ser::Serialize for Role {
21334 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21335 where
21336 S: serde::Serializer,
21337 {
21338 match self {
21339 Self::Unspecified => serializer.serialize_i32(0),
21340 Self::Default => serializer.serialize_i32(1),
21341 Self::Controller => serializer.serialize_i32(2),
21342 Self::SparkDriver => serializer.serialize_i32(3),
21343 Self::SparkExecutor => serializer.serialize_i32(4),
21344 Self::UnknownValue(u) => u.0.serialize(serializer),
21345 }
21346 }
21347 }
21348
21349 impl<'de> serde::de::Deserialize<'de> for Role {
21350 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21351 where
21352 D: serde::Deserializer<'de>,
21353 {
21354 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
21355 ".google.cloud.dataproc.v1.GkeNodePoolTarget.Role",
21356 ))
21357 }
21358 }
21359}
21360
21361/// The configuration of a GKE node pool used by a [Dataproc-on-GKE
21362/// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
21363#[derive(Clone, Default, PartialEq)]
21364#[non_exhaustive]
21365pub struct GkeNodePoolConfig {
21366 /// Optional. The node pool configuration.
21367 pub config: std::option::Option<crate::model::gke_node_pool_config::GkeNodeConfig>,
21368
21369 /// Optional. The list of Compute Engine
21370 /// [zones](https://cloud.google.com/compute/docs/zones#available) where
21371 /// node pool nodes associated with a Dataproc on GKE virtual cluster
21372 /// will be located.
21373 ///
21374 /// **Note:** All node pools associated with a virtual cluster
21375 /// must be located in the same region as the virtual cluster, and they must
21376 /// be located in the same zone within that region.
21377 ///
21378 /// If a location is not specified during node pool creation, Dataproc on GKE
21379 /// will choose the zone.
21380 pub locations: std::vec::Vec<std::string::String>,
21381
21382 /// Optional. The autoscaler configuration for this node pool. The autoscaler
21383 /// is enabled only when a valid configuration is present.
21384 pub autoscaling:
21385 std::option::Option<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21386
21387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21388}
21389
21390impl GkeNodePoolConfig {
21391 pub fn new() -> Self {
21392 std::default::Default::default()
21393 }
21394
21395 /// Sets the value of [config][crate::model::GkeNodePoolConfig::config].
21396 ///
21397 /// # Example
21398 /// ```ignore,no_run
21399 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21400 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21401 /// let x = GkeNodePoolConfig::new().set_config(GkeNodeConfig::default()/* use setters */);
21402 /// ```
21403 pub fn set_config<T>(mut self, v: T) -> Self
21404 where
21405 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21406 {
21407 self.config = std::option::Option::Some(v.into());
21408 self
21409 }
21410
21411 /// Sets or clears the value of [config][crate::model::GkeNodePoolConfig::config].
21412 ///
21413 /// # Example
21414 /// ```ignore,no_run
21415 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21416 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21417 /// let x = GkeNodePoolConfig::new().set_or_clear_config(Some(GkeNodeConfig::default()/* use setters */));
21418 /// let x = GkeNodePoolConfig::new().set_or_clear_config(None::<GkeNodeConfig>);
21419 /// ```
21420 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
21421 where
21422 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21423 {
21424 self.config = v.map(|x| x.into());
21425 self
21426 }
21427
21428 /// Sets the value of [locations][crate::model::GkeNodePoolConfig::locations].
21429 ///
21430 /// # Example
21431 /// ```ignore,no_run
21432 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21433 /// let x = GkeNodePoolConfig::new().set_locations(["a", "b", "c"]);
21434 /// ```
21435 pub fn set_locations<T, V>(mut self, v: T) -> Self
21436 where
21437 T: std::iter::IntoIterator<Item = V>,
21438 V: std::convert::Into<std::string::String>,
21439 {
21440 use std::iter::Iterator;
21441 self.locations = v.into_iter().map(|i| i.into()).collect();
21442 self
21443 }
21444
21445 /// Sets the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21446 ///
21447 /// # Example
21448 /// ```ignore,no_run
21449 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21450 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21451 /// let x = GkeNodePoolConfig::new().set_autoscaling(GkeNodePoolAutoscalingConfig::default()/* use setters */);
21452 /// ```
21453 pub fn set_autoscaling<T>(mut self, v: T) -> Self
21454 where
21455 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21456 {
21457 self.autoscaling = std::option::Option::Some(v.into());
21458 self
21459 }
21460
21461 /// Sets or clears the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21462 ///
21463 /// # Example
21464 /// ```ignore,no_run
21465 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21466 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21467 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(Some(GkeNodePoolAutoscalingConfig::default()/* use setters */));
21468 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(None::<GkeNodePoolAutoscalingConfig>);
21469 /// ```
21470 pub fn set_or_clear_autoscaling<T>(mut self, v: std::option::Option<T>) -> Self
21471 where
21472 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21473 {
21474 self.autoscaling = v.map(|x| x.into());
21475 self
21476 }
21477}
21478
21479impl wkt::message::Message for GkeNodePoolConfig {
21480 fn typename() -> &'static str {
21481 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig"
21482 }
21483}
21484
21485/// Defines additional types related to [GkeNodePoolConfig].
21486pub mod gke_node_pool_config {
21487 #[allow(unused_imports)]
21488 use super::*;
21489
21490 /// Parameters that describe cluster nodes.
21491 #[derive(Clone, Default, PartialEq)]
21492 #[non_exhaustive]
21493 pub struct GkeNodeConfig {
21494 /// Optional. The name of a Compute Engine [machine
21495 /// type](https://cloud.google.com/compute/docs/machine-types).
21496 pub machine_type: std::string::String,
21497
21498 /// Optional. The number of local SSD disks to attach to the node, which is
21499 /// limited by the maximum number of disks allowable per zone (see [Adding
21500 /// Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)).
21501 pub local_ssd_count: i32,
21502
21503 /// Optional. Whether the nodes are created as legacy [preemptible VM
21504 /// instances] (<https://cloud.google.com/compute/docs/instances/preemptible>).
21505 /// Also see
21506 /// [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]
21507 /// VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot
21508 /// preemptible nodes cannot be used in a node pool with the `CONTROLLER`
21509 /// [role]
21510 /// (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21511 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21512 /// DEFAULT node pool will assume the CONTROLLER role).
21513 ///
21514 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]: crate::model::gke_node_pool_config::GkeNodeConfig::spot
21515 pub preemptible: bool,
21516
21517 /// Optional. A list of [hardware
21518 /// accelerators](https://cloud.google.com/compute/docs/gpus) to attach to
21519 /// each node.
21520 pub accelerators:
21521 std::vec::Vec<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21522
21523 /// Optional. [Minimum CPU
21524 /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
21525 /// to be used by this instance. The instance may be scheduled on the
21526 /// specified or a newer CPU platform. Specify the friendly names of CPU
21527 /// platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
21528 pub min_cpu_platform: std::string::String,
21529
21530 /// Optional. The [Customer Managed Encryption Key (CMEK)]
21531 /// (<https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek>)
21532 /// used to encrypt the boot disk attached to each node in the node pool.
21533 /// Specify the key using the following format:
21534 /// \<code\>projects/\<var\>KEY_PROJECT_ID\</var\>/locations/\<var\>LOCATION\</var\>/keyRings/\<var\>RING_NAME\</var\>/cryptoKeys/\<var\>KEY_NAME\</var\>\</code\>.
21535 pub boot_disk_kms_key: std::string::String,
21536
21537 /// Optional. Whether the nodes are created as [Spot VM instances]
21538 /// (<https://cloud.google.com/compute/docs/instances/spot>).
21539 /// Spot VMs are the latest update to legacy
21540 /// [preemptible
21541 /// VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible].
21542 /// Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible
21543 /// nodes cannot be used in a node pool with the `CONTROLLER`
21544 /// [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21545 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21546 /// DEFAULT node pool will assume the CONTROLLER role).
21547 ///
21548 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]: crate::model::gke_node_pool_config::GkeNodeConfig::preemptible
21549 pub spot: bool,
21550
21551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21552 }
21553
21554 impl GkeNodeConfig {
21555 pub fn new() -> Self {
21556 std::default::Default::default()
21557 }
21558
21559 /// Sets the value of [machine_type][crate::model::gke_node_pool_config::GkeNodeConfig::machine_type].
21560 ///
21561 /// # Example
21562 /// ```ignore,no_run
21563 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21564 /// let x = GkeNodeConfig::new().set_machine_type("example");
21565 /// ```
21566 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
21567 mut self,
21568 v: T,
21569 ) -> Self {
21570 self.machine_type = v.into();
21571 self
21572 }
21573
21574 /// Sets the value of [local_ssd_count][crate::model::gke_node_pool_config::GkeNodeConfig::local_ssd_count].
21575 ///
21576 /// # Example
21577 /// ```ignore,no_run
21578 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21579 /// let x = GkeNodeConfig::new().set_local_ssd_count(42);
21580 /// ```
21581 pub fn set_local_ssd_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21582 self.local_ssd_count = v.into();
21583 self
21584 }
21585
21586 /// Sets the value of [preemptible][crate::model::gke_node_pool_config::GkeNodeConfig::preemptible].
21587 ///
21588 /// # Example
21589 /// ```ignore,no_run
21590 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21591 /// let x = GkeNodeConfig::new().set_preemptible(true);
21592 /// ```
21593 pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21594 self.preemptible = v.into();
21595 self
21596 }
21597
21598 /// Sets the value of [accelerators][crate::model::gke_node_pool_config::GkeNodeConfig::accelerators].
21599 ///
21600 /// # Example
21601 /// ```ignore,no_run
21602 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21603 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21604 /// let x = GkeNodeConfig::new()
21605 /// .set_accelerators([
21606 /// GkeNodePoolAcceleratorConfig::default()/* use setters */,
21607 /// GkeNodePoolAcceleratorConfig::default()/* use (different) setters */,
21608 /// ]);
21609 /// ```
21610 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
21611 where
21612 T: std::iter::IntoIterator<Item = V>,
21613 V: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21614 {
21615 use std::iter::Iterator;
21616 self.accelerators = v.into_iter().map(|i| i.into()).collect();
21617 self
21618 }
21619
21620 /// Sets the value of [min_cpu_platform][crate::model::gke_node_pool_config::GkeNodeConfig::min_cpu_platform].
21621 ///
21622 /// # Example
21623 /// ```ignore,no_run
21624 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21625 /// let x = GkeNodeConfig::new().set_min_cpu_platform("example");
21626 /// ```
21627 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
21628 mut self,
21629 v: T,
21630 ) -> Self {
21631 self.min_cpu_platform = v.into();
21632 self
21633 }
21634
21635 /// Sets the value of [boot_disk_kms_key][crate::model::gke_node_pool_config::GkeNodeConfig::boot_disk_kms_key].
21636 ///
21637 /// # Example
21638 /// ```ignore,no_run
21639 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21640 /// let x = GkeNodeConfig::new().set_boot_disk_kms_key("example");
21641 /// ```
21642 pub fn set_boot_disk_kms_key<T: std::convert::Into<std::string::String>>(
21643 mut self,
21644 v: T,
21645 ) -> Self {
21646 self.boot_disk_kms_key = v.into();
21647 self
21648 }
21649
21650 /// Sets the value of [spot][crate::model::gke_node_pool_config::GkeNodeConfig::spot].
21651 ///
21652 /// # Example
21653 /// ```ignore,no_run
21654 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21655 /// let x = GkeNodeConfig::new().set_spot(true);
21656 /// ```
21657 pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21658 self.spot = v.into();
21659 self
21660 }
21661 }
21662
21663 impl wkt::message::Message for GkeNodeConfig {
21664 fn typename() -> &'static str {
21665 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig"
21666 }
21667 }
21668
21669 /// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request
21670 /// for a node pool.
21671 #[derive(Clone, Default, PartialEq)]
21672 #[non_exhaustive]
21673 pub struct GkeNodePoolAcceleratorConfig {
21674 /// The number of accelerator cards exposed to an instance.
21675 pub accelerator_count: i64,
21676
21677 /// The accelerator type resource namename (see GPUs on Compute Engine).
21678 pub accelerator_type: std::string::String,
21679
21680 /// Size of partitions to create on the GPU. Valid values are described in
21681 /// the NVIDIA [mig user
21682 /// guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
21683 pub gpu_partition_size: std::string::String,
21684
21685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21686 }
21687
21688 impl GkeNodePoolAcceleratorConfig {
21689 pub fn new() -> Self {
21690 std::default::Default::default()
21691 }
21692
21693 /// Sets the value of [accelerator_count][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_count].
21694 ///
21695 /// # Example
21696 /// ```ignore,no_run
21697 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21698 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_count(42);
21699 /// ```
21700 pub fn set_accelerator_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21701 self.accelerator_count = v.into();
21702 self
21703 }
21704
21705 /// Sets the value of [accelerator_type][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_type].
21706 ///
21707 /// # Example
21708 /// ```ignore,no_run
21709 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21710 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_type("example");
21711 /// ```
21712 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21713 mut self,
21714 v: T,
21715 ) -> Self {
21716 self.accelerator_type = v.into();
21717 self
21718 }
21719
21720 /// Sets the value of [gpu_partition_size][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::gpu_partition_size].
21721 ///
21722 /// # Example
21723 /// ```ignore,no_run
21724 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21725 /// let x = GkeNodePoolAcceleratorConfig::new().set_gpu_partition_size("example");
21726 /// ```
21727 pub fn set_gpu_partition_size<T: std::convert::Into<std::string::String>>(
21728 mut self,
21729 v: T,
21730 ) -> Self {
21731 self.gpu_partition_size = v.into();
21732 self
21733 }
21734 }
21735
21736 impl wkt::message::Message for GkeNodePoolAcceleratorConfig {
21737 fn typename() -> &'static str {
21738 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAcceleratorConfig"
21739 }
21740 }
21741
21742 /// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to
21743 /// adjust the size of the node pool to the current cluster usage.
21744 #[derive(Clone, Default, PartialEq)]
21745 #[non_exhaustive]
21746 pub struct GkeNodePoolAutoscalingConfig {
21747 /// The minimum number of nodes in the node pool. Must be >= 0 and <=
21748 /// max_node_count.
21749 pub min_node_count: i32,
21750
21751 /// The maximum number of nodes in the node pool. Must be >= min_node_count,
21752 /// and must be > 0.
21753 /// **Note:** Quota must be sufficient to scale up the cluster.
21754 pub max_node_count: i32,
21755
21756 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21757 }
21758
21759 impl GkeNodePoolAutoscalingConfig {
21760 pub fn new() -> Self {
21761 std::default::Default::default()
21762 }
21763
21764 /// Sets the value of [min_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::min_node_count].
21765 ///
21766 /// # Example
21767 /// ```ignore,no_run
21768 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21769 /// let x = GkeNodePoolAutoscalingConfig::new().set_min_node_count(42);
21770 /// ```
21771 pub fn set_min_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21772 self.min_node_count = v.into();
21773 self
21774 }
21775
21776 /// Sets the value of [max_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::max_node_count].
21777 ///
21778 /// # Example
21779 /// ```ignore,no_run
21780 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21781 /// let x = GkeNodePoolAutoscalingConfig::new().set_max_node_count(42);
21782 /// ```
21783 pub fn set_max_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21784 self.max_node_count = v.into();
21785 self
21786 }
21787 }
21788
21789 impl wkt::message::Message for GkeNodePoolAutoscalingConfig {
21790 fn typename() -> &'static str {
21791 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAutoscalingConfig"
21792 }
21793 }
21794}
21795
21796/// Authentication configuration for a workload is used to set the default
21797/// identity for the workload execution.
21798/// The config specifies the type of identity (service account or user) that
21799/// will be used by workloads to access resources on the project(s).
21800#[derive(Clone, Default, PartialEq)]
21801#[non_exhaustive]
21802pub struct AuthenticationConfig {
21803 /// Optional. Authentication type for the user workload running in containers.
21804 pub user_workload_authentication_type: crate::model::authentication_config::AuthenticationType,
21805
21806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21807}
21808
21809impl AuthenticationConfig {
21810 pub fn new() -> Self {
21811 std::default::Default::default()
21812 }
21813
21814 /// Sets the value of [user_workload_authentication_type][crate::model::AuthenticationConfig::user_workload_authentication_type].
21815 ///
21816 /// # Example
21817 /// ```ignore,no_run
21818 /// # use google_cloud_dataproc_v1::model::AuthenticationConfig;
21819 /// use google_cloud_dataproc_v1::model::authentication_config::AuthenticationType;
21820 /// let x0 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::ServiceAccount);
21821 /// let x1 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::EndUserCredentials);
21822 /// ```
21823 pub fn set_user_workload_authentication_type<
21824 T: std::convert::Into<crate::model::authentication_config::AuthenticationType>,
21825 >(
21826 mut self,
21827 v: T,
21828 ) -> Self {
21829 self.user_workload_authentication_type = v.into();
21830 self
21831 }
21832}
21833
21834impl wkt::message::Message for AuthenticationConfig {
21835 fn typename() -> &'static str {
21836 "type.googleapis.com/google.cloud.dataproc.v1.AuthenticationConfig"
21837 }
21838}
21839
21840/// Defines additional types related to [AuthenticationConfig].
21841pub mod authentication_config {
21842 #[allow(unused_imports)]
21843 use super::*;
21844
21845 /// Authentication types for workload execution.
21846 ///
21847 /// # Working with unknown values
21848 ///
21849 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21850 /// additional enum variants at any time. Adding new variants is not considered
21851 /// a breaking change. Applications should write their code in anticipation of:
21852 ///
21853 /// - New values appearing in future releases of the client library, **and**
21854 /// - New values received dynamically, without application changes.
21855 ///
21856 /// Please consult the [Working with enums] section in the user guide for some
21857 /// guidelines.
21858 ///
21859 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21860 #[derive(Clone, Debug, PartialEq)]
21861 #[non_exhaustive]
21862 pub enum AuthenticationType {
21863 /// If AuthenticationType is unspecified then END_USER_CREDENTIALS is used
21864 /// for 3.0 and newer runtimes, and SERVICE_ACCOUNT is used for older
21865 /// runtimes.
21866 Unspecified,
21867 /// Use service account credentials for authenticating to other services.
21868 ServiceAccount,
21869 /// Use OAuth credentials associated with the workload creator/user for
21870 /// authenticating to other services.
21871 EndUserCredentials,
21872 /// If set, the enum was initialized with an unknown value.
21873 ///
21874 /// Applications can examine the value using [AuthenticationType::value] or
21875 /// [AuthenticationType::name].
21876 UnknownValue(authentication_type::UnknownValue),
21877 }
21878
21879 #[doc(hidden)]
21880 pub mod authentication_type {
21881 #[allow(unused_imports)]
21882 use super::*;
21883 #[derive(Clone, Debug, PartialEq)]
21884 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21885 }
21886
21887 impl AuthenticationType {
21888 /// Gets the enum value.
21889 ///
21890 /// Returns `None` if the enum contains an unknown value deserialized from
21891 /// the string representation of enums.
21892 pub fn value(&self) -> std::option::Option<i32> {
21893 match self {
21894 Self::Unspecified => std::option::Option::Some(0),
21895 Self::ServiceAccount => std::option::Option::Some(1),
21896 Self::EndUserCredentials => std::option::Option::Some(2),
21897 Self::UnknownValue(u) => u.0.value(),
21898 }
21899 }
21900
21901 /// Gets the enum value as a string.
21902 ///
21903 /// Returns `None` if the enum contains an unknown value deserialized from
21904 /// the integer representation of enums.
21905 pub fn name(&self) -> std::option::Option<&str> {
21906 match self {
21907 Self::Unspecified => std::option::Option::Some("AUTHENTICATION_TYPE_UNSPECIFIED"),
21908 Self::ServiceAccount => std::option::Option::Some("SERVICE_ACCOUNT"),
21909 Self::EndUserCredentials => std::option::Option::Some("END_USER_CREDENTIALS"),
21910 Self::UnknownValue(u) => u.0.name(),
21911 }
21912 }
21913 }
21914
21915 impl std::default::Default for AuthenticationType {
21916 fn default() -> Self {
21917 use std::convert::From;
21918 Self::from(0)
21919 }
21920 }
21921
21922 impl std::fmt::Display for AuthenticationType {
21923 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21924 wkt::internal::display_enum(f, self.name(), self.value())
21925 }
21926 }
21927
21928 impl std::convert::From<i32> for AuthenticationType {
21929 fn from(value: i32) -> Self {
21930 match value {
21931 0 => Self::Unspecified,
21932 1 => Self::ServiceAccount,
21933 2 => Self::EndUserCredentials,
21934 _ => Self::UnknownValue(authentication_type::UnknownValue(
21935 wkt::internal::UnknownEnumValue::Integer(value),
21936 )),
21937 }
21938 }
21939 }
21940
21941 impl std::convert::From<&str> for AuthenticationType {
21942 fn from(value: &str) -> Self {
21943 use std::string::ToString;
21944 match value {
21945 "AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
21946 "SERVICE_ACCOUNT" => Self::ServiceAccount,
21947 "END_USER_CREDENTIALS" => Self::EndUserCredentials,
21948 _ => Self::UnknownValue(authentication_type::UnknownValue(
21949 wkt::internal::UnknownEnumValue::String(value.to_string()),
21950 )),
21951 }
21952 }
21953 }
21954
21955 impl serde::ser::Serialize for AuthenticationType {
21956 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21957 where
21958 S: serde::Serializer,
21959 {
21960 match self {
21961 Self::Unspecified => serializer.serialize_i32(0),
21962 Self::ServiceAccount => serializer.serialize_i32(1),
21963 Self::EndUserCredentials => serializer.serialize_i32(2),
21964 Self::UnknownValue(u) => u.0.serialize(serializer),
21965 }
21966 }
21967 }
21968
21969 impl<'de> serde::de::Deserialize<'de> for AuthenticationType {
21970 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21971 where
21972 D: serde::Deserializer<'de>,
21973 {
21974 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthenticationType>::new(
21975 ".google.cloud.dataproc.v1.AuthenticationConfig.AuthenticationType",
21976 ))
21977 }
21978 }
21979}
21980
21981/// Autotuning configuration of the workload.
21982#[derive(Clone, Default, PartialEq)]
21983#[non_exhaustive]
21984pub struct AutotuningConfig {
21985 /// Optional. Scenarios for which tunings are applied.
21986 pub scenarios: std::vec::Vec<crate::model::autotuning_config::Scenario>,
21987
21988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21989}
21990
21991impl AutotuningConfig {
21992 pub fn new() -> Self {
21993 std::default::Default::default()
21994 }
21995
21996 /// Sets the value of [scenarios][crate::model::AutotuningConfig::scenarios].
21997 ///
21998 /// # Example
21999 /// ```ignore,no_run
22000 /// # use google_cloud_dataproc_v1::model::AutotuningConfig;
22001 /// use google_cloud_dataproc_v1::model::autotuning_config::Scenario;
22002 /// let x = AutotuningConfig::new().set_scenarios([
22003 /// Scenario::Scaling,
22004 /// Scenario::BroadcastHashJoin,
22005 /// Scenario::Memory,
22006 /// ]);
22007 /// ```
22008 pub fn set_scenarios<T, V>(mut self, v: T) -> Self
22009 where
22010 T: std::iter::IntoIterator<Item = V>,
22011 V: std::convert::Into<crate::model::autotuning_config::Scenario>,
22012 {
22013 use std::iter::Iterator;
22014 self.scenarios = v.into_iter().map(|i| i.into()).collect();
22015 self
22016 }
22017}
22018
22019impl wkt::message::Message for AutotuningConfig {
22020 fn typename() -> &'static str {
22021 "type.googleapis.com/google.cloud.dataproc.v1.AutotuningConfig"
22022 }
22023}
22024
22025/// Defines additional types related to [AutotuningConfig].
22026pub mod autotuning_config {
22027 #[allow(unused_imports)]
22028 use super::*;
22029
22030 /// Scenario represents a specific goal that autotuning will attempt to achieve
22031 /// by modifying workloads.
22032 ///
22033 /// # Working with unknown values
22034 ///
22035 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22036 /// additional enum variants at any time. Adding new variants is not considered
22037 /// a breaking change. Applications should write their code in anticipation of:
22038 ///
22039 /// - New values appearing in future releases of the client library, **and**
22040 /// - New values received dynamically, without application changes.
22041 ///
22042 /// Please consult the [Working with enums] section in the user guide for some
22043 /// guidelines.
22044 ///
22045 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22046 #[derive(Clone, Debug, PartialEq)]
22047 #[non_exhaustive]
22048 pub enum Scenario {
22049 /// Default value.
22050 Unspecified,
22051 /// Scaling recommendations such as initialExecutors.
22052 Scaling,
22053 /// Adding hints for potential relation broadcasts.
22054 BroadcastHashJoin,
22055 /// Memory management for workloads.
22056 Memory,
22057 /// No autotuning.
22058 None,
22059 /// Automatic selection of scenarios.
22060 Auto,
22061 /// If set, the enum was initialized with an unknown value.
22062 ///
22063 /// Applications can examine the value using [Scenario::value] or
22064 /// [Scenario::name].
22065 UnknownValue(scenario::UnknownValue),
22066 }
22067
22068 #[doc(hidden)]
22069 pub mod scenario {
22070 #[allow(unused_imports)]
22071 use super::*;
22072 #[derive(Clone, Debug, PartialEq)]
22073 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22074 }
22075
22076 impl Scenario {
22077 /// Gets the enum value.
22078 ///
22079 /// Returns `None` if the enum contains an unknown value deserialized from
22080 /// the string representation of enums.
22081 pub fn value(&self) -> std::option::Option<i32> {
22082 match self {
22083 Self::Unspecified => std::option::Option::Some(0),
22084 Self::Scaling => std::option::Option::Some(2),
22085 Self::BroadcastHashJoin => std::option::Option::Some(3),
22086 Self::Memory => std::option::Option::Some(4),
22087 Self::None => std::option::Option::Some(5),
22088 Self::Auto => std::option::Option::Some(6),
22089 Self::UnknownValue(u) => u.0.value(),
22090 }
22091 }
22092
22093 /// Gets the enum value as a string.
22094 ///
22095 /// Returns `None` if the enum contains an unknown value deserialized from
22096 /// the integer representation of enums.
22097 pub fn name(&self) -> std::option::Option<&str> {
22098 match self {
22099 Self::Unspecified => std::option::Option::Some("SCENARIO_UNSPECIFIED"),
22100 Self::Scaling => std::option::Option::Some("SCALING"),
22101 Self::BroadcastHashJoin => std::option::Option::Some("BROADCAST_HASH_JOIN"),
22102 Self::Memory => std::option::Option::Some("MEMORY"),
22103 Self::None => std::option::Option::Some("NONE"),
22104 Self::Auto => std::option::Option::Some("AUTO"),
22105 Self::UnknownValue(u) => u.0.name(),
22106 }
22107 }
22108 }
22109
22110 impl std::default::Default for Scenario {
22111 fn default() -> Self {
22112 use std::convert::From;
22113 Self::from(0)
22114 }
22115 }
22116
22117 impl std::fmt::Display for Scenario {
22118 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22119 wkt::internal::display_enum(f, self.name(), self.value())
22120 }
22121 }
22122
22123 impl std::convert::From<i32> for Scenario {
22124 fn from(value: i32) -> Self {
22125 match value {
22126 0 => Self::Unspecified,
22127 2 => Self::Scaling,
22128 3 => Self::BroadcastHashJoin,
22129 4 => Self::Memory,
22130 5 => Self::None,
22131 6 => Self::Auto,
22132 _ => Self::UnknownValue(scenario::UnknownValue(
22133 wkt::internal::UnknownEnumValue::Integer(value),
22134 )),
22135 }
22136 }
22137 }
22138
22139 impl std::convert::From<&str> for Scenario {
22140 fn from(value: &str) -> Self {
22141 use std::string::ToString;
22142 match value {
22143 "SCENARIO_UNSPECIFIED" => Self::Unspecified,
22144 "SCALING" => Self::Scaling,
22145 "BROADCAST_HASH_JOIN" => Self::BroadcastHashJoin,
22146 "MEMORY" => Self::Memory,
22147 "NONE" => Self::None,
22148 "AUTO" => Self::Auto,
22149 _ => Self::UnknownValue(scenario::UnknownValue(
22150 wkt::internal::UnknownEnumValue::String(value.to_string()),
22151 )),
22152 }
22153 }
22154 }
22155
22156 impl serde::ser::Serialize for Scenario {
22157 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22158 where
22159 S: serde::Serializer,
22160 {
22161 match self {
22162 Self::Unspecified => serializer.serialize_i32(0),
22163 Self::Scaling => serializer.serialize_i32(2),
22164 Self::BroadcastHashJoin => serializer.serialize_i32(3),
22165 Self::Memory => serializer.serialize_i32(4),
22166 Self::None => serializer.serialize_i32(5),
22167 Self::Auto => serializer.serialize_i32(6),
22168 Self::UnknownValue(u) => u.0.serialize(serializer),
22169 }
22170 }
22171 }
22172
22173 impl<'de> serde::de::Deserialize<'de> for Scenario {
22174 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22175 where
22176 D: serde::Deserializer<'de>,
22177 {
22178 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scenario>::new(
22179 ".google.cloud.dataproc.v1.AutotuningConfig.Scenario",
22180 ))
22181 }
22182 }
22183}
22184
22185/// Configuration for dependency repositories
22186#[derive(Clone, Default, PartialEq)]
22187#[non_exhaustive]
22188pub struct RepositoryConfig {
22189 /// Optional. Configuration for PyPi repository.
22190 pub pypi_repository_config: std::option::Option<crate::model::PyPiRepositoryConfig>,
22191
22192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22193}
22194
22195impl RepositoryConfig {
22196 pub fn new() -> Self {
22197 std::default::Default::default()
22198 }
22199
22200 /// Sets the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
22201 ///
22202 /// # Example
22203 /// ```ignore,no_run
22204 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
22205 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22206 /// let x = RepositoryConfig::new().set_pypi_repository_config(PyPiRepositoryConfig::default()/* use setters */);
22207 /// ```
22208 pub fn set_pypi_repository_config<T>(mut self, v: T) -> Self
22209 where
22210 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
22211 {
22212 self.pypi_repository_config = std::option::Option::Some(v.into());
22213 self
22214 }
22215
22216 /// Sets or clears the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
22217 ///
22218 /// # Example
22219 /// ```ignore,no_run
22220 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
22221 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22222 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(Some(PyPiRepositoryConfig::default()/* use setters */));
22223 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(None::<PyPiRepositoryConfig>);
22224 /// ```
22225 pub fn set_or_clear_pypi_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
22226 where
22227 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
22228 {
22229 self.pypi_repository_config = v.map(|x| x.into());
22230 self
22231 }
22232}
22233
22234impl wkt::message::Message for RepositoryConfig {
22235 fn typename() -> &'static str {
22236 "type.googleapis.com/google.cloud.dataproc.v1.RepositoryConfig"
22237 }
22238}
22239
22240/// Configuration for PyPi repository
22241#[derive(Clone, Default, PartialEq)]
22242#[non_exhaustive]
22243pub struct PyPiRepositoryConfig {
22244 /// Optional. PyPi repository address
22245 pub pypi_repository: std::string::String,
22246
22247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22248}
22249
22250impl PyPiRepositoryConfig {
22251 pub fn new() -> Self {
22252 std::default::Default::default()
22253 }
22254
22255 /// Sets the value of [pypi_repository][crate::model::PyPiRepositoryConfig::pypi_repository].
22256 ///
22257 /// # Example
22258 /// ```ignore,no_run
22259 /// # use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22260 /// let x = PyPiRepositoryConfig::new().set_pypi_repository("example");
22261 /// ```
22262 pub fn set_pypi_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22263 self.pypi_repository = v.into();
22264 self
22265 }
22266}
22267
22268impl wkt::message::Message for PyPiRepositoryConfig {
22269 fn typename() -> &'static str {
22270 "type.googleapis.com/google.cloud.dataproc.v1.PyPiRepositoryConfig"
22271 }
22272}
22273
22274/// A Dataproc workflow template resource.
22275#[derive(Clone, Default, PartialEq)]
22276#[non_exhaustive]
22277pub struct WorkflowTemplate {
22278 pub id: std::string::String,
22279
22280 /// Output only. The resource name of the workflow template, as described
22281 /// in <https://cloud.google.com/apis/design/resource_names>.
22282 ///
22283 /// * For `projects.regions.workflowTemplates`, the resource name of the
22284 /// template has the following format:
22285 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
22286 ///
22287 /// * For `projects.locations.workflowTemplates`, the resource name of the
22288 /// template has the following format:
22289 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
22290 ///
22291 pub name: std::string::String,
22292
22293 /// Optional. Used to perform a consistent read-modify-write.
22294 ///
22295 /// This field should be left blank for a `CreateWorkflowTemplate` request. It
22296 /// is required for an `UpdateWorkflowTemplate` request, and must match the
22297 /// current server version. A typical update template flow would fetch the
22298 /// current template with a `GetWorkflowTemplate` request, which will return
22299 /// the current template with the `version` field filled in with the
22300 /// current server version. The user updates other fields in the template,
22301 /// then returns it as part of the `UpdateWorkflowTemplate` request.
22302 pub version: i32,
22303
22304 /// Output only. The time template was created.
22305 pub create_time: std::option::Option<wkt::Timestamp>,
22306
22307 /// Output only. The time template was last updated.
22308 pub update_time: std::option::Option<wkt::Timestamp>,
22309
22310 /// Optional. The labels to associate with this template. These labels
22311 /// will be propagated to all jobs and clusters created by the workflow
22312 /// instance.
22313 ///
22314 /// Label **keys** must contain 1 to 63 characters, and must conform to
22315 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22316 ///
22317 /// Label **values** may be empty, but, if present, must contain 1 to 63
22318 /// characters, and must conform to
22319 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22320 ///
22321 /// No more than 32 labels can be associated with a template.
22322 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22323
22324 /// Required. WorkflowTemplate scheduling information.
22325 pub placement: std::option::Option<crate::model::WorkflowTemplatePlacement>,
22326
22327 /// Required. The Directed Acyclic Graph of Jobs to submit.
22328 pub jobs: std::vec::Vec<crate::model::OrderedJob>,
22329
22330 /// Optional. Template parameters whose values are substituted into the
22331 /// template. Values for parameters must be provided when the template is
22332 /// instantiated.
22333 pub parameters: std::vec::Vec<crate::model::TemplateParameter>,
22334
22335 /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
22336 /// [JSON representation of
22337 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
22338 /// The timeout duration must be from 10 minutes ("600s") to 24 hours
22339 /// ("86400s"). The timer begins when the first job is submitted. If the
22340 /// workflow is running at the end of the timeout period, any remaining jobs
22341 /// are cancelled, the workflow is ended, and if the workflow was running on a
22342 /// [managed
22343 /// cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
22344 /// the cluster is deleted.
22345 pub dag_timeout: std::option::Option<wkt::Duration>,
22346
22347 /// Optional. Encryption settings for encrypting workflow template job
22348 /// arguments.
22349 pub encryption_config: std::option::Option<crate::model::workflow_template::EncryptionConfig>,
22350
22351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22352}
22353
22354impl WorkflowTemplate {
22355 pub fn new() -> Self {
22356 std::default::Default::default()
22357 }
22358
22359 /// Sets the value of [id][crate::model::WorkflowTemplate::id].
22360 ///
22361 /// # Example
22362 /// ```ignore,no_run
22363 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22364 /// let x = WorkflowTemplate::new().set_id("example");
22365 /// ```
22366 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22367 self.id = v.into();
22368 self
22369 }
22370
22371 /// Sets the value of [name][crate::model::WorkflowTemplate::name].
22372 ///
22373 /// # Example
22374 /// ```ignore,no_run
22375 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22376 /// let x = WorkflowTemplate::new().set_name("example");
22377 /// ```
22378 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22379 self.name = v.into();
22380 self
22381 }
22382
22383 /// Sets the value of [version][crate::model::WorkflowTemplate::version].
22384 ///
22385 /// # Example
22386 /// ```ignore,no_run
22387 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22388 /// let x = WorkflowTemplate::new().set_version(42);
22389 /// ```
22390 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22391 self.version = v.into();
22392 self
22393 }
22394
22395 /// Sets the value of [create_time][crate::model::WorkflowTemplate::create_time].
22396 ///
22397 /// # Example
22398 /// ```ignore,no_run
22399 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22400 /// use wkt::Timestamp;
22401 /// let x = WorkflowTemplate::new().set_create_time(Timestamp::default()/* use setters */);
22402 /// ```
22403 pub fn set_create_time<T>(mut self, v: T) -> Self
22404 where
22405 T: std::convert::Into<wkt::Timestamp>,
22406 {
22407 self.create_time = std::option::Option::Some(v.into());
22408 self
22409 }
22410
22411 /// Sets or clears the value of [create_time][crate::model::WorkflowTemplate::create_time].
22412 ///
22413 /// # Example
22414 /// ```ignore,no_run
22415 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22416 /// use wkt::Timestamp;
22417 /// let x = WorkflowTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
22418 /// let x = WorkflowTemplate::new().set_or_clear_create_time(None::<Timestamp>);
22419 /// ```
22420 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
22421 where
22422 T: std::convert::Into<wkt::Timestamp>,
22423 {
22424 self.create_time = v.map(|x| x.into());
22425 self
22426 }
22427
22428 /// Sets the value of [update_time][crate::model::WorkflowTemplate::update_time].
22429 ///
22430 /// # Example
22431 /// ```ignore,no_run
22432 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22433 /// use wkt::Timestamp;
22434 /// let x = WorkflowTemplate::new().set_update_time(Timestamp::default()/* use setters */);
22435 /// ```
22436 pub fn set_update_time<T>(mut self, v: T) -> Self
22437 where
22438 T: std::convert::Into<wkt::Timestamp>,
22439 {
22440 self.update_time = std::option::Option::Some(v.into());
22441 self
22442 }
22443
22444 /// Sets or clears the value of [update_time][crate::model::WorkflowTemplate::update_time].
22445 ///
22446 /// # Example
22447 /// ```ignore,no_run
22448 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22449 /// use wkt::Timestamp;
22450 /// let x = WorkflowTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
22451 /// let x = WorkflowTemplate::new().set_or_clear_update_time(None::<Timestamp>);
22452 /// ```
22453 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
22454 where
22455 T: std::convert::Into<wkt::Timestamp>,
22456 {
22457 self.update_time = v.map(|x| x.into());
22458 self
22459 }
22460
22461 /// Sets the value of [labels][crate::model::WorkflowTemplate::labels].
22462 ///
22463 /// # Example
22464 /// ```ignore,no_run
22465 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22466 /// let x = WorkflowTemplate::new().set_labels([
22467 /// ("key0", "abc"),
22468 /// ("key1", "xyz"),
22469 /// ]);
22470 /// ```
22471 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22472 where
22473 T: std::iter::IntoIterator<Item = (K, V)>,
22474 K: std::convert::Into<std::string::String>,
22475 V: std::convert::Into<std::string::String>,
22476 {
22477 use std::iter::Iterator;
22478 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22479 self
22480 }
22481
22482 /// Sets the value of [placement][crate::model::WorkflowTemplate::placement].
22483 ///
22484 /// # Example
22485 /// ```ignore,no_run
22486 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22487 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22488 /// let x = WorkflowTemplate::new().set_placement(WorkflowTemplatePlacement::default()/* use setters */);
22489 /// ```
22490 pub fn set_placement<T>(mut self, v: T) -> Self
22491 where
22492 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22493 {
22494 self.placement = std::option::Option::Some(v.into());
22495 self
22496 }
22497
22498 /// Sets or clears the value of [placement][crate::model::WorkflowTemplate::placement].
22499 ///
22500 /// # Example
22501 /// ```ignore,no_run
22502 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22503 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22504 /// let x = WorkflowTemplate::new().set_or_clear_placement(Some(WorkflowTemplatePlacement::default()/* use setters */));
22505 /// let x = WorkflowTemplate::new().set_or_clear_placement(None::<WorkflowTemplatePlacement>);
22506 /// ```
22507 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
22508 where
22509 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22510 {
22511 self.placement = v.map(|x| x.into());
22512 self
22513 }
22514
22515 /// Sets the value of [jobs][crate::model::WorkflowTemplate::jobs].
22516 ///
22517 /// # Example
22518 /// ```ignore,no_run
22519 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22520 /// use google_cloud_dataproc_v1::model::OrderedJob;
22521 /// let x = WorkflowTemplate::new()
22522 /// .set_jobs([
22523 /// OrderedJob::default()/* use setters */,
22524 /// OrderedJob::default()/* use (different) setters */,
22525 /// ]);
22526 /// ```
22527 pub fn set_jobs<T, V>(mut self, v: T) -> Self
22528 where
22529 T: std::iter::IntoIterator<Item = V>,
22530 V: std::convert::Into<crate::model::OrderedJob>,
22531 {
22532 use std::iter::Iterator;
22533 self.jobs = v.into_iter().map(|i| i.into()).collect();
22534 self
22535 }
22536
22537 /// Sets the value of [parameters][crate::model::WorkflowTemplate::parameters].
22538 ///
22539 /// # Example
22540 /// ```ignore,no_run
22541 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22542 /// use google_cloud_dataproc_v1::model::TemplateParameter;
22543 /// let x = WorkflowTemplate::new()
22544 /// .set_parameters([
22545 /// TemplateParameter::default()/* use setters */,
22546 /// TemplateParameter::default()/* use (different) setters */,
22547 /// ]);
22548 /// ```
22549 pub fn set_parameters<T, V>(mut self, v: T) -> Self
22550 where
22551 T: std::iter::IntoIterator<Item = V>,
22552 V: std::convert::Into<crate::model::TemplateParameter>,
22553 {
22554 use std::iter::Iterator;
22555 self.parameters = v.into_iter().map(|i| i.into()).collect();
22556 self
22557 }
22558
22559 /// Sets the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22560 ///
22561 /// # Example
22562 /// ```ignore,no_run
22563 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22564 /// use wkt::Duration;
22565 /// let x = WorkflowTemplate::new().set_dag_timeout(Duration::default()/* use setters */);
22566 /// ```
22567 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
22568 where
22569 T: std::convert::Into<wkt::Duration>,
22570 {
22571 self.dag_timeout = std::option::Option::Some(v.into());
22572 self
22573 }
22574
22575 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22576 ///
22577 /// # Example
22578 /// ```ignore,no_run
22579 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22580 /// use wkt::Duration;
22581 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
22582 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(None::<Duration>);
22583 /// ```
22584 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
22585 where
22586 T: std::convert::Into<wkt::Duration>,
22587 {
22588 self.dag_timeout = v.map(|x| x.into());
22589 self
22590 }
22591
22592 /// Sets the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22593 ///
22594 /// # Example
22595 /// ```ignore,no_run
22596 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22597 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22598 /// let x = WorkflowTemplate::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
22599 /// ```
22600 pub fn set_encryption_config<T>(mut self, v: T) -> Self
22601 where
22602 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22603 {
22604 self.encryption_config = std::option::Option::Some(v.into());
22605 self
22606 }
22607
22608 /// Sets or clears the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22609 ///
22610 /// # Example
22611 /// ```ignore,no_run
22612 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22613 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22614 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
22615 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
22616 /// ```
22617 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
22618 where
22619 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22620 {
22621 self.encryption_config = v.map(|x| x.into());
22622 self
22623 }
22624}
22625
22626impl wkt::message::Message for WorkflowTemplate {
22627 fn typename() -> &'static str {
22628 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate"
22629 }
22630}
22631
22632/// Defines additional types related to [WorkflowTemplate].
22633pub mod workflow_template {
22634 #[allow(unused_imports)]
22635 use super::*;
22636
22637 /// Encryption settings for encrypting workflow template job arguments.
22638 #[derive(Clone, Default, PartialEq)]
22639 #[non_exhaustive]
22640 pub struct EncryptionConfig {
22641 /// Optional. The Cloud KMS key name to use for encrypting
22642 /// workflow template job arguments.
22643 ///
22644 /// When this this key is provided, the following workflow template
22645 /// [job arguments]
22646 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template>),
22647 /// if present, are
22648 /// [CMEK
22649 /// encrypted](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data):
22650 ///
22651 /// * [FlinkJob
22652 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
22653 /// * [HadoopJob
22654 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
22655 /// * [SparkJob
22656 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
22657 /// * [SparkRJob
22658 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
22659 /// * [PySparkJob
22660 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
22661 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
22662 /// scriptVariables and queryList.queries
22663 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
22664 /// scriptVariables and queryList.queries
22665 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
22666 /// scriptVariables and queryList.queries
22667 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
22668 /// scriptVariables and queryList.queries
22669 pub kms_key: std::string::String,
22670
22671 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22672 }
22673
22674 impl EncryptionConfig {
22675 pub fn new() -> Self {
22676 std::default::Default::default()
22677 }
22678
22679 /// Sets the value of [kms_key][crate::model::workflow_template::EncryptionConfig::kms_key].
22680 ///
22681 /// # Example
22682 /// ```ignore,no_run
22683 /// # use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22684 /// let x = EncryptionConfig::new().set_kms_key("example");
22685 /// ```
22686 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22687 self.kms_key = v.into();
22688 self
22689 }
22690 }
22691
22692 impl wkt::message::Message for EncryptionConfig {
22693 fn typename() -> &'static str {
22694 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate.EncryptionConfig"
22695 }
22696 }
22697}
22698
22699/// Specifies workflow execution target.
22700///
22701/// Either `managed_cluster` or `cluster_selector` is required.
22702#[derive(Clone, Default, PartialEq)]
22703#[non_exhaustive]
22704pub struct WorkflowTemplatePlacement {
22705 /// Required. Specifies where workflow executes; either on a managed
22706 /// cluster or an existing cluster chosen by labels.
22707 pub placement: std::option::Option<crate::model::workflow_template_placement::Placement>,
22708
22709 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22710}
22711
22712impl WorkflowTemplatePlacement {
22713 pub fn new() -> Self {
22714 std::default::Default::default()
22715 }
22716
22717 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement].
22718 ///
22719 /// Note that all the setters affecting `placement` are mutually
22720 /// exclusive.
22721 ///
22722 /// # Example
22723 /// ```ignore,no_run
22724 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22725 /// use google_cloud_dataproc_v1::model::ManagedCluster;
22726 /// let x = WorkflowTemplatePlacement::new().set_placement(Some(
22727 /// google_cloud_dataproc_v1::model::workflow_template_placement::Placement::ManagedCluster(ManagedCluster::default().into())));
22728 /// ```
22729 pub fn set_placement<
22730 T: std::convert::Into<
22731 std::option::Option<crate::model::workflow_template_placement::Placement>,
22732 >,
22733 >(
22734 mut self,
22735 v: T,
22736 ) -> Self {
22737 self.placement = v.into();
22738 self
22739 }
22740
22741 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22742 /// if it holds a `ManagedCluster`, `None` if the field is not set or
22743 /// holds a different branch.
22744 pub fn managed_cluster(
22745 &self,
22746 ) -> std::option::Option<&std::boxed::Box<crate::model::ManagedCluster>> {
22747 #[allow(unreachable_patterns)]
22748 self.placement.as_ref().and_then(|v| match v {
22749 crate::model::workflow_template_placement::Placement::ManagedCluster(v) => {
22750 std::option::Option::Some(v)
22751 }
22752 _ => std::option::Option::None,
22753 })
22754 }
22755
22756 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22757 /// to hold a `ManagedCluster`.
22758 ///
22759 /// Note that all the setters affecting `placement` are
22760 /// mutually exclusive.
22761 ///
22762 /// # Example
22763 /// ```ignore,no_run
22764 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22765 /// use google_cloud_dataproc_v1::model::ManagedCluster;
22766 /// let x = WorkflowTemplatePlacement::new().set_managed_cluster(ManagedCluster::default()/* use setters */);
22767 /// assert!(x.managed_cluster().is_some());
22768 /// assert!(x.cluster_selector().is_none());
22769 /// ```
22770 pub fn set_managed_cluster<
22771 T: std::convert::Into<std::boxed::Box<crate::model::ManagedCluster>>,
22772 >(
22773 mut self,
22774 v: T,
22775 ) -> Self {
22776 self.placement = std::option::Option::Some(
22777 crate::model::workflow_template_placement::Placement::ManagedCluster(v.into()),
22778 );
22779 self
22780 }
22781
22782 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22783 /// if it holds a `ClusterSelector`, `None` if the field is not set or
22784 /// holds a different branch.
22785 pub fn cluster_selector(
22786 &self,
22787 ) -> std::option::Option<&std::boxed::Box<crate::model::ClusterSelector>> {
22788 #[allow(unreachable_patterns)]
22789 self.placement.as_ref().and_then(|v| match v {
22790 crate::model::workflow_template_placement::Placement::ClusterSelector(v) => {
22791 std::option::Option::Some(v)
22792 }
22793 _ => std::option::Option::None,
22794 })
22795 }
22796
22797 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22798 /// to hold a `ClusterSelector`.
22799 ///
22800 /// Note that all the setters affecting `placement` are
22801 /// mutually exclusive.
22802 ///
22803 /// # Example
22804 /// ```ignore,no_run
22805 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22806 /// use google_cloud_dataproc_v1::model::ClusterSelector;
22807 /// let x = WorkflowTemplatePlacement::new().set_cluster_selector(ClusterSelector::default()/* use setters */);
22808 /// assert!(x.cluster_selector().is_some());
22809 /// assert!(x.managed_cluster().is_none());
22810 /// ```
22811 pub fn set_cluster_selector<
22812 T: std::convert::Into<std::boxed::Box<crate::model::ClusterSelector>>,
22813 >(
22814 mut self,
22815 v: T,
22816 ) -> Self {
22817 self.placement = std::option::Option::Some(
22818 crate::model::workflow_template_placement::Placement::ClusterSelector(v.into()),
22819 );
22820 self
22821 }
22822}
22823
22824impl wkt::message::Message for WorkflowTemplatePlacement {
22825 fn typename() -> &'static str {
22826 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplatePlacement"
22827 }
22828}
22829
22830/// Defines additional types related to [WorkflowTemplatePlacement].
22831pub mod workflow_template_placement {
22832 #[allow(unused_imports)]
22833 use super::*;
22834
22835 /// Required. Specifies where workflow executes; either on a managed
22836 /// cluster or an existing cluster chosen by labels.
22837 #[derive(Clone, Debug, PartialEq)]
22838 #[non_exhaustive]
22839 pub enum Placement {
22840 /// A cluster that is managed by the workflow.
22841 ManagedCluster(std::boxed::Box<crate::model::ManagedCluster>),
22842 /// Optional. A selector that chooses target cluster for jobs based
22843 /// on metadata.
22844 ///
22845 /// The selector is evaluated at the time each job is submitted.
22846 ClusterSelector(std::boxed::Box<crate::model::ClusterSelector>),
22847 }
22848}
22849
22850/// Cluster that is managed by the workflow.
22851#[derive(Clone, Default, PartialEq)]
22852#[non_exhaustive]
22853pub struct ManagedCluster {
22854 /// Required. The cluster name prefix. A unique cluster name will be formed by
22855 /// appending a random suffix.
22856 ///
22857 /// The name must contain only lower-case letters (a-z), numbers (0-9),
22858 /// and hyphens (-). Must begin with a letter. Cannot begin or end with
22859 /// hyphen. Must consist of between 2 and 35 characters.
22860 pub cluster_name: std::string::String,
22861
22862 /// Required. The cluster configuration.
22863 pub config: std::option::Option<crate::model::ClusterConfig>,
22864
22865 /// Optional. The labels to associate with this cluster.
22866 ///
22867 /// Label keys must be between 1 and 63 characters long, and must conform to
22868 /// the following PCRE regular expression:
22869 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
22870 ///
22871 /// Label values must be between 1 and 63 characters long, and must conform to
22872 /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
22873 ///
22874 /// No more than 32 labels can be associated with a given cluster.
22875 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22876
22877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22878}
22879
22880impl ManagedCluster {
22881 pub fn new() -> Self {
22882 std::default::Default::default()
22883 }
22884
22885 /// Sets the value of [cluster_name][crate::model::ManagedCluster::cluster_name].
22886 ///
22887 /// # Example
22888 /// ```ignore,no_run
22889 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22890 /// let x = ManagedCluster::new().set_cluster_name("example");
22891 /// ```
22892 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22893 self.cluster_name = v.into();
22894 self
22895 }
22896
22897 /// Sets the value of [config][crate::model::ManagedCluster::config].
22898 ///
22899 /// # Example
22900 /// ```ignore,no_run
22901 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22902 /// use google_cloud_dataproc_v1::model::ClusterConfig;
22903 /// let x = ManagedCluster::new().set_config(ClusterConfig::default()/* use setters */);
22904 /// ```
22905 pub fn set_config<T>(mut self, v: T) -> Self
22906 where
22907 T: std::convert::Into<crate::model::ClusterConfig>,
22908 {
22909 self.config = std::option::Option::Some(v.into());
22910 self
22911 }
22912
22913 /// Sets or clears the value of [config][crate::model::ManagedCluster::config].
22914 ///
22915 /// # Example
22916 /// ```ignore,no_run
22917 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22918 /// use google_cloud_dataproc_v1::model::ClusterConfig;
22919 /// let x = ManagedCluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
22920 /// let x = ManagedCluster::new().set_or_clear_config(None::<ClusterConfig>);
22921 /// ```
22922 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
22923 where
22924 T: std::convert::Into<crate::model::ClusterConfig>,
22925 {
22926 self.config = v.map(|x| x.into());
22927 self
22928 }
22929
22930 /// Sets the value of [labels][crate::model::ManagedCluster::labels].
22931 ///
22932 /// # Example
22933 /// ```ignore,no_run
22934 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22935 /// let x = ManagedCluster::new().set_labels([
22936 /// ("key0", "abc"),
22937 /// ("key1", "xyz"),
22938 /// ]);
22939 /// ```
22940 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22941 where
22942 T: std::iter::IntoIterator<Item = (K, V)>,
22943 K: std::convert::Into<std::string::String>,
22944 V: std::convert::Into<std::string::String>,
22945 {
22946 use std::iter::Iterator;
22947 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22948 self
22949 }
22950}
22951
22952impl wkt::message::Message for ManagedCluster {
22953 fn typename() -> &'static str {
22954 "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
22955 }
22956}
22957
22958/// A selector that chooses target cluster for jobs based on metadata.
22959#[derive(Clone, Default, PartialEq)]
22960#[non_exhaustive]
22961pub struct ClusterSelector {
22962 /// Optional. The zone where workflow process executes. This parameter does not
22963 /// affect the selection of the cluster.
22964 ///
22965 /// If unspecified, the zone of the first cluster matching the selector
22966 /// is used.
22967 pub zone: std::string::String,
22968
22969 /// Required. The cluster labels. Cluster must have all labels
22970 /// to match.
22971 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
22972
22973 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22974}
22975
22976impl ClusterSelector {
22977 pub fn new() -> Self {
22978 std::default::Default::default()
22979 }
22980
22981 /// Sets the value of [zone][crate::model::ClusterSelector::zone].
22982 ///
22983 /// # Example
22984 /// ```ignore,no_run
22985 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22986 /// let x = ClusterSelector::new().set_zone("example");
22987 /// ```
22988 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22989 self.zone = v.into();
22990 self
22991 }
22992
22993 /// Sets the value of [cluster_labels][crate::model::ClusterSelector::cluster_labels].
22994 ///
22995 /// # Example
22996 /// ```ignore,no_run
22997 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22998 /// let x = ClusterSelector::new().set_cluster_labels([
22999 /// ("key0", "abc"),
23000 /// ("key1", "xyz"),
23001 /// ]);
23002 /// ```
23003 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
23004 where
23005 T: std::iter::IntoIterator<Item = (K, V)>,
23006 K: std::convert::Into<std::string::String>,
23007 V: std::convert::Into<std::string::String>,
23008 {
23009 use std::iter::Iterator;
23010 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23011 self
23012 }
23013}
23014
23015impl wkt::message::Message for ClusterSelector {
23016 fn typename() -> &'static str {
23017 "type.googleapis.com/google.cloud.dataproc.v1.ClusterSelector"
23018 }
23019}
23020
23021/// A job executed by the workflow.
23022#[derive(Clone, Default, PartialEq)]
23023#[non_exhaustive]
23024pub struct OrderedJob {
23025 /// Required. The step id. The id must be unique among all jobs
23026 /// within the template.
23027 ///
23028 /// The step id is used as prefix for job id, as job
23029 /// `goog-dataproc-workflow-step-id` label, and in
23030 /// [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
23031 /// field from other steps.
23032 ///
23033 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
23034 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
23035 /// or hyphen. Must consist of between 3 and 50 characters.
23036 ///
23037 /// [google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]: crate::model::OrderedJob::prerequisite_step_ids
23038 pub step_id: std::string::String,
23039
23040 /// Optional. The labels to associate with this job.
23041 ///
23042 /// Label keys must be between 1 and 63 characters long, and must conform to
23043 /// the following regular expression:
23044 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
23045 ///
23046 /// Label values must be between 1 and 63 characters long, and must conform to
23047 /// the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
23048 ///
23049 /// No more than 32 labels can be associated with a given job.
23050 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23051
23052 /// Optional. Job scheduling configuration.
23053 pub scheduling: std::option::Option<crate::model::JobScheduling>,
23054
23055 /// Optional. The optional list of prerequisite job step_ids.
23056 /// If not specified, the job will start at the beginning of workflow.
23057 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
23058
23059 /// Required. The job definition.
23060 pub job_type: std::option::Option<crate::model::ordered_job::JobType>,
23061
23062 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23063}
23064
23065impl OrderedJob {
23066 pub fn new() -> Self {
23067 std::default::Default::default()
23068 }
23069
23070 /// Sets the value of [step_id][crate::model::OrderedJob::step_id].
23071 ///
23072 /// # Example
23073 /// ```ignore,no_run
23074 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23075 /// let x = OrderedJob::new().set_step_id("example");
23076 /// ```
23077 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23078 self.step_id = v.into();
23079 self
23080 }
23081
23082 /// Sets the value of [labels][crate::model::OrderedJob::labels].
23083 ///
23084 /// # Example
23085 /// ```ignore,no_run
23086 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23087 /// let x = OrderedJob::new().set_labels([
23088 /// ("key0", "abc"),
23089 /// ("key1", "xyz"),
23090 /// ]);
23091 /// ```
23092 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23093 where
23094 T: std::iter::IntoIterator<Item = (K, V)>,
23095 K: std::convert::Into<std::string::String>,
23096 V: std::convert::Into<std::string::String>,
23097 {
23098 use std::iter::Iterator;
23099 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23100 self
23101 }
23102
23103 /// Sets the value of [scheduling][crate::model::OrderedJob::scheduling].
23104 ///
23105 /// # Example
23106 /// ```ignore,no_run
23107 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23108 /// use google_cloud_dataproc_v1::model::JobScheduling;
23109 /// let x = OrderedJob::new().set_scheduling(JobScheduling::default()/* use setters */);
23110 /// ```
23111 pub fn set_scheduling<T>(mut self, v: T) -> Self
23112 where
23113 T: std::convert::Into<crate::model::JobScheduling>,
23114 {
23115 self.scheduling = std::option::Option::Some(v.into());
23116 self
23117 }
23118
23119 /// Sets or clears the value of [scheduling][crate::model::OrderedJob::scheduling].
23120 ///
23121 /// # Example
23122 /// ```ignore,no_run
23123 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23124 /// use google_cloud_dataproc_v1::model::JobScheduling;
23125 /// let x = OrderedJob::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
23126 /// let x = OrderedJob::new().set_or_clear_scheduling(None::<JobScheduling>);
23127 /// ```
23128 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
23129 where
23130 T: std::convert::Into<crate::model::JobScheduling>,
23131 {
23132 self.scheduling = v.map(|x| x.into());
23133 self
23134 }
23135
23136 /// Sets the value of [prerequisite_step_ids][crate::model::OrderedJob::prerequisite_step_ids].
23137 ///
23138 /// # Example
23139 /// ```ignore,no_run
23140 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23141 /// let x = OrderedJob::new().set_prerequisite_step_ids(["a", "b", "c"]);
23142 /// ```
23143 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
23144 where
23145 T: std::iter::IntoIterator<Item = V>,
23146 V: std::convert::Into<std::string::String>,
23147 {
23148 use std::iter::Iterator;
23149 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
23150 self
23151 }
23152
23153 /// Sets the value of [job_type][crate::model::OrderedJob::job_type].
23154 ///
23155 /// Note that all the setters affecting `job_type` are mutually
23156 /// exclusive.
23157 ///
23158 /// # Example
23159 /// ```ignore,no_run
23160 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23161 /// use google_cloud_dataproc_v1::model::HadoopJob;
23162 /// let x = OrderedJob::new().set_job_type(Some(
23163 /// google_cloud_dataproc_v1::model::ordered_job::JobType::HadoopJob(HadoopJob::default().into())));
23164 /// ```
23165 pub fn set_job_type<
23166 T: std::convert::Into<std::option::Option<crate::model::ordered_job::JobType>>,
23167 >(
23168 mut self,
23169 v: T,
23170 ) -> Self {
23171 self.job_type = v.into();
23172 self
23173 }
23174
23175 /// The value of [job_type][crate::model::OrderedJob::job_type]
23176 /// if it holds a `HadoopJob`, `None` if the field is not set or
23177 /// holds a different branch.
23178 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
23179 #[allow(unreachable_patterns)]
23180 self.job_type.as_ref().and_then(|v| match v {
23181 crate::model::ordered_job::JobType::HadoopJob(v) => std::option::Option::Some(v),
23182 _ => std::option::Option::None,
23183 })
23184 }
23185
23186 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23187 /// to hold a `HadoopJob`.
23188 ///
23189 /// Note that all the setters affecting `job_type` are
23190 /// mutually exclusive.
23191 ///
23192 /// # Example
23193 /// ```ignore,no_run
23194 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23195 /// use google_cloud_dataproc_v1::model::HadoopJob;
23196 /// let x = OrderedJob::new().set_hadoop_job(HadoopJob::default()/* use setters */);
23197 /// assert!(x.hadoop_job().is_some());
23198 /// assert!(x.spark_job().is_none());
23199 /// assert!(x.pyspark_job().is_none());
23200 /// assert!(x.hive_job().is_none());
23201 /// assert!(x.pig_job().is_none());
23202 /// assert!(x.spark_r_job().is_none());
23203 /// assert!(x.spark_sql_job().is_none());
23204 /// assert!(x.presto_job().is_none());
23205 /// assert!(x.trino_job().is_none());
23206 /// assert!(x.flink_job().is_none());
23207 /// ```
23208 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
23209 mut self,
23210 v: T,
23211 ) -> Self {
23212 self.job_type =
23213 std::option::Option::Some(crate::model::ordered_job::JobType::HadoopJob(v.into()));
23214 self
23215 }
23216
23217 /// The value of [job_type][crate::model::OrderedJob::job_type]
23218 /// if it holds a `SparkJob`, `None` if the field is not set or
23219 /// holds a different branch.
23220 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
23221 #[allow(unreachable_patterns)]
23222 self.job_type.as_ref().and_then(|v| match v {
23223 crate::model::ordered_job::JobType::SparkJob(v) => std::option::Option::Some(v),
23224 _ => std::option::Option::None,
23225 })
23226 }
23227
23228 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23229 /// to hold a `SparkJob`.
23230 ///
23231 /// Note that all the setters affecting `job_type` are
23232 /// mutually exclusive.
23233 ///
23234 /// # Example
23235 /// ```ignore,no_run
23236 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23237 /// use google_cloud_dataproc_v1::model::SparkJob;
23238 /// let x = OrderedJob::new().set_spark_job(SparkJob::default()/* use setters */);
23239 /// assert!(x.spark_job().is_some());
23240 /// assert!(x.hadoop_job().is_none());
23241 /// assert!(x.pyspark_job().is_none());
23242 /// assert!(x.hive_job().is_none());
23243 /// assert!(x.pig_job().is_none());
23244 /// assert!(x.spark_r_job().is_none());
23245 /// assert!(x.spark_sql_job().is_none());
23246 /// assert!(x.presto_job().is_none());
23247 /// assert!(x.trino_job().is_none());
23248 /// assert!(x.flink_job().is_none());
23249 /// ```
23250 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
23251 mut self,
23252 v: T,
23253 ) -> Self {
23254 self.job_type =
23255 std::option::Option::Some(crate::model::ordered_job::JobType::SparkJob(v.into()));
23256 self
23257 }
23258
23259 /// The value of [job_type][crate::model::OrderedJob::job_type]
23260 /// if it holds a `PysparkJob`, `None` if the field is not set or
23261 /// holds a different branch.
23262 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
23263 #[allow(unreachable_patterns)]
23264 self.job_type.as_ref().and_then(|v| match v {
23265 crate::model::ordered_job::JobType::PysparkJob(v) => std::option::Option::Some(v),
23266 _ => std::option::Option::None,
23267 })
23268 }
23269
23270 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23271 /// to hold a `PysparkJob`.
23272 ///
23273 /// Note that all the setters affecting `job_type` are
23274 /// mutually exclusive.
23275 ///
23276 /// # Example
23277 /// ```ignore,no_run
23278 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23279 /// use google_cloud_dataproc_v1::model::PySparkJob;
23280 /// let x = OrderedJob::new().set_pyspark_job(PySparkJob::default()/* use setters */);
23281 /// assert!(x.pyspark_job().is_some());
23282 /// assert!(x.hadoop_job().is_none());
23283 /// assert!(x.spark_job().is_none());
23284 /// assert!(x.hive_job().is_none());
23285 /// assert!(x.pig_job().is_none());
23286 /// assert!(x.spark_r_job().is_none());
23287 /// assert!(x.spark_sql_job().is_none());
23288 /// assert!(x.presto_job().is_none());
23289 /// assert!(x.trino_job().is_none());
23290 /// assert!(x.flink_job().is_none());
23291 /// ```
23292 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
23293 mut self,
23294 v: T,
23295 ) -> Self {
23296 self.job_type =
23297 std::option::Option::Some(crate::model::ordered_job::JobType::PysparkJob(v.into()));
23298 self
23299 }
23300
23301 /// The value of [job_type][crate::model::OrderedJob::job_type]
23302 /// if it holds a `HiveJob`, `None` if the field is not set or
23303 /// holds a different branch.
23304 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
23305 #[allow(unreachable_patterns)]
23306 self.job_type.as_ref().and_then(|v| match v {
23307 crate::model::ordered_job::JobType::HiveJob(v) => std::option::Option::Some(v),
23308 _ => std::option::Option::None,
23309 })
23310 }
23311
23312 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23313 /// to hold a `HiveJob`.
23314 ///
23315 /// Note that all the setters affecting `job_type` are
23316 /// mutually exclusive.
23317 ///
23318 /// # Example
23319 /// ```ignore,no_run
23320 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23321 /// use google_cloud_dataproc_v1::model::HiveJob;
23322 /// let x = OrderedJob::new().set_hive_job(HiveJob::default()/* use setters */);
23323 /// assert!(x.hive_job().is_some());
23324 /// assert!(x.hadoop_job().is_none());
23325 /// assert!(x.spark_job().is_none());
23326 /// assert!(x.pyspark_job().is_none());
23327 /// assert!(x.pig_job().is_none());
23328 /// assert!(x.spark_r_job().is_none());
23329 /// assert!(x.spark_sql_job().is_none());
23330 /// assert!(x.presto_job().is_none());
23331 /// assert!(x.trino_job().is_none());
23332 /// assert!(x.flink_job().is_none());
23333 /// ```
23334 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
23335 mut self,
23336 v: T,
23337 ) -> Self {
23338 self.job_type =
23339 std::option::Option::Some(crate::model::ordered_job::JobType::HiveJob(v.into()));
23340 self
23341 }
23342
23343 /// The value of [job_type][crate::model::OrderedJob::job_type]
23344 /// if it holds a `PigJob`, `None` if the field is not set or
23345 /// holds a different branch.
23346 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
23347 #[allow(unreachable_patterns)]
23348 self.job_type.as_ref().and_then(|v| match v {
23349 crate::model::ordered_job::JobType::PigJob(v) => std::option::Option::Some(v),
23350 _ => std::option::Option::None,
23351 })
23352 }
23353
23354 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23355 /// to hold a `PigJob`.
23356 ///
23357 /// Note that all the setters affecting `job_type` are
23358 /// mutually exclusive.
23359 ///
23360 /// # Example
23361 /// ```ignore,no_run
23362 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23363 /// use google_cloud_dataproc_v1::model::PigJob;
23364 /// let x = OrderedJob::new().set_pig_job(PigJob::default()/* use setters */);
23365 /// assert!(x.pig_job().is_some());
23366 /// assert!(x.hadoop_job().is_none());
23367 /// assert!(x.spark_job().is_none());
23368 /// assert!(x.pyspark_job().is_none());
23369 /// assert!(x.hive_job().is_none());
23370 /// assert!(x.spark_r_job().is_none());
23371 /// assert!(x.spark_sql_job().is_none());
23372 /// assert!(x.presto_job().is_none());
23373 /// assert!(x.trino_job().is_none());
23374 /// assert!(x.flink_job().is_none());
23375 /// ```
23376 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
23377 mut self,
23378 v: T,
23379 ) -> Self {
23380 self.job_type =
23381 std::option::Option::Some(crate::model::ordered_job::JobType::PigJob(v.into()));
23382 self
23383 }
23384
23385 /// The value of [job_type][crate::model::OrderedJob::job_type]
23386 /// if it holds a `SparkRJob`, `None` if the field is not set or
23387 /// holds a different branch.
23388 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
23389 #[allow(unreachable_patterns)]
23390 self.job_type.as_ref().and_then(|v| match v {
23391 crate::model::ordered_job::JobType::SparkRJob(v) => std::option::Option::Some(v),
23392 _ => std::option::Option::None,
23393 })
23394 }
23395
23396 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23397 /// to hold a `SparkRJob`.
23398 ///
23399 /// Note that all the setters affecting `job_type` are
23400 /// mutually exclusive.
23401 ///
23402 /// # Example
23403 /// ```ignore,no_run
23404 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23405 /// use google_cloud_dataproc_v1::model::SparkRJob;
23406 /// let x = OrderedJob::new().set_spark_r_job(SparkRJob::default()/* use setters */);
23407 /// assert!(x.spark_r_job().is_some());
23408 /// assert!(x.hadoop_job().is_none());
23409 /// assert!(x.spark_job().is_none());
23410 /// assert!(x.pyspark_job().is_none());
23411 /// assert!(x.hive_job().is_none());
23412 /// assert!(x.pig_job().is_none());
23413 /// assert!(x.spark_sql_job().is_none());
23414 /// assert!(x.presto_job().is_none());
23415 /// assert!(x.trino_job().is_none());
23416 /// assert!(x.flink_job().is_none());
23417 /// ```
23418 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
23419 mut self,
23420 v: T,
23421 ) -> Self {
23422 self.job_type =
23423 std::option::Option::Some(crate::model::ordered_job::JobType::SparkRJob(v.into()));
23424 self
23425 }
23426
23427 /// The value of [job_type][crate::model::OrderedJob::job_type]
23428 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
23429 /// holds a different branch.
23430 pub fn spark_sql_job(
23431 &self,
23432 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
23433 #[allow(unreachable_patterns)]
23434 self.job_type.as_ref().and_then(|v| match v {
23435 crate::model::ordered_job::JobType::SparkSqlJob(v) => std::option::Option::Some(v),
23436 _ => std::option::Option::None,
23437 })
23438 }
23439
23440 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23441 /// to hold a `SparkSqlJob`.
23442 ///
23443 /// Note that all the setters affecting `job_type` are
23444 /// mutually exclusive.
23445 ///
23446 /// # Example
23447 /// ```ignore,no_run
23448 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23449 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
23450 /// let x = OrderedJob::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
23451 /// assert!(x.spark_sql_job().is_some());
23452 /// assert!(x.hadoop_job().is_none());
23453 /// assert!(x.spark_job().is_none());
23454 /// assert!(x.pyspark_job().is_none());
23455 /// assert!(x.hive_job().is_none());
23456 /// assert!(x.pig_job().is_none());
23457 /// assert!(x.spark_r_job().is_none());
23458 /// assert!(x.presto_job().is_none());
23459 /// assert!(x.trino_job().is_none());
23460 /// assert!(x.flink_job().is_none());
23461 /// ```
23462 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
23463 mut self,
23464 v: T,
23465 ) -> Self {
23466 self.job_type =
23467 std::option::Option::Some(crate::model::ordered_job::JobType::SparkSqlJob(v.into()));
23468 self
23469 }
23470
23471 /// The value of [job_type][crate::model::OrderedJob::job_type]
23472 /// if it holds a `PrestoJob`, `None` if the field is not set or
23473 /// holds a different branch.
23474 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
23475 #[allow(unreachable_patterns)]
23476 self.job_type.as_ref().and_then(|v| match v {
23477 crate::model::ordered_job::JobType::PrestoJob(v) => std::option::Option::Some(v),
23478 _ => std::option::Option::None,
23479 })
23480 }
23481
23482 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23483 /// to hold a `PrestoJob`.
23484 ///
23485 /// Note that all the setters affecting `job_type` are
23486 /// mutually exclusive.
23487 ///
23488 /// # Example
23489 /// ```ignore,no_run
23490 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23491 /// use google_cloud_dataproc_v1::model::PrestoJob;
23492 /// let x = OrderedJob::new().set_presto_job(PrestoJob::default()/* use setters */);
23493 /// assert!(x.presto_job().is_some());
23494 /// assert!(x.hadoop_job().is_none());
23495 /// assert!(x.spark_job().is_none());
23496 /// assert!(x.pyspark_job().is_none());
23497 /// assert!(x.hive_job().is_none());
23498 /// assert!(x.pig_job().is_none());
23499 /// assert!(x.spark_r_job().is_none());
23500 /// assert!(x.spark_sql_job().is_none());
23501 /// assert!(x.trino_job().is_none());
23502 /// assert!(x.flink_job().is_none());
23503 /// ```
23504 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
23505 mut self,
23506 v: T,
23507 ) -> Self {
23508 self.job_type =
23509 std::option::Option::Some(crate::model::ordered_job::JobType::PrestoJob(v.into()));
23510 self
23511 }
23512
23513 /// The value of [job_type][crate::model::OrderedJob::job_type]
23514 /// if it holds a `TrinoJob`, `None` if the field is not set or
23515 /// holds a different branch.
23516 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
23517 #[allow(unreachable_patterns)]
23518 self.job_type.as_ref().and_then(|v| match v {
23519 crate::model::ordered_job::JobType::TrinoJob(v) => std::option::Option::Some(v),
23520 _ => std::option::Option::None,
23521 })
23522 }
23523
23524 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23525 /// to hold a `TrinoJob`.
23526 ///
23527 /// Note that all the setters affecting `job_type` are
23528 /// mutually exclusive.
23529 ///
23530 /// # Example
23531 /// ```ignore,no_run
23532 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23533 /// use google_cloud_dataproc_v1::model::TrinoJob;
23534 /// let x = OrderedJob::new().set_trino_job(TrinoJob::default()/* use setters */);
23535 /// assert!(x.trino_job().is_some());
23536 /// assert!(x.hadoop_job().is_none());
23537 /// assert!(x.spark_job().is_none());
23538 /// assert!(x.pyspark_job().is_none());
23539 /// assert!(x.hive_job().is_none());
23540 /// assert!(x.pig_job().is_none());
23541 /// assert!(x.spark_r_job().is_none());
23542 /// assert!(x.spark_sql_job().is_none());
23543 /// assert!(x.presto_job().is_none());
23544 /// assert!(x.flink_job().is_none());
23545 /// ```
23546 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
23547 mut self,
23548 v: T,
23549 ) -> Self {
23550 self.job_type =
23551 std::option::Option::Some(crate::model::ordered_job::JobType::TrinoJob(v.into()));
23552 self
23553 }
23554
23555 /// The value of [job_type][crate::model::OrderedJob::job_type]
23556 /// if it holds a `FlinkJob`, `None` if the field is not set or
23557 /// holds a different branch.
23558 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
23559 #[allow(unreachable_patterns)]
23560 self.job_type.as_ref().and_then(|v| match v {
23561 crate::model::ordered_job::JobType::FlinkJob(v) => std::option::Option::Some(v),
23562 _ => std::option::Option::None,
23563 })
23564 }
23565
23566 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23567 /// to hold a `FlinkJob`.
23568 ///
23569 /// Note that all the setters affecting `job_type` are
23570 /// mutually exclusive.
23571 ///
23572 /// # Example
23573 /// ```ignore,no_run
23574 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23575 /// use google_cloud_dataproc_v1::model::FlinkJob;
23576 /// let x = OrderedJob::new().set_flink_job(FlinkJob::default()/* use setters */);
23577 /// assert!(x.flink_job().is_some());
23578 /// assert!(x.hadoop_job().is_none());
23579 /// assert!(x.spark_job().is_none());
23580 /// assert!(x.pyspark_job().is_none());
23581 /// assert!(x.hive_job().is_none());
23582 /// assert!(x.pig_job().is_none());
23583 /// assert!(x.spark_r_job().is_none());
23584 /// assert!(x.spark_sql_job().is_none());
23585 /// assert!(x.presto_job().is_none());
23586 /// assert!(x.trino_job().is_none());
23587 /// ```
23588 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
23589 mut self,
23590 v: T,
23591 ) -> Self {
23592 self.job_type =
23593 std::option::Option::Some(crate::model::ordered_job::JobType::FlinkJob(v.into()));
23594 self
23595 }
23596}
23597
23598impl wkt::message::Message for OrderedJob {
23599 fn typename() -> &'static str {
23600 "type.googleapis.com/google.cloud.dataproc.v1.OrderedJob"
23601 }
23602}
23603
23604/// Defines additional types related to [OrderedJob].
23605pub mod ordered_job {
23606 #[allow(unused_imports)]
23607 use super::*;
23608
23609 /// Required. The job definition.
23610 #[derive(Clone, Debug, PartialEq)]
23611 #[non_exhaustive]
23612 pub enum JobType {
23613 /// Optional. Job is a Hadoop job.
23614 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
23615 /// Optional. Job is a Spark job.
23616 SparkJob(std::boxed::Box<crate::model::SparkJob>),
23617 /// Optional. Job is a PySpark job.
23618 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
23619 /// Optional. Job is a Hive job.
23620 HiveJob(std::boxed::Box<crate::model::HiveJob>),
23621 /// Optional. Job is a Pig job.
23622 PigJob(std::boxed::Box<crate::model::PigJob>),
23623 /// Optional. Job is a SparkR job.
23624 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
23625 /// Optional. Job is a SparkSql job.
23626 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
23627 /// Optional. Job is a Presto job.
23628 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
23629 /// Optional. Job is a Trino job.
23630 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
23631 /// Optional. Job is a Flink job.
23632 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
23633 }
23634}
23635
23636/// A configurable parameter that replaces one or more fields in the template.
23637/// Parameterizable fields:
23638///
23639/// - Labels
23640/// - File uris
23641/// - Job properties
23642/// - Job arguments
23643/// - Script variables
23644/// - Main class (in HadoopJob and SparkJob)
23645/// - Zone (in ClusterSelector)
23646#[derive(Clone, Default, PartialEq)]
23647#[non_exhaustive]
23648pub struct TemplateParameter {
23649 /// Required. Parameter name.
23650 /// The parameter name is used as the key, and paired with the
23651 /// parameter value, which are passed to the template when the template
23652 /// is instantiated.
23653 /// The name must contain only capital letters (A-Z), numbers (0-9), and
23654 /// underscores (_), and must not start with a number. The maximum length is
23655 /// 40 characters.
23656 pub name: std::string::String,
23657
23658 /// Required. Paths to all fields that the parameter replaces.
23659 /// A field is allowed to appear in at most one parameter's list of field
23660 /// paths.
23661 ///
23662 /// A field path is similar in syntax to a
23663 /// [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
23664 /// field path that references the zone field of a workflow template's cluster
23665 /// selector would be specified as `placement.clusterSelector.zone`.
23666 ///
23667 /// Also, field paths can reference fields using the following syntax:
23668 ///
23669 /// * Values in maps can be referenced by key:
23670 ///
23671 /// * labels['key']
23672 /// * placement.clusterSelector.clusterLabels['key']
23673 /// * placement.managedCluster.labels['key']
23674 /// * placement.clusterSelector.clusterLabels['key']
23675 /// * jobs['step-id'].labels['key']
23676 /// * Jobs in the jobs list can be referenced by step-id:
23677 ///
23678 /// * jobs['step-id'].hadoopJob.mainJarFileUri
23679 /// * jobs['step-id'].hiveJob.queryFileUri
23680 /// * jobs['step-id'].pySparkJob.mainPythonFileUri
23681 /// * jobs['step-id'].hadoopJob.jarFileUris[0]
23682 /// * jobs['step-id'].hadoopJob.archiveUris[0]
23683 /// * jobs['step-id'].hadoopJob.fileUris[0]
23684 /// * jobs['step-id'].pySparkJob.pythonFileUris[0]
23685 /// * Items in repeated fields can be referenced by a zero-based index:
23686 ///
23687 /// * jobs['step-id'].sparkJob.args[0]
23688 /// * Other examples:
23689 ///
23690 /// * jobs['step-id'].hadoopJob.properties['key']
23691 /// * jobs['step-id'].hadoopJob.args[0]
23692 /// * jobs['step-id'].hiveJob.scriptVariables['key']
23693 /// * jobs['step-id'].hadoopJob.mainJarFileUri
23694 /// * placement.clusterSelector.zone
23695 ///
23696 /// It may not be possible to parameterize maps and repeated fields in their
23697 /// entirety since only individual map values and individual items in repeated
23698 /// fields can be referenced. For example, the following field paths are
23699 /// invalid:
23700 ///
23701 /// - placement.clusterSelector.clusterLabels
23702 /// - jobs['step-id'].sparkJob.args
23703 ///
23704 /// [google.protobuf.FieldMask]: wkt::FieldMask
23705 pub fields: std::vec::Vec<std::string::String>,
23706
23707 /// Optional. Brief description of the parameter.
23708 /// Must not exceed 1024 characters.
23709 pub description: std::string::String,
23710
23711 /// Optional. Validation rules to be applied to this parameter's value.
23712 pub validation: std::option::Option<crate::model::ParameterValidation>,
23713
23714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23715}
23716
23717impl TemplateParameter {
23718 pub fn new() -> Self {
23719 std::default::Default::default()
23720 }
23721
23722 /// Sets the value of [name][crate::model::TemplateParameter::name].
23723 ///
23724 /// # Example
23725 /// ```ignore,no_run
23726 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23727 /// let x = TemplateParameter::new().set_name("example");
23728 /// ```
23729 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23730 self.name = v.into();
23731 self
23732 }
23733
23734 /// Sets the value of [fields][crate::model::TemplateParameter::fields].
23735 ///
23736 /// # Example
23737 /// ```ignore,no_run
23738 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23739 /// let x = TemplateParameter::new().set_fields(["a", "b", "c"]);
23740 /// ```
23741 pub fn set_fields<T, V>(mut self, v: T) -> Self
23742 where
23743 T: std::iter::IntoIterator<Item = V>,
23744 V: std::convert::Into<std::string::String>,
23745 {
23746 use std::iter::Iterator;
23747 self.fields = v.into_iter().map(|i| i.into()).collect();
23748 self
23749 }
23750
23751 /// Sets the value of [description][crate::model::TemplateParameter::description].
23752 ///
23753 /// # Example
23754 /// ```ignore,no_run
23755 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23756 /// let x = TemplateParameter::new().set_description("example");
23757 /// ```
23758 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23759 self.description = v.into();
23760 self
23761 }
23762
23763 /// Sets the value of [validation][crate::model::TemplateParameter::validation].
23764 ///
23765 /// # Example
23766 /// ```ignore,no_run
23767 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23768 /// use google_cloud_dataproc_v1::model::ParameterValidation;
23769 /// let x = TemplateParameter::new().set_validation(ParameterValidation::default()/* use setters */);
23770 /// ```
23771 pub fn set_validation<T>(mut self, v: T) -> Self
23772 where
23773 T: std::convert::Into<crate::model::ParameterValidation>,
23774 {
23775 self.validation = std::option::Option::Some(v.into());
23776 self
23777 }
23778
23779 /// Sets or clears the value of [validation][crate::model::TemplateParameter::validation].
23780 ///
23781 /// # Example
23782 /// ```ignore,no_run
23783 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23784 /// use google_cloud_dataproc_v1::model::ParameterValidation;
23785 /// let x = TemplateParameter::new().set_or_clear_validation(Some(ParameterValidation::default()/* use setters */));
23786 /// let x = TemplateParameter::new().set_or_clear_validation(None::<ParameterValidation>);
23787 /// ```
23788 pub fn set_or_clear_validation<T>(mut self, v: std::option::Option<T>) -> Self
23789 where
23790 T: std::convert::Into<crate::model::ParameterValidation>,
23791 {
23792 self.validation = v.map(|x| x.into());
23793 self
23794 }
23795}
23796
23797impl wkt::message::Message for TemplateParameter {
23798 fn typename() -> &'static str {
23799 "type.googleapis.com/google.cloud.dataproc.v1.TemplateParameter"
23800 }
23801}
23802
23803/// Configuration for parameter validation.
23804#[derive(Clone, Default, PartialEq)]
23805#[non_exhaustive]
23806pub struct ParameterValidation {
23807 /// Required. The type of validation to be performed.
23808 pub validation_type: std::option::Option<crate::model::parameter_validation::ValidationType>,
23809
23810 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23811}
23812
23813impl ParameterValidation {
23814 pub fn new() -> Self {
23815 std::default::Default::default()
23816 }
23817
23818 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type].
23819 ///
23820 /// Note that all the setters affecting `validation_type` are mutually
23821 /// exclusive.
23822 ///
23823 /// # Example
23824 /// ```ignore,no_run
23825 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23826 /// use google_cloud_dataproc_v1::model::RegexValidation;
23827 /// let x = ParameterValidation::new().set_validation_type(Some(
23828 /// google_cloud_dataproc_v1::model::parameter_validation::ValidationType::Regex(RegexValidation::default().into())));
23829 /// ```
23830 pub fn set_validation_type<
23831 T: std::convert::Into<std::option::Option<crate::model::parameter_validation::ValidationType>>,
23832 >(
23833 mut self,
23834 v: T,
23835 ) -> Self {
23836 self.validation_type = v.into();
23837 self
23838 }
23839
23840 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23841 /// if it holds a `Regex`, `None` if the field is not set or
23842 /// holds a different branch.
23843 pub fn regex(&self) -> std::option::Option<&std::boxed::Box<crate::model::RegexValidation>> {
23844 #[allow(unreachable_patterns)]
23845 self.validation_type.as_ref().and_then(|v| match v {
23846 crate::model::parameter_validation::ValidationType::Regex(v) => {
23847 std::option::Option::Some(v)
23848 }
23849 _ => std::option::Option::None,
23850 })
23851 }
23852
23853 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23854 /// to hold a `Regex`.
23855 ///
23856 /// Note that all the setters affecting `validation_type` are
23857 /// mutually exclusive.
23858 ///
23859 /// # Example
23860 /// ```ignore,no_run
23861 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23862 /// use google_cloud_dataproc_v1::model::RegexValidation;
23863 /// let x = ParameterValidation::new().set_regex(RegexValidation::default()/* use setters */);
23864 /// assert!(x.regex().is_some());
23865 /// assert!(x.values().is_none());
23866 /// ```
23867 pub fn set_regex<T: std::convert::Into<std::boxed::Box<crate::model::RegexValidation>>>(
23868 mut self,
23869 v: T,
23870 ) -> Self {
23871 self.validation_type = std::option::Option::Some(
23872 crate::model::parameter_validation::ValidationType::Regex(v.into()),
23873 );
23874 self
23875 }
23876
23877 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23878 /// if it holds a `Values`, `None` if the field is not set or
23879 /// holds a different branch.
23880 pub fn values(&self) -> std::option::Option<&std::boxed::Box<crate::model::ValueValidation>> {
23881 #[allow(unreachable_patterns)]
23882 self.validation_type.as_ref().and_then(|v| match v {
23883 crate::model::parameter_validation::ValidationType::Values(v) => {
23884 std::option::Option::Some(v)
23885 }
23886 _ => std::option::Option::None,
23887 })
23888 }
23889
23890 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23891 /// to hold a `Values`.
23892 ///
23893 /// Note that all the setters affecting `validation_type` are
23894 /// mutually exclusive.
23895 ///
23896 /// # Example
23897 /// ```ignore,no_run
23898 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23899 /// use google_cloud_dataproc_v1::model::ValueValidation;
23900 /// let x = ParameterValidation::new().set_values(ValueValidation::default()/* use setters */);
23901 /// assert!(x.values().is_some());
23902 /// assert!(x.regex().is_none());
23903 /// ```
23904 pub fn set_values<T: std::convert::Into<std::boxed::Box<crate::model::ValueValidation>>>(
23905 mut self,
23906 v: T,
23907 ) -> Self {
23908 self.validation_type = std::option::Option::Some(
23909 crate::model::parameter_validation::ValidationType::Values(v.into()),
23910 );
23911 self
23912 }
23913}
23914
23915impl wkt::message::Message for ParameterValidation {
23916 fn typename() -> &'static str {
23917 "type.googleapis.com/google.cloud.dataproc.v1.ParameterValidation"
23918 }
23919}
23920
23921/// Defines additional types related to [ParameterValidation].
23922pub mod parameter_validation {
23923 #[allow(unused_imports)]
23924 use super::*;
23925
23926 /// Required. The type of validation to be performed.
23927 #[derive(Clone, Debug, PartialEq)]
23928 #[non_exhaustive]
23929 pub enum ValidationType {
23930 /// Validation based on regular expressions.
23931 Regex(std::boxed::Box<crate::model::RegexValidation>),
23932 /// Validation based on a list of allowed values.
23933 Values(std::boxed::Box<crate::model::ValueValidation>),
23934 }
23935}
23936
23937/// Validation based on regular expressions.
23938#[derive(Clone, Default, PartialEq)]
23939#[non_exhaustive]
23940pub struct RegexValidation {
23941 /// Required. RE2 regular expressions used to validate the parameter's value.
23942 /// The value must match the regex in its entirety (substring
23943 /// matches are not sufficient).
23944 pub regexes: std::vec::Vec<std::string::String>,
23945
23946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23947}
23948
23949impl RegexValidation {
23950 pub fn new() -> Self {
23951 std::default::Default::default()
23952 }
23953
23954 /// Sets the value of [regexes][crate::model::RegexValidation::regexes].
23955 ///
23956 /// # Example
23957 /// ```ignore,no_run
23958 /// # use google_cloud_dataproc_v1::model::RegexValidation;
23959 /// let x = RegexValidation::new().set_regexes(["a", "b", "c"]);
23960 /// ```
23961 pub fn set_regexes<T, V>(mut self, v: T) -> Self
23962 where
23963 T: std::iter::IntoIterator<Item = V>,
23964 V: std::convert::Into<std::string::String>,
23965 {
23966 use std::iter::Iterator;
23967 self.regexes = v.into_iter().map(|i| i.into()).collect();
23968 self
23969 }
23970}
23971
23972impl wkt::message::Message for RegexValidation {
23973 fn typename() -> &'static str {
23974 "type.googleapis.com/google.cloud.dataproc.v1.RegexValidation"
23975 }
23976}
23977
23978/// Validation based on a list of allowed values.
23979#[derive(Clone, Default, PartialEq)]
23980#[non_exhaustive]
23981pub struct ValueValidation {
23982 /// Required. List of allowed values for the parameter.
23983 pub values: std::vec::Vec<std::string::String>,
23984
23985 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23986}
23987
23988impl ValueValidation {
23989 pub fn new() -> Self {
23990 std::default::Default::default()
23991 }
23992
23993 /// Sets the value of [values][crate::model::ValueValidation::values].
23994 ///
23995 /// # Example
23996 /// ```ignore,no_run
23997 /// # use google_cloud_dataproc_v1::model::ValueValidation;
23998 /// let x = ValueValidation::new().set_values(["a", "b", "c"]);
23999 /// ```
24000 pub fn set_values<T, V>(mut self, v: T) -> Self
24001 where
24002 T: std::iter::IntoIterator<Item = V>,
24003 V: std::convert::Into<std::string::String>,
24004 {
24005 use std::iter::Iterator;
24006 self.values = v.into_iter().map(|i| i.into()).collect();
24007 self
24008 }
24009}
24010
24011impl wkt::message::Message for ValueValidation {
24012 fn typename() -> &'static str {
24013 "type.googleapis.com/google.cloud.dataproc.v1.ValueValidation"
24014 }
24015}
24016
24017/// A Dataproc workflow template resource.
24018#[derive(Clone, Default, PartialEq)]
24019#[non_exhaustive]
24020pub struct WorkflowMetadata {
24021 /// Output only. The resource name of the workflow template as described
24022 /// in <https://cloud.google.com/apis/design/resource_names>.
24023 ///
24024 /// * For `projects.regions.workflowTemplates`, the resource name of the
24025 /// template has the following format:
24026 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24027 ///
24028 /// * For `projects.locations.workflowTemplates`, the resource name of the
24029 /// template has the following format:
24030 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24031 ///
24032 pub template: std::string::String,
24033
24034 /// Output only. The version of template at the time of
24035 /// workflow instantiation.
24036 pub version: i32,
24037
24038 /// Output only. The create cluster operation metadata.
24039 pub create_cluster: std::option::Option<crate::model::ClusterOperation>,
24040
24041 /// Output only. The workflow graph.
24042 pub graph: std::option::Option<crate::model::WorkflowGraph>,
24043
24044 /// Output only. The delete cluster operation metadata.
24045 pub delete_cluster: std::option::Option<crate::model::ClusterOperation>,
24046
24047 /// Output only. The workflow state.
24048 pub state: crate::model::workflow_metadata::State,
24049
24050 /// Output only. The name of the target cluster.
24051 pub cluster_name: std::string::String,
24052
24053 /// Map from parameter names to values that were used for those parameters.
24054 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
24055
24056 /// Output only. Workflow start time.
24057 pub start_time: std::option::Option<wkt::Timestamp>,
24058
24059 /// Output only. Workflow end time.
24060 pub end_time: std::option::Option<wkt::Timestamp>,
24061
24062 /// Output only. The UUID of target cluster.
24063 pub cluster_uuid: std::string::String,
24064
24065 /// Output only. The timeout duration for the DAG of jobs, expressed in seconds
24066 /// (see [JSON representation of
24067 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
24068 pub dag_timeout: std::option::Option<wkt::Duration>,
24069
24070 /// Output only. DAG start time, only set for workflows with
24071 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24072 /// DAG begins.
24073 ///
24074 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24075 pub dag_start_time: std::option::Option<wkt::Timestamp>,
24076
24077 /// Output only. DAG end time, only set for workflows with
24078 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24079 /// DAG ends.
24080 ///
24081 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24082 pub dag_end_time: std::option::Option<wkt::Timestamp>,
24083
24084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24085}
24086
24087impl WorkflowMetadata {
24088 pub fn new() -> Self {
24089 std::default::Default::default()
24090 }
24091
24092 /// Sets the value of [template][crate::model::WorkflowMetadata::template].
24093 ///
24094 /// # Example
24095 /// ```ignore,no_run
24096 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24097 /// let x = WorkflowMetadata::new().set_template("example");
24098 /// ```
24099 pub fn set_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24100 self.template = v.into();
24101 self
24102 }
24103
24104 /// Sets the value of [version][crate::model::WorkflowMetadata::version].
24105 ///
24106 /// # Example
24107 /// ```ignore,no_run
24108 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24109 /// let x = WorkflowMetadata::new().set_version(42);
24110 /// ```
24111 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24112 self.version = v.into();
24113 self
24114 }
24115
24116 /// Sets the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24117 ///
24118 /// # Example
24119 /// ```ignore,no_run
24120 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24121 /// use google_cloud_dataproc_v1::model::ClusterOperation;
24122 /// let x = WorkflowMetadata::new().set_create_cluster(ClusterOperation::default()/* use setters */);
24123 /// ```
24124 pub fn set_create_cluster<T>(mut self, v: T) -> Self
24125 where
24126 T: std::convert::Into<crate::model::ClusterOperation>,
24127 {
24128 self.create_cluster = std::option::Option::Some(v.into());
24129 self
24130 }
24131
24132 /// Sets or clears the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24133 ///
24134 /// # Example
24135 /// ```ignore,no_run
24136 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24137 /// use google_cloud_dataproc_v1::model::ClusterOperation;
24138 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(Some(ClusterOperation::default()/* use setters */));
24139 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(None::<ClusterOperation>);
24140 /// ```
24141 pub fn set_or_clear_create_cluster<T>(mut self, v: std::option::Option<T>) -> Self
24142 where
24143 T: std::convert::Into<crate::model::ClusterOperation>,
24144 {
24145 self.create_cluster = v.map(|x| x.into());
24146 self
24147 }
24148
24149 /// Sets the value of [graph][crate::model::WorkflowMetadata::graph].
24150 ///
24151 /// # Example
24152 /// ```ignore,no_run
24153 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24154 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
24155 /// let x = WorkflowMetadata::new().set_graph(WorkflowGraph::default()/* use setters */);
24156 /// ```
24157 pub fn set_graph<T>(mut self, v: T) -> Self
24158 where
24159 T: std::convert::Into<crate::model::WorkflowGraph>,
24160 {
24161 self.graph = std::option::Option::Some(v.into());
24162 self
24163 }
24164
24165 /// Sets or clears the value of [graph][crate::model::WorkflowMetadata::graph].
24166 ///
24167 /// # Example
24168 /// ```ignore,no_run
24169 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24170 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
24171 /// let x = WorkflowMetadata::new().set_or_clear_graph(Some(WorkflowGraph::default()/* use setters */));
24172 /// let x = WorkflowMetadata::new().set_or_clear_graph(None::<WorkflowGraph>);
24173 /// ```
24174 pub fn set_or_clear_graph<T>(mut self, v: std::option::Option<T>) -> Self
24175 where
24176 T: std::convert::Into<crate::model::WorkflowGraph>,
24177 {
24178 self.graph = v.map(|x| x.into());
24179 self
24180 }
24181
24182 /// Sets the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
24183 ///
24184 /// # Example
24185 /// ```ignore,no_run
24186 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24187 /// use google_cloud_dataproc_v1::model::ClusterOperation;
24188 /// let x = WorkflowMetadata::new().set_delete_cluster(ClusterOperation::default()/* use setters */);
24189 /// ```
24190 pub fn set_delete_cluster<T>(mut self, v: T) -> Self
24191 where
24192 T: std::convert::Into<crate::model::ClusterOperation>,
24193 {
24194 self.delete_cluster = std::option::Option::Some(v.into());
24195 self
24196 }
24197
24198 /// Sets or clears the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
24199 ///
24200 /// # Example
24201 /// ```ignore,no_run
24202 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24203 /// use google_cloud_dataproc_v1::model::ClusterOperation;
24204 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(Some(ClusterOperation::default()/* use setters */));
24205 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(None::<ClusterOperation>);
24206 /// ```
24207 pub fn set_or_clear_delete_cluster<T>(mut self, v: std::option::Option<T>) -> Self
24208 where
24209 T: std::convert::Into<crate::model::ClusterOperation>,
24210 {
24211 self.delete_cluster = v.map(|x| x.into());
24212 self
24213 }
24214
24215 /// Sets the value of [state][crate::model::WorkflowMetadata::state].
24216 ///
24217 /// # Example
24218 /// ```ignore,no_run
24219 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24220 /// use google_cloud_dataproc_v1::model::workflow_metadata::State;
24221 /// let x0 = WorkflowMetadata::new().set_state(State::Pending);
24222 /// let x1 = WorkflowMetadata::new().set_state(State::Running);
24223 /// let x2 = WorkflowMetadata::new().set_state(State::Done);
24224 /// ```
24225 pub fn set_state<T: std::convert::Into<crate::model::workflow_metadata::State>>(
24226 mut self,
24227 v: T,
24228 ) -> Self {
24229 self.state = v.into();
24230 self
24231 }
24232
24233 /// Sets the value of [cluster_name][crate::model::WorkflowMetadata::cluster_name].
24234 ///
24235 /// # Example
24236 /// ```ignore,no_run
24237 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24238 /// let x = WorkflowMetadata::new().set_cluster_name("example");
24239 /// ```
24240 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24241 self.cluster_name = v.into();
24242 self
24243 }
24244
24245 /// Sets the value of [parameters][crate::model::WorkflowMetadata::parameters].
24246 ///
24247 /// # Example
24248 /// ```ignore,no_run
24249 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24250 /// let x = WorkflowMetadata::new().set_parameters([
24251 /// ("key0", "abc"),
24252 /// ("key1", "xyz"),
24253 /// ]);
24254 /// ```
24255 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
24256 where
24257 T: std::iter::IntoIterator<Item = (K, V)>,
24258 K: std::convert::Into<std::string::String>,
24259 V: std::convert::Into<std::string::String>,
24260 {
24261 use std::iter::Iterator;
24262 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24263 self
24264 }
24265
24266 /// Sets the value of [start_time][crate::model::WorkflowMetadata::start_time].
24267 ///
24268 /// # Example
24269 /// ```ignore,no_run
24270 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24271 /// use wkt::Timestamp;
24272 /// let x = WorkflowMetadata::new().set_start_time(Timestamp::default()/* use setters */);
24273 /// ```
24274 pub fn set_start_time<T>(mut self, v: T) -> Self
24275 where
24276 T: std::convert::Into<wkt::Timestamp>,
24277 {
24278 self.start_time = std::option::Option::Some(v.into());
24279 self
24280 }
24281
24282 /// Sets or clears the value of [start_time][crate::model::WorkflowMetadata::start_time].
24283 ///
24284 /// # Example
24285 /// ```ignore,no_run
24286 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24287 /// use wkt::Timestamp;
24288 /// let x = WorkflowMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
24289 /// let x = WorkflowMetadata::new().set_or_clear_start_time(None::<Timestamp>);
24290 /// ```
24291 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24292 where
24293 T: std::convert::Into<wkt::Timestamp>,
24294 {
24295 self.start_time = v.map(|x| x.into());
24296 self
24297 }
24298
24299 /// Sets the value of [end_time][crate::model::WorkflowMetadata::end_time].
24300 ///
24301 /// # Example
24302 /// ```ignore,no_run
24303 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24304 /// use wkt::Timestamp;
24305 /// let x = WorkflowMetadata::new().set_end_time(Timestamp::default()/* use setters */);
24306 /// ```
24307 pub fn set_end_time<T>(mut self, v: T) -> Self
24308 where
24309 T: std::convert::Into<wkt::Timestamp>,
24310 {
24311 self.end_time = std::option::Option::Some(v.into());
24312 self
24313 }
24314
24315 /// Sets or clears the value of [end_time][crate::model::WorkflowMetadata::end_time].
24316 ///
24317 /// # Example
24318 /// ```ignore,no_run
24319 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24320 /// use wkt::Timestamp;
24321 /// let x = WorkflowMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
24322 /// let x = WorkflowMetadata::new().set_or_clear_end_time(None::<Timestamp>);
24323 /// ```
24324 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24325 where
24326 T: std::convert::Into<wkt::Timestamp>,
24327 {
24328 self.end_time = v.map(|x| x.into());
24329 self
24330 }
24331
24332 /// Sets the value of [cluster_uuid][crate::model::WorkflowMetadata::cluster_uuid].
24333 ///
24334 /// # Example
24335 /// ```ignore,no_run
24336 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24337 /// let x = WorkflowMetadata::new().set_cluster_uuid("example");
24338 /// ```
24339 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24340 self.cluster_uuid = v.into();
24341 self
24342 }
24343
24344 /// Sets the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24345 ///
24346 /// # Example
24347 /// ```ignore,no_run
24348 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24349 /// use wkt::Duration;
24350 /// let x = WorkflowMetadata::new().set_dag_timeout(Duration::default()/* use setters */);
24351 /// ```
24352 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
24353 where
24354 T: std::convert::Into<wkt::Duration>,
24355 {
24356 self.dag_timeout = std::option::Option::Some(v.into());
24357 self
24358 }
24359
24360 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24361 ///
24362 /// # Example
24363 /// ```ignore,no_run
24364 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24365 /// use wkt::Duration;
24366 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
24367 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(None::<Duration>);
24368 /// ```
24369 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
24370 where
24371 T: std::convert::Into<wkt::Duration>,
24372 {
24373 self.dag_timeout = v.map(|x| x.into());
24374 self
24375 }
24376
24377 /// Sets the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24378 ///
24379 /// # Example
24380 /// ```ignore,no_run
24381 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24382 /// use wkt::Timestamp;
24383 /// let x = WorkflowMetadata::new().set_dag_start_time(Timestamp::default()/* use setters */);
24384 /// ```
24385 pub fn set_dag_start_time<T>(mut self, v: T) -> Self
24386 where
24387 T: std::convert::Into<wkt::Timestamp>,
24388 {
24389 self.dag_start_time = std::option::Option::Some(v.into());
24390 self
24391 }
24392
24393 /// Sets or clears the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24394 ///
24395 /// # Example
24396 /// ```ignore,no_run
24397 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24398 /// use wkt::Timestamp;
24399 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(Some(Timestamp::default()/* use setters */));
24400 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(None::<Timestamp>);
24401 /// ```
24402 pub fn set_or_clear_dag_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24403 where
24404 T: std::convert::Into<wkt::Timestamp>,
24405 {
24406 self.dag_start_time = v.map(|x| x.into());
24407 self
24408 }
24409
24410 /// Sets the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24411 ///
24412 /// # Example
24413 /// ```ignore,no_run
24414 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24415 /// use wkt::Timestamp;
24416 /// let x = WorkflowMetadata::new().set_dag_end_time(Timestamp::default()/* use setters */);
24417 /// ```
24418 pub fn set_dag_end_time<T>(mut self, v: T) -> Self
24419 where
24420 T: std::convert::Into<wkt::Timestamp>,
24421 {
24422 self.dag_end_time = std::option::Option::Some(v.into());
24423 self
24424 }
24425
24426 /// Sets or clears the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24427 ///
24428 /// # Example
24429 /// ```ignore,no_run
24430 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24431 /// use wkt::Timestamp;
24432 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(Some(Timestamp::default()/* use setters */));
24433 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(None::<Timestamp>);
24434 /// ```
24435 pub fn set_or_clear_dag_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24436 where
24437 T: std::convert::Into<wkt::Timestamp>,
24438 {
24439 self.dag_end_time = v.map(|x| x.into());
24440 self
24441 }
24442}
24443
24444impl wkt::message::Message for WorkflowMetadata {
24445 fn typename() -> &'static str {
24446 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowMetadata"
24447 }
24448}
24449
24450/// Defines additional types related to [WorkflowMetadata].
24451pub mod workflow_metadata {
24452 #[allow(unused_imports)]
24453 use super::*;
24454
24455 /// The operation state.
24456 ///
24457 /// # Working with unknown values
24458 ///
24459 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24460 /// additional enum variants at any time. Adding new variants is not considered
24461 /// a breaking change. Applications should write their code in anticipation of:
24462 ///
24463 /// - New values appearing in future releases of the client library, **and**
24464 /// - New values received dynamically, without application changes.
24465 ///
24466 /// Please consult the [Working with enums] section in the user guide for some
24467 /// guidelines.
24468 ///
24469 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
24470 #[derive(Clone, Debug, PartialEq)]
24471 #[non_exhaustive]
24472 pub enum State {
24473 /// Unused.
24474 Unknown,
24475 /// The operation has been created.
24476 Pending,
24477 /// The operation is running.
24478 Running,
24479 /// The operation is done; either cancelled or completed.
24480 Done,
24481 /// If set, the enum was initialized with an unknown value.
24482 ///
24483 /// Applications can examine the value using [State::value] or
24484 /// [State::name].
24485 UnknownValue(state::UnknownValue),
24486 }
24487
24488 #[doc(hidden)]
24489 pub mod state {
24490 #[allow(unused_imports)]
24491 use super::*;
24492 #[derive(Clone, Debug, PartialEq)]
24493 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24494 }
24495
24496 impl State {
24497 /// Gets the enum value.
24498 ///
24499 /// Returns `None` if the enum contains an unknown value deserialized from
24500 /// the string representation of enums.
24501 pub fn value(&self) -> std::option::Option<i32> {
24502 match self {
24503 Self::Unknown => std::option::Option::Some(0),
24504 Self::Pending => std::option::Option::Some(1),
24505 Self::Running => std::option::Option::Some(2),
24506 Self::Done => std::option::Option::Some(3),
24507 Self::UnknownValue(u) => u.0.value(),
24508 }
24509 }
24510
24511 /// Gets the enum value as a string.
24512 ///
24513 /// Returns `None` if the enum contains an unknown value deserialized from
24514 /// the integer representation of enums.
24515 pub fn name(&self) -> std::option::Option<&str> {
24516 match self {
24517 Self::Unknown => std::option::Option::Some("UNKNOWN"),
24518 Self::Pending => std::option::Option::Some("PENDING"),
24519 Self::Running => std::option::Option::Some("RUNNING"),
24520 Self::Done => std::option::Option::Some("DONE"),
24521 Self::UnknownValue(u) => u.0.name(),
24522 }
24523 }
24524 }
24525
24526 impl std::default::Default for State {
24527 fn default() -> Self {
24528 use std::convert::From;
24529 Self::from(0)
24530 }
24531 }
24532
24533 impl std::fmt::Display for State {
24534 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24535 wkt::internal::display_enum(f, self.name(), self.value())
24536 }
24537 }
24538
24539 impl std::convert::From<i32> for State {
24540 fn from(value: i32) -> Self {
24541 match value {
24542 0 => Self::Unknown,
24543 1 => Self::Pending,
24544 2 => Self::Running,
24545 3 => Self::Done,
24546 _ => Self::UnknownValue(state::UnknownValue(
24547 wkt::internal::UnknownEnumValue::Integer(value),
24548 )),
24549 }
24550 }
24551 }
24552
24553 impl std::convert::From<&str> for State {
24554 fn from(value: &str) -> Self {
24555 use std::string::ToString;
24556 match value {
24557 "UNKNOWN" => Self::Unknown,
24558 "PENDING" => Self::Pending,
24559 "RUNNING" => Self::Running,
24560 "DONE" => Self::Done,
24561 _ => Self::UnknownValue(state::UnknownValue(
24562 wkt::internal::UnknownEnumValue::String(value.to_string()),
24563 )),
24564 }
24565 }
24566 }
24567
24568 impl serde::ser::Serialize for State {
24569 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24570 where
24571 S: serde::Serializer,
24572 {
24573 match self {
24574 Self::Unknown => serializer.serialize_i32(0),
24575 Self::Pending => serializer.serialize_i32(1),
24576 Self::Running => serializer.serialize_i32(2),
24577 Self::Done => serializer.serialize_i32(3),
24578 Self::UnknownValue(u) => u.0.serialize(serializer),
24579 }
24580 }
24581 }
24582
24583 impl<'de> serde::de::Deserialize<'de> for State {
24584 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24585 where
24586 D: serde::Deserializer<'de>,
24587 {
24588 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
24589 ".google.cloud.dataproc.v1.WorkflowMetadata.State",
24590 ))
24591 }
24592 }
24593}
24594
24595/// The cluster operation triggered by a workflow.
24596#[derive(Clone, Default, PartialEq)]
24597#[non_exhaustive]
24598pub struct ClusterOperation {
24599 /// Output only. The id of the cluster operation.
24600 pub operation_id: std::string::String,
24601
24602 /// Output only. Error, if operation failed.
24603 pub error: std::string::String,
24604
24605 /// Output only. Indicates the operation is done.
24606 pub done: bool,
24607
24608 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24609}
24610
24611impl ClusterOperation {
24612 pub fn new() -> Self {
24613 std::default::Default::default()
24614 }
24615
24616 /// Sets the value of [operation_id][crate::model::ClusterOperation::operation_id].
24617 ///
24618 /// # Example
24619 /// ```ignore,no_run
24620 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24621 /// let x = ClusterOperation::new().set_operation_id("example");
24622 /// ```
24623 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24624 self.operation_id = v.into();
24625 self
24626 }
24627
24628 /// Sets the value of [error][crate::model::ClusterOperation::error].
24629 ///
24630 /// # Example
24631 /// ```ignore,no_run
24632 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24633 /// let x = ClusterOperation::new().set_error("example");
24634 /// ```
24635 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24636 self.error = v.into();
24637 self
24638 }
24639
24640 /// Sets the value of [done][crate::model::ClusterOperation::done].
24641 ///
24642 /// # Example
24643 /// ```ignore,no_run
24644 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24645 /// let x = ClusterOperation::new().set_done(true);
24646 /// ```
24647 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24648 self.done = v.into();
24649 self
24650 }
24651}
24652
24653impl wkt::message::Message for ClusterOperation {
24654 fn typename() -> &'static str {
24655 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperation"
24656 }
24657}
24658
24659/// The workflow graph.
24660#[derive(Clone, Default, PartialEq)]
24661#[non_exhaustive]
24662pub struct WorkflowGraph {
24663 /// Output only. The workflow nodes.
24664 pub nodes: std::vec::Vec<crate::model::WorkflowNode>,
24665
24666 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24667}
24668
24669impl WorkflowGraph {
24670 pub fn new() -> Self {
24671 std::default::Default::default()
24672 }
24673
24674 /// Sets the value of [nodes][crate::model::WorkflowGraph::nodes].
24675 ///
24676 /// # Example
24677 /// ```ignore,no_run
24678 /// # use google_cloud_dataproc_v1::model::WorkflowGraph;
24679 /// use google_cloud_dataproc_v1::model::WorkflowNode;
24680 /// let x = WorkflowGraph::new()
24681 /// .set_nodes([
24682 /// WorkflowNode::default()/* use setters */,
24683 /// WorkflowNode::default()/* use (different) setters */,
24684 /// ]);
24685 /// ```
24686 pub fn set_nodes<T, V>(mut self, v: T) -> Self
24687 where
24688 T: std::iter::IntoIterator<Item = V>,
24689 V: std::convert::Into<crate::model::WorkflowNode>,
24690 {
24691 use std::iter::Iterator;
24692 self.nodes = v.into_iter().map(|i| i.into()).collect();
24693 self
24694 }
24695}
24696
24697impl wkt::message::Message for WorkflowGraph {
24698 fn typename() -> &'static str {
24699 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowGraph"
24700 }
24701}
24702
24703/// The workflow node.
24704#[derive(Clone, Default, PartialEq)]
24705#[non_exhaustive]
24706pub struct WorkflowNode {
24707 /// Output only. The name of the node.
24708 pub step_id: std::string::String,
24709
24710 /// Output only. Node's prerequisite nodes.
24711 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
24712
24713 /// Output only. The job id; populated after the node enters RUNNING state.
24714 pub job_id: std::string::String,
24715
24716 /// Output only. The node state.
24717 pub state: crate::model::workflow_node::NodeState,
24718
24719 /// Output only. The error detail.
24720 pub error: std::string::String,
24721
24722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24723}
24724
24725impl WorkflowNode {
24726 pub fn new() -> Self {
24727 std::default::Default::default()
24728 }
24729
24730 /// Sets the value of [step_id][crate::model::WorkflowNode::step_id].
24731 ///
24732 /// # Example
24733 /// ```ignore,no_run
24734 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24735 /// let x = WorkflowNode::new().set_step_id("example");
24736 /// ```
24737 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24738 self.step_id = v.into();
24739 self
24740 }
24741
24742 /// Sets the value of [prerequisite_step_ids][crate::model::WorkflowNode::prerequisite_step_ids].
24743 ///
24744 /// # Example
24745 /// ```ignore,no_run
24746 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24747 /// let x = WorkflowNode::new().set_prerequisite_step_ids(["a", "b", "c"]);
24748 /// ```
24749 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
24750 where
24751 T: std::iter::IntoIterator<Item = V>,
24752 V: std::convert::Into<std::string::String>,
24753 {
24754 use std::iter::Iterator;
24755 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
24756 self
24757 }
24758
24759 /// Sets the value of [job_id][crate::model::WorkflowNode::job_id].
24760 ///
24761 /// # Example
24762 /// ```ignore,no_run
24763 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24764 /// let x = WorkflowNode::new().set_job_id("example");
24765 /// ```
24766 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24767 self.job_id = v.into();
24768 self
24769 }
24770
24771 /// Sets the value of [state][crate::model::WorkflowNode::state].
24772 ///
24773 /// # Example
24774 /// ```ignore,no_run
24775 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24776 /// use google_cloud_dataproc_v1::model::workflow_node::NodeState;
24777 /// let x0 = WorkflowNode::new().set_state(NodeState::Blocked);
24778 /// let x1 = WorkflowNode::new().set_state(NodeState::Runnable);
24779 /// let x2 = WorkflowNode::new().set_state(NodeState::Running);
24780 /// ```
24781 pub fn set_state<T: std::convert::Into<crate::model::workflow_node::NodeState>>(
24782 mut self,
24783 v: T,
24784 ) -> Self {
24785 self.state = v.into();
24786 self
24787 }
24788
24789 /// Sets the value of [error][crate::model::WorkflowNode::error].
24790 ///
24791 /// # Example
24792 /// ```ignore,no_run
24793 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24794 /// let x = WorkflowNode::new().set_error("example");
24795 /// ```
24796 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24797 self.error = v.into();
24798 self
24799 }
24800}
24801
24802impl wkt::message::Message for WorkflowNode {
24803 fn typename() -> &'static str {
24804 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowNode"
24805 }
24806}
24807
24808/// Defines additional types related to [WorkflowNode].
24809pub mod workflow_node {
24810 #[allow(unused_imports)]
24811 use super::*;
24812
24813 /// The workflow node state.
24814 ///
24815 /// # Working with unknown values
24816 ///
24817 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24818 /// additional enum variants at any time. Adding new variants is not considered
24819 /// a breaking change. Applications should write their code in anticipation of:
24820 ///
24821 /// - New values appearing in future releases of the client library, **and**
24822 /// - New values received dynamically, without application changes.
24823 ///
24824 /// Please consult the [Working with enums] section in the user guide for some
24825 /// guidelines.
24826 ///
24827 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
24828 #[derive(Clone, Debug, PartialEq)]
24829 #[non_exhaustive]
24830 pub enum NodeState {
24831 /// State is unspecified.
24832 Unspecified,
24833 /// The node is awaiting prerequisite node to finish.
24834 Blocked,
24835 /// The node is runnable but not running.
24836 Runnable,
24837 /// The node is running.
24838 Running,
24839 /// The node completed successfully.
24840 Completed,
24841 /// The node failed. A node can be marked FAILED because
24842 /// its ancestor or peer failed.
24843 Failed,
24844 /// If set, the enum was initialized with an unknown value.
24845 ///
24846 /// Applications can examine the value using [NodeState::value] or
24847 /// [NodeState::name].
24848 UnknownValue(node_state::UnknownValue),
24849 }
24850
24851 #[doc(hidden)]
24852 pub mod node_state {
24853 #[allow(unused_imports)]
24854 use super::*;
24855 #[derive(Clone, Debug, PartialEq)]
24856 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24857 }
24858
24859 impl NodeState {
24860 /// Gets the enum value.
24861 ///
24862 /// Returns `None` if the enum contains an unknown value deserialized from
24863 /// the string representation of enums.
24864 pub fn value(&self) -> std::option::Option<i32> {
24865 match self {
24866 Self::Unspecified => std::option::Option::Some(0),
24867 Self::Blocked => std::option::Option::Some(1),
24868 Self::Runnable => std::option::Option::Some(2),
24869 Self::Running => std::option::Option::Some(3),
24870 Self::Completed => std::option::Option::Some(4),
24871 Self::Failed => std::option::Option::Some(5),
24872 Self::UnknownValue(u) => u.0.value(),
24873 }
24874 }
24875
24876 /// Gets the enum value as a string.
24877 ///
24878 /// Returns `None` if the enum contains an unknown value deserialized from
24879 /// the integer representation of enums.
24880 pub fn name(&self) -> std::option::Option<&str> {
24881 match self {
24882 Self::Unspecified => std::option::Option::Some("NODE_STATE_UNSPECIFIED"),
24883 Self::Blocked => std::option::Option::Some("BLOCKED"),
24884 Self::Runnable => std::option::Option::Some("RUNNABLE"),
24885 Self::Running => std::option::Option::Some("RUNNING"),
24886 Self::Completed => std::option::Option::Some("COMPLETED"),
24887 Self::Failed => std::option::Option::Some("FAILED"),
24888 Self::UnknownValue(u) => u.0.name(),
24889 }
24890 }
24891 }
24892
24893 impl std::default::Default for NodeState {
24894 fn default() -> Self {
24895 use std::convert::From;
24896 Self::from(0)
24897 }
24898 }
24899
24900 impl std::fmt::Display for NodeState {
24901 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24902 wkt::internal::display_enum(f, self.name(), self.value())
24903 }
24904 }
24905
24906 impl std::convert::From<i32> for NodeState {
24907 fn from(value: i32) -> Self {
24908 match value {
24909 0 => Self::Unspecified,
24910 1 => Self::Blocked,
24911 2 => Self::Runnable,
24912 3 => Self::Running,
24913 4 => Self::Completed,
24914 5 => Self::Failed,
24915 _ => Self::UnknownValue(node_state::UnknownValue(
24916 wkt::internal::UnknownEnumValue::Integer(value),
24917 )),
24918 }
24919 }
24920 }
24921
24922 impl std::convert::From<&str> for NodeState {
24923 fn from(value: &str) -> Self {
24924 use std::string::ToString;
24925 match value {
24926 "NODE_STATE_UNSPECIFIED" => Self::Unspecified,
24927 "BLOCKED" => Self::Blocked,
24928 "RUNNABLE" => Self::Runnable,
24929 "RUNNING" => Self::Running,
24930 "COMPLETED" => Self::Completed,
24931 "FAILED" => Self::Failed,
24932 _ => Self::UnknownValue(node_state::UnknownValue(
24933 wkt::internal::UnknownEnumValue::String(value.to_string()),
24934 )),
24935 }
24936 }
24937 }
24938
24939 impl serde::ser::Serialize for NodeState {
24940 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24941 where
24942 S: serde::Serializer,
24943 {
24944 match self {
24945 Self::Unspecified => serializer.serialize_i32(0),
24946 Self::Blocked => serializer.serialize_i32(1),
24947 Self::Runnable => serializer.serialize_i32(2),
24948 Self::Running => serializer.serialize_i32(3),
24949 Self::Completed => serializer.serialize_i32(4),
24950 Self::Failed => serializer.serialize_i32(5),
24951 Self::UnknownValue(u) => u.0.serialize(serializer),
24952 }
24953 }
24954 }
24955
24956 impl<'de> serde::de::Deserialize<'de> for NodeState {
24957 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24958 where
24959 D: serde::Deserializer<'de>,
24960 {
24961 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeState>::new(
24962 ".google.cloud.dataproc.v1.WorkflowNode.NodeState",
24963 ))
24964 }
24965 }
24966}
24967
24968/// A request to create a workflow template.
24969#[derive(Clone, Default, PartialEq)]
24970#[non_exhaustive]
24971pub struct CreateWorkflowTemplateRequest {
24972 /// Required. The resource name of the region or location, as described
24973 /// in <https://cloud.google.com/apis/design/resource_names>.
24974 ///
24975 /// * For `projects.regions.workflowTemplates.create`, the resource name of the
24976 /// region has the following format:
24977 /// `projects/{project_id}/regions/{region}`
24978 ///
24979 /// * For `projects.locations.workflowTemplates.create`, the resource name of
24980 /// the location has the following format:
24981 /// `projects/{project_id}/locations/{location}`
24982 ///
24983 pub parent: std::string::String,
24984
24985 /// Required. The Dataproc workflow template to create.
24986 pub template: std::option::Option<crate::model::WorkflowTemplate>,
24987
24988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24989}
24990
24991impl CreateWorkflowTemplateRequest {
24992 pub fn new() -> Self {
24993 std::default::Default::default()
24994 }
24995
24996 /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
24997 ///
24998 /// # Example
24999 /// ```ignore,no_run
25000 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25001 /// let x = CreateWorkflowTemplateRequest::new().set_parent("example");
25002 /// ```
25003 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25004 self.parent = v.into();
25005 self
25006 }
25007
25008 /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25009 ///
25010 /// # Example
25011 /// ```ignore,no_run
25012 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25013 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25014 /// let x = CreateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25015 /// ```
25016 pub fn set_template<T>(mut self, v: T) -> Self
25017 where
25018 T: std::convert::Into<crate::model::WorkflowTemplate>,
25019 {
25020 self.template = std::option::Option::Some(v.into());
25021 self
25022 }
25023
25024 /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25025 ///
25026 /// # Example
25027 /// ```ignore,no_run
25028 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25029 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25030 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25031 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25032 /// ```
25033 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25034 where
25035 T: std::convert::Into<crate::model::WorkflowTemplate>,
25036 {
25037 self.template = v.map(|x| x.into());
25038 self
25039 }
25040}
25041
25042impl wkt::message::Message for CreateWorkflowTemplateRequest {
25043 fn typename() -> &'static str {
25044 "type.googleapis.com/google.cloud.dataproc.v1.CreateWorkflowTemplateRequest"
25045 }
25046}
25047
25048/// A request to fetch a workflow template.
25049#[derive(Clone, Default, PartialEq)]
25050#[non_exhaustive]
25051pub struct GetWorkflowTemplateRequest {
25052 /// Required. The resource name of the workflow template, as described
25053 /// in <https://cloud.google.com/apis/design/resource_names>.
25054 ///
25055 /// * For `projects.regions.workflowTemplates.get`, the resource name of the
25056 /// template has the following format:
25057 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25058 ///
25059 /// * For `projects.locations.workflowTemplates.get`, the resource name of the
25060 /// template has the following format:
25061 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25062 ///
25063 pub name: std::string::String,
25064
25065 /// Optional. The version of workflow template to retrieve. Only previously
25066 /// instantiated versions can be retrieved.
25067 ///
25068 /// If unspecified, retrieves the current version.
25069 pub version: i32,
25070
25071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25072}
25073
25074impl GetWorkflowTemplateRequest {
25075 pub fn new() -> Self {
25076 std::default::Default::default()
25077 }
25078
25079 /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
25080 ///
25081 /// # Example
25082 /// ```ignore,no_run
25083 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25084 /// let x = GetWorkflowTemplateRequest::new().set_name("example");
25085 /// ```
25086 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25087 self.name = v.into();
25088 self
25089 }
25090
25091 /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
25092 ///
25093 /// # Example
25094 /// ```ignore,no_run
25095 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25096 /// let x = GetWorkflowTemplateRequest::new().set_version(42);
25097 /// ```
25098 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25099 self.version = v.into();
25100 self
25101 }
25102}
25103
25104impl wkt::message::Message for GetWorkflowTemplateRequest {
25105 fn typename() -> &'static str {
25106 "type.googleapis.com/google.cloud.dataproc.v1.GetWorkflowTemplateRequest"
25107 }
25108}
25109
25110/// A request to instantiate a workflow template.
25111#[derive(Clone, Default, PartialEq)]
25112#[non_exhaustive]
25113pub struct InstantiateWorkflowTemplateRequest {
25114 /// Required. The resource name of the workflow template, as described
25115 /// in <https://cloud.google.com/apis/design/resource_names>.
25116 ///
25117 /// * For `projects.regions.workflowTemplates.instantiate`, the resource name
25118 /// of the template has the following format:
25119 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25120 ///
25121 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25122 /// of the template has the following format:
25123 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25124 ///
25125 pub name: std::string::String,
25126
25127 /// Optional. The version of workflow template to instantiate. If specified,
25128 /// the workflow will be instantiated only if the current version of
25129 /// the workflow template has the supplied version.
25130 ///
25131 /// This option cannot be used to instantiate a previous version of
25132 /// workflow template.
25133 pub version: i32,
25134
25135 /// Optional. A tag that prevents multiple concurrent workflow
25136 /// instances with the same tag from running. This mitigates risk of
25137 /// concurrent instances started due to retries.
25138 ///
25139 /// It is recommended to always set this value to a
25140 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
25141 ///
25142 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
25143 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
25144 pub request_id: std::string::String,
25145
25146 /// Optional. Map from parameter names to values that should be used for those
25147 /// parameters. Values may not exceed 1000 characters.
25148 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
25149
25150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25151}
25152
25153impl InstantiateWorkflowTemplateRequest {
25154 pub fn new() -> Self {
25155 std::default::Default::default()
25156 }
25157
25158 /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
25159 ///
25160 /// # Example
25161 /// ```ignore,no_run
25162 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25163 /// let x = InstantiateWorkflowTemplateRequest::new().set_name("example");
25164 /// ```
25165 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25166 self.name = v.into();
25167 self
25168 }
25169
25170 /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
25171 ///
25172 /// # Example
25173 /// ```ignore,no_run
25174 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25175 /// let x = InstantiateWorkflowTemplateRequest::new().set_version(42);
25176 /// ```
25177 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25178 self.version = v.into();
25179 self
25180 }
25181
25182 /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
25183 ///
25184 /// # Example
25185 /// ```ignore,no_run
25186 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25187 /// let x = InstantiateWorkflowTemplateRequest::new().set_request_id("example");
25188 /// ```
25189 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25190 self.request_id = v.into();
25191 self
25192 }
25193
25194 /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
25195 ///
25196 /// # Example
25197 /// ```ignore,no_run
25198 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25199 /// let x = InstantiateWorkflowTemplateRequest::new().set_parameters([
25200 /// ("key0", "abc"),
25201 /// ("key1", "xyz"),
25202 /// ]);
25203 /// ```
25204 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
25205 where
25206 T: std::iter::IntoIterator<Item = (K, V)>,
25207 K: std::convert::Into<std::string::String>,
25208 V: std::convert::Into<std::string::String>,
25209 {
25210 use std::iter::Iterator;
25211 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
25212 self
25213 }
25214}
25215
25216impl wkt::message::Message for InstantiateWorkflowTemplateRequest {
25217 fn typename() -> &'static str {
25218 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest"
25219 }
25220}
25221
25222/// A request to instantiate an inline workflow template.
25223#[derive(Clone, Default, PartialEq)]
25224#[non_exhaustive]
25225pub struct InstantiateInlineWorkflowTemplateRequest {
25226 /// Required. The resource name of the region or location, as described
25227 /// in <https://cloud.google.com/apis/design/resource_names>.
25228 ///
25229 /// * For `projects.regions.workflowTemplates,instantiateinline`, the resource
25230 /// name of the region has the following format:
25231 /// `projects/{project_id}/regions/{region}`
25232 ///
25233 /// * For `projects.locations.workflowTemplates.instantiateinline`, the
25234 /// resource name of the location has the following format:
25235 /// `projects/{project_id}/locations/{location}`
25236 ///
25237 pub parent: std::string::String,
25238
25239 /// Required. The workflow template to instantiate.
25240 pub template: std::option::Option<crate::model::WorkflowTemplate>,
25241
25242 /// Optional. A tag that prevents multiple concurrent workflow
25243 /// instances with the same tag from running. This mitigates risk of
25244 /// concurrent instances started due to retries.
25245 ///
25246 /// It is recommended to always set this value to a
25247 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
25248 ///
25249 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
25250 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
25251 pub request_id: std::string::String,
25252
25253 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25254}
25255
25256impl InstantiateInlineWorkflowTemplateRequest {
25257 pub fn new() -> Self {
25258 std::default::Default::default()
25259 }
25260
25261 /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
25262 ///
25263 /// # Example
25264 /// ```ignore,no_run
25265 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25266 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_parent("example");
25267 /// ```
25268 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25269 self.parent = v.into();
25270 self
25271 }
25272
25273 /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
25274 ///
25275 /// # Example
25276 /// ```ignore,no_run
25277 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25278 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25279 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25280 /// ```
25281 pub fn set_template<T>(mut self, v: T) -> Self
25282 where
25283 T: std::convert::Into<crate::model::WorkflowTemplate>,
25284 {
25285 self.template = std::option::Option::Some(v.into());
25286 self
25287 }
25288
25289 /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
25290 ///
25291 /// # Example
25292 /// ```ignore,no_run
25293 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25294 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25295 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25296 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25297 /// ```
25298 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25299 where
25300 T: std::convert::Into<crate::model::WorkflowTemplate>,
25301 {
25302 self.template = v.map(|x| x.into());
25303 self
25304 }
25305
25306 /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
25307 ///
25308 /// # Example
25309 /// ```ignore,no_run
25310 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25311 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_request_id("example");
25312 /// ```
25313 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25314 self.request_id = v.into();
25315 self
25316 }
25317}
25318
25319impl wkt::message::Message for InstantiateInlineWorkflowTemplateRequest {
25320 fn typename() -> &'static str {
25321 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest"
25322 }
25323}
25324
25325/// A request to update a workflow template.
25326#[derive(Clone, Default, PartialEq)]
25327#[non_exhaustive]
25328pub struct UpdateWorkflowTemplateRequest {
25329 /// Required. The updated workflow template.
25330 ///
25331 /// The `template.version` field must match the current version.
25332 pub template: std::option::Option<crate::model::WorkflowTemplate>,
25333
25334 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25335}
25336
25337impl UpdateWorkflowTemplateRequest {
25338 pub fn new() -> Self {
25339 std::default::Default::default()
25340 }
25341
25342 /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25343 ///
25344 /// # Example
25345 /// ```ignore,no_run
25346 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25347 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25348 /// let x = UpdateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25349 /// ```
25350 pub fn set_template<T>(mut self, v: T) -> Self
25351 where
25352 T: std::convert::Into<crate::model::WorkflowTemplate>,
25353 {
25354 self.template = std::option::Option::Some(v.into());
25355 self
25356 }
25357
25358 /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25359 ///
25360 /// # Example
25361 /// ```ignore,no_run
25362 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25363 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25364 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25365 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25366 /// ```
25367 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25368 where
25369 T: std::convert::Into<crate::model::WorkflowTemplate>,
25370 {
25371 self.template = v.map(|x| x.into());
25372 self
25373 }
25374}
25375
25376impl wkt::message::Message for UpdateWorkflowTemplateRequest {
25377 fn typename() -> &'static str {
25378 "type.googleapis.com/google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest"
25379 }
25380}
25381
25382/// A request to list workflow templates in a project.
25383#[derive(Clone, Default, PartialEq)]
25384#[non_exhaustive]
25385pub struct ListWorkflowTemplatesRequest {
25386 /// Required. The resource name of the region or location, as described
25387 /// in <https://cloud.google.com/apis/design/resource_names>.
25388 ///
25389 /// * For `projects.regions.workflowTemplates,list`, the resource
25390 /// name of the region has the following format:
25391 /// `projects/{project_id}/regions/{region}`
25392 ///
25393 /// * For `projects.locations.workflowTemplates.list`, the
25394 /// resource name of the location has the following format:
25395 /// `projects/{project_id}/locations/{location}`
25396 ///
25397 pub parent: std::string::String,
25398
25399 /// Optional. The maximum number of results to return in each response.
25400 pub page_size: i32,
25401
25402 /// Optional. The page token, returned by a previous call, to request the
25403 /// next page of results.
25404 pub page_token: std::string::String,
25405
25406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25407}
25408
25409impl ListWorkflowTemplatesRequest {
25410 pub fn new() -> Self {
25411 std::default::Default::default()
25412 }
25413
25414 /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
25415 ///
25416 /// # Example
25417 /// ```ignore,no_run
25418 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25419 /// let x = ListWorkflowTemplatesRequest::new().set_parent("example");
25420 /// ```
25421 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25422 self.parent = v.into();
25423 self
25424 }
25425
25426 /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
25427 ///
25428 /// # Example
25429 /// ```ignore,no_run
25430 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25431 /// let x = ListWorkflowTemplatesRequest::new().set_page_size(42);
25432 /// ```
25433 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25434 self.page_size = v.into();
25435 self
25436 }
25437
25438 /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
25439 ///
25440 /// # Example
25441 /// ```ignore,no_run
25442 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25443 /// let x = ListWorkflowTemplatesRequest::new().set_page_token("example");
25444 /// ```
25445 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25446 self.page_token = v.into();
25447 self
25448 }
25449}
25450
25451impl wkt::message::Message for ListWorkflowTemplatesRequest {
25452 fn typename() -> &'static str {
25453 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesRequest"
25454 }
25455}
25456
25457/// A response to a request to list workflow templates in a project.
25458#[derive(Clone, Default, PartialEq)]
25459#[non_exhaustive]
25460pub struct ListWorkflowTemplatesResponse {
25461 /// Output only. WorkflowTemplates list.
25462 pub templates: std::vec::Vec<crate::model::WorkflowTemplate>,
25463
25464 /// Output only. This token is included in the response if there are more
25465 /// results to fetch. To fetch additional results, provide this value as the
25466 /// page_token in a subsequent \<code\>ListWorkflowTemplatesRequest\</code\>.
25467 pub next_page_token: std::string::String,
25468
25469 /// Output only. List of workflow templates that could not be included in the
25470 /// response. Attempting to get one of these resources may indicate why it was
25471 /// not included in the list response.
25472 pub unreachable: std::vec::Vec<std::string::String>,
25473
25474 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25475}
25476
25477impl ListWorkflowTemplatesResponse {
25478 pub fn new() -> Self {
25479 std::default::Default::default()
25480 }
25481
25482 /// Sets the value of [templates][crate::model::ListWorkflowTemplatesResponse::templates].
25483 ///
25484 /// # Example
25485 /// ```ignore,no_run
25486 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25487 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25488 /// let x = ListWorkflowTemplatesResponse::new()
25489 /// .set_templates([
25490 /// WorkflowTemplate::default()/* use setters */,
25491 /// WorkflowTemplate::default()/* use (different) setters */,
25492 /// ]);
25493 /// ```
25494 pub fn set_templates<T, V>(mut self, v: T) -> Self
25495 where
25496 T: std::iter::IntoIterator<Item = V>,
25497 V: std::convert::Into<crate::model::WorkflowTemplate>,
25498 {
25499 use std::iter::Iterator;
25500 self.templates = v.into_iter().map(|i| i.into()).collect();
25501 self
25502 }
25503
25504 /// Sets the value of [next_page_token][crate::model::ListWorkflowTemplatesResponse::next_page_token].
25505 ///
25506 /// # Example
25507 /// ```ignore,no_run
25508 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25509 /// let x = ListWorkflowTemplatesResponse::new().set_next_page_token("example");
25510 /// ```
25511 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25512 self.next_page_token = v.into();
25513 self
25514 }
25515
25516 /// Sets the value of [unreachable][crate::model::ListWorkflowTemplatesResponse::unreachable].
25517 ///
25518 /// # Example
25519 /// ```ignore,no_run
25520 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25521 /// let x = ListWorkflowTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
25522 /// ```
25523 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
25524 where
25525 T: std::iter::IntoIterator<Item = V>,
25526 V: std::convert::Into<std::string::String>,
25527 {
25528 use std::iter::Iterator;
25529 self.unreachable = v.into_iter().map(|i| i.into()).collect();
25530 self
25531 }
25532}
25533
25534impl wkt::message::Message for ListWorkflowTemplatesResponse {
25535 fn typename() -> &'static str {
25536 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesResponse"
25537 }
25538}
25539
25540#[doc(hidden)]
25541impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowTemplatesResponse {
25542 type PageItem = crate::model::WorkflowTemplate;
25543
25544 fn items(self) -> std::vec::Vec<Self::PageItem> {
25545 self.templates
25546 }
25547
25548 fn next_page_token(&self) -> std::string::String {
25549 use std::clone::Clone;
25550 self.next_page_token.clone()
25551 }
25552}
25553
25554/// A request to delete a workflow template.
25555///
25556/// Currently started workflows will remain running.
25557#[derive(Clone, Default, PartialEq)]
25558#[non_exhaustive]
25559pub struct DeleteWorkflowTemplateRequest {
25560 /// Required. The resource name of the workflow template, as described
25561 /// in <https://cloud.google.com/apis/design/resource_names>.
25562 ///
25563 /// * For `projects.regions.workflowTemplates.delete`, the resource name
25564 /// of the template has the following format:
25565 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25566 ///
25567 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25568 /// of the template has the following format:
25569 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25570 ///
25571 pub name: std::string::String,
25572
25573 /// Optional. The version of workflow template to delete. If specified,
25574 /// will only delete the template if the current server version matches
25575 /// specified version.
25576 pub version: i32,
25577
25578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25579}
25580
25581impl DeleteWorkflowTemplateRequest {
25582 pub fn new() -> Self {
25583 std::default::Default::default()
25584 }
25585
25586 /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
25587 ///
25588 /// # Example
25589 /// ```ignore,no_run
25590 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25591 /// let x = DeleteWorkflowTemplateRequest::new().set_name("example");
25592 /// ```
25593 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25594 self.name = v.into();
25595 self
25596 }
25597
25598 /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
25599 ///
25600 /// # Example
25601 /// ```ignore,no_run
25602 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25603 /// let x = DeleteWorkflowTemplateRequest::new().set_version(42);
25604 /// ```
25605 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25606 self.version = v.into();
25607 self
25608 }
25609}
25610
25611impl wkt::message::Message for DeleteWorkflowTemplateRequest {
25612 fn typename() -> &'static str {
25613 "type.googleapis.com/google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest"
25614 }
25615}
25616
25617/// Cluster components that can be activated.
25618///
25619/// # Working with unknown values
25620///
25621/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25622/// additional enum variants at any time. Adding new variants is not considered
25623/// a breaking change. Applications should write their code in anticipation of:
25624///
25625/// - New values appearing in future releases of the client library, **and**
25626/// - New values received dynamically, without application changes.
25627///
25628/// Please consult the [Working with enums] section in the user guide for some
25629/// guidelines.
25630///
25631/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25632#[derive(Clone, Debug, PartialEq)]
25633#[non_exhaustive]
25634pub enum Component {
25635 /// Unspecified component. Specifying this will cause Cluster creation to fail.
25636 Unspecified,
25637 /// The Anaconda component is no longer supported or applicable to
25638 /// [supported Dataproc on Compute Engine image versions]
25639 /// (<https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-version-clusters#supported-dataproc-image-versions>).
25640 /// It cannot be activated on clusters created with supported Dataproc on
25641 /// Compute Engine image versions.
25642 Anaconda,
25643 /// Delta Lake.
25644 Delta,
25645 /// Docker
25646 Docker,
25647 /// The Druid query engine. (alpha)
25648 Druid,
25649 /// Flink
25650 Flink,
25651 /// HBase. (beta)
25652 Hbase,
25653 /// The Hive Web HCatalog (the REST service for accessing HCatalog).
25654 HiveWebhcat,
25655 /// Hudi.
25656 Hudi,
25657 /// Iceberg.
25658 Iceberg,
25659 /// The Jupyter Notebook.
25660 Jupyter,
25661 /// The Jupyter Kernel Gateway.
25662 JupyterKernelGateway,
25663 /// The Pig component.
25664 Pig,
25665 /// The Presto query engine.
25666 Presto,
25667 /// The Trino query engine.
25668 Trino,
25669 /// The Ranger service.
25670 Ranger,
25671 /// The Solr service.
25672 Solr,
25673 /// The Zeppelin notebook.
25674 Zeppelin,
25675 /// The Zookeeper service.
25676 Zookeeper,
25677 /// If set, the enum was initialized with an unknown value.
25678 ///
25679 /// Applications can examine the value using [Component::value] or
25680 /// [Component::name].
25681 UnknownValue(component::UnknownValue),
25682}
25683
25684#[doc(hidden)]
25685pub mod component {
25686 #[allow(unused_imports)]
25687 use super::*;
25688 #[derive(Clone, Debug, PartialEq)]
25689 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25690}
25691
25692impl Component {
25693 /// Gets the enum value.
25694 ///
25695 /// Returns `None` if the enum contains an unknown value deserialized from
25696 /// the string representation of enums.
25697 pub fn value(&self) -> std::option::Option<i32> {
25698 match self {
25699 Self::Unspecified => std::option::Option::Some(0),
25700 Self::Anaconda => std::option::Option::Some(5),
25701 Self::Delta => std::option::Option::Some(20),
25702 Self::Docker => std::option::Option::Some(13),
25703 Self::Druid => std::option::Option::Some(9),
25704 Self::Flink => std::option::Option::Some(14),
25705 Self::Hbase => std::option::Option::Some(11),
25706 Self::HiveWebhcat => std::option::Option::Some(3),
25707 Self::Hudi => std::option::Option::Some(18),
25708 Self::Iceberg => std::option::Option::Some(19),
25709 Self::Jupyter => std::option::Option::Some(1),
25710 Self::JupyterKernelGateway => std::option::Option::Some(22),
25711 Self::Pig => std::option::Option::Some(21),
25712 Self::Presto => std::option::Option::Some(6),
25713 Self::Trino => std::option::Option::Some(17),
25714 Self::Ranger => std::option::Option::Some(12),
25715 Self::Solr => std::option::Option::Some(10),
25716 Self::Zeppelin => std::option::Option::Some(4),
25717 Self::Zookeeper => std::option::Option::Some(8),
25718 Self::UnknownValue(u) => u.0.value(),
25719 }
25720 }
25721
25722 /// Gets the enum value as a string.
25723 ///
25724 /// Returns `None` if the enum contains an unknown value deserialized from
25725 /// the integer representation of enums.
25726 pub fn name(&self) -> std::option::Option<&str> {
25727 match self {
25728 Self::Unspecified => std::option::Option::Some("COMPONENT_UNSPECIFIED"),
25729 Self::Anaconda => std::option::Option::Some("ANACONDA"),
25730 Self::Delta => std::option::Option::Some("DELTA"),
25731 Self::Docker => std::option::Option::Some("DOCKER"),
25732 Self::Druid => std::option::Option::Some("DRUID"),
25733 Self::Flink => std::option::Option::Some("FLINK"),
25734 Self::Hbase => std::option::Option::Some("HBASE"),
25735 Self::HiveWebhcat => std::option::Option::Some("HIVE_WEBHCAT"),
25736 Self::Hudi => std::option::Option::Some("HUDI"),
25737 Self::Iceberg => std::option::Option::Some("ICEBERG"),
25738 Self::Jupyter => std::option::Option::Some("JUPYTER"),
25739 Self::JupyterKernelGateway => std::option::Option::Some("JUPYTER_KERNEL_GATEWAY"),
25740 Self::Pig => std::option::Option::Some("PIG"),
25741 Self::Presto => std::option::Option::Some("PRESTO"),
25742 Self::Trino => std::option::Option::Some("TRINO"),
25743 Self::Ranger => std::option::Option::Some("RANGER"),
25744 Self::Solr => std::option::Option::Some("SOLR"),
25745 Self::Zeppelin => std::option::Option::Some("ZEPPELIN"),
25746 Self::Zookeeper => std::option::Option::Some("ZOOKEEPER"),
25747 Self::UnknownValue(u) => u.0.name(),
25748 }
25749 }
25750}
25751
25752impl std::default::Default for Component {
25753 fn default() -> Self {
25754 use std::convert::From;
25755 Self::from(0)
25756 }
25757}
25758
25759impl std::fmt::Display for Component {
25760 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25761 wkt::internal::display_enum(f, self.name(), self.value())
25762 }
25763}
25764
25765impl std::convert::From<i32> for Component {
25766 fn from(value: i32) -> Self {
25767 match value {
25768 0 => Self::Unspecified,
25769 1 => Self::Jupyter,
25770 3 => Self::HiveWebhcat,
25771 4 => Self::Zeppelin,
25772 5 => Self::Anaconda,
25773 6 => Self::Presto,
25774 8 => Self::Zookeeper,
25775 9 => Self::Druid,
25776 10 => Self::Solr,
25777 11 => Self::Hbase,
25778 12 => Self::Ranger,
25779 13 => Self::Docker,
25780 14 => Self::Flink,
25781 17 => Self::Trino,
25782 18 => Self::Hudi,
25783 19 => Self::Iceberg,
25784 20 => Self::Delta,
25785 21 => Self::Pig,
25786 22 => Self::JupyterKernelGateway,
25787 _ => Self::UnknownValue(component::UnknownValue(
25788 wkt::internal::UnknownEnumValue::Integer(value),
25789 )),
25790 }
25791 }
25792}
25793
25794impl std::convert::From<&str> for Component {
25795 fn from(value: &str) -> Self {
25796 use std::string::ToString;
25797 match value {
25798 "COMPONENT_UNSPECIFIED" => Self::Unspecified,
25799 "ANACONDA" => Self::Anaconda,
25800 "DELTA" => Self::Delta,
25801 "DOCKER" => Self::Docker,
25802 "DRUID" => Self::Druid,
25803 "FLINK" => Self::Flink,
25804 "HBASE" => Self::Hbase,
25805 "HIVE_WEBHCAT" => Self::HiveWebhcat,
25806 "HUDI" => Self::Hudi,
25807 "ICEBERG" => Self::Iceberg,
25808 "JUPYTER" => Self::Jupyter,
25809 "JUPYTER_KERNEL_GATEWAY" => Self::JupyterKernelGateway,
25810 "PIG" => Self::Pig,
25811 "PRESTO" => Self::Presto,
25812 "TRINO" => Self::Trino,
25813 "RANGER" => Self::Ranger,
25814 "SOLR" => Self::Solr,
25815 "ZEPPELIN" => Self::Zeppelin,
25816 "ZOOKEEPER" => Self::Zookeeper,
25817 _ => Self::UnknownValue(component::UnknownValue(
25818 wkt::internal::UnknownEnumValue::String(value.to_string()),
25819 )),
25820 }
25821 }
25822}
25823
25824impl serde::ser::Serialize for Component {
25825 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25826 where
25827 S: serde::Serializer,
25828 {
25829 match self {
25830 Self::Unspecified => serializer.serialize_i32(0),
25831 Self::Anaconda => serializer.serialize_i32(5),
25832 Self::Delta => serializer.serialize_i32(20),
25833 Self::Docker => serializer.serialize_i32(13),
25834 Self::Druid => serializer.serialize_i32(9),
25835 Self::Flink => serializer.serialize_i32(14),
25836 Self::Hbase => serializer.serialize_i32(11),
25837 Self::HiveWebhcat => serializer.serialize_i32(3),
25838 Self::Hudi => serializer.serialize_i32(18),
25839 Self::Iceberg => serializer.serialize_i32(19),
25840 Self::Jupyter => serializer.serialize_i32(1),
25841 Self::JupyterKernelGateway => serializer.serialize_i32(22),
25842 Self::Pig => serializer.serialize_i32(21),
25843 Self::Presto => serializer.serialize_i32(6),
25844 Self::Trino => serializer.serialize_i32(17),
25845 Self::Ranger => serializer.serialize_i32(12),
25846 Self::Solr => serializer.serialize_i32(10),
25847 Self::Zeppelin => serializer.serialize_i32(4),
25848 Self::Zookeeper => serializer.serialize_i32(8),
25849 Self::UnknownValue(u) => u.0.serialize(serializer),
25850 }
25851 }
25852}
25853
25854impl<'de> serde::de::Deserialize<'de> for Component {
25855 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25856 where
25857 D: serde::Deserializer<'de>,
25858 {
25859 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Component>::new(
25860 ".google.cloud.dataproc.v1.Component",
25861 ))
25862 }
25863}
25864
25865/// Actions in response to failure of a resource associated with a cluster.
25866///
25867/// # Working with unknown values
25868///
25869/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25870/// additional enum variants at any time. Adding new variants is not considered
25871/// a breaking change. Applications should write their code in anticipation of:
25872///
25873/// - New values appearing in future releases of the client library, **and**
25874/// - New values received dynamically, without application changes.
25875///
25876/// Please consult the [Working with enums] section in the user guide for some
25877/// guidelines.
25878///
25879/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25880#[derive(Clone, Debug, PartialEq)]
25881#[non_exhaustive]
25882pub enum FailureAction {
25883 /// When FailureAction is unspecified, failure action defaults to NO_ACTION.
25884 Unspecified,
25885 /// Take no action on failure to create a cluster resource. NO_ACTION is the
25886 /// default.
25887 NoAction,
25888 /// Delete the failed cluster resource.
25889 Delete,
25890 /// If set, the enum was initialized with an unknown value.
25891 ///
25892 /// Applications can examine the value using [FailureAction::value] or
25893 /// [FailureAction::name].
25894 UnknownValue(failure_action::UnknownValue),
25895}
25896
25897#[doc(hidden)]
25898pub mod failure_action {
25899 #[allow(unused_imports)]
25900 use super::*;
25901 #[derive(Clone, Debug, PartialEq)]
25902 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25903}
25904
25905impl FailureAction {
25906 /// Gets the enum value.
25907 ///
25908 /// Returns `None` if the enum contains an unknown value deserialized from
25909 /// the string representation of enums.
25910 pub fn value(&self) -> std::option::Option<i32> {
25911 match self {
25912 Self::Unspecified => std::option::Option::Some(0),
25913 Self::NoAction => std::option::Option::Some(1),
25914 Self::Delete => std::option::Option::Some(2),
25915 Self::UnknownValue(u) => u.0.value(),
25916 }
25917 }
25918
25919 /// Gets the enum value as a string.
25920 ///
25921 /// Returns `None` if the enum contains an unknown value deserialized from
25922 /// the integer representation of enums.
25923 pub fn name(&self) -> std::option::Option<&str> {
25924 match self {
25925 Self::Unspecified => std::option::Option::Some("FAILURE_ACTION_UNSPECIFIED"),
25926 Self::NoAction => std::option::Option::Some("NO_ACTION"),
25927 Self::Delete => std::option::Option::Some("DELETE"),
25928 Self::UnknownValue(u) => u.0.name(),
25929 }
25930 }
25931}
25932
25933impl std::default::Default for FailureAction {
25934 fn default() -> Self {
25935 use std::convert::From;
25936 Self::from(0)
25937 }
25938}
25939
25940impl std::fmt::Display for FailureAction {
25941 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25942 wkt::internal::display_enum(f, self.name(), self.value())
25943 }
25944}
25945
25946impl std::convert::From<i32> for FailureAction {
25947 fn from(value: i32) -> Self {
25948 match value {
25949 0 => Self::Unspecified,
25950 1 => Self::NoAction,
25951 2 => Self::Delete,
25952 _ => Self::UnknownValue(failure_action::UnknownValue(
25953 wkt::internal::UnknownEnumValue::Integer(value),
25954 )),
25955 }
25956 }
25957}
25958
25959impl std::convert::From<&str> for FailureAction {
25960 fn from(value: &str) -> Self {
25961 use std::string::ToString;
25962 match value {
25963 "FAILURE_ACTION_UNSPECIFIED" => Self::Unspecified,
25964 "NO_ACTION" => Self::NoAction,
25965 "DELETE" => Self::Delete,
25966 _ => Self::UnknownValue(failure_action::UnknownValue(
25967 wkt::internal::UnknownEnumValue::String(value.to_string()),
25968 )),
25969 }
25970 }
25971}
25972
25973impl serde::ser::Serialize for FailureAction {
25974 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25975 where
25976 S: serde::Serializer,
25977 {
25978 match self {
25979 Self::Unspecified => serializer.serialize_i32(0),
25980 Self::NoAction => serializer.serialize_i32(1),
25981 Self::Delete => serializer.serialize_i32(2),
25982 Self::UnknownValue(u) => u.0.serialize(serializer),
25983 }
25984 }
25985}
25986
25987impl<'de> serde::de::Deserialize<'de> for FailureAction {
25988 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25989 where
25990 D: serde::Deserializer<'de>,
25991 {
25992 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureAction>::new(
25993 ".google.cloud.dataproc.v1.FailureAction",
25994 ))
25995 }
25996}