google_cloud_datafusion_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 gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate longrunning;
26extern crate lro;
27extern crate reqwest;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35/// Network configuration for a Data Fusion instance. These configurations
36/// are used for peering with the customer network. Configurations are optional
37/// when a public Data Fusion instance is to be created. However, providing
38/// these configurations allows several benefits, such as reduced network latency
39/// while accessing the customer resources from managed Data Fusion instance
40/// nodes, as well as access to the customer on-prem resources.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct NetworkConfig {
44    /// Name of the network in the customer project with which the Tenant Project
45    /// will be peered for executing pipelines. In case of shared VPC where the
46    /// network resides in another host project the network should specified in
47    /// the form of projects/{host-project-id}/global/networks/{network}
48    pub network: std::string::String,
49
50    /// The IP range in CIDR notation to use for the managed Data Fusion instance
51    /// nodes. This range must not overlap with any other ranges used in the
52    /// customer network.
53    pub ip_allocation: std::string::String,
54
55    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
56}
57
58impl NetworkConfig {
59    pub fn new() -> Self {
60        std::default::Default::default()
61    }
62
63    /// Sets the value of [network][crate::model::NetworkConfig::network].
64    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
65        self.network = v.into();
66        self
67    }
68
69    /// Sets the value of [ip_allocation][crate::model::NetworkConfig::ip_allocation].
70    pub fn set_ip_allocation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
71        self.ip_allocation = v.into();
72        self
73    }
74}
75
76impl wkt::message::Message for NetworkConfig {
77    fn typename() -> &'static str {
78        "type.googleapis.com/google.cloud.datafusion.v1.NetworkConfig"
79    }
80}
81
82#[doc(hidden)]
83impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
84    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
85    where
86        D: serde::Deserializer<'de>,
87    {
88        #[allow(non_camel_case_types)]
89        #[doc(hidden)]
90        #[derive(PartialEq, Eq, Hash)]
91        enum __FieldTag {
92            __network,
93            __ip_allocation,
94            Unknown(std::string::String),
95        }
96        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
97            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
98            where
99                D: serde::Deserializer<'de>,
100            {
101                struct Visitor;
102                impl<'de> serde::de::Visitor<'de> for Visitor {
103                    type Value = __FieldTag;
104                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
105                        formatter.write_str("a field name for NetworkConfig")
106                    }
107                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
108                    where
109                        E: serde::de::Error,
110                    {
111                        use std::result::Result::Ok;
112                        use std::string::ToString;
113                        match value {
114                            "network" => Ok(__FieldTag::__network),
115                            "ipAllocation" => Ok(__FieldTag::__ip_allocation),
116                            "ip_allocation" => Ok(__FieldTag::__ip_allocation),
117                            _ => Ok(__FieldTag::Unknown(value.to_string())),
118                        }
119                    }
120                }
121                deserializer.deserialize_identifier(Visitor)
122            }
123        }
124        struct Visitor;
125        impl<'de> serde::de::Visitor<'de> for Visitor {
126            type Value = NetworkConfig;
127            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
128                formatter.write_str("struct NetworkConfig")
129            }
130            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
131            where
132                A: serde::de::MapAccess<'de>,
133            {
134                #[allow(unused_imports)]
135                use serde::de::Error;
136                use std::option::Option::Some;
137                let mut fields = std::collections::HashSet::new();
138                let mut result = Self::Value::new();
139                while let Some(tag) = map.next_key::<__FieldTag>()? {
140                    #[allow(clippy::match_single_binding)]
141                    match tag {
142                        __FieldTag::__network => {
143                            if !fields.insert(__FieldTag::__network) {
144                                return std::result::Result::Err(A::Error::duplicate_field(
145                                    "multiple values for network",
146                                ));
147                            }
148                            result.network = map
149                                .next_value::<std::option::Option<std::string::String>>()?
150                                .unwrap_or_default();
151                        }
152                        __FieldTag::__ip_allocation => {
153                            if !fields.insert(__FieldTag::__ip_allocation) {
154                                return std::result::Result::Err(A::Error::duplicate_field(
155                                    "multiple values for ip_allocation",
156                                ));
157                            }
158                            result.ip_allocation = map
159                                .next_value::<std::option::Option<std::string::String>>()?
160                                .unwrap_or_default();
161                        }
162                        __FieldTag::Unknown(key) => {
163                            let value = map.next_value::<serde_json::Value>()?;
164                            result._unknown_fields.insert(key, value);
165                        }
166                    }
167                }
168                std::result::Result::Ok(result)
169            }
170        }
171        deserializer.deserialize_any(Visitor)
172    }
173}
174
175#[doc(hidden)]
176impl serde::ser::Serialize for NetworkConfig {
177    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
178    where
179        S: serde::ser::Serializer,
180    {
181        use serde::ser::SerializeMap;
182        #[allow(unused_imports)]
183        use std::option::Option::Some;
184        let mut state = serializer.serialize_map(std::option::Option::None)?;
185        if !self.network.is_empty() {
186            state.serialize_entry("network", &self.network)?;
187        }
188        if !self.ip_allocation.is_empty() {
189            state.serialize_entry("ipAllocation", &self.ip_allocation)?;
190        }
191        if !self._unknown_fields.is_empty() {
192            for (key, value) in self._unknown_fields.iter() {
193                state.serialize_entry(key, &value)?;
194            }
195        }
196        state.end()
197    }
198}
199
200impl std::fmt::Debug for NetworkConfig {
201    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
202        let mut debug_struct = f.debug_struct("NetworkConfig");
203        debug_struct.field("network", &self.network);
204        debug_struct.field("ip_allocation", &self.ip_allocation);
205        if !self._unknown_fields.is_empty() {
206            debug_struct.field("_unknown_fields", &self._unknown_fields);
207        }
208        debug_struct.finish()
209    }
210}
211
212/// The Data Fusion version. This proto message stores information about certain
213/// Data Fusion version, which is used for Data Fusion version upgrade.
214#[derive(Clone, Default, PartialEq)]
215#[non_exhaustive]
216pub struct Version {
217    /// The version number of the Data Fusion instance, such as '6.0.1.0'.
218    pub version_number: std::string::String,
219
220    /// Whether this is currently the default version for Cloud Data Fusion
221    pub default_version: bool,
222
223    /// Represents a list of available feature names for a given version.
224    pub available_features: std::vec::Vec<std::string::String>,
225
226    /// Type represents the release availability of the version
227    pub r#type: crate::model::version::Type,
228
229    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
230}
231
232impl Version {
233    pub fn new() -> Self {
234        std::default::Default::default()
235    }
236
237    /// Sets the value of [version_number][crate::model::Version::version_number].
238    pub fn set_version_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
239        self.version_number = v.into();
240        self
241    }
242
243    /// Sets the value of [default_version][crate::model::Version::default_version].
244    pub fn set_default_version<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
245        self.default_version = v.into();
246        self
247    }
248
249    /// Sets the value of [available_features][crate::model::Version::available_features].
250    pub fn set_available_features<T, V>(mut self, v: T) -> Self
251    where
252        T: std::iter::IntoIterator<Item = V>,
253        V: std::convert::Into<std::string::String>,
254    {
255        use std::iter::Iterator;
256        self.available_features = v.into_iter().map(|i| i.into()).collect();
257        self
258    }
259
260    /// Sets the value of [r#type][crate::model::Version::type].
261    pub fn set_type<T: std::convert::Into<crate::model::version::Type>>(mut self, v: T) -> Self {
262        self.r#type = v.into();
263        self
264    }
265}
266
267impl wkt::message::Message for Version {
268    fn typename() -> &'static str {
269        "type.googleapis.com/google.cloud.datafusion.v1.Version"
270    }
271}
272
273#[doc(hidden)]
274impl<'de> serde::de::Deserialize<'de> for Version {
275    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
276    where
277        D: serde::Deserializer<'de>,
278    {
279        #[allow(non_camel_case_types)]
280        #[doc(hidden)]
281        #[derive(PartialEq, Eq, Hash)]
282        enum __FieldTag {
283            __version_number,
284            __default_version,
285            __available_features,
286            __type,
287            Unknown(std::string::String),
288        }
289        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
290            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
291            where
292                D: serde::Deserializer<'de>,
293            {
294                struct Visitor;
295                impl<'de> serde::de::Visitor<'de> for Visitor {
296                    type Value = __FieldTag;
297                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
298                        formatter.write_str("a field name for Version")
299                    }
300                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
301                    where
302                        E: serde::de::Error,
303                    {
304                        use std::result::Result::Ok;
305                        use std::string::ToString;
306                        match value {
307                            "versionNumber" => Ok(__FieldTag::__version_number),
308                            "version_number" => Ok(__FieldTag::__version_number),
309                            "defaultVersion" => Ok(__FieldTag::__default_version),
310                            "default_version" => Ok(__FieldTag::__default_version),
311                            "availableFeatures" => Ok(__FieldTag::__available_features),
312                            "available_features" => Ok(__FieldTag::__available_features),
313                            "type" => Ok(__FieldTag::__type),
314                            _ => Ok(__FieldTag::Unknown(value.to_string())),
315                        }
316                    }
317                }
318                deserializer.deserialize_identifier(Visitor)
319            }
320        }
321        struct Visitor;
322        impl<'de> serde::de::Visitor<'de> for Visitor {
323            type Value = Version;
324            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
325                formatter.write_str("struct Version")
326            }
327            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
328            where
329                A: serde::de::MapAccess<'de>,
330            {
331                #[allow(unused_imports)]
332                use serde::de::Error;
333                use std::option::Option::Some;
334                let mut fields = std::collections::HashSet::new();
335                let mut result = Self::Value::new();
336                while let Some(tag) = map.next_key::<__FieldTag>()? {
337                    #[allow(clippy::match_single_binding)]
338                    match tag {
339                        __FieldTag::__version_number => {
340                            if !fields.insert(__FieldTag::__version_number) {
341                                return std::result::Result::Err(A::Error::duplicate_field(
342                                    "multiple values for version_number",
343                                ));
344                            }
345                            result.version_number = map
346                                .next_value::<std::option::Option<std::string::String>>()?
347                                .unwrap_or_default();
348                        }
349                        __FieldTag::__default_version => {
350                            if !fields.insert(__FieldTag::__default_version) {
351                                return std::result::Result::Err(A::Error::duplicate_field(
352                                    "multiple values for default_version",
353                                ));
354                            }
355                            result.default_version = map
356                                .next_value::<std::option::Option<bool>>()?
357                                .unwrap_or_default();
358                        }
359                        __FieldTag::__available_features => {
360                            if !fields.insert(__FieldTag::__available_features) {
361                                return std::result::Result::Err(A::Error::duplicate_field(
362                                    "multiple values for available_features",
363                                ));
364                            }
365                            result.available_features = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
366                        }
367                        __FieldTag::__type => {
368                            if !fields.insert(__FieldTag::__type) {
369                                return std::result::Result::Err(A::Error::duplicate_field(
370                                    "multiple values for type",
371                                ));
372                            }
373                            result.r#type = map
374                                .next_value::<std::option::Option<crate::model::version::Type>>()?
375                                .unwrap_or_default();
376                        }
377                        __FieldTag::Unknown(key) => {
378                            let value = map.next_value::<serde_json::Value>()?;
379                            result._unknown_fields.insert(key, value);
380                        }
381                    }
382                }
383                std::result::Result::Ok(result)
384            }
385        }
386        deserializer.deserialize_any(Visitor)
387    }
388}
389
390#[doc(hidden)]
391impl serde::ser::Serialize for Version {
392    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
393    where
394        S: serde::ser::Serializer,
395    {
396        use serde::ser::SerializeMap;
397        #[allow(unused_imports)]
398        use std::option::Option::Some;
399        let mut state = serializer.serialize_map(std::option::Option::None)?;
400        if !self.version_number.is_empty() {
401            state.serialize_entry("versionNumber", &self.version_number)?;
402        }
403        if !wkt::internal::is_default(&self.default_version) {
404            state.serialize_entry("defaultVersion", &self.default_version)?;
405        }
406        if !self.available_features.is_empty() {
407            state.serialize_entry("availableFeatures", &self.available_features)?;
408        }
409        if !wkt::internal::is_default(&self.r#type) {
410            state.serialize_entry("type", &self.r#type)?;
411        }
412        if !self._unknown_fields.is_empty() {
413            for (key, value) in self._unknown_fields.iter() {
414                state.serialize_entry(key, &value)?;
415            }
416        }
417        state.end()
418    }
419}
420
421impl std::fmt::Debug for Version {
422    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
423        let mut debug_struct = f.debug_struct("Version");
424        debug_struct.field("version_number", &self.version_number);
425        debug_struct.field("default_version", &self.default_version);
426        debug_struct.field("available_features", &self.available_features);
427        debug_struct.field("r#type", &self.r#type);
428        if !self._unknown_fields.is_empty() {
429            debug_struct.field("_unknown_fields", &self._unknown_fields);
430        }
431        debug_struct.finish()
432    }
433}
434
435/// Defines additional types related to [Version].
436pub mod version {
437    #[allow(unused_imports)]
438    use super::*;
439
440    /// Each type represents the release availability of a CDF version
441    ///
442    /// # Working with unknown values
443    ///
444    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
445    /// additional enum variants at any time. Adding new variants is not considered
446    /// a breaking change. Applications should write their code in anticipation of:
447    ///
448    /// - New values appearing in future releases of the client library, **and**
449    /// - New values received dynamically, without application changes.
450    ///
451    /// Please consult the [Working with enums] section in the user guide for some
452    /// guidelines.
453    ///
454    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
455    #[derive(Clone, Debug, PartialEq)]
456    #[non_exhaustive]
457    pub enum Type {
458        /// Version does not have availability yet
459        Unspecified,
460        /// Version is under development and not considered stable
461        Preview,
462        /// Version is available for public use
463        GeneralAvailability,
464        /// If set, the enum was initialized with an unknown value.
465        ///
466        /// Applications can examine the value using [Type::value] or
467        /// [Type::name].
468        UnknownValue(r#type::UnknownValue),
469    }
470
471    #[doc(hidden)]
472    pub mod r#type {
473        #[allow(unused_imports)]
474        use super::*;
475        #[derive(Clone, Debug, PartialEq)]
476        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
477    }
478
479    impl Type {
480        /// Gets the enum value.
481        ///
482        /// Returns `None` if the enum contains an unknown value deserialized from
483        /// the string representation of enums.
484        pub fn value(&self) -> std::option::Option<i32> {
485            match self {
486                Self::Unspecified => std::option::Option::Some(0),
487                Self::Preview => std::option::Option::Some(1),
488                Self::GeneralAvailability => std::option::Option::Some(2),
489                Self::UnknownValue(u) => u.0.value(),
490            }
491        }
492
493        /// Gets the enum value as a string.
494        ///
495        /// Returns `None` if the enum contains an unknown value deserialized from
496        /// the integer representation of enums.
497        pub fn name(&self) -> std::option::Option<&str> {
498            match self {
499                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
500                Self::Preview => std::option::Option::Some("TYPE_PREVIEW"),
501                Self::GeneralAvailability => std::option::Option::Some("TYPE_GENERAL_AVAILABILITY"),
502                Self::UnknownValue(u) => u.0.name(),
503            }
504        }
505    }
506
507    impl std::default::Default for Type {
508        fn default() -> Self {
509            use std::convert::From;
510            Self::from(0)
511        }
512    }
513
514    impl std::fmt::Display for Type {
515        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
516            wkt::internal::display_enum(f, self.name(), self.value())
517        }
518    }
519
520    impl std::convert::From<i32> for Type {
521        fn from(value: i32) -> Self {
522            match value {
523                0 => Self::Unspecified,
524                1 => Self::Preview,
525                2 => Self::GeneralAvailability,
526                _ => Self::UnknownValue(r#type::UnknownValue(
527                    wkt::internal::UnknownEnumValue::Integer(value),
528                )),
529            }
530        }
531    }
532
533    impl std::convert::From<&str> for Type {
534        fn from(value: &str) -> Self {
535            use std::string::ToString;
536            match value {
537                "TYPE_UNSPECIFIED" => Self::Unspecified,
538                "TYPE_PREVIEW" => Self::Preview,
539                "TYPE_GENERAL_AVAILABILITY" => Self::GeneralAvailability,
540                _ => Self::UnknownValue(r#type::UnknownValue(
541                    wkt::internal::UnknownEnumValue::String(value.to_string()),
542                )),
543            }
544        }
545    }
546
547    impl serde::ser::Serialize for Type {
548        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
549        where
550            S: serde::Serializer,
551        {
552            match self {
553                Self::Unspecified => serializer.serialize_i32(0),
554                Self::Preview => serializer.serialize_i32(1),
555                Self::GeneralAvailability => serializer.serialize_i32(2),
556                Self::UnknownValue(u) => u.0.serialize(serializer),
557            }
558        }
559    }
560
561    impl<'de> serde::de::Deserialize<'de> for Type {
562        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
563        where
564            D: serde::Deserializer<'de>,
565        {
566            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
567                ".google.cloud.datafusion.v1.Version.Type",
568            ))
569        }
570    }
571}
572
573/// Identifies Data Fusion accelerators for an instance.
574#[derive(Clone, Default, PartialEq)]
575#[non_exhaustive]
576pub struct Accelerator {
577    /// The type of an accelator for a CDF instance.
578    pub accelerator_type: crate::model::accelerator::AcceleratorType,
579
580    /// The state of the accelerator
581    pub state: crate::model::accelerator::State,
582
583    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
584}
585
586impl Accelerator {
587    pub fn new() -> Self {
588        std::default::Default::default()
589    }
590
591    /// Sets the value of [accelerator_type][crate::model::Accelerator::accelerator_type].
592    pub fn set_accelerator_type<
593        T: std::convert::Into<crate::model::accelerator::AcceleratorType>,
594    >(
595        mut self,
596        v: T,
597    ) -> Self {
598        self.accelerator_type = v.into();
599        self
600    }
601
602    /// Sets the value of [state][crate::model::Accelerator::state].
603    pub fn set_state<T: std::convert::Into<crate::model::accelerator::State>>(
604        mut self,
605        v: T,
606    ) -> Self {
607        self.state = v.into();
608        self
609    }
610}
611
612impl wkt::message::Message for Accelerator {
613    fn typename() -> &'static str {
614        "type.googleapis.com/google.cloud.datafusion.v1.Accelerator"
615    }
616}
617
618#[doc(hidden)]
619impl<'de> serde::de::Deserialize<'de> for Accelerator {
620    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
621    where
622        D: serde::Deserializer<'de>,
623    {
624        #[allow(non_camel_case_types)]
625        #[doc(hidden)]
626        #[derive(PartialEq, Eq, Hash)]
627        enum __FieldTag {
628            __accelerator_type,
629            __state,
630            Unknown(std::string::String),
631        }
632        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
633            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
634            where
635                D: serde::Deserializer<'de>,
636            {
637                struct Visitor;
638                impl<'de> serde::de::Visitor<'de> for Visitor {
639                    type Value = __FieldTag;
640                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
641                        formatter.write_str("a field name for Accelerator")
642                    }
643                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
644                    where
645                        E: serde::de::Error,
646                    {
647                        use std::result::Result::Ok;
648                        use std::string::ToString;
649                        match value {
650                            "acceleratorType" => Ok(__FieldTag::__accelerator_type),
651                            "accelerator_type" => Ok(__FieldTag::__accelerator_type),
652                            "state" => Ok(__FieldTag::__state),
653                            _ => Ok(__FieldTag::Unknown(value.to_string())),
654                        }
655                    }
656                }
657                deserializer.deserialize_identifier(Visitor)
658            }
659        }
660        struct Visitor;
661        impl<'de> serde::de::Visitor<'de> for Visitor {
662            type Value = Accelerator;
663            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
664                formatter.write_str("struct Accelerator")
665            }
666            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
667            where
668                A: serde::de::MapAccess<'de>,
669            {
670                #[allow(unused_imports)]
671                use serde::de::Error;
672                use std::option::Option::Some;
673                let mut fields = std::collections::HashSet::new();
674                let mut result = Self::Value::new();
675                while let Some(tag) = map.next_key::<__FieldTag>()? {
676                    #[allow(clippy::match_single_binding)]
677                    match tag {
678                        __FieldTag::__accelerator_type => {
679                            if !fields.insert(__FieldTag::__accelerator_type) {
680                                return std::result::Result::Err(A::Error::duplicate_field(
681                                    "multiple values for accelerator_type",
682                                ));
683                            }
684                            result.accelerator_type = map.next_value::<std::option::Option<crate::model::accelerator::AcceleratorType>>()?.unwrap_or_default();
685                        }
686                        __FieldTag::__state => {
687                            if !fields.insert(__FieldTag::__state) {
688                                return std::result::Result::Err(A::Error::duplicate_field(
689                                    "multiple values for state",
690                                ));
691                            }
692                            result.state = map.next_value::<std::option::Option<crate::model::accelerator::State>>()?.unwrap_or_default();
693                        }
694                        __FieldTag::Unknown(key) => {
695                            let value = map.next_value::<serde_json::Value>()?;
696                            result._unknown_fields.insert(key, value);
697                        }
698                    }
699                }
700                std::result::Result::Ok(result)
701            }
702        }
703        deserializer.deserialize_any(Visitor)
704    }
705}
706
707#[doc(hidden)]
708impl serde::ser::Serialize for Accelerator {
709    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
710    where
711        S: serde::ser::Serializer,
712    {
713        use serde::ser::SerializeMap;
714        #[allow(unused_imports)]
715        use std::option::Option::Some;
716        let mut state = serializer.serialize_map(std::option::Option::None)?;
717        if !wkt::internal::is_default(&self.accelerator_type) {
718            state.serialize_entry("acceleratorType", &self.accelerator_type)?;
719        }
720        if !wkt::internal::is_default(&self.state) {
721            state.serialize_entry("state", &self.state)?;
722        }
723        if !self._unknown_fields.is_empty() {
724            for (key, value) in self._unknown_fields.iter() {
725                state.serialize_entry(key, &value)?;
726            }
727        }
728        state.end()
729    }
730}
731
732impl std::fmt::Debug for Accelerator {
733    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
734        let mut debug_struct = f.debug_struct("Accelerator");
735        debug_struct.field("accelerator_type", &self.accelerator_type);
736        debug_struct.field("state", &self.state);
737        if !self._unknown_fields.is_empty() {
738            debug_struct.field("_unknown_fields", &self._unknown_fields);
739        }
740        debug_struct.finish()
741    }
742}
743
744/// Defines additional types related to [Accelerator].
745pub mod accelerator {
746    #[allow(unused_imports)]
747    use super::*;
748
749    /// Each type represents an Accelerator (Add-On) supported by Cloud Data Fusion
750    /// service.
751    ///
752    /// # Working with unknown values
753    ///
754    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
755    /// additional enum variants at any time. Adding new variants is not considered
756    /// a breaking change. Applications should write their code in anticipation of:
757    ///
758    /// - New values appearing in future releases of the client library, **and**
759    /// - New values received dynamically, without application changes.
760    ///
761    /// Please consult the [Working with enums] section in the user guide for some
762    /// guidelines.
763    ///
764    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
765    #[derive(Clone, Debug, PartialEq)]
766    #[non_exhaustive]
767    pub enum AcceleratorType {
768        /// Default value, if unspecified.
769        Unspecified,
770        /// Change Data Capture accelerator for CDF.
771        Cdc,
772        /// Cloud Healthcare accelerator for CDF. This accelerator is to enable Cloud
773        /// Healthcare specific CDF plugins developed by Healthcare team.
774        Healthcare,
775        /// Contact Center AI Insights
776        /// This accelerator is used to enable import and export pipelines
777        /// custom built to streamline CCAI Insights processing.
778        CcaiInsights,
779        /// If set, the enum was initialized with an unknown value.
780        ///
781        /// Applications can examine the value using [AcceleratorType::value] or
782        /// [AcceleratorType::name].
783        UnknownValue(accelerator_type::UnknownValue),
784    }
785
786    #[doc(hidden)]
787    pub mod accelerator_type {
788        #[allow(unused_imports)]
789        use super::*;
790        #[derive(Clone, Debug, PartialEq)]
791        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
792    }
793
794    impl AcceleratorType {
795        /// Gets the enum value.
796        ///
797        /// Returns `None` if the enum contains an unknown value deserialized from
798        /// the string representation of enums.
799        pub fn value(&self) -> std::option::Option<i32> {
800            match self {
801                Self::Unspecified => std::option::Option::Some(0),
802                Self::Cdc => std::option::Option::Some(1),
803                Self::Healthcare => std::option::Option::Some(2),
804                Self::CcaiInsights => std::option::Option::Some(3),
805                Self::UnknownValue(u) => u.0.value(),
806            }
807        }
808
809        /// Gets the enum value as a string.
810        ///
811        /// Returns `None` if the enum contains an unknown value deserialized from
812        /// the integer representation of enums.
813        pub fn name(&self) -> std::option::Option<&str> {
814            match self {
815                Self::Unspecified => std::option::Option::Some("ACCELERATOR_TYPE_UNSPECIFIED"),
816                Self::Cdc => std::option::Option::Some("CDC"),
817                Self::Healthcare => std::option::Option::Some("HEALTHCARE"),
818                Self::CcaiInsights => std::option::Option::Some("CCAI_INSIGHTS"),
819                Self::UnknownValue(u) => u.0.name(),
820            }
821        }
822    }
823
824    impl std::default::Default for AcceleratorType {
825        fn default() -> Self {
826            use std::convert::From;
827            Self::from(0)
828        }
829    }
830
831    impl std::fmt::Display for AcceleratorType {
832        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
833            wkt::internal::display_enum(f, self.name(), self.value())
834        }
835    }
836
837    impl std::convert::From<i32> for AcceleratorType {
838        fn from(value: i32) -> Self {
839            match value {
840                0 => Self::Unspecified,
841                1 => Self::Cdc,
842                2 => Self::Healthcare,
843                3 => Self::CcaiInsights,
844                _ => Self::UnknownValue(accelerator_type::UnknownValue(
845                    wkt::internal::UnknownEnumValue::Integer(value),
846                )),
847            }
848        }
849    }
850
851    impl std::convert::From<&str> for AcceleratorType {
852        fn from(value: &str) -> Self {
853            use std::string::ToString;
854            match value {
855                "ACCELERATOR_TYPE_UNSPECIFIED" => Self::Unspecified,
856                "CDC" => Self::Cdc,
857                "HEALTHCARE" => Self::Healthcare,
858                "CCAI_INSIGHTS" => Self::CcaiInsights,
859                _ => Self::UnknownValue(accelerator_type::UnknownValue(
860                    wkt::internal::UnknownEnumValue::String(value.to_string()),
861                )),
862            }
863        }
864    }
865
866    impl serde::ser::Serialize for AcceleratorType {
867        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
868        where
869            S: serde::Serializer,
870        {
871            match self {
872                Self::Unspecified => serializer.serialize_i32(0),
873                Self::Cdc => serializer.serialize_i32(1),
874                Self::Healthcare => serializer.serialize_i32(2),
875                Self::CcaiInsights => serializer.serialize_i32(3),
876                Self::UnknownValue(u) => u.0.serialize(serializer),
877            }
878        }
879    }
880
881    impl<'de> serde::de::Deserialize<'de> for AcceleratorType {
882        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
883        where
884            D: serde::Deserializer<'de>,
885        {
886            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AcceleratorType>::new(
887                ".google.cloud.datafusion.v1.Accelerator.AcceleratorType",
888            ))
889        }
890    }
891
892    /// Different values possible for the state of an accelerator
893    ///
894    /// # Working with unknown values
895    ///
896    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
897    /// additional enum variants at any time. Adding new variants is not considered
898    /// a breaking change. Applications should write their code in anticipation of:
899    ///
900    /// - New values appearing in future releases of the client library, **and**
901    /// - New values received dynamically, without application changes.
902    ///
903    /// Please consult the [Working with enums] section in the user guide for some
904    /// guidelines.
905    ///
906    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
907    #[derive(Clone, Debug, PartialEq)]
908    #[non_exhaustive]
909    pub enum State {
910        /// Default value, do not use
911        Unspecified,
912        /// Indicates that the accelerator is enabled and available to use
913        Enabled,
914        /// Indicates that the accelerator is disabled and not available to use
915        Disabled,
916        /// Indicates that accelerator state is currently unknown.
917        /// Requests for enable, disable could be retried while in this state
918        Unknown,
919        /// If set, the enum was initialized with an unknown value.
920        ///
921        /// Applications can examine the value using [State::value] or
922        /// [State::name].
923        UnknownValue(state::UnknownValue),
924    }
925
926    #[doc(hidden)]
927    pub mod state {
928        #[allow(unused_imports)]
929        use super::*;
930        #[derive(Clone, Debug, PartialEq)]
931        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
932    }
933
934    impl State {
935        /// Gets the enum value.
936        ///
937        /// Returns `None` if the enum contains an unknown value deserialized from
938        /// the string representation of enums.
939        pub fn value(&self) -> std::option::Option<i32> {
940            match self {
941                Self::Unspecified => std::option::Option::Some(0),
942                Self::Enabled => std::option::Option::Some(1),
943                Self::Disabled => std::option::Option::Some(2),
944                Self::Unknown => std::option::Option::Some(3),
945                Self::UnknownValue(u) => u.0.value(),
946            }
947        }
948
949        /// Gets the enum value as a string.
950        ///
951        /// Returns `None` if the enum contains an unknown value deserialized from
952        /// the integer representation of enums.
953        pub fn name(&self) -> std::option::Option<&str> {
954            match self {
955                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
956                Self::Enabled => std::option::Option::Some("ENABLED"),
957                Self::Disabled => std::option::Option::Some("DISABLED"),
958                Self::Unknown => std::option::Option::Some("UNKNOWN"),
959                Self::UnknownValue(u) => u.0.name(),
960            }
961        }
962    }
963
964    impl std::default::Default for State {
965        fn default() -> Self {
966            use std::convert::From;
967            Self::from(0)
968        }
969    }
970
971    impl std::fmt::Display for State {
972        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
973            wkt::internal::display_enum(f, self.name(), self.value())
974        }
975    }
976
977    impl std::convert::From<i32> for State {
978        fn from(value: i32) -> Self {
979            match value {
980                0 => Self::Unspecified,
981                1 => Self::Enabled,
982                2 => Self::Disabled,
983                3 => Self::Unknown,
984                _ => Self::UnknownValue(state::UnknownValue(
985                    wkt::internal::UnknownEnumValue::Integer(value),
986                )),
987            }
988        }
989    }
990
991    impl std::convert::From<&str> for State {
992        fn from(value: &str) -> Self {
993            use std::string::ToString;
994            match value {
995                "STATE_UNSPECIFIED" => Self::Unspecified,
996                "ENABLED" => Self::Enabled,
997                "DISABLED" => Self::Disabled,
998                "UNKNOWN" => Self::Unknown,
999                _ => Self::UnknownValue(state::UnknownValue(
1000                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1001                )),
1002            }
1003        }
1004    }
1005
1006    impl serde::ser::Serialize for State {
1007        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1008        where
1009            S: serde::Serializer,
1010        {
1011            match self {
1012                Self::Unspecified => serializer.serialize_i32(0),
1013                Self::Enabled => serializer.serialize_i32(1),
1014                Self::Disabled => serializer.serialize_i32(2),
1015                Self::Unknown => serializer.serialize_i32(3),
1016                Self::UnknownValue(u) => u.0.serialize(serializer),
1017            }
1018        }
1019    }
1020
1021    impl<'de> serde::de::Deserialize<'de> for State {
1022        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1023        where
1024            D: serde::Deserializer<'de>,
1025        {
1026            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1027                ".google.cloud.datafusion.v1.Accelerator.State",
1028            ))
1029        }
1030    }
1031}
1032
1033/// The crypto key configuration. This field is used by the Customer-managed
1034/// encryption keys (CMEK) feature.
1035#[derive(Clone, Default, PartialEq)]
1036#[non_exhaustive]
1037pub struct CryptoKeyConfig {
1038    /// The name of the key which is used to encrypt/decrypt customer data. For key
1039    /// in Cloud KMS, the key should be in the format of
1040    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
1041    pub key_reference: std::string::String,
1042
1043    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1044}
1045
1046impl CryptoKeyConfig {
1047    pub fn new() -> Self {
1048        std::default::Default::default()
1049    }
1050
1051    /// Sets the value of [key_reference][crate::model::CryptoKeyConfig::key_reference].
1052    pub fn set_key_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1053        self.key_reference = v.into();
1054        self
1055    }
1056}
1057
1058impl wkt::message::Message for CryptoKeyConfig {
1059    fn typename() -> &'static str {
1060        "type.googleapis.com/google.cloud.datafusion.v1.CryptoKeyConfig"
1061    }
1062}
1063
1064#[doc(hidden)]
1065impl<'de> serde::de::Deserialize<'de> for CryptoKeyConfig {
1066    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1067    where
1068        D: serde::Deserializer<'de>,
1069    {
1070        #[allow(non_camel_case_types)]
1071        #[doc(hidden)]
1072        #[derive(PartialEq, Eq, Hash)]
1073        enum __FieldTag {
1074            __key_reference,
1075            Unknown(std::string::String),
1076        }
1077        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1078            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1079            where
1080                D: serde::Deserializer<'de>,
1081            {
1082                struct Visitor;
1083                impl<'de> serde::de::Visitor<'de> for Visitor {
1084                    type Value = __FieldTag;
1085                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1086                        formatter.write_str("a field name for CryptoKeyConfig")
1087                    }
1088                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1089                    where
1090                        E: serde::de::Error,
1091                    {
1092                        use std::result::Result::Ok;
1093                        use std::string::ToString;
1094                        match value {
1095                            "keyReference" => Ok(__FieldTag::__key_reference),
1096                            "key_reference" => Ok(__FieldTag::__key_reference),
1097                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1098                        }
1099                    }
1100                }
1101                deserializer.deserialize_identifier(Visitor)
1102            }
1103        }
1104        struct Visitor;
1105        impl<'de> serde::de::Visitor<'de> for Visitor {
1106            type Value = CryptoKeyConfig;
1107            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1108                formatter.write_str("struct CryptoKeyConfig")
1109            }
1110            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1111            where
1112                A: serde::de::MapAccess<'de>,
1113            {
1114                #[allow(unused_imports)]
1115                use serde::de::Error;
1116                use std::option::Option::Some;
1117                let mut fields = std::collections::HashSet::new();
1118                let mut result = Self::Value::new();
1119                while let Some(tag) = map.next_key::<__FieldTag>()? {
1120                    #[allow(clippy::match_single_binding)]
1121                    match tag {
1122                        __FieldTag::__key_reference => {
1123                            if !fields.insert(__FieldTag::__key_reference) {
1124                                return std::result::Result::Err(A::Error::duplicate_field(
1125                                    "multiple values for key_reference",
1126                                ));
1127                            }
1128                            result.key_reference = map
1129                                .next_value::<std::option::Option<std::string::String>>()?
1130                                .unwrap_or_default();
1131                        }
1132                        __FieldTag::Unknown(key) => {
1133                            let value = map.next_value::<serde_json::Value>()?;
1134                            result._unknown_fields.insert(key, value);
1135                        }
1136                    }
1137                }
1138                std::result::Result::Ok(result)
1139            }
1140        }
1141        deserializer.deserialize_any(Visitor)
1142    }
1143}
1144
1145#[doc(hidden)]
1146impl serde::ser::Serialize for CryptoKeyConfig {
1147    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1148    where
1149        S: serde::ser::Serializer,
1150    {
1151        use serde::ser::SerializeMap;
1152        #[allow(unused_imports)]
1153        use std::option::Option::Some;
1154        let mut state = serializer.serialize_map(std::option::Option::None)?;
1155        if !self.key_reference.is_empty() {
1156            state.serialize_entry("keyReference", &self.key_reference)?;
1157        }
1158        if !self._unknown_fields.is_empty() {
1159            for (key, value) in self._unknown_fields.iter() {
1160                state.serialize_entry(key, &value)?;
1161            }
1162        }
1163        state.end()
1164    }
1165}
1166
1167impl std::fmt::Debug for CryptoKeyConfig {
1168    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1169        let mut debug_struct = f.debug_struct("CryptoKeyConfig");
1170        debug_struct.field("key_reference", &self.key_reference);
1171        if !self._unknown_fields.is_empty() {
1172            debug_struct.field("_unknown_fields", &self._unknown_fields);
1173        }
1174        debug_struct.finish()
1175    }
1176}
1177
1178/// Represents a Data Fusion instance.
1179#[derive(Clone, Default, PartialEq)]
1180#[non_exhaustive]
1181pub struct Instance {
1182    /// Output only. The name of this instance is in the form of
1183    /// projects/{project}/locations/{location}/instances/{instance}.
1184    pub name: std::string::String,
1185
1186    /// A description of this instance.
1187    pub description: std::string::String,
1188
1189    /// Required. Instance type.
1190    pub r#type: crate::model::instance::Type,
1191
1192    /// Option to enable Stackdriver Logging.
1193    pub enable_stackdriver_logging: bool,
1194
1195    /// Option to enable Stackdriver Monitoring.
1196    pub enable_stackdriver_monitoring: bool,
1197
1198    /// Specifies whether the Data Fusion instance should be private. If set to
1199    /// true, all Data Fusion nodes will have private IP addresses and will not be
1200    /// able to access the public internet.
1201    pub private_instance: bool,
1202
1203    /// Network configuration options. These are required when a private Data
1204    /// Fusion instance is to be created.
1205    pub network_config: std::option::Option<crate::model::NetworkConfig>,
1206
1207    /// The resource labels for instance to use to annotate any related underlying
1208    /// resources such as Compute Engine VMs. The character '=' is not allowed to
1209    /// be used within the labels.
1210    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1211
1212    /// Map of additional options used to configure the behavior of
1213    /// Data Fusion instance.
1214    pub options: std::collections::HashMap<std::string::String, std::string::String>,
1215
1216    /// Output only. The time the instance was created.
1217    pub create_time: std::option::Option<wkt::Timestamp>,
1218
1219    /// Output only. The time the instance was last updated.
1220    pub update_time: std::option::Option<wkt::Timestamp>,
1221
1222    /// Output only. The current state of this Data Fusion instance.
1223    pub state: crate::model::instance::State,
1224
1225    /// Output only. Additional information about the current state of this Data
1226    /// Fusion instance if available.
1227    pub state_message: std::string::String,
1228
1229    /// Output only. Endpoint on which the Data Fusion UI is accessible.
1230    pub service_endpoint: std::string::String,
1231
1232    /// Name of the zone in which the Data Fusion instance will be created. Only
1233    /// DEVELOPER instances use this field.
1234    pub zone: std::string::String,
1235
1236    /// Current version of the Data Fusion. Only specifiable in Update.
1237    pub version: std::string::String,
1238
1239    /// Output only. Deprecated. Use tenant_project_id instead to extract the tenant project ID.
1240    #[deprecated]
1241    pub service_account: std::string::String,
1242
1243    /// Display name for an instance.
1244    pub display_name: std::string::String,
1245
1246    /// Available versions that the instance can be upgraded to using
1247    /// UpdateInstanceRequest.
1248    pub available_version: std::vec::Vec<crate::model::Version>,
1249
1250    /// Output only. Endpoint on which the REST APIs is accessible.
1251    pub api_endpoint: std::string::String,
1252
1253    /// Output only. Cloud Storage bucket generated by Data Fusion in the customer project.
1254    pub gcs_bucket: std::string::String,
1255
1256    /// List of accelerators enabled for this CDF instance.
1257    pub accelerators: std::vec::Vec<crate::model::Accelerator>,
1258
1259    /// Output only. P4 service account for the customer project.
1260    pub p4_service_account: std::string::String,
1261
1262    /// Output only. The name of the tenant project.
1263    pub tenant_project_id: std::string::String,
1264
1265    /// User-managed service account to set on Dataproc when Cloud Data Fusion
1266    /// creates Dataproc to run data processing pipelines.
1267    ///
1268    /// This allows users to have fine-grained access control on Dataproc's
1269    /// accesses to cloud resources.
1270    pub dataproc_service_account: std::string::String,
1271
1272    /// Option to enable granular role-based access control.
1273    pub enable_rbac: bool,
1274
1275    /// The crypto key configuration. This field is used by the Customer-Managed
1276    /// Encryption Keys (CMEK) feature.
1277    pub crypto_key_config: std::option::Option<crate::model::CryptoKeyConfig>,
1278
1279    /// Output only. If the instance state is DISABLED, the reason for disabling the instance.
1280    pub disabled_reason: std::vec::Vec<crate::model::instance::DisabledReason>,
1281
1282    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1283}
1284
1285impl Instance {
1286    pub fn new() -> Self {
1287        std::default::Default::default()
1288    }
1289
1290    /// Sets the value of [name][crate::model::Instance::name].
1291    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1292        self.name = v.into();
1293        self
1294    }
1295
1296    /// Sets the value of [description][crate::model::Instance::description].
1297    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1298        self.description = v.into();
1299        self
1300    }
1301
1302    /// Sets the value of [r#type][crate::model::Instance::type].
1303    pub fn set_type<T: std::convert::Into<crate::model::instance::Type>>(mut self, v: T) -> Self {
1304        self.r#type = v.into();
1305        self
1306    }
1307
1308    /// Sets the value of [enable_stackdriver_logging][crate::model::Instance::enable_stackdriver_logging].
1309    pub fn set_enable_stackdriver_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1310        self.enable_stackdriver_logging = v.into();
1311        self
1312    }
1313
1314    /// Sets the value of [enable_stackdriver_monitoring][crate::model::Instance::enable_stackdriver_monitoring].
1315    pub fn set_enable_stackdriver_monitoring<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1316        self.enable_stackdriver_monitoring = v.into();
1317        self
1318    }
1319
1320    /// Sets the value of [private_instance][crate::model::Instance::private_instance].
1321    pub fn set_private_instance<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1322        self.private_instance = v.into();
1323        self
1324    }
1325
1326    /// Sets the value of [network_config][crate::model::Instance::network_config].
1327    pub fn set_network_config<T>(mut self, v: T) -> Self
1328    where
1329        T: std::convert::Into<crate::model::NetworkConfig>,
1330    {
1331        self.network_config = std::option::Option::Some(v.into());
1332        self
1333    }
1334
1335    /// Sets or clears the value of [network_config][crate::model::Instance::network_config].
1336    pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
1337    where
1338        T: std::convert::Into<crate::model::NetworkConfig>,
1339    {
1340        self.network_config = v.map(|x| x.into());
1341        self
1342    }
1343
1344    /// Sets the value of [labels][crate::model::Instance::labels].
1345    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1346    where
1347        T: std::iter::IntoIterator<Item = (K, V)>,
1348        K: std::convert::Into<std::string::String>,
1349        V: std::convert::Into<std::string::String>,
1350    {
1351        use std::iter::Iterator;
1352        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1353        self
1354    }
1355
1356    /// Sets the value of [options][crate::model::Instance::options].
1357    pub fn set_options<T, K, V>(mut self, v: T) -> Self
1358    where
1359        T: std::iter::IntoIterator<Item = (K, V)>,
1360        K: std::convert::Into<std::string::String>,
1361        V: std::convert::Into<std::string::String>,
1362    {
1363        use std::iter::Iterator;
1364        self.options = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1365        self
1366    }
1367
1368    /// Sets the value of [create_time][crate::model::Instance::create_time].
1369    pub fn set_create_time<T>(mut self, v: T) -> Self
1370    where
1371        T: std::convert::Into<wkt::Timestamp>,
1372    {
1373        self.create_time = std::option::Option::Some(v.into());
1374        self
1375    }
1376
1377    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
1378    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1379    where
1380        T: std::convert::Into<wkt::Timestamp>,
1381    {
1382        self.create_time = v.map(|x| x.into());
1383        self
1384    }
1385
1386    /// Sets the value of [update_time][crate::model::Instance::update_time].
1387    pub fn set_update_time<T>(mut self, v: T) -> Self
1388    where
1389        T: std::convert::Into<wkt::Timestamp>,
1390    {
1391        self.update_time = std::option::Option::Some(v.into());
1392        self
1393    }
1394
1395    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
1396    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1397    where
1398        T: std::convert::Into<wkt::Timestamp>,
1399    {
1400        self.update_time = v.map(|x| x.into());
1401        self
1402    }
1403
1404    /// Sets the value of [state][crate::model::Instance::state].
1405    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
1406        self.state = v.into();
1407        self
1408    }
1409
1410    /// Sets the value of [state_message][crate::model::Instance::state_message].
1411    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1412        self.state_message = v.into();
1413        self
1414    }
1415
1416    /// Sets the value of [service_endpoint][crate::model::Instance::service_endpoint].
1417    pub fn set_service_endpoint<T: std::convert::Into<std::string::String>>(
1418        mut self,
1419        v: T,
1420    ) -> Self {
1421        self.service_endpoint = v.into();
1422        self
1423    }
1424
1425    /// Sets the value of [zone][crate::model::Instance::zone].
1426    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1427        self.zone = v.into();
1428        self
1429    }
1430
1431    /// Sets the value of [version][crate::model::Instance::version].
1432    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1433        self.version = v.into();
1434        self
1435    }
1436
1437    /// Sets the value of [service_account][crate::model::Instance::service_account].
1438    #[deprecated]
1439    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1440        self.service_account = v.into();
1441        self
1442    }
1443
1444    /// Sets the value of [display_name][crate::model::Instance::display_name].
1445    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1446        self.display_name = v.into();
1447        self
1448    }
1449
1450    /// Sets the value of [available_version][crate::model::Instance::available_version].
1451    pub fn set_available_version<T, V>(mut self, v: T) -> Self
1452    where
1453        T: std::iter::IntoIterator<Item = V>,
1454        V: std::convert::Into<crate::model::Version>,
1455    {
1456        use std::iter::Iterator;
1457        self.available_version = v.into_iter().map(|i| i.into()).collect();
1458        self
1459    }
1460
1461    /// Sets the value of [api_endpoint][crate::model::Instance::api_endpoint].
1462    pub fn set_api_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1463        self.api_endpoint = v.into();
1464        self
1465    }
1466
1467    /// Sets the value of [gcs_bucket][crate::model::Instance::gcs_bucket].
1468    pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1469        self.gcs_bucket = v.into();
1470        self
1471    }
1472
1473    /// Sets the value of [accelerators][crate::model::Instance::accelerators].
1474    pub fn set_accelerators<T, V>(mut self, v: T) -> Self
1475    where
1476        T: std::iter::IntoIterator<Item = V>,
1477        V: std::convert::Into<crate::model::Accelerator>,
1478    {
1479        use std::iter::Iterator;
1480        self.accelerators = v.into_iter().map(|i| i.into()).collect();
1481        self
1482    }
1483
1484    /// Sets the value of [p4_service_account][crate::model::Instance::p4_service_account].
1485    pub fn set_p4_service_account<T: std::convert::Into<std::string::String>>(
1486        mut self,
1487        v: T,
1488    ) -> Self {
1489        self.p4_service_account = v.into();
1490        self
1491    }
1492
1493    /// Sets the value of [tenant_project_id][crate::model::Instance::tenant_project_id].
1494    pub fn set_tenant_project_id<T: std::convert::Into<std::string::String>>(
1495        mut self,
1496        v: T,
1497    ) -> Self {
1498        self.tenant_project_id = v.into();
1499        self
1500    }
1501
1502    /// Sets the value of [dataproc_service_account][crate::model::Instance::dataproc_service_account].
1503    pub fn set_dataproc_service_account<T: std::convert::Into<std::string::String>>(
1504        mut self,
1505        v: T,
1506    ) -> Self {
1507        self.dataproc_service_account = v.into();
1508        self
1509    }
1510
1511    /// Sets the value of [enable_rbac][crate::model::Instance::enable_rbac].
1512    pub fn set_enable_rbac<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1513        self.enable_rbac = v.into();
1514        self
1515    }
1516
1517    /// Sets the value of [crypto_key_config][crate::model::Instance::crypto_key_config].
1518    pub fn set_crypto_key_config<T>(mut self, v: T) -> Self
1519    where
1520        T: std::convert::Into<crate::model::CryptoKeyConfig>,
1521    {
1522        self.crypto_key_config = std::option::Option::Some(v.into());
1523        self
1524    }
1525
1526    /// Sets or clears the value of [crypto_key_config][crate::model::Instance::crypto_key_config].
1527    pub fn set_or_clear_crypto_key_config<T>(mut self, v: std::option::Option<T>) -> Self
1528    where
1529        T: std::convert::Into<crate::model::CryptoKeyConfig>,
1530    {
1531        self.crypto_key_config = v.map(|x| x.into());
1532        self
1533    }
1534
1535    /// Sets the value of [disabled_reason][crate::model::Instance::disabled_reason].
1536    pub fn set_disabled_reason<T, V>(mut self, v: T) -> Self
1537    where
1538        T: std::iter::IntoIterator<Item = V>,
1539        V: std::convert::Into<crate::model::instance::DisabledReason>,
1540    {
1541        use std::iter::Iterator;
1542        self.disabled_reason = v.into_iter().map(|i| i.into()).collect();
1543        self
1544    }
1545}
1546
1547impl wkt::message::Message for Instance {
1548    fn typename() -> &'static str {
1549        "type.googleapis.com/google.cloud.datafusion.v1.Instance"
1550    }
1551}
1552
1553#[doc(hidden)]
1554impl<'de> serde::de::Deserialize<'de> for Instance {
1555    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1556    where
1557        D: serde::Deserializer<'de>,
1558    {
1559        #[allow(non_camel_case_types)]
1560        #[doc(hidden)]
1561        #[derive(PartialEq, Eq, Hash)]
1562        enum __FieldTag {
1563            __name,
1564            __description,
1565            __type,
1566            __enable_stackdriver_logging,
1567            __enable_stackdriver_monitoring,
1568            __private_instance,
1569            __network_config,
1570            __labels,
1571            __options,
1572            __create_time,
1573            __update_time,
1574            __state,
1575            __state_message,
1576            __service_endpoint,
1577            __zone,
1578            __version,
1579            __service_account,
1580            __display_name,
1581            __available_version,
1582            __api_endpoint,
1583            __gcs_bucket,
1584            __accelerators,
1585            __p4_service_account,
1586            __tenant_project_id,
1587            __dataproc_service_account,
1588            __enable_rbac,
1589            __crypto_key_config,
1590            __disabled_reason,
1591            Unknown(std::string::String),
1592        }
1593        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1594            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1595            where
1596                D: serde::Deserializer<'de>,
1597            {
1598                struct Visitor;
1599                impl<'de> serde::de::Visitor<'de> for Visitor {
1600                    type Value = __FieldTag;
1601                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1602                        formatter.write_str("a field name for Instance")
1603                    }
1604                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1605                    where
1606                        E: serde::de::Error,
1607                    {
1608                        use std::result::Result::Ok;
1609                        use std::string::ToString;
1610                        match value {
1611                            "name" => Ok(__FieldTag::__name),
1612                            "description" => Ok(__FieldTag::__description),
1613                            "type" => Ok(__FieldTag::__type),
1614                            "enableStackdriverLogging" => {
1615                                Ok(__FieldTag::__enable_stackdriver_logging)
1616                            }
1617                            "enable_stackdriver_logging" => {
1618                                Ok(__FieldTag::__enable_stackdriver_logging)
1619                            }
1620                            "enableStackdriverMonitoring" => {
1621                                Ok(__FieldTag::__enable_stackdriver_monitoring)
1622                            }
1623                            "enable_stackdriver_monitoring" => {
1624                                Ok(__FieldTag::__enable_stackdriver_monitoring)
1625                            }
1626                            "privateInstance" => Ok(__FieldTag::__private_instance),
1627                            "private_instance" => Ok(__FieldTag::__private_instance),
1628                            "networkConfig" => Ok(__FieldTag::__network_config),
1629                            "network_config" => Ok(__FieldTag::__network_config),
1630                            "labels" => Ok(__FieldTag::__labels),
1631                            "options" => Ok(__FieldTag::__options),
1632                            "createTime" => Ok(__FieldTag::__create_time),
1633                            "create_time" => Ok(__FieldTag::__create_time),
1634                            "updateTime" => Ok(__FieldTag::__update_time),
1635                            "update_time" => Ok(__FieldTag::__update_time),
1636                            "state" => Ok(__FieldTag::__state),
1637                            "stateMessage" => Ok(__FieldTag::__state_message),
1638                            "state_message" => Ok(__FieldTag::__state_message),
1639                            "serviceEndpoint" => Ok(__FieldTag::__service_endpoint),
1640                            "service_endpoint" => Ok(__FieldTag::__service_endpoint),
1641                            "zone" => Ok(__FieldTag::__zone),
1642                            "version" => Ok(__FieldTag::__version),
1643                            "serviceAccount" => Ok(__FieldTag::__service_account),
1644                            "service_account" => Ok(__FieldTag::__service_account),
1645                            "displayName" => Ok(__FieldTag::__display_name),
1646                            "display_name" => Ok(__FieldTag::__display_name),
1647                            "availableVersion" => Ok(__FieldTag::__available_version),
1648                            "available_version" => Ok(__FieldTag::__available_version),
1649                            "apiEndpoint" => Ok(__FieldTag::__api_endpoint),
1650                            "api_endpoint" => Ok(__FieldTag::__api_endpoint),
1651                            "gcsBucket" => Ok(__FieldTag::__gcs_bucket),
1652                            "gcs_bucket" => Ok(__FieldTag::__gcs_bucket),
1653                            "accelerators" => Ok(__FieldTag::__accelerators),
1654                            "p4ServiceAccount" => Ok(__FieldTag::__p4_service_account),
1655                            "p4_service_account" => Ok(__FieldTag::__p4_service_account),
1656                            "tenantProjectId" => Ok(__FieldTag::__tenant_project_id),
1657                            "tenant_project_id" => Ok(__FieldTag::__tenant_project_id),
1658                            "dataprocServiceAccount" => Ok(__FieldTag::__dataproc_service_account),
1659                            "dataproc_service_account" => {
1660                                Ok(__FieldTag::__dataproc_service_account)
1661                            }
1662                            "enableRbac" => Ok(__FieldTag::__enable_rbac),
1663                            "enable_rbac" => Ok(__FieldTag::__enable_rbac),
1664                            "cryptoKeyConfig" => Ok(__FieldTag::__crypto_key_config),
1665                            "crypto_key_config" => Ok(__FieldTag::__crypto_key_config),
1666                            "disabledReason" => Ok(__FieldTag::__disabled_reason),
1667                            "disabled_reason" => Ok(__FieldTag::__disabled_reason),
1668                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1669                        }
1670                    }
1671                }
1672                deserializer.deserialize_identifier(Visitor)
1673            }
1674        }
1675        struct Visitor;
1676        impl<'de> serde::de::Visitor<'de> for Visitor {
1677            type Value = Instance;
1678            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1679                formatter.write_str("struct Instance")
1680            }
1681            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1682            where
1683                A: serde::de::MapAccess<'de>,
1684            {
1685                #[allow(unused_imports)]
1686                use serde::de::Error;
1687                use std::option::Option::Some;
1688                let mut fields = std::collections::HashSet::new();
1689                let mut result = Self::Value::new();
1690                while let Some(tag) = map.next_key::<__FieldTag>()? {
1691                    #[allow(clippy::match_single_binding)]
1692                    match tag {
1693                        __FieldTag::__name => {
1694                            if !fields.insert(__FieldTag::__name) {
1695                                return std::result::Result::Err(A::Error::duplicate_field(
1696                                    "multiple values for name",
1697                                ));
1698                            }
1699                            result.name = map
1700                                .next_value::<std::option::Option<std::string::String>>()?
1701                                .unwrap_or_default();
1702                        }
1703                        __FieldTag::__description => {
1704                            if !fields.insert(__FieldTag::__description) {
1705                                return std::result::Result::Err(A::Error::duplicate_field(
1706                                    "multiple values for description",
1707                                ));
1708                            }
1709                            result.description = map
1710                                .next_value::<std::option::Option<std::string::String>>()?
1711                                .unwrap_or_default();
1712                        }
1713                        __FieldTag::__type => {
1714                            if !fields.insert(__FieldTag::__type) {
1715                                return std::result::Result::Err(A::Error::duplicate_field(
1716                                    "multiple values for type",
1717                                ));
1718                            }
1719                            result.r#type = map
1720                                .next_value::<std::option::Option<crate::model::instance::Type>>()?
1721                                .unwrap_or_default();
1722                        }
1723                        __FieldTag::__enable_stackdriver_logging => {
1724                            if !fields.insert(__FieldTag::__enable_stackdriver_logging) {
1725                                return std::result::Result::Err(A::Error::duplicate_field(
1726                                    "multiple values for enable_stackdriver_logging",
1727                                ));
1728                            }
1729                            result.enable_stackdriver_logging = map
1730                                .next_value::<std::option::Option<bool>>()?
1731                                .unwrap_or_default();
1732                        }
1733                        __FieldTag::__enable_stackdriver_monitoring => {
1734                            if !fields.insert(__FieldTag::__enable_stackdriver_monitoring) {
1735                                return std::result::Result::Err(A::Error::duplicate_field(
1736                                    "multiple values for enable_stackdriver_monitoring",
1737                                ));
1738                            }
1739                            result.enable_stackdriver_monitoring = map
1740                                .next_value::<std::option::Option<bool>>()?
1741                                .unwrap_or_default();
1742                        }
1743                        __FieldTag::__private_instance => {
1744                            if !fields.insert(__FieldTag::__private_instance) {
1745                                return std::result::Result::Err(A::Error::duplicate_field(
1746                                    "multiple values for private_instance",
1747                                ));
1748                            }
1749                            result.private_instance = map
1750                                .next_value::<std::option::Option<bool>>()?
1751                                .unwrap_or_default();
1752                        }
1753                        __FieldTag::__network_config => {
1754                            if !fields.insert(__FieldTag::__network_config) {
1755                                return std::result::Result::Err(A::Error::duplicate_field(
1756                                    "multiple values for network_config",
1757                                ));
1758                            }
1759                            result.network_config = map
1760                                .next_value::<std::option::Option<crate::model::NetworkConfig>>()?;
1761                        }
1762                        __FieldTag::__labels => {
1763                            if !fields.insert(__FieldTag::__labels) {
1764                                return std::result::Result::Err(A::Error::duplicate_field(
1765                                    "multiple values for labels",
1766                                ));
1767                            }
1768                            result.labels = map
1769                                .next_value::<std::option::Option<
1770                                    std::collections::HashMap<
1771                                        std::string::String,
1772                                        std::string::String,
1773                                    >,
1774                                >>()?
1775                                .unwrap_or_default();
1776                        }
1777                        __FieldTag::__options => {
1778                            if !fields.insert(__FieldTag::__options) {
1779                                return std::result::Result::Err(A::Error::duplicate_field(
1780                                    "multiple values for options",
1781                                ));
1782                            }
1783                            result.options = map
1784                                .next_value::<std::option::Option<
1785                                    std::collections::HashMap<
1786                                        std::string::String,
1787                                        std::string::String,
1788                                    >,
1789                                >>()?
1790                                .unwrap_or_default();
1791                        }
1792                        __FieldTag::__create_time => {
1793                            if !fields.insert(__FieldTag::__create_time) {
1794                                return std::result::Result::Err(A::Error::duplicate_field(
1795                                    "multiple values for create_time",
1796                                ));
1797                            }
1798                            result.create_time =
1799                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1800                        }
1801                        __FieldTag::__update_time => {
1802                            if !fields.insert(__FieldTag::__update_time) {
1803                                return std::result::Result::Err(A::Error::duplicate_field(
1804                                    "multiple values for update_time",
1805                                ));
1806                            }
1807                            result.update_time =
1808                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1809                        }
1810                        __FieldTag::__state => {
1811                            if !fields.insert(__FieldTag::__state) {
1812                                return std::result::Result::Err(A::Error::duplicate_field(
1813                                    "multiple values for state",
1814                                ));
1815                            }
1816                            result.state = map
1817                                .next_value::<std::option::Option<crate::model::instance::State>>()?
1818                                .unwrap_or_default();
1819                        }
1820                        __FieldTag::__state_message => {
1821                            if !fields.insert(__FieldTag::__state_message) {
1822                                return std::result::Result::Err(A::Error::duplicate_field(
1823                                    "multiple values for state_message",
1824                                ));
1825                            }
1826                            result.state_message = map
1827                                .next_value::<std::option::Option<std::string::String>>()?
1828                                .unwrap_or_default();
1829                        }
1830                        __FieldTag::__service_endpoint => {
1831                            if !fields.insert(__FieldTag::__service_endpoint) {
1832                                return std::result::Result::Err(A::Error::duplicate_field(
1833                                    "multiple values for service_endpoint",
1834                                ));
1835                            }
1836                            result.service_endpoint = map
1837                                .next_value::<std::option::Option<std::string::String>>()?
1838                                .unwrap_or_default();
1839                        }
1840                        __FieldTag::__zone => {
1841                            if !fields.insert(__FieldTag::__zone) {
1842                                return std::result::Result::Err(A::Error::duplicate_field(
1843                                    "multiple values for zone",
1844                                ));
1845                            }
1846                            result.zone = map
1847                                .next_value::<std::option::Option<std::string::String>>()?
1848                                .unwrap_or_default();
1849                        }
1850                        __FieldTag::__version => {
1851                            if !fields.insert(__FieldTag::__version) {
1852                                return std::result::Result::Err(A::Error::duplicate_field(
1853                                    "multiple values for version",
1854                                ));
1855                            }
1856                            result.version = map
1857                                .next_value::<std::option::Option<std::string::String>>()?
1858                                .unwrap_or_default();
1859                        }
1860                        __FieldTag::__service_account => {
1861                            if !fields.insert(__FieldTag::__service_account) {
1862                                return std::result::Result::Err(A::Error::duplicate_field(
1863                                    "multiple values for service_account",
1864                                ));
1865                            }
1866                            result.service_account = map
1867                                .next_value::<std::option::Option<std::string::String>>()?
1868                                .unwrap_or_default();
1869                        }
1870                        __FieldTag::__display_name => {
1871                            if !fields.insert(__FieldTag::__display_name) {
1872                                return std::result::Result::Err(A::Error::duplicate_field(
1873                                    "multiple values for display_name",
1874                                ));
1875                            }
1876                            result.display_name = map
1877                                .next_value::<std::option::Option<std::string::String>>()?
1878                                .unwrap_or_default();
1879                        }
1880                        __FieldTag::__available_version => {
1881                            if !fields.insert(__FieldTag::__available_version) {
1882                                return std::result::Result::Err(A::Error::duplicate_field(
1883                                    "multiple values for available_version",
1884                                ));
1885                            }
1886                            result.available_version = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Version>>>()?.unwrap_or_default();
1887                        }
1888                        __FieldTag::__api_endpoint => {
1889                            if !fields.insert(__FieldTag::__api_endpoint) {
1890                                return std::result::Result::Err(A::Error::duplicate_field(
1891                                    "multiple values for api_endpoint",
1892                                ));
1893                            }
1894                            result.api_endpoint = map
1895                                .next_value::<std::option::Option<std::string::String>>()?
1896                                .unwrap_or_default();
1897                        }
1898                        __FieldTag::__gcs_bucket => {
1899                            if !fields.insert(__FieldTag::__gcs_bucket) {
1900                                return std::result::Result::Err(A::Error::duplicate_field(
1901                                    "multiple values for gcs_bucket",
1902                                ));
1903                            }
1904                            result.gcs_bucket = map
1905                                .next_value::<std::option::Option<std::string::String>>()?
1906                                .unwrap_or_default();
1907                        }
1908                        __FieldTag::__accelerators => {
1909                            if !fields.insert(__FieldTag::__accelerators) {
1910                                return std::result::Result::Err(A::Error::duplicate_field(
1911                                    "multiple values for accelerators",
1912                                ));
1913                            }
1914                            result.accelerators = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Accelerator>>>()?.unwrap_or_default();
1915                        }
1916                        __FieldTag::__p4_service_account => {
1917                            if !fields.insert(__FieldTag::__p4_service_account) {
1918                                return std::result::Result::Err(A::Error::duplicate_field(
1919                                    "multiple values for p4_service_account",
1920                                ));
1921                            }
1922                            result.p4_service_account = map
1923                                .next_value::<std::option::Option<std::string::String>>()?
1924                                .unwrap_or_default();
1925                        }
1926                        __FieldTag::__tenant_project_id => {
1927                            if !fields.insert(__FieldTag::__tenant_project_id) {
1928                                return std::result::Result::Err(A::Error::duplicate_field(
1929                                    "multiple values for tenant_project_id",
1930                                ));
1931                            }
1932                            result.tenant_project_id = map
1933                                .next_value::<std::option::Option<std::string::String>>()?
1934                                .unwrap_or_default();
1935                        }
1936                        __FieldTag::__dataproc_service_account => {
1937                            if !fields.insert(__FieldTag::__dataproc_service_account) {
1938                                return std::result::Result::Err(A::Error::duplicate_field(
1939                                    "multiple values for dataproc_service_account",
1940                                ));
1941                            }
1942                            result.dataproc_service_account = map
1943                                .next_value::<std::option::Option<std::string::String>>()?
1944                                .unwrap_or_default();
1945                        }
1946                        __FieldTag::__enable_rbac => {
1947                            if !fields.insert(__FieldTag::__enable_rbac) {
1948                                return std::result::Result::Err(A::Error::duplicate_field(
1949                                    "multiple values for enable_rbac",
1950                                ));
1951                            }
1952                            result.enable_rbac = map
1953                                .next_value::<std::option::Option<bool>>()?
1954                                .unwrap_or_default();
1955                        }
1956                        __FieldTag::__crypto_key_config => {
1957                            if !fields.insert(__FieldTag::__crypto_key_config) {
1958                                return std::result::Result::Err(A::Error::duplicate_field(
1959                                    "multiple values for crypto_key_config",
1960                                ));
1961                            }
1962                            result.crypto_key_config = map
1963                                .next_value::<std::option::Option<crate::model::CryptoKeyConfig>>(
1964                                )?;
1965                        }
1966                        __FieldTag::__disabled_reason => {
1967                            if !fields.insert(__FieldTag::__disabled_reason) {
1968                                return std::result::Result::Err(A::Error::duplicate_field(
1969                                    "multiple values for disabled_reason",
1970                                ));
1971                            }
1972                            result.disabled_reason = map
1973                                .next_value::<std::option::Option<
1974                                    std::vec::Vec<crate::model::instance::DisabledReason>,
1975                                >>()?
1976                                .unwrap_or_default();
1977                        }
1978                        __FieldTag::Unknown(key) => {
1979                            let value = map.next_value::<serde_json::Value>()?;
1980                            result._unknown_fields.insert(key, value);
1981                        }
1982                    }
1983                }
1984                std::result::Result::Ok(result)
1985            }
1986        }
1987        deserializer.deserialize_any(Visitor)
1988    }
1989}
1990
1991#[doc(hidden)]
1992impl serde::ser::Serialize for Instance {
1993    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1994    where
1995        S: serde::ser::Serializer,
1996    {
1997        use serde::ser::SerializeMap;
1998        #[allow(unused_imports)]
1999        use std::option::Option::Some;
2000        let mut state = serializer.serialize_map(std::option::Option::None)?;
2001        if !self.name.is_empty() {
2002            state.serialize_entry("name", &self.name)?;
2003        }
2004        if !self.description.is_empty() {
2005            state.serialize_entry("description", &self.description)?;
2006        }
2007        if !wkt::internal::is_default(&self.r#type) {
2008            state.serialize_entry("type", &self.r#type)?;
2009        }
2010        if !wkt::internal::is_default(&self.enable_stackdriver_logging) {
2011            state.serialize_entry("enableStackdriverLogging", &self.enable_stackdriver_logging)?;
2012        }
2013        if !wkt::internal::is_default(&self.enable_stackdriver_monitoring) {
2014            state.serialize_entry(
2015                "enableStackdriverMonitoring",
2016                &self.enable_stackdriver_monitoring,
2017            )?;
2018        }
2019        if !wkt::internal::is_default(&self.private_instance) {
2020            state.serialize_entry("privateInstance", &self.private_instance)?;
2021        }
2022        if self.network_config.is_some() {
2023            state.serialize_entry("networkConfig", &self.network_config)?;
2024        }
2025        if !self.labels.is_empty() {
2026            state.serialize_entry("labels", &self.labels)?;
2027        }
2028        if !self.options.is_empty() {
2029            state.serialize_entry("options", &self.options)?;
2030        }
2031        if self.create_time.is_some() {
2032            state.serialize_entry("createTime", &self.create_time)?;
2033        }
2034        if self.update_time.is_some() {
2035            state.serialize_entry("updateTime", &self.update_time)?;
2036        }
2037        if !wkt::internal::is_default(&self.state) {
2038            state.serialize_entry("state", &self.state)?;
2039        }
2040        if !self.state_message.is_empty() {
2041            state.serialize_entry("stateMessage", &self.state_message)?;
2042        }
2043        if !self.service_endpoint.is_empty() {
2044            state.serialize_entry("serviceEndpoint", &self.service_endpoint)?;
2045        }
2046        if !self.zone.is_empty() {
2047            state.serialize_entry("zone", &self.zone)?;
2048        }
2049        if !self.version.is_empty() {
2050            state.serialize_entry("version", &self.version)?;
2051        }
2052        if !self.service_account.is_empty() {
2053            state.serialize_entry("serviceAccount", &self.service_account)?;
2054        }
2055        if !self.display_name.is_empty() {
2056            state.serialize_entry("displayName", &self.display_name)?;
2057        }
2058        if !self.available_version.is_empty() {
2059            state.serialize_entry("availableVersion", &self.available_version)?;
2060        }
2061        if !self.api_endpoint.is_empty() {
2062            state.serialize_entry("apiEndpoint", &self.api_endpoint)?;
2063        }
2064        if !self.gcs_bucket.is_empty() {
2065            state.serialize_entry("gcsBucket", &self.gcs_bucket)?;
2066        }
2067        if !self.accelerators.is_empty() {
2068            state.serialize_entry("accelerators", &self.accelerators)?;
2069        }
2070        if !self.p4_service_account.is_empty() {
2071            state.serialize_entry("p4ServiceAccount", &self.p4_service_account)?;
2072        }
2073        if !self.tenant_project_id.is_empty() {
2074            state.serialize_entry("tenantProjectId", &self.tenant_project_id)?;
2075        }
2076        if !self.dataproc_service_account.is_empty() {
2077            state.serialize_entry("dataprocServiceAccount", &self.dataproc_service_account)?;
2078        }
2079        if !wkt::internal::is_default(&self.enable_rbac) {
2080            state.serialize_entry("enableRbac", &self.enable_rbac)?;
2081        }
2082        if self.crypto_key_config.is_some() {
2083            state.serialize_entry("cryptoKeyConfig", &self.crypto_key_config)?;
2084        }
2085        if !self.disabled_reason.is_empty() {
2086            state.serialize_entry("disabledReason", &self.disabled_reason)?;
2087        }
2088        if !self._unknown_fields.is_empty() {
2089            for (key, value) in self._unknown_fields.iter() {
2090                state.serialize_entry(key, &value)?;
2091            }
2092        }
2093        state.end()
2094    }
2095}
2096
2097impl std::fmt::Debug for Instance {
2098    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2099        let mut debug_struct = f.debug_struct("Instance");
2100        debug_struct.field("name", &self.name);
2101        debug_struct.field("description", &self.description);
2102        debug_struct.field("r#type", &self.r#type);
2103        debug_struct.field(
2104            "enable_stackdriver_logging",
2105            &self.enable_stackdriver_logging,
2106        );
2107        debug_struct.field(
2108            "enable_stackdriver_monitoring",
2109            &self.enable_stackdriver_monitoring,
2110        );
2111        debug_struct.field("private_instance", &self.private_instance);
2112        debug_struct.field("network_config", &self.network_config);
2113        debug_struct.field("labels", &self.labels);
2114        debug_struct.field("options", &self.options);
2115        debug_struct.field("create_time", &self.create_time);
2116        debug_struct.field("update_time", &self.update_time);
2117        debug_struct.field("state", &self.state);
2118        debug_struct.field("state_message", &self.state_message);
2119        debug_struct.field("service_endpoint", &self.service_endpoint);
2120        debug_struct.field("zone", &self.zone);
2121        debug_struct.field("version", &self.version);
2122        debug_struct.field("service_account", &self.service_account);
2123        debug_struct.field("display_name", &self.display_name);
2124        debug_struct.field("available_version", &self.available_version);
2125        debug_struct.field("api_endpoint", &self.api_endpoint);
2126        debug_struct.field("gcs_bucket", &self.gcs_bucket);
2127        debug_struct.field("accelerators", &self.accelerators);
2128        debug_struct.field("p4_service_account", &self.p4_service_account);
2129        debug_struct.field("tenant_project_id", &self.tenant_project_id);
2130        debug_struct.field("dataproc_service_account", &self.dataproc_service_account);
2131        debug_struct.field("enable_rbac", &self.enable_rbac);
2132        debug_struct.field("crypto_key_config", &self.crypto_key_config);
2133        debug_struct.field("disabled_reason", &self.disabled_reason);
2134        if !self._unknown_fields.is_empty() {
2135            debug_struct.field("_unknown_fields", &self._unknown_fields);
2136        }
2137        debug_struct.finish()
2138    }
2139}
2140
2141/// Defines additional types related to [Instance].
2142pub mod instance {
2143    #[allow(unused_imports)]
2144    use super::*;
2145
2146    /// Represents the type of Data Fusion instance. Each type is configured with
2147    /// the default settings for processing and memory.
2148    ///
2149    /// # Working with unknown values
2150    ///
2151    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2152    /// additional enum variants at any time. Adding new variants is not considered
2153    /// a breaking change. Applications should write their code in anticipation of:
2154    ///
2155    /// - New values appearing in future releases of the client library, **and**
2156    /// - New values received dynamically, without application changes.
2157    ///
2158    /// Please consult the [Working with enums] section in the user guide for some
2159    /// guidelines.
2160    ///
2161    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2162    #[derive(Clone, Debug, PartialEq)]
2163    #[non_exhaustive]
2164    pub enum Type {
2165        /// No type specified. The instance creation will fail.
2166        Unspecified,
2167        /// Basic Data Fusion instance. In Basic type, the user will be able to
2168        /// create data pipelines using point and click UI. However, there are
2169        /// certain limitations, such as fewer number of concurrent pipelines, no
2170        /// support for streaming pipelines, etc.
2171        Basic,
2172        /// Enterprise Data Fusion instance. In Enterprise type, the user will have
2173        /// all features available, such as support for streaming pipelines, higher
2174        /// number of concurrent pipelines, etc.
2175        Enterprise,
2176        /// Developer Data Fusion instance. In Developer type, the user will have all
2177        /// features available but with restrictive capabilities. This is to help
2178        /// enterprises design and develop their data ingestion and integration
2179        /// pipelines at low cost.
2180        Developer,
2181        /// If set, the enum was initialized with an unknown value.
2182        ///
2183        /// Applications can examine the value using [Type::value] or
2184        /// [Type::name].
2185        UnknownValue(r#type::UnknownValue),
2186    }
2187
2188    #[doc(hidden)]
2189    pub mod r#type {
2190        #[allow(unused_imports)]
2191        use super::*;
2192        #[derive(Clone, Debug, PartialEq)]
2193        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2194    }
2195
2196    impl Type {
2197        /// Gets the enum value.
2198        ///
2199        /// Returns `None` if the enum contains an unknown value deserialized from
2200        /// the string representation of enums.
2201        pub fn value(&self) -> std::option::Option<i32> {
2202            match self {
2203                Self::Unspecified => std::option::Option::Some(0),
2204                Self::Basic => std::option::Option::Some(1),
2205                Self::Enterprise => std::option::Option::Some(2),
2206                Self::Developer => std::option::Option::Some(3),
2207                Self::UnknownValue(u) => u.0.value(),
2208            }
2209        }
2210
2211        /// Gets the enum value as a string.
2212        ///
2213        /// Returns `None` if the enum contains an unknown value deserialized from
2214        /// the integer representation of enums.
2215        pub fn name(&self) -> std::option::Option<&str> {
2216            match self {
2217                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2218                Self::Basic => std::option::Option::Some("BASIC"),
2219                Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
2220                Self::Developer => std::option::Option::Some("DEVELOPER"),
2221                Self::UnknownValue(u) => u.0.name(),
2222            }
2223        }
2224    }
2225
2226    impl std::default::Default for Type {
2227        fn default() -> Self {
2228            use std::convert::From;
2229            Self::from(0)
2230        }
2231    }
2232
2233    impl std::fmt::Display for Type {
2234        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2235            wkt::internal::display_enum(f, self.name(), self.value())
2236        }
2237    }
2238
2239    impl std::convert::From<i32> for Type {
2240        fn from(value: i32) -> Self {
2241            match value {
2242                0 => Self::Unspecified,
2243                1 => Self::Basic,
2244                2 => Self::Enterprise,
2245                3 => Self::Developer,
2246                _ => Self::UnknownValue(r#type::UnknownValue(
2247                    wkt::internal::UnknownEnumValue::Integer(value),
2248                )),
2249            }
2250        }
2251    }
2252
2253    impl std::convert::From<&str> for Type {
2254        fn from(value: &str) -> Self {
2255            use std::string::ToString;
2256            match value {
2257                "TYPE_UNSPECIFIED" => Self::Unspecified,
2258                "BASIC" => Self::Basic,
2259                "ENTERPRISE" => Self::Enterprise,
2260                "DEVELOPER" => Self::Developer,
2261                _ => Self::UnknownValue(r#type::UnknownValue(
2262                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2263                )),
2264            }
2265        }
2266    }
2267
2268    impl serde::ser::Serialize for Type {
2269        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2270        where
2271            S: serde::Serializer,
2272        {
2273            match self {
2274                Self::Unspecified => serializer.serialize_i32(0),
2275                Self::Basic => serializer.serialize_i32(1),
2276                Self::Enterprise => serializer.serialize_i32(2),
2277                Self::Developer => serializer.serialize_i32(3),
2278                Self::UnknownValue(u) => u.0.serialize(serializer),
2279            }
2280        }
2281    }
2282
2283    impl<'de> serde::de::Deserialize<'de> for Type {
2284        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2285        where
2286            D: serde::Deserializer<'de>,
2287        {
2288            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2289                ".google.cloud.datafusion.v1.Instance.Type",
2290            ))
2291        }
2292    }
2293
2294    /// Represents the state of a Data Fusion instance
2295    ///
2296    /// # Working with unknown values
2297    ///
2298    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2299    /// additional enum variants at any time. Adding new variants is not considered
2300    /// a breaking change. Applications should write their code in anticipation of:
2301    ///
2302    /// - New values appearing in future releases of the client library, **and**
2303    /// - New values received dynamically, without application changes.
2304    ///
2305    /// Please consult the [Working with enums] section in the user guide for some
2306    /// guidelines.
2307    ///
2308    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2309    #[derive(Clone, Debug, PartialEq)]
2310    #[non_exhaustive]
2311    pub enum State {
2312        /// Instance does not have a state yet
2313        Unspecified,
2314        /// Instance is being created
2315        Creating,
2316        /// Instance is active and ready for requests. This corresponds to 'RUNNING'
2317        /// in datafusion.v1beta1.
2318        Active,
2319        /// Instance creation failed
2320        Failed,
2321        /// Instance is being deleted
2322        Deleting,
2323        /// Instance is being upgraded
2324        Upgrading,
2325        /// Instance is being restarted
2326        Restarting,
2327        /// Instance is being updated on customer request
2328        Updating,
2329        /// Instance is being auto-updated
2330        AutoUpdating,
2331        /// Instance is being auto-upgraded
2332        AutoUpgrading,
2333        /// Instance is disabled
2334        Disabled,
2335        /// If set, the enum was initialized with an unknown value.
2336        ///
2337        /// Applications can examine the value using [State::value] or
2338        /// [State::name].
2339        UnknownValue(state::UnknownValue),
2340    }
2341
2342    #[doc(hidden)]
2343    pub mod state {
2344        #[allow(unused_imports)]
2345        use super::*;
2346        #[derive(Clone, Debug, PartialEq)]
2347        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2348    }
2349
2350    impl State {
2351        /// Gets the enum value.
2352        ///
2353        /// Returns `None` if the enum contains an unknown value deserialized from
2354        /// the string representation of enums.
2355        pub fn value(&self) -> std::option::Option<i32> {
2356            match self {
2357                Self::Unspecified => std::option::Option::Some(0),
2358                Self::Creating => std::option::Option::Some(1),
2359                Self::Active => std::option::Option::Some(2),
2360                Self::Failed => std::option::Option::Some(3),
2361                Self::Deleting => std::option::Option::Some(4),
2362                Self::Upgrading => std::option::Option::Some(5),
2363                Self::Restarting => std::option::Option::Some(6),
2364                Self::Updating => std::option::Option::Some(7),
2365                Self::AutoUpdating => std::option::Option::Some(8),
2366                Self::AutoUpgrading => std::option::Option::Some(9),
2367                Self::Disabled => std::option::Option::Some(10),
2368                Self::UnknownValue(u) => u.0.value(),
2369            }
2370        }
2371
2372        /// Gets the enum value as a string.
2373        ///
2374        /// Returns `None` if the enum contains an unknown value deserialized from
2375        /// the integer representation of enums.
2376        pub fn name(&self) -> std::option::Option<&str> {
2377            match self {
2378                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2379                Self::Creating => std::option::Option::Some("CREATING"),
2380                Self::Active => std::option::Option::Some("ACTIVE"),
2381                Self::Failed => std::option::Option::Some("FAILED"),
2382                Self::Deleting => std::option::Option::Some("DELETING"),
2383                Self::Upgrading => std::option::Option::Some("UPGRADING"),
2384                Self::Restarting => std::option::Option::Some("RESTARTING"),
2385                Self::Updating => std::option::Option::Some("UPDATING"),
2386                Self::AutoUpdating => std::option::Option::Some("AUTO_UPDATING"),
2387                Self::AutoUpgrading => std::option::Option::Some("AUTO_UPGRADING"),
2388                Self::Disabled => std::option::Option::Some("DISABLED"),
2389                Self::UnknownValue(u) => u.0.name(),
2390            }
2391        }
2392    }
2393
2394    impl std::default::Default for State {
2395        fn default() -> Self {
2396            use std::convert::From;
2397            Self::from(0)
2398        }
2399    }
2400
2401    impl std::fmt::Display for State {
2402        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2403            wkt::internal::display_enum(f, self.name(), self.value())
2404        }
2405    }
2406
2407    impl std::convert::From<i32> for State {
2408        fn from(value: i32) -> Self {
2409            match value {
2410                0 => Self::Unspecified,
2411                1 => Self::Creating,
2412                2 => Self::Active,
2413                3 => Self::Failed,
2414                4 => Self::Deleting,
2415                5 => Self::Upgrading,
2416                6 => Self::Restarting,
2417                7 => Self::Updating,
2418                8 => Self::AutoUpdating,
2419                9 => Self::AutoUpgrading,
2420                10 => Self::Disabled,
2421                _ => Self::UnknownValue(state::UnknownValue(
2422                    wkt::internal::UnknownEnumValue::Integer(value),
2423                )),
2424            }
2425        }
2426    }
2427
2428    impl std::convert::From<&str> for State {
2429        fn from(value: &str) -> Self {
2430            use std::string::ToString;
2431            match value {
2432                "STATE_UNSPECIFIED" => Self::Unspecified,
2433                "CREATING" => Self::Creating,
2434                "ACTIVE" => Self::Active,
2435                "FAILED" => Self::Failed,
2436                "DELETING" => Self::Deleting,
2437                "UPGRADING" => Self::Upgrading,
2438                "RESTARTING" => Self::Restarting,
2439                "UPDATING" => Self::Updating,
2440                "AUTO_UPDATING" => Self::AutoUpdating,
2441                "AUTO_UPGRADING" => Self::AutoUpgrading,
2442                "DISABLED" => Self::Disabled,
2443                _ => Self::UnknownValue(state::UnknownValue(
2444                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2445                )),
2446            }
2447        }
2448    }
2449
2450    impl serde::ser::Serialize for State {
2451        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2452        where
2453            S: serde::Serializer,
2454        {
2455            match self {
2456                Self::Unspecified => serializer.serialize_i32(0),
2457                Self::Creating => serializer.serialize_i32(1),
2458                Self::Active => serializer.serialize_i32(2),
2459                Self::Failed => serializer.serialize_i32(3),
2460                Self::Deleting => serializer.serialize_i32(4),
2461                Self::Upgrading => serializer.serialize_i32(5),
2462                Self::Restarting => serializer.serialize_i32(6),
2463                Self::Updating => serializer.serialize_i32(7),
2464                Self::AutoUpdating => serializer.serialize_i32(8),
2465                Self::AutoUpgrading => serializer.serialize_i32(9),
2466                Self::Disabled => serializer.serialize_i32(10),
2467                Self::UnknownValue(u) => u.0.serialize(serializer),
2468            }
2469        }
2470    }
2471
2472    impl<'de> serde::de::Deserialize<'de> for State {
2473        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2474        where
2475            D: serde::Deserializer<'de>,
2476        {
2477            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2478                ".google.cloud.datafusion.v1.Instance.State",
2479            ))
2480        }
2481    }
2482
2483    /// The reason for disabling the instance if the state is DISABLED.
2484    ///
2485    /// # Working with unknown values
2486    ///
2487    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2488    /// additional enum variants at any time. Adding new variants is not considered
2489    /// a breaking change. Applications should write their code in anticipation of:
2490    ///
2491    /// - New values appearing in future releases of the client library, **and**
2492    /// - New values received dynamically, without application changes.
2493    ///
2494    /// Please consult the [Working with enums] section in the user guide for some
2495    /// guidelines.
2496    ///
2497    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2498    #[derive(Clone, Debug, PartialEq)]
2499    #[non_exhaustive]
2500    pub enum DisabledReason {
2501        /// This is an unknown reason for disabling.
2502        Unspecified,
2503        /// The KMS key used by the instance is either revoked or denied access to
2504        KmsKeyIssue,
2505        /// If set, the enum was initialized with an unknown value.
2506        ///
2507        /// Applications can examine the value using [DisabledReason::value] or
2508        /// [DisabledReason::name].
2509        UnknownValue(disabled_reason::UnknownValue),
2510    }
2511
2512    #[doc(hidden)]
2513    pub mod disabled_reason {
2514        #[allow(unused_imports)]
2515        use super::*;
2516        #[derive(Clone, Debug, PartialEq)]
2517        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2518    }
2519
2520    impl DisabledReason {
2521        /// Gets the enum value.
2522        ///
2523        /// Returns `None` if the enum contains an unknown value deserialized from
2524        /// the string representation of enums.
2525        pub fn value(&self) -> std::option::Option<i32> {
2526            match self {
2527                Self::Unspecified => std::option::Option::Some(0),
2528                Self::KmsKeyIssue => std::option::Option::Some(1),
2529                Self::UnknownValue(u) => u.0.value(),
2530            }
2531        }
2532
2533        /// Gets the enum value as a string.
2534        ///
2535        /// Returns `None` if the enum contains an unknown value deserialized from
2536        /// the integer representation of enums.
2537        pub fn name(&self) -> std::option::Option<&str> {
2538            match self {
2539                Self::Unspecified => std::option::Option::Some("DISABLED_REASON_UNSPECIFIED"),
2540                Self::KmsKeyIssue => std::option::Option::Some("KMS_KEY_ISSUE"),
2541                Self::UnknownValue(u) => u.0.name(),
2542            }
2543        }
2544    }
2545
2546    impl std::default::Default for DisabledReason {
2547        fn default() -> Self {
2548            use std::convert::From;
2549            Self::from(0)
2550        }
2551    }
2552
2553    impl std::fmt::Display for DisabledReason {
2554        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2555            wkt::internal::display_enum(f, self.name(), self.value())
2556        }
2557    }
2558
2559    impl std::convert::From<i32> for DisabledReason {
2560        fn from(value: i32) -> Self {
2561            match value {
2562                0 => Self::Unspecified,
2563                1 => Self::KmsKeyIssue,
2564                _ => Self::UnknownValue(disabled_reason::UnknownValue(
2565                    wkt::internal::UnknownEnumValue::Integer(value),
2566                )),
2567            }
2568        }
2569    }
2570
2571    impl std::convert::From<&str> for DisabledReason {
2572        fn from(value: &str) -> Self {
2573            use std::string::ToString;
2574            match value {
2575                "DISABLED_REASON_UNSPECIFIED" => Self::Unspecified,
2576                "KMS_KEY_ISSUE" => Self::KmsKeyIssue,
2577                _ => Self::UnknownValue(disabled_reason::UnknownValue(
2578                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2579                )),
2580            }
2581        }
2582    }
2583
2584    impl serde::ser::Serialize for DisabledReason {
2585        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2586        where
2587            S: serde::Serializer,
2588        {
2589            match self {
2590                Self::Unspecified => serializer.serialize_i32(0),
2591                Self::KmsKeyIssue => serializer.serialize_i32(1),
2592                Self::UnknownValue(u) => u.0.serialize(serializer),
2593            }
2594        }
2595    }
2596
2597    impl<'de> serde::de::Deserialize<'de> for DisabledReason {
2598        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2599        where
2600            D: serde::Deserializer<'de>,
2601        {
2602            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DisabledReason>::new(
2603                ".google.cloud.datafusion.v1.Instance.DisabledReason",
2604            ))
2605        }
2606    }
2607}
2608
2609/// Request message for listing Data Fusion instances.
2610#[derive(Clone, Default, PartialEq)]
2611#[non_exhaustive]
2612pub struct ListInstancesRequest {
2613    /// Required. The project and location for which to retrieve instance information
2614    /// in the format projects/{project}/locations/{location}. If the location is
2615    /// specified as '-' (wildcard), then all regions available to the project
2616    /// are queried, and the results are aggregated.
2617    pub parent: std::string::String,
2618
2619    /// The maximum number of items to return.
2620    pub page_size: i32,
2621
2622    /// The next_page_token value to use if there are additional
2623    /// results to retrieve for this list request.
2624    pub page_token: std::string::String,
2625
2626    /// List filter.
2627    pub filter: std::string::String,
2628
2629    /// Sort results. Supported values are "name", "name desc",  or "" (unsorted).
2630    pub order_by: std::string::String,
2631
2632    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2633}
2634
2635impl ListInstancesRequest {
2636    pub fn new() -> Self {
2637        std::default::Default::default()
2638    }
2639
2640    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
2641    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2642        self.parent = v.into();
2643        self
2644    }
2645
2646    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
2647    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2648        self.page_size = v.into();
2649        self
2650    }
2651
2652    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
2653    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2654        self.page_token = v.into();
2655        self
2656    }
2657
2658    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
2659    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2660        self.filter = v.into();
2661        self
2662    }
2663
2664    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
2665    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2666        self.order_by = v.into();
2667        self
2668    }
2669}
2670
2671impl wkt::message::Message for ListInstancesRequest {
2672    fn typename() -> &'static str {
2673        "type.googleapis.com/google.cloud.datafusion.v1.ListInstancesRequest"
2674    }
2675}
2676
2677#[doc(hidden)]
2678impl<'de> serde::de::Deserialize<'de> for ListInstancesRequest {
2679    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2680    where
2681        D: serde::Deserializer<'de>,
2682    {
2683        #[allow(non_camel_case_types)]
2684        #[doc(hidden)]
2685        #[derive(PartialEq, Eq, Hash)]
2686        enum __FieldTag {
2687            __parent,
2688            __page_size,
2689            __page_token,
2690            __filter,
2691            __order_by,
2692            Unknown(std::string::String),
2693        }
2694        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2695            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2696            where
2697                D: serde::Deserializer<'de>,
2698            {
2699                struct Visitor;
2700                impl<'de> serde::de::Visitor<'de> for Visitor {
2701                    type Value = __FieldTag;
2702                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2703                        formatter.write_str("a field name for ListInstancesRequest")
2704                    }
2705                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2706                    where
2707                        E: serde::de::Error,
2708                    {
2709                        use std::result::Result::Ok;
2710                        use std::string::ToString;
2711                        match value {
2712                            "parent" => Ok(__FieldTag::__parent),
2713                            "pageSize" => Ok(__FieldTag::__page_size),
2714                            "page_size" => Ok(__FieldTag::__page_size),
2715                            "pageToken" => Ok(__FieldTag::__page_token),
2716                            "page_token" => Ok(__FieldTag::__page_token),
2717                            "filter" => Ok(__FieldTag::__filter),
2718                            "orderBy" => Ok(__FieldTag::__order_by),
2719                            "order_by" => Ok(__FieldTag::__order_by),
2720                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2721                        }
2722                    }
2723                }
2724                deserializer.deserialize_identifier(Visitor)
2725            }
2726        }
2727        struct Visitor;
2728        impl<'de> serde::de::Visitor<'de> for Visitor {
2729            type Value = ListInstancesRequest;
2730            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2731                formatter.write_str("struct ListInstancesRequest")
2732            }
2733            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2734            where
2735                A: serde::de::MapAccess<'de>,
2736            {
2737                #[allow(unused_imports)]
2738                use serde::de::Error;
2739                use std::option::Option::Some;
2740                let mut fields = std::collections::HashSet::new();
2741                let mut result = Self::Value::new();
2742                while let Some(tag) = map.next_key::<__FieldTag>()? {
2743                    #[allow(clippy::match_single_binding)]
2744                    match tag {
2745                        __FieldTag::__parent => {
2746                            if !fields.insert(__FieldTag::__parent) {
2747                                return std::result::Result::Err(A::Error::duplicate_field(
2748                                    "multiple values for parent",
2749                                ));
2750                            }
2751                            result.parent = map
2752                                .next_value::<std::option::Option<std::string::String>>()?
2753                                .unwrap_or_default();
2754                        }
2755                        __FieldTag::__page_size => {
2756                            if !fields.insert(__FieldTag::__page_size) {
2757                                return std::result::Result::Err(A::Error::duplicate_field(
2758                                    "multiple values for page_size",
2759                                ));
2760                            }
2761                            struct __With(std::option::Option<i32>);
2762                            impl<'de> serde::de::Deserialize<'de> for __With {
2763                                fn deserialize<D>(
2764                                    deserializer: D,
2765                                ) -> std::result::Result<Self, D::Error>
2766                                where
2767                                    D: serde::de::Deserializer<'de>,
2768                                {
2769                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2770                                }
2771                            }
2772                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2773                        }
2774                        __FieldTag::__page_token => {
2775                            if !fields.insert(__FieldTag::__page_token) {
2776                                return std::result::Result::Err(A::Error::duplicate_field(
2777                                    "multiple values for page_token",
2778                                ));
2779                            }
2780                            result.page_token = map
2781                                .next_value::<std::option::Option<std::string::String>>()?
2782                                .unwrap_or_default();
2783                        }
2784                        __FieldTag::__filter => {
2785                            if !fields.insert(__FieldTag::__filter) {
2786                                return std::result::Result::Err(A::Error::duplicate_field(
2787                                    "multiple values for filter",
2788                                ));
2789                            }
2790                            result.filter = map
2791                                .next_value::<std::option::Option<std::string::String>>()?
2792                                .unwrap_or_default();
2793                        }
2794                        __FieldTag::__order_by => {
2795                            if !fields.insert(__FieldTag::__order_by) {
2796                                return std::result::Result::Err(A::Error::duplicate_field(
2797                                    "multiple values for order_by",
2798                                ));
2799                            }
2800                            result.order_by = map
2801                                .next_value::<std::option::Option<std::string::String>>()?
2802                                .unwrap_or_default();
2803                        }
2804                        __FieldTag::Unknown(key) => {
2805                            let value = map.next_value::<serde_json::Value>()?;
2806                            result._unknown_fields.insert(key, value);
2807                        }
2808                    }
2809                }
2810                std::result::Result::Ok(result)
2811            }
2812        }
2813        deserializer.deserialize_any(Visitor)
2814    }
2815}
2816
2817#[doc(hidden)]
2818impl serde::ser::Serialize for ListInstancesRequest {
2819    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2820    where
2821        S: serde::ser::Serializer,
2822    {
2823        use serde::ser::SerializeMap;
2824        #[allow(unused_imports)]
2825        use std::option::Option::Some;
2826        let mut state = serializer.serialize_map(std::option::Option::None)?;
2827        if !self.parent.is_empty() {
2828            state.serialize_entry("parent", &self.parent)?;
2829        }
2830        if !wkt::internal::is_default(&self.page_size) {
2831            struct __With<'a>(&'a i32);
2832            impl<'a> serde::ser::Serialize for __With<'a> {
2833                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2834                where
2835                    S: serde::ser::Serializer,
2836                {
2837                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2838                }
2839            }
2840            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2841        }
2842        if !self.page_token.is_empty() {
2843            state.serialize_entry("pageToken", &self.page_token)?;
2844        }
2845        if !self.filter.is_empty() {
2846            state.serialize_entry("filter", &self.filter)?;
2847        }
2848        if !self.order_by.is_empty() {
2849            state.serialize_entry("orderBy", &self.order_by)?;
2850        }
2851        if !self._unknown_fields.is_empty() {
2852            for (key, value) in self._unknown_fields.iter() {
2853                state.serialize_entry(key, &value)?;
2854            }
2855        }
2856        state.end()
2857    }
2858}
2859
2860impl std::fmt::Debug for ListInstancesRequest {
2861    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2862        let mut debug_struct = f.debug_struct("ListInstancesRequest");
2863        debug_struct.field("parent", &self.parent);
2864        debug_struct.field("page_size", &self.page_size);
2865        debug_struct.field("page_token", &self.page_token);
2866        debug_struct.field("filter", &self.filter);
2867        debug_struct.field("order_by", &self.order_by);
2868        if !self._unknown_fields.is_empty() {
2869            debug_struct.field("_unknown_fields", &self._unknown_fields);
2870        }
2871        debug_struct.finish()
2872    }
2873}
2874
2875/// Response message for the list instance request.
2876#[derive(Clone, Default, PartialEq)]
2877#[non_exhaustive]
2878pub struct ListInstancesResponse {
2879    /// Represents a list of Data Fusion instances.
2880    pub instances: std::vec::Vec<crate::model::Instance>,
2881
2882    /// Token to retrieve the next page of results or empty if there are no more
2883    /// results in the list.
2884    pub next_page_token: std::string::String,
2885
2886    /// Locations that could not be reached.
2887    pub unreachable: std::vec::Vec<std::string::String>,
2888
2889    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2890}
2891
2892impl ListInstancesResponse {
2893    pub fn new() -> Self {
2894        std::default::Default::default()
2895    }
2896
2897    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
2898    pub fn set_instances<T, V>(mut self, v: T) -> Self
2899    where
2900        T: std::iter::IntoIterator<Item = V>,
2901        V: std::convert::Into<crate::model::Instance>,
2902    {
2903        use std::iter::Iterator;
2904        self.instances = v.into_iter().map(|i| i.into()).collect();
2905        self
2906    }
2907
2908    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
2909    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2910        self.next_page_token = v.into();
2911        self
2912    }
2913
2914    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
2915    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2916    where
2917        T: std::iter::IntoIterator<Item = V>,
2918        V: std::convert::Into<std::string::String>,
2919    {
2920        use std::iter::Iterator;
2921        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2922        self
2923    }
2924}
2925
2926impl wkt::message::Message for ListInstancesResponse {
2927    fn typename() -> &'static str {
2928        "type.googleapis.com/google.cloud.datafusion.v1.ListInstancesResponse"
2929    }
2930}
2931
2932#[doc(hidden)]
2933impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
2934    type PageItem = crate::model::Instance;
2935
2936    fn items(self) -> std::vec::Vec<Self::PageItem> {
2937        self.instances
2938    }
2939
2940    fn next_page_token(&self) -> std::string::String {
2941        use std::clone::Clone;
2942        self.next_page_token.clone()
2943    }
2944}
2945
2946#[doc(hidden)]
2947impl<'de> serde::de::Deserialize<'de> for ListInstancesResponse {
2948    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2949    where
2950        D: serde::Deserializer<'de>,
2951    {
2952        #[allow(non_camel_case_types)]
2953        #[doc(hidden)]
2954        #[derive(PartialEq, Eq, Hash)]
2955        enum __FieldTag {
2956            __instances,
2957            __next_page_token,
2958            __unreachable,
2959            Unknown(std::string::String),
2960        }
2961        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2962            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2963            where
2964                D: serde::Deserializer<'de>,
2965            {
2966                struct Visitor;
2967                impl<'de> serde::de::Visitor<'de> for Visitor {
2968                    type Value = __FieldTag;
2969                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2970                        formatter.write_str("a field name for ListInstancesResponse")
2971                    }
2972                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2973                    where
2974                        E: serde::de::Error,
2975                    {
2976                        use std::result::Result::Ok;
2977                        use std::string::ToString;
2978                        match value {
2979                            "instances" => Ok(__FieldTag::__instances),
2980                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2981                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2982                            "unreachable" => Ok(__FieldTag::__unreachable),
2983                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2984                        }
2985                    }
2986                }
2987                deserializer.deserialize_identifier(Visitor)
2988            }
2989        }
2990        struct Visitor;
2991        impl<'de> serde::de::Visitor<'de> for Visitor {
2992            type Value = ListInstancesResponse;
2993            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2994                formatter.write_str("struct ListInstancesResponse")
2995            }
2996            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2997            where
2998                A: serde::de::MapAccess<'de>,
2999            {
3000                #[allow(unused_imports)]
3001                use serde::de::Error;
3002                use std::option::Option::Some;
3003                let mut fields = std::collections::HashSet::new();
3004                let mut result = Self::Value::new();
3005                while let Some(tag) = map.next_key::<__FieldTag>()? {
3006                    #[allow(clippy::match_single_binding)]
3007                    match tag {
3008                        __FieldTag::__instances => {
3009                            if !fields.insert(__FieldTag::__instances) {
3010                                return std::result::Result::Err(A::Error::duplicate_field(
3011                                    "multiple values for instances",
3012                                ));
3013                            }
3014                            result.instances = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Instance>>>()?.unwrap_or_default();
3015                        }
3016                        __FieldTag::__next_page_token => {
3017                            if !fields.insert(__FieldTag::__next_page_token) {
3018                                return std::result::Result::Err(A::Error::duplicate_field(
3019                                    "multiple values for next_page_token",
3020                                ));
3021                            }
3022                            result.next_page_token = map
3023                                .next_value::<std::option::Option<std::string::String>>()?
3024                                .unwrap_or_default();
3025                        }
3026                        __FieldTag::__unreachable => {
3027                            if !fields.insert(__FieldTag::__unreachable) {
3028                                return std::result::Result::Err(A::Error::duplicate_field(
3029                                    "multiple values for unreachable",
3030                                ));
3031                            }
3032                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3033                        }
3034                        __FieldTag::Unknown(key) => {
3035                            let value = map.next_value::<serde_json::Value>()?;
3036                            result._unknown_fields.insert(key, value);
3037                        }
3038                    }
3039                }
3040                std::result::Result::Ok(result)
3041            }
3042        }
3043        deserializer.deserialize_any(Visitor)
3044    }
3045}
3046
3047#[doc(hidden)]
3048impl serde::ser::Serialize for ListInstancesResponse {
3049    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3050    where
3051        S: serde::ser::Serializer,
3052    {
3053        use serde::ser::SerializeMap;
3054        #[allow(unused_imports)]
3055        use std::option::Option::Some;
3056        let mut state = serializer.serialize_map(std::option::Option::None)?;
3057        if !self.instances.is_empty() {
3058            state.serialize_entry("instances", &self.instances)?;
3059        }
3060        if !self.next_page_token.is_empty() {
3061            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3062        }
3063        if !self.unreachable.is_empty() {
3064            state.serialize_entry("unreachable", &self.unreachable)?;
3065        }
3066        if !self._unknown_fields.is_empty() {
3067            for (key, value) in self._unknown_fields.iter() {
3068                state.serialize_entry(key, &value)?;
3069            }
3070        }
3071        state.end()
3072    }
3073}
3074
3075impl std::fmt::Debug for ListInstancesResponse {
3076    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3077        let mut debug_struct = f.debug_struct("ListInstancesResponse");
3078        debug_struct.field("instances", &self.instances);
3079        debug_struct.field("next_page_token", &self.next_page_token);
3080        debug_struct.field("unreachable", &self.unreachable);
3081        if !self._unknown_fields.is_empty() {
3082            debug_struct.field("_unknown_fields", &self._unknown_fields);
3083        }
3084        debug_struct.finish()
3085    }
3086}
3087
3088/// Request message for the list available versions request.
3089#[derive(Clone, Default, PartialEq)]
3090#[non_exhaustive]
3091pub struct ListAvailableVersionsRequest {
3092    /// Required. The project and location for which to retrieve instance information
3093    /// in the format projects/{project}/locations/{location}.
3094    pub parent: std::string::String,
3095
3096    /// The maximum number of items to return.
3097    pub page_size: i32,
3098
3099    /// The next_page_token value to use if there are additional
3100    /// results to retrieve for this list request.
3101    pub page_token: std::string::String,
3102
3103    /// Whether or not to return the latest patch of every available minor version.
3104    /// If true, only the latest patch will be returned. Ex. if allowed versions is
3105    /// [6.1.1, 6.1.2, 6.2.0] then response will be [6.1.2, 6.2.0]
3106    pub latest_patch_only: bool,
3107
3108    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3109}
3110
3111impl ListAvailableVersionsRequest {
3112    pub fn new() -> Self {
3113        std::default::Default::default()
3114    }
3115
3116    /// Sets the value of [parent][crate::model::ListAvailableVersionsRequest::parent].
3117    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3118        self.parent = v.into();
3119        self
3120    }
3121
3122    /// Sets the value of [page_size][crate::model::ListAvailableVersionsRequest::page_size].
3123    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3124        self.page_size = v.into();
3125        self
3126    }
3127
3128    /// Sets the value of [page_token][crate::model::ListAvailableVersionsRequest::page_token].
3129    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3130        self.page_token = v.into();
3131        self
3132    }
3133
3134    /// Sets the value of [latest_patch_only][crate::model::ListAvailableVersionsRequest::latest_patch_only].
3135    pub fn set_latest_patch_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3136        self.latest_patch_only = v.into();
3137        self
3138    }
3139}
3140
3141impl wkt::message::Message for ListAvailableVersionsRequest {
3142    fn typename() -> &'static str {
3143        "type.googleapis.com/google.cloud.datafusion.v1.ListAvailableVersionsRequest"
3144    }
3145}
3146
3147#[doc(hidden)]
3148impl<'de> serde::de::Deserialize<'de> for ListAvailableVersionsRequest {
3149    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3150    where
3151        D: serde::Deserializer<'de>,
3152    {
3153        #[allow(non_camel_case_types)]
3154        #[doc(hidden)]
3155        #[derive(PartialEq, Eq, Hash)]
3156        enum __FieldTag {
3157            __parent,
3158            __page_size,
3159            __page_token,
3160            __latest_patch_only,
3161            Unknown(std::string::String),
3162        }
3163        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3164            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3165            where
3166                D: serde::Deserializer<'de>,
3167            {
3168                struct Visitor;
3169                impl<'de> serde::de::Visitor<'de> for Visitor {
3170                    type Value = __FieldTag;
3171                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3172                        formatter.write_str("a field name for ListAvailableVersionsRequest")
3173                    }
3174                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3175                    where
3176                        E: serde::de::Error,
3177                    {
3178                        use std::result::Result::Ok;
3179                        use std::string::ToString;
3180                        match value {
3181                            "parent" => Ok(__FieldTag::__parent),
3182                            "pageSize" => Ok(__FieldTag::__page_size),
3183                            "page_size" => Ok(__FieldTag::__page_size),
3184                            "pageToken" => Ok(__FieldTag::__page_token),
3185                            "page_token" => Ok(__FieldTag::__page_token),
3186                            "latestPatchOnly" => Ok(__FieldTag::__latest_patch_only),
3187                            "latest_patch_only" => Ok(__FieldTag::__latest_patch_only),
3188                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3189                        }
3190                    }
3191                }
3192                deserializer.deserialize_identifier(Visitor)
3193            }
3194        }
3195        struct Visitor;
3196        impl<'de> serde::de::Visitor<'de> for Visitor {
3197            type Value = ListAvailableVersionsRequest;
3198            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3199                formatter.write_str("struct ListAvailableVersionsRequest")
3200            }
3201            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3202            where
3203                A: serde::de::MapAccess<'de>,
3204            {
3205                #[allow(unused_imports)]
3206                use serde::de::Error;
3207                use std::option::Option::Some;
3208                let mut fields = std::collections::HashSet::new();
3209                let mut result = Self::Value::new();
3210                while let Some(tag) = map.next_key::<__FieldTag>()? {
3211                    #[allow(clippy::match_single_binding)]
3212                    match tag {
3213                        __FieldTag::__parent => {
3214                            if !fields.insert(__FieldTag::__parent) {
3215                                return std::result::Result::Err(A::Error::duplicate_field(
3216                                    "multiple values for parent",
3217                                ));
3218                            }
3219                            result.parent = map
3220                                .next_value::<std::option::Option<std::string::String>>()?
3221                                .unwrap_or_default();
3222                        }
3223                        __FieldTag::__page_size => {
3224                            if !fields.insert(__FieldTag::__page_size) {
3225                                return std::result::Result::Err(A::Error::duplicate_field(
3226                                    "multiple values for page_size",
3227                                ));
3228                            }
3229                            struct __With(std::option::Option<i32>);
3230                            impl<'de> serde::de::Deserialize<'de> for __With {
3231                                fn deserialize<D>(
3232                                    deserializer: D,
3233                                ) -> std::result::Result<Self, D::Error>
3234                                where
3235                                    D: serde::de::Deserializer<'de>,
3236                                {
3237                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3238                                }
3239                            }
3240                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3241                        }
3242                        __FieldTag::__page_token => {
3243                            if !fields.insert(__FieldTag::__page_token) {
3244                                return std::result::Result::Err(A::Error::duplicate_field(
3245                                    "multiple values for page_token",
3246                                ));
3247                            }
3248                            result.page_token = map
3249                                .next_value::<std::option::Option<std::string::String>>()?
3250                                .unwrap_or_default();
3251                        }
3252                        __FieldTag::__latest_patch_only => {
3253                            if !fields.insert(__FieldTag::__latest_patch_only) {
3254                                return std::result::Result::Err(A::Error::duplicate_field(
3255                                    "multiple values for latest_patch_only",
3256                                ));
3257                            }
3258                            result.latest_patch_only = map
3259                                .next_value::<std::option::Option<bool>>()?
3260                                .unwrap_or_default();
3261                        }
3262                        __FieldTag::Unknown(key) => {
3263                            let value = map.next_value::<serde_json::Value>()?;
3264                            result._unknown_fields.insert(key, value);
3265                        }
3266                    }
3267                }
3268                std::result::Result::Ok(result)
3269            }
3270        }
3271        deserializer.deserialize_any(Visitor)
3272    }
3273}
3274
3275#[doc(hidden)]
3276impl serde::ser::Serialize for ListAvailableVersionsRequest {
3277    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3278    where
3279        S: serde::ser::Serializer,
3280    {
3281        use serde::ser::SerializeMap;
3282        #[allow(unused_imports)]
3283        use std::option::Option::Some;
3284        let mut state = serializer.serialize_map(std::option::Option::None)?;
3285        if !self.parent.is_empty() {
3286            state.serialize_entry("parent", &self.parent)?;
3287        }
3288        if !wkt::internal::is_default(&self.page_size) {
3289            struct __With<'a>(&'a i32);
3290            impl<'a> serde::ser::Serialize for __With<'a> {
3291                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3292                where
3293                    S: serde::ser::Serializer,
3294                {
3295                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3296                }
3297            }
3298            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3299        }
3300        if !self.page_token.is_empty() {
3301            state.serialize_entry("pageToken", &self.page_token)?;
3302        }
3303        if !wkt::internal::is_default(&self.latest_patch_only) {
3304            state.serialize_entry("latestPatchOnly", &self.latest_patch_only)?;
3305        }
3306        if !self._unknown_fields.is_empty() {
3307            for (key, value) in self._unknown_fields.iter() {
3308                state.serialize_entry(key, &value)?;
3309            }
3310        }
3311        state.end()
3312    }
3313}
3314
3315impl std::fmt::Debug for ListAvailableVersionsRequest {
3316    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3317        let mut debug_struct = f.debug_struct("ListAvailableVersionsRequest");
3318        debug_struct.field("parent", &self.parent);
3319        debug_struct.field("page_size", &self.page_size);
3320        debug_struct.field("page_token", &self.page_token);
3321        debug_struct.field("latest_patch_only", &self.latest_patch_only);
3322        if !self._unknown_fields.is_empty() {
3323            debug_struct.field("_unknown_fields", &self._unknown_fields);
3324        }
3325        debug_struct.finish()
3326    }
3327}
3328
3329/// Response message for the list available versions request.
3330#[derive(Clone, Default, PartialEq)]
3331#[non_exhaustive]
3332pub struct ListAvailableVersionsResponse {
3333    /// Represents a list of versions that are supported.
3334    pub available_versions: std::vec::Vec<crate::model::Version>,
3335
3336    /// Token to retrieve the next page of results or empty if there are no more
3337    /// results in the list.
3338    pub next_page_token: std::string::String,
3339
3340    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3341}
3342
3343impl ListAvailableVersionsResponse {
3344    pub fn new() -> Self {
3345        std::default::Default::default()
3346    }
3347
3348    /// Sets the value of [available_versions][crate::model::ListAvailableVersionsResponse::available_versions].
3349    pub fn set_available_versions<T, V>(mut self, v: T) -> Self
3350    where
3351        T: std::iter::IntoIterator<Item = V>,
3352        V: std::convert::Into<crate::model::Version>,
3353    {
3354        use std::iter::Iterator;
3355        self.available_versions = v.into_iter().map(|i| i.into()).collect();
3356        self
3357    }
3358
3359    /// Sets the value of [next_page_token][crate::model::ListAvailableVersionsResponse::next_page_token].
3360    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3361        self.next_page_token = v.into();
3362        self
3363    }
3364}
3365
3366impl wkt::message::Message for ListAvailableVersionsResponse {
3367    fn typename() -> &'static str {
3368        "type.googleapis.com/google.cloud.datafusion.v1.ListAvailableVersionsResponse"
3369    }
3370}
3371
3372#[doc(hidden)]
3373impl gax::paginator::internal::PageableResponse for ListAvailableVersionsResponse {
3374    type PageItem = crate::model::Version;
3375
3376    fn items(self) -> std::vec::Vec<Self::PageItem> {
3377        self.available_versions
3378    }
3379
3380    fn next_page_token(&self) -> std::string::String {
3381        use std::clone::Clone;
3382        self.next_page_token.clone()
3383    }
3384}
3385
3386#[doc(hidden)]
3387impl<'de> serde::de::Deserialize<'de> for ListAvailableVersionsResponse {
3388    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3389    where
3390        D: serde::Deserializer<'de>,
3391    {
3392        #[allow(non_camel_case_types)]
3393        #[doc(hidden)]
3394        #[derive(PartialEq, Eq, Hash)]
3395        enum __FieldTag {
3396            __available_versions,
3397            __next_page_token,
3398            Unknown(std::string::String),
3399        }
3400        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3401            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3402            where
3403                D: serde::Deserializer<'de>,
3404            {
3405                struct Visitor;
3406                impl<'de> serde::de::Visitor<'de> for Visitor {
3407                    type Value = __FieldTag;
3408                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3409                        formatter.write_str("a field name for ListAvailableVersionsResponse")
3410                    }
3411                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3412                    where
3413                        E: serde::de::Error,
3414                    {
3415                        use std::result::Result::Ok;
3416                        use std::string::ToString;
3417                        match value {
3418                            "availableVersions" => Ok(__FieldTag::__available_versions),
3419                            "available_versions" => Ok(__FieldTag::__available_versions),
3420                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3421                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3422                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3423                        }
3424                    }
3425                }
3426                deserializer.deserialize_identifier(Visitor)
3427            }
3428        }
3429        struct Visitor;
3430        impl<'de> serde::de::Visitor<'de> for Visitor {
3431            type Value = ListAvailableVersionsResponse;
3432            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3433                formatter.write_str("struct ListAvailableVersionsResponse")
3434            }
3435            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3436            where
3437                A: serde::de::MapAccess<'de>,
3438            {
3439                #[allow(unused_imports)]
3440                use serde::de::Error;
3441                use std::option::Option::Some;
3442                let mut fields = std::collections::HashSet::new();
3443                let mut result = Self::Value::new();
3444                while let Some(tag) = map.next_key::<__FieldTag>()? {
3445                    #[allow(clippy::match_single_binding)]
3446                    match tag {
3447                        __FieldTag::__available_versions => {
3448                            if !fields.insert(__FieldTag::__available_versions) {
3449                                return std::result::Result::Err(A::Error::duplicate_field(
3450                                    "multiple values for available_versions",
3451                                ));
3452                            }
3453                            result.available_versions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Version>>>()?.unwrap_or_default();
3454                        }
3455                        __FieldTag::__next_page_token => {
3456                            if !fields.insert(__FieldTag::__next_page_token) {
3457                                return std::result::Result::Err(A::Error::duplicate_field(
3458                                    "multiple values for next_page_token",
3459                                ));
3460                            }
3461                            result.next_page_token = map
3462                                .next_value::<std::option::Option<std::string::String>>()?
3463                                .unwrap_or_default();
3464                        }
3465                        __FieldTag::Unknown(key) => {
3466                            let value = map.next_value::<serde_json::Value>()?;
3467                            result._unknown_fields.insert(key, value);
3468                        }
3469                    }
3470                }
3471                std::result::Result::Ok(result)
3472            }
3473        }
3474        deserializer.deserialize_any(Visitor)
3475    }
3476}
3477
3478#[doc(hidden)]
3479impl serde::ser::Serialize for ListAvailableVersionsResponse {
3480    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3481    where
3482        S: serde::ser::Serializer,
3483    {
3484        use serde::ser::SerializeMap;
3485        #[allow(unused_imports)]
3486        use std::option::Option::Some;
3487        let mut state = serializer.serialize_map(std::option::Option::None)?;
3488        if !self.available_versions.is_empty() {
3489            state.serialize_entry("availableVersions", &self.available_versions)?;
3490        }
3491        if !self.next_page_token.is_empty() {
3492            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3493        }
3494        if !self._unknown_fields.is_empty() {
3495            for (key, value) in self._unknown_fields.iter() {
3496                state.serialize_entry(key, &value)?;
3497            }
3498        }
3499        state.end()
3500    }
3501}
3502
3503impl std::fmt::Debug for ListAvailableVersionsResponse {
3504    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3505        let mut debug_struct = f.debug_struct("ListAvailableVersionsResponse");
3506        debug_struct.field("available_versions", &self.available_versions);
3507        debug_struct.field("next_page_token", &self.next_page_token);
3508        if !self._unknown_fields.is_empty() {
3509            debug_struct.field("_unknown_fields", &self._unknown_fields);
3510        }
3511        debug_struct.finish()
3512    }
3513}
3514
3515/// Request message for getting details about a Data Fusion instance.
3516#[derive(Clone, Default, PartialEq)]
3517#[non_exhaustive]
3518pub struct GetInstanceRequest {
3519    /// Required. The instance resource name in the format
3520    /// projects/{project}/locations/{location}/instances/{instance}.
3521    pub name: std::string::String,
3522
3523    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3524}
3525
3526impl GetInstanceRequest {
3527    pub fn new() -> Self {
3528        std::default::Default::default()
3529    }
3530
3531    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3532    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3533        self.name = v.into();
3534        self
3535    }
3536}
3537
3538impl wkt::message::Message for GetInstanceRequest {
3539    fn typename() -> &'static str {
3540        "type.googleapis.com/google.cloud.datafusion.v1.GetInstanceRequest"
3541    }
3542}
3543
3544#[doc(hidden)]
3545impl<'de> serde::de::Deserialize<'de> for GetInstanceRequest {
3546    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3547    where
3548        D: serde::Deserializer<'de>,
3549    {
3550        #[allow(non_camel_case_types)]
3551        #[doc(hidden)]
3552        #[derive(PartialEq, Eq, Hash)]
3553        enum __FieldTag {
3554            __name,
3555            Unknown(std::string::String),
3556        }
3557        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3558            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3559            where
3560                D: serde::Deserializer<'de>,
3561            {
3562                struct Visitor;
3563                impl<'de> serde::de::Visitor<'de> for Visitor {
3564                    type Value = __FieldTag;
3565                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3566                        formatter.write_str("a field name for GetInstanceRequest")
3567                    }
3568                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3569                    where
3570                        E: serde::de::Error,
3571                    {
3572                        use std::result::Result::Ok;
3573                        use std::string::ToString;
3574                        match value {
3575                            "name" => Ok(__FieldTag::__name),
3576                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3577                        }
3578                    }
3579                }
3580                deserializer.deserialize_identifier(Visitor)
3581            }
3582        }
3583        struct Visitor;
3584        impl<'de> serde::de::Visitor<'de> for Visitor {
3585            type Value = GetInstanceRequest;
3586            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3587                formatter.write_str("struct GetInstanceRequest")
3588            }
3589            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3590            where
3591                A: serde::de::MapAccess<'de>,
3592            {
3593                #[allow(unused_imports)]
3594                use serde::de::Error;
3595                use std::option::Option::Some;
3596                let mut fields = std::collections::HashSet::new();
3597                let mut result = Self::Value::new();
3598                while let Some(tag) = map.next_key::<__FieldTag>()? {
3599                    #[allow(clippy::match_single_binding)]
3600                    match tag {
3601                        __FieldTag::__name => {
3602                            if !fields.insert(__FieldTag::__name) {
3603                                return std::result::Result::Err(A::Error::duplicate_field(
3604                                    "multiple values for name",
3605                                ));
3606                            }
3607                            result.name = map
3608                                .next_value::<std::option::Option<std::string::String>>()?
3609                                .unwrap_or_default();
3610                        }
3611                        __FieldTag::Unknown(key) => {
3612                            let value = map.next_value::<serde_json::Value>()?;
3613                            result._unknown_fields.insert(key, value);
3614                        }
3615                    }
3616                }
3617                std::result::Result::Ok(result)
3618            }
3619        }
3620        deserializer.deserialize_any(Visitor)
3621    }
3622}
3623
3624#[doc(hidden)]
3625impl serde::ser::Serialize for GetInstanceRequest {
3626    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3627    where
3628        S: serde::ser::Serializer,
3629    {
3630        use serde::ser::SerializeMap;
3631        #[allow(unused_imports)]
3632        use std::option::Option::Some;
3633        let mut state = serializer.serialize_map(std::option::Option::None)?;
3634        if !self.name.is_empty() {
3635            state.serialize_entry("name", &self.name)?;
3636        }
3637        if !self._unknown_fields.is_empty() {
3638            for (key, value) in self._unknown_fields.iter() {
3639                state.serialize_entry(key, &value)?;
3640            }
3641        }
3642        state.end()
3643    }
3644}
3645
3646impl std::fmt::Debug for GetInstanceRequest {
3647    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3648        let mut debug_struct = f.debug_struct("GetInstanceRequest");
3649        debug_struct.field("name", &self.name);
3650        if !self._unknown_fields.is_empty() {
3651            debug_struct.field("_unknown_fields", &self._unknown_fields);
3652        }
3653        debug_struct.finish()
3654    }
3655}
3656
3657/// Request message for creating a Data Fusion instance.
3658#[derive(Clone, Default, PartialEq)]
3659#[non_exhaustive]
3660pub struct CreateInstanceRequest {
3661    /// Required. The instance's project and location in the format
3662    /// projects/{project}/locations/{location}.
3663    pub parent: std::string::String,
3664
3665    /// Required. The name of the instance to create.
3666    pub instance_id: std::string::String,
3667
3668    /// An instance resource.
3669    pub instance: std::option::Option<crate::model::Instance>,
3670
3671    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3672}
3673
3674impl CreateInstanceRequest {
3675    pub fn new() -> Self {
3676        std::default::Default::default()
3677    }
3678
3679    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3680    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3681        self.parent = v.into();
3682        self
3683    }
3684
3685    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3686    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3687        self.instance_id = v.into();
3688        self
3689    }
3690
3691    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3692    pub fn set_instance<T>(mut self, v: T) -> Self
3693    where
3694        T: std::convert::Into<crate::model::Instance>,
3695    {
3696        self.instance = std::option::Option::Some(v.into());
3697        self
3698    }
3699
3700    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3701    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3702    where
3703        T: std::convert::Into<crate::model::Instance>,
3704    {
3705        self.instance = v.map(|x| x.into());
3706        self
3707    }
3708}
3709
3710impl wkt::message::Message for CreateInstanceRequest {
3711    fn typename() -> &'static str {
3712        "type.googleapis.com/google.cloud.datafusion.v1.CreateInstanceRequest"
3713    }
3714}
3715
3716#[doc(hidden)]
3717impl<'de> serde::de::Deserialize<'de> for CreateInstanceRequest {
3718    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3719    where
3720        D: serde::Deserializer<'de>,
3721    {
3722        #[allow(non_camel_case_types)]
3723        #[doc(hidden)]
3724        #[derive(PartialEq, Eq, Hash)]
3725        enum __FieldTag {
3726            __parent,
3727            __instance_id,
3728            __instance,
3729            Unknown(std::string::String),
3730        }
3731        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3732            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3733            where
3734                D: serde::Deserializer<'de>,
3735            {
3736                struct Visitor;
3737                impl<'de> serde::de::Visitor<'de> for Visitor {
3738                    type Value = __FieldTag;
3739                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3740                        formatter.write_str("a field name for CreateInstanceRequest")
3741                    }
3742                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3743                    where
3744                        E: serde::de::Error,
3745                    {
3746                        use std::result::Result::Ok;
3747                        use std::string::ToString;
3748                        match value {
3749                            "parent" => Ok(__FieldTag::__parent),
3750                            "instanceId" => Ok(__FieldTag::__instance_id),
3751                            "instance_id" => Ok(__FieldTag::__instance_id),
3752                            "instance" => Ok(__FieldTag::__instance),
3753                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3754                        }
3755                    }
3756                }
3757                deserializer.deserialize_identifier(Visitor)
3758            }
3759        }
3760        struct Visitor;
3761        impl<'de> serde::de::Visitor<'de> for Visitor {
3762            type Value = CreateInstanceRequest;
3763            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3764                formatter.write_str("struct CreateInstanceRequest")
3765            }
3766            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3767            where
3768                A: serde::de::MapAccess<'de>,
3769            {
3770                #[allow(unused_imports)]
3771                use serde::de::Error;
3772                use std::option::Option::Some;
3773                let mut fields = std::collections::HashSet::new();
3774                let mut result = Self::Value::new();
3775                while let Some(tag) = map.next_key::<__FieldTag>()? {
3776                    #[allow(clippy::match_single_binding)]
3777                    match tag {
3778                        __FieldTag::__parent => {
3779                            if !fields.insert(__FieldTag::__parent) {
3780                                return std::result::Result::Err(A::Error::duplicate_field(
3781                                    "multiple values for parent",
3782                                ));
3783                            }
3784                            result.parent = map
3785                                .next_value::<std::option::Option<std::string::String>>()?
3786                                .unwrap_or_default();
3787                        }
3788                        __FieldTag::__instance_id => {
3789                            if !fields.insert(__FieldTag::__instance_id) {
3790                                return std::result::Result::Err(A::Error::duplicate_field(
3791                                    "multiple values for instance_id",
3792                                ));
3793                            }
3794                            result.instance_id = map
3795                                .next_value::<std::option::Option<std::string::String>>()?
3796                                .unwrap_or_default();
3797                        }
3798                        __FieldTag::__instance => {
3799                            if !fields.insert(__FieldTag::__instance) {
3800                                return std::result::Result::Err(A::Error::duplicate_field(
3801                                    "multiple values for instance",
3802                                ));
3803                            }
3804                            result.instance =
3805                                map.next_value::<std::option::Option<crate::model::Instance>>()?;
3806                        }
3807                        __FieldTag::Unknown(key) => {
3808                            let value = map.next_value::<serde_json::Value>()?;
3809                            result._unknown_fields.insert(key, value);
3810                        }
3811                    }
3812                }
3813                std::result::Result::Ok(result)
3814            }
3815        }
3816        deserializer.deserialize_any(Visitor)
3817    }
3818}
3819
3820#[doc(hidden)]
3821impl serde::ser::Serialize for CreateInstanceRequest {
3822    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3823    where
3824        S: serde::ser::Serializer,
3825    {
3826        use serde::ser::SerializeMap;
3827        #[allow(unused_imports)]
3828        use std::option::Option::Some;
3829        let mut state = serializer.serialize_map(std::option::Option::None)?;
3830        if !self.parent.is_empty() {
3831            state.serialize_entry("parent", &self.parent)?;
3832        }
3833        if !self.instance_id.is_empty() {
3834            state.serialize_entry("instanceId", &self.instance_id)?;
3835        }
3836        if self.instance.is_some() {
3837            state.serialize_entry("instance", &self.instance)?;
3838        }
3839        if !self._unknown_fields.is_empty() {
3840            for (key, value) in self._unknown_fields.iter() {
3841                state.serialize_entry(key, &value)?;
3842            }
3843        }
3844        state.end()
3845    }
3846}
3847
3848impl std::fmt::Debug for CreateInstanceRequest {
3849    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3850        let mut debug_struct = f.debug_struct("CreateInstanceRequest");
3851        debug_struct.field("parent", &self.parent);
3852        debug_struct.field("instance_id", &self.instance_id);
3853        debug_struct.field("instance", &self.instance);
3854        if !self._unknown_fields.is_empty() {
3855            debug_struct.field("_unknown_fields", &self._unknown_fields);
3856        }
3857        debug_struct.finish()
3858    }
3859}
3860
3861/// Request message for deleting a Data Fusion instance.
3862#[derive(Clone, Default, PartialEq)]
3863#[non_exhaustive]
3864pub struct DeleteInstanceRequest {
3865    /// Required. The instance resource name in the format
3866    /// projects/{project}/locations/{location}/instances/{instance}
3867    pub name: std::string::String,
3868
3869    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3870}
3871
3872impl DeleteInstanceRequest {
3873    pub fn new() -> Self {
3874        std::default::Default::default()
3875    }
3876
3877    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3878    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3879        self.name = v.into();
3880        self
3881    }
3882}
3883
3884impl wkt::message::Message for DeleteInstanceRequest {
3885    fn typename() -> &'static str {
3886        "type.googleapis.com/google.cloud.datafusion.v1.DeleteInstanceRequest"
3887    }
3888}
3889
3890#[doc(hidden)]
3891impl<'de> serde::de::Deserialize<'de> for DeleteInstanceRequest {
3892    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3893    where
3894        D: serde::Deserializer<'de>,
3895    {
3896        #[allow(non_camel_case_types)]
3897        #[doc(hidden)]
3898        #[derive(PartialEq, Eq, Hash)]
3899        enum __FieldTag {
3900            __name,
3901            Unknown(std::string::String),
3902        }
3903        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3904            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3905            where
3906                D: serde::Deserializer<'de>,
3907            {
3908                struct Visitor;
3909                impl<'de> serde::de::Visitor<'de> for Visitor {
3910                    type Value = __FieldTag;
3911                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3912                        formatter.write_str("a field name for DeleteInstanceRequest")
3913                    }
3914                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3915                    where
3916                        E: serde::de::Error,
3917                    {
3918                        use std::result::Result::Ok;
3919                        use std::string::ToString;
3920                        match value {
3921                            "name" => Ok(__FieldTag::__name),
3922                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3923                        }
3924                    }
3925                }
3926                deserializer.deserialize_identifier(Visitor)
3927            }
3928        }
3929        struct Visitor;
3930        impl<'de> serde::de::Visitor<'de> for Visitor {
3931            type Value = DeleteInstanceRequest;
3932            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3933                formatter.write_str("struct DeleteInstanceRequest")
3934            }
3935            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3936            where
3937                A: serde::de::MapAccess<'de>,
3938            {
3939                #[allow(unused_imports)]
3940                use serde::de::Error;
3941                use std::option::Option::Some;
3942                let mut fields = std::collections::HashSet::new();
3943                let mut result = Self::Value::new();
3944                while let Some(tag) = map.next_key::<__FieldTag>()? {
3945                    #[allow(clippy::match_single_binding)]
3946                    match tag {
3947                        __FieldTag::__name => {
3948                            if !fields.insert(__FieldTag::__name) {
3949                                return std::result::Result::Err(A::Error::duplicate_field(
3950                                    "multiple values for name",
3951                                ));
3952                            }
3953                            result.name = map
3954                                .next_value::<std::option::Option<std::string::String>>()?
3955                                .unwrap_or_default();
3956                        }
3957                        __FieldTag::Unknown(key) => {
3958                            let value = map.next_value::<serde_json::Value>()?;
3959                            result._unknown_fields.insert(key, value);
3960                        }
3961                    }
3962                }
3963                std::result::Result::Ok(result)
3964            }
3965        }
3966        deserializer.deserialize_any(Visitor)
3967    }
3968}
3969
3970#[doc(hidden)]
3971impl serde::ser::Serialize for DeleteInstanceRequest {
3972    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3973    where
3974        S: serde::ser::Serializer,
3975    {
3976        use serde::ser::SerializeMap;
3977        #[allow(unused_imports)]
3978        use std::option::Option::Some;
3979        let mut state = serializer.serialize_map(std::option::Option::None)?;
3980        if !self.name.is_empty() {
3981            state.serialize_entry("name", &self.name)?;
3982        }
3983        if !self._unknown_fields.is_empty() {
3984            for (key, value) in self._unknown_fields.iter() {
3985                state.serialize_entry(key, &value)?;
3986            }
3987        }
3988        state.end()
3989    }
3990}
3991
3992impl std::fmt::Debug for DeleteInstanceRequest {
3993    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3994        let mut debug_struct = f.debug_struct("DeleteInstanceRequest");
3995        debug_struct.field("name", &self.name);
3996        if !self._unknown_fields.is_empty() {
3997            debug_struct.field("_unknown_fields", &self._unknown_fields);
3998        }
3999        debug_struct.finish()
4000    }
4001}
4002
4003/// Request message for updating a Data Fusion instance.
4004/// Data Fusion allows updating the labels, options, and stack driver settings.
4005/// This is also used for CDF version upgrade.
4006#[derive(Clone, Default, PartialEq)]
4007#[non_exhaustive]
4008pub struct UpdateInstanceRequest {
4009    /// Required. The instance resource that replaces the resource on the server. Currently,
4010    /// Data Fusion only allows replacing labels, options, and stack driver
4011    /// settings. All other fields will be ignored.
4012    pub instance: std::option::Option<crate::model::Instance>,
4013
4014    /// Field mask is used to specify the fields that the update will overwrite
4015    /// in an instance resource. The fields specified in the update_mask are
4016    /// relative to the resource, not the full request.
4017    /// A field will be overwritten if it is in the mask.
4018    /// If the user does not provide a mask, all the supported fields (labels,
4019    /// options, and version currently) will be overwritten.
4020    pub update_mask: std::option::Option<wkt::FieldMask>,
4021
4022    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4023}
4024
4025impl UpdateInstanceRequest {
4026    pub fn new() -> Self {
4027        std::default::Default::default()
4028    }
4029
4030    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
4031    pub fn set_instance<T>(mut self, v: T) -> Self
4032    where
4033        T: std::convert::Into<crate::model::Instance>,
4034    {
4035        self.instance = std::option::Option::Some(v.into());
4036        self
4037    }
4038
4039    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
4040    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4041    where
4042        T: std::convert::Into<crate::model::Instance>,
4043    {
4044        self.instance = v.map(|x| x.into());
4045        self
4046    }
4047
4048    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
4049    pub fn set_update_mask<T>(mut self, v: T) -> Self
4050    where
4051        T: std::convert::Into<wkt::FieldMask>,
4052    {
4053        self.update_mask = std::option::Option::Some(v.into());
4054        self
4055    }
4056
4057    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
4058    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4059    where
4060        T: std::convert::Into<wkt::FieldMask>,
4061    {
4062        self.update_mask = v.map(|x| x.into());
4063        self
4064    }
4065}
4066
4067impl wkt::message::Message for UpdateInstanceRequest {
4068    fn typename() -> &'static str {
4069        "type.googleapis.com/google.cloud.datafusion.v1.UpdateInstanceRequest"
4070    }
4071}
4072
4073#[doc(hidden)]
4074impl<'de> serde::de::Deserialize<'de> for UpdateInstanceRequest {
4075    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4076    where
4077        D: serde::Deserializer<'de>,
4078    {
4079        #[allow(non_camel_case_types)]
4080        #[doc(hidden)]
4081        #[derive(PartialEq, Eq, Hash)]
4082        enum __FieldTag {
4083            __instance,
4084            __update_mask,
4085            Unknown(std::string::String),
4086        }
4087        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4088            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4089            where
4090                D: serde::Deserializer<'de>,
4091            {
4092                struct Visitor;
4093                impl<'de> serde::de::Visitor<'de> for Visitor {
4094                    type Value = __FieldTag;
4095                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4096                        formatter.write_str("a field name for UpdateInstanceRequest")
4097                    }
4098                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4099                    where
4100                        E: serde::de::Error,
4101                    {
4102                        use std::result::Result::Ok;
4103                        use std::string::ToString;
4104                        match value {
4105                            "instance" => Ok(__FieldTag::__instance),
4106                            "updateMask" => Ok(__FieldTag::__update_mask),
4107                            "update_mask" => Ok(__FieldTag::__update_mask),
4108                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4109                        }
4110                    }
4111                }
4112                deserializer.deserialize_identifier(Visitor)
4113            }
4114        }
4115        struct Visitor;
4116        impl<'de> serde::de::Visitor<'de> for Visitor {
4117            type Value = UpdateInstanceRequest;
4118            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4119                formatter.write_str("struct UpdateInstanceRequest")
4120            }
4121            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4122            where
4123                A: serde::de::MapAccess<'de>,
4124            {
4125                #[allow(unused_imports)]
4126                use serde::de::Error;
4127                use std::option::Option::Some;
4128                let mut fields = std::collections::HashSet::new();
4129                let mut result = Self::Value::new();
4130                while let Some(tag) = map.next_key::<__FieldTag>()? {
4131                    #[allow(clippy::match_single_binding)]
4132                    match tag {
4133                        __FieldTag::__instance => {
4134                            if !fields.insert(__FieldTag::__instance) {
4135                                return std::result::Result::Err(A::Error::duplicate_field(
4136                                    "multiple values for instance",
4137                                ));
4138                            }
4139                            result.instance =
4140                                map.next_value::<std::option::Option<crate::model::Instance>>()?;
4141                        }
4142                        __FieldTag::__update_mask => {
4143                            if !fields.insert(__FieldTag::__update_mask) {
4144                                return std::result::Result::Err(A::Error::duplicate_field(
4145                                    "multiple values for update_mask",
4146                                ));
4147                            }
4148                            result.update_mask =
4149                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
4150                        }
4151                        __FieldTag::Unknown(key) => {
4152                            let value = map.next_value::<serde_json::Value>()?;
4153                            result._unknown_fields.insert(key, value);
4154                        }
4155                    }
4156                }
4157                std::result::Result::Ok(result)
4158            }
4159        }
4160        deserializer.deserialize_any(Visitor)
4161    }
4162}
4163
4164#[doc(hidden)]
4165impl serde::ser::Serialize for UpdateInstanceRequest {
4166    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4167    where
4168        S: serde::ser::Serializer,
4169    {
4170        use serde::ser::SerializeMap;
4171        #[allow(unused_imports)]
4172        use std::option::Option::Some;
4173        let mut state = serializer.serialize_map(std::option::Option::None)?;
4174        if self.instance.is_some() {
4175            state.serialize_entry("instance", &self.instance)?;
4176        }
4177        if self.update_mask.is_some() {
4178            state.serialize_entry("updateMask", &self.update_mask)?;
4179        }
4180        if !self._unknown_fields.is_empty() {
4181            for (key, value) in self._unknown_fields.iter() {
4182                state.serialize_entry(key, &value)?;
4183            }
4184        }
4185        state.end()
4186    }
4187}
4188
4189impl std::fmt::Debug for UpdateInstanceRequest {
4190    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4191        let mut debug_struct = f.debug_struct("UpdateInstanceRequest");
4192        debug_struct.field("instance", &self.instance);
4193        debug_struct.field("update_mask", &self.update_mask);
4194        if !self._unknown_fields.is_empty() {
4195            debug_struct.field("_unknown_fields", &self._unknown_fields);
4196        }
4197        debug_struct.finish()
4198    }
4199}
4200
4201/// Request message for restarting a Data Fusion instance.
4202#[derive(Clone, Default, PartialEq)]
4203#[non_exhaustive]
4204pub struct RestartInstanceRequest {
4205    /// Required. Name of the Data Fusion instance which need to be restarted in the form of
4206    /// projects/{project}/locations/{location}/instances/{instance}
4207    pub name: std::string::String,
4208
4209    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4210}
4211
4212impl RestartInstanceRequest {
4213    pub fn new() -> Self {
4214        std::default::Default::default()
4215    }
4216
4217    /// Sets the value of [name][crate::model::RestartInstanceRequest::name].
4218    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4219        self.name = v.into();
4220        self
4221    }
4222}
4223
4224impl wkt::message::Message for RestartInstanceRequest {
4225    fn typename() -> &'static str {
4226        "type.googleapis.com/google.cloud.datafusion.v1.RestartInstanceRequest"
4227    }
4228}
4229
4230#[doc(hidden)]
4231impl<'de> serde::de::Deserialize<'de> for RestartInstanceRequest {
4232    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4233    where
4234        D: serde::Deserializer<'de>,
4235    {
4236        #[allow(non_camel_case_types)]
4237        #[doc(hidden)]
4238        #[derive(PartialEq, Eq, Hash)]
4239        enum __FieldTag {
4240            __name,
4241            Unknown(std::string::String),
4242        }
4243        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4244            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4245            where
4246                D: serde::Deserializer<'de>,
4247            {
4248                struct Visitor;
4249                impl<'de> serde::de::Visitor<'de> for Visitor {
4250                    type Value = __FieldTag;
4251                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4252                        formatter.write_str("a field name for RestartInstanceRequest")
4253                    }
4254                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4255                    where
4256                        E: serde::de::Error,
4257                    {
4258                        use std::result::Result::Ok;
4259                        use std::string::ToString;
4260                        match value {
4261                            "name" => Ok(__FieldTag::__name),
4262                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4263                        }
4264                    }
4265                }
4266                deserializer.deserialize_identifier(Visitor)
4267            }
4268        }
4269        struct Visitor;
4270        impl<'de> serde::de::Visitor<'de> for Visitor {
4271            type Value = RestartInstanceRequest;
4272            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4273                formatter.write_str("struct RestartInstanceRequest")
4274            }
4275            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4276            where
4277                A: serde::de::MapAccess<'de>,
4278            {
4279                #[allow(unused_imports)]
4280                use serde::de::Error;
4281                use std::option::Option::Some;
4282                let mut fields = std::collections::HashSet::new();
4283                let mut result = Self::Value::new();
4284                while let Some(tag) = map.next_key::<__FieldTag>()? {
4285                    #[allow(clippy::match_single_binding)]
4286                    match tag {
4287                        __FieldTag::__name => {
4288                            if !fields.insert(__FieldTag::__name) {
4289                                return std::result::Result::Err(A::Error::duplicate_field(
4290                                    "multiple values for name",
4291                                ));
4292                            }
4293                            result.name = map
4294                                .next_value::<std::option::Option<std::string::String>>()?
4295                                .unwrap_or_default();
4296                        }
4297                        __FieldTag::Unknown(key) => {
4298                            let value = map.next_value::<serde_json::Value>()?;
4299                            result._unknown_fields.insert(key, value);
4300                        }
4301                    }
4302                }
4303                std::result::Result::Ok(result)
4304            }
4305        }
4306        deserializer.deserialize_any(Visitor)
4307    }
4308}
4309
4310#[doc(hidden)]
4311impl serde::ser::Serialize for RestartInstanceRequest {
4312    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4313    where
4314        S: serde::ser::Serializer,
4315    {
4316        use serde::ser::SerializeMap;
4317        #[allow(unused_imports)]
4318        use std::option::Option::Some;
4319        let mut state = serializer.serialize_map(std::option::Option::None)?;
4320        if !self.name.is_empty() {
4321            state.serialize_entry("name", &self.name)?;
4322        }
4323        if !self._unknown_fields.is_empty() {
4324            for (key, value) in self._unknown_fields.iter() {
4325                state.serialize_entry(key, &value)?;
4326            }
4327        }
4328        state.end()
4329    }
4330}
4331
4332impl std::fmt::Debug for RestartInstanceRequest {
4333    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4334        let mut debug_struct = f.debug_struct("RestartInstanceRequest");
4335        debug_struct.field("name", &self.name);
4336        if !self._unknown_fields.is_empty() {
4337            debug_struct.field("_unknown_fields", &self._unknown_fields);
4338        }
4339        debug_struct.finish()
4340    }
4341}
4342
4343/// Represents the metadata of a long-running operation.
4344#[derive(Clone, Default, PartialEq)]
4345#[non_exhaustive]
4346pub struct OperationMetadata {
4347    /// The time the operation was created.
4348    pub create_time: std::option::Option<wkt::Timestamp>,
4349
4350    /// The time the operation finished running.
4351    pub end_time: std::option::Option<wkt::Timestamp>,
4352
4353    /// Server-defined resource path for the target of the operation.
4354    pub target: std::string::String,
4355
4356    /// Name of the verb executed by the operation.
4357    pub verb: std::string::String,
4358
4359    /// Human-readable status of the operation if any.
4360    pub status_detail: std::string::String,
4361
4362    /// Identifies whether the user has requested cancellation
4363    /// of the operation. Operations that have successfully been cancelled
4364    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
4365    /// corresponding to `Code.CANCELLED`.
4366    ///
4367    /// [google.rpc.Status.code]: rpc::model::Status::code
4368    pub requested_cancellation: bool,
4369
4370    /// API version used to start the operation.
4371    pub api_version: std::string::String,
4372
4373    /// Map to hold any additional status info for the operation
4374    /// If there is an accelerator being enabled/disabled/deleted, this will be
4375    /// populated with accelerator name as key and status as
4376    /// ENABLING, DISABLING or DELETING
4377    pub additional_status: std::collections::HashMap<std::string::String, std::string::String>,
4378
4379    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4380}
4381
4382impl OperationMetadata {
4383    pub fn new() -> Self {
4384        std::default::Default::default()
4385    }
4386
4387    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
4388    pub fn set_create_time<T>(mut self, v: T) -> Self
4389    where
4390        T: std::convert::Into<wkt::Timestamp>,
4391    {
4392        self.create_time = std::option::Option::Some(v.into());
4393        self
4394    }
4395
4396    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
4397    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4398    where
4399        T: std::convert::Into<wkt::Timestamp>,
4400    {
4401        self.create_time = v.map(|x| x.into());
4402        self
4403    }
4404
4405    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
4406    pub fn set_end_time<T>(mut self, v: T) -> Self
4407    where
4408        T: std::convert::Into<wkt::Timestamp>,
4409    {
4410        self.end_time = std::option::Option::Some(v.into());
4411        self
4412    }
4413
4414    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
4415    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4416    where
4417        T: std::convert::Into<wkt::Timestamp>,
4418    {
4419        self.end_time = v.map(|x| x.into());
4420        self
4421    }
4422
4423    /// Sets the value of [target][crate::model::OperationMetadata::target].
4424    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4425        self.target = v.into();
4426        self
4427    }
4428
4429    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
4430    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4431        self.verb = v.into();
4432        self
4433    }
4434
4435    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
4436    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4437        self.status_detail = v.into();
4438        self
4439    }
4440
4441    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
4442    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4443        self.requested_cancellation = v.into();
4444        self
4445    }
4446
4447    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
4448    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4449        self.api_version = v.into();
4450        self
4451    }
4452
4453    /// Sets the value of [additional_status][crate::model::OperationMetadata::additional_status].
4454    pub fn set_additional_status<T, K, V>(mut self, v: T) -> Self
4455    where
4456        T: std::iter::IntoIterator<Item = (K, V)>,
4457        K: std::convert::Into<std::string::String>,
4458        V: std::convert::Into<std::string::String>,
4459    {
4460        use std::iter::Iterator;
4461        self.additional_status = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4462        self
4463    }
4464}
4465
4466impl wkt::message::Message for OperationMetadata {
4467    fn typename() -> &'static str {
4468        "type.googleapis.com/google.cloud.datafusion.v1.OperationMetadata"
4469    }
4470}
4471
4472#[doc(hidden)]
4473impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
4474    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4475    where
4476        D: serde::Deserializer<'de>,
4477    {
4478        #[allow(non_camel_case_types)]
4479        #[doc(hidden)]
4480        #[derive(PartialEq, Eq, Hash)]
4481        enum __FieldTag {
4482            __create_time,
4483            __end_time,
4484            __target,
4485            __verb,
4486            __status_detail,
4487            __requested_cancellation,
4488            __api_version,
4489            __additional_status,
4490            Unknown(std::string::String),
4491        }
4492        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4493            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4494            where
4495                D: serde::Deserializer<'de>,
4496            {
4497                struct Visitor;
4498                impl<'de> serde::de::Visitor<'de> for Visitor {
4499                    type Value = __FieldTag;
4500                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4501                        formatter.write_str("a field name for OperationMetadata")
4502                    }
4503                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4504                    where
4505                        E: serde::de::Error,
4506                    {
4507                        use std::result::Result::Ok;
4508                        use std::string::ToString;
4509                        match value {
4510                            "createTime" => Ok(__FieldTag::__create_time),
4511                            "create_time" => Ok(__FieldTag::__create_time),
4512                            "endTime" => Ok(__FieldTag::__end_time),
4513                            "end_time" => Ok(__FieldTag::__end_time),
4514                            "target" => Ok(__FieldTag::__target),
4515                            "verb" => Ok(__FieldTag::__verb),
4516                            "statusDetail" => Ok(__FieldTag::__status_detail),
4517                            "status_detail" => Ok(__FieldTag::__status_detail),
4518                            "requestedCancellation" => Ok(__FieldTag::__requested_cancellation),
4519                            "requested_cancellation" => Ok(__FieldTag::__requested_cancellation),
4520                            "apiVersion" => Ok(__FieldTag::__api_version),
4521                            "api_version" => Ok(__FieldTag::__api_version),
4522                            "additionalStatus" => Ok(__FieldTag::__additional_status),
4523                            "additional_status" => Ok(__FieldTag::__additional_status),
4524                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4525                        }
4526                    }
4527                }
4528                deserializer.deserialize_identifier(Visitor)
4529            }
4530        }
4531        struct Visitor;
4532        impl<'de> serde::de::Visitor<'de> for Visitor {
4533            type Value = OperationMetadata;
4534            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4535                formatter.write_str("struct OperationMetadata")
4536            }
4537            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4538            where
4539                A: serde::de::MapAccess<'de>,
4540            {
4541                #[allow(unused_imports)]
4542                use serde::de::Error;
4543                use std::option::Option::Some;
4544                let mut fields = std::collections::HashSet::new();
4545                let mut result = Self::Value::new();
4546                while let Some(tag) = map.next_key::<__FieldTag>()? {
4547                    #[allow(clippy::match_single_binding)]
4548                    match tag {
4549                        __FieldTag::__create_time => {
4550                            if !fields.insert(__FieldTag::__create_time) {
4551                                return std::result::Result::Err(A::Error::duplicate_field(
4552                                    "multiple values for create_time",
4553                                ));
4554                            }
4555                            result.create_time =
4556                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4557                        }
4558                        __FieldTag::__end_time => {
4559                            if !fields.insert(__FieldTag::__end_time) {
4560                                return std::result::Result::Err(A::Error::duplicate_field(
4561                                    "multiple values for end_time",
4562                                ));
4563                            }
4564                            result.end_time =
4565                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4566                        }
4567                        __FieldTag::__target => {
4568                            if !fields.insert(__FieldTag::__target) {
4569                                return std::result::Result::Err(A::Error::duplicate_field(
4570                                    "multiple values for target",
4571                                ));
4572                            }
4573                            result.target = map
4574                                .next_value::<std::option::Option<std::string::String>>()?
4575                                .unwrap_or_default();
4576                        }
4577                        __FieldTag::__verb => {
4578                            if !fields.insert(__FieldTag::__verb) {
4579                                return std::result::Result::Err(A::Error::duplicate_field(
4580                                    "multiple values for verb",
4581                                ));
4582                            }
4583                            result.verb = map
4584                                .next_value::<std::option::Option<std::string::String>>()?
4585                                .unwrap_or_default();
4586                        }
4587                        __FieldTag::__status_detail => {
4588                            if !fields.insert(__FieldTag::__status_detail) {
4589                                return std::result::Result::Err(A::Error::duplicate_field(
4590                                    "multiple values for status_detail",
4591                                ));
4592                            }
4593                            result.status_detail = map
4594                                .next_value::<std::option::Option<std::string::String>>()?
4595                                .unwrap_or_default();
4596                        }
4597                        __FieldTag::__requested_cancellation => {
4598                            if !fields.insert(__FieldTag::__requested_cancellation) {
4599                                return std::result::Result::Err(A::Error::duplicate_field(
4600                                    "multiple values for requested_cancellation",
4601                                ));
4602                            }
4603                            result.requested_cancellation = map
4604                                .next_value::<std::option::Option<bool>>()?
4605                                .unwrap_or_default();
4606                        }
4607                        __FieldTag::__api_version => {
4608                            if !fields.insert(__FieldTag::__api_version) {
4609                                return std::result::Result::Err(A::Error::duplicate_field(
4610                                    "multiple values for api_version",
4611                                ));
4612                            }
4613                            result.api_version = map
4614                                .next_value::<std::option::Option<std::string::String>>()?
4615                                .unwrap_or_default();
4616                        }
4617                        __FieldTag::__additional_status => {
4618                            if !fields.insert(__FieldTag::__additional_status) {
4619                                return std::result::Result::Err(A::Error::duplicate_field(
4620                                    "multiple values for additional_status",
4621                                ));
4622                            }
4623                            result.additional_status = map
4624                                .next_value::<std::option::Option<
4625                                    std::collections::HashMap<
4626                                        std::string::String,
4627                                        std::string::String,
4628                                    >,
4629                                >>()?
4630                                .unwrap_or_default();
4631                        }
4632                        __FieldTag::Unknown(key) => {
4633                            let value = map.next_value::<serde_json::Value>()?;
4634                            result._unknown_fields.insert(key, value);
4635                        }
4636                    }
4637                }
4638                std::result::Result::Ok(result)
4639            }
4640        }
4641        deserializer.deserialize_any(Visitor)
4642    }
4643}
4644
4645#[doc(hidden)]
4646impl serde::ser::Serialize for OperationMetadata {
4647    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4648    where
4649        S: serde::ser::Serializer,
4650    {
4651        use serde::ser::SerializeMap;
4652        #[allow(unused_imports)]
4653        use std::option::Option::Some;
4654        let mut state = serializer.serialize_map(std::option::Option::None)?;
4655        if self.create_time.is_some() {
4656            state.serialize_entry("createTime", &self.create_time)?;
4657        }
4658        if self.end_time.is_some() {
4659            state.serialize_entry("endTime", &self.end_time)?;
4660        }
4661        if !self.target.is_empty() {
4662            state.serialize_entry("target", &self.target)?;
4663        }
4664        if !self.verb.is_empty() {
4665            state.serialize_entry("verb", &self.verb)?;
4666        }
4667        if !self.status_detail.is_empty() {
4668            state.serialize_entry("statusDetail", &self.status_detail)?;
4669        }
4670        if !wkt::internal::is_default(&self.requested_cancellation) {
4671            state.serialize_entry("requestedCancellation", &self.requested_cancellation)?;
4672        }
4673        if !self.api_version.is_empty() {
4674            state.serialize_entry("apiVersion", &self.api_version)?;
4675        }
4676        if !self.additional_status.is_empty() {
4677            state.serialize_entry("additionalStatus", &self.additional_status)?;
4678        }
4679        if !self._unknown_fields.is_empty() {
4680            for (key, value) in self._unknown_fields.iter() {
4681                state.serialize_entry(key, &value)?;
4682            }
4683        }
4684        state.end()
4685    }
4686}
4687
4688impl std::fmt::Debug for OperationMetadata {
4689    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4690        let mut debug_struct = f.debug_struct("OperationMetadata");
4691        debug_struct.field("create_time", &self.create_time);
4692        debug_struct.field("end_time", &self.end_time);
4693        debug_struct.field("target", &self.target);
4694        debug_struct.field("verb", &self.verb);
4695        debug_struct.field("status_detail", &self.status_detail);
4696        debug_struct.field("requested_cancellation", &self.requested_cancellation);
4697        debug_struct.field("api_version", &self.api_version);
4698        debug_struct.field("additional_status", &self.additional_status);
4699        if !self._unknown_fields.is_empty() {
4700            debug_struct.field("_unknown_fields", &self._unknown_fields);
4701        }
4702        debug_struct.finish()
4703    }
4704}