google_cloud_bigquery_datatransfer_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 location;
26extern crate reqwest;
27extern crate rpc;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35/// A parameter used to define custom fields in a data source definition.
36#[derive(Clone, Debug, Default, PartialEq)]
37#[non_exhaustive]
38pub struct DataSourceParameter {
39    /// Parameter identifier.
40    pub param_id: std::string::String,
41
42    /// Parameter display name in the user interface.
43    pub display_name: std::string::String,
44
45    /// Parameter description.
46    pub description: std::string::String,
47
48    /// Parameter type.
49    pub r#type: crate::model::data_source_parameter::Type,
50
51    /// Is parameter required.
52    pub required: bool,
53
54    /// Deprecated. This field has no effect.
55    pub repeated: bool,
56
57    /// Regular expression which can be used for parameter validation.
58    pub validation_regex: std::string::String,
59
60    /// All possible values for the parameter.
61    pub allowed_values: std::vec::Vec<std::string::String>,
62
63    /// For integer and double values specifies minimum allowed value.
64    pub min_value: std::option::Option<wkt::DoubleValue>,
65
66    /// For integer and double values specifies maximum allowed value.
67    pub max_value: std::option::Option<wkt::DoubleValue>,
68
69    /// Deprecated. This field has no effect.
70    pub fields: std::vec::Vec<crate::model::DataSourceParameter>,
71
72    /// Description of the requirements for this field, in case the user input does
73    /// not fulfill the regex pattern or min/max values.
74    pub validation_description: std::string::String,
75
76    /// URL to a help document to further explain the naming requirements.
77    pub validation_help_url: std::string::String,
78
79    /// Cannot be changed after initial creation.
80    pub immutable: bool,
81
82    /// Deprecated. This field has no effect.
83    pub recurse: bool,
84
85    /// If true, it should not be used in new transfers, and it should not be
86    /// visible to users.
87    pub deprecated: bool,
88
89    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
90}
91
92impl DataSourceParameter {
93    pub fn new() -> Self {
94        std::default::Default::default()
95    }
96
97    /// Sets the value of [param_id][crate::model::DataSourceParameter::param_id].
98    pub fn set_param_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
99        self.param_id = v.into();
100        self
101    }
102
103    /// Sets the value of [display_name][crate::model::DataSourceParameter::display_name].
104    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
105        self.display_name = v.into();
106        self
107    }
108
109    /// Sets the value of [description][crate::model::DataSourceParameter::description].
110    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
111        self.description = v.into();
112        self
113    }
114
115    /// Sets the value of [r#type][crate::model::DataSourceParameter::type].
116    pub fn set_type<T: std::convert::Into<crate::model::data_source_parameter::Type>>(
117        mut self,
118        v: T,
119    ) -> Self {
120        self.r#type = v.into();
121        self
122    }
123
124    /// Sets the value of [required][crate::model::DataSourceParameter::required].
125    pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
126        self.required = v.into();
127        self
128    }
129
130    /// Sets the value of [repeated][crate::model::DataSourceParameter::repeated].
131    pub fn set_repeated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
132        self.repeated = v.into();
133        self
134    }
135
136    /// Sets the value of [validation_regex][crate::model::DataSourceParameter::validation_regex].
137    pub fn set_validation_regex<T: std::convert::Into<std::string::String>>(
138        mut self,
139        v: T,
140    ) -> Self {
141        self.validation_regex = v.into();
142        self
143    }
144
145    /// Sets the value of [allowed_values][crate::model::DataSourceParameter::allowed_values].
146    pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
147    where
148        T: std::iter::IntoIterator<Item = V>,
149        V: std::convert::Into<std::string::String>,
150    {
151        use std::iter::Iterator;
152        self.allowed_values = v.into_iter().map(|i| i.into()).collect();
153        self
154    }
155
156    /// Sets the value of [min_value][crate::model::DataSourceParameter::min_value].
157    pub fn set_min_value<T>(mut self, v: T) -> Self
158    where
159        T: std::convert::Into<wkt::DoubleValue>,
160    {
161        self.min_value = std::option::Option::Some(v.into());
162        self
163    }
164
165    /// Sets or clears the value of [min_value][crate::model::DataSourceParameter::min_value].
166    pub fn set_or_clear_min_value<T>(mut self, v: std::option::Option<T>) -> Self
167    where
168        T: std::convert::Into<wkt::DoubleValue>,
169    {
170        self.min_value = v.map(|x| x.into());
171        self
172    }
173
174    /// Sets the value of [max_value][crate::model::DataSourceParameter::max_value].
175    pub fn set_max_value<T>(mut self, v: T) -> Self
176    where
177        T: std::convert::Into<wkt::DoubleValue>,
178    {
179        self.max_value = std::option::Option::Some(v.into());
180        self
181    }
182
183    /// Sets or clears the value of [max_value][crate::model::DataSourceParameter::max_value].
184    pub fn set_or_clear_max_value<T>(mut self, v: std::option::Option<T>) -> Self
185    where
186        T: std::convert::Into<wkt::DoubleValue>,
187    {
188        self.max_value = v.map(|x| x.into());
189        self
190    }
191
192    /// Sets the value of [fields][crate::model::DataSourceParameter::fields].
193    pub fn set_fields<T, V>(mut self, v: T) -> Self
194    where
195        T: std::iter::IntoIterator<Item = V>,
196        V: std::convert::Into<crate::model::DataSourceParameter>,
197    {
198        use std::iter::Iterator;
199        self.fields = v.into_iter().map(|i| i.into()).collect();
200        self
201    }
202
203    /// Sets the value of [validation_description][crate::model::DataSourceParameter::validation_description].
204    pub fn set_validation_description<T: std::convert::Into<std::string::String>>(
205        mut self,
206        v: T,
207    ) -> Self {
208        self.validation_description = v.into();
209        self
210    }
211
212    /// Sets the value of [validation_help_url][crate::model::DataSourceParameter::validation_help_url].
213    pub fn set_validation_help_url<T: std::convert::Into<std::string::String>>(
214        mut self,
215        v: T,
216    ) -> Self {
217        self.validation_help_url = v.into();
218        self
219    }
220
221    /// Sets the value of [immutable][crate::model::DataSourceParameter::immutable].
222    pub fn set_immutable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
223        self.immutable = v.into();
224        self
225    }
226
227    /// Sets the value of [recurse][crate::model::DataSourceParameter::recurse].
228    pub fn set_recurse<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
229        self.recurse = v.into();
230        self
231    }
232
233    /// Sets the value of [deprecated][crate::model::DataSourceParameter::deprecated].
234    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
235        self.deprecated = v.into();
236        self
237    }
238}
239
240impl wkt::message::Message for DataSourceParameter {
241    fn typename() -> &'static str {
242        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DataSourceParameter"
243    }
244}
245
246#[doc(hidden)]
247impl<'de> serde::de::Deserialize<'de> for DataSourceParameter {
248    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
249    where
250        D: serde::Deserializer<'de>,
251    {
252        #[allow(non_camel_case_types)]
253        #[doc(hidden)]
254        #[derive(PartialEq, Eq, Hash)]
255        enum __FieldTag {
256            __param_id,
257            __display_name,
258            __description,
259            __type,
260            __required,
261            __repeated,
262            __validation_regex,
263            __allowed_values,
264            __min_value,
265            __max_value,
266            __fields,
267            __validation_description,
268            __validation_help_url,
269            __immutable,
270            __recurse,
271            __deprecated,
272            Unknown(std::string::String),
273        }
274        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
275            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
276            where
277                D: serde::Deserializer<'de>,
278            {
279                struct Visitor;
280                impl<'de> serde::de::Visitor<'de> for Visitor {
281                    type Value = __FieldTag;
282                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
283                        formatter.write_str("a field name for DataSourceParameter")
284                    }
285                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
286                    where
287                        E: serde::de::Error,
288                    {
289                        use std::result::Result::Ok;
290                        use std::string::ToString;
291                        match value {
292                            "paramId" => Ok(__FieldTag::__param_id),
293                            "param_id" => Ok(__FieldTag::__param_id),
294                            "displayName" => Ok(__FieldTag::__display_name),
295                            "display_name" => Ok(__FieldTag::__display_name),
296                            "description" => Ok(__FieldTag::__description),
297                            "type" => Ok(__FieldTag::__type),
298                            "required" => Ok(__FieldTag::__required),
299                            "repeated" => Ok(__FieldTag::__repeated),
300                            "validationRegex" => Ok(__FieldTag::__validation_regex),
301                            "validation_regex" => Ok(__FieldTag::__validation_regex),
302                            "allowedValues" => Ok(__FieldTag::__allowed_values),
303                            "allowed_values" => Ok(__FieldTag::__allowed_values),
304                            "minValue" => Ok(__FieldTag::__min_value),
305                            "min_value" => Ok(__FieldTag::__min_value),
306                            "maxValue" => Ok(__FieldTag::__max_value),
307                            "max_value" => Ok(__FieldTag::__max_value),
308                            "fields" => Ok(__FieldTag::__fields),
309                            "validationDescription" => Ok(__FieldTag::__validation_description),
310                            "validation_description" => Ok(__FieldTag::__validation_description),
311                            "validationHelpUrl" => Ok(__FieldTag::__validation_help_url),
312                            "validation_help_url" => Ok(__FieldTag::__validation_help_url),
313                            "immutable" => Ok(__FieldTag::__immutable),
314                            "recurse" => Ok(__FieldTag::__recurse),
315                            "deprecated" => Ok(__FieldTag::__deprecated),
316                            _ => Ok(__FieldTag::Unknown(value.to_string())),
317                        }
318                    }
319                }
320                deserializer.deserialize_identifier(Visitor)
321            }
322        }
323        struct Visitor;
324        impl<'de> serde::de::Visitor<'de> for Visitor {
325            type Value = DataSourceParameter;
326            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
327                formatter.write_str("struct DataSourceParameter")
328            }
329            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
330            where
331                A: serde::de::MapAccess<'de>,
332            {
333                #[allow(unused_imports)]
334                use serde::de::Error;
335                use std::option::Option::Some;
336                let mut fields = std::collections::HashSet::new();
337                let mut result = Self::Value::new();
338                while let Some(tag) = map.next_key::<__FieldTag>()? {
339                    #[allow(clippy::match_single_binding)]
340                    match tag {
341                        __FieldTag::__param_id => {
342                            if !fields.insert(__FieldTag::__param_id) {
343                                return std::result::Result::Err(A::Error::duplicate_field(
344                                    "multiple values for param_id",
345                                ));
346                            }
347                            result.param_id = map
348                                .next_value::<std::option::Option<std::string::String>>()?
349                                .unwrap_or_default();
350                        }
351                        __FieldTag::__display_name => {
352                            if !fields.insert(__FieldTag::__display_name) {
353                                return std::result::Result::Err(A::Error::duplicate_field(
354                                    "multiple values for display_name",
355                                ));
356                            }
357                            result.display_name = map
358                                .next_value::<std::option::Option<std::string::String>>()?
359                                .unwrap_or_default();
360                        }
361                        __FieldTag::__description => {
362                            if !fields.insert(__FieldTag::__description) {
363                                return std::result::Result::Err(A::Error::duplicate_field(
364                                    "multiple values for description",
365                                ));
366                            }
367                            result.description = map
368                                .next_value::<std::option::Option<std::string::String>>()?
369                                .unwrap_or_default();
370                        }
371                        __FieldTag::__type => {
372                            if !fields.insert(__FieldTag::__type) {
373                                return std::result::Result::Err(A::Error::duplicate_field(
374                                    "multiple values for type",
375                                ));
376                            }
377                            result.r#type = map.next_value::<std::option::Option<crate::model::data_source_parameter::Type>>()?.unwrap_or_default();
378                        }
379                        __FieldTag::__required => {
380                            if !fields.insert(__FieldTag::__required) {
381                                return std::result::Result::Err(A::Error::duplicate_field(
382                                    "multiple values for required",
383                                ));
384                            }
385                            result.required = map
386                                .next_value::<std::option::Option<bool>>()?
387                                .unwrap_or_default();
388                        }
389                        __FieldTag::__repeated => {
390                            if !fields.insert(__FieldTag::__repeated) {
391                                return std::result::Result::Err(A::Error::duplicate_field(
392                                    "multiple values for repeated",
393                                ));
394                            }
395                            result.repeated = map
396                                .next_value::<std::option::Option<bool>>()?
397                                .unwrap_or_default();
398                        }
399                        __FieldTag::__validation_regex => {
400                            if !fields.insert(__FieldTag::__validation_regex) {
401                                return std::result::Result::Err(A::Error::duplicate_field(
402                                    "multiple values for validation_regex",
403                                ));
404                            }
405                            result.validation_regex = map
406                                .next_value::<std::option::Option<std::string::String>>()?
407                                .unwrap_or_default();
408                        }
409                        __FieldTag::__allowed_values => {
410                            if !fields.insert(__FieldTag::__allowed_values) {
411                                return std::result::Result::Err(A::Error::duplicate_field(
412                                    "multiple values for allowed_values",
413                                ));
414                            }
415                            result.allowed_values = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
416                        }
417                        __FieldTag::__min_value => {
418                            if !fields.insert(__FieldTag::__min_value) {
419                                return std::result::Result::Err(A::Error::duplicate_field(
420                                    "multiple values for min_value",
421                                ));
422                            }
423                            struct __With(std::option::Option<wkt::DoubleValue>);
424                            impl<'de> serde::de::Deserialize<'de> for __With {
425                                fn deserialize<D>(
426                                    deserializer: D,
427                                ) -> std::result::Result<Self, D::Error>
428                                where
429                                    D: serde::de::Deserializer<'de>,
430                                {
431                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
432                                }
433                            }
434                            result.min_value = map.next_value::<__With>()?.0;
435                        }
436                        __FieldTag::__max_value => {
437                            if !fields.insert(__FieldTag::__max_value) {
438                                return std::result::Result::Err(A::Error::duplicate_field(
439                                    "multiple values for max_value",
440                                ));
441                            }
442                            struct __With(std::option::Option<wkt::DoubleValue>);
443                            impl<'de> serde::de::Deserialize<'de> for __With {
444                                fn deserialize<D>(
445                                    deserializer: D,
446                                ) -> std::result::Result<Self, D::Error>
447                                where
448                                    D: serde::de::Deserializer<'de>,
449                                {
450                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
451                                }
452                            }
453                            result.max_value = map.next_value::<__With>()?.0;
454                        }
455                        __FieldTag::__fields => {
456                            if !fields.insert(__FieldTag::__fields) {
457                                return std::result::Result::Err(A::Error::duplicate_field(
458                                    "multiple values for fields",
459                                ));
460                            }
461                            result.fields = map
462                                .next_value::<std::option::Option<
463                                    std::vec::Vec<crate::model::DataSourceParameter>,
464                                >>()?
465                                .unwrap_or_default();
466                        }
467                        __FieldTag::__validation_description => {
468                            if !fields.insert(__FieldTag::__validation_description) {
469                                return std::result::Result::Err(A::Error::duplicate_field(
470                                    "multiple values for validation_description",
471                                ));
472                            }
473                            result.validation_description = map
474                                .next_value::<std::option::Option<std::string::String>>()?
475                                .unwrap_or_default();
476                        }
477                        __FieldTag::__validation_help_url => {
478                            if !fields.insert(__FieldTag::__validation_help_url) {
479                                return std::result::Result::Err(A::Error::duplicate_field(
480                                    "multiple values for validation_help_url",
481                                ));
482                            }
483                            result.validation_help_url = map
484                                .next_value::<std::option::Option<std::string::String>>()?
485                                .unwrap_or_default();
486                        }
487                        __FieldTag::__immutable => {
488                            if !fields.insert(__FieldTag::__immutable) {
489                                return std::result::Result::Err(A::Error::duplicate_field(
490                                    "multiple values for immutable",
491                                ));
492                            }
493                            result.immutable = map
494                                .next_value::<std::option::Option<bool>>()?
495                                .unwrap_or_default();
496                        }
497                        __FieldTag::__recurse => {
498                            if !fields.insert(__FieldTag::__recurse) {
499                                return std::result::Result::Err(A::Error::duplicate_field(
500                                    "multiple values for recurse",
501                                ));
502                            }
503                            result.recurse = map
504                                .next_value::<std::option::Option<bool>>()?
505                                .unwrap_or_default();
506                        }
507                        __FieldTag::__deprecated => {
508                            if !fields.insert(__FieldTag::__deprecated) {
509                                return std::result::Result::Err(A::Error::duplicate_field(
510                                    "multiple values for deprecated",
511                                ));
512                            }
513                            result.deprecated = map
514                                .next_value::<std::option::Option<bool>>()?
515                                .unwrap_or_default();
516                        }
517                        __FieldTag::Unknown(key) => {
518                            let value = map.next_value::<serde_json::Value>()?;
519                            result._unknown_fields.insert(key, value);
520                        }
521                    }
522                }
523                std::result::Result::Ok(result)
524            }
525        }
526        deserializer.deserialize_any(Visitor)
527    }
528}
529
530#[doc(hidden)]
531impl serde::ser::Serialize for DataSourceParameter {
532    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
533    where
534        S: serde::ser::Serializer,
535    {
536        use serde::ser::SerializeMap;
537        #[allow(unused_imports)]
538        use std::option::Option::Some;
539        let mut state = serializer.serialize_map(std::option::Option::None)?;
540        if !self.param_id.is_empty() {
541            state.serialize_entry("paramId", &self.param_id)?;
542        }
543        if !self.display_name.is_empty() {
544            state.serialize_entry("displayName", &self.display_name)?;
545        }
546        if !self.description.is_empty() {
547            state.serialize_entry("description", &self.description)?;
548        }
549        if !wkt::internal::is_default(&self.r#type) {
550            state.serialize_entry("type", &self.r#type)?;
551        }
552        if !wkt::internal::is_default(&self.required) {
553            state.serialize_entry("required", &self.required)?;
554        }
555        if !wkt::internal::is_default(&self.repeated) {
556            state.serialize_entry("repeated", &self.repeated)?;
557        }
558        if !self.validation_regex.is_empty() {
559            state.serialize_entry("validationRegex", &self.validation_regex)?;
560        }
561        if !self.allowed_values.is_empty() {
562            state.serialize_entry("allowedValues", &self.allowed_values)?;
563        }
564        if self.min_value.is_some() {
565            struct __With<'a>(&'a std::option::Option<wkt::DoubleValue>);
566            impl<'a> serde::ser::Serialize for __With<'a> {
567                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
568                where
569                    S: serde::ser::Serializer,
570                {
571                    serde_with::As::<std::option::Option<wkt::internal::F64>>::serialize(
572                        self.0, serializer,
573                    )
574                }
575            }
576            state.serialize_entry("minValue", &__With(&self.min_value))?;
577        }
578        if self.max_value.is_some() {
579            struct __With<'a>(&'a std::option::Option<wkt::DoubleValue>);
580            impl<'a> serde::ser::Serialize for __With<'a> {
581                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
582                where
583                    S: serde::ser::Serializer,
584                {
585                    serde_with::As::<std::option::Option<wkt::internal::F64>>::serialize(
586                        self.0, serializer,
587                    )
588                }
589            }
590            state.serialize_entry("maxValue", &__With(&self.max_value))?;
591        }
592        if !self.fields.is_empty() {
593            state.serialize_entry("fields", &self.fields)?;
594        }
595        if !self.validation_description.is_empty() {
596            state.serialize_entry("validationDescription", &self.validation_description)?;
597        }
598        if !self.validation_help_url.is_empty() {
599            state.serialize_entry("validationHelpUrl", &self.validation_help_url)?;
600        }
601        if !wkt::internal::is_default(&self.immutable) {
602            state.serialize_entry("immutable", &self.immutable)?;
603        }
604        if !wkt::internal::is_default(&self.recurse) {
605            state.serialize_entry("recurse", &self.recurse)?;
606        }
607        if !wkt::internal::is_default(&self.deprecated) {
608            state.serialize_entry("deprecated", &self.deprecated)?;
609        }
610        if !self._unknown_fields.is_empty() {
611            for (key, value) in self._unknown_fields.iter() {
612                state.serialize_entry(key, &value)?;
613            }
614        }
615        state.end()
616    }
617}
618
619/// Defines additional types related to [DataSourceParameter].
620pub mod data_source_parameter {
621    #[allow(unused_imports)]
622    use super::*;
623
624    /// Parameter type.
625    ///
626    /// # Working with unknown values
627    ///
628    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
629    /// additional enum variants at any time. Adding new variants is not considered
630    /// a breaking change. Applications should write their code in anticipation of:
631    ///
632    /// - New values appearing in future releases of the client library, **and**
633    /// - New values received dynamically, without application changes.
634    ///
635    /// Please consult the [Working with enums] section in the user guide for some
636    /// guidelines.
637    ///
638    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
639    #[derive(Clone, Debug, PartialEq)]
640    #[non_exhaustive]
641    pub enum Type {
642        /// Type unspecified.
643        Unspecified,
644        /// String parameter.
645        String,
646        /// Integer parameter (64-bits).
647        /// Will be serialized to json as string.
648        Integer,
649        /// Double precision floating point parameter.
650        Double,
651        /// Boolean parameter.
652        Boolean,
653        /// Deprecated. This field has no effect.
654        Record,
655        /// Page ID for a Google+ Page.
656        PlusPage,
657        /// List of strings parameter.
658        List,
659        /// If set, the enum was initialized with an unknown value.
660        ///
661        /// Applications can examine the value using [Type::value] or
662        /// [Type::name].
663        UnknownValue(r#type::UnknownValue),
664    }
665
666    #[doc(hidden)]
667    pub mod r#type {
668        #[allow(unused_imports)]
669        use super::*;
670        #[derive(Clone, Debug, PartialEq)]
671        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
672    }
673
674    impl Type {
675        /// Gets the enum value.
676        ///
677        /// Returns `None` if the enum contains an unknown value deserialized from
678        /// the string representation of enums.
679        pub fn value(&self) -> std::option::Option<i32> {
680            match self {
681                Self::Unspecified => std::option::Option::Some(0),
682                Self::String => std::option::Option::Some(1),
683                Self::Integer => std::option::Option::Some(2),
684                Self::Double => std::option::Option::Some(3),
685                Self::Boolean => std::option::Option::Some(4),
686                Self::Record => std::option::Option::Some(5),
687                Self::PlusPage => std::option::Option::Some(6),
688                Self::List => std::option::Option::Some(7),
689                Self::UnknownValue(u) => u.0.value(),
690            }
691        }
692
693        /// Gets the enum value as a string.
694        ///
695        /// Returns `None` if the enum contains an unknown value deserialized from
696        /// the integer representation of enums.
697        pub fn name(&self) -> std::option::Option<&str> {
698            match self {
699                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
700                Self::String => std::option::Option::Some("STRING"),
701                Self::Integer => std::option::Option::Some("INTEGER"),
702                Self::Double => std::option::Option::Some("DOUBLE"),
703                Self::Boolean => std::option::Option::Some("BOOLEAN"),
704                Self::Record => std::option::Option::Some("RECORD"),
705                Self::PlusPage => std::option::Option::Some("PLUS_PAGE"),
706                Self::List => std::option::Option::Some("LIST"),
707                Self::UnknownValue(u) => u.0.name(),
708            }
709        }
710    }
711
712    impl std::default::Default for Type {
713        fn default() -> Self {
714            use std::convert::From;
715            Self::from(0)
716        }
717    }
718
719    impl std::fmt::Display for Type {
720        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
721            wkt::internal::display_enum(f, self.name(), self.value())
722        }
723    }
724
725    impl std::convert::From<i32> for Type {
726        fn from(value: i32) -> Self {
727            match value {
728                0 => Self::Unspecified,
729                1 => Self::String,
730                2 => Self::Integer,
731                3 => Self::Double,
732                4 => Self::Boolean,
733                5 => Self::Record,
734                6 => Self::PlusPage,
735                7 => Self::List,
736                _ => Self::UnknownValue(r#type::UnknownValue(
737                    wkt::internal::UnknownEnumValue::Integer(value),
738                )),
739            }
740        }
741    }
742
743    impl std::convert::From<&str> for Type {
744        fn from(value: &str) -> Self {
745            use std::string::ToString;
746            match value {
747                "TYPE_UNSPECIFIED" => Self::Unspecified,
748                "STRING" => Self::String,
749                "INTEGER" => Self::Integer,
750                "DOUBLE" => Self::Double,
751                "BOOLEAN" => Self::Boolean,
752                "RECORD" => Self::Record,
753                "PLUS_PAGE" => Self::PlusPage,
754                "LIST" => Self::List,
755                _ => Self::UnknownValue(r#type::UnknownValue(
756                    wkt::internal::UnknownEnumValue::String(value.to_string()),
757                )),
758            }
759        }
760    }
761
762    impl serde::ser::Serialize for Type {
763        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
764        where
765            S: serde::Serializer,
766        {
767            match self {
768                Self::Unspecified => serializer.serialize_i32(0),
769                Self::String => serializer.serialize_i32(1),
770                Self::Integer => serializer.serialize_i32(2),
771                Self::Double => serializer.serialize_i32(3),
772                Self::Boolean => serializer.serialize_i32(4),
773                Self::Record => serializer.serialize_i32(5),
774                Self::PlusPage => serializer.serialize_i32(6),
775                Self::List => serializer.serialize_i32(7),
776                Self::UnknownValue(u) => u.0.serialize(serializer),
777            }
778        }
779    }
780
781    impl<'de> serde::de::Deserialize<'de> for Type {
782        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
783        where
784            D: serde::Deserializer<'de>,
785        {
786            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
787                ".google.cloud.bigquery.datatransfer.v1.DataSourceParameter.Type",
788            ))
789        }
790    }
791}
792
793/// Defines the properties and custom parameters for a data source.
794#[derive(Clone, Debug, Default, PartialEq)]
795#[non_exhaustive]
796pub struct DataSource {
797    /// Output only. Data source resource name.
798    pub name: std::string::String,
799
800    /// Data source id.
801    pub data_source_id: std::string::String,
802
803    /// User friendly data source name.
804    pub display_name: std::string::String,
805
806    /// User friendly data source description string.
807    pub description: std::string::String,
808
809    /// Data source client id which should be used to receive refresh token.
810    pub client_id: std::string::String,
811
812    /// Api auth scopes for which refresh token needs to be obtained. These are
813    /// scopes needed by a data source to prepare data and ingest them into
814    /// BigQuery, e.g., <https://www.googleapis.com/auth/bigquery>
815    pub scopes: std::vec::Vec<std::string::String>,
816
817    /// Deprecated. This field has no effect.
818    #[deprecated]
819    pub transfer_type: crate::model::TransferType,
820
821    /// Deprecated. This field has no effect.
822    #[deprecated]
823    pub supports_multiple_transfers: bool,
824
825    /// The number of seconds to wait for an update from the data source
826    /// before the Data Transfer Service marks the transfer as FAILED.
827    pub update_deadline_seconds: i32,
828
829    /// Default data transfer schedule.
830    /// Examples of valid schedules include:
831    /// `1st,3rd monday of month 15:30`,
832    /// `every wed,fri of jan,jun 13:15`, and
833    /// `first sunday of quarter 00:00`.
834    pub default_schedule: std::string::String,
835
836    /// Specifies whether the data source supports a user defined schedule, or
837    /// operates on the default schedule.
838    /// When set to `true`, user can override default schedule.
839    pub supports_custom_schedule: bool,
840
841    /// Data source parameters.
842    pub parameters: std::vec::Vec<crate::model::DataSourceParameter>,
843
844    /// Url for the help document for this data source.
845    pub help_url: std::string::String,
846
847    /// Indicates the type of authorization.
848    pub authorization_type: crate::model::data_source::AuthorizationType,
849
850    /// Specifies whether the data source supports automatic data refresh for the
851    /// past few days, and how it's supported.
852    /// For some data sources, data might not be complete until a few days later,
853    /// so it's useful to refresh data automatically.
854    pub data_refresh_type: crate::model::data_source::DataRefreshType,
855
856    /// Default data refresh window on days.
857    /// Only meaningful when `data_refresh_type` = `SLIDING_WINDOW`.
858    pub default_data_refresh_window_days: i32,
859
860    /// Disables backfilling and manual run scheduling
861    /// for the data source.
862    pub manual_runs_disabled: bool,
863
864    /// The minimum interval for scheduler to schedule runs.
865    pub minimum_schedule_interval: std::option::Option<wkt::Duration>,
866
867    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
868}
869
870impl DataSource {
871    pub fn new() -> Self {
872        std::default::Default::default()
873    }
874
875    /// Sets the value of [name][crate::model::DataSource::name].
876    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
877        self.name = v.into();
878        self
879    }
880
881    /// Sets the value of [data_source_id][crate::model::DataSource::data_source_id].
882    pub fn set_data_source_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
883        self.data_source_id = v.into();
884        self
885    }
886
887    /// Sets the value of [display_name][crate::model::DataSource::display_name].
888    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
889        self.display_name = v.into();
890        self
891    }
892
893    /// Sets the value of [description][crate::model::DataSource::description].
894    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
895        self.description = v.into();
896        self
897    }
898
899    /// Sets the value of [client_id][crate::model::DataSource::client_id].
900    pub fn set_client_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
901        self.client_id = v.into();
902        self
903    }
904
905    /// Sets the value of [scopes][crate::model::DataSource::scopes].
906    pub fn set_scopes<T, V>(mut self, v: T) -> Self
907    where
908        T: std::iter::IntoIterator<Item = V>,
909        V: std::convert::Into<std::string::String>,
910    {
911        use std::iter::Iterator;
912        self.scopes = v.into_iter().map(|i| i.into()).collect();
913        self
914    }
915
916    /// Sets the value of [transfer_type][crate::model::DataSource::transfer_type].
917    #[deprecated]
918    pub fn set_transfer_type<T: std::convert::Into<crate::model::TransferType>>(
919        mut self,
920        v: T,
921    ) -> Self {
922        self.transfer_type = v.into();
923        self
924    }
925
926    /// Sets the value of [supports_multiple_transfers][crate::model::DataSource::supports_multiple_transfers].
927    #[deprecated]
928    pub fn set_supports_multiple_transfers<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
929        self.supports_multiple_transfers = v.into();
930        self
931    }
932
933    /// Sets the value of [update_deadline_seconds][crate::model::DataSource::update_deadline_seconds].
934    pub fn set_update_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
935        self.update_deadline_seconds = v.into();
936        self
937    }
938
939    /// Sets the value of [default_schedule][crate::model::DataSource::default_schedule].
940    pub fn set_default_schedule<T: std::convert::Into<std::string::String>>(
941        mut self,
942        v: T,
943    ) -> Self {
944        self.default_schedule = v.into();
945        self
946    }
947
948    /// Sets the value of [supports_custom_schedule][crate::model::DataSource::supports_custom_schedule].
949    pub fn set_supports_custom_schedule<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
950        self.supports_custom_schedule = v.into();
951        self
952    }
953
954    /// Sets the value of [parameters][crate::model::DataSource::parameters].
955    pub fn set_parameters<T, V>(mut self, v: T) -> Self
956    where
957        T: std::iter::IntoIterator<Item = V>,
958        V: std::convert::Into<crate::model::DataSourceParameter>,
959    {
960        use std::iter::Iterator;
961        self.parameters = v.into_iter().map(|i| i.into()).collect();
962        self
963    }
964
965    /// Sets the value of [help_url][crate::model::DataSource::help_url].
966    pub fn set_help_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
967        self.help_url = v.into();
968        self
969    }
970
971    /// Sets the value of [authorization_type][crate::model::DataSource::authorization_type].
972    pub fn set_authorization_type<
973        T: std::convert::Into<crate::model::data_source::AuthorizationType>,
974    >(
975        mut self,
976        v: T,
977    ) -> Self {
978        self.authorization_type = v.into();
979        self
980    }
981
982    /// Sets the value of [data_refresh_type][crate::model::DataSource::data_refresh_type].
983    pub fn set_data_refresh_type<
984        T: std::convert::Into<crate::model::data_source::DataRefreshType>,
985    >(
986        mut self,
987        v: T,
988    ) -> Self {
989        self.data_refresh_type = v.into();
990        self
991    }
992
993    /// Sets the value of [default_data_refresh_window_days][crate::model::DataSource::default_data_refresh_window_days].
994    pub fn set_default_data_refresh_window_days<T: std::convert::Into<i32>>(
995        mut self,
996        v: T,
997    ) -> Self {
998        self.default_data_refresh_window_days = v.into();
999        self
1000    }
1001
1002    /// Sets the value of [manual_runs_disabled][crate::model::DataSource::manual_runs_disabled].
1003    pub fn set_manual_runs_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1004        self.manual_runs_disabled = v.into();
1005        self
1006    }
1007
1008    /// Sets the value of [minimum_schedule_interval][crate::model::DataSource::minimum_schedule_interval].
1009    pub fn set_minimum_schedule_interval<T>(mut self, v: T) -> Self
1010    where
1011        T: std::convert::Into<wkt::Duration>,
1012    {
1013        self.minimum_schedule_interval = std::option::Option::Some(v.into());
1014        self
1015    }
1016
1017    /// Sets or clears the value of [minimum_schedule_interval][crate::model::DataSource::minimum_schedule_interval].
1018    pub fn set_or_clear_minimum_schedule_interval<T>(mut self, v: std::option::Option<T>) -> Self
1019    where
1020        T: std::convert::Into<wkt::Duration>,
1021    {
1022        self.minimum_schedule_interval = v.map(|x| x.into());
1023        self
1024    }
1025}
1026
1027impl wkt::message::Message for DataSource {
1028    fn typename() -> &'static str {
1029        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DataSource"
1030    }
1031}
1032
1033#[doc(hidden)]
1034impl<'de> serde::de::Deserialize<'de> for DataSource {
1035    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1036    where
1037        D: serde::Deserializer<'de>,
1038    {
1039        #[allow(non_camel_case_types)]
1040        #[doc(hidden)]
1041        #[derive(PartialEq, Eq, Hash)]
1042        enum __FieldTag {
1043            __name,
1044            __data_source_id,
1045            __display_name,
1046            __description,
1047            __client_id,
1048            __scopes,
1049            __transfer_type,
1050            __supports_multiple_transfers,
1051            __update_deadline_seconds,
1052            __default_schedule,
1053            __supports_custom_schedule,
1054            __parameters,
1055            __help_url,
1056            __authorization_type,
1057            __data_refresh_type,
1058            __default_data_refresh_window_days,
1059            __manual_runs_disabled,
1060            __minimum_schedule_interval,
1061            Unknown(std::string::String),
1062        }
1063        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1064            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1065            where
1066                D: serde::Deserializer<'de>,
1067            {
1068                struct Visitor;
1069                impl<'de> serde::de::Visitor<'de> for Visitor {
1070                    type Value = __FieldTag;
1071                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1072                        formatter.write_str("a field name for DataSource")
1073                    }
1074                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1075                    where
1076                        E: serde::de::Error,
1077                    {
1078                        use std::result::Result::Ok;
1079                        use std::string::ToString;
1080                        match value {
1081                            "name" => Ok(__FieldTag::__name),
1082                            "dataSourceId" => Ok(__FieldTag::__data_source_id),
1083                            "data_source_id" => Ok(__FieldTag::__data_source_id),
1084                            "displayName" => Ok(__FieldTag::__display_name),
1085                            "display_name" => Ok(__FieldTag::__display_name),
1086                            "description" => Ok(__FieldTag::__description),
1087                            "clientId" => Ok(__FieldTag::__client_id),
1088                            "client_id" => Ok(__FieldTag::__client_id),
1089                            "scopes" => Ok(__FieldTag::__scopes),
1090                            "transferType" => Ok(__FieldTag::__transfer_type),
1091                            "transfer_type" => Ok(__FieldTag::__transfer_type),
1092                            "supportsMultipleTransfers" => {
1093                                Ok(__FieldTag::__supports_multiple_transfers)
1094                            }
1095                            "supports_multiple_transfers" => {
1096                                Ok(__FieldTag::__supports_multiple_transfers)
1097                            }
1098                            "updateDeadlineSeconds" => Ok(__FieldTag::__update_deadline_seconds),
1099                            "update_deadline_seconds" => Ok(__FieldTag::__update_deadline_seconds),
1100                            "defaultSchedule" => Ok(__FieldTag::__default_schedule),
1101                            "default_schedule" => Ok(__FieldTag::__default_schedule),
1102                            "supportsCustomSchedule" => Ok(__FieldTag::__supports_custom_schedule),
1103                            "supports_custom_schedule" => {
1104                                Ok(__FieldTag::__supports_custom_schedule)
1105                            }
1106                            "parameters" => Ok(__FieldTag::__parameters),
1107                            "helpUrl" => Ok(__FieldTag::__help_url),
1108                            "help_url" => Ok(__FieldTag::__help_url),
1109                            "authorizationType" => Ok(__FieldTag::__authorization_type),
1110                            "authorization_type" => Ok(__FieldTag::__authorization_type),
1111                            "dataRefreshType" => Ok(__FieldTag::__data_refresh_type),
1112                            "data_refresh_type" => Ok(__FieldTag::__data_refresh_type),
1113                            "defaultDataRefreshWindowDays" => {
1114                                Ok(__FieldTag::__default_data_refresh_window_days)
1115                            }
1116                            "default_data_refresh_window_days" => {
1117                                Ok(__FieldTag::__default_data_refresh_window_days)
1118                            }
1119                            "manualRunsDisabled" => Ok(__FieldTag::__manual_runs_disabled),
1120                            "manual_runs_disabled" => Ok(__FieldTag::__manual_runs_disabled),
1121                            "minimumScheduleInterval" => {
1122                                Ok(__FieldTag::__minimum_schedule_interval)
1123                            }
1124                            "minimum_schedule_interval" => {
1125                                Ok(__FieldTag::__minimum_schedule_interval)
1126                            }
1127                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1128                        }
1129                    }
1130                }
1131                deserializer.deserialize_identifier(Visitor)
1132            }
1133        }
1134        struct Visitor;
1135        impl<'de> serde::de::Visitor<'de> for Visitor {
1136            type Value = DataSource;
1137            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1138                formatter.write_str("struct DataSource")
1139            }
1140            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1141            where
1142                A: serde::de::MapAccess<'de>,
1143            {
1144                #[allow(unused_imports)]
1145                use serde::de::Error;
1146                use std::option::Option::Some;
1147                let mut fields = std::collections::HashSet::new();
1148                let mut result = Self::Value::new();
1149                while let Some(tag) = map.next_key::<__FieldTag>()? {
1150                    #[allow(clippy::match_single_binding)]
1151                    match tag {
1152                        __FieldTag::__name => {
1153                            if !fields.insert(__FieldTag::__name) {
1154                                return std::result::Result::Err(A::Error::duplicate_field(
1155                                    "multiple values for name",
1156                                ));
1157                            }
1158                            result.name = map
1159                                .next_value::<std::option::Option<std::string::String>>()?
1160                                .unwrap_or_default();
1161                        }
1162                        __FieldTag::__data_source_id => {
1163                            if !fields.insert(__FieldTag::__data_source_id) {
1164                                return std::result::Result::Err(A::Error::duplicate_field(
1165                                    "multiple values for data_source_id",
1166                                ));
1167                            }
1168                            result.data_source_id = map
1169                                .next_value::<std::option::Option<std::string::String>>()?
1170                                .unwrap_or_default();
1171                        }
1172                        __FieldTag::__display_name => {
1173                            if !fields.insert(__FieldTag::__display_name) {
1174                                return std::result::Result::Err(A::Error::duplicate_field(
1175                                    "multiple values for display_name",
1176                                ));
1177                            }
1178                            result.display_name = map
1179                                .next_value::<std::option::Option<std::string::String>>()?
1180                                .unwrap_or_default();
1181                        }
1182                        __FieldTag::__description => {
1183                            if !fields.insert(__FieldTag::__description) {
1184                                return std::result::Result::Err(A::Error::duplicate_field(
1185                                    "multiple values for description",
1186                                ));
1187                            }
1188                            result.description = map
1189                                .next_value::<std::option::Option<std::string::String>>()?
1190                                .unwrap_or_default();
1191                        }
1192                        __FieldTag::__client_id => {
1193                            if !fields.insert(__FieldTag::__client_id) {
1194                                return std::result::Result::Err(A::Error::duplicate_field(
1195                                    "multiple values for client_id",
1196                                ));
1197                            }
1198                            result.client_id = map
1199                                .next_value::<std::option::Option<std::string::String>>()?
1200                                .unwrap_or_default();
1201                        }
1202                        __FieldTag::__scopes => {
1203                            if !fields.insert(__FieldTag::__scopes) {
1204                                return std::result::Result::Err(A::Error::duplicate_field(
1205                                    "multiple values for scopes",
1206                                ));
1207                            }
1208                            result.scopes = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1209                        }
1210                        __FieldTag::__transfer_type => {
1211                            if !fields.insert(__FieldTag::__transfer_type) {
1212                                return std::result::Result::Err(A::Error::duplicate_field(
1213                                    "multiple values for transfer_type",
1214                                ));
1215                            }
1216                            result.transfer_type = map
1217                                .next_value::<std::option::Option<crate::model::TransferType>>()?
1218                                .unwrap_or_default();
1219                        }
1220                        __FieldTag::__supports_multiple_transfers => {
1221                            if !fields.insert(__FieldTag::__supports_multiple_transfers) {
1222                                return std::result::Result::Err(A::Error::duplicate_field(
1223                                    "multiple values for supports_multiple_transfers",
1224                                ));
1225                            }
1226                            result.supports_multiple_transfers = map
1227                                .next_value::<std::option::Option<bool>>()?
1228                                .unwrap_or_default();
1229                        }
1230                        __FieldTag::__update_deadline_seconds => {
1231                            if !fields.insert(__FieldTag::__update_deadline_seconds) {
1232                                return std::result::Result::Err(A::Error::duplicate_field(
1233                                    "multiple values for update_deadline_seconds",
1234                                ));
1235                            }
1236                            struct __With(std::option::Option<i32>);
1237                            impl<'de> serde::de::Deserialize<'de> for __With {
1238                                fn deserialize<D>(
1239                                    deserializer: D,
1240                                ) -> std::result::Result<Self, D::Error>
1241                                where
1242                                    D: serde::de::Deserializer<'de>,
1243                                {
1244                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1245                                }
1246                            }
1247                            result.update_deadline_seconds =
1248                                map.next_value::<__With>()?.0.unwrap_or_default();
1249                        }
1250                        __FieldTag::__default_schedule => {
1251                            if !fields.insert(__FieldTag::__default_schedule) {
1252                                return std::result::Result::Err(A::Error::duplicate_field(
1253                                    "multiple values for default_schedule",
1254                                ));
1255                            }
1256                            result.default_schedule = map
1257                                .next_value::<std::option::Option<std::string::String>>()?
1258                                .unwrap_or_default();
1259                        }
1260                        __FieldTag::__supports_custom_schedule => {
1261                            if !fields.insert(__FieldTag::__supports_custom_schedule) {
1262                                return std::result::Result::Err(A::Error::duplicate_field(
1263                                    "multiple values for supports_custom_schedule",
1264                                ));
1265                            }
1266                            result.supports_custom_schedule = map
1267                                .next_value::<std::option::Option<bool>>()?
1268                                .unwrap_or_default();
1269                        }
1270                        __FieldTag::__parameters => {
1271                            if !fields.insert(__FieldTag::__parameters) {
1272                                return std::result::Result::Err(A::Error::duplicate_field(
1273                                    "multiple values for parameters",
1274                                ));
1275                            }
1276                            result.parameters = map
1277                                .next_value::<std::option::Option<
1278                                    std::vec::Vec<crate::model::DataSourceParameter>,
1279                                >>()?
1280                                .unwrap_or_default();
1281                        }
1282                        __FieldTag::__help_url => {
1283                            if !fields.insert(__FieldTag::__help_url) {
1284                                return std::result::Result::Err(A::Error::duplicate_field(
1285                                    "multiple values for help_url",
1286                                ));
1287                            }
1288                            result.help_url = map
1289                                .next_value::<std::option::Option<std::string::String>>()?
1290                                .unwrap_or_default();
1291                        }
1292                        __FieldTag::__authorization_type => {
1293                            if !fields.insert(__FieldTag::__authorization_type) {
1294                                return std::result::Result::Err(A::Error::duplicate_field(
1295                                    "multiple values for authorization_type",
1296                                ));
1297                            }
1298                            result.authorization_type =
1299                                map.next_value::<std::option::Option<
1300                                    crate::model::data_source::AuthorizationType,
1301                                >>()?
1302                                .unwrap_or_default();
1303                        }
1304                        __FieldTag::__data_refresh_type => {
1305                            if !fields.insert(__FieldTag::__data_refresh_type) {
1306                                return std::result::Result::Err(A::Error::duplicate_field(
1307                                    "multiple values for data_refresh_type",
1308                                ));
1309                            }
1310                            result.data_refresh_type = map.next_value::<std::option::Option<crate::model::data_source::DataRefreshType>>()?.unwrap_or_default();
1311                        }
1312                        __FieldTag::__default_data_refresh_window_days => {
1313                            if !fields.insert(__FieldTag::__default_data_refresh_window_days) {
1314                                return std::result::Result::Err(A::Error::duplicate_field(
1315                                    "multiple values for default_data_refresh_window_days",
1316                                ));
1317                            }
1318                            struct __With(std::option::Option<i32>);
1319                            impl<'de> serde::de::Deserialize<'de> for __With {
1320                                fn deserialize<D>(
1321                                    deserializer: D,
1322                                ) -> std::result::Result<Self, D::Error>
1323                                where
1324                                    D: serde::de::Deserializer<'de>,
1325                                {
1326                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1327                                }
1328                            }
1329                            result.default_data_refresh_window_days =
1330                                map.next_value::<__With>()?.0.unwrap_or_default();
1331                        }
1332                        __FieldTag::__manual_runs_disabled => {
1333                            if !fields.insert(__FieldTag::__manual_runs_disabled) {
1334                                return std::result::Result::Err(A::Error::duplicate_field(
1335                                    "multiple values for manual_runs_disabled",
1336                                ));
1337                            }
1338                            result.manual_runs_disabled = map
1339                                .next_value::<std::option::Option<bool>>()?
1340                                .unwrap_or_default();
1341                        }
1342                        __FieldTag::__minimum_schedule_interval => {
1343                            if !fields.insert(__FieldTag::__minimum_schedule_interval) {
1344                                return std::result::Result::Err(A::Error::duplicate_field(
1345                                    "multiple values for minimum_schedule_interval",
1346                                ));
1347                            }
1348                            result.minimum_schedule_interval =
1349                                map.next_value::<std::option::Option<wkt::Duration>>()?;
1350                        }
1351                        __FieldTag::Unknown(key) => {
1352                            let value = map.next_value::<serde_json::Value>()?;
1353                            result._unknown_fields.insert(key, value);
1354                        }
1355                    }
1356                }
1357                std::result::Result::Ok(result)
1358            }
1359        }
1360        deserializer.deserialize_any(Visitor)
1361    }
1362}
1363
1364#[doc(hidden)]
1365impl serde::ser::Serialize for DataSource {
1366    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1367    where
1368        S: serde::ser::Serializer,
1369    {
1370        use serde::ser::SerializeMap;
1371        #[allow(unused_imports)]
1372        use std::option::Option::Some;
1373        let mut state = serializer.serialize_map(std::option::Option::None)?;
1374        if !self.name.is_empty() {
1375            state.serialize_entry("name", &self.name)?;
1376        }
1377        if !self.data_source_id.is_empty() {
1378            state.serialize_entry("dataSourceId", &self.data_source_id)?;
1379        }
1380        if !self.display_name.is_empty() {
1381            state.serialize_entry("displayName", &self.display_name)?;
1382        }
1383        if !self.description.is_empty() {
1384            state.serialize_entry("description", &self.description)?;
1385        }
1386        if !self.client_id.is_empty() {
1387            state.serialize_entry("clientId", &self.client_id)?;
1388        }
1389        if !self.scopes.is_empty() {
1390            state.serialize_entry("scopes", &self.scopes)?;
1391        }
1392        if !wkt::internal::is_default(&self.transfer_type) {
1393            state.serialize_entry("transferType", &self.transfer_type)?;
1394        }
1395        if !wkt::internal::is_default(&self.supports_multiple_transfers) {
1396            state.serialize_entry(
1397                "supportsMultipleTransfers",
1398                &self.supports_multiple_transfers,
1399            )?;
1400        }
1401        if !wkt::internal::is_default(&self.update_deadline_seconds) {
1402            struct __With<'a>(&'a i32);
1403            impl<'a> serde::ser::Serialize for __With<'a> {
1404                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1405                where
1406                    S: serde::ser::Serializer,
1407                {
1408                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1409                }
1410            }
1411            state.serialize_entry(
1412                "updateDeadlineSeconds",
1413                &__With(&self.update_deadline_seconds),
1414            )?;
1415        }
1416        if !self.default_schedule.is_empty() {
1417            state.serialize_entry("defaultSchedule", &self.default_schedule)?;
1418        }
1419        if !wkt::internal::is_default(&self.supports_custom_schedule) {
1420            state.serialize_entry("supportsCustomSchedule", &self.supports_custom_schedule)?;
1421        }
1422        if !self.parameters.is_empty() {
1423            state.serialize_entry("parameters", &self.parameters)?;
1424        }
1425        if !self.help_url.is_empty() {
1426            state.serialize_entry("helpUrl", &self.help_url)?;
1427        }
1428        if !wkt::internal::is_default(&self.authorization_type) {
1429            state.serialize_entry("authorizationType", &self.authorization_type)?;
1430        }
1431        if !wkt::internal::is_default(&self.data_refresh_type) {
1432            state.serialize_entry("dataRefreshType", &self.data_refresh_type)?;
1433        }
1434        if !wkt::internal::is_default(&self.default_data_refresh_window_days) {
1435            struct __With<'a>(&'a i32);
1436            impl<'a> serde::ser::Serialize for __With<'a> {
1437                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1438                where
1439                    S: serde::ser::Serializer,
1440                {
1441                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1442                }
1443            }
1444            state.serialize_entry(
1445                "defaultDataRefreshWindowDays",
1446                &__With(&self.default_data_refresh_window_days),
1447            )?;
1448        }
1449        if !wkt::internal::is_default(&self.manual_runs_disabled) {
1450            state.serialize_entry("manualRunsDisabled", &self.manual_runs_disabled)?;
1451        }
1452        if self.minimum_schedule_interval.is_some() {
1453            state.serialize_entry("minimumScheduleInterval", &self.minimum_schedule_interval)?;
1454        }
1455        if !self._unknown_fields.is_empty() {
1456            for (key, value) in self._unknown_fields.iter() {
1457                state.serialize_entry(key, &value)?;
1458            }
1459        }
1460        state.end()
1461    }
1462}
1463
1464/// Defines additional types related to [DataSource].
1465pub mod data_source {
1466    #[allow(unused_imports)]
1467    use super::*;
1468
1469    /// The type of authorization needed for this data source.
1470    ///
1471    /// # Working with unknown values
1472    ///
1473    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1474    /// additional enum variants at any time. Adding new variants is not considered
1475    /// a breaking change. Applications should write their code in anticipation of:
1476    ///
1477    /// - New values appearing in future releases of the client library, **and**
1478    /// - New values received dynamically, without application changes.
1479    ///
1480    /// Please consult the [Working with enums] section in the user guide for some
1481    /// guidelines.
1482    ///
1483    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1484    #[derive(Clone, Debug, PartialEq)]
1485    #[non_exhaustive]
1486    pub enum AuthorizationType {
1487        /// Type unspecified.
1488        Unspecified,
1489        /// Use OAuth 2 authorization codes that can be exchanged
1490        /// for a refresh token on the backend.
1491        AuthorizationCode,
1492        /// Return an authorization code for a given Google+ page that can then be
1493        /// exchanged for a refresh token on the backend.
1494        GooglePlusAuthorizationCode,
1495        /// Use First Party OAuth.
1496        FirstPartyOauth,
1497        /// If set, the enum was initialized with an unknown value.
1498        ///
1499        /// Applications can examine the value using [AuthorizationType::value] or
1500        /// [AuthorizationType::name].
1501        UnknownValue(authorization_type::UnknownValue),
1502    }
1503
1504    #[doc(hidden)]
1505    pub mod authorization_type {
1506        #[allow(unused_imports)]
1507        use super::*;
1508        #[derive(Clone, Debug, PartialEq)]
1509        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1510    }
1511
1512    impl AuthorizationType {
1513        /// Gets the enum value.
1514        ///
1515        /// Returns `None` if the enum contains an unknown value deserialized from
1516        /// the string representation of enums.
1517        pub fn value(&self) -> std::option::Option<i32> {
1518            match self {
1519                Self::Unspecified => std::option::Option::Some(0),
1520                Self::AuthorizationCode => std::option::Option::Some(1),
1521                Self::GooglePlusAuthorizationCode => std::option::Option::Some(2),
1522                Self::FirstPartyOauth => std::option::Option::Some(3),
1523                Self::UnknownValue(u) => u.0.value(),
1524            }
1525        }
1526
1527        /// Gets the enum value as a string.
1528        ///
1529        /// Returns `None` if the enum contains an unknown value deserialized from
1530        /// the integer representation of enums.
1531        pub fn name(&self) -> std::option::Option<&str> {
1532            match self {
1533                Self::Unspecified => std::option::Option::Some("AUTHORIZATION_TYPE_UNSPECIFIED"),
1534                Self::AuthorizationCode => std::option::Option::Some("AUTHORIZATION_CODE"),
1535                Self::GooglePlusAuthorizationCode => {
1536                    std::option::Option::Some("GOOGLE_PLUS_AUTHORIZATION_CODE")
1537                }
1538                Self::FirstPartyOauth => std::option::Option::Some("FIRST_PARTY_OAUTH"),
1539                Self::UnknownValue(u) => u.0.name(),
1540            }
1541        }
1542    }
1543
1544    impl std::default::Default for AuthorizationType {
1545        fn default() -> Self {
1546            use std::convert::From;
1547            Self::from(0)
1548        }
1549    }
1550
1551    impl std::fmt::Display for AuthorizationType {
1552        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1553            wkt::internal::display_enum(f, self.name(), self.value())
1554        }
1555    }
1556
1557    impl std::convert::From<i32> for AuthorizationType {
1558        fn from(value: i32) -> Self {
1559            match value {
1560                0 => Self::Unspecified,
1561                1 => Self::AuthorizationCode,
1562                2 => Self::GooglePlusAuthorizationCode,
1563                3 => Self::FirstPartyOauth,
1564                _ => Self::UnknownValue(authorization_type::UnknownValue(
1565                    wkt::internal::UnknownEnumValue::Integer(value),
1566                )),
1567            }
1568        }
1569    }
1570
1571    impl std::convert::From<&str> for AuthorizationType {
1572        fn from(value: &str) -> Self {
1573            use std::string::ToString;
1574            match value {
1575                "AUTHORIZATION_TYPE_UNSPECIFIED" => Self::Unspecified,
1576                "AUTHORIZATION_CODE" => Self::AuthorizationCode,
1577                "GOOGLE_PLUS_AUTHORIZATION_CODE" => Self::GooglePlusAuthorizationCode,
1578                "FIRST_PARTY_OAUTH" => Self::FirstPartyOauth,
1579                _ => Self::UnknownValue(authorization_type::UnknownValue(
1580                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1581                )),
1582            }
1583        }
1584    }
1585
1586    impl serde::ser::Serialize for AuthorizationType {
1587        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1588        where
1589            S: serde::Serializer,
1590        {
1591            match self {
1592                Self::Unspecified => serializer.serialize_i32(0),
1593                Self::AuthorizationCode => serializer.serialize_i32(1),
1594                Self::GooglePlusAuthorizationCode => serializer.serialize_i32(2),
1595                Self::FirstPartyOauth => serializer.serialize_i32(3),
1596                Self::UnknownValue(u) => u.0.serialize(serializer),
1597            }
1598        }
1599    }
1600
1601    impl<'de> serde::de::Deserialize<'de> for AuthorizationType {
1602        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1603        where
1604            D: serde::Deserializer<'de>,
1605        {
1606            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthorizationType>::new(
1607                ".google.cloud.bigquery.datatransfer.v1.DataSource.AuthorizationType",
1608            ))
1609        }
1610    }
1611
1612    /// Represents how the data source supports data auto refresh.
1613    ///
1614    /// # Working with unknown values
1615    ///
1616    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1617    /// additional enum variants at any time. Adding new variants is not considered
1618    /// a breaking change. Applications should write their code in anticipation of:
1619    ///
1620    /// - New values appearing in future releases of the client library, **and**
1621    /// - New values received dynamically, without application changes.
1622    ///
1623    /// Please consult the [Working with enums] section in the user guide for some
1624    /// guidelines.
1625    ///
1626    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1627    #[derive(Clone, Debug, PartialEq)]
1628    #[non_exhaustive]
1629    pub enum DataRefreshType {
1630        /// The data source won't support data auto refresh, which is default value.
1631        Unspecified,
1632        /// The data source supports data auto refresh, and runs will be scheduled
1633        /// for the past few days. Does not allow custom values to be set for each
1634        /// transfer config.
1635        SlidingWindow,
1636        /// The data source supports data auto refresh, and runs will be scheduled
1637        /// for the past few days. Allows custom values to be set for each transfer
1638        /// config.
1639        CustomSlidingWindow,
1640        /// If set, the enum was initialized with an unknown value.
1641        ///
1642        /// Applications can examine the value using [DataRefreshType::value] or
1643        /// [DataRefreshType::name].
1644        UnknownValue(data_refresh_type::UnknownValue),
1645    }
1646
1647    #[doc(hidden)]
1648    pub mod data_refresh_type {
1649        #[allow(unused_imports)]
1650        use super::*;
1651        #[derive(Clone, Debug, PartialEq)]
1652        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1653    }
1654
1655    impl DataRefreshType {
1656        /// Gets the enum value.
1657        ///
1658        /// Returns `None` if the enum contains an unknown value deserialized from
1659        /// the string representation of enums.
1660        pub fn value(&self) -> std::option::Option<i32> {
1661            match self {
1662                Self::Unspecified => std::option::Option::Some(0),
1663                Self::SlidingWindow => std::option::Option::Some(1),
1664                Self::CustomSlidingWindow => std::option::Option::Some(2),
1665                Self::UnknownValue(u) => u.0.value(),
1666            }
1667        }
1668
1669        /// Gets the enum value as a string.
1670        ///
1671        /// Returns `None` if the enum contains an unknown value deserialized from
1672        /// the integer representation of enums.
1673        pub fn name(&self) -> std::option::Option<&str> {
1674            match self {
1675                Self::Unspecified => std::option::Option::Some("DATA_REFRESH_TYPE_UNSPECIFIED"),
1676                Self::SlidingWindow => std::option::Option::Some("SLIDING_WINDOW"),
1677                Self::CustomSlidingWindow => std::option::Option::Some("CUSTOM_SLIDING_WINDOW"),
1678                Self::UnknownValue(u) => u.0.name(),
1679            }
1680        }
1681    }
1682
1683    impl std::default::Default for DataRefreshType {
1684        fn default() -> Self {
1685            use std::convert::From;
1686            Self::from(0)
1687        }
1688    }
1689
1690    impl std::fmt::Display for DataRefreshType {
1691        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1692            wkt::internal::display_enum(f, self.name(), self.value())
1693        }
1694    }
1695
1696    impl std::convert::From<i32> for DataRefreshType {
1697        fn from(value: i32) -> Self {
1698            match value {
1699                0 => Self::Unspecified,
1700                1 => Self::SlidingWindow,
1701                2 => Self::CustomSlidingWindow,
1702                _ => Self::UnknownValue(data_refresh_type::UnknownValue(
1703                    wkt::internal::UnknownEnumValue::Integer(value),
1704                )),
1705            }
1706        }
1707    }
1708
1709    impl std::convert::From<&str> for DataRefreshType {
1710        fn from(value: &str) -> Self {
1711            use std::string::ToString;
1712            match value {
1713                "DATA_REFRESH_TYPE_UNSPECIFIED" => Self::Unspecified,
1714                "SLIDING_WINDOW" => Self::SlidingWindow,
1715                "CUSTOM_SLIDING_WINDOW" => Self::CustomSlidingWindow,
1716                _ => Self::UnknownValue(data_refresh_type::UnknownValue(
1717                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1718                )),
1719            }
1720        }
1721    }
1722
1723    impl serde::ser::Serialize for DataRefreshType {
1724        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1725        where
1726            S: serde::Serializer,
1727        {
1728            match self {
1729                Self::Unspecified => serializer.serialize_i32(0),
1730                Self::SlidingWindow => serializer.serialize_i32(1),
1731                Self::CustomSlidingWindow => serializer.serialize_i32(2),
1732                Self::UnknownValue(u) => u.0.serialize(serializer),
1733            }
1734        }
1735    }
1736
1737    impl<'de> serde::de::Deserialize<'de> for DataRefreshType {
1738        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1739        where
1740            D: serde::Deserializer<'de>,
1741        {
1742            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataRefreshType>::new(
1743                ".google.cloud.bigquery.datatransfer.v1.DataSource.DataRefreshType",
1744            ))
1745        }
1746    }
1747}
1748
1749/// A request to get data source info.
1750#[derive(Clone, Debug, Default, PartialEq)]
1751#[non_exhaustive]
1752pub struct GetDataSourceRequest {
1753    /// Required. The field will contain name of the resource requested, for
1754    /// example: `projects/{project_id}/dataSources/{data_source_id}` or
1755    /// `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
1756    pub name: std::string::String,
1757
1758    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1759}
1760
1761impl GetDataSourceRequest {
1762    pub fn new() -> Self {
1763        std::default::Default::default()
1764    }
1765
1766    /// Sets the value of [name][crate::model::GetDataSourceRequest::name].
1767    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1768        self.name = v.into();
1769        self
1770    }
1771}
1772
1773impl wkt::message::Message for GetDataSourceRequest {
1774    fn typename() -> &'static str {
1775        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.GetDataSourceRequest"
1776    }
1777}
1778
1779#[doc(hidden)]
1780impl<'de> serde::de::Deserialize<'de> for GetDataSourceRequest {
1781    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1782    where
1783        D: serde::Deserializer<'de>,
1784    {
1785        #[allow(non_camel_case_types)]
1786        #[doc(hidden)]
1787        #[derive(PartialEq, Eq, Hash)]
1788        enum __FieldTag {
1789            __name,
1790            Unknown(std::string::String),
1791        }
1792        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1793            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1794            where
1795                D: serde::Deserializer<'de>,
1796            {
1797                struct Visitor;
1798                impl<'de> serde::de::Visitor<'de> for Visitor {
1799                    type Value = __FieldTag;
1800                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1801                        formatter.write_str("a field name for GetDataSourceRequest")
1802                    }
1803                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1804                    where
1805                        E: serde::de::Error,
1806                    {
1807                        use std::result::Result::Ok;
1808                        use std::string::ToString;
1809                        match value {
1810                            "name" => Ok(__FieldTag::__name),
1811                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1812                        }
1813                    }
1814                }
1815                deserializer.deserialize_identifier(Visitor)
1816            }
1817        }
1818        struct Visitor;
1819        impl<'de> serde::de::Visitor<'de> for Visitor {
1820            type Value = GetDataSourceRequest;
1821            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1822                formatter.write_str("struct GetDataSourceRequest")
1823            }
1824            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1825            where
1826                A: serde::de::MapAccess<'de>,
1827            {
1828                #[allow(unused_imports)]
1829                use serde::de::Error;
1830                use std::option::Option::Some;
1831                let mut fields = std::collections::HashSet::new();
1832                let mut result = Self::Value::new();
1833                while let Some(tag) = map.next_key::<__FieldTag>()? {
1834                    #[allow(clippy::match_single_binding)]
1835                    match tag {
1836                        __FieldTag::__name => {
1837                            if !fields.insert(__FieldTag::__name) {
1838                                return std::result::Result::Err(A::Error::duplicate_field(
1839                                    "multiple values for name",
1840                                ));
1841                            }
1842                            result.name = map
1843                                .next_value::<std::option::Option<std::string::String>>()?
1844                                .unwrap_or_default();
1845                        }
1846                        __FieldTag::Unknown(key) => {
1847                            let value = map.next_value::<serde_json::Value>()?;
1848                            result._unknown_fields.insert(key, value);
1849                        }
1850                    }
1851                }
1852                std::result::Result::Ok(result)
1853            }
1854        }
1855        deserializer.deserialize_any(Visitor)
1856    }
1857}
1858
1859#[doc(hidden)]
1860impl serde::ser::Serialize for GetDataSourceRequest {
1861    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1862    where
1863        S: serde::ser::Serializer,
1864    {
1865        use serde::ser::SerializeMap;
1866        #[allow(unused_imports)]
1867        use std::option::Option::Some;
1868        let mut state = serializer.serialize_map(std::option::Option::None)?;
1869        if !self.name.is_empty() {
1870            state.serialize_entry("name", &self.name)?;
1871        }
1872        if !self._unknown_fields.is_empty() {
1873            for (key, value) in self._unknown_fields.iter() {
1874                state.serialize_entry(key, &value)?;
1875            }
1876        }
1877        state.end()
1878    }
1879}
1880
1881/// Request to list supported data sources and their data transfer settings.
1882#[derive(Clone, Debug, Default, PartialEq)]
1883#[non_exhaustive]
1884pub struct ListDataSourcesRequest {
1885    /// Required. The BigQuery project id for which data sources should be
1886    /// returned. Must be in the form: `projects/{project_id}` or
1887    /// `projects/{project_id}/locations/{location_id}`
1888    pub parent: std::string::String,
1889
1890    /// Pagination token, which can be used to request a specific page
1891    /// of `ListDataSourcesRequest` list results. For multiple-page
1892    /// results, `ListDataSourcesResponse` outputs
1893    /// a `next_page` token, which can be used as the
1894    /// `page_token` value to request the next page of list results.
1895    pub page_token: std::string::String,
1896
1897    /// Page size. The default page size is the maximum value of 1000 results.
1898    pub page_size: i32,
1899
1900    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1901}
1902
1903impl ListDataSourcesRequest {
1904    pub fn new() -> Self {
1905        std::default::Default::default()
1906    }
1907
1908    /// Sets the value of [parent][crate::model::ListDataSourcesRequest::parent].
1909    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1910        self.parent = v.into();
1911        self
1912    }
1913
1914    /// Sets the value of [page_token][crate::model::ListDataSourcesRequest::page_token].
1915    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1916        self.page_token = v.into();
1917        self
1918    }
1919
1920    /// Sets the value of [page_size][crate::model::ListDataSourcesRequest::page_size].
1921    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1922        self.page_size = v.into();
1923        self
1924    }
1925}
1926
1927impl wkt::message::Message for ListDataSourcesRequest {
1928    fn typename() -> &'static str {
1929        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListDataSourcesRequest"
1930    }
1931}
1932
1933#[doc(hidden)]
1934impl<'de> serde::de::Deserialize<'de> for ListDataSourcesRequest {
1935    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1936    where
1937        D: serde::Deserializer<'de>,
1938    {
1939        #[allow(non_camel_case_types)]
1940        #[doc(hidden)]
1941        #[derive(PartialEq, Eq, Hash)]
1942        enum __FieldTag {
1943            __parent,
1944            __page_token,
1945            __page_size,
1946            Unknown(std::string::String),
1947        }
1948        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1949            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1950            where
1951                D: serde::Deserializer<'de>,
1952            {
1953                struct Visitor;
1954                impl<'de> serde::de::Visitor<'de> for Visitor {
1955                    type Value = __FieldTag;
1956                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1957                        formatter.write_str("a field name for ListDataSourcesRequest")
1958                    }
1959                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1960                    where
1961                        E: serde::de::Error,
1962                    {
1963                        use std::result::Result::Ok;
1964                        use std::string::ToString;
1965                        match value {
1966                            "parent" => Ok(__FieldTag::__parent),
1967                            "pageToken" => Ok(__FieldTag::__page_token),
1968                            "page_token" => Ok(__FieldTag::__page_token),
1969                            "pageSize" => Ok(__FieldTag::__page_size),
1970                            "page_size" => Ok(__FieldTag::__page_size),
1971                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1972                        }
1973                    }
1974                }
1975                deserializer.deserialize_identifier(Visitor)
1976            }
1977        }
1978        struct Visitor;
1979        impl<'de> serde::de::Visitor<'de> for Visitor {
1980            type Value = ListDataSourcesRequest;
1981            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1982                formatter.write_str("struct ListDataSourcesRequest")
1983            }
1984            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1985            where
1986                A: serde::de::MapAccess<'de>,
1987            {
1988                #[allow(unused_imports)]
1989                use serde::de::Error;
1990                use std::option::Option::Some;
1991                let mut fields = std::collections::HashSet::new();
1992                let mut result = Self::Value::new();
1993                while let Some(tag) = map.next_key::<__FieldTag>()? {
1994                    #[allow(clippy::match_single_binding)]
1995                    match tag {
1996                        __FieldTag::__parent => {
1997                            if !fields.insert(__FieldTag::__parent) {
1998                                return std::result::Result::Err(A::Error::duplicate_field(
1999                                    "multiple values for parent",
2000                                ));
2001                            }
2002                            result.parent = map
2003                                .next_value::<std::option::Option<std::string::String>>()?
2004                                .unwrap_or_default();
2005                        }
2006                        __FieldTag::__page_token => {
2007                            if !fields.insert(__FieldTag::__page_token) {
2008                                return std::result::Result::Err(A::Error::duplicate_field(
2009                                    "multiple values for page_token",
2010                                ));
2011                            }
2012                            result.page_token = map
2013                                .next_value::<std::option::Option<std::string::String>>()?
2014                                .unwrap_or_default();
2015                        }
2016                        __FieldTag::__page_size => {
2017                            if !fields.insert(__FieldTag::__page_size) {
2018                                return std::result::Result::Err(A::Error::duplicate_field(
2019                                    "multiple values for page_size",
2020                                ));
2021                            }
2022                            struct __With(std::option::Option<i32>);
2023                            impl<'de> serde::de::Deserialize<'de> for __With {
2024                                fn deserialize<D>(
2025                                    deserializer: D,
2026                                ) -> std::result::Result<Self, D::Error>
2027                                where
2028                                    D: serde::de::Deserializer<'de>,
2029                                {
2030                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2031                                }
2032                            }
2033                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2034                        }
2035                        __FieldTag::Unknown(key) => {
2036                            let value = map.next_value::<serde_json::Value>()?;
2037                            result._unknown_fields.insert(key, value);
2038                        }
2039                    }
2040                }
2041                std::result::Result::Ok(result)
2042            }
2043        }
2044        deserializer.deserialize_any(Visitor)
2045    }
2046}
2047
2048#[doc(hidden)]
2049impl serde::ser::Serialize for ListDataSourcesRequest {
2050    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2051    where
2052        S: serde::ser::Serializer,
2053    {
2054        use serde::ser::SerializeMap;
2055        #[allow(unused_imports)]
2056        use std::option::Option::Some;
2057        let mut state = serializer.serialize_map(std::option::Option::None)?;
2058        if !self.parent.is_empty() {
2059            state.serialize_entry("parent", &self.parent)?;
2060        }
2061        if !self.page_token.is_empty() {
2062            state.serialize_entry("pageToken", &self.page_token)?;
2063        }
2064        if !wkt::internal::is_default(&self.page_size) {
2065            struct __With<'a>(&'a i32);
2066            impl<'a> serde::ser::Serialize for __With<'a> {
2067                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2068                where
2069                    S: serde::ser::Serializer,
2070                {
2071                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2072                }
2073            }
2074            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2075        }
2076        if !self._unknown_fields.is_empty() {
2077            for (key, value) in self._unknown_fields.iter() {
2078                state.serialize_entry(key, &value)?;
2079            }
2080        }
2081        state.end()
2082    }
2083}
2084
2085/// Returns list of supported data sources and their metadata.
2086#[derive(Clone, Debug, Default, PartialEq)]
2087#[non_exhaustive]
2088pub struct ListDataSourcesResponse {
2089    /// List of supported data sources and their transfer settings.
2090    pub data_sources: std::vec::Vec<crate::model::DataSource>,
2091
2092    /// Output only. The next-pagination token. For multiple-page list results,
2093    /// this token can be used as the
2094    /// `ListDataSourcesRequest.page_token`
2095    /// to request the next page of list results.
2096    pub next_page_token: std::string::String,
2097
2098    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2099}
2100
2101impl ListDataSourcesResponse {
2102    pub fn new() -> Self {
2103        std::default::Default::default()
2104    }
2105
2106    /// Sets the value of [data_sources][crate::model::ListDataSourcesResponse::data_sources].
2107    pub fn set_data_sources<T, V>(mut self, v: T) -> Self
2108    where
2109        T: std::iter::IntoIterator<Item = V>,
2110        V: std::convert::Into<crate::model::DataSource>,
2111    {
2112        use std::iter::Iterator;
2113        self.data_sources = v.into_iter().map(|i| i.into()).collect();
2114        self
2115    }
2116
2117    /// Sets the value of [next_page_token][crate::model::ListDataSourcesResponse::next_page_token].
2118    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2119        self.next_page_token = v.into();
2120        self
2121    }
2122}
2123
2124impl wkt::message::Message for ListDataSourcesResponse {
2125    fn typename() -> &'static str {
2126        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListDataSourcesResponse"
2127    }
2128}
2129
2130#[doc(hidden)]
2131impl gax::paginator::internal::PageableResponse for ListDataSourcesResponse {
2132    type PageItem = crate::model::DataSource;
2133
2134    fn items(self) -> std::vec::Vec<Self::PageItem> {
2135        self.data_sources
2136    }
2137
2138    fn next_page_token(&self) -> std::string::String {
2139        use std::clone::Clone;
2140        self.next_page_token.clone()
2141    }
2142}
2143
2144#[doc(hidden)]
2145impl<'de> serde::de::Deserialize<'de> for ListDataSourcesResponse {
2146    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2147    where
2148        D: serde::Deserializer<'de>,
2149    {
2150        #[allow(non_camel_case_types)]
2151        #[doc(hidden)]
2152        #[derive(PartialEq, Eq, Hash)]
2153        enum __FieldTag {
2154            __data_sources,
2155            __next_page_token,
2156            Unknown(std::string::String),
2157        }
2158        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2159            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2160            where
2161                D: serde::Deserializer<'de>,
2162            {
2163                struct Visitor;
2164                impl<'de> serde::de::Visitor<'de> for Visitor {
2165                    type Value = __FieldTag;
2166                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2167                        formatter.write_str("a field name for ListDataSourcesResponse")
2168                    }
2169                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2170                    where
2171                        E: serde::de::Error,
2172                    {
2173                        use std::result::Result::Ok;
2174                        use std::string::ToString;
2175                        match value {
2176                            "dataSources" => Ok(__FieldTag::__data_sources),
2177                            "data_sources" => Ok(__FieldTag::__data_sources),
2178                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2179                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2180                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2181                        }
2182                    }
2183                }
2184                deserializer.deserialize_identifier(Visitor)
2185            }
2186        }
2187        struct Visitor;
2188        impl<'de> serde::de::Visitor<'de> for Visitor {
2189            type Value = ListDataSourcesResponse;
2190            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2191                formatter.write_str("struct ListDataSourcesResponse")
2192            }
2193            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2194            where
2195                A: serde::de::MapAccess<'de>,
2196            {
2197                #[allow(unused_imports)]
2198                use serde::de::Error;
2199                use std::option::Option::Some;
2200                let mut fields = std::collections::HashSet::new();
2201                let mut result = Self::Value::new();
2202                while let Some(tag) = map.next_key::<__FieldTag>()? {
2203                    #[allow(clippy::match_single_binding)]
2204                    match tag {
2205                        __FieldTag::__data_sources => {
2206                            if !fields.insert(__FieldTag::__data_sources) {
2207                                return std::result::Result::Err(A::Error::duplicate_field(
2208                                    "multiple values for data_sources",
2209                                ));
2210                            }
2211                            result.data_sources = map.next_value::<std::option::Option<std::vec::Vec<crate::model::DataSource>>>()?.unwrap_or_default();
2212                        }
2213                        __FieldTag::__next_page_token => {
2214                            if !fields.insert(__FieldTag::__next_page_token) {
2215                                return std::result::Result::Err(A::Error::duplicate_field(
2216                                    "multiple values for next_page_token",
2217                                ));
2218                            }
2219                            result.next_page_token = map
2220                                .next_value::<std::option::Option<std::string::String>>()?
2221                                .unwrap_or_default();
2222                        }
2223                        __FieldTag::Unknown(key) => {
2224                            let value = map.next_value::<serde_json::Value>()?;
2225                            result._unknown_fields.insert(key, value);
2226                        }
2227                    }
2228                }
2229                std::result::Result::Ok(result)
2230            }
2231        }
2232        deserializer.deserialize_any(Visitor)
2233    }
2234}
2235
2236#[doc(hidden)]
2237impl serde::ser::Serialize for ListDataSourcesResponse {
2238    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2239    where
2240        S: serde::ser::Serializer,
2241    {
2242        use serde::ser::SerializeMap;
2243        #[allow(unused_imports)]
2244        use std::option::Option::Some;
2245        let mut state = serializer.serialize_map(std::option::Option::None)?;
2246        if !self.data_sources.is_empty() {
2247            state.serialize_entry("dataSources", &self.data_sources)?;
2248        }
2249        if !self.next_page_token.is_empty() {
2250            state.serialize_entry("nextPageToken", &self.next_page_token)?;
2251        }
2252        if !self._unknown_fields.is_empty() {
2253            for (key, value) in self._unknown_fields.iter() {
2254                state.serialize_entry(key, &value)?;
2255            }
2256        }
2257        state.end()
2258    }
2259}
2260
2261/// A request to create a data transfer configuration. If new credentials are
2262/// needed for this transfer configuration, authorization info must be provided.
2263/// If authorization info is provided, the transfer configuration will be
2264/// associated with the user id corresponding to the authorization info.
2265/// Otherwise, the transfer configuration will be associated with the calling
2266/// user.
2267///
2268/// When using a cross project service account for creating a transfer config,
2269/// you must enable cross project service account usage. For more information,
2270/// see [Disable attachment of service accounts to resources in other
2271/// projects](https://cloud.google.com/resource-manager/docs/organization-policy/restricting-service-accounts#disable_cross_project_service_accounts).
2272#[derive(Clone, Debug, Default, PartialEq)]
2273#[non_exhaustive]
2274pub struct CreateTransferConfigRequest {
2275    /// Required. The BigQuery project id where the transfer configuration should
2276    /// be created. Must be in the format
2277    /// projects/{project_id}/locations/{location_id} or projects/{project_id}. If
2278    /// specified location and location of the destination bigquery dataset do not
2279    /// match - the request will fail.
2280    pub parent: std::string::String,
2281
2282    /// Required. Data transfer configuration to create.
2283    pub transfer_config: std::option::Option<crate::model::TransferConfig>,
2284
2285    /// Deprecated: Authorization code was required when
2286    /// `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used
2287    /// in any data sources. Use `version_info` instead.
2288    ///
2289    /// Optional OAuth2 authorization code to use with this transfer configuration.
2290    /// This is required only if `transferConfig.dataSourceId` is 'youtube_channel'
2291    /// and new credentials are needed, as indicated by `CheckValidCreds`. In order
2292    /// to obtain authorization_code, make a request to the following URL:
2293    ///
2294    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
2295    ///   returned by ListDataSources method.
2296    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
2297    ///   method.
2298    ///
2299    /// Note that this should not be set when `service_account_name` is used to
2300    /// create the transfer config.
2301    #[deprecated]
2302    pub authorization_code: std::string::String,
2303
2304    /// Optional version info. This parameter replaces `authorization_code` which
2305    /// is no longer used in any data sources. This is required only if
2306    /// `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials
2307    /// are needed, as indicated by `CheckValidCreds`. In order to obtain version
2308    /// info, make a request to the following URL:
2309    ///
2310    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
2311    ///   returned by ListDataSources method.
2312    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
2313    ///   method.
2314    ///
2315    /// Note that this should not be set when `service_account_name` is used to
2316    /// create the transfer config.
2317    pub version_info: std::string::String,
2318
2319    /// Optional service account email. If this field is set, the transfer config
2320    /// will be created with this service account's credentials. It requires that
2321    /// the requesting user calling this API has permissions to act as this service
2322    /// account.
2323    ///
2324    /// Note that not all data sources support service account credentials when
2325    /// creating a transfer config. For the latest list of data sources, read about
2326    /// [using service
2327    /// accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
2328    pub service_account_name: std::string::String,
2329
2330    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2331}
2332
2333impl CreateTransferConfigRequest {
2334    pub fn new() -> Self {
2335        std::default::Default::default()
2336    }
2337
2338    /// Sets the value of [parent][crate::model::CreateTransferConfigRequest::parent].
2339    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2340        self.parent = v.into();
2341        self
2342    }
2343
2344    /// Sets the value of [transfer_config][crate::model::CreateTransferConfigRequest::transfer_config].
2345    pub fn set_transfer_config<T>(mut self, v: T) -> Self
2346    where
2347        T: std::convert::Into<crate::model::TransferConfig>,
2348    {
2349        self.transfer_config = std::option::Option::Some(v.into());
2350        self
2351    }
2352
2353    /// Sets or clears the value of [transfer_config][crate::model::CreateTransferConfigRequest::transfer_config].
2354    pub fn set_or_clear_transfer_config<T>(mut self, v: std::option::Option<T>) -> Self
2355    where
2356        T: std::convert::Into<crate::model::TransferConfig>,
2357    {
2358        self.transfer_config = v.map(|x| x.into());
2359        self
2360    }
2361
2362    /// Sets the value of [authorization_code][crate::model::CreateTransferConfigRequest::authorization_code].
2363    #[deprecated]
2364    pub fn set_authorization_code<T: std::convert::Into<std::string::String>>(
2365        mut self,
2366        v: T,
2367    ) -> Self {
2368        self.authorization_code = v.into();
2369        self
2370    }
2371
2372    /// Sets the value of [version_info][crate::model::CreateTransferConfigRequest::version_info].
2373    pub fn set_version_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2374        self.version_info = v.into();
2375        self
2376    }
2377
2378    /// Sets the value of [service_account_name][crate::model::CreateTransferConfigRequest::service_account_name].
2379    pub fn set_service_account_name<T: std::convert::Into<std::string::String>>(
2380        mut self,
2381        v: T,
2382    ) -> Self {
2383        self.service_account_name = v.into();
2384        self
2385    }
2386}
2387
2388impl wkt::message::Message for CreateTransferConfigRequest {
2389    fn typename() -> &'static str {
2390        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest"
2391    }
2392}
2393
2394#[doc(hidden)]
2395impl<'de> serde::de::Deserialize<'de> for CreateTransferConfigRequest {
2396    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2397    where
2398        D: serde::Deserializer<'de>,
2399    {
2400        #[allow(non_camel_case_types)]
2401        #[doc(hidden)]
2402        #[derive(PartialEq, Eq, Hash)]
2403        enum __FieldTag {
2404            __parent,
2405            __transfer_config,
2406            __authorization_code,
2407            __version_info,
2408            __service_account_name,
2409            Unknown(std::string::String),
2410        }
2411        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2412            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2413            where
2414                D: serde::Deserializer<'de>,
2415            {
2416                struct Visitor;
2417                impl<'de> serde::de::Visitor<'de> for Visitor {
2418                    type Value = __FieldTag;
2419                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2420                        formatter.write_str("a field name for CreateTransferConfigRequest")
2421                    }
2422                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2423                    where
2424                        E: serde::de::Error,
2425                    {
2426                        use std::result::Result::Ok;
2427                        use std::string::ToString;
2428                        match value {
2429                            "parent" => Ok(__FieldTag::__parent),
2430                            "transferConfig" => Ok(__FieldTag::__transfer_config),
2431                            "transfer_config" => Ok(__FieldTag::__transfer_config),
2432                            "authorizationCode" => Ok(__FieldTag::__authorization_code),
2433                            "authorization_code" => Ok(__FieldTag::__authorization_code),
2434                            "versionInfo" => Ok(__FieldTag::__version_info),
2435                            "version_info" => Ok(__FieldTag::__version_info),
2436                            "serviceAccountName" => Ok(__FieldTag::__service_account_name),
2437                            "service_account_name" => Ok(__FieldTag::__service_account_name),
2438                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2439                        }
2440                    }
2441                }
2442                deserializer.deserialize_identifier(Visitor)
2443            }
2444        }
2445        struct Visitor;
2446        impl<'de> serde::de::Visitor<'de> for Visitor {
2447            type Value = CreateTransferConfigRequest;
2448            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2449                formatter.write_str("struct CreateTransferConfigRequest")
2450            }
2451            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2452            where
2453                A: serde::de::MapAccess<'de>,
2454            {
2455                #[allow(unused_imports)]
2456                use serde::de::Error;
2457                use std::option::Option::Some;
2458                let mut fields = std::collections::HashSet::new();
2459                let mut result = Self::Value::new();
2460                while let Some(tag) = map.next_key::<__FieldTag>()? {
2461                    #[allow(clippy::match_single_binding)]
2462                    match tag {
2463                        __FieldTag::__parent => {
2464                            if !fields.insert(__FieldTag::__parent) {
2465                                return std::result::Result::Err(A::Error::duplicate_field(
2466                                    "multiple values for parent",
2467                                ));
2468                            }
2469                            result.parent = map
2470                                .next_value::<std::option::Option<std::string::String>>()?
2471                                .unwrap_or_default();
2472                        }
2473                        __FieldTag::__transfer_config => {
2474                            if !fields.insert(__FieldTag::__transfer_config) {
2475                                return std::result::Result::Err(A::Error::duplicate_field(
2476                                    "multiple values for transfer_config",
2477                                ));
2478                            }
2479                            result.transfer_config = map
2480                                .next_value::<std::option::Option<crate::model::TransferConfig>>(
2481                                )?;
2482                        }
2483                        __FieldTag::__authorization_code => {
2484                            if !fields.insert(__FieldTag::__authorization_code) {
2485                                return std::result::Result::Err(A::Error::duplicate_field(
2486                                    "multiple values for authorization_code",
2487                                ));
2488                            }
2489                            result.authorization_code = map
2490                                .next_value::<std::option::Option<std::string::String>>()?
2491                                .unwrap_or_default();
2492                        }
2493                        __FieldTag::__version_info => {
2494                            if !fields.insert(__FieldTag::__version_info) {
2495                                return std::result::Result::Err(A::Error::duplicate_field(
2496                                    "multiple values for version_info",
2497                                ));
2498                            }
2499                            result.version_info = map
2500                                .next_value::<std::option::Option<std::string::String>>()?
2501                                .unwrap_or_default();
2502                        }
2503                        __FieldTag::__service_account_name => {
2504                            if !fields.insert(__FieldTag::__service_account_name) {
2505                                return std::result::Result::Err(A::Error::duplicate_field(
2506                                    "multiple values for service_account_name",
2507                                ));
2508                            }
2509                            result.service_account_name = map
2510                                .next_value::<std::option::Option<std::string::String>>()?
2511                                .unwrap_or_default();
2512                        }
2513                        __FieldTag::Unknown(key) => {
2514                            let value = map.next_value::<serde_json::Value>()?;
2515                            result._unknown_fields.insert(key, value);
2516                        }
2517                    }
2518                }
2519                std::result::Result::Ok(result)
2520            }
2521        }
2522        deserializer.deserialize_any(Visitor)
2523    }
2524}
2525
2526#[doc(hidden)]
2527impl serde::ser::Serialize for CreateTransferConfigRequest {
2528    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2529    where
2530        S: serde::ser::Serializer,
2531    {
2532        use serde::ser::SerializeMap;
2533        #[allow(unused_imports)]
2534        use std::option::Option::Some;
2535        let mut state = serializer.serialize_map(std::option::Option::None)?;
2536        if !self.parent.is_empty() {
2537            state.serialize_entry("parent", &self.parent)?;
2538        }
2539        if self.transfer_config.is_some() {
2540            state.serialize_entry("transferConfig", &self.transfer_config)?;
2541        }
2542        if !self.authorization_code.is_empty() {
2543            state.serialize_entry("authorizationCode", &self.authorization_code)?;
2544        }
2545        if !self.version_info.is_empty() {
2546            state.serialize_entry("versionInfo", &self.version_info)?;
2547        }
2548        if !self.service_account_name.is_empty() {
2549            state.serialize_entry("serviceAccountName", &self.service_account_name)?;
2550        }
2551        if !self._unknown_fields.is_empty() {
2552            for (key, value) in self._unknown_fields.iter() {
2553                state.serialize_entry(key, &value)?;
2554            }
2555        }
2556        state.end()
2557    }
2558}
2559
2560/// A request to update a transfer configuration. To update the user id of the
2561/// transfer configuration, authorization info needs to be provided.
2562///
2563/// When using a cross project service account for updating a transfer config,
2564/// you must enable cross project service account usage. For more information,
2565/// see [Disable attachment of service accounts to resources in other
2566/// projects](https://cloud.google.com/resource-manager/docs/organization-policy/restricting-service-accounts#disable_cross_project_service_accounts).
2567#[derive(Clone, Debug, Default, PartialEq)]
2568#[non_exhaustive]
2569pub struct UpdateTransferConfigRequest {
2570    /// Required. Data transfer configuration to create.
2571    pub transfer_config: std::option::Option<crate::model::TransferConfig>,
2572
2573    /// Deprecated: Authorization code was required when
2574    /// `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used
2575    /// in any data sources. Use `version_info` instead.
2576    ///
2577    /// Optional OAuth2 authorization code to use with this transfer configuration.
2578    /// This is required only if `transferConfig.dataSourceId` is 'youtube_channel'
2579    /// and new credentials are needed, as indicated by `CheckValidCreds`. In order
2580    /// to obtain authorization_code, make a request to the following URL:
2581    ///
2582    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
2583    ///   returned by ListDataSources method.
2584    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
2585    ///   method.
2586    ///
2587    /// Note that this should not be set when `service_account_name` is used to
2588    /// update the transfer config.
2589    #[deprecated]
2590    pub authorization_code: std::string::String,
2591
2592    /// Required. Required list of fields to be updated in this request.
2593    pub update_mask: std::option::Option<wkt::FieldMask>,
2594
2595    /// Optional version info. This parameter replaces `authorization_code` which
2596    /// is no longer used in any data sources. This is required only if
2597    /// `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials
2598    /// are needed, as indicated by `CheckValidCreds`. In order to obtain version
2599    /// info, make a request to the following URL:
2600    ///
2601    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
2602    ///   returned by ListDataSources method.
2603    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
2604    ///   method.
2605    ///
2606    /// Note that this should not be set when `service_account_name` is used to
2607    /// update the transfer config.
2608    pub version_info: std::string::String,
2609
2610    /// Optional service account email. If this field is set, the transfer config
2611    /// will be created with this service account's credentials. It requires that
2612    /// the requesting user calling this API has permissions to act as this service
2613    /// account.
2614    ///
2615    /// Note that not all data sources support service account credentials when
2616    /// creating a transfer config. For the latest list of data sources, read about
2617    /// [using service
2618    /// accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
2619    pub service_account_name: std::string::String,
2620
2621    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2622}
2623
2624impl UpdateTransferConfigRequest {
2625    pub fn new() -> Self {
2626        std::default::Default::default()
2627    }
2628
2629    /// Sets the value of [transfer_config][crate::model::UpdateTransferConfigRequest::transfer_config].
2630    pub fn set_transfer_config<T>(mut self, v: T) -> Self
2631    where
2632        T: std::convert::Into<crate::model::TransferConfig>,
2633    {
2634        self.transfer_config = std::option::Option::Some(v.into());
2635        self
2636    }
2637
2638    /// Sets or clears the value of [transfer_config][crate::model::UpdateTransferConfigRequest::transfer_config].
2639    pub fn set_or_clear_transfer_config<T>(mut self, v: std::option::Option<T>) -> Self
2640    where
2641        T: std::convert::Into<crate::model::TransferConfig>,
2642    {
2643        self.transfer_config = v.map(|x| x.into());
2644        self
2645    }
2646
2647    /// Sets the value of [authorization_code][crate::model::UpdateTransferConfigRequest::authorization_code].
2648    #[deprecated]
2649    pub fn set_authorization_code<T: std::convert::Into<std::string::String>>(
2650        mut self,
2651        v: T,
2652    ) -> Self {
2653        self.authorization_code = v.into();
2654        self
2655    }
2656
2657    /// Sets the value of [update_mask][crate::model::UpdateTransferConfigRequest::update_mask].
2658    pub fn set_update_mask<T>(mut self, v: T) -> Self
2659    where
2660        T: std::convert::Into<wkt::FieldMask>,
2661    {
2662        self.update_mask = std::option::Option::Some(v.into());
2663        self
2664    }
2665
2666    /// Sets or clears the value of [update_mask][crate::model::UpdateTransferConfigRequest::update_mask].
2667    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2668    where
2669        T: std::convert::Into<wkt::FieldMask>,
2670    {
2671        self.update_mask = v.map(|x| x.into());
2672        self
2673    }
2674
2675    /// Sets the value of [version_info][crate::model::UpdateTransferConfigRequest::version_info].
2676    pub fn set_version_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2677        self.version_info = v.into();
2678        self
2679    }
2680
2681    /// Sets the value of [service_account_name][crate::model::UpdateTransferConfigRequest::service_account_name].
2682    pub fn set_service_account_name<T: std::convert::Into<std::string::String>>(
2683        mut self,
2684        v: T,
2685    ) -> Self {
2686        self.service_account_name = v.into();
2687        self
2688    }
2689}
2690
2691impl wkt::message::Message for UpdateTransferConfigRequest {
2692    fn typename() -> &'static str {
2693        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest"
2694    }
2695}
2696
2697#[doc(hidden)]
2698impl<'de> serde::de::Deserialize<'de> for UpdateTransferConfigRequest {
2699    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2700    where
2701        D: serde::Deserializer<'de>,
2702    {
2703        #[allow(non_camel_case_types)]
2704        #[doc(hidden)]
2705        #[derive(PartialEq, Eq, Hash)]
2706        enum __FieldTag {
2707            __transfer_config,
2708            __authorization_code,
2709            __update_mask,
2710            __version_info,
2711            __service_account_name,
2712            Unknown(std::string::String),
2713        }
2714        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2715            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2716            where
2717                D: serde::Deserializer<'de>,
2718            {
2719                struct Visitor;
2720                impl<'de> serde::de::Visitor<'de> for Visitor {
2721                    type Value = __FieldTag;
2722                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2723                        formatter.write_str("a field name for UpdateTransferConfigRequest")
2724                    }
2725                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2726                    where
2727                        E: serde::de::Error,
2728                    {
2729                        use std::result::Result::Ok;
2730                        use std::string::ToString;
2731                        match value {
2732                            "transferConfig" => Ok(__FieldTag::__transfer_config),
2733                            "transfer_config" => Ok(__FieldTag::__transfer_config),
2734                            "authorizationCode" => Ok(__FieldTag::__authorization_code),
2735                            "authorization_code" => Ok(__FieldTag::__authorization_code),
2736                            "updateMask" => Ok(__FieldTag::__update_mask),
2737                            "update_mask" => Ok(__FieldTag::__update_mask),
2738                            "versionInfo" => Ok(__FieldTag::__version_info),
2739                            "version_info" => Ok(__FieldTag::__version_info),
2740                            "serviceAccountName" => Ok(__FieldTag::__service_account_name),
2741                            "service_account_name" => Ok(__FieldTag::__service_account_name),
2742                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2743                        }
2744                    }
2745                }
2746                deserializer.deserialize_identifier(Visitor)
2747            }
2748        }
2749        struct Visitor;
2750        impl<'de> serde::de::Visitor<'de> for Visitor {
2751            type Value = UpdateTransferConfigRequest;
2752            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2753                formatter.write_str("struct UpdateTransferConfigRequest")
2754            }
2755            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2756            where
2757                A: serde::de::MapAccess<'de>,
2758            {
2759                #[allow(unused_imports)]
2760                use serde::de::Error;
2761                use std::option::Option::Some;
2762                let mut fields = std::collections::HashSet::new();
2763                let mut result = Self::Value::new();
2764                while let Some(tag) = map.next_key::<__FieldTag>()? {
2765                    #[allow(clippy::match_single_binding)]
2766                    match tag {
2767                        __FieldTag::__transfer_config => {
2768                            if !fields.insert(__FieldTag::__transfer_config) {
2769                                return std::result::Result::Err(A::Error::duplicate_field(
2770                                    "multiple values for transfer_config",
2771                                ));
2772                            }
2773                            result.transfer_config = map
2774                                .next_value::<std::option::Option<crate::model::TransferConfig>>(
2775                                )?;
2776                        }
2777                        __FieldTag::__authorization_code => {
2778                            if !fields.insert(__FieldTag::__authorization_code) {
2779                                return std::result::Result::Err(A::Error::duplicate_field(
2780                                    "multiple values for authorization_code",
2781                                ));
2782                            }
2783                            result.authorization_code = map
2784                                .next_value::<std::option::Option<std::string::String>>()?
2785                                .unwrap_or_default();
2786                        }
2787                        __FieldTag::__update_mask => {
2788                            if !fields.insert(__FieldTag::__update_mask) {
2789                                return std::result::Result::Err(A::Error::duplicate_field(
2790                                    "multiple values for update_mask",
2791                                ));
2792                            }
2793                            result.update_mask =
2794                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
2795                        }
2796                        __FieldTag::__version_info => {
2797                            if !fields.insert(__FieldTag::__version_info) {
2798                                return std::result::Result::Err(A::Error::duplicate_field(
2799                                    "multiple values for version_info",
2800                                ));
2801                            }
2802                            result.version_info = map
2803                                .next_value::<std::option::Option<std::string::String>>()?
2804                                .unwrap_or_default();
2805                        }
2806                        __FieldTag::__service_account_name => {
2807                            if !fields.insert(__FieldTag::__service_account_name) {
2808                                return std::result::Result::Err(A::Error::duplicate_field(
2809                                    "multiple values for service_account_name",
2810                                ));
2811                            }
2812                            result.service_account_name = map
2813                                .next_value::<std::option::Option<std::string::String>>()?
2814                                .unwrap_or_default();
2815                        }
2816                        __FieldTag::Unknown(key) => {
2817                            let value = map.next_value::<serde_json::Value>()?;
2818                            result._unknown_fields.insert(key, value);
2819                        }
2820                    }
2821                }
2822                std::result::Result::Ok(result)
2823            }
2824        }
2825        deserializer.deserialize_any(Visitor)
2826    }
2827}
2828
2829#[doc(hidden)]
2830impl serde::ser::Serialize for UpdateTransferConfigRequest {
2831    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2832    where
2833        S: serde::ser::Serializer,
2834    {
2835        use serde::ser::SerializeMap;
2836        #[allow(unused_imports)]
2837        use std::option::Option::Some;
2838        let mut state = serializer.serialize_map(std::option::Option::None)?;
2839        if self.transfer_config.is_some() {
2840            state.serialize_entry("transferConfig", &self.transfer_config)?;
2841        }
2842        if !self.authorization_code.is_empty() {
2843            state.serialize_entry("authorizationCode", &self.authorization_code)?;
2844        }
2845        if self.update_mask.is_some() {
2846            state.serialize_entry("updateMask", &self.update_mask)?;
2847        }
2848        if !self.version_info.is_empty() {
2849            state.serialize_entry("versionInfo", &self.version_info)?;
2850        }
2851        if !self.service_account_name.is_empty() {
2852            state.serialize_entry("serviceAccountName", &self.service_account_name)?;
2853        }
2854        if !self._unknown_fields.is_empty() {
2855            for (key, value) in self._unknown_fields.iter() {
2856                state.serialize_entry(key, &value)?;
2857            }
2858        }
2859        state.end()
2860    }
2861}
2862
2863/// A request to get data transfer information.
2864#[derive(Clone, Debug, Default, PartialEq)]
2865#[non_exhaustive]
2866pub struct GetTransferConfigRequest {
2867    /// Required. The field will contain name of the resource requested, for
2868    /// example: `projects/{project_id}/transferConfigs/{config_id}` or
2869    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
2870    pub name: std::string::String,
2871
2872    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2873}
2874
2875impl GetTransferConfigRequest {
2876    pub fn new() -> Self {
2877        std::default::Default::default()
2878    }
2879
2880    /// Sets the value of [name][crate::model::GetTransferConfigRequest::name].
2881    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2882        self.name = v.into();
2883        self
2884    }
2885}
2886
2887impl wkt::message::Message for GetTransferConfigRequest {
2888    fn typename() -> &'static str {
2889        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.GetTransferConfigRequest"
2890    }
2891}
2892
2893#[doc(hidden)]
2894impl<'de> serde::de::Deserialize<'de> for GetTransferConfigRequest {
2895    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2896    where
2897        D: serde::Deserializer<'de>,
2898    {
2899        #[allow(non_camel_case_types)]
2900        #[doc(hidden)]
2901        #[derive(PartialEq, Eq, Hash)]
2902        enum __FieldTag {
2903            __name,
2904            Unknown(std::string::String),
2905        }
2906        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2907            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2908            where
2909                D: serde::Deserializer<'de>,
2910            {
2911                struct Visitor;
2912                impl<'de> serde::de::Visitor<'de> for Visitor {
2913                    type Value = __FieldTag;
2914                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2915                        formatter.write_str("a field name for GetTransferConfigRequest")
2916                    }
2917                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2918                    where
2919                        E: serde::de::Error,
2920                    {
2921                        use std::result::Result::Ok;
2922                        use std::string::ToString;
2923                        match value {
2924                            "name" => Ok(__FieldTag::__name),
2925                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2926                        }
2927                    }
2928                }
2929                deserializer.deserialize_identifier(Visitor)
2930            }
2931        }
2932        struct Visitor;
2933        impl<'de> serde::de::Visitor<'de> for Visitor {
2934            type Value = GetTransferConfigRequest;
2935            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2936                formatter.write_str("struct GetTransferConfigRequest")
2937            }
2938            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2939            where
2940                A: serde::de::MapAccess<'de>,
2941            {
2942                #[allow(unused_imports)]
2943                use serde::de::Error;
2944                use std::option::Option::Some;
2945                let mut fields = std::collections::HashSet::new();
2946                let mut result = Self::Value::new();
2947                while let Some(tag) = map.next_key::<__FieldTag>()? {
2948                    #[allow(clippy::match_single_binding)]
2949                    match tag {
2950                        __FieldTag::__name => {
2951                            if !fields.insert(__FieldTag::__name) {
2952                                return std::result::Result::Err(A::Error::duplicate_field(
2953                                    "multiple values for name",
2954                                ));
2955                            }
2956                            result.name = map
2957                                .next_value::<std::option::Option<std::string::String>>()?
2958                                .unwrap_or_default();
2959                        }
2960                        __FieldTag::Unknown(key) => {
2961                            let value = map.next_value::<serde_json::Value>()?;
2962                            result._unknown_fields.insert(key, value);
2963                        }
2964                    }
2965                }
2966                std::result::Result::Ok(result)
2967            }
2968        }
2969        deserializer.deserialize_any(Visitor)
2970    }
2971}
2972
2973#[doc(hidden)]
2974impl serde::ser::Serialize for GetTransferConfigRequest {
2975    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2976    where
2977        S: serde::ser::Serializer,
2978    {
2979        use serde::ser::SerializeMap;
2980        #[allow(unused_imports)]
2981        use std::option::Option::Some;
2982        let mut state = serializer.serialize_map(std::option::Option::None)?;
2983        if !self.name.is_empty() {
2984            state.serialize_entry("name", &self.name)?;
2985        }
2986        if !self._unknown_fields.is_empty() {
2987            for (key, value) in self._unknown_fields.iter() {
2988                state.serialize_entry(key, &value)?;
2989            }
2990        }
2991        state.end()
2992    }
2993}
2994
2995/// A request to delete data transfer information. All associated transfer runs
2996/// and log messages will be deleted as well.
2997#[derive(Clone, Debug, Default, PartialEq)]
2998#[non_exhaustive]
2999pub struct DeleteTransferConfigRequest {
3000    /// Required. The field will contain name of the resource requested, for
3001    /// example: `projects/{project_id}/transferConfigs/{config_id}` or
3002    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
3003    pub name: std::string::String,
3004
3005    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3006}
3007
3008impl DeleteTransferConfigRequest {
3009    pub fn new() -> Self {
3010        std::default::Default::default()
3011    }
3012
3013    /// Sets the value of [name][crate::model::DeleteTransferConfigRequest::name].
3014    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3015        self.name = v.into();
3016        self
3017    }
3018}
3019
3020impl wkt::message::Message for DeleteTransferConfigRequest {
3021    fn typename() -> &'static str {
3022        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DeleteTransferConfigRequest"
3023    }
3024}
3025
3026#[doc(hidden)]
3027impl<'de> serde::de::Deserialize<'de> for DeleteTransferConfigRequest {
3028    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3029    where
3030        D: serde::Deserializer<'de>,
3031    {
3032        #[allow(non_camel_case_types)]
3033        #[doc(hidden)]
3034        #[derive(PartialEq, Eq, Hash)]
3035        enum __FieldTag {
3036            __name,
3037            Unknown(std::string::String),
3038        }
3039        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3040            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3041            where
3042                D: serde::Deserializer<'de>,
3043            {
3044                struct Visitor;
3045                impl<'de> serde::de::Visitor<'de> for Visitor {
3046                    type Value = __FieldTag;
3047                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3048                        formatter.write_str("a field name for DeleteTransferConfigRequest")
3049                    }
3050                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3051                    where
3052                        E: serde::de::Error,
3053                    {
3054                        use std::result::Result::Ok;
3055                        use std::string::ToString;
3056                        match value {
3057                            "name" => Ok(__FieldTag::__name),
3058                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3059                        }
3060                    }
3061                }
3062                deserializer.deserialize_identifier(Visitor)
3063            }
3064        }
3065        struct Visitor;
3066        impl<'de> serde::de::Visitor<'de> for Visitor {
3067            type Value = DeleteTransferConfigRequest;
3068            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3069                formatter.write_str("struct DeleteTransferConfigRequest")
3070            }
3071            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3072            where
3073                A: serde::de::MapAccess<'de>,
3074            {
3075                #[allow(unused_imports)]
3076                use serde::de::Error;
3077                use std::option::Option::Some;
3078                let mut fields = std::collections::HashSet::new();
3079                let mut result = Self::Value::new();
3080                while let Some(tag) = map.next_key::<__FieldTag>()? {
3081                    #[allow(clippy::match_single_binding)]
3082                    match tag {
3083                        __FieldTag::__name => {
3084                            if !fields.insert(__FieldTag::__name) {
3085                                return std::result::Result::Err(A::Error::duplicate_field(
3086                                    "multiple values for name",
3087                                ));
3088                            }
3089                            result.name = map
3090                                .next_value::<std::option::Option<std::string::String>>()?
3091                                .unwrap_or_default();
3092                        }
3093                        __FieldTag::Unknown(key) => {
3094                            let value = map.next_value::<serde_json::Value>()?;
3095                            result._unknown_fields.insert(key, value);
3096                        }
3097                    }
3098                }
3099                std::result::Result::Ok(result)
3100            }
3101        }
3102        deserializer.deserialize_any(Visitor)
3103    }
3104}
3105
3106#[doc(hidden)]
3107impl serde::ser::Serialize for DeleteTransferConfigRequest {
3108    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3109    where
3110        S: serde::ser::Serializer,
3111    {
3112        use serde::ser::SerializeMap;
3113        #[allow(unused_imports)]
3114        use std::option::Option::Some;
3115        let mut state = serializer.serialize_map(std::option::Option::None)?;
3116        if !self.name.is_empty() {
3117            state.serialize_entry("name", &self.name)?;
3118        }
3119        if !self._unknown_fields.is_empty() {
3120            for (key, value) in self._unknown_fields.iter() {
3121                state.serialize_entry(key, &value)?;
3122            }
3123        }
3124        state.end()
3125    }
3126}
3127
3128/// A request to get data transfer run information.
3129#[derive(Clone, Debug, Default, PartialEq)]
3130#[non_exhaustive]
3131pub struct GetTransferRunRequest {
3132    /// Required. The field will contain name of the resource requested, for
3133    /// example: `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`
3134    /// or
3135    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
3136    pub name: std::string::String,
3137
3138    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3139}
3140
3141impl GetTransferRunRequest {
3142    pub fn new() -> Self {
3143        std::default::Default::default()
3144    }
3145
3146    /// Sets the value of [name][crate::model::GetTransferRunRequest::name].
3147    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3148        self.name = v.into();
3149        self
3150    }
3151}
3152
3153impl wkt::message::Message for GetTransferRunRequest {
3154    fn typename() -> &'static str {
3155        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.GetTransferRunRequest"
3156    }
3157}
3158
3159#[doc(hidden)]
3160impl<'de> serde::de::Deserialize<'de> for GetTransferRunRequest {
3161    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3162    where
3163        D: serde::Deserializer<'de>,
3164    {
3165        #[allow(non_camel_case_types)]
3166        #[doc(hidden)]
3167        #[derive(PartialEq, Eq, Hash)]
3168        enum __FieldTag {
3169            __name,
3170            Unknown(std::string::String),
3171        }
3172        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3173            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3174            where
3175                D: serde::Deserializer<'de>,
3176            {
3177                struct Visitor;
3178                impl<'de> serde::de::Visitor<'de> for Visitor {
3179                    type Value = __FieldTag;
3180                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3181                        formatter.write_str("a field name for GetTransferRunRequest")
3182                    }
3183                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3184                    where
3185                        E: serde::de::Error,
3186                    {
3187                        use std::result::Result::Ok;
3188                        use std::string::ToString;
3189                        match value {
3190                            "name" => Ok(__FieldTag::__name),
3191                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3192                        }
3193                    }
3194                }
3195                deserializer.deserialize_identifier(Visitor)
3196            }
3197        }
3198        struct Visitor;
3199        impl<'de> serde::de::Visitor<'de> for Visitor {
3200            type Value = GetTransferRunRequest;
3201            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3202                formatter.write_str("struct GetTransferRunRequest")
3203            }
3204            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3205            where
3206                A: serde::de::MapAccess<'de>,
3207            {
3208                #[allow(unused_imports)]
3209                use serde::de::Error;
3210                use std::option::Option::Some;
3211                let mut fields = std::collections::HashSet::new();
3212                let mut result = Self::Value::new();
3213                while let Some(tag) = map.next_key::<__FieldTag>()? {
3214                    #[allow(clippy::match_single_binding)]
3215                    match tag {
3216                        __FieldTag::__name => {
3217                            if !fields.insert(__FieldTag::__name) {
3218                                return std::result::Result::Err(A::Error::duplicate_field(
3219                                    "multiple values for name",
3220                                ));
3221                            }
3222                            result.name = map
3223                                .next_value::<std::option::Option<std::string::String>>()?
3224                                .unwrap_or_default();
3225                        }
3226                        __FieldTag::Unknown(key) => {
3227                            let value = map.next_value::<serde_json::Value>()?;
3228                            result._unknown_fields.insert(key, value);
3229                        }
3230                    }
3231                }
3232                std::result::Result::Ok(result)
3233            }
3234        }
3235        deserializer.deserialize_any(Visitor)
3236    }
3237}
3238
3239#[doc(hidden)]
3240impl serde::ser::Serialize for GetTransferRunRequest {
3241    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3242    where
3243        S: serde::ser::Serializer,
3244    {
3245        use serde::ser::SerializeMap;
3246        #[allow(unused_imports)]
3247        use std::option::Option::Some;
3248        let mut state = serializer.serialize_map(std::option::Option::None)?;
3249        if !self.name.is_empty() {
3250            state.serialize_entry("name", &self.name)?;
3251        }
3252        if !self._unknown_fields.is_empty() {
3253            for (key, value) in self._unknown_fields.iter() {
3254                state.serialize_entry(key, &value)?;
3255            }
3256        }
3257        state.end()
3258    }
3259}
3260
3261/// A request to delete data transfer run information.
3262#[derive(Clone, Debug, Default, PartialEq)]
3263#[non_exhaustive]
3264pub struct DeleteTransferRunRequest {
3265    /// Required. The field will contain name of the resource requested, for
3266    /// example: `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`
3267    /// or
3268    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
3269    pub name: std::string::String,
3270
3271    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3272}
3273
3274impl DeleteTransferRunRequest {
3275    pub fn new() -> Self {
3276        std::default::Default::default()
3277    }
3278
3279    /// Sets the value of [name][crate::model::DeleteTransferRunRequest::name].
3280    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3281        self.name = v.into();
3282        self
3283    }
3284}
3285
3286impl wkt::message::Message for DeleteTransferRunRequest {
3287    fn typename() -> &'static str {
3288        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DeleteTransferRunRequest"
3289    }
3290}
3291
3292#[doc(hidden)]
3293impl<'de> serde::de::Deserialize<'de> for DeleteTransferRunRequest {
3294    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3295    where
3296        D: serde::Deserializer<'de>,
3297    {
3298        #[allow(non_camel_case_types)]
3299        #[doc(hidden)]
3300        #[derive(PartialEq, Eq, Hash)]
3301        enum __FieldTag {
3302            __name,
3303            Unknown(std::string::String),
3304        }
3305        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3306            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3307            where
3308                D: serde::Deserializer<'de>,
3309            {
3310                struct Visitor;
3311                impl<'de> serde::de::Visitor<'de> for Visitor {
3312                    type Value = __FieldTag;
3313                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3314                        formatter.write_str("a field name for DeleteTransferRunRequest")
3315                    }
3316                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3317                    where
3318                        E: serde::de::Error,
3319                    {
3320                        use std::result::Result::Ok;
3321                        use std::string::ToString;
3322                        match value {
3323                            "name" => Ok(__FieldTag::__name),
3324                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3325                        }
3326                    }
3327                }
3328                deserializer.deserialize_identifier(Visitor)
3329            }
3330        }
3331        struct Visitor;
3332        impl<'de> serde::de::Visitor<'de> for Visitor {
3333            type Value = DeleteTransferRunRequest;
3334            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3335                formatter.write_str("struct DeleteTransferRunRequest")
3336            }
3337            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3338            where
3339                A: serde::de::MapAccess<'de>,
3340            {
3341                #[allow(unused_imports)]
3342                use serde::de::Error;
3343                use std::option::Option::Some;
3344                let mut fields = std::collections::HashSet::new();
3345                let mut result = Self::Value::new();
3346                while let Some(tag) = map.next_key::<__FieldTag>()? {
3347                    #[allow(clippy::match_single_binding)]
3348                    match tag {
3349                        __FieldTag::__name => {
3350                            if !fields.insert(__FieldTag::__name) {
3351                                return std::result::Result::Err(A::Error::duplicate_field(
3352                                    "multiple values for name",
3353                                ));
3354                            }
3355                            result.name = map
3356                                .next_value::<std::option::Option<std::string::String>>()?
3357                                .unwrap_or_default();
3358                        }
3359                        __FieldTag::Unknown(key) => {
3360                            let value = map.next_value::<serde_json::Value>()?;
3361                            result._unknown_fields.insert(key, value);
3362                        }
3363                    }
3364                }
3365                std::result::Result::Ok(result)
3366            }
3367        }
3368        deserializer.deserialize_any(Visitor)
3369    }
3370}
3371
3372#[doc(hidden)]
3373impl serde::ser::Serialize for DeleteTransferRunRequest {
3374    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3375    where
3376        S: serde::ser::Serializer,
3377    {
3378        use serde::ser::SerializeMap;
3379        #[allow(unused_imports)]
3380        use std::option::Option::Some;
3381        let mut state = serializer.serialize_map(std::option::Option::None)?;
3382        if !self.name.is_empty() {
3383            state.serialize_entry("name", &self.name)?;
3384        }
3385        if !self._unknown_fields.is_empty() {
3386            for (key, value) in self._unknown_fields.iter() {
3387                state.serialize_entry(key, &value)?;
3388            }
3389        }
3390        state.end()
3391    }
3392}
3393
3394/// A request to list data transfers configured for a BigQuery project.
3395#[derive(Clone, Debug, Default, PartialEq)]
3396#[non_exhaustive]
3397pub struct ListTransferConfigsRequest {
3398    /// Required. The BigQuery project id for which transfer configs
3399    /// should be returned: `projects/{project_id}` or
3400    /// `projects/{project_id}/locations/{location_id}`
3401    pub parent: std::string::String,
3402
3403    /// When specified, only configurations of requested data sources are returned.
3404    pub data_source_ids: std::vec::Vec<std::string::String>,
3405
3406    /// Pagination token, which can be used to request a specific page
3407    /// of `ListTransfersRequest` list results. For multiple-page
3408    /// results, `ListTransfersResponse` outputs
3409    /// a `next_page` token, which can be used as the
3410    /// `page_token` value to request the next page of list results.
3411    pub page_token: std::string::String,
3412
3413    /// Page size. The default page size is the maximum value of 1000 results.
3414    pub page_size: i32,
3415
3416    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3417}
3418
3419impl ListTransferConfigsRequest {
3420    pub fn new() -> Self {
3421        std::default::Default::default()
3422    }
3423
3424    /// Sets the value of [parent][crate::model::ListTransferConfigsRequest::parent].
3425    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3426        self.parent = v.into();
3427        self
3428    }
3429
3430    /// Sets the value of [data_source_ids][crate::model::ListTransferConfigsRequest::data_source_ids].
3431    pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
3432    where
3433        T: std::iter::IntoIterator<Item = V>,
3434        V: std::convert::Into<std::string::String>,
3435    {
3436        use std::iter::Iterator;
3437        self.data_source_ids = v.into_iter().map(|i| i.into()).collect();
3438        self
3439    }
3440
3441    /// Sets the value of [page_token][crate::model::ListTransferConfigsRequest::page_token].
3442    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3443        self.page_token = v.into();
3444        self
3445    }
3446
3447    /// Sets the value of [page_size][crate::model::ListTransferConfigsRequest::page_size].
3448    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3449        self.page_size = v.into();
3450        self
3451    }
3452}
3453
3454impl wkt::message::Message for ListTransferConfigsRequest {
3455    fn typename() -> &'static str {
3456        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferConfigsRequest"
3457    }
3458}
3459
3460#[doc(hidden)]
3461impl<'de> serde::de::Deserialize<'de> for ListTransferConfigsRequest {
3462    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3463    where
3464        D: serde::Deserializer<'de>,
3465    {
3466        #[allow(non_camel_case_types)]
3467        #[doc(hidden)]
3468        #[derive(PartialEq, Eq, Hash)]
3469        enum __FieldTag {
3470            __parent,
3471            __data_source_ids,
3472            __page_token,
3473            __page_size,
3474            Unknown(std::string::String),
3475        }
3476        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3477            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3478            where
3479                D: serde::Deserializer<'de>,
3480            {
3481                struct Visitor;
3482                impl<'de> serde::de::Visitor<'de> for Visitor {
3483                    type Value = __FieldTag;
3484                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3485                        formatter.write_str("a field name for ListTransferConfigsRequest")
3486                    }
3487                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3488                    where
3489                        E: serde::de::Error,
3490                    {
3491                        use std::result::Result::Ok;
3492                        use std::string::ToString;
3493                        match value {
3494                            "parent" => Ok(__FieldTag::__parent),
3495                            "dataSourceIds" => Ok(__FieldTag::__data_source_ids),
3496                            "data_source_ids" => Ok(__FieldTag::__data_source_ids),
3497                            "pageToken" => Ok(__FieldTag::__page_token),
3498                            "page_token" => Ok(__FieldTag::__page_token),
3499                            "pageSize" => Ok(__FieldTag::__page_size),
3500                            "page_size" => Ok(__FieldTag::__page_size),
3501                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3502                        }
3503                    }
3504                }
3505                deserializer.deserialize_identifier(Visitor)
3506            }
3507        }
3508        struct Visitor;
3509        impl<'de> serde::de::Visitor<'de> for Visitor {
3510            type Value = ListTransferConfigsRequest;
3511            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3512                formatter.write_str("struct ListTransferConfigsRequest")
3513            }
3514            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3515            where
3516                A: serde::de::MapAccess<'de>,
3517            {
3518                #[allow(unused_imports)]
3519                use serde::de::Error;
3520                use std::option::Option::Some;
3521                let mut fields = std::collections::HashSet::new();
3522                let mut result = Self::Value::new();
3523                while let Some(tag) = map.next_key::<__FieldTag>()? {
3524                    #[allow(clippy::match_single_binding)]
3525                    match tag {
3526                        __FieldTag::__parent => {
3527                            if !fields.insert(__FieldTag::__parent) {
3528                                return std::result::Result::Err(A::Error::duplicate_field(
3529                                    "multiple values for parent",
3530                                ));
3531                            }
3532                            result.parent = map
3533                                .next_value::<std::option::Option<std::string::String>>()?
3534                                .unwrap_or_default();
3535                        }
3536                        __FieldTag::__data_source_ids => {
3537                            if !fields.insert(__FieldTag::__data_source_ids) {
3538                                return std::result::Result::Err(A::Error::duplicate_field(
3539                                    "multiple values for data_source_ids",
3540                                ));
3541                            }
3542                            result.data_source_ids = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3543                        }
3544                        __FieldTag::__page_token => {
3545                            if !fields.insert(__FieldTag::__page_token) {
3546                                return std::result::Result::Err(A::Error::duplicate_field(
3547                                    "multiple values for page_token",
3548                                ));
3549                            }
3550                            result.page_token = map
3551                                .next_value::<std::option::Option<std::string::String>>()?
3552                                .unwrap_or_default();
3553                        }
3554                        __FieldTag::__page_size => {
3555                            if !fields.insert(__FieldTag::__page_size) {
3556                                return std::result::Result::Err(A::Error::duplicate_field(
3557                                    "multiple values for page_size",
3558                                ));
3559                            }
3560                            struct __With(std::option::Option<i32>);
3561                            impl<'de> serde::de::Deserialize<'de> for __With {
3562                                fn deserialize<D>(
3563                                    deserializer: D,
3564                                ) -> std::result::Result<Self, D::Error>
3565                                where
3566                                    D: serde::de::Deserializer<'de>,
3567                                {
3568                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3569                                }
3570                            }
3571                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3572                        }
3573                        __FieldTag::Unknown(key) => {
3574                            let value = map.next_value::<serde_json::Value>()?;
3575                            result._unknown_fields.insert(key, value);
3576                        }
3577                    }
3578                }
3579                std::result::Result::Ok(result)
3580            }
3581        }
3582        deserializer.deserialize_any(Visitor)
3583    }
3584}
3585
3586#[doc(hidden)]
3587impl serde::ser::Serialize for ListTransferConfigsRequest {
3588    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3589    where
3590        S: serde::ser::Serializer,
3591    {
3592        use serde::ser::SerializeMap;
3593        #[allow(unused_imports)]
3594        use std::option::Option::Some;
3595        let mut state = serializer.serialize_map(std::option::Option::None)?;
3596        if !self.parent.is_empty() {
3597            state.serialize_entry("parent", &self.parent)?;
3598        }
3599        if !self.data_source_ids.is_empty() {
3600            state.serialize_entry("dataSourceIds", &self.data_source_ids)?;
3601        }
3602        if !self.page_token.is_empty() {
3603            state.serialize_entry("pageToken", &self.page_token)?;
3604        }
3605        if !wkt::internal::is_default(&self.page_size) {
3606            struct __With<'a>(&'a i32);
3607            impl<'a> serde::ser::Serialize for __With<'a> {
3608                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3609                where
3610                    S: serde::ser::Serializer,
3611                {
3612                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3613                }
3614            }
3615            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3616        }
3617        if !self._unknown_fields.is_empty() {
3618            for (key, value) in self._unknown_fields.iter() {
3619                state.serialize_entry(key, &value)?;
3620            }
3621        }
3622        state.end()
3623    }
3624}
3625
3626/// The returned list of pipelines in the project.
3627#[derive(Clone, Debug, Default, PartialEq)]
3628#[non_exhaustive]
3629pub struct ListTransferConfigsResponse {
3630    /// Output only. The stored pipeline transfer configurations.
3631    pub transfer_configs: std::vec::Vec<crate::model::TransferConfig>,
3632
3633    /// Output only. The next-pagination token. For multiple-page list results,
3634    /// this token can be used as the
3635    /// `ListTransferConfigsRequest.page_token`
3636    /// to request the next page of list results.
3637    pub next_page_token: std::string::String,
3638
3639    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3640}
3641
3642impl ListTransferConfigsResponse {
3643    pub fn new() -> Self {
3644        std::default::Default::default()
3645    }
3646
3647    /// Sets the value of [transfer_configs][crate::model::ListTransferConfigsResponse::transfer_configs].
3648    pub fn set_transfer_configs<T, V>(mut self, v: T) -> Self
3649    where
3650        T: std::iter::IntoIterator<Item = V>,
3651        V: std::convert::Into<crate::model::TransferConfig>,
3652    {
3653        use std::iter::Iterator;
3654        self.transfer_configs = v.into_iter().map(|i| i.into()).collect();
3655        self
3656    }
3657
3658    /// Sets the value of [next_page_token][crate::model::ListTransferConfigsResponse::next_page_token].
3659    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3660        self.next_page_token = v.into();
3661        self
3662    }
3663}
3664
3665impl wkt::message::Message for ListTransferConfigsResponse {
3666    fn typename() -> &'static str {
3667        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferConfigsResponse"
3668    }
3669}
3670
3671#[doc(hidden)]
3672impl gax::paginator::internal::PageableResponse for ListTransferConfigsResponse {
3673    type PageItem = crate::model::TransferConfig;
3674
3675    fn items(self) -> std::vec::Vec<Self::PageItem> {
3676        self.transfer_configs
3677    }
3678
3679    fn next_page_token(&self) -> std::string::String {
3680        use std::clone::Clone;
3681        self.next_page_token.clone()
3682    }
3683}
3684
3685#[doc(hidden)]
3686impl<'de> serde::de::Deserialize<'de> for ListTransferConfigsResponse {
3687    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3688    where
3689        D: serde::Deserializer<'de>,
3690    {
3691        #[allow(non_camel_case_types)]
3692        #[doc(hidden)]
3693        #[derive(PartialEq, Eq, Hash)]
3694        enum __FieldTag {
3695            __transfer_configs,
3696            __next_page_token,
3697            Unknown(std::string::String),
3698        }
3699        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3700            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3701            where
3702                D: serde::Deserializer<'de>,
3703            {
3704                struct Visitor;
3705                impl<'de> serde::de::Visitor<'de> for Visitor {
3706                    type Value = __FieldTag;
3707                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3708                        formatter.write_str("a field name for ListTransferConfigsResponse")
3709                    }
3710                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3711                    where
3712                        E: serde::de::Error,
3713                    {
3714                        use std::result::Result::Ok;
3715                        use std::string::ToString;
3716                        match value {
3717                            "transferConfigs" => Ok(__FieldTag::__transfer_configs),
3718                            "transfer_configs" => Ok(__FieldTag::__transfer_configs),
3719                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3720                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3721                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3722                        }
3723                    }
3724                }
3725                deserializer.deserialize_identifier(Visitor)
3726            }
3727        }
3728        struct Visitor;
3729        impl<'de> serde::de::Visitor<'de> for Visitor {
3730            type Value = ListTransferConfigsResponse;
3731            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3732                formatter.write_str("struct ListTransferConfigsResponse")
3733            }
3734            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3735            where
3736                A: serde::de::MapAccess<'de>,
3737            {
3738                #[allow(unused_imports)]
3739                use serde::de::Error;
3740                use std::option::Option::Some;
3741                let mut fields = std::collections::HashSet::new();
3742                let mut result = Self::Value::new();
3743                while let Some(tag) = map.next_key::<__FieldTag>()? {
3744                    #[allow(clippy::match_single_binding)]
3745                    match tag {
3746                        __FieldTag::__transfer_configs => {
3747                            if !fields.insert(__FieldTag::__transfer_configs) {
3748                                return std::result::Result::Err(A::Error::duplicate_field(
3749                                    "multiple values for transfer_configs",
3750                                ));
3751                            }
3752                            result.transfer_configs =
3753                                map.next_value::<std::option::Option<
3754                                    std::vec::Vec<crate::model::TransferConfig>,
3755                                >>()?
3756                                .unwrap_or_default();
3757                        }
3758                        __FieldTag::__next_page_token => {
3759                            if !fields.insert(__FieldTag::__next_page_token) {
3760                                return std::result::Result::Err(A::Error::duplicate_field(
3761                                    "multiple values for next_page_token",
3762                                ));
3763                            }
3764                            result.next_page_token = map
3765                                .next_value::<std::option::Option<std::string::String>>()?
3766                                .unwrap_or_default();
3767                        }
3768                        __FieldTag::Unknown(key) => {
3769                            let value = map.next_value::<serde_json::Value>()?;
3770                            result._unknown_fields.insert(key, value);
3771                        }
3772                    }
3773                }
3774                std::result::Result::Ok(result)
3775            }
3776        }
3777        deserializer.deserialize_any(Visitor)
3778    }
3779}
3780
3781#[doc(hidden)]
3782impl serde::ser::Serialize for ListTransferConfigsResponse {
3783    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3784    where
3785        S: serde::ser::Serializer,
3786    {
3787        use serde::ser::SerializeMap;
3788        #[allow(unused_imports)]
3789        use std::option::Option::Some;
3790        let mut state = serializer.serialize_map(std::option::Option::None)?;
3791        if !self.transfer_configs.is_empty() {
3792            state.serialize_entry("transferConfigs", &self.transfer_configs)?;
3793        }
3794        if !self.next_page_token.is_empty() {
3795            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3796        }
3797        if !self._unknown_fields.is_empty() {
3798            for (key, value) in self._unknown_fields.iter() {
3799                state.serialize_entry(key, &value)?;
3800            }
3801        }
3802        state.end()
3803    }
3804}
3805
3806/// A request to list data transfer runs.
3807#[derive(Clone, Debug, Default, PartialEq)]
3808#[non_exhaustive]
3809pub struct ListTransferRunsRequest {
3810    /// Required. Name of transfer configuration for which transfer runs should be
3811    /// retrieved. Format of transfer configuration resource name is:
3812    /// `projects/{project_id}/transferConfigs/{config_id}` or
3813    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
3814    pub parent: std::string::String,
3815
3816    /// When specified, only transfer runs with requested states are returned.
3817    pub states: std::vec::Vec<crate::model::TransferState>,
3818
3819    /// Pagination token, which can be used to request a specific page
3820    /// of `ListTransferRunsRequest` list results. For multiple-page
3821    /// results, `ListTransferRunsResponse` outputs
3822    /// a `next_page` token, which can be used as the
3823    /// `page_token` value to request the next page of list results.
3824    pub page_token: std::string::String,
3825
3826    /// Page size. The default page size is the maximum value of 1000 results.
3827    pub page_size: i32,
3828
3829    /// Indicates how run attempts are to be pulled.
3830    pub run_attempt: crate::model::list_transfer_runs_request::RunAttempt,
3831
3832    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3833}
3834
3835impl ListTransferRunsRequest {
3836    pub fn new() -> Self {
3837        std::default::Default::default()
3838    }
3839
3840    /// Sets the value of [parent][crate::model::ListTransferRunsRequest::parent].
3841    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3842        self.parent = v.into();
3843        self
3844    }
3845
3846    /// Sets the value of [states][crate::model::ListTransferRunsRequest::states].
3847    pub fn set_states<T, V>(mut self, v: T) -> Self
3848    where
3849        T: std::iter::IntoIterator<Item = V>,
3850        V: std::convert::Into<crate::model::TransferState>,
3851    {
3852        use std::iter::Iterator;
3853        self.states = v.into_iter().map(|i| i.into()).collect();
3854        self
3855    }
3856
3857    /// Sets the value of [page_token][crate::model::ListTransferRunsRequest::page_token].
3858    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3859        self.page_token = v.into();
3860        self
3861    }
3862
3863    /// Sets the value of [page_size][crate::model::ListTransferRunsRequest::page_size].
3864    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3865        self.page_size = v.into();
3866        self
3867    }
3868
3869    /// Sets the value of [run_attempt][crate::model::ListTransferRunsRequest::run_attempt].
3870    pub fn set_run_attempt<
3871        T: std::convert::Into<crate::model::list_transfer_runs_request::RunAttempt>,
3872    >(
3873        mut self,
3874        v: T,
3875    ) -> Self {
3876        self.run_attempt = v.into();
3877        self
3878    }
3879}
3880
3881impl wkt::message::Message for ListTransferRunsRequest {
3882    fn typename() -> &'static str {
3883        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferRunsRequest"
3884    }
3885}
3886
3887#[doc(hidden)]
3888impl<'de> serde::de::Deserialize<'de> for ListTransferRunsRequest {
3889    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3890    where
3891        D: serde::Deserializer<'de>,
3892    {
3893        #[allow(non_camel_case_types)]
3894        #[doc(hidden)]
3895        #[derive(PartialEq, Eq, Hash)]
3896        enum __FieldTag {
3897            __parent,
3898            __states,
3899            __page_token,
3900            __page_size,
3901            __run_attempt,
3902            Unknown(std::string::String),
3903        }
3904        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3905            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3906            where
3907                D: serde::Deserializer<'de>,
3908            {
3909                struct Visitor;
3910                impl<'de> serde::de::Visitor<'de> for Visitor {
3911                    type Value = __FieldTag;
3912                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3913                        formatter.write_str("a field name for ListTransferRunsRequest")
3914                    }
3915                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3916                    where
3917                        E: serde::de::Error,
3918                    {
3919                        use std::result::Result::Ok;
3920                        use std::string::ToString;
3921                        match value {
3922                            "parent" => Ok(__FieldTag::__parent),
3923                            "states" => Ok(__FieldTag::__states),
3924                            "pageToken" => Ok(__FieldTag::__page_token),
3925                            "page_token" => Ok(__FieldTag::__page_token),
3926                            "pageSize" => Ok(__FieldTag::__page_size),
3927                            "page_size" => Ok(__FieldTag::__page_size),
3928                            "runAttempt" => Ok(__FieldTag::__run_attempt),
3929                            "run_attempt" => Ok(__FieldTag::__run_attempt),
3930                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3931                        }
3932                    }
3933                }
3934                deserializer.deserialize_identifier(Visitor)
3935            }
3936        }
3937        struct Visitor;
3938        impl<'de> serde::de::Visitor<'de> for Visitor {
3939            type Value = ListTransferRunsRequest;
3940            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3941                formatter.write_str("struct ListTransferRunsRequest")
3942            }
3943            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3944            where
3945                A: serde::de::MapAccess<'de>,
3946            {
3947                #[allow(unused_imports)]
3948                use serde::de::Error;
3949                use std::option::Option::Some;
3950                let mut fields = std::collections::HashSet::new();
3951                let mut result = Self::Value::new();
3952                while let Some(tag) = map.next_key::<__FieldTag>()? {
3953                    #[allow(clippy::match_single_binding)]
3954                    match tag {
3955                        __FieldTag::__parent => {
3956                            if !fields.insert(__FieldTag::__parent) {
3957                                return std::result::Result::Err(A::Error::duplicate_field(
3958                                    "multiple values for parent",
3959                                ));
3960                            }
3961                            result.parent = map
3962                                .next_value::<std::option::Option<std::string::String>>()?
3963                                .unwrap_or_default();
3964                        }
3965                        __FieldTag::__states => {
3966                            if !fields.insert(__FieldTag::__states) {
3967                                return std::result::Result::Err(A::Error::duplicate_field(
3968                                    "multiple values for states",
3969                                ));
3970                            }
3971                            result.states = map.next_value::<std::option::Option<std::vec::Vec<crate::model::TransferState>>>()?.unwrap_or_default();
3972                        }
3973                        __FieldTag::__page_token => {
3974                            if !fields.insert(__FieldTag::__page_token) {
3975                                return std::result::Result::Err(A::Error::duplicate_field(
3976                                    "multiple values for page_token",
3977                                ));
3978                            }
3979                            result.page_token = map
3980                                .next_value::<std::option::Option<std::string::String>>()?
3981                                .unwrap_or_default();
3982                        }
3983                        __FieldTag::__page_size => {
3984                            if !fields.insert(__FieldTag::__page_size) {
3985                                return std::result::Result::Err(A::Error::duplicate_field(
3986                                    "multiple values for page_size",
3987                                ));
3988                            }
3989                            struct __With(std::option::Option<i32>);
3990                            impl<'de> serde::de::Deserialize<'de> for __With {
3991                                fn deserialize<D>(
3992                                    deserializer: D,
3993                                ) -> std::result::Result<Self, D::Error>
3994                                where
3995                                    D: serde::de::Deserializer<'de>,
3996                                {
3997                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3998                                }
3999                            }
4000                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
4001                        }
4002                        __FieldTag::__run_attempt => {
4003                            if !fields.insert(__FieldTag::__run_attempt) {
4004                                return std::result::Result::Err(A::Error::duplicate_field(
4005                                    "multiple values for run_attempt",
4006                                ));
4007                            }
4008                            result.run_attempt = map
4009                                .next_value::<std::option::Option<
4010                                    crate::model::list_transfer_runs_request::RunAttempt,
4011                                >>()?
4012                                .unwrap_or_default();
4013                        }
4014                        __FieldTag::Unknown(key) => {
4015                            let value = map.next_value::<serde_json::Value>()?;
4016                            result._unknown_fields.insert(key, value);
4017                        }
4018                    }
4019                }
4020                std::result::Result::Ok(result)
4021            }
4022        }
4023        deserializer.deserialize_any(Visitor)
4024    }
4025}
4026
4027#[doc(hidden)]
4028impl serde::ser::Serialize for ListTransferRunsRequest {
4029    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4030    where
4031        S: serde::ser::Serializer,
4032    {
4033        use serde::ser::SerializeMap;
4034        #[allow(unused_imports)]
4035        use std::option::Option::Some;
4036        let mut state = serializer.serialize_map(std::option::Option::None)?;
4037        if !self.parent.is_empty() {
4038            state.serialize_entry("parent", &self.parent)?;
4039        }
4040        if !self.states.is_empty() {
4041            state.serialize_entry("states", &self.states)?;
4042        }
4043        if !self.page_token.is_empty() {
4044            state.serialize_entry("pageToken", &self.page_token)?;
4045        }
4046        if !wkt::internal::is_default(&self.page_size) {
4047            struct __With<'a>(&'a i32);
4048            impl<'a> serde::ser::Serialize for __With<'a> {
4049                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4050                where
4051                    S: serde::ser::Serializer,
4052                {
4053                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4054                }
4055            }
4056            state.serialize_entry("pageSize", &__With(&self.page_size))?;
4057        }
4058        if !wkt::internal::is_default(&self.run_attempt) {
4059            state.serialize_entry("runAttempt", &self.run_attempt)?;
4060        }
4061        if !self._unknown_fields.is_empty() {
4062            for (key, value) in self._unknown_fields.iter() {
4063                state.serialize_entry(key, &value)?;
4064            }
4065        }
4066        state.end()
4067    }
4068}
4069
4070/// Defines additional types related to [ListTransferRunsRequest].
4071pub mod list_transfer_runs_request {
4072    #[allow(unused_imports)]
4073    use super::*;
4074
4075    /// Represents which runs should be pulled.
4076    ///
4077    /// # Working with unknown values
4078    ///
4079    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4080    /// additional enum variants at any time. Adding new variants is not considered
4081    /// a breaking change. Applications should write their code in anticipation of:
4082    ///
4083    /// - New values appearing in future releases of the client library, **and**
4084    /// - New values received dynamically, without application changes.
4085    ///
4086    /// Please consult the [Working with enums] section in the user guide for some
4087    /// guidelines.
4088    ///
4089    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4090    #[derive(Clone, Debug, PartialEq)]
4091    #[non_exhaustive]
4092    pub enum RunAttempt {
4093        /// All runs should be returned.
4094        Unspecified,
4095        /// Only latest run per day should be returned.
4096        Latest,
4097        /// If set, the enum was initialized with an unknown value.
4098        ///
4099        /// Applications can examine the value using [RunAttempt::value] or
4100        /// [RunAttempt::name].
4101        UnknownValue(run_attempt::UnknownValue),
4102    }
4103
4104    #[doc(hidden)]
4105    pub mod run_attempt {
4106        #[allow(unused_imports)]
4107        use super::*;
4108        #[derive(Clone, Debug, PartialEq)]
4109        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4110    }
4111
4112    impl RunAttempt {
4113        /// Gets the enum value.
4114        ///
4115        /// Returns `None` if the enum contains an unknown value deserialized from
4116        /// the string representation of enums.
4117        pub fn value(&self) -> std::option::Option<i32> {
4118            match self {
4119                Self::Unspecified => std::option::Option::Some(0),
4120                Self::Latest => std::option::Option::Some(1),
4121                Self::UnknownValue(u) => u.0.value(),
4122            }
4123        }
4124
4125        /// Gets the enum value as a string.
4126        ///
4127        /// Returns `None` if the enum contains an unknown value deserialized from
4128        /// the integer representation of enums.
4129        pub fn name(&self) -> std::option::Option<&str> {
4130            match self {
4131                Self::Unspecified => std::option::Option::Some("RUN_ATTEMPT_UNSPECIFIED"),
4132                Self::Latest => std::option::Option::Some("LATEST"),
4133                Self::UnknownValue(u) => u.0.name(),
4134            }
4135        }
4136    }
4137
4138    impl std::default::Default for RunAttempt {
4139        fn default() -> Self {
4140            use std::convert::From;
4141            Self::from(0)
4142        }
4143    }
4144
4145    impl std::fmt::Display for RunAttempt {
4146        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4147            wkt::internal::display_enum(f, self.name(), self.value())
4148        }
4149    }
4150
4151    impl std::convert::From<i32> for RunAttempt {
4152        fn from(value: i32) -> Self {
4153            match value {
4154                0 => Self::Unspecified,
4155                1 => Self::Latest,
4156                _ => Self::UnknownValue(run_attempt::UnknownValue(
4157                    wkt::internal::UnknownEnumValue::Integer(value),
4158                )),
4159            }
4160        }
4161    }
4162
4163    impl std::convert::From<&str> for RunAttempt {
4164        fn from(value: &str) -> Self {
4165            use std::string::ToString;
4166            match value {
4167                "RUN_ATTEMPT_UNSPECIFIED" => Self::Unspecified,
4168                "LATEST" => Self::Latest,
4169                _ => Self::UnknownValue(run_attempt::UnknownValue(
4170                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4171                )),
4172            }
4173        }
4174    }
4175
4176    impl serde::ser::Serialize for RunAttempt {
4177        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4178        where
4179            S: serde::Serializer,
4180        {
4181            match self {
4182                Self::Unspecified => serializer.serialize_i32(0),
4183                Self::Latest => serializer.serialize_i32(1),
4184                Self::UnknownValue(u) => u.0.serialize(serializer),
4185            }
4186        }
4187    }
4188
4189    impl<'de> serde::de::Deserialize<'de> for RunAttempt {
4190        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4191        where
4192            D: serde::Deserializer<'de>,
4193        {
4194            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RunAttempt>::new(
4195                ".google.cloud.bigquery.datatransfer.v1.ListTransferRunsRequest.RunAttempt",
4196            ))
4197        }
4198    }
4199}
4200
4201/// The returned list of pipelines in the project.
4202#[derive(Clone, Debug, Default, PartialEq)]
4203#[non_exhaustive]
4204pub struct ListTransferRunsResponse {
4205    /// Output only. The stored pipeline transfer runs.
4206    pub transfer_runs: std::vec::Vec<crate::model::TransferRun>,
4207
4208    /// Output only. The next-pagination token. For multiple-page list results,
4209    /// this token can be used as the
4210    /// `ListTransferRunsRequest.page_token`
4211    /// to request the next page of list results.
4212    pub next_page_token: std::string::String,
4213
4214    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4215}
4216
4217impl ListTransferRunsResponse {
4218    pub fn new() -> Self {
4219        std::default::Default::default()
4220    }
4221
4222    /// Sets the value of [transfer_runs][crate::model::ListTransferRunsResponse::transfer_runs].
4223    pub fn set_transfer_runs<T, V>(mut self, v: T) -> Self
4224    where
4225        T: std::iter::IntoIterator<Item = V>,
4226        V: std::convert::Into<crate::model::TransferRun>,
4227    {
4228        use std::iter::Iterator;
4229        self.transfer_runs = v.into_iter().map(|i| i.into()).collect();
4230        self
4231    }
4232
4233    /// Sets the value of [next_page_token][crate::model::ListTransferRunsResponse::next_page_token].
4234    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4235        self.next_page_token = v.into();
4236        self
4237    }
4238}
4239
4240impl wkt::message::Message for ListTransferRunsResponse {
4241    fn typename() -> &'static str {
4242        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferRunsResponse"
4243    }
4244}
4245
4246#[doc(hidden)]
4247impl gax::paginator::internal::PageableResponse for ListTransferRunsResponse {
4248    type PageItem = crate::model::TransferRun;
4249
4250    fn items(self) -> std::vec::Vec<Self::PageItem> {
4251        self.transfer_runs
4252    }
4253
4254    fn next_page_token(&self) -> std::string::String {
4255        use std::clone::Clone;
4256        self.next_page_token.clone()
4257    }
4258}
4259
4260#[doc(hidden)]
4261impl<'de> serde::de::Deserialize<'de> for ListTransferRunsResponse {
4262    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4263    where
4264        D: serde::Deserializer<'de>,
4265    {
4266        #[allow(non_camel_case_types)]
4267        #[doc(hidden)]
4268        #[derive(PartialEq, Eq, Hash)]
4269        enum __FieldTag {
4270            __transfer_runs,
4271            __next_page_token,
4272            Unknown(std::string::String),
4273        }
4274        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4275            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4276            where
4277                D: serde::Deserializer<'de>,
4278            {
4279                struct Visitor;
4280                impl<'de> serde::de::Visitor<'de> for Visitor {
4281                    type Value = __FieldTag;
4282                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4283                        formatter.write_str("a field name for ListTransferRunsResponse")
4284                    }
4285                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4286                    where
4287                        E: serde::de::Error,
4288                    {
4289                        use std::result::Result::Ok;
4290                        use std::string::ToString;
4291                        match value {
4292                            "transferRuns" => Ok(__FieldTag::__transfer_runs),
4293                            "transfer_runs" => Ok(__FieldTag::__transfer_runs),
4294                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
4295                            "next_page_token" => Ok(__FieldTag::__next_page_token),
4296                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4297                        }
4298                    }
4299                }
4300                deserializer.deserialize_identifier(Visitor)
4301            }
4302        }
4303        struct Visitor;
4304        impl<'de> serde::de::Visitor<'de> for Visitor {
4305            type Value = ListTransferRunsResponse;
4306            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4307                formatter.write_str("struct ListTransferRunsResponse")
4308            }
4309            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4310            where
4311                A: serde::de::MapAccess<'de>,
4312            {
4313                #[allow(unused_imports)]
4314                use serde::de::Error;
4315                use std::option::Option::Some;
4316                let mut fields = std::collections::HashSet::new();
4317                let mut result = Self::Value::new();
4318                while let Some(tag) = map.next_key::<__FieldTag>()? {
4319                    #[allow(clippy::match_single_binding)]
4320                    match tag {
4321                        __FieldTag::__transfer_runs => {
4322                            if !fields.insert(__FieldTag::__transfer_runs) {
4323                                return std::result::Result::Err(A::Error::duplicate_field(
4324                                    "multiple values for transfer_runs",
4325                                ));
4326                            }
4327                            result.transfer_runs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::TransferRun>>>()?.unwrap_or_default();
4328                        }
4329                        __FieldTag::__next_page_token => {
4330                            if !fields.insert(__FieldTag::__next_page_token) {
4331                                return std::result::Result::Err(A::Error::duplicate_field(
4332                                    "multiple values for next_page_token",
4333                                ));
4334                            }
4335                            result.next_page_token = map
4336                                .next_value::<std::option::Option<std::string::String>>()?
4337                                .unwrap_or_default();
4338                        }
4339                        __FieldTag::Unknown(key) => {
4340                            let value = map.next_value::<serde_json::Value>()?;
4341                            result._unknown_fields.insert(key, value);
4342                        }
4343                    }
4344                }
4345                std::result::Result::Ok(result)
4346            }
4347        }
4348        deserializer.deserialize_any(Visitor)
4349    }
4350}
4351
4352#[doc(hidden)]
4353impl serde::ser::Serialize for ListTransferRunsResponse {
4354    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4355    where
4356        S: serde::ser::Serializer,
4357    {
4358        use serde::ser::SerializeMap;
4359        #[allow(unused_imports)]
4360        use std::option::Option::Some;
4361        let mut state = serializer.serialize_map(std::option::Option::None)?;
4362        if !self.transfer_runs.is_empty() {
4363            state.serialize_entry("transferRuns", &self.transfer_runs)?;
4364        }
4365        if !self.next_page_token.is_empty() {
4366            state.serialize_entry("nextPageToken", &self.next_page_token)?;
4367        }
4368        if !self._unknown_fields.is_empty() {
4369            for (key, value) in self._unknown_fields.iter() {
4370                state.serialize_entry(key, &value)?;
4371            }
4372        }
4373        state.end()
4374    }
4375}
4376
4377/// A request to get user facing log messages associated with data transfer run.
4378#[derive(Clone, Debug, Default, PartialEq)]
4379#[non_exhaustive]
4380pub struct ListTransferLogsRequest {
4381    /// Required. Transfer run name in the form:
4382    /// `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` or
4383    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
4384    pub parent: std::string::String,
4385
4386    /// Pagination token, which can be used to request a specific page
4387    /// of `ListTransferLogsRequest` list results. For multiple-page
4388    /// results, `ListTransferLogsResponse` outputs
4389    /// a `next_page` token, which can be used as the
4390    /// `page_token` value to request the next page of list results.
4391    pub page_token: std::string::String,
4392
4393    /// Page size. The default page size is the maximum value of 1000 results.
4394    pub page_size: i32,
4395
4396    /// Message types to return. If not populated - INFO, WARNING and ERROR
4397    /// messages are returned.
4398    pub message_types: std::vec::Vec<crate::model::transfer_message::MessageSeverity>,
4399
4400    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4401}
4402
4403impl ListTransferLogsRequest {
4404    pub fn new() -> Self {
4405        std::default::Default::default()
4406    }
4407
4408    /// Sets the value of [parent][crate::model::ListTransferLogsRequest::parent].
4409    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4410        self.parent = v.into();
4411        self
4412    }
4413
4414    /// Sets the value of [page_token][crate::model::ListTransferLogsRequest::page_token].
4415    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4416        self.page_token = v.into();
4417        self
4418    }
4419
4420    /// Sets the value of [page_size][crate::model::ListTransferLogsRequest::page_size].
4421    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4422        self.page_size = v.into();
4423        self
4424    }
4425
4426    /// Sets the value of [message_types][crate::model::ListTransferLogsRequest::message_types].
4427    pub fn set_message_types<T, V>(mut self, v: T) -> Self
4428    where
4429        T: std::iter::IntoIterator<Item = V>,
4430        V: std::convert::Into<crate::model::transfer_message::MessageSeverity>,
4431    {
4432        use std::iter::Iterator;
4433        self.message_types = v.into_iter().map(|i| i.into()).collect();
4434        self
4435    }
4436}
4437
4438impl wkt::message::Message for ListTransferLogsRequest {
4439    fn typename() -> &'static str {
4440        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferLogsRequest"
4441    }
4442}
4443
4444#[doc(hidden)]
4445impl<'de> serde::de::Deserialize<'de> for ListTransferLogsRequest {
4446    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4447    where
4448        D: serde::Deserializer<'de>,
4449    {
4450        #[allow(non_camel_case_types)]
4451        #[doc(hidden)]
4452        #[derive(PartialEq, Eq, Hash)]
4453        enum __FieldTag {
4454            __parent,
4455            __page_token,
4456            __page_size,
4457            __message_types,
4458            Unknown(std::string::String),
4459        }
4460        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4461            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4462            where
4463                D: serde::Deserializer<'de>,
4464            {
4465                struct Visitor;
4466                impl<'de> serde::de::Visitor<'de> for Visitor {
4467                    type Value = __FieldTag;
4468                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4469                        formatter.write_str("a field name for ListTransferLogsRequest")
4470                    }
4471                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4472                    where
4473                        E: serde::de::Error,
4474                    {
4475                        use std::result::Result::Ok;
4476                        use std::string::ToString;
4477                        match value {
4478                            "parent" => Ok(__FieldTag::__parent),
4479                            "pageToken" => Ok(__FieldTag::__page_token),
4480                            "page_token" => Ok(__FieldTag::__page_token),
4481                            "pageSize" => Ok(__FieldTag::__page_size),
4482                            "page_size" => Ok(__FieldTag::__page_size),
4483                            "messageTypes" => Ok(__FieldTag::__message_types),
4484                            "message_types" => Ok(__FieldTag::__message_types),
4485                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4486                        }
4487                    }
4488                }
4489                deserializer.deserialize_identifier(Visitor)
4490            }
4491        }
4492        struct Visitor;
4493        impl<'de> serde::de::Visitor<'de> for Visitor {
4494            type Value = ListTransferLogsRequest;
4495            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4496                formatter.write_str("struct ListTransferLogsRequest")
4497            }
4498            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4499            where
4500                A: serde::de::MapAccess<'de>,
4501            {
4502                #[allow(unused_imports)]
4503                use serde::de::Error;
4504                use std::option::Option::Some;
4505                let mut fields = std::collections::HashSet::new();
4506                let mut result = Self::Value::new();
4507                while let Some(tag) = map.next_key::<__FieldTag>()? {
4508                    #[allow(clippy::match_single_binding)]
4509                    match tag {
4510                        __FieldTag::__parent => {
4511                            if !fields.insert(__FieldTag::__parent) {
4512                                return std::result::Result::Err(A::Error::duplicate_field(
4513                                    "multiple values for parent",
4514                                ));
4515                            }
4516                            result.parent = map
4517                                .next_value::<std::option::Option<std::string::String>>()?
4518                                .unwrap_or_default();
4519                        }
4520                        __FieldTag::__page_token => {
4521                            if !fields.insert(__FieldTag::__page_token) {
4522                                return std::result::Result::Err(A::Error::duplicate_field(
4523                                    "multiple values for page_token",
4524                                ));
4525                            }
4526                            result.page_token = map
4527                                .next_value::<std::option::Option<std::string::String>>()?
4528                                .unwrap_or_default();
4529                        }
4530                        __FieldTag::__page_size => {
4531                            if !fields.insert(__FieldTag::__page_size) {
4532                                return std::result::Result::Err(A::Error::duplicate_field(
4533                                    "multiple values for page_size",
4534                                ));
4535                            }
4536                            struct __With(std::option::Option<i32>);
4537                            impl<'de> serde::de::Deserialize<'de> for __With {
4538                                fn deserialize<D>(
4539                                    deserializer: D,
4540                                ) -> std::result::Result<Self, D::Error>
4541                                where
4542                                    D: serde::de::Deserializer<'de>,
4543                                {
4544                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4545                                }
4546                            }
4547                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
4548                        }
4549                        __FieldTag::__message_types => {
4550                            if !fields.insert(__FieldTag::__message_types) {
4551                                return std::result::Result::Err(A::Error::duplicate_field(
4552                                    "multiple values for message_types",
4553                                ));
4554                            }
4555                            result.message_types = map
4556                                .next_value::<std::option::Option<
4557                                    std::vec::Vec<crate::model::transfer_message::MessageSeverity>,
4558                                >>()?
4559                                .unwrap_or_default();
4560                        }
4561                        __FieldTag::Unknown(key) => {
4562                            let value = map.next_value::<serde_json::Value>()?;
4563                            result._unknown_fields.insert(key, value);
4564                        }
4565                    }
4566                }
4567                std::result::Result::Ok(result)
4568            }
4569        }
4570        deserializer.deserialize_any(Visitor)
4571    }
4572}
4573
4574#[doc(hidden)]
4575impl serde::ser::Serialize for ListTransferLogsRequest {
4576    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4577    where
4578        S: serde::ser::Serializer,
4579    {
4580        use serde::ser::SerializeMap;
4581        #[allow(unused_imports)]
4582        use std::option::Option::Some;
4583        let mut state = serializer.serialize_map(std::option::Option::None)?;
4584        if !self.parent.is_empty() {
4585            state.serialize_entry("parent", &self.parent)?;
4586        }
4587        if !self.page_token.is_empty() {
4588            state.serialize_entry("pageToken", &self.page_token)?;
4589        }
4590        if !wkt::internal::is_default(&self.page_size) {
4591            struct __With<'a>(&'a i32);
4592            impl<'a> serde::ser::Serialize for __With<'a> {
4593                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4594                where
4595                    S: serde::ser::Serializer,
4596                {
4597                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4598                }
4599            }
4600            state.serialize_entry("pageSize", &__With(&self.page_size))?;
4601        }
4602        if !self.message_types.is_empty() {
4603            state.serialize_entry("messageTypes", &self.message_types)?;
4604        }
4605        if !self._unknown_fields.is_empty() {
4606            for (key, value) in self._unknown_fields.iter() {
4607                state.serialize_entry(key, &value)?;
4608            }
4609        }
4610        state.end()
4611    }
4612}
4613
4614/// The returned list transfer run messages.
4615#[derive(Clone, Debug, Default, PartialEq)]
4616#[non_exhaustive]
4617pub struct ListTransferLogsResponse {
4618    /// Output only. The stored pipeline transfer messages.
4619    pub transfer_messages: std::vec::Vec<crate::model::TransferMessage>,
4620
4621    /// Output only. The next-pagination token. For multiple-page list results,
4622    /// this token can be used as the
4623    /// `GetTransferRunLogRequest.page_token`
4624    /// to request the next page of list results.
4625    pub next_page_token: std::string::String,
4626
4627    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4628}
4629
4630impl ListTransferLogsResponse {
4631    pub fn new() -> Self {
4632        std::default::Default::default()
4633    }
4634
4635    /// Sets the value of [transfer_messages][crate::model::ListTransferLogsResponse::transfer_messages].
4636    pub fn set_transfer_messages<T, V>(mut self, v: T) -> Self
4637    where
4638        T: std::iter::IntoIterator<Item = V>,
4639        V: std::convert::Into<crate::model::TransferMessage>,
4640    {
4641        use std::iter::Iterator;
4642        self.transfer_messages = v.into_iter().map(|i| i.into()).collect();
4643        self
4644    }
4645
4646    /// Sets the value of [next_page_token][crate::model::ListTransferLogsResponse::next_page_token].
4647    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4648        self.next_page_token = v.into();
4649        self
4650    }
4651}
4652
4653impl wkt::message::Message for ListTransferLogsResponse {
4654    fn typename() -> &'static str {
4655        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferLogsResponse"
4656    }
4657}
4658
4659#[doc(hidden)]
4660impl gax::paginator::internal::PageableResponse for ListTransferLogsResponse {
4661    type PageItem = crate::model::TransferMessage;
4662
4663    fn items(self) -> std::vec::Vec<Self::PageItem> {
4664        self.transfer_messages
4665    }
4666
4667    fn next_page_token(&self) -> std::string::String {
4668        use std::clone::Clone;
4669        self.next_page_token.clone()
4670    }
4671}
4672
4673#[doc(hidden)]
4674impl<'de> serde::de::Deserialize<'de> for ListTransferLogsResponse {
4675    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4676    where
4677        D: serde::Deserializer<'de>,
4678    {
4679        #[allow(non_camel_case_types)]
4680        #[doc(hidden)]
4681        #[derive(PartialEq, Eq, Hash)]
4682        enum __FieldTag {
4683            __transfer_messages,
4684            __next_page_token,
4685            Unknown(std::string::String),
4686        }
4687        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4688            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4689            where
4690                D: serde::Deserializer<'de>,
4691            {
4692                struct Visitor;
4693                impl<'de> serde::de::Visitor<'de> for Visitor {
4694                    type Value = __FieldTag;
4695                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4696                        formatter.write_str("a field name for ListTransferLogsResponse")
4697                    }
4698                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4699                    where
4700                        E: serde::de::Error,
4701                    {
4702                        use std::result::Result::Ok;
4703                        use std::string::ToString;
4704                        match value {
4705                            "transferMessages" => Ok(__FieldTag::__transfer_messages),
4706                            "transfer_messages" => Ok(__FieldTag::__transfer_messages),
4707                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
4708                            "next_page_token" => Ok(__FieldTag::__next_page_token),
4709                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4710                        }
4711                    }
4712                }
4713                deserializer.deserialize_identifier(Visitor)
4714            }
4715        }
4716        struct Visitor;
4717        impl<'de> serde::de::Visitor<'de> for Visitor {
4718            type Value = ListTransferLogsResponse;
4719            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4720                formatter.write_str("struct ListTransferLogsResponse")
4721            }
4722            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4723            where
4724                A: serde::de::MapAccess<'de>,
4725            {
4726                #[allow(unused_imports)]
4727                use serde::de::Error;
4728                use std::option::Option::Some;
4729                let mut fields = std::collections::HashSet::new();
4730                let mut result = Self::Value::new();
4731                while let Some(tag) = map.next_key::<__FieldTag>()? {
4732                    #[allow(clippy::match_single_binding)]
4733                    match tag {
4734                        __FieldTag::__transfer_messages => {
4735                            if !fields.insert(__FieldTag::__transfer_messages) {
4736                                return std::result::Result::Err(A::Error::duplicate_field(
4737                                    "multiple values for transfer_messages",
4738                                ));
4739                            }
4740                            result.transfer_messages =
4741                                map.next_value::<std::option::Option<
4742                                    std::vec::Vec<crate::model::TransferMessage>,
4743                                >>()?
4744                                .unwrap_or_default();
4745                        }
4746                        __FieldTag::__next_page_token => {
4747                            if !fields.insert(__FieldTag::__next_page_token) {
4748                                return std::result::Result::Err(A::Error::duplicate_field(
4749                                    "multiple values for next_page_token",
4750                                ));
4751                            }
4752                            result.next_page_token = map
4753                                .next_value::<std::option::Option<std::string::String>>()?
4754                                .unwrap_or_default();
4755                        }
4756                        __FieldTag::Unknown(key) => {
4757                            let value = map.next_value::<serde_json::Value>()?;
4758                            result._unknown_fields.insert(key, value);
4759                        }
4760                    }
4761                }
4762                std::result::Result::Ok(result)
4763            }
4764        }
4765        deserializer.deserialize_any(Visitor)
4766    }
4767}
4768
4769#[doc(hidden)]
4770impl serde::ser::Serialize for ListTransferLogsResponse {
4771    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4772    where
4773        S: serde::ser::Serializer,
4774    {
4775        use serde::ser::SerializeMap;
4776        #[allow(unused_imports)]
4777        use std::option::Option::Some;
4778        let mut state = serializer.serialize_map(std::option::Option::None)?;
4779        if !self.transfer_messages.is_empty() {
4780            state.serialize_entry("transferMessages", &self.transfer_messages)?;
4781        }
4782        if !self.next_page_token.is_empty() {
4783            state.serialize_entry("nextPageToken", &self.next_page_token)?;
4784        }
4785        if !self._unknown_fields.is_empty() {
4786            for (key, value) in self._unknown_fields.iter() {
4787                state.serialize_entry(key, &value)?;
4788            }
4789        }
4790        state.end()
4791    }
4792}
4793
4794/// A request to determine whether the user has valid credentials. This method
4795/// is used to limit the number of OAuth popups in the user interface. The
4796/// user id is inferred from the API call context.
4797/// If the data source has the Google+ authorization type, this method
4798/// returns false, as it cannot be determined whether the credentials are
4799/// already valid merely based on the user id.
4800#[derive(Clone, Debug, Default, PartialEq)]
4801#[non_exhaustive]
4802pub struct CheckValidCredsRequest {
4803    /// Required. The data source in the form:
4804    /// `projects/{project_id}/dataSources/{data_source_id}` or
4805    /// `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`.
4806    pub name: std::string::String,
4807
4808    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4809}
4810
4811impl CheckValidCredsRequest {
4812    pub fn new() -> Self {
4813        std::default::Default::default()
4814    }
4815
4816    /// Sets the value of [name][crate::model::CheckValidCredsRequest::name].
4817    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4818        self.name = v.into();
4819        self
4820    }
4821}
4822
4823impl wkt::message::Message for CheckValidCredsRequest {
4824    fn typename() -> &'static str {
4825        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.CheckValidCredsRequest"
4826    }
4827}
4828
4829#[doc(hidden)]
4830impl<'de> serde::de::Deserialize<'de> for CheckValidCredsRequest {
4831    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4832    where
4833        D: serde::Deserializer<'de>,
4834    {
4835        #[allow(non_camel_case_types)]
4836        #[doc(hidden)]
4837        #[derive(PartialEq, Eq, Hash)]
4838        enum __FieldTag {
4839            __name,
4840            Unknown(std::string::String),
4841        }
4842        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4843            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4844            where
4845                D: serde::Deserializer<'de>,
4846            {
4847                struct Visitor;
4848                impl<'de> serde::de::Visitor<'de> for Visitor {
4849                    type Value = __FieldTag;
4850                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4851                        formatter.write_str("a field name for CheckValidCredsRequest")
4852                    }
4853                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4854                    where
4855                        E: serde::de::Error,
4856                    {
4857                        use std::result::Result::Ok;
4858                        use std::string::ToString;
4859                        match value {
4860                            "name" => Ok(__FieldTag::__name),
4861                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4862                        }
4863                    }
4864                }
4865                deserializer.deserialize_identifier(Visitor)
4866            }
4867        }
4868        struct Visitor;
4869        impl<'de> serde::de::Visitor<'de> for Visitor {
4870            type Value = CheckValidCredsRequest;
4871            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4872                formatter.write_str("struct CheckValidCredsRequest")
4873            }
4874            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4875            where
4876                A: serde::de::MapAccess<'de>,
4877            {
4878                #[allow(unused_imports)]
4879                use serde::de::Error;
4880                use std::option::Option::Some;
4881                let mut fields = std::collections::HashSet::new();
4882                let mut result = Self::Value::new();
4883                while let Some(tag) = map.next_key::<__FieldTag>()? {
4884                    #[allow(clippy::match_single_binding)]
4885                    match tag {
4886                        __FieldTag::__name => {
4887                            if !fields.insert(__FieldTag::__name) {
4888                                return std::result::Result::Err(A::Error::duplicate_field(
4889                                    "multiple values for name",
4890                                ));
4891                            }
4892                            result.name = map
4893                                .next_value::<std::option::Option<std::string::String>>()?
4894                                .unwrap_or_default();
4895                        }
4896                        __FieldTag::Unknown(key) => {
4897                            let value = map.next_value::<serde_json::Value>()?;
4898                            result._unknown_fields.insert(key, value);
4899                        }
4900                    }
4901                }
4902                std::result::Result::Ok(result)
4903            }
4904        }
4905        deserializer.deserialize_any(Visitor)
4906    }
4907}
4908
4909#[doc(hidden)]
4910impl serde::ser::Serialize for CheckValidCredsRequest {
4911    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4912    where
4913        S: serde::ser::Serializer,
4914    {
4915        use serde::ser::SerializeMap;
4916        #[allow(unused_imports)]
4917        use std::option::Option::Some;
4918        let mut state = serializer.serialize_map(std::option::Option::None)?;
4919        if !self.name.is_empty() {
4920            state.serialize_entry("name", &self.name)?;
4921        }
4922        if !self._unknown_fields.is_empty() {
4923            for (key, value) in self._unknown_fields.iter() {
4924                state.serialize_entry(key, &value)?;
4925            }
4926        }
4927        state.end()
4928    }
4929}
4930
4931/// A response indicating whether the credentials exist and are valid.
4932#[derive(Clone, Debug, Default, PartialEq)]
4933#[non_exhaustive]
4934pub struct CheckValidCredsResponse {
4935    /// If set to `true`, the credentials exist and are valid.
4936    pub has_valid_creds: bool,
4937
4938    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4939}
4940
4941impl CheckValidCredsResponse {
4942    pub fn new() -> Self {
4943        std::default::Default::default()
4944    }
4945
4946    /// Sets the value of [has_valid_creds][crate::model::CheckValidCredsResponse::has_valid_creds].
4947    pub fn set_has_valid_creds<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4948        self.has_valid_creds = v.into();
4949        self
4950    }
4951}
4952
4953impl wkt::message::Message for CheckValidCredsResponse {
4954    fn typename() -> &'static str {
4955        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.CheckValidCredsResponse"
4956    }
4957}
4958
4959#[doc(hidden)]
4960impl<'de> serde::de::Deserialize<'de> for CheckValidCredsResponse {
4961    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4962    where
4963        D: serde::Deserializer<'de>,
4964    {
4965        #[allow(non_camel_case_types)]
4966        #[doc(hidden)]
4967        #[derive(PartialEq, Eq, Hash)]
4968        enum __FieldTag {
4969            __has_valid_creds,
4970            Unknown(std::string::String),
4971        }
4972        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4973            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4974            where
4975                D: serde::Deserializer<'de>,
4976            {
4977                struct Visitor;
4978                impl<'de> serde::de::Visitor<'de> for Visitor {
4979                    type Value = __FieldTag;
4980                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4981                        formatter.write_str("a field name for CheckValidCredsResponse")
4982                    }
4983                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4984                    where
4985                        E: serde::de::Error,
4986                    {
4987                        use std::result::Result::Ok;
4988                        use std::string::ToString;
4989                        match value {
4990                            "hasValidCreds" => Ok(__FieldTag::__has_valid_creds),
4991                            "has_valid_creds" => Ok(__FieldTag::__has_valid_creds),
4992                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4993                        }
4994                    }
4995                }
4996                deserializer.deserialize_identifier(Visitor)
4997            }
4998        }
4999        struct Visitor;
5000        impl<'de> serde::de::Visitor<'de> for Visitor {
5001            type Value = CheckValidCredsResponse;
5002            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5003                formatter.write_str("struct CheckValidCredsResponse")
5004            }
5005            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5006            where
5007                A: serde::de::MapAccess<'de>,
5008            {
5009                #[allow(unused_imports)]
5010                use serde::de::Error;
5011                use std::option::Option::Some;
5012                let mut fields = std::collections::HashSet::new();
5013                let mut result = Self::Value::new();
5014                while let Some(tag) = map.next_key::<__FieldTag>()? {
5015                    #[allow(clippy::match_single_binding)]
5016                    match tag {
5017                        __FieldTag::__has_valid_creds => {
5018                            if !fields.insert(__FieldTag::__has_valid_creds) {
5019                                return std::result::Result::Err(A::Error::duplicate_field(
5020                                    "multiple values for has_valid_creds",
5021                                ));
5022                            }
5023                            result.has_valid_creds = map
5024                                .next_value::<std::option::Option<bool>>()?
5025                                .unwrap_or_default();
5026                        }
5027                        __FieldTag::Unknown(key) => {
5028                            let value = map.next_value::<serde_json::Value>()?;
5029                            result._unknown_fields.insert(key, value);
5030                        }
5031                    }
5032                }
5033                std::result::Result::Ok(result)
5034            }
5035        }
5036        deserializer.deserialize_any(Visitor)
5037    }
5038}
5039
5040#[doc(hidden)]
5041impl serde::ser::Serialize for CheckValidCredsResponse {
5042    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5043    where
5044        S: serde::ser::Serializer,
5045    {
5046        use serde::ser::SerializeMap;
5047        #[allow(unused_imports)]
5048        use std::option::Option::Some;
5049        let mut state = serializer.serialize_map(std::option::Option::None)?;
5050        if !wkt::internal::is_default(&self.has_valid_creds) {
5051            state.serialize_entry("hasValidCreds", &self.has_valid_creds)?;
5052        }
5053        if !self._unknown_fields.is_empty() {
5054            for (key, value) in self._unknown_fields.iter() {
5055                state.serialize_entry(key, &value)?;
5056            }
5057        }
5058        state.end()
5059    }
5060}
5061
5062/// A request to schedule transfer runs for a time range.
5063#[derive(Clone, Debug, Default, PartialEq)]
5064#[non_exhaustive]
5065pub struct ScheduleTransferRunsRequest {
5066    /// Required. Transfer configuration name in the form:
5067    /// `projects/{project_id}/transferConfigs/{config_id}` or
5068    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
5069    pub parent: std::string::String,
5070
5071    /// Required. Start time of the range of transfer runs. For example,
5072    /// `"2017-05-25T00:00:00+00:00"`.
5073    pub start_time: std::option::Option<wkt::Timestamp>,
5074
5075    /// Required. End time of the range of transfer runs. For example,
5076    /// `"2017-05-30T00:00:00+00:00"`.
5077    pub end_time: std::option::Option<wkt::Timestamp>,
5078
5079    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5080}
5081
5082impl ScheduleTransferRunsRequest {
5083    pub fn new() -> Self {
5084        std::default::Default::default()
5085    }
5086
5087    /// Sets the value of [parent][crate::model::ScheduleTransferRunsRequest::parent].
5088    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5089        self.parent = v.into();
5090        self
5091    }
5092
5093    /// Sets the value of [start_time][crate::model::ScheduleTransferRunsRequest::start_time].
5094    pub fn set_start_time<T>(mut self, v: T) -> Self
5095    where
5096        T: std::convert::Into<wkt::Timestamp>,
5097    {
5098        self.start_time = std::option::Option::Some(v.into());
5099        self
5100    }
5101
5102    /// Sets or clears the value of [start_time][crate::model::ScheduleTransferRunsRequest::start_time].
5103    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5104    where
5105        T: std::convert::Into<wkt::Timestamp>,
5106    {
5107        self.start_time = v.map(|x| x.into());
5108        self
5109    }
5110
5111    /// Sets the value of [end_time][crate::model::ScheduleTransferRunsRequest::end_time].
5112    pub fn set_end_time<T>(mut self, v: T) -> Self
5113    where
5114        T: std::convert::Into<wkt::Timestamp>,
5115    {
5116        self.end_time = std::option::Option::Some(v.into());
5117        self
5118    }
5119
5120    /// Sets or clears the value of [end_time][crate::model::ScheduleTransferRunsRequest::end_time].
5121    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5122    where
5123        T: std::convert::Into<wkt::Timestamp>,
5124    {
5125        self.end_time = v.map(|x| x.into());
5126        self
5127    }
5128}
5129
5130impl wkt::message::Message for ScheduleTransferRunsRequest {
5131    fn typename() -> &'static str {
5132        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleTransferRunsRequest"
5133    }
5134}
5135
5136#[doc(hidden)]
5137impl<'de> serde::de::Deserialize<'de> for ScheduleTransferRunsRequest {
5138    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5139    where
5140        D: serde::Deserializer<'de>,
5141    {
5142        #[allow(non_camel_case_types)]
5143        #[doc(hidden)]
5144        #[derive(PartialEq, Eq, Hash)]
5145        enum __FieldTag {
5146            __parent,
5147            __start_time,
5148            __end_time,
5149            Unknown(std::string::String),
5150        }
5151        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5152            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5153            where
5154                D: serde::Deserializer<'de>,
5155            {
5156                struct Visitor;
5157                impl<'de> serde::de::Visitor<'de> for Visitor {
5158                    type Value = __FieldTag;
5159                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5160                        formatter.write_str("a field name for ScheduleTransferRunsRequest")
5161                    }
5162                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5163                    where
5164                        E: serde::de::Error,
5165                    {
5166                        use std::result::Result::Ok;
5167                        use std::string::ToString;
5168                        match value {
5169                            "parent" => Ok(__FieldTag::__parent),
5170                            "startTime" => Ok(__FieldTag::__start_time),
5171                            "start_time" => Ok(__FieldTag::__start_time),
5172                            "endTime" => Ok(__FieldTag::__end_time),
5173                            "end_time" => Ok(__FieldTag::__end_time),
5174                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5175                        }
5176                    }
5177                }
5178                deserializer.deserialize_identifier(Visitor)
5179            }
5180        }
5181        struct Visitor;
5182        impl<'de> serde::de::Visitor<'de> for Visitor {
5183            type Value = ScheduleTransferRunsRequest;
5184            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5185                formatter.write_str("struct ScheduleTransferRunsRequest")
5186            }
5187            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5188            where
5189                A: serde::de::MapAccess<'de>,
5190            {
5191                #[allow(unused_imports)]
5192                use serde::de::Error;
5193                use std::option::Option::Some;
5194                let mut fields = std::collections::HashSet::new();
5195                let mut result = Self::Value::new();
5196                while let Some(tag) = map.next_key::<__FieldTag>()? {
5197                    #[allow(clippy::match_single_binding)]
5198                    match tag {
5199                        __FieldTag::__parent => {
5200                            if !fields.insert(__FieldTag::__parent) {
5201                                return std::result::Result::Err(A::Error::duplicate_field(
5202                                    "multiple values for parent",
5203                                ));
5204                            }
5205                            result.parent = map
5206                                .next_value::<std::option::Option<std::string::String>>()?
5207                                .unwrap_or_default();
5208                        }
5209                        __FieldTag::__start_time => {
5210                            if !fields.insert(__FieldTag::__start_time) {
5211                                return std::result::Result::Err(A::Error::duplicate_field(
5212                                    "multiple values for start_time",
5213                                ));
5214                            }
5215                            result.start_time =
5216                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5217                        }
5218                        __FieldTag::__end_time => {
5219                            if !fields.insert(__FieldTag::__end_time) {
5220                                return std::result::Result::Err(A::Error::duplicate_field(
5221                                    "multiple values for end_time",
5222                                ));
5223                            }
5224                            result.end_time =
5225                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5226                        }
5227                        __FieldTag::Unknown(key) => {
5228                            let value = map.next_value::<serde_json::Value>()?;
5229                            result._unknown_fields.insert(key, value);
5230                        }
5231                    }
5232                }
5233                std::result::Result::Ok(result)
5234            }
5235        }
5236        deserializer.deserialize_any(Visitor)
5237    }
5238}
5239
5240#[doc(hidden)]
5241impl serde::ser::Serialize for ScheduleTransferRunsRequest {
5242    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5243    where
5244        S: serde::ser::Serializer,
5245    {
5246        use serde::ser::SerializeMap;
5247        #[allow(unused_imports)]
5248        use std::option::Option::Some;
5249        let mut state = serializer.serialize_map(std::option::Option::None)?;
5250        if !self.parent.is_empty() {
5251            state.serialize_entry("parent", &self.parent)?;
5252        }
5253        if self.start_time.is_some() {
5254            state.serialize_entry("startTime", &self.start_time)?;
5255        }
5256        if self.end_time.is_some() {
5257            state.serialize_entry("endTime", &self.end_time)?;
5258        }
5259        if !self._unknown_fields.is_empty() {
5260            for (key, value) in self._unknown_fields.iter() {
5261                state.serialize_entry(key, &value)?;
5262            }
5263        }
5264        state.end()
5265    }
5266}
5267
5268/// A response to schedule transfer runs for a time range.
5269#[derive(Clone, Debug, Default, PartialEq)]
5270#[non_exhaustive]
5271pub struct ScheduleTransferRunsResponse {
5272    /// The transfer runs that were scheduled.
5273    pub runs: std::vec::Vec<crate::model::TransferRun>,
5274
5275    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5276}
5277
5278impl ScheduleTransferRunsResponse {
5279    pub fn new() -> Self {
5280        std::default::Default::default()
5281    }
5282
5283    /// Sets the value of [runs][crate::model::ScheduleTransferRunsResponse::runs].
5284    pub fn set_runs<T, V>(mut self, v: T) -> Self
5285    where
5286        T: std::iter::IntoIterator<Item = V>,
5287        V: std::convert::Into<crate::model::TransferRun>,
5288    {
5289        use std::iter::Iterator;
5290        self.runs = v.into_iter().map(|i| i.into()).collect();
5291        self
5292    }
5293}
5294
5295impl wkt::message::Message for ScheduleTransferRunsResponse {
5296    fn typename() -> &'static str {
5297        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleTransferRunsResponse"
5298    }
5299}
5300
5301#[doc(hidden)]
5302impl<'de> serde::de::Deserialize<'de> for ScheduleTransferRunsResponse {
5303    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5304    where
5305        D: serde::Deserializer<'de>,
5306    {
5307        #[allow(non_camel_case_types)]
5308        #[doc(hidden)]
5309        #[derive(PartialEq, Eq, Hash)]
5310        enum __FieldTag {
5311            __runs,
5312            Unknown(std::string::String),
5313        }
5314        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5315            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5316            where
5317                D: serde::Deserializer<'de>,
5318            {
5319                struct Visitor;
5320                impl<'de> serde::de::Visitor<'de> for Visitor {
5321                    type Value = __FieldTag;
5322                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5323                        formatter.write_str("a field name for ScheduleTransferRunsResponse")
5324                    }
5325                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5326                    where
5327                        E: serde::de::Error,
5328                    {
5329                        use std::result::Result::Ok;
5330                        use std::string::ToString;
5331                        match value {
5332                            "runs" => Ok(__FieldTag::__runs),
5333                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5334                        }
5335                    }
5336                }
5337                deserializer.deserialize_identifier(Visitor)
5338            }
5339        }
5340        struct Visitor;
5341        impl<'de> serde::de::Visitor<'de> for Visitor {
5342            type Value = ScheduleTransferRunsResponse;
5343            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5344                formatter.write_str("struct ScheduleTransferRunsResponse")
5345            }
5346            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5347            where
5348                A: serde::de::MapAccess<'de>,
5349            {
5350                #[allow(unused_imports)]
5351                use serde::de::Error;
5352                use std::option::Option::Some;
5353                let mut fields = std::collections::HashSet::new();
5354                let mut result = Self::Value::new();
5355                while let Some(tag) = map.next_key::<__FieldTag>()? {
5356                    #[allow(clippy::match_single_binding)]
5357                    match tag {
5358                        __FieldTag::__runs => {
5359                            if !fields.insert(__FieldTag::__runs) {
5360                                return std::result::Result::Err(A::Error::duplicate_field(
5361                                    "multiple values for runs",
5362                                ));
5363                            }
5364                            result.runs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::TransferRun>>>()?.unwrap_or_default();
5365                        }
5366                        __FieldTag::Unknown(key) => {
5367                            let value = map.next_value::<serde_json::Value>()?;
5368                            result._unknown_fields.insert(key, value);
5369                        }
5370                    }
5371                }
5372                std::result::Result::Ok(result)
5373            }
5374        }
5375        deserializer.deserialize_any(Visitor)
5376    }
5377}
5378
5379#[doc(hidden)]
5380impl serde::ser::Serialize for ScheduleTransferRunsResponse {
5381    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5382    where
5383        S: serde::ser::Serializer,
5384    {
5385        use serde::ser::SerializeMap;
5386        #[allow(unused_imports)]
5387        use std::option::Option::Some;
5388        let mut state = serializer.serialize_map(std::option::Option::None)?;
5389        if !self.runs.is_empty() {
5390            state.serialize_entry("runs", &self.runs)?;
5391        }
5392        if !self._unknown_fields.is_empty() {
5393            for (key, value) in self._unknown_fields.iter() {
5394                state.serialize_entry(key, &value)?;
5395            }
5396        }
5397        state.end()
5398    }
5399}
5400
5401/// A request to start manual transfer runs.
5402#[derive(Clone, Debug, Default, PartialEq)]
5403#[non_exhaustive]
5404pub struct StartManualTransferRunsRequest {
5405    /// Required. Transfer configuration name in the form:
5406    /// `projects/{project_id}/transferConfigs/{config_id}` or
5407    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
5408    pub parent: std::string::String,
5409
5410    /// The requested time specification - this can be a time range or a specific
5411    /// run_time.
5412    pub time: std::option::Option<crate::model::start_manual_transfer_runs_request::Time>,
5413
5414    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5415}
5416
5417impl StartManualTransferRunsRequest {
5418    pub fn new() -> Self {
5419        std::default::Default::default()
5420    }
5421
5422    /// Sets the value of [parent][crate::model::StartManualTransferRunsRequest::parent].
5423    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5424        self.parent = v.into();
5425        self
5426    }
5427
5428    /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time].
5429    ///
5430    /// Note that all the setters affecting `time` are mutually
5431    /// exclusive.
5432    pub fn set_time<
5433        T: std::convert::Into<
5434                std::option::Option<crate::model::start_manual_transfer_runs_request::Time>,
5435            >,
5436    >(
5437        mut self,
5438        v: T,
5439    ) -> Self {
5440        self.time = v.into();
5441        self
5442    }
5443
5444    /// The value of [time][crate::model::StartManualTransferRunsRequest::time]
5445    /// if it holds a `RequestedTimeRange`, `None` if the field is not set or
5446    /// holds a different branch.
5447    pub fn requested_time_range(
5448        &self,
5449    ) -> std::option::Option<
5450        &std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
5451    > {
5452        #[allow(unreachable_patterns)]
5453        self.time.as_ref().and_then(|v| match v {
5454            crate::model::start_manual_transfer_runs_request::Time::RequestedTimeRange(v) => {
5455                std::option::Option::Some(v)
5456            }
5457            _ => std::option::Option::None,
5458        })
5459    }
5460
5461    /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
5462    /// to hold a `RequestedTimeRange`.
5463    ///
5464    /// Note that all the setters affecting `time` are
5465    /// mutually exclusive.
5466    pub fn set_requested_time_range<
5467        T: std::convert::Into<
5468                std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
5469            >,
5470    >(
5471        mut self,
5472        v: T,
5473    ) -> Self {
5474        self.time = std::option::Option::Some(
5475            crate::model::start_manual_transfer_runs_request::Time::RequestedTimeRange(v.into()),
5476        );
5477        self
5478    }
5479
5480    /// The value of [time][crate::model::StartManualTransferRunsRequest::time]
5481    /// if it holds a `RequestedRunTime`, `None` if the field is not set or
5482    /// holds a different branch.
5483    pub fn requested_run_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
5484        #[allow(unreachable_patterns)]
5485        self.time.as_ref().and_then(|v| match v {
5486            crate::model::start_manual_transfer_runs_request::Time::RequestedRunTime(v) => {
5487                std::option::Option::Some(v)
5488            }
5489            _ => std::option::Option::None,
5490        })
5491    }
5492
5493    /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
5494    /// to hold a `RequestedRunTime`.
5495    ///
5496    /// Note that all the setters affecting `time` are
5497    /// mutually exclusive.
5498    pub fn set_requested_run_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
5499        mut self,
5500        v: T,
5501    ) -> Self {
5502        self.time = std::option::Option::Some(
5503            crate::model::start_manual_transfer_runs_request::Time::RequestedRunTime(v.into()),
5504        );
5505        self
5506    }
5507}
5508
5509impl wkt::message::Message for StartManualTransferRunsRequest {
5510    fn typename() -> &'static str {
5511        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsRequest"
5512    }
5513}
5514
5515#[doc(hidden)]
5516impl<'de> serde::de::Deserialize<'de> for StartManualTransferRunsRequest {
5517    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5518    where
5519        D: serde::Deserializer<'de>,
5520    {
5521        #[allow(non_camel_case_types)]
5522        #[doc(hidden)]
5523        #[derive(PartialEq, Eq, Hash)]
5524        enum __FieldTag {
5525            __parent,
5526            __requested_time_range,
5527            __requested_run_time,
5528            Unknown(std::string::String),
5529        }
5530        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5531            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5532            where
5533                D: serde::Deserializer<'de>,
5534            {
5535                struct Visitor;
5536                impl<'de> serde::de::Visitor<'de> for Visitor {
5537                    type Value = __FieldTag;
5538                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5539                        formatter.write_str("a field name for StartManualTransferRunsRequest")
5540                    }
5541                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5542                    where
5543                        E: serde::de::Error,
5544                    {
5545                        use std::result::Result::Ok;
5546                        use std::string::ToString;
5547                        match value {
5548                            "parent" => Ok(__FieldTag::__parent),
5549                            "requestedTimeRange" => Ok(__FieldTag::__requested_time_range),
5550                            "requested_time_range" => Ok(__FieldTag::__requested_time_range),
5551                            "requestedRunTime" => Ok(__FieldTag::__requested_run_time),
5552                            "requested_run_time" => Ok(__FieldTag::__requested_run_time),
5553                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5554                        }
5555                    }
5556                }
5557                deserializer.deserialize_identifier(Visitor)
5558            }
5559        }
5560        struct Visitor;
5561        impl<'de> serde::de::Visitor<'de> for Visitor {
5562            type Value = StartManualTransferRunsRequest;
5563            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5564                formatter.write_str("struct StartManualTransferRunsRequest")
5565            }
5566            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5567            where
5568                A: serde::de::MapAccess<'de>,
5569            {
5570                #[allow(unused_imports)]
5571                use serde::de::Error;
5572                use std::option::Option::Some;
5573                let mut fields = std::collections::HashSet::new();
5574                let mut result = Self::Value::new();
5575                while let Some(tag) = map.next_key::<__FieldTag>()? {
5576                    #[allow(clippy::match_single_binding)]
5577                    match tag {
5578                        __FieldTag::__parent => {
5579                            if !fields.insert(__FieldTag::__parent) {
5580                                return std::result::Result::Err(A::Error::duplicate_field(
5581                                    "multiple values for parent",
5582                                ));
5583                            }
5584                            result.parent = map
5585                                .next_value::<std::option::Option<std::string::String>>()?
5586                                .unwrap_or_default();
5587                        }
5588                        __FieldTag::__requested_time_range => {
5589                            if !fields.insert(__FieldTag::__requested_time_range) {
5590                                return std::result::Result::Err(A::Error::duplicate_field(
5591                                    "multiple values for requested_time_range",
5592                                ));
5593                            }
5594                            if result.time.is_some() {
5595                                return std::result::Result::Err(A::Error::duplicate_field(
5596                                    "multiple values for `time`, a oneof with full ID .google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsRequest.requested_time_range, latest field was requestedTimeRange",
5597                                ));
5598                            }
5599                            result.time = std::option::Option::Some(
5600                                crate::model::start_manual_transfer_runs_request::Time::RequestedTimeRange(
5601                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>>>()?.unwrap_or_default()
5602                                ),
5603                            );
5604                        }
5605                        __FieldTag::__requested_run_time => {
5606                            if !fields.insert(__FieldTag::__requested_run_time) {
5607                                return std::result::Result::Err(A::Error::duplicate_field(
5608                                    "multiple values for requested_run_time",
5609                                ));
5610                            }
5611                            if result.time.is_some() {
5612                                return std::result::Result::Err(A::Error::duplicate_field(
5613                                    "multiple values for `time`, a oneof with full ID .google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsRequest.requested_run_time, latest field was requestedRunTime",
5614                                ));
5615                            }
5616                            result.time = std::option::Option::Some(
5617                                crate::model::start_manual_transfer_runs_request::Time::RequestedRunTime(
5618                                    map.next_value::<std::option::Option<std::boxed::Box<wkt::Timestamp>>>()?.unwrap_or_default()
5619                                ),
5620                            );
5621                        }
5622                        __FieldTag::Unknown(key) => {
5623                            let value = map.next_value::<serde_json::Value>()?;
5624                            result._unknown_fields.insert(key, value);
5625                        }
5626                    }
5627                }
5628                std::result::Result::Ok(result)
5629            }
5630        }
5631        deserializer.deserialize_any(Visitor)
5632    }
5633}
5634
5635#[doc(hidden)]
5636impl serde::ser::Serialize for StartManualTransferRunsRequest {
5637    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5638    where
5639        S: serde::ser::Serializer,
5640    {
5641        use serde::ser::SerializeMap;
5642        #[allow(unused_imports)]
5643        use std::option::Option::Some;
5644        let mut state = serializer.serialize_map(std::option::Option::None)?;
5645        if !self.parent.is_empty() {
5646            state.serialize_entry("parent", &self.parent)?;
5647        }
5648        if let Some(value) = self.requested_time_range() {
5649            state.serialize_entry("requestedTimeRange", value)?;
5650        }
5651        if let Some(value) = self.requested_run_time() {
5652            state.serialize_entry("requestedRunTime", value)?;
5653        }
5654        if !self._unknown_fields.is_empty() {
5655            for (key, value) in self._unknown_fields.iter() {
5656                state.serialize_entry(key, &value)?;
5657            }
5658        }
5659        state.end()
5660    }
5661}
5662
5663/// Defines additional types related to [StartManualTransferRunsRequest].
5664pub mod start_manual_transfer_runs_request {
5665    #[allow(unused_imports)]
5666    use super::*;
5667
5668    /// A specification for a time range, this will request transfer runs with
5669    /// run_time between start_time (inclusive) and end_time (exclusive).
5670    #[derive(Clone, Debug, Default, PartialEq)]
5671    #[non_exhaustive]
5672    pub struct TimeRange {
5673        /// Start time of the range of transfer runs. For example,
5674        /// `"2017-05-25T00:00:00+00:00"`. The start_time must be strictly less than
5675        /// the end_time. Creates transfer runs where run_time is in the range
5676        /// between start_time (inclusive) and end_time (exclusive).
5677        pub start_time: std::option::Option<wkt::Timestamp>,
5678
5679        /// End time of the range of transfer runs. For example,
5680        /// `"2017-05-30T00:00:00+00:00"`. The end_time must not be in the future.
5681        /// Creates transfer runs where run_time is in the range between start_time
5682        /// (inclusive) and end_time (exclusive).
5683        pub end_time: std::option::Option<wkt::Timestamp>,
5684
5685        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5686    }
5687
5688    impl TimeRange {
5689        pub fn new() -> Self {
5690            std::default::Default::default()
5691        }
5692
5693        /// Sets the value of [start_time][crate::model::start_manual_transfer_runs_request::TimeRange::start_time].
5694        pub fn set_start_time<T>(mut self, v: T) -> Self
5695        where
5696            T: std::convert::Into<wkt::Timestamp>,
5697        {
5698            self.start_time = std::option::Option::Some(v.into());
5699            self
5700        }
5701
5702        /// Sets or clears the value of [start_time][crate::model::start_manual_transfer_runs_request::TimeRange::start_time].
5703        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5704        where
5705            T: std::convert::Into<wkt::Timestamp>,
5706        {
5707            self.start_time = v.map(|x| x.into());
5708            self
5709        }
5710
5711        /// Sets the value of [end_time][crate::model::start_manual_transfer_runs_request::TimeRange::end_time].
5712        pub fn set_end_time<T>(mut self, v: T) -> Self
5713        where
5714            T: std::convert::Into<wkt::Timestamp>,
5715        {
5716            self.end_time = std::option::Option::Some(v.into());
5717            self
5718        }
5719
5720        /// Sets or clears the value of [end_time][crate::model::start_manual_transfer_runs_request::TimeRange::end_time].
5721        pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5722        where
5723            T: std::convert::Into<wkt::Timestamp>,
5724        {
5725            self.end_time = v.map(|x| x.into());
5726            self
5727        }
5728    }
5729
5730    impl wkt::message::Message for TimeRange {
5731        fn typename() -> &'static str {
5732            "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsRequest.TimeRange"
5733        }
5734    }
5735
5736    #[doc(hidden)]
5737    impl<'de> serde::de::Deserialize<'de> for TimeRange {
5738        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5739        where
5740            D: serde::Deserializer<'de>,
5741        {
5742            #[allow(non_camel_case_types)]
5743            #[doc(hidden)]
5744            #[derive(PartialEq, Eq, Hash)]
5745            enum __FieldTag {
5746                __start_time,
5747                __end_time,
5748                Unknown(std::string::String),
5749            }
5750            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5751                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5752                where
5753                    D: serde::Deserializer<'de>,
5754                {
5755                    struct Visitor;
5756                    impl<'de> serde::de::Visitor<'de> for Visitor {
5757                        type Value = __FieldTag;
5758                        fn expecting(
5759                            &self,
5760                            formatter: &mut std::fmt::Formatter,
5761                        ) -> std::fmt::Result {
5762                            formatter.write_str("a field name for TimeRange")
5763                        }
5764                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5765                        where
5766                            E: serde::de::Error,
5767                        {
5768                            use std::result::Result::Ok;
5769                            use std::string::ToString;
5770                            match value {
5771                                "startTime" => Ok(__FieldTag::__start_time),
5772                                "start_time" => Ok(__FieldTag::__start_time),
5773                                "endTime" => Ok(__FieldTag::__end_time),
5774                                "end_time" => Ok(__FieldTag::__end_time),
5775                                _ => Ok(__FieldTag::Unknown(value.to_string())),
5776                            }
5777                        }
5778                    }
5779                    deserializer.deserialize_identifier(Visitor)
5780                }
5781            }
5782            struct Visitor;
5783            impl<'de> serde::de::Visitor<'de> for Visitor {
5784                type Value = TimeRange;
5785                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5786                    formatter.write_str("struct TimeRange")
5787                }
5788                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5789                where
5790                    A: serde::de::MapAccess<'de>,
5791                {
5792                    #[allow(unused_imports)]
5793                    use serde::de::Error;
5794                    use std::option::Option::Some;
5795                    let mut fields = std::collections::HashSet::new();
5796                    let mut result = Self::Value::new();
5797                    while let Some(tag) = map.next_key::<__FieldTag>()? {
5798                        #[allow(clippy::match_single_binding)]
5799                        match tag {
5800                            __FieldTag::__start_time => {
5801                                if !fields.insert(__FieldTag::__start_time) {
5802                                    return std::result::Result::Err(A::Error::duplicate_field(
5803                                        "multiple values for start_time",
5804                                    ));
5805                                }
5806                                result.start_time =
5807                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5808                            }
5809                            __FieldTag::__end_time => {
5810                                if !fields.insert(__FieldTag::__end_time) {
5811                                    return std::result::Result::Err(A::Error::duplicate_field(
5812                                        "multiple values for end_time",
5813                                    ));
5814                                }
5815                                result.end_time =
5816                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5817                            }
5818                            __FieldTag::Unknown(key) => {
5819                                let value = map.next_value::<serde_json::Value>()?;
5820                                result._unknown_fields.insert(key, value);
5821                            }
5822                        }
5823                    }
5824                    std::result::Result::Ok(result)
5825                }
5826            }
5827            deserializer.deserialize_any(Visitor)
5828        }
5829    }
5830
5831    #[doc(hidden)]
5832    impl serde::ser::Serialize for TimeRange {
5833        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5834        where
5835            S: serde::ser::Serializer,
5836        {
5837            use serde::ser::SerializeMap;
5838            #[allow(unused_imports)]
5839            use std::option::Option::Some;
5840            let mut state = serializer.serialize_map(std::option::Option::None)?;
5841            if self.start_time.is_some() {
5842                state.serialize_entry("startTime", &self.start_time)?;
5843            }
5844            if self.end_time.is_some() {
5845                state.serialize_entry("endTime", &self.end_time)?;
5846            }
5847            if !self._unknown_fields.is_empty() {
5848                for (key, value) in self._unknown_fields.iter() {
5849                    state.serialize_entry(key, &value)?;
5850                }
5851            }
5852            state.end()
5853        }
5854    }
5855
5856    /// The requested time specification - this can be a time range or a specific
5857    /// run_time.
5858    #[derive(Clone, Debug, PartialEq)]
5859    #[non_exhaustive]
5860    pub enum Time {
5861        /// A time_range start and end timestamp for historical data files or reports
5862        /// that are scheduled to be transferred by the scheduled transfer run.
5863        /// requested_time_range must be a past time and cannot include future time
5864        /// values.
5865        RequestedTimeRange(
5866            std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
5867        ),
5868        /// A run_time timestamp for historical data files or reports
5869        /// that are scheduled to be transferred by the scheduled transfer run.
5870        /// requested_run_time must be a past time and cannot include future time
5871        /// values.
5872        RequestedRunTime(std::boxed::Box<wkt::Timestamp>),
5873    }
5874}
5875
5876/// A response to start manual transfer runs.
5877#[derive(Clone, Debug, Default, PartialEq)]
5878#[non_exhaustive]
5879pub struct StartManualTransferRunsResponse {
5880    /// The transfer runs that were created.
5881    pub runs: std::vec::Vec<crate::model::TransferRun>,
5882
5883    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5884}
5885
5886impl StartManualTransferRunsResponse {
5887    pub fn new() -> Self {
5888        std::default::Default::default()
5889    }
5890
5891    /// Sets the value of [runs][crate::model::StartManualTransferRunsResponse::runs].
5892    pub fn set_runs<T, V>(mut self, v: T) -> Self
5893    where
5894        T: std::iter::IntoIterator<Item = V>,
5895        V: std::convert::Into<crate::model::TransferRun>,
5896    {
5897        use std::iter::Iterator;
5898        self.runs = v.into_iter().map(|i| i.into()).collect();
5899        self
5900    }
5901}
5902
5903impl wkt::message::Message for StartManualTransferRunsResponse {
5904    fn typename() -> &'static str {
5905        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsResponse"
5906    }
5907}
5908
5909#[doc(hidden)]
5910impl<'de> serde::de::Deserialize<'de> for StartManualTransferRunsResponse {
5911    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5912    where
5913        D: serde::Deserializer<'de>,
5914    {
5915        #[allow(non_camel_case_types)]
5916        #[doc(hidden)]
5917        #[derive(PartialEq, Eq, Hash)]
5918        enum __FieldTag {
5919            __runs,
5920            Unknown(std::string::String),
5921        }
5922        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5923            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5924            where
5925                D: serde::Deserializer<'de>,
5926            {
5927                struct Visitor;
5928                impl<'de> serde::de::Visitor<'de> for Visitor {
5929                    type Value = __FieldTag;
5930                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5931                        formatter.write_str("a field name for StartManualTransferRunsResponse")
5932                    }
5933                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5934                    where
5935                        E: serde::de::Error,
5936                    {
5937                        use std::result::Result::Ok;
5938                        use std::string::ToString;
5939                        match value {
5940                            "runs" => Ok(__FieldTag::__runs),
5941                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5942                        }
5943                    }
5944                }
5945                deserializer.deserialize_identifier(Visitor)
5946            }
5947        }
5948        struct Visitor;
5949        impl<'de> serde::de::Visitor<'de> for Visitor {
5950            type Value = StartManualTransferRunsResponse;
5951            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5952                formatter.write_str("struct StartManualTransferRunsResponse")
5953            }
5954            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5955            where
5956                A: serde::de::MapAccess<'de>,
5957            {
5958                #[allow(unused_imports)]
5959                use serde::de::Error;
5960                use std::option::Option::Some;
5961                let mut fields = std::collections::HashSet::new();
5962                let mut result = Self::Value::new();
5963                while let Some(tag) = map.next_key::<__FieldTag>()? {
5964                    #[allow(clippy::match_single_binding)]
5965                    match tag {
5966                        __FieldTag::__runs => {
5967                            if !fields.insert(__FieldTag::__runs) {
5968                                return std::result::Result::Err(A::Error::duplicate_field(
5969                                    "multiple values for runs",
5970                                ));
5971                            }
5972                            result.runs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::TransferRun>>>()?.unwrap_or_default();
5973                        }
5974                        __FieldTag::Unknown(key) => {
5975                            let value = map.next_value::<serde_json::Value>()?;
5976                            result._unknown_fields.insert(key, value);
5977                        }
5978                    }
5979                }
5980                std::result::Result::Ok(result)
5981            }
5982        }
5983        deserializer.deserialize_any(Visitor)
5984    }
5985}
5986
5987#[doc(hidden)]
5988impl serde::ser::Serialize for StartManualTransferRunsResponse {
5989    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5990    where
5991        S: serde::ser::Serializer,
5992    {
5993        use serde::ser::SerializeMap;
5994        #[allow(unused_imports)]
5995        use std::option::Option::Some;
5996        let mut state = serializer.serialize_map(std::option::Option::None)?;
5997        if !self.runs.is_empty() {
5998            state.serialize_entry("runs", &self.runs)?;
5999        }
6000        if !self._unknown_fields.is_empty() {
6001            for (key, value) in self._unknown_fields.iter() {
6002                state.serialize_entry(key, &value)?;
6003            }
6004        }
6005        state.end()
6006    }
6007}
6008
6009/// A request to enroll a set of data sources so they are visible in the
6010/// BigQuery UI's `Transfer` tab.
6011#[derive(Clone, Debug, Default, PartialEq)]
6012#[non_exhaustive]
6013pub struct EnrollDataSourcesRequest {
6014    /// Required. The name of the project resource in the form:
6015    /// `projects/{project_id}`
6016    pub name: std::string::String,
6017
6018    /// Data sources that are enrolled. It is required to provide at least one
6019    /// data source id.
6020    pub data_source_ids: std::vec::Vec<std::string::String>,
6021
6022    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6023}
6024
6025impl EnrollDataSourcesRequest {
6026    pub fn new() -> Self {
6027        std::default::Default::default()
6028    }
6029
6030    /// Sets the value of [name][crate::model::EnrollDataSourcesRequest::name].
6031    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6032        self.name = v.into();
6033        self
6034    }
6035
6036    /// Sets the value of [data_source_ids][crate::model::EnrollDataSourcesRequest::data_source_ids].
6037    pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
6038    where
6039        T: std::iter::IntoIterator<Item = V>,
6040        V: std::convert::Into<std::string::String>,
6041    {
6042        use std::iter::Iterator;
6043        self.data_source_ids = v.into_iter().map(|i| i.into()).collect();
6044        self
6045    }
6046}
6047
6048impl wkt::message::Message for EnrollDataSourcesRequest {
6049    fn typename() -> &'static str {
6050        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EnrollDataSourcesRequest"
6051    }
6052}
6053
6054#[doc(hidden)]
6055impl<'de> serde::de::Deserialize<'de> for EnrollDataSourcesRequest {
6056    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6057    where
6058        D: serde::Deserializer<'de>,
6059    {
6060        #[allow(non_camel_case_types)]
6061        #[doc(hidden)]
6062        #[derive(PartialEq, Eq, Hash)]
6063        enum __FieldTag {
6064            __name,
6065            __data_source_ids,
6066            Unknown(std::string::String),
6067        }
6068        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6069            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6070            where
6071                D: serde::Deserializer<'de>,
6072            {
6073                struct Visitor;
6074                impl<'de> serde::de::Visitor<'de> for Visitor {
6075                    type Value = __FieldTag;
6076                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6077                        formatter.write_str("a field name for EnrollDataSourcesRequest")
6078                    }
6079                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6080                    where
6081                        E: serde::de::Error,
6082                    {
6083                        use std::result::Result::Ok;
6084                        use std::string::ToString;
6085                        match value {
6086                            "name" => Ok(__FieldTag::__name),
6087                            "dataSourceIds" => Ok(__FieldTag::__data_source_ids),
6088                            "data_source_ids" => Ok(__FieldTag::__data_source_ids),
6089                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6090                        }
6091                    }
6092                }
6093                deserializer.deserialize_identifier(Visitor)
6094            }
6095        }
6096        struct Visitor;
6097        impl<'de> serde::de::Visitor<'de> for Visitor {
6098            type Value = EnrollDataSourcesRequest;
6099            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6100                formatter.write_str("struct EnrollDataSourcesRequest")
6101            }
6102            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6103            where
6104                A: serde::de::MapAccess<'de>,
6105            {
6106                #[allow(unused_imports)]
6107                use serde::de::Error;
6108                use std::option::Option::Some;
6109                let mut fields = std::collections::HashSet::new();
6110                let mut result = Self::Value::new();
6111                while let Some(tag) = map.next_key::<__FieldTag>()? {
6112                    #[allow(clippy::match_single_binding)]
6113                    match tag {
6114                        __FieldTag::__name => {
6115                            if !fields.insert(__FieldTag::__name) {
6116                                return std::result::Result::Err(A::Error::duplicate_field(
6117                                    "multiple values for name",
6118                                ));
6119                            }
6120                            result.name = map
6121                                .next_value::<std::option::Option<std::string::String>>()?
6122                                .unwrap_or_default();
6123                        }
6124                        __FieldTag::__data_source_ids => {
6125                            if !fields.insert(__FieldTag::__data_source_ids) {
6126                                return std::result::Result::Err(A::Error::duplicate_field(
6127                                    "multiple values for data_source_ids",
6128                                ));
6129                            }
6130                            result.data_source_ids = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
6131                        }
6132                        __FieldTag::Unknown(key) => {
6133                            let value = map.next_value::<serde_json::Value>()?;
6134                            result._unknown_fields.insert(key, value);
6135                        }
6136                    }
6137                }
6138                std::result::Result::Ok(result)
6139            }
6140        }
6141        deserializer.deserialize_any(Visitor)
6142    }
6143}
6144
6145#[doc(hidden)]
6146impl serde::ser::Serialize for EnrollDataSourcesRequest {
6147    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6148    where
6149        S: serde::ser::Serializer,
6150    {
6151        use serde::ser::SerializeMap;
6152        #[allow(unused_imports)]
6153        use std::option::Option::Some;
6154        let mut state = serializer.serialize_map(std::option::Option::None)?;
6155        if !self.name.is_empty() {
6156            state.serialize_entry("name", &self.name)?;
6157        }
6158        if !self.data_source_ids.is_empty() {
6159            state.serialize_entry("dataSourceIds", &self.data_source_ids)?;
6160        }
6161        if !self._unknown_fields.is_empty() {
6162            for (key, value) in self._unknown_fields.iter() {
6163                state.serialize_entry(key, &value)?;
6164            }
6165        }
6166        state.end()
6167    }
6168}
6169
6170/// A request to unenroll a set of data sources so they are no longer visible in
6171/// the BigQuery UI's `Transfer` tab.
6172#[derive(Clone, Debug, Default, PartialEq)]
6173#[non_exhaustive]
6174pub struct UnenrollDataSourcesRequest {
6175    /// Required. The name of the project resource in the form:
6176    /// `projects/{project_id}`
6177    pub name: std::string::String,
6178
6179    /// Data sources that are unenrolled. It is required to provide at least one
6180    /// data source id.
6181    pub data_source_ids: std::vec::Vec<std::string::String>,
6182
6183    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6184}
6185
6186impl UnenrollDataSourcesRequest {
6187    pub fn new() -> Self {
6188        std::default::Default::default()
6189    }
6190
6191    /// Sets the value of [name][crate::model::UnenrollDataSourcesRequest::name].
6192    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6193        self.name = v.into();
6194        self
6195    }
6196
6197    /// Sets the value of [data_source_ids][crate::model::UnenrollDataSourcesRequest::data_source_ids].
6198    pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
6199    where
6200        T: std::iter::IntoIterator<Item = V>,
6201        V: std::convert::Into<std::string::String>,
6202    {
6203        use std::iter::Iterator;
6204        self.data_source_ids = v.into_iter().map(|i| i.into()).collect();
6205        self
6206    }
6207}
6208
6209impl wkt::message::Message for UnenrollDataSourcesRequest {
6210    fn typename() -> &'static str {
6211        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.UnenrollDataSourcesRequest"
6212    }
6213}
6214
6215#[doc(hidden)]
6216impl<'de> serde::de::Deserialize<'de> for UnenrollDataSourcesRequest {
6217    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6218    where
6219        D: serde::Deserializer<'de>,
6220    {
6221        #[allow(non_camel_case_types)]
6222        #[doc(hidden)]
6223        #[derive(PartialEq, Eq, Hash)]
6224        enum __FieldTag {
6225            __name,
6226            __data_source_ids,
6227            Unknown(std::string::String),
6228        }
6229        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6230            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6231            where
6232                D: serde::Deserializer<'de>,
6233            {
6234                struct Visitor;
6235                impl<'de> serde::de::Visitor<'de> for Visitor {
6236                    type Value = __FieldTag;
6237                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6238                        formatter.write_str("a field name for UnenrollDataSourcesRequest")
6239                    }
6240                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6241                    where
6242                        E: serde::de::Error,
6243                    {
6244                        use std::result::Result::Ok;
6245                        use std::string::ToString;
6246                        match value {
6247                            "name" => Ok(__FieldTag::__name),
6248                            "dataSourceIds" => Ok(__FieldTag::__data_source_ids),
6249                            "data_source_ids" => Ok(__FieldTag::__data_source_ids),
6250                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6251                        }
6252                    }
6253                }
6254                deserializer.deserialize_identifier(Visitor)
6255            }
6256        }
6257        struct Visitor;
6258        impl<'de> serde::de::Visitor<'de> for Visitor {
6259            type Value = UnenrollDataSourcesRequest;
6260            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6261                formatter.write_str("struct UnenrollDataSourcesRequest")
6262            }
6263            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6264            where
6265                A: serde::de::MapAccess<'de>,
6266            {
6267                #[allow(unused_imports)]
6268                use serde::de::Error;
6269                use std::option::Option::Some;
6270                let mut fields = std::collections::HashSet::new();
6271                let mut result = Self::Value::new();
6272                while let Some(tag) = map.next_key::<__FieldTag>()? {
6273                    #[allow(clippy::match_single_binding)]
6274                    match tag {
6275                        __FieldTag::__name => {
6276                            if !fields.insert(__FieldTag::__name) {
6277                                return std::result::Result::Err(A::Error::duplicate_field(
6278                                    "multiple values for name",
6279                                ));
6280                            }
6281                            result.name = map
6282                                .next_value::<std::option::Option<std::string::String>>()?
6283                                .unwrap_or_default();
6284                        }
6285                        __FieldTag::__data_source_ids => {
6286                            if !fields.insert(__FieldTag::__data_source_ids) {
6287                                return std::result::Result::Err(A::Error::duplicate_field(
6288                                    "multiple values for data_source_ids",
6289                                ));
6290                            }
6291                            result.data_source_ids = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
6292                        }
6293                        __FieldTag::Unknown(key) => {
6294                            let value = map.next_value::<serde_json::Value>()?;
6295                            result._unknown_fields.insert(key, value);
6296                        }
6297                    }
6298                }
6299                std::result::Result::Ok(result)
6300            }
6301        }
6302        deserializer.deserialize_any(Visitor)
6303    }
6304}
6305
6306#[doc(hidden)]
6307impl serde::ser::Serialize for UnenrollDataSourcesRequest {
6308    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6309    where
6310        S: serde::ser::Serializer,
6311    {
6312        use serde::ser::SerializeMap;
6313        #[allow(unused_imports)]
6314        use std::option::Option::Some;
6315        let mut state = serializer.serialize_map(std::option::Option::None)?;
6316        if !self.name.is_empty() {
6317            state.serialize_entry("name", &self.name)?;
6318        }
6319        if !self.data_source_ids.is_empty() {
6320            state.serialize_entry("dataSourceIds", &self.data_source_ids)?;
6321        }
6322        if !self._unknown_fields.is_empty() {
6323            for (key, value) in self._unknown_fields.iter() {
6324                state.serialize_entry(key, &value)?;
6325            }
6326        }
6327        state.end()
6328    }
6329}
6330
6331/// Represents preferences for sending email notifications for transfer run
6332/// events.
6333#[derive(Clone, Debug, Default, PartialEq)]
6334#[non_exhaustive]
6335pub struct EmailPreferences {
6336    /// If true, email notifications will be sent on transfer run failures.
6337    pub enable_failure_email: bool,
6338
6339    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6340}
6341
6342impl EmailPreferences {
6343    pub fn new() -> Self {
6344        std::default::Default::default()
6345    }
6346
6347    /// Sets the value of [enable_failure_email][crate::model::EmailPreferences::enable_failure_email].
6348    pub fn set_enable_failure_email<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6349        self.enable_failure_email = v.into();
6350        self
6351    }
6352}
6353
6354impl wkt::message::Message for EmailPreferences {
6355    fn typename() -> &'static str {
6356        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EmailPreferences"
6357    }
6358}
6359
6360#[doc(hidden)]
6361impl<'de> serde::de::Deserialize<'de> for EmailPreferences {
6362    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6363    where
6364        D: serde::Deserializer<'de>,
6365    {
6366        #[allow(non_camel_case_types)]
6367        #[doc(hidden)]
6368        #[derive(PartialEq, Eq, Hash)]
6369        enum __FieldTag {
6370            __enable_failure_email,
6371            Unknown(std::string::String),
6372        }
6373        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6374            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6375            where
6376                D: serde::Deserializer<'de>,
6377            {
6378                struct Visitor;
6379                impl<'de> serde::de::Visitor<'de> for Visitor {
6380                    type Value = __FieldTag;
6381                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6382                        formatter.write_str("a field name for EmailPreferences")
6383                    }
6384                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6385                    where
6386                        E: serde::de::Error,
6387                    {
6388                        use std::result::Result::Ok;
6389                        use std::string::ToString;
6390                        match value {
6391                            "enableFailureEmail" => Ok(__FieldTag::__enable_failure_email),
6392                            "enable_failure_email" => Ok(__FieldTag::__enable_failure_email),
6393                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6394                        }
6395                    }
6396                }
6397                deserializer.deserialize_identifier(Visitor)
6398            }
6399        }
6400        struct Visitor;
6401        impl<'de> serde::de::Visitor<'de> for Visitor {
6402            type Value = EmailPreferences;
6403            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6404                formatter.write_str("struct EmailPreferences")
6405            }
6406            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6407            where
6408                A: serde::de::MapAccess<'de>,
6409            {
6410                #[allow(unused_imports)]
6411                use serde::de::Error;
6412                use std::option::Option::Some;
6413                let mut fields = std::collections::HashSet::new();
6414                let mut result = Self::Value::new();
6415                while let Some(tag) = map.next_key::<__FieldTag>()? {
6416                    #[allow(clippy::match_single_binding)]
6417                    match tag {
6418                        __FieldTag::__enable_failure_email => {
6419                            if !fields.insert(__FieldTag::__enable_failure_email) {
6420                                return std::result::Result::Err(A::Error::duplicate_field(
6421                                    "multiple values for enable_failure_email",
6422                                ));
6423                            }
6424                            result.enable_failure_email = map
6425                                .next_value::<std::option::Option<bool>>()?
6426                                .unwrap_or_default();
6427                        }
6428                        __FieldTag::Unknown(key) => {
6429                            let value = map.next_value::<serde_json::Value>()?;
6430                            result._unknown_fields.insert(key, value);
6431                        }
6432                    }
6433                }
6434                std::result::Result::Ok(result)
6435            }
6436        }
6437        deserializer.deserialize_any(Visitor)
6438    }
6439}
6440
6441#[doc(hidden)]
6442impl serde::ser::Serialize for EmailPreferences {
6443    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6444    where
6445        S: serde::ser::Serializer,
6446    {
6447        use serde::ser::SerializeMap;
6448        #[allow(unused_imports)]
6449        use std::option::Option::Some;
6450        let mut state = serializer.serialize_map(std::option::Option::None)?;
6451        if !wkt::internal::is_default(&self.enable_failure_email) {
6452            state.serialize_entry("enableFailureEmail", &self.enable_failure_email)?;
6453        }
6454        if !self._unknown_fields.is_empty() {
6455            for (key, value) in self._unknown_fields.iter() {
6456                state.serialize_entry(key, &value)?;
6457            }
6458        }
6459        state.end()
6460    }
6461}
6462
6463/// Options customizing the data transfer schedule.
6464#[derive(Clone, Debug, Default, PartialEq)]
6465#[non_exhaustive]
6466pub struct ScheduleOptions {
6467    /// If true, automatic scheduling of data transfer runs for this configuration
6468    /// will be disabled. The runs can be started on ad-hoc basis using
6469    /// StartManualTransferRuns API. When automatic scheduling is disabled, the
6470    /// TransferConfig.schedule field will be ignored.
6471    pub disable_auto_scheduling: bool,
6472
6473    /// Specifies time to start scheduling transfer runs. The first run will be
6474    /// scheduled at or after the start time according to a recurrence pattern
6475    /// defined in the schedule string. The start time can be changed at any
6476    /// moment. The time when a data transfer can be triggered manually is not
6477    /// limited by this option.
6478    pub start_time: std::option::Option<wkt::Timestamp>,
6479
6480    /// Defines time to stop scheduling transfer runs. A transfer run cannot be
6481    /// scheduled at or after the end time. The end time can be changed at any
6482    /// moment. The time when a data transfer can be triggered manually is not
6483    /// limited by this option.
6484    pub end_time: std::option::Option<wkt::Timestamp>,
6485
6486    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6487}
6488
6489impl ScheduleOptions {
6490    pub fn new() -> Self {
6491        std::default::Default::default()
6492    }
6493
6494    /// Sets the value of [disable_auto_scheduling][crate::model::ScheduleOptions::disable_auto_scheduling].
6495    pub fn set_disable_auto_scheduling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6496        self.disable_auto_scheduling = v.into();
6497        self
6498    }
6499
6500    /// Sets the value of [start_time][crate::model::ScheduleOptions::start_time].
6501    pub fn set_start_time<T>(mut self, v: T) -> Self
6502    where
6503        T: std::convert::Into<wkt::Timestamp>,
6504    {
6505        self.start_time = std::option::Option::Some(v.into());
6506        self
6507    }
6508
6509    /// Sets or clears the value of [start_time][crate::model::ScheduleOptions::start_time].
6510    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6511    where
6512        T: std::convert::Into<wkt::Timestamp>,
6513    {
6514        self.start_time = v.map(|x| x.into());
6515        self
6516    }
6517
6518    /// Sets the value of [end_time][crate::model::ScheduleOptions::end_time].
6519    pub fn set_end_time<T>(mut self, v: T) -> Self
6520    where
6521        T: std::convert::Into<wkt::Timestamp>,
6522    {
6523        self.end_time = std::option::Option::Some(v.into());
6524        self
6525    }
6526
6527    /// Sets or clears the value of [end_time][crate::model::ScheduleOptions::end_time].
6528    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
6529    where
6530        T: std::convert::Into<wkt::Timestamp>,
6531    {
6532        self.end_time = v.map(|x| x.into());
6533        self
6534    }
6535}
6536
6537impl wkt::message::Message for ScheduleOptions {
6538    fn typename() -> &'static str {
6539        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleOptions"
6540    }
6541}
6542
6543#[doc(hidden)]
6544impl<'de> serde::de::Deserialize<'de> for ScheduleOptions {
6545    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6546    where
6547        D: serde::Deserializer<'de>,
6548    {
6549        #[allow(non_camel_case_types)]
6550        #[doc(hidden)]
6551        #[derive(PartialEq, Eq, Hash)]
6552        enum __FieldTag {
6553            __disable_auto_scheduling,
6554            __start_time,
6555            __end_time,
6556            Unknown(std::string::String),
6557        }
6558        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6559            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6560            where
6561                D: serde::Deserializer<'de>,
6562            {
6563                struct Visitor;
6564                impl<'de> serde::de::Visitor<'de> for Visitor {
6565                    type Value = __FieldTag;
6566                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6567                        formatter.write_str("a field name for ScheduleOptions")
6568                    }
6569                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6570                    where
6571                        E: serde::de::Error,
6572                    {
6573                        use std::result::Result::Ok;
6574                        use std::string::ToString;
6575                        match value {
6576                            "disableAutoScheduling" => Ok(__FieldTag::__disable_auto_scheduling),
6577                            "disable_auto_scheduling" => Ok(__FieldTag::__disable_auto_scheduling),
6578                            "startTime" => Ok(__FieldTag::__start_time),
6579                            "start_time" => Ok(__FieldTag::__start_time),
6580                            "endTime" => Ok(__FieldTag::__end_time),
6581                            "end_time" => Ok(__FieldTag::__end_time),
6582                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6583                        }
6584                    }
6585                }
6586                deserializer.deserialize_identifier(Visitor)
6587            }
6588        }
6589        struct Visitor;
6590        impl<'de> serde::de::Visitor<'de> for Visitor {
6591            type Value = ScheduleOptions;
6592            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6593                formatter.write_str("struct ScheduleOptions")
6594            }
6595            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6596            where
6597                A: serde::de::MapAccess<'de>,
6598            {
6599                #[allow(unused_imports)]
6600                use serde::de::Error;
6601                use std::option::Option::Some;
6602                let mut fields = std::collections::HashSet::new();
6603                let mut result = Self::Value::new();
6604                while let Some(tag) = map.next_key::<__FieldTag>()? {
6605                    #[allow(clippy::match_single_binding)]
6606                    match tag {
6607                        __FieldTag::__disable_auto_scheduling => {
6608                            if !fields.insert(__FieldTag::__disable_auto_scheduling) {
6609                                return std::result::Result::Err(A::Error::duplicate_field(
6610                                    "multiple values for disable_auto_scheduling",
6611                                ));
6612                            }
6613                            result.disable_auto_scheduling = map
6614                                .next_value::<std::option::Option<bool>>()?
6615                                .unwrap_or_default();
6616                        }
6617                        __FieldTag::__start_time => {
6618                            if !fields.insert(__FieldTag::__start_time) {
6619                                return std::result::Result::Err(A::Error::duplicate_field(
6620                                    "multiple values for start_time",
6621                                ));
6622                            }
6623                            result.start_time =
6624                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
6625                        }
6626                        __FieldTag::__end_time => {
6627                            if !fields.insert(__FieldTag::__end_time) {
6628                                return std::result::Result::Err(A::Error::duplicate_field(
6629                                    "multiple values for end_time",
6630                                ));
6631                            }
6632                            result.end_time =
6633                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
6634                        }
6635                        __FieldTag::Unknown(key) => {
6636                            let value = map.next_value::<serde_json::Value>()?;
6637                            result._unknown_fields.insert(key, value);
6638                        }
6639                    }
6640                }
6641                std::result::Result::Ok(result)
6642            }
6643        }
6644        deserializer.deserialize_any(Visitor)
6645    }
6646}
6647
6648#[doc(hidden)]
6649impl serde::ser::Serialize for ScheduleOptions {
6650    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6651    where
6652        S: serde::ser::Serializer,
6653    {
6654        use serde::ser::SerializeMap;
6655        #[allow(unused_imports)]
6656        use std::option::Option::Some;
6657        let mut state = serializer.serialize_map(std::option::Option::None)?;
6658        if !wkt::internal::is_default(&self.disable_auto_scheduling) {
6659            state.serialize_entry("disableAutoScheduling", &self.disable_auto_scheduling)?;
6660        }
6661        if self.start_time.is_some() {
6662            state.serialize_entry("startTime", &self.start_time)?;
6663        }
6664        if self.end_time.is_some() {
6665            state.serialize_entry("endTime", &self.end_time)?;
6666        }
6667        if !self._unknown_fields.is_empty() {
6668            for (key, value) in self._unknown_fields.iter() {
6669                state.serialize_entry(key, &value)?;
6670            }
6671        }
6672        state.end()
6673    }
6674}
6675
6676/// V2 options customizing different types of data transfer schedule.
6677/// This field supports existing time-based and manual transfer schedule. Also
6678/// supports Event-Driven transfer schedule. ScheduleOptionsV2 cannot be used
6679/// together with ScheduleOptions/Schedule.
6680#[derive(Clone, Debug, Default, PartialEq)]
6681#[non_exhaustive]
6682pub struct ScheduleOptionsV2 {
6683    /// Data transfer schedules.
6684    pub schedule: std::option::Option<crate::model::schedule_options_v_2::Schedule>,
6685
6686    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6687}
6688
6689impl ScheduleOptionsV2 {
6690    pub fn new() -> Self {
6691        std::default::Default::default()
6692    }
6693
6694    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule].
6695    ///
6696    /// Note that all the setters affecting `schedule` are mutually
6697    /// exclusive.
6698    pub fn set_schedule<
6699        T: std::convert::Into<std::option::Option<crate::model::schedule_options_v_2::Schedule>>,
6700    >(
6701        mut self,
6702        v: T,
6703    ) -> Self {
6704        self.schedule = v.into();
6705        self
6706    }
6707
6708    /// The value of [schedule][crate::model::ScheduleOptionsV2::schedule]
6709    /// if it holds a `TimeBasedSchedule`, `None` if the field is not set or
6710    /// holds a different branch.
6711    pub fn time_based_schedule(
6712        &self,
6713    ) -> std::option::Option<&std::boxed::Box<crate::model::TimeBasedSchedule>> {
6714        #[allow(unreachable_patterns)]
6715        self.schedule.as_ref().and_then(|v| match v {
6716            crate::model::schedule_options_v_2::Schedule::TimeBasedSchedule(v) => {
6717                std::option::Option::Some(v)
6718            }
6719            _ => std::option::Option::None,
6720        })
6721    }
6722
6723    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule]
6724    /// to hold a `TimeBasedSchedule`.
6725    ///
6726    /// Note that all the setters affecting `schedule` are
6727    /// mutually exclusive.
6728    pub fn set_time_based_schedule<
6729        T: std::convert::Into<std::boxed::Box<crate::model::TimeBasedSchedule>>,
6730    >(
6731        mut self,
6732        v: T,
6733    ) -> Self {
6734        self.schedule = std::option::Option::Some(
6735            crate::model::schedule_options_v_2::Schedule::TimeBasedSchedule(v.into()),
6736        );
6737        self
6738    }
6739
6740    /// The value of [schedule][crate::model::ScheduleOptionsV2::schedule]
6741    /// if it holds a `ManualSchedule`, `None` if the field is not set or
6742    /// holds a different branch.
6743    pub fn manual_schedule(
6744        &self,
6745    ) -> std::option::Option<&std::boxed::Box<crate::model::ManualSchedule>> {
6746        #[allow(unreachable_patterns)]
6747        self.schedule.as_ref().and_then(|v| match v {
6748            crate::model::schedule_options_v_2::Schedule::ManualSchedule(v) => {
6749                std::option::Option::Some(v)
6750            }
6751            _ => std::option::Option::None,
6752        })
6753    }
6754
6755    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule]
6756    /// to hold a `ManualSchedule`.
6757    ///
6758    /// Note that all the setters affecting `schedule` are
6759    /// mutually exclusive.
6760    pub fn set_manual_schedule<
6761        T: std::convert::Into<std::boxed::Box<crate::model::ManualSchedule>>,
6762    >(
6763        mut self,
6764        v: T,
6765    ) -> Self {
6766        self.schedule = std::option::Option::Some(
6767            crate::model::schedule_options_v_2::Schedule::ManualSchedule(v.into()),
6768        );
6769        self
6770    }
6771
6772    /// The value of [schedule][crate::model::ScheduleOptionsV2::schedule]
6773    /// if it holds a `EventDrivenSchedule`, `None` if the field is not set or
6774    /// holds a different branch.
6775    pub fn event_driven_schedule(
6776        &self,
6777    ) -> std::option::Option<&std::boxed::Box<crate::model::EventDrivenSchedule>> {
6778        #[allow(unreachable_patterns)]
6779        self.schedule.as_ref().and_then(|v| match v {
6780            crate::model::schedule_options_v_2::Schedule::EventDrivenSchedule(v) => {
6781                std::option::Option::Some(v)
6782            }
6783            _ => std::option::Option::None,
6784        })
6785    }
6786
6787    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule]
6788    /// to hold a `EventDrivenSchedule`.
6789    ///
6790    /// Note that all the setters affecting `schedule` are
6791    /// mutually exclusive.
6792    pub fn set_event_driven_schedule<
6793        T: std::convert::Into<std::boxed::Box<crate::model::EventDrivenSchedule>>,
6794    >(
6795        mut self,
6796        v: T,
6797    ) -> Self {
6798        self.schedule = std::option::Option::Some(
6799            crate::model::schedule_options_v_2::Schedule::EventDrivenSchedule(v.into()),
6800        );
6801        self
6802    }
6803}
6804
6805impl wkt::message::Message for ScheduleOptionsV2 {
6806    fn typename() -> &'static str {
6807        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleOptionsV2"
6808    }
6809}
6810
6811#[doc(hidden)]
6812impl<'de> serde::de::Deserialize<'de> for ScheduleOptionsV2 {
6813    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6814    where
6815        D: serde::Deserializer<'de>,
6816    {
6817        #[allow(non_camel_case_types)]
6818        #[doc(hidden)]
6819        #[derive(PartialEq, Eq, Hash)]
6820        enum __FieldTag {
6821            __time_based_schedule,
6822            __manual_schedule,
6823            __event_driven_schedule,
6824            Unknown(std::string::String),
6825        }
6826        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6827            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6828            where
6829                D: serde::Deserializer<'de>,
6830            {
6831                struct Visitor;
6832                impl<'de> serde::de::Visitor<'de> for Visitor {
6833                    type Value = __FieldTag;
6834                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6835                        formatter.write_str("a field name for ScheduleOptionsV2")
6836                    }
6837                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6838                    where
6839                        E: serde::de::Error,
6840                    {
6841                        use std::result::Result::Ok;
6842                        use std::string::ToString;
6843                        match value {
6844                            "timeBasedSchedule" => Ok(__FieldTag::__time_based_schedule),
6845                            "time_based_schedule" => Ok(__FieldTag::__time_based_schedule),
6846                            "manualSchedule" => Ok(__FieldTag::__manual_schedule),
6847                            "manual_schedule" => Ok(__FieldTag::__manual_schedule),
6848                            "eventDrivenSchedule" => Ok(__FieldTag::__event_driven_schedule),
6849                            "event_driven_schedule" => Ok(__FieldTag::__event_driven_schedule),
6850                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6851                        }
6852                    }
6853                }
6854                deserializer.deserialize_identifier(Visitor)
6855            }
6856        }
6857        struct Visitor;
6858        impl<'de> serde::de::Visitor<'de> for Visitor {
6859            type Value = ScheduleOptionsV2;
6860            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6861                formatter.write_str("struct ScheduleOptionsV2")
6862            }
6863            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6864            where
6865                A: serde::de::MapAccess<'de>,
6866            {
6867                #[allow(unused_imports)]
6868                use serde::de::Error;
6869                use std::option::Option::Some;
6870                let mut fields = std::collections::HashSet::new();
6871                let mut result = Self::Value::new();
6872                while let Some(tag) = map.next_key::<__FieldTag>()? {
6873                    #[allow(clippy::match_single_binding)]
6874                    match tag {
6875                        __FieldTag::__time_based_schedule => {
6876                            if !fields.insert(__FieldTag::__time_based_schedule) {
6877                                return std::result::Result::Err(A::Error::duplicate_field(
6878                                    "multiple values for time_based_schedule",
6879                                ));
6880                            }
6881                            if result.schedule.is_some() {
6882                                return std::result::Result::Err(A::Error::duplicate_field(
6883                                    "multiple values for `schedule`, a oneof with full ID .google.cloud.bigquery.datatransfer.v1.ScheduleOptionsV2.time_based_schedule, latest field was timeBasedSchedule",
6884                                ));
6885                            }
6886                            result.schedule = std::option::Option::Some(
6887                                crate::model::schedule_options_v_2::Schedule::TimeBasedSchedule(
6888                                    map.next_value::<std::option::Option<
6889                                        std::boxed::Box<crate::model::TimeBasedSchedule>,
6890                                    >>()?
6891                                    .unwrap_or_default(),
6892                                ),
6893                            );
6894                        }
6895                        __FieldTag::__manual_schedule => {
6896                            if !fields.insert(__FieldTag::__manual_schedule) {
6897                                return std::result::Result::Err(A::Error::duplicate_field(
6898                                    "multiple values for manual_schedule",
6899                                ));
6900                            }
6901                            if result.schedule.is_some() {
6902                                return std::result::Result::Err(A::Error::duplicate_field(
6903                                    "multiple values for `schedule`, a oneof with full ID .google.cloud.bigquery.datatransfer.v1.ScheduleOptionsV2.manual_schedule, latest field was manualSchedule",
6904                                ));
6905                            }
6906                            result.schedule = std::option::Option::Some(
6907                                crate::model::schedule_options_v_2::Schedule::ManualSchedule(
6908                                    map.next_value::<std::option::Option<
6909                                        std::boxed::Box<crate::model::ManualSchedule>,
6910                                    >>()?
6911                                    .unwrap_or_default(),
6912                                ),
6913                            );
6914                        }
6915                        __FieldTag::__event_driven_schedule => {
6916                            if !fields.insert(__FieldTag::__event_driven_schedule) {
6917                                return std::result::Result::Err(A::Error::duplicate_field(
6918                                    "multiple values for event_driven_schedule",
6919                                ));
6920                            }
6921                            if result.schedule.is_some() {
6922                                return std::result::Result::Err(A::Error::duplicate_field(
6923                                    "multiple values for `schedule`, a oneof with full ID .google.cloud.bigquery.datatransfer.v1.ScheduleOptionsV2.event_driven_schedule, latest field was eventDrivenSchedule",
6924                                ));
6925                            }
6926                            result.schedule = std::option::Option::Some(
6927                                crate::model::schedule_options_v_2::Schedule::EventDrivenSchedule(
6928                                    map.next_value::<std::option::Option<
6929                                        std::boxed::Box<crate::model::EventDrivenSchedule>,
6930                                    >>()?
6931                                    .unwrap_or_default(),
6932                                ),
6933                            );
6934                        }
6935                        __FieldTag::Unknown(key) => {
6936                            let value = map.next_value::<serde_json::Value>()?;
6937                            result._unknown_fields.insert(key, value);
6938                        }
6939                    }
6940                }
6941                std::result::Result::Ok(result)
6942            }
6943        }
6944        deserializer.deserialize_any(Visitor)
6945    }
6946}
6947
6948#[doc(hidden)]
6949impl serde::ser::Serialize for ScheduleOptionsV2 {
6950    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6951    where
6952        S: serde::ser::Serializer,
6953    {
6954        use serde::ser::SerializeMap;
6955        #[allow(unused_imports)]
6956        use std::option::Option::Some;
6957        let mut state = serializer.serialize_map(std::option::Option::None)?;
6958        if let Some(value) = self.time_based_schedule() {
6959            state.serialize_entry("timeBasedSchedule", value)?;
6960        }
6961        if let Some(value) = self.manual_schedule() {
6962            state.serialize_entry("manualSchedule", value)?;
6963        }
6964        if let Some(value) = self.event_driven_schedule() {
6965            state.serialize_entry("eventDrivenSchedule", value)?;
6966        }
6967        if !self._unknown_fields.is_empty() {
6968            for (key, value) in self._unknown_fields.iter() {
6969                state.serialize_entry(key, &value)?;
6970            }
6971        }
6972        state.end()
6973    }
6974}
6975
6976/// Defines additional types related to [ScheduleOptionsV2].
6977pub mod schedule_options_v_2 {
6978    #[allow(unused_imports)]
6979    use super::*;
6980
6981    /// Data transfer schedules.
6982    #[derive(Clone, Debug, PartialEq)]
6983    #[non_exhaustive]
6984    pub enum Schedule {
6985        /// Time based transfer schedule options. This is the default schedule
6986        /// option.
6987        TimeBasedSchedule(std::boxed::Box<crate::model::TimeBasedSchedule>),
6988        /// Manual transfer schedule. If set, the transfer run will not be
6989        /// auto-scheduled by the system, unless the client invokes
6990        /// StartManualTransferRuns.  This is equivalent to
6991        /// disable_auto_scheduling = true.
6992        ManualSchedule(std::boxed::Box<crate::model::ManualSchedule>),
6993        /// Event driven transfer schedule options. If set, the transfer will be
6994        /// scheduled upon events arrial.
6995        EventDrivenSchedule(std::boxed::Box<crate::model::EventDrivenSchedule>),
6996    }
6997}
6998
6999/// Options customizing the time based transfer schedule.
7000/// Options are migrated from the original ScheduleOptions message.
7001#[derive(Clone, Debug, Default, PartialEq)]
7002#[non_exhaustive]
7003pub struct TimeBasedSchedule {
7004    /// Data transfer schedule.
7005    /// If the data source does not support a custom schedule, this should be
7006    /// empty. If it is empty, the default value for the data source will be used.
7007    /// The specified times are in UTC.
7008    /// Examples of valid format:
7009    /// `1st,3rd monday of month 15:30`,
7010    /// `every wed,fri of jan,jun 13:15`, and
7011    /// `first sunday of quarter 00:00`.
7012    /// See more explanation about the format here:
7013    /// <https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format>
7014    ///
7015    /// NOTE: The minimum interval time between recurring transfers depends on the
7016    /// data source; refer to the documentation for your data source.
7017    pub schedule: std::string::String,
7018
7019    /// Specifies time to start scheduling transfer runs. The first run will be
7020    /// scheduled at or after the start time according to a recurrence pattern
7021    /// defined in the schedule string. The start time can be changed at any
7022    /// moment.
7023    pub start_time: std::option::Option<wkt::Timestamp>,
7024
7025    /// Defines time to stop scheduling transfer runs. A transfer run cannot be
7026    /// scheduled at or after the end time. The end time can be changed at any
7027    /// moment.
7028    pub end_time: std::option::Option<wkt::Timestamp>,
7029
7030    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7031}
7032
7033impl TimeBasedSchedule {
7034    pub fn new() -> Self {
7035        std::default::Default::default()
7036    }
7037
7038    /// Sets the value of [schedule][crate::model::TimeBasedSchedule::schedule].
7039    pub fn set_schedule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7040        self.schedule = v.into();
7041        self
7042    }
7043
7044    /// Sets the value of [start_time][crate::model::TimeBasedSchedule::start_time].
7045    pub fn set_start_time<T>(mut self, v: T) -> Self
7046    where
7047        T: std::convert::Into<wkt::Timestamp>,
7048    {
7049        self.start_time = std::option::Option::Some(v.into());
7050        self
7051    }
7052
7053    /// Sets or clears the value of [start_time][crate::model::TimeBasedSchedule::start_time].
7054    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7055    where
7056        T: std::convert::Into<wkt::Timestamp>,
7057    {
7058        self.start_time = v.map(|x| x.into());
7059        self
7060    }
7061
7062    /// Sets the value of [end_time][crate::model::TimeBasedSchedule::end_time].
7063    pub fn set_end_time<T>(mut self, v: T) -> Self
7064    where
7065        T: std::convert::Into<wkt::Timestamp>,
7066    {
7067        self.end_time = std::option::Option::Some(v.into());
7068        self
7069    }
7070
7071    /// Sets or clears the value of [end_time][crate::model::TimeBasedSchedule::end_time].
7072    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
7073    where
7074        T: std::convert::Into<wkt::Timestamp>,
7075    {
7076        self.end_time = v.map(|x| x.into());
7077        self
7078    }
7079}
7080
7081impl wkt::message::Message for TimeBasedSchedule {
7082    fn typename() -> &'static str {
7083        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TimeBasedSchedule"
7084    }
7085}
7086
7087#[doc(hidden)]
7088impl<'de> serde::de::Deserialize<'de> for TimeBasedSchedule {
7089    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7090    where
7091        D: serde::Deserializer<'de>,
7092    {
7093        #[allow(non_camel_case_types)]
7094        #[doc(hidden)]
7095        #[derive(PartialEq, Eq, Hash)]
7096        enum __FieldTag {
7097            __schedule,
7098            __start_time,
7099            __end_time,
7100            Unknown(std::string::String),
7101        }
7102        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7103            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7104            where
7105                D: serde::Deserializer<'de>,
7106            {
7107                struct Visitor;
7108                impl<'de> serde::de::Visitor<'de> for Visitor {
7109                    type Value = __FieldTag;
7110                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7111                        formatter.write_str("a field name for TimeBasedSchedule")
7112                    }
7113                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7114                    where
7115                        E: serde::de::Error,
7116                    {
7117                        use std::result::Result::Ok;
7118                        use std::string::ToString;
7119                        match value {
7120                            "schedule" => Ok(__FieldTag::__schedule),
7121                            "startTime" => Ok(__FieldTag::__start_time),
7122                            "start_time" => Ok(__FieldTag::__start_time),
7123                            "endTime" => Ok(__FieldTag::__end_time),
7124                            "end_time" => Ok(__FieldTag::__end_time),
7125                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7126                        }
7127                    }
7128                }
7129                deserializer.deserialize_identifier(Visitor)
7130            }
7131        }
7132        struct Visitor;
7133        impl<'de> serde::de::Visitor<'de> for Visitor {
7134            type Value = TimeBasedSchedule;
7135            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7136                formatter.write_str("struct TimeBasedSchedule")
7137            }
7138            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7139            where
7140                A: serde::de::MapAccess<'de>,
7141            {
7142                #[allow(unused_imports)]
7143                use serde::de::Error;
7144                use std::option::Option::Some;
7145                let mut fields = std::collections::HashSet::new();
7146                let mut result = Self::Value::new();
7147                while let Some(tag) = map.next_key::<__FieldTag>()? {
7148                    #[allow(clippy::match_single_binding)]
7149                    match tag {
7150                        __FieldTag::__schedule => {
7151                            if !fields.insert(__FieldTag::__schedule) {
7152                                return std::result::Result::Err(A::Error::duplicate_field(
7153                                    "multiple values for schedule",
7154                                ));
7155                            }
7156                            result.schedule = map
7157                                .next_value::<std::option::Option<std::string::String>>()?
7158                                .unwrap_or_default();
7159                        }
7160                        __FieldTag::__start_time => {
7161                            if !fields.insert(__FieldTag::__start_time) {
7162                                return std::result::Result::Err(A::Error::duplicate_field(
7163                                    "multiple values for start_time",
7164                                ));
7165                            }
7166                            result.start_time =
7167                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7168                        }
7169                        __FieldTag::__end_time => {
7170                            if !fields.insert(__FieldTag::__end_time) {
7171                                return std::result::Result::Err(A::Error::duplicate_field(
7172                                    "multiple values for end_time",
7173                                ));
7174                            }
7175                            result.end_time =
7176                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7177                        }
7178                        __FieldTag::Unknown(key) => {
7179                            let value = map.next_value::<serde_json::Value>()?;
7180                            result._unknown_fields.insert(key, value);
7181                        }
7182                    }
7183                }
7184                std::result::Result::Ok(result)
7185            }
7186        }
7187        deserializer.deserialize_any(Visitor)
7188    }
7189}
7190
7191#[doc(hidden)]
7192impl serde::ser::Serialize for TimeBasedSchedule {
7193    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7194    where
7195        S: serde::ser::Serializer,
7196    {
7197        use serde::ser::SerializeMap;
7198        #[allow(unused_imports)]
7199        use std::option::Option::Some;
7200        let mut state = serializer.serialize_map(std::option::Option::None)?;
7201        if !self.schedule.is_empty() {
7202            state.serialize_entry("schedule", &self.schedule)?;
7203        }
7204        if self.start_time.is_some() {
7205            state.serialize_entry("startTime", &self.start_time)?;
7206        }
7207        if self.end_time.is_some() {
7208            state.serialize_entry("endTime", &self.end_time)?;
7209        }
7210        if !self._unknown_fields.is_empty() {
7211            for (key, value) in self._unknown_fields.iter() {
7212                state.serialize_entry(key, &value)?;
7213            }
7214        }
7215        state.end()
7216    }
7217}
7218
7219/// Options customizing manual transfers schedule.
7220#[derive(Clone, Debug, Default, PartialEq)]
7221#[non_exhaustive]
7222pub struct ManualSchedule {
7223    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7224}
7225
7226impl ManualSchedule {
7227    pub fn new() -> Self {
7228        std::default::Default::default()
7229    }
7230}
7231
7232impl wkt::message::Message for ManualSchedule {
7233    fn typename() -> &'static str {
7234        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ManualSchedule"
7235    }
7236}
7237
7238#[doc(hidden)]
7239impl<'de> serde::de::Deserialize<'de> for ManualSchedule {
7240    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7241    where
7242        D: serde::Deserializer<'de>,
7243    {
7244        #[allow(non_camel_case_types)]
7245        #[doc(hidden)]
7246        #[derive(PartialEq, Eq, Hash)]
7247        enum __FieldTag {
7248            Unknown(std::string::String),
7249        }
7250        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7251            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7252            where
7253                D: serde::Deserializer<'de>,
7254            {
7255                struct Visitor;
7256                impl<'de> serde::de::Visitor<'de> for Visitor {
7257                    type Value = __FieldTag;
7258                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7259                        formatter.write_str("a field name for ManualSchedule")
7260                    }
7261                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7262                    where
7263                        E: serde::de::Error,
7264                    {
7265                        use std::result::Result::Ok;
7266                        use std::string::ToString;
7267                        Ok(__FieldTag::Unknown(value.to_string()))
7268                    }
7269                }
7270                deserializer.deserialize_identifier(Visitor)
7271            }
7272        }
7273        struct Visitor;
7274        impl<'de> serde::de::Visitor<'de> for Visitor {
7275            type Value = ManualSchedule;
7276            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7277                formatter.write_str("struct ManualSchedule")
7278            }
7279            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7280            where
7281                A: serde::de::MapAccess<'de>,
7282            {
7283                #[allow(unused_imports)]
7284                use serde::de::Error;
7285                use std::option::Option::Some;
7286                let mut result = Self::Value::new();
7287                while let Some(tag) = map.next_key::<__FieldTag>()? {
7288                    #[allow(clippy::match_single_binding)]
7289                    match tag {
7290                        __FieldTag::Unknown(key) => {
7291                            let value = map.next_value::<serde_json::Value>()?;
7292                            result._unknown_fields.insert(key, value);
7293                        }
7294                    }
7295                }
7296                std::result::Result::Ok(result)
7297            }
7298        }
7299        deserializer.deserialize_any(Visitor)
7300    }
7301}
7302
7303#[doc(hidden)]
7304impl serde::ser::Serialize for ManualSchedule {
7305    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7306    where
7307        S: serde::ser::Serializer,
7308    {
7309        use serde::ser::SerializeMap;
7310        #[allow(unused_imports)]
7311        use std::option::Option::Some;
7312        let mut state = serializer.serialize_map(std::option::Option::None)?;
7313        if !self._unknown_fields.is_empty() {
7314            for (key, value) in self._unknown_fields.iter() {
7315                state.serialize_entry(key, &value)?;
7316            }
7317        }
7318        state.end()
7319    }
7320}
7321
7322/// Options customizing EventDriven transfers schedule.
7323#[derive(Clone, Debug, Default, PartialEq)]
7324#[non_exhaustive]
7325pub struct EventDrivenSchedule {
7326    /// Pub/Sub subscription name used to receive events.
7327    /// Only Google Cloud Storage data source support this option.
7328    /// Format: projects/{project}/subscriptions/{subscription}
7329    pub pubsub_subscription: std::string::String,
7330
7331    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7332}
7333
7334impl EventDrivenSchedule {
7335    pub fn new() -> Self {
7336        std::default::Default::default()
7337    }
7338
7339    /// Sets the value of [pubsub_subscription][crate::model::EventDrivenSchedule::pubsub_subscription].
7340    pub fn set_pubsub_subscription<T: std::convert::Into<std::string::String>>(
7341        mut self,
7342        v: T,
7343    ) -> Self {
7344        self.pubsub_subscription = v.into();
7345        self
7346    }
7347}
7348
7349impl wkt::message::Message for EventDrivenSchedule {
7350    fn typename() -> &'static str {
7351        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EventDrivenSchedule"
7352    }
7353}
7354
7355#[doc(hidden)]
7356impl<'de> serde::de::Deserialize<'de> for EventDrivenSchedule {
7357    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7358    where
7359        D: serde::Deserializer<'de>,
7360    {
7361        #[allow(non_camel_case_types)]
7362        #[doc(hidden)]
7363        #[derive(PartialEq, Eq, Hash)]
7364        enum __FieldTag {
7365            __pubsub_subscription,
7366            Unknown(std::string::String),
7367        }
7368        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7369            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7370            where
7371                D: serde::Deserializer<'de>,
7372            {
7373                struct Visitor;
7374                impl<'de> serde::de::Visitor<'de> for Visitor {
7375                    type Value = __FieldTag;
7376                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7377                        formatter.write_str("a field name for EventDrivenSchedule")
7378                    }
7379                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7380                    where
7381                        E: serde::de::Error,
7382                    {
7383                        use std::result::Result::Ok;
7384                        use std::string::ToString;
7385                        match value {
7386                            "pubsubSubscription" => Ok(__FieldTag::__pubsub_subscription),
7387                            "pubsub_subscription" => Ok(__FieldTag::__pubsub_subscription),
7388                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7389                        }
7390                    }
7391                }
7392                deserializer.deserialize_identifier(Visitor)
7393            }
7394        }
7395        struct Visitor;
7396        impl<'de> serde::de::Visitor<'de> for Visitor {
7397            type Value = EventDrivenSchedule;
7398            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7399                formatter.write_str("struct EventDrivenSchedule")
7400            }
7401            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7402            where
7403                A: serde::de::MapAccess<'de>,
7404            {
7405                #[allow(unused_imports)]
7406                use serde::de::Error;
7407                use std::option::Option::Some;
7408                let mut fields = std::collections::HashSet::new();
7409                let mut result = Self::Value::new();
7410                while let Some(tag) = map.next_key::<__FieldTag>()? {
7411                    #[allow(clippy::match_single_binding)]
7412                    match tag {
7413                        __FieldTag::__pubsub_subscription => {
7414                            if !fields.insert(__FieldTag::__pubsub_subscription) {
7415                                return std::result::Result::Err(A::Error::duplicate_field(
7416                                    "multiple values for pubsub_subscription",
7417                                ));
7418                            }
7419                            result.pubsub_subscription = map
7420                                .next_value::<std::option::Option<std::string::String>>()?
7421                                .unwrap_or_default();
7422                        }
7423                        __FieldTag::Unknown(key) => {
7424                            let value = map.next_value::<serde_json::Value>()?;
7425                            result._unknown_fields.insert(key, value);
7426                        }
7427                    }
7428                }
7429                std::result::Result::Ok(result)
7430            }
7431        }
7432        deserializer.deserialize_any(Visitor)
7433    }
7434}
7435
7436#[doc(hidden)]
7437impl serde::ser::Serialize for EventDrivenSchedule {
7438    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7439    where
7440        S: serde::ser::Serializer,
7441    {
7442        use serde::ser::SerializeMap;
7443        #[allow(unused_imports)]
7444        use std::option::Option::Some;
7445        let mut state = serializer.serialize_map(std::option::Option::None)?;
7446        if !self.pubsub_subscription.is_empty() {
7447            state.serialize_entry("pubsubSubscription", &self.pubsub_subscription)?;
7448        }
7449        if !self._unknown_fields.is_empty() {
7450            for (key, value) in self._unknown_fields.iter() {
7451                state.serialize_entry(key, &value)?;
7452            }
7453        }
7454        state.end()
7455    }
7456}
7457
7458/// Information about a user.
7459#[derive(Clone, Debug, Default, PartialEq)]
7460#[non_exhaustive]
7461pub struct UserInfo {
7462    /// E-mail address of the user.
7463    pub email: std::option::Option<std::string::String>,
7464
7465    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7466}
7467
7468impl UserInfo {
7469    pub fn new() -> Self {
7470        std::default::Default::default()
7471    }
7472
7473    /// Sets the value of [email][crate::model::UserInfo::email].
7474    pub fn set_email<T>(mut self, v: T) -> Self
7475    where
7476        T: std::convert::Into<std::string::String>,
7477    {
7478        self.email = std::option::Option::Some(v.into());
7479        self
7480    }
7481
7482    /// Sets or clears the value of [email][crate::model::UserInfo::email].
7483    pub fn set_or_clear_email<T>(mut self, v: std::option::Option<T>) -> Self
7484    where
7485        T: std::convert::Into<std::string::String>,
7486    {
7487        self.email = v.map(|x| x.into());
7488        self
7489    }
7490}
7491
7492impl wkt::message::Message for UserInfo {
7493    fn typename() -> &'static str {
7494        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.UserInfo"
7495    }
7496}
7497
7498#[doc(hidden)]
7499impl<'de> serde::de::Deserialize<'de> for UserInfo {
7500    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7501    where
7502        D: serde::Deserializer<'de>,
7503    {
7504        #[allow(non_camel_case_types)]
7505        #[doc(hidden)]
7506        #[derive(PartialEq, Eq, Hash)]
7507        enum __FieldTag {
7508            __email,
7509            Unknown(std::string::String),
7510        }
7511        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7512            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7513            where
7514                D: serde::Deserializer<'de>,
7515            {
7516                struct Visitor;
7517                impl<'de> serde::de::Visitor<'de> for Visitor {
7518                    type Value = __FieldTag;
7519                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7520                        formatter.write_str("a field name for UserInfo")
7521                    }
7522                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7523                    where
7524                        E: serde::de::Error,
7525                    {
7526                        use std::result::Result::Ok;
7527                        use std::string::ToString;
7528                        match value {
7529                            "email" => Ok(__FieldTag::__email),
7530                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7531                        }
7532                    }
7533                }
7534                deserializer.deserialize_identifier(Visitor)
7535            }
7536        }
7537        struct Visitor;
7538        impl<'de> serde::de::Visitor<'de> for Visitor {
7539            type Value = UserInfo;
7540            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7541                formatter.write_str("struct UserInfo")
7542            }
7543            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7544            where
7545                A: serde::de::MapAccess<'de>,
7546            {
7547                #[allow(unused_imports)]
7548                use serde::de::Error;
7549                use std::option::Option::Some;
7550                let mut fields = std::collections::HashSet::new();
7551                let mut result = Self::Value::new();
7552                while let Some(tag) = map.next_key::<__FieldTag>()? {
7553                    #[allow(clippy::match_single_binding)]
7554                    match tag {
7555                        __FieldTag::__email => {
7556                            if !fields.insert(__FieldTag::__email) {
7557                                return std::result::Result::Err(A::Error::duplicate_field(
7558                                    "multiple values for email",
7559                                ));
7560                            }
7561                            result.email =
7562                                map.next_value::<std::option::Option<std::string::String>>()?;
7563                        }
7564                        __FieldTag::Unknown(key) => {
7565                            let value = map.next_value::<serde_json::Value>()?;
7566                            result._unknown_fields.insert(key, value);
7567                        }
7568                    }
7569                }
7570                std::result::Result::Ok(result)
7571            }
7572        }
7573        deserializer.deserialize_any(Visitor)
7574    }
7575}
7576
7577#[doc(hidden)]
7578impl serde::ser::Serialize for UserInfo {
7579    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7580    where
7581        S: serde::ser::Serializer,
7582    {
7583        use serde::ser::SerializeMap;
7584        #[allow(unused_imports)]
7585        use std::option::Option::Some;
7586        let mut state = serializer.serialize_map(std::option::Option::None)?;
7587        if self.email.is_some() {
7588            state.serialize_entry("email", &self.email)?;
7589        }
7590        if !self._unknown_fields.is_empty() {
7591            for (key, value) in self._unknown_fields.iter() {
7592                state.serialize_entry(key, &value)?;
7593            }
7594        }
7595        state.end()
7596    }
7597}
7598
7599/// Represents a data transfer configuration. A transfer configuration
7600/// contains all metadata needed to perform a data transfer. For example,
7601/// `destination_dataset_id` specifies where data should be stored.
7602/// When a new transfer configuration is created, the specified
7603/// `destination_dataset_id` is created when needed and shared with the
7604/// appropriate data source service account.
7605#[derive(Clone, Debug, Default, PartialEq)]
7606#[non_exhaustive]
7607pub struct TransferConfig {
7608    /// Identifier. The resource name of the transfer config.
7609    /// Transfer config names have the form either
7610    /// `projects/{project_id}/locations/{region}/transferConfigs/{config_id}` or
7611    /// `projects/{project_id}/transferConfigs/{config_id}`,
7612    /// where `config_id` is usually a UUID, even though it is not
7613    /// guaranteed or required. The name is ignored when creating a transfer
7614    /// config.
7615    pub name: std::string::String,
7616
7617    /// User specified display name for the data transfer.
7618    pub display_name: std::string::String,
7619
7620    /// Data source ID. This cannot be changed once data transfer is created. The
7621    /// full list of available data source IDs can be returned through an API call:
7622    /// <https://cloud.google.com/bigquery-transfer/docs/reference/datatransfer/rest/v1/projects.locations.dataSources/list>
7623    pub data_source_id: std::string::String,
7624
7625    /// Parameters specific to each data source. For more information see the
7626    /// bq tab in the 'Setting up a data transfer' section for each data source.
7627    /// For example the parameters for Cloud Storage transfers are listed here:
7628    /// <https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq>
7629    pub params: std::option::Option<wkt::Struct>,
7630
7631    /// Data transfer schedule.
7632    /// If the data source does not support a custom schedule, this should be
7633    /// empty. If it is empty, the default value for the data source will be used.
7634    /// The specified times are in UTC.
7635    /// Examples of valid format:
7636    /// `1st,3rd monday of month 15:30`,
7637    /// `every wed,fri of jan,jun 13:15`, and
7638    /// `first sunday of quarter 00:00`.
7639    /// See more explanation about the format here:
7640    /// <https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format>
7641    ///
7642    /// NOTE: The minimum interval time between recurring transfers depends on the
7643    /// data source; refer to the documentation for your data source.
7644    pub schedule: std::string::String,
7645
7646    /// Options customizing the data transfer schedule.
7647    pub schedule_options: std::option::Option<crate::model::ScheduleOptions>,
7648
7649    /// Options customizing different types of data transfer schedule.
7650    /// This field replaces "schedule" and "schedule_options" fields.
7651    /// ScheduleOptionsV2 cannot be used together with ScheduleOptions/Schedule.
7652    pub schedule_options_v2: std::option::Option<crate::model::ScheduleOptionsV2>,
7653
7654    /// The number of days to look back to automatically refresh the data.
7655    /// For example, if `data_refresh_window_days = 10`, then every day
7656    /// BigQuery reingests data for [today-10, today-1], rather than ingesting data
7657    /// for just [today-1].
7658    /// Only valid if the data source supports the feature. Set the value to 0
7659    /// to use the default value.
7660    pub data_refresh_window_days: i32,
7661
7662    /// Is this config disabled. When set to true, no runs will be scheduled for
7663    /// this transfer config.
7664    pub disabled: bool,
7665
7666    /// Output only. Data transfer modification time. Ignored by server on input.
7667    pub update_time: std::option::Option<wkt::Timestamp>,
7668
7669    /// Output only. Next time when data transfer will run.
7670    pub next_run_time: std::option::Option<wkt::Timestamp>,
7671
7672    /// Output only. State of the most recently updated transfer run.
7673    pub state: crate::model::TransferState,
7674
7675    /// Deprecated. Unique ID of the user on whose behalf transfer is done.
7676    pub user_id: i64,
7677
7678    /// Output only. Region in which BigQuery dataset is located.
7679    pub dataset_region: std::string::String,
7680
7681    /// Pub/Sub topic where notifications will be sent after transfer runs
7682    /// associated with this transfer config finish.
7683    ///
7684    /// The format for specifying a pubsub topic is:
7685    /// `projects/{project_id}/topics/{topic_id}`
7686    pub notification_pubsub_topic: std::string::String,
7687
7688    /// Email notifications will be sent according to these preferences
7689    /// to the email address of the user who owns this transfer config.
7690    pub email_preferences: std::option::Option<crate::model::EmailPreferences>,
7691
7692    /// Output only. Information about the user whose credentials are used to
7693    /// transfer data. Populated only for `transferConfigs.get` requests. In case
7694    /// the user information is not available, this field will not be populated.
7695    pub owner_info: std::option::Option<crate::model::UserInfo>,
7696
7697    /// The encryption configuration part. Currently, it is only used for the
7698    /// optional KMS key name. The BigQuery service account of your project must be
7699    /// granted permissions to use the key. Read methods will return the key name
7700    /// applied in effect. Write methods will apply the key if it is present, or
7701    /// otherwise try to apply project default keys if it is absent.
7702    pub encryption_configuration: std::option::Option<crate::model::EncryptionConfiguration>,
7703
7704    /// Output only. Error code with detailed information about reason of the
7705    /// latest config failure.
7706    pub error: std::option::Option<rpc::model::Status>,
7707
7708    /// The desination of the transfer config.
7709    pub destination: std::option::Option<crate::model::transfer_config::Destination>,
7710
7711    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7712}
7713
7714impl TransferConfig {
7715    pub fn new() -> Self {
7716        std::default::Default::default()
7717    }
7718
7719    /// Sets the value of [name][crate::model::TransferConfig::name].
7720    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7721        self.name = v.into();
7722        self
7723    }
7724
7725    /// Sets the value of [display_name][crate::model::TransferConfig::display_name].
7726    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7727        self.display_name = v.into();
7728        self
7729    }
7730
7731    /// Sets the value of [data_source_id][crate::model::TransferConfig::data_source_id].
7732    pub fn set_data_source_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7733        self.data_source_id = v.into();
7734        self
7735    }
7736
7737    /// Sets the value of [params][crate::model::TransferConfig::params].
7738    pub fn set_params<T>(mut self, v: T) -> Self
7739    where
7740        T: std::convert::Into<wkt::Struct>,
7741    {
7742        self.params = std::option::Option::Some(v.into());
7743        self
7744    }
7745
7746    /// Sets or clears the value of [params][crate::model::TransferConfig::params].
7747    pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
7748    where
7749        T: std::convert::Into<wkt::Struct>,
7750    {
7751        self.params = v.map(|x| x.into());
7752        self
7753    }
7754
7755    /// Sets the value of [schedule][crate::model::TransferConfig::schedule].
7756    pub fn set_schedule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7757        self.schedule = v.into();
7758        self
7759    }
7760
7761    /// Sets the value of [schedule_options][crate::model::TransferConfig::schedule_options].
7762    pub fn set_schedule_options<T>(mut self, v: T) -> Self
7763    where
7764        T: std::convert::Into<crate::model::ScheduleOptions>,
7765    {
7766        self.schedule_options = std::option::Option::Some(v.into());
7767        self
7768    }
7769
7770    /// Sets or clears the value of [schedule_options][crate::model::TransferConfig::schedule_options].
7771    pub fn set_or_clear_schedule_options<T>(mut self, v: std::option::Option<T>) -> Self
7772    where
7773        T: std::convert::Into<crate::model::ScheduleOptions>,
7774    {
7775        self.schedule_options = v.map(|x| x.into());
7776        self
7777    }
7778
7779    /// Sets the value of [schedule_options_v2][crate::model::TransferConfig::schedule_options_v2].
7780    pub fn set_schedule_options_v2<T>(mut self, v: T) -> Self
7781    where
7782        T: std::convert::Into<crate::model::ScheduleOptionsV2>,
7783    {
7784        self.schedule_options_v2 = std::option::Option::Some(v.into());
7785        self
7786    }
7787
7788    /// Sets or clears the value of [schedule_options_v2][crate::model::TransferConfig::schedule_options_v2].
7789    pub fn set_or_clear_schedule_options_v2<T>(mut self, v: std::option::Option<T>) -> Self
7790    where
7791        T: std::convert::Into<crate::model::ScheduleOptionsV2>,
7792    {
7793        self.schedule_options_v2 = v.map(|x| x.into());
7794        self
7795    }
7796
7797    /// Sets the value of [data_refresh_window_days][crate::model::TransferConfig::data_refresh_window_days].
7798    pub fn set_data_refresh_window_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7799        self.data_refresh_window_days = v.into();
7800        self
7801    }
7802
7803    /// Sets the value of [disabled][crate::model::TransferConfig::disabled].
7804    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7805        self.disabled = v.into();
7806        self
7807    }
7808
7809    /// Sets the value of [update_time][crate::model::TransferConfig::update_time].
7810    pub fn set_update_time<T>(mut self, v: T) -> Self
7811    where
7812        T: std::convert::Into<wkt::Timestamp>,
7813    {
7814        self.update_time = std::option::Option::Some(v.into());
7815        self
7816    }
7817
7818    /// Sets or clears the value of [update_time][crate::model::TransferConfig::update_time].
7819    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7820    where
7821        T: std::convert::Into<wkt::Timestamp>,
7822    {
7823        self.update_time = v.map(|x| x.into());
7824        self
7825    }
7826
7827    /// Sets the value of [next_run_time][crate::model::TransferConfig::next_run_time].
7828    pub fn set_next_run_time<T>(mut self, v: T) -> Self
7829    where
7830        T: std::convert::Into<wkt::Timestamp>,
7831    {
7832        self.next_run_time = std::option::Option::Some(v.into());
7833        self
7834    }
7835
7836    /// Sets or clears the value of [next_run_time][crate::model::TransferConfig::next_run_time].
7837    pub fn set_or_clear_next_run_time<T>(mut self, v: std::option::Option<T>) -> Self
7838    where
7839        T: std::convert::Into<wkt::Timestamp>,
7840    {
7841        self.next_run_time = v.map(|x| x.into());
7842        self
7843    }
7844
7845    /// Sets the value of [state][crate::model::TransferConfig::state].
7846    pub fn set_state<T: std::convert::Into<crate::model::TransferState>>(mut self, v: T) -> Self {
7847        self.state = v.into();
7848        self
7849    }
7850
7851    /// Sets the value of [user_id][crate::model::TransferConfig::user_id].
7852    pub fn set_user_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7853        self.user_id = v.into();
7854        self
7855    }
7856
7857    /// Sets the value of [dataset_region][crate::model::TransferConfig::dataset_region].
7858    pub fn set_dataset_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7859        self.dataset_region = v.into();
7860        self
7861    }
7862
7863    /// Sets the value of [notification_pubsub_topic][crate::model::TransferConfig::notification_pubsub_topic].
7864    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
7865        mut self,
7866        v: T,
7867    ) -> Self {
7868        self.notification_pubsub_topic = v.into();
7869        self
7870    }
7871
7872    /// Sets the value of [email_preferences][crate::model::TransferConfig::email_preferences].
7873    pub fn set_email_preferences<T>(mut self, v: T) -> Self
7874    where
7875        T: std::convert::Into<crate::model::EmailPreferences>,
7876    {
7877        self.email_preferences = std::option::Option::Some(v.into());
7878        self
7879    }
7880
7881    /// Sets or clears the value of [email_preferences][crate::model::TransferConfig::email_preferences].
7882    pub fn set_or_clear_email_preferences<T>(mut self, v: std::option::Option<T>) -> Self
7883    where
7884        T: std::convert::Into<crate::model::EmailPreferences>,
7885    {
7886        self.email_preferences = v.map(|x| x.into());
7887        self
7888    }
7889
7890    /// Sets the value of [owner_info][crate::model::TransferConfig::owner_info].
7891    pub fn set_owner_info<T>(mut self, v: T) -> Self
7892    where
7893        T: std::convert::Into<crate::model::UserInfo>,
7894    {
7895        self.owner_info = std::option::Option::Some(v.into());
7896        self
7897    }
7898
7899    /// Sets or clears the value of [owner_info][crate::model::TransferConfig::owner_info].
7900    pub fn set_or_clear_owner_info<T>(mut self, v: std::option::Option<T>) -> Self
7901    where
7902        T: std::convert::Into<crate::model::UserInfo>,
7903    {
7904        self.owner_info = v.map(|x| x.into());
7905        self
7906    }
7907
7908    /// Sets the value of [encryption_configuration][crate::model::TransferConfig::encryption_configuration].
7909    pub fn set_encryption_configuration<T>(mut self, v: T) -> Self
7910    where
7911        T: std::convert::Into<crate::model::EncryptionConfiguration>,
7912    {
7913        self.encryption_configuration = std::option::Option::Some(v.into());
7914        self
7915    }
7916
7917    /// Sets or clears the value of [encryption_configuration][crate::model::TransferConfig::encryption_configuration].
7918    pub fn set_or_clear_encryption_configuration<T>(mut self, v: std::option::Option<T>) -> Self
7919    where
7920        T: std::convert::Into<crate::model::EncryptionConfiguration>,
7921    {
7922        self.encryption_configuration = v.map(|x| x.into());
7923        self
7924    }
7925
7926    /// Sets the value of [error][crate::model::TransferConfig::error].
7927    pub fn set_error<T>(mut self, v: T) -> Self
7928    where
7929        T: std::convert::Into<rpc::model::Status>,
7930    {
7931        self.error = std::option::Option::Some(v.into());
7932        self
7933    }
7934
7935    /// Sets or clears the value of [error][crate::model::TransferConfig::error].
7936    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
7937    where
7938        T: std::convert::Into<rpc::model::Status>,
7939    {
7940        self.error = v.map(|x| x.into());
7941        self
7942    }
7943
7944    /// Sets the value of [destination][crate::model::TransferConfig::destination].
7945    ///
7946    /// Note that all the setters affecting `destination` are mutually
7947    /// exclusive.
7948    pub fn set_destination<
7949        T: std::convert::Into<std::option::Option<crate::model::transfer_config::Destination>>,
7950    >(
7951        mut self,
7952        v: T,
7953    ) -> Self {
7954        self.destination = v.into();
7955        self
7956    }
7957
7958    /// The value of [destination][crate::model::TransferConfig::destination]
7959    /// if it holds a `DestinationDatasetId`, `None` if the field is not set or
7960    /// holds a different branch.
7961    pub fn destination_dataset_id(&self) -> std::option::Option<&std::string::String> {
7962        #[allow(unreachable_patterns)]
7963        self.destination.as_ref().and_then(|v| match v {
7964            crate::model::transfer_config::Destination::DestinationDatasetId(v) => {
7965                std::option::Option::Some(v)
7966            }
7967            _ => std::option::Option::None,
7968        })
7969    }
7970
7971    /// Sets the value of [destination][crate::model::TransferConfig::destination]
7972    /// to hold a `DestinationDatasetId`.
7973    ///
7974    /// Note that all the setters affecting `destination` are
7975    /// mutually exclusive.
7976    pub fn set_destination_dataset_id<T: std::convert::Into<std::string::String>>(
7977        mut self,
7978        v: T,
7979    ) -> Self {
7980        self.destination = std::option::Option::Some(
7981            crate::model::transfer_config::Destination::DestinationDatasetId(v.into()),
7982        );
7983        self
7984    }
7985}
7986
7987impl wkt::message::Message for TransferConfig {
7988    fn typename() -> &'static str {
7989        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TransferConfig"
7990    }
7991}
7992
7993#[doc(hidden)]
7994impl<'de> serde::de::Deserialize<'de> for TransferConfig {
7995    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7996    where
7997        D: serde::Deserializer<'de>,
7998    {
7999        #[allow(non_camel_case_types)]
8000        #[doc(hidden)]
8001        #[derive(PartialEq, Eq, Hash)]
8002        enum __FieldTag {
8003            __name,
8004            __destination_dataset_id,
8005            __display_name,
8006            __data_source_id,
8007            __params,
8008            __schedule,
8009            __schedule_options,
8010            __schedule_options_v2,
8011            __data_refresh_window_days,
8012            __disabled,
8013            __update_time,
8014            __next_run_time,
8015            __state,
8016            __user_id,
8017            __dataset_region,
8018            __notification_pubsub_topic,
8019            __email_preferences,
8020            __owner_info,
8021            __encryption_configuration,
8022            __error,
8023            Unknown(std::string::String),
8024        }
8025        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8026            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8027            where
8028                D: serde::Deserializer<'de>,
8029            {
8030                struct Visitor;
8031                impl<'de> serde::de::Visitor<'de> for Visitor {
8032                    type Value = __FieldTag;
8033                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8034                        formatter.write_str("a field name for TransferConfig")
8035                    }
8036                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8037                    where
8038                        E: serde::de::Error,
8039                    {
8040                        use std::result::Result::Ok;
8041                        use std::string::ToString;
8042                        match value {
8043                            "name" => Ok(__FieldTag::__name),
8044                            "destinationDatasetId" => Ok(__FieldTag::__destination_dataset_id),
8045                            "destination_dataset_id" => Ok(__FieldTag::__destination_dataset_id),
8046                            "displayName" => Ok(__FieldTag::__display_name),
8047                            "display_name" => Ok(__FieldTag::__display_name),
8048                            "dataSourceId" => Ok(__FieldTag::__data_source_id),
8049                            "data_source_id" => Ok(__FieldTag::__data_source_id),
8050                            "params" => Ok(__FieldTag::__params),
8051                            "schedule" => Ok(__FieldTag::__schedule),
8052                            "scheduleOptions" => Ok(__FieldTag::__schedule_options),
8053                            "schedule_options" => Ok(__FieldTag::__schedule_options),
8054                            "scheduleOptionsV2" => Ok(__FieldTag::__schedule_options_v2),
8055                            "schedule_options_v2" => Ok(__FieldTag::__schedule_options_v2),
8056                            "dataRefreshWindowDays" => Ok(__FieldTag::__data_refresh_window_days),
8057                            "data_refresh_window_days" => {
8058                                Ok(__FieldTag::__data_refresh_window_days)
8059                            }
8060                            "disabled" => Ok(__FieldTag::__disabled),
8061                            "updateTime" => Ok(__FieldTag::__update_time),
8062                            "update_time" => Ok(__FieldTag::__update_time),
8063                            "nextRunTime" => Ok(__FieldTag::__next_run_time),
8064                            "next_run_time" => Ok(__FieldTag::__next_run_time),
8065                            "state" => Ok(__FieldTag::__state),
8066                            "userId" => Ok(__FieldTag::__user_id),
8067                            "user_id" => Ok(__FieldTag::__user_id),
8068                            "datasetRegion" => Ok(__FieldTag::__dataset_region),
8069                            "dataset_region" => Ok(__FieldTag::__dataset_region),
8070                            "notificationPubsubTopic" => {
8071                                Ok(__FieldTag::__notification_pubsub_topic)
8072                            }
8073                            "notification_pubsub_topic" => {
8074                                Ok(__FieldTag::__notification_pubsub_topic)
8075                            }
8076                            "emailPreferences" => Ok(__FieldTag::__email_preferences),
8077                            "email_preferences" => Ok(__FieldTag::__email_preferences),
8078                            "ownerInfo" => Ok(__FieldTag::__owner_info),
8079                            "owner_info" => Ok(__FieldTag::__owner_info),
8080                            "encryptionConfiguration" => Ok(__FieldTag::__encryption_configuration),
8081                            "encryption_configuration" => {
8082                                Ok(__FieldTag::__encryption_configuration)
8083                            }
8084                            "error" => Ok(__FieldTag::__error),
8085                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8086                        }
8087                    }
8088                }
8089                deserializer.deserialize_identifier(Visitor)
8090            }
8091        }
8092        struct Visitor;
8093        impl<'de> serde::de::Visitor<'de> for Visitor {
8094            type Value = TransferConfig;
8095            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8096                formatter.write_str("struct TransferConfig")
8097            }
8098            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8099            where
8100                A: serde::de::MapAccess<'de>,
8101            {
8102                #[allow(unused_imports)]
8103                use serde::de::Error;
8104                use std::option::Option::Some;
8105                let mut fields = std::collections::HashSet::new();
8106                let mut result = Self::Value::new();
8107                while let Some(tag) = map.next_key::<__FieldTag>()? {
8108                    #[allow(clippy::match_single_binding)]
8109                    match tag {
8110                        __FieldTag::__name => {
8111                            if !fields.insert(__FieldTag::__name) {
8112                                return std::result::Result::Err(A::Error::duplicate_field(
8113                                    "multiple values for name",
8114                                ));
8115                            }
8116                            result.name = map
8117                                .next_value::<std::option::Option<std::string::String>>()?
8118                                .unwrap_or_default();
8119                        }
8120                        __FieldTag::__destination_dataset_id => {
8121                            if !fields.insert(__FieldTag::__destination_dataset_id) {
8122                                return std::result::Result::Err(A::Error::duplicate_field(
8123                                    "multiple values for destination_dataset_id",
8124                                ));
8125                            }
8126                            if result.destination.is_some() {
8127                                return std::result::Result::Err(A::Error::duplicate_field(
8128                                    "multiple values for `destination`, a oneof with full ID .google.cloud.bigquery.datatransfer.v1.TransferConfig.destination_dataset_id, latest field was destinationDatasetId",
8129                                ));
8130                            }
8131                            result.destination = std::option::Option::Some(
8132                                crate::model::transfer_config::Destination::DestinationDatasetId(
8133                                    map.next_value::<std::option::Option<std::string::String>>()?
8134                                        .unwrap_or_default(),
8135                                ),
8136                            );
8137                        }
8138                        __FieldTag::__display_name => {
8139                            if !fields.insert(__FieldTag::__display_name) {
8140                                return std::result::Result::Err(A::Error::duplicate_field(
8141                                    "multiple values for display_name",
8142                                ));
8143                            }
8144                            result.display_name = map
8145                                .next_value::<std::option::Option<std::string::String>>()?
8146                                .unwrap_or_default();
8147                        }
8148                        __FieldTag::__data_source_id => {
8149                            if !fields.insert(__FieldTag::__data_source_id) {
8150                                return std::result::Result::Err(A::Error::duplicate_field(
8151                                    "multiple values for data_source_id",
8152                                ));
8153                            }
8154                            result.data_source_id = map
8155                                .next_value::<std::option::Option<std::string::String>>()?
8156                                .unwrap_or_default();
8157                        }
8158                        __FieldTag::__params => {
8159                            if !fields.insert(__FieldTag::__params) {
8160                                return std::result::Result::Err(A::Error::duplicate_field(
8161                                    "multiple values for params",
8162                                ));
8163                            }
8164                            result.params = map.next_value::<std::option::Option<wkt::Struct>>()?;
8165                        }
8166                        __FieldTag::__schedule => {
8167                            if !fields.insert(__FieldTag::__schedule) {
8168                                return std::result::Result::Err(A::Error::duplicate_field(
8169                                    "multiple values for schedule",
8170                                ));
8171                            }
8172                            result.schedule = map
8173                                .next_value::<std::option::Option<std::string::String>>()?
8174                                .unwrap_or_default();
8175                        }
8176                        __FieldTag::__schedule_options => {
8177                            if !fields.insert(__FieldTag::__schedule_options) {
8178                                return std::result::Result::Err(A::Error::duplicate_field(
8179                                    "multiple values for schedule_options",
8180                                ));
8181                            }
8182                            result.schedule_options = map
8183                                .next_value::<std::option::Option<crate::model::ScheduleOptions>>(
8184                                )?;
8185                        }
8186                        __FieldTag::__schedule_options_v2 => {
8187                            if !fields.insert(__FieldTag::__schedule_options_v2) {
8188                                return std::result::Result::Err(A::Error::duplicate_field(
8189                                    "multiple values for schedule_options_v2",
8190                                ));
8191                            }
8192                            result.schedule_options_v2 = map
8193                                .next_value::<std::option::Option<crate::model::ScheduleOptionsV2>>(
8194                                )?;
8195                        }
8196                        __FieldTag::__data_refresh_window_days => {
8197                            if !fields.insert(__FieldTag::__data_refresh_window_days) {
8198                                return std::result::Result::Err(A::Error::duplicate_field(
8199                                    "multiple values for data_refresh_window_days",
8200                                ));
8201                            }
8202                            struct __With(std::option::Option<i32>);
8203                            impl<'de> serde::de::Deserialize<'de> for __With {
8204                                fn deserialize<D>(
8205                                    deserializer: D,
8206                                ) -> std::result::Result<Self, D::Error>
8207                                where
8208                                    D: serde::de::Deserializer<'de>,
8209                                {
8210                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
8211                                }
8212                            }
8213                            result.data_refresh_window_days =
8214                                map.next_value::<__With>()?.0.unwrap_or_default();
8215                        }
8216                        __FieldTag::__disabled => {
8217                            if !fields.insert(__FieldTag::__disabled) {
8218                                return std::result::Result::Err(A::Error::duplicate_field(
8219                                    "multiple values for disabled",
8220                                ));
8221                            }
8222                            result.disabled = map
8223                                .next_value::<std::option::Option<bool>>()?
8224                                .unwrap_or_default();
8225                        }
8226                        __FieldTag::__update_time => {
8227                            if !fields.insert(__FieldTag::__update_time) {
8228                                return std::result::Result::Err(A::Error::duplicate_field(
8229                                    "multiple values for update_time",
8230                                ));
8231                            }
8232                            result.update_time =
8233                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8234                        }
8235                        __FieldTag::__next_run_time => {
8236                            if !fields.insert(__FieldTag::__next_run_time) {
8237                                return std::result::Result::Err(A::Error::duplicate_field(
8238                                    "multiple values for next_run_time",
8239                                ));
8240                            }
8241                            result.next_run_time =
8242                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8243                        }
8244                        __FieldTag::__state => {
8245                            if !fields.insert(__FieldTag::__state) {
8246                                return std::result::Result::Err(A::Error::duplicate_field(
8247                                    "multiple values for state",
8248                                ));
8249                            }
8250                            result.state = map
8251                                .next_value::<std::option::Option<crate::model::TransferState>>()?
8252                                .unwrap_or_default();
8253                        }
8254                        __FieldTag::__user_id => {
8255                            if !fields.insert(__FieldTag::__user_id) {
8256                                return std::result::Result::Err(A::Error::duplicate_field(
8257                                    "multiple values for user_id",
8258                                ));
8259                            }
8260                            struct __With(std::option::Option<i64>);
8261                            impl<'de> serde::de::Deserialize<'de> for __With {
8262                                fn deserialize<D>(
8263                                    deserializer: D,
8264                                ) -> std::result::Result<Self, D::Error>
8265                                where
8266                                    D: serde::de::Deserializer<'de>,
8267                                {
8268                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8269                                }
8270                            }
8271                            result.user_id = map.next_value::<__With>()?.0.unwrap_or_default();
8272                        }
8273                        __FieldTag::__dataset_region => {
8274                            if !fields.insert(__FieldTag::__dataset_region) {
8275                                return std::result::Result::Err(A::Error::duplicate_field(
8276                                    "multiple values for dataset_region",
8277                                ));
8278                            }
8279                            result.dataset_region = map
8280                                .next_value::<std::option::Option<std::string::String>>()?
8281                                .unwrap_or_default();
8282                        }
8283                        __FieldTag::__notification_pubsub_topic => {
8284                            if !fields.insert(__FieldTag::__notification_pubsub_topic) {
8285                                return std::result::Result::Err(A::Error::duplicate_field(
8286                                    "multiple values for notification_pubsub_topic",
8287                                ));
8288                            }
8289                            result.notification_pubsub_topic = map
8290                                .next_value::<std::option::Option<std::string::String>>()?
8291                                .unwrap_or_default();
8292                        }
8293                        __FieldTag::__email_preferences => {
8294                            if !fields.insert(__FieldTag::__email_preferences) {
8295                                return std::result::Result::Err(A::Error::duplicate_field(
8296                                    "multiple values for email_preferences",
8297                                ));
8298                            }
8299                            result.email_preferences = map
8300                                .next_value::<std::option::Option<crate::model::EmailPreferences>>(
8301                                )?;
8302                        }
8303                        __FieldTag::__owner_info => {
8304                            if !fields.insert(__FieldTag::__owner_info) {
8305                                return std::result::Result::Err(A::Error::duplicate_field(
8306                                    "multiple values for owner_info",
8307                                ));
8308                            }
8309                            result.owner_info =
8310                                map.next_value::<std::option::Option<crate::model::UserInfo>>()?;
8311                        }
8312                        __FieldTag::__encryption_configuration => {
8313                            if !fields.insert(__FieldTag::__encryption_configuration) {
8314                                return std::result::Result::Err(A::Error::duplicate_field(
8315                                    "multiple values for encryption_configuration",
8316                                ));
8317                            }
8318                            result.encryption_configuration = map.next_value::<std::option::Option<crate::model::EncryptionConfiguration>>()?
8319                                ;
8320                        }
8321                        __FieldTag::__error => {
8322                            if !fields.insert(__FieldTag::__error) {
8323                                return std::result::Result::Err(A::Error::duplicate_field(
8324                                    "multiple values for error",
8325                                ));
8326                            }
8327                            result.error =
8328                                map.next_value::<std::option::Option<rpc::model::Status>>()?;
8329                        }
8330                        __FieldTag::Unknown(key) => {
8331                            let value = map.next_value::<serde_json::Value>()?;
8332                            result._unknown_fields.insert(key, value);
8333                        }
8334                    }
8335                }
8336                std::result::Result::Ok(result)
8337            }
8338        }
8339        deserializer.deserialize_any(Visitor)
8340    }
8341}
8342
8343#[doc(hidden)]
8344impl serde::ser::Serialize for TransferConfig {
8345    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8346    where
8347        S: serde::ser::Serializer,
8348    {
8349        use serde::ser::SerializeMap;
8350        #[allow(unused_imports)]
8351        use std::option::Option::Some;
8352        let mut state = serializer.serialize_map(std::option::Option::None)?;
8353        if !self.name.is_empty() {
8354            state.serialize_entry("name", &self.name)?;
8355        }
8356        if let Some(value) = self.destination_dataset_id() {
8357            state.serialize_entry("destinationDatasetId", value)?;
8358        }
8359        if !self.display_name.is_empty() {
8360            state.serialize_entry("displayName", &self.display_name)?;
8361        }
8362        if !self.data_source_id.is_empty() {
8363            state.serialize_entry("dataSourceId", &self.data_source_id)?;
8364        }
8365        if self.params.is_some() {
8366            state.serialize_entry("params", &self.params)?;
8367        }
8368        if !self.schedule.is_empty() {
8369            state.serialize_entry("schedule", &self.schedule)?;
8370        }
8371        if self.schedule_options.is_some() {
8372            state.serialize_entry("scheduleOptions", &self.schedule_options)?;
8373        }
8374        if self.schedule_options_v2.is_some() {
8375            state.serialize_entry("scheduleOptionsV2", &self.schedule_options_v2)?;
8376        }
8377        if !wkt::internal::is_default(&self.data_refresh_window_days) {
8378            struct __With<'a>(&'a i32);
8379            impl<'a> serde::ser::Serialize for __With<'a> {
8380                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8381                where
8382                    S: serde::ser::Serializer,
8383                {
8384                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
8385                }
8386            }
8387            state.serialize_entry(
8388                "dataRefreshWindowDays",
8389                &__With(&self.data_refresh_window_days),
8390            )?;
8391        }
8392        if !wkt::internal::is_default(&self.disabled) {
8393            state.serialize_entry("disabled", &self.disabled)?;
8394        }
8395        if self.update_time.is_some() {
8396            state.serialize_entry("updateTime", &self.update_time)?;
8397        }
8398        if self.next_run_time.is_some() {
8399            state.serialize_entry("nextRunTime", &self.next_run_time)?;
8400        }
8401        if !wkt::internal::is_default(&self.state) {
8402            state.serialize_entry("state", &self.state)?;
8403        }
8404        if !wkt::internal::is_default(&self.user_id) {
8405            struct __With<'a>(&'a i64);
8406            impl<'a> serde::ser::Serialize for __With<'a> {
8407                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8408                where
8409                    S: serde::ser::Serializer,
8410                {
8411                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
8412                }
8413            }
8414            state.serialize_entry("userId", &__With(&self.user_id))?;
8415        }
8416        if !self.dataset_region.is_empty() {
8417            state.serialize_entry("datasetRegion", &self.dataset_region)?;
8418        }
8419        if !self.notification_pubsub_topic.is_empty() {
8420            state.serialize_entry("notificationPubsubTopic", &self.notification_pubsub_topic)?;
8421        }
8422        if self.email_preferences.is_some() {
8423            state.serialize_entry("emailPreferences", &self.email_preferences)?;
8424        }
8425        if self.owner_info.is_some() {
8426            state.serialize_entry("ownerInfo", &self.owner_info)?;
8427        }
8428        if self.encryption_configuration.is_some() {
8429            state.serialize_entry("encryptionConfiguration", &self.encryption_configuration)?;
8430        }
8431        if self.error.is_some() {
8432            state.serialize_entry("error", &self.error)?;
8433        }
8434        if !self._unknown_fields.is_empty() {
8435            for (key, value) in self._unknown_fields.iter() {
8436                state.serialize_entry(key, &value)?;
8437            }
8438        }
8439        state.end()
8440    }
8441}
8442
8443/// Defines additional types related to [TransferConfig].
8444pub mod transfer_config {
8445    #[allow(unused_imports)]
8446    use super::*;
8447
8448    /// The desination of the transfer config.
8449    #[derive(Clone, Debug, PartialEq)]
8450    #[non_exhaustive]
8451    pub enum Destination {
8452        /// The BigQuery target dataset id.
8453        DestinationDatasetId(std::string::String),
8454    }
8455}
8456
8457/// Represents the encryption configuration for a transfer.
8458#[derive(Clone, Debug, Default, PartialEq)]
8459#[non_exhaustive]
8460pub struct EncryptionConfiguration {
8461    /// The name of the KMS key used for encrypting BigQuery data.
8462    pub kms_key_name: std::option::Option<wkt::StringValue>,
8463
8464    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8465}
8466
8467impl EncryptionConfiguration {
8468    pub fn new() -> Self {
8469        std::default::Default::default()
8470    }
8471
8472    /// Sets the value of [kms_key_name][crate::model::EncryptionConfiguration::kms_key_name].
8473    pub fn set_kms_key_name<T>(mut self, v: T) -> Self
8474    where
8475        T: std::convert::Into<wkt::StringValue>,
8476    {
8477        self.kms_key_name = std::option::Option::Some(v.into());
8478        self
8479    }
8480
8481    /// Sets or clears the value of [kms_key_name][crate::model::EncryptionConfiguration::kms_key_name].
8482    pub fn set_or_clear_kms_key_name<T>(mut self, v: std::option::Option<T>) -> Self
8483    where
8484        T: std::convert::Into<wkt::StringValue>,
8485    {
8486        self.kms_key_name = v.map(|x| x.into());
8487        self
8488    }
8489}
8490
8491impl wkt::message::Message for EncryptionConfiguration {
8492    fn typename() -> &'static str {
8493        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EncryptionConfiguration"
8494    }
8495}
8496
8497#[doc(hidden)]
8498impl<'de> serde::de::Deserialize<'de> for EncryptionConfiguration {
8499    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8500    where
8501        D: serde::Deserializer<'de>,
8502    {
8503        #[allow(non_camel_case_types)]
8504        #[doc(hidden)]
8505        #[derive(PartialEq, Eq, Hash)]
8506        enum __FieldTag {
8507            __kms_key_name,
8508            Unknown(std::string::String),
8509        }
8510        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8511            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8512            where
8513                D: serde::Deserializer<'de>,
8514            {
8515                struct Visitor;
8516                impl<'de> serde::de::Visitor<'de> for Visitor {
8517                    type Value = __FieldTag;
8518                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8519                        formatter.write_str("a field name for EncryptionConfiguration")
8520                    }
8521                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8522                    where
8523                        E: serde::de::Error,
8524                    {
8525                        use std::result::Result::Ok;
8526                        use std::string::ToString;
8527                        match value {
8528                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
8529                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
8530                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8531                        }
8532                    }
8533                }
8534                deserializer.deserialize_identifier(Visitor)
8535            }
8536        }
8537        struct Visitor;
8538        impl<'de> serde::de::Visitor<'de> for Visitor {
8539            type Value = EncryptionConfiguration;
8540            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8541                formatter.write_str("struct EncryptionConfiguration")
8542            }
8543            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8544            where
8545                A: serde::de::MapAccess<'de>,
8546            {
8547                #[allow(unused_imports)]
8548                use serde::de::Error;
8549                use std::option::Option::Some;
8550                let mut fields = std::collections::HashSet::new();
8551                let mut result = Self::Value::new();
8552                while let Some(tag) = map.next_key::<__FieldTag>()? {
8553                    #[allow(clippy::match_single_binding)]
8554                    match tag {
8555                        __FieldTag::__kms_key_name => {
8556                            if !fields.insert(__FieldTag::__kms_key_name) {
8557                                return std::result::Result::Err(A::Error::duplicate_field(
8558                                    "multiple values for kms_key_name",
8559                                ));
8560                            }
8561                            result.kms_key_name =
8562                                map.next_value::<std::option::Option<wkt::StringValue>>()?;
8563                        }
8564                        __FieldTag::Unknown(key) => {
8565                            let value = map.next_value::<serde_json::Value>()?;
8566                            result._unknown_fields.insert(key, value);
8567                        }
8568                    }
8569                }
8570                std::result::Result::Ok(result)
8571            }
8572        }
8573        deserializer.deserialize_any(Visitor)
8574    }
8575}
8576
8577#[doc(hidden)]
8578impl serde::ser::Serialize for EncryptionConfiguration {
8579    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8580    where
8581        S: serde::ser::Serializer,
8582    {
8583        use serde::ser::SerializeMap;
8584        #[allow(unused_imports)]
8585        use std::option::Option::Some;
8586        let mut state = serializer.serialize_map(std::option::Option::None)?;
8587        if self.kms_key_name.is_some() {
8588            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
8589        }
8590        if !self._unknown_fields.is_empty() {
8591            for (key, value) in self._unknown_fields.iter() {
8592                state.serialize_entry(key, &value)?;
8593            }
8594        }
8595        state.end()
8596    }
8597}
8598
8599/// Represents a data transfer run.
8600#[derive(Clone, Debug, Default, PartialEq)]
8601#[non_exhaustive]
8602pub struct TransferRun {
8603    /// Identifier. The resource name of the transfer run.
8604    /// Transfer run names have the form
8605    /// `projects/{project_id}/locations/{location}/transferConfigs/{config_id}/runs/{run_id}`.
8606    /// The name is ignored when creating a transfer run.
8607    pub name: std::string::String,
8608
8609    /// Minimum time after which a transfer run can be started.
8610    pub schedule_time: std::option::Option<wkt::Timestamp>,
8611
8612    /// For batch transfer runs, specifies the date and time of the data should be
8613    /// ingested.
8614    pub run_time: std::option::Option<wkt::Timestamp>,
8615
8616    /// Status of the transfer run.
8617    pub error_status: std::option::Option<rpc::model::Status>,
8618
8619    /// Output only. Time when transfer run was started.
8620    /// Parameter ignored by server for input requests.
8621    pub start_time: std::option::Option<wkt::Timestamp>,
8622
8623    /// Output only. Time when transfer run ended.
8624    /// Parameter ignored by server for input requests.
8625    pub end_time: std::option::Option<wkt::Timestamp>,
8626
8627    /// Output only. Last time the data transfer run state was updated.
8628    pub update_time: std::option::Option<wkt::Timestamp>,
8629
8630    /// Output only. Parameters specific to each data source. For more information
8631    /// see the bq tab in the 'Setting up a data transfer' section for each data
8632    /// source. For example the parameters for Cloud Storage transfers are listed
8633    /// here:
8634    /// <https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq>
8635    pub params: std::option::Option<wkt::Struct>,
8636
8637    /// Output only. Data source id.
8638    pub data_source_id: std::string::String,
8639
8640    /// Data transfer run state. Ignored for input requests.
8641    pub state: crate::model::TransferState,
8642
8643    /// Deprecated. Unique ID of the user on whose behalf transfer is done.
8644    pub user_id: i64,
8645
8646    /// Output only. Describes the schedule of this transfer run if it was
8647    /// created as part of a regular schedule. For batch transfer runs that are
8648    /// scheduled manually, this is empty.
8649    /// NOTE: the system might choose to delay the schedule depending on the
8650    /// current load, so `schedule_time` doesn't always match this.
8651    pub schedule: std::string::String,
8652
8653    /// Output only. Pub/Sub topic where a notification will be sent after this
8654    /// transfer run finishes.
8655    ///
8656    /// The format for specifying a pubsub topic is:
8657    /// `projects/{project_id}/topics/{topic_id}`
8658    pub notification_pubsub_topic: std::string::String,
8659
8660    /// Output only. Email notifications will be sent according to these
8661    /// preferences to the email address of the user who owns the transfer config
8662    /// this run was derived from.
8663    pub email_preferences: std::option::Option<crate::model::EmailPreferences>,
8664
8665    /// Data transfer destination.
8666    pub destination: std::option::Option<crate::model::transfer_run::Destination>,
8667
8668    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8669}
8670
8671impl TransferRun {
8672    pub fn new() -> Self {
8673        std::default::Default::default()
8674    }
8675
8676    /// Sets the value of [name][crate::model::TransferRun::name].
8677    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8678        self.name = v.into();
8679        self
8680    }
8681
8682    /// Sets the value of [schedule_time][crate::model::TransferRun::schedule_time].
8683    pub fn set_schedule_time<T>(mut self, v: T) -> Self
8684    where
8685        T: std::convert::Into<wkt::Timestamp>,
8686    {
8687        self.schedule_time = std::option::Option::Some(v.into());
8688        self
8689    }
8690
8691    /// Sets or clears the value of [schedule_time][crate::model::TransferRun::schedule_time].
8692    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
8693    where
8694        T: std::convert::Into<wkt::Timestamp>,
8695    {
8696        self.schedule_time = v.map(|x| x.into());
8697        self
8698    }
8699
8700    /// Sets the value of [run_time][crate::model::TransferRun::run_time].
8701    pub fn set_run_time<T>(mut self, v: T) -> Self
8702    where
8703        T: std::convert::Into<wkt::Timestamp>,
8704    {
8705        self.run_time = std::option::Option::Some(v.into());
8706        self
8707    }
8708
8709    /// Sets or clears the value of [run_time][crate::model::TransferRun::run_time].
8710    pub fn set_or_clear_run_time<T>(mut self, v: std::option::Option<T>) -> Self
8711    where
8712        T: std::convert::Into<wkt::Timestamp>,
8713    {
8714        self.run_time = v.map(|x| x.into());
8715        self
8716    }
8717
8718    /// Sets the value of [error_status][crate::model::TransferRun::error_status].
8719    pub fn set_error_status<T>(mut self, v: T) -> Self
8720    where
8721        T: std::convert::Into<rpc::model::Status>,
8722    {
8723        self.error_status = std::option::Option::Some(v.into());
8724        self
8725    }
8726
8727    /// Sets or clears the value of [error_status][crate::model::TransferRun::error_status].
8728    pub fn set_or_clear_error_status<T>(mut self, v: std::option::Option<T>) -> Self
8729    where
8730        T: std::convert::Into<rpc::model::Status>,
8731    {
8732        self.error_status = v.map(|x| x.into());
8733        self
8734    }
8735
8736    /// Sets the value of [start_time][crate::model::TransferRun::start_time].
8737    pub fn set_start_time<T>(mut self, v: T) -> Self
8738    where
8739        T: std::convert::Into<wkt::Timestamp>,
8740    {
8741        self.start_time = std::option::Option::Some(v.into());
8742        self
8743    }
8744
8745    /// Sets or clears the value of [start_time][crate::model::TransferRun::start_time].
8746    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8747    where
8748        T: std::convert::Into<wkt::Timestamp>,
8749    {
8750        self.start_time = v.map(|x| x.into());
8751        self
8752    }
8753
8754    /// Sets the value of [end_time][crate::model::TransferRun::end_time].
8755    pub fn set_end_time<T>(mut self, v: T) -> Self
8756    where
8757        T: std::convert::Into<wkt::Timestamp>,
8758    {
8759        self.end_time = std::option::Option::Some(v.into());
8760        self
8761    }
8762
8763    /// Sets or clears the value of [end_time][crate::model::TransferRun::end_time].
8764    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8765    where
8766        T: std::convert::Into<wkt::Timestamp>,
8767    {
8768        self.end_time = v.map(|x| x.into());
8769        self
8770    }
8771
8772    /// Sets the value of [update_time][crate::model::TransferRun::update_time].
8773    pub fn set_update_time<T>(mut self, v: T) -> Self
8774    where
8775        T: std::convert::Into<wkt::Timestamp>,
8776    {
8777        self.update_time = std::option::Option::Some(v.into());
8778        self
8779    }
8780
8781    /// Sets or clears the value of [update_time][crate::model::TransferRun::update_time].
8782    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8783    where
8784        T: std::convert::Into<wkt::Timestamp>,
8785    {
8786        self.update_time = v.map(|x| x.into());
8787        self
8788    }
8789
8790    /// Sets the value of [params][crate::model::TransferRun::params].
8791    pub fn set_params<T>(mut self, v: T) -> Self
8792    where
8793        T: std::convert::Into<wkt::Struct>,
8794    {
8795        self.params = std::option::Option::Some(v.into());
8796        self
8797    }
8798
8799    /// Sets or clears the value of [params][crate::model::TransferRun::params].
8800    pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
8801    where
8802        T: std::convert::Into<wkt::Struct>,
8803    {
8804        self.params = v.map(|x| x.into());
8805        self
8806    }
8807
8808    /// Sets the value of [data_source_id][crate::model::TransferRun::data_source_id].
8809    pub fn set_data_source_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8810        self.data_source_id = v.into();
8811        self
8812    }
8813
8814    /// Sets the value of [state][crate::model::TransferRun::state].
8815    pub fn set_state<T: std::convert::Into<crate::model::TransferState>>(mut self, v: T) -> Self {
8816        self.state = v.into();
8817        self
8818    }
8819
8820    /// Sets the value of [user_id][crate::model::TransferRun::user_id].
8821    pub fn set_user_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8822        self.user_id = v.into();
8823        self
8824    }
8825
8826    /// Sets the value of [schedule][crate::model::TransferRun::schedule].
8827    pub fn set_schedule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8828        self.schedule = v.into();
8829        self
8830    }
8831
8832    /// Sets the value of [notification_pubsub_topic][crate::model::TransferRun::notification_pubsub_topic].
8833    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
8834        mut self,
8835        v: T,
8836    ) -> Self {
8837        self.notification_pubsub_topic = v.into();
8838        self
8839    }
8840
8841    /// Sets the value of [email_preferences][crate::model::TransferRun::email_preferences].
8842    pub fn set_email_preferences<T>(mut self, v: T) -> Self
8843    where
8844        T: std::convert::Into<crate::model::EmailPreferences>,
8845    {
8846        self.email_preferences = std::option::Option::Some(v.into());
8847        self
8848    }
8849
8850    /// Sets or clears the value of [email_preferences][crate::model::TransferRun::email_preferences].
8851    pub fn set_or_clear_email_preferences<T>(mut self, v: std::option::Option<T>) -> Self
8852    where
8853        T: std::convert::Into<crate::model::EmailPreferences>,
8854    {
8855        self.email_preferences = v.map(|x| x.into());
8856        self
8857    }
8858
8859    /// Sets the value of [destination][crate::model::TransferRun::destination].
8860    ///
8861    /// Note that all the setters affecting `destination` are mutually
8862    /// exclusive.
8863    pub fn set_destination<
8864        T: std::convert::Into<std::option::Option<crate::model::transfer_run::Destination>>,
8865    >(
8866        mut self,
8867        v: T,
8868    ) -> Self {
8869        self.destination = v.into();
8870        self
8871    }
8872
8873    /// The value of [destination][crate::model::TransferRun::destination]
8874    /// if it holds a `DestinationDatasetId`, `None` if the field is not set or
8875    /// holds a different branch.
8876    pub fn destination_dataset_id(&self) -> std::option::Option<&std::string::String> {
8877        #[allow(unreachable_patterns)]
8878        self.destination.as_ref().and_then(|v| match v {
8879            crate::model::transfer_run::Destination::DestinationDatasetId(v) => {
8880                std::option::Option::Some(v)
8881            }
8882            _ => std::option::Option::None,
8883        })
8884    }
8885
8886    /// Sets the value of [destination][crate::model::TransferRun::destination]
8887    /// to hold a `DestinationDatasetId`.
8888    ///
8889    /// Note that all the setters affecting `destination` are
8890    /// mutually exclusive.
8891    pub fn set_destination_dataset_id<T: std::convert::Into<std::string::String>>(
8892        mut self,
8893        v: T,
8894    ) -> Self {
8895        self.destination = std::option::Option::Some(
8896            crate::model::transfer_run::Destination::DestinationDatasetId(v.into()),
8897        );
8898        self
8899    }
8900}
8901
8902impl wkt::message::Message for TransferRun {
8903    fn typename() -> &'static str {
8904        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TransferRun"
8905    }
8906}
8907
8908#[doc(hidden)]
8909impl<'de> serde::de::Deserialize<'de> for TransferRun {
8910    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8911    where
8912        D: serde::Deserializer<'de>,
8913    {
8914        #[allow(non_camel_case_types)]
8915        #[doc(hidden)]
8916        #[derive(PartialEq, Eq, Hash)]
8917        enum __FieldTag {
8918            __name,
8919            __schedule_time,
8920            __run_time,
8921            __error_status,
8922            __start_time,
8923            __end_time,
8924            __update_time,
8925            __params,
8926            __destination_dataset_id,
8927            __data_source_id,
8928            __state,
8929            __user_id,
8930            __schedule,
8931            __notification_pubsub_topic,
8932            __email_preferences,
8933            Unknown(std::string::String),
8934        }
8935        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8936            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8937            where
8938                D: serde::Deserializer<'de>,
8939            {
8940                struct Visitor;
8941                impl<'de> serde::de::Visitor<'de> for Visitor {
8942                    type Value = __FieldTag;
8943                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8944                        formatter.write_str("a field name for TransferRun")
8945                    }
8946                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8947                    where
8948                        E: serde::de::Error,
8949                    {
8950                        use std::result::Result::Ok;
8951                        use std::string::ToString;
8952                        match value {
8953                            "name" => Ok(__FieldTag::__name),
8954                            "scheduleTime" => Ok(__FieldTag::__schedule_time),
8955                            "schedule_time" => Ok(__FieldTag::__schedule_time),
8956                            "runTime" => Ok(__FieldTag::__run_time),
8957                            "run_time" => Ok(__FieldTag::__run_time),
8958                            "errorStatus" => Ok(__FieldTag::__error_status),
8959                            "error_status" => Ok(__FieldTag::__error_status),
8960                            "startTime" => Ok(__FieldTag::__start_time),
8961                            "start_time" => Ok(__FieldTag::__start_time),
8962                            "endTime" => Ok(__FieldTag::__end_time),
8963                            "end_time" => Ok(__FieldTag::__end_time),
8964                            "updateTime" => Ok(__FieldTag::__update_time),
8965                            "update_time" => Ok(__FieldTag::__update_time),
8966                            "params" => Ok(__FieldTag::__params),
8967                            "destinationDatasetId" => Ok(__FieldTag::__destination_dataset_id),
8968                            "destination_dataset_id" => Ok(__FieldTag::__destination_dataset_id),
8969                            "dataSourceId" => Ok(__FieldTag::__data_source_id),
8970                            "data_source_id" => Ok(__FieldTag::__data_source_id),
8971                            "state" => Ok(__FieldTag::__state),
8972                            "userId" => Ok(__FieldTag::__user_id),
8973                            "user_id" => Ok(__FieldTag::__user_id),
8974                            "schedule" => Ok(__FieldTag::__schedule),
8975                            "notificationPubsubTopic" => {
8976                                Ok(__FieldTag::__notification_pubsub_topic)
8977                            }
8978                            "notification_pubsub_topic" => {
8979                                Ok(__FieldTag::__notification_pubsub_topic)
8980                            }
8981                            "emailPreferences" => Ok(__FieldTag::__email_preferences),
8982                            "email_preferences" => Ok(__FieldTag::__email_preferences),
8983                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8984                        }
8985                    }
8986                }
8987                deserializer.deserialize_identifier(Visitor)
8988            }
8989        }
8990        struct Visitor;
8991        impl<'de> serde::de::Visitor<'de> for Visitor {
8992            type Value = TransferRun;
8993            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8994                formatter.write_str("struct TransferRun")
8995            }
8996            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8997            where
8998                A: serde::de::MapAccess<'de>,
8999            {
9000                #[allow(unused_imports)]
9001                use serde::de::Error;
9002                use std::option::Option::Some;
9003                let mut fields = std::collections::HashSet::new();
9004                let mut result = Self::Value::new();
9005                while let Some(tag) = map.next_key::<__FieldTag>()? {
9006                    #[allow(clippy::match_single_binding)]
9007                    match tag {
9008                        __FieldTag::__name => {
9009                            if !fields.insert(__FieldTag::__name) {
9010                                return std::result::Result::Err(A::Error::duplicate_field(
9011                                    "multiple values for name",
9012                                ));
9013                            }
9014                            result.name = map
9015                                .next_value::<std::option::Option<std::string::String>>()?
9016                                .unwrap_or_default();
9017                        }
9018                        __FieldTag::__schedule_time => {
9019                            if !fields.insert(__FieldTag::__schedule_time) {
9020                                return std::result::Result::Err(A::Error::duplicate_field(
9021                                    "multiple values for schedule_time",
9022                                ));
9023                            }
9024                            result.schedule_time =
9025                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9026                        }
9027                        __FieldTag::__run_time => {
9028                            if !fields.insert(__FieldTag::__run_time) {
9029                                return std::result::Result::Err(A::Error::duplicate_field(
9030                                    "multiple values for run_time",
9031                                ));
9032                            }
9033                            result.run_time =
9034                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9035                        }
9036                        __FieldTag::__error_status => {
9037                            if !fields.insert(__FieldTag::__error_status) {
9038                                return std::result::Result::Err(A::Error::duplicate_field(
9039                                    "multiple values for error_status",
9040                                ));
9041                            }
9042                            result.error_status =
9043                                map.next_value::<std::option::Option<rpc::model::Status>>()?;
9044                        }
9045                        __FieldTag::__start_time => {
9046                            if !fields.insert(__FieldTag::__start_time) {
9047                                return std::result::Result::Err(A::Error::duplicate_field(
9048                                    "multiple values for start_time",
9049                                ));
9050                            }
9051                            result.start_time =
9052                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9053                        }
9054                        __FieldTag::__end_time => {
9055                            if !fields.insert(__FieldTag::__end_time) {
9056                                return std::result::Result::Err(A::Error::duplicate_field(
9057                                    "multiple values for end_time",
9058                                ));
9059                            }
9060                            result.end_time =
9061                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9062                        }
9063                        __FieldTag::__update_time => {
9064                            if !fields.insert(__FieldTag::__update_time) {
9065                                return std::result::Result::Err(A::Error::duplicate_field(
9066                                    "multiple values for update_time",
9067                                ));
9068                            }
9069                            result.update_time =
9070                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9071                        }
9072                        __FieldTag::__params => {
9073                            if !fields.insert(__FieldTag::__params) {
9074                                return std::result::Result::Err(A::Error::duplicate_field(
9075                                    "multiple values for params",
9076                                ));
9077                            }
9078                            result.params = map.next_value::<std::option::Option<wkt::Struct>>()?;
9079                        }
9080                        __FieldTag::__destination_dataset_id => {
9081                            if !fields.insert(__FieldTag::__destination_dataset_id) {
9082                                return std::result::Result::Err(A::Error::duplicate_field(
9083                                    "multiple values for destination_dataset_id",
9084                                ));
9085                            }
9086                            if result.destination.is_some() {
9087                                return std::result::Result::Err(A::Error::duplicate_field(
9088                                    "multiple values for `destination`, a oneof with full ID .google.cloud.bigquery.datatransfer.v1.TransferRun.destination_dataset_id, latest field was destinationDatasetId",
9089                                ));
9090                            }
9091                            result.destination = std::option::Option::Some(
9092                                crate::model::transfer_run::Destination::DestinationDatasetId(
9093                                    map.next_value::<std::option::Option<std::string::String>>()?
9094                                        .unwrap_or_default(),
9095                                ),
9096                            );
9097                        }
9098                        __FieldTag::__data_source_id => {
9099                            if !fields.insert(__FieldTag::__data_source_id) {
9100                                return std::result::Result::Err(A::Error::duplicate_field(
9101                                    "multiple values for data_source_id",
9102                                ));
9103                            }
9104                            result.data_source_id = map
9105                                .next_value::<std::option::Option<std::string::String>>()?
9106                                .unwrap_or_default();
9107                        }
9108                        __FieldTag::__state => {
9109                            if !fields.insert(__FieldTag::__state) {
9110                                return std::result::Result::Err(A::Error::duplicate_field(
9111                                    "multiple values for state",
9112                                ));
9113                            }
9114                            result.state = map
9115                                .next_value::<std::option::Option<crate::model::TransferState>>()?
9116                                .unwrap_or_default();
9117                        }
9118                        __FieldTag::__user_id => {
9119                            if !fields.insert(__FieldTag::__user_id) {
9120                                return std::result::Result::Err(A::Error::duplicate_field(
9121                                    "multiple values for user_id",
9122                                ));
9123                            }
9124                            struct __With(std::option::Option<i64>);
9125                            impl<'de> serde::de::Deserialize<'de> for __With {
9126                                fn deserialize<D>(
9127                                    deserializer: D,
9128                                ) -> std::result::Result<Self, D::Error>
9129                                where
9130                                    D: serde::de::Deserializer<'de>,
9131                                {
9132                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
9133                                }
9134                            }
9135                            result.user_id = map.next_value::<__With>()?.0.unwrap_or_default();
9136                        }
9137                        __FieldTag::__schedule => {
9138                            if !fields.insert(__FieldTag::__schedule) {
9139                                return std::result::Result::Err(A::Error::duplicate_field(
9140                                    "multiple values for schedule",
9141                                ));
9142                            }
9143                            result.schedule = map
9144                                .next_value::<std::option::Option<std::string::String>>()?
9145                                .unwrap_or_default();
9146                        }
9147                        __FieldTag::__notification_pubsub_topic => {
9148                            if !fields.insert(__FieldTag::__notification_pubsub_topic) {
9149                                return std::result::Result::Err(A::Error::duplicate_field(
9150                                    "multiple values for notification_pubsub_topic",
9151                                ));
9152                            }
9153                            result.notification_pubsub_topic = map
9154                                .next_value::<std::option::Option<std::string::String>>()?
9155                                .unwrap_or_default();
9156                        }
9157                        __FieldTag::__email_preferences => {
9158                            if !fields.insert(__FieldTag::__email_preferences) {
9159                                return std::result::Result::Err(A::Error::duplicate_field(
9160                                    "multiple values for email_preferences",
9161                                ));
9162                            }
9163                            result.email_preferences = map
9164                                .next_value::<std::option::Option<crate::model::EmailPreferences>>(
9165                                )?;
9166                        }
9167                        __FieldTag::Unknown(key) => {
9168                            let value = map.next_value::<serde_json::Value>()?;
9169                            result._unknown_fields.insert(key, value);
9170                        }
9171                    }
9172                }
9173                std::result::Result::Ok(result)
9174            }
9175        }
9176        deserializer.deserialize_any(Visitor)
9177    }
9178}
9179
9180#[doc(hidden)]
9181impl serde::ser::Serialize for TransferRun {
9182    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9183    where
9184        S: serde::ser::Serializer,
9185    {
9186        use serde::ser::SerializeMap;
9187        #[allow(unused_imports)]
9188        use std::option::Option::Some;
9189        let mut state = serializer.serialize_map(std::option::Option::None)?;
9190        if !self.name.is_empty() {
9191            state.serialize_entry("name", &self.name)?;
9192        }
9193        if self.schedule_time.is_some() {
9194            state.serialize_entry("scheduleTime", &self.schedule_time)?;
9195        }
9196        if self.run_time.is_some() {
9197            state.serialize_entry("runTime", &self.run_time)?;
9198        }
9199        if self.error_status.is_some() {
9200            state.serialize_entry("errorStatus", &self.error_status)?;
9201        }
9202        if self.start_time.is_some() {
9203            state.serialize_entry("startTime", &self.start_time)?;
9204        }
9205        if self.end_time.is_some() {
9206            state.serialize_entry("endTime", &self.end_time)?;
9207        }
9208        if self.update_time.is_some() {
9209            state.serialize_entry("updateTime", &self.update_time)?;
9210        }
9211        if self.params.is_some() {
9212            state.serialize_entry("params", &self.params)?;
9213        }
9214        if let Some(value) = self.destination_dataset_id() {
9215            state.serialize_entry("destinationDatasetId", value)?;
9216        }
9217        if !self.data_source_id.is_empty() {
9218            state.serialize_entry("dataSourceId", &self.data_source_id)?;
9219        }
9220        if !wkt::internal::is_default(&self.state) {
9221            state.serialize_entry("state", &self.state)?;
9222        }
9223        if !wkt::internal::is_default(&self.user_id) {
9224            struct __With<'a>(&'a i64);
9225            impl<'a> serde::ser::Serialize for __With<'a> {
9226                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9227                where
9228                    S: serde::ser::Serializer,
9229                {
9230                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
9231                }
9232            }
9233            state.serialize_entry("userId", &__With(&self.user_id))?;
9234        }
9235        if !self.schedule.is_empty() {
9236            state.serialize_entry("schedule", &self.schedule)?;
9237        }
9238        if !self.notification_pubsub_topic.is_empty() {
9239            state.serialize_entry("notificationPubsubTopic", &self.notification_pubsub_topic)?;
9240        }
9241        if self.email_preferences.is_some() {
9242            state.serialize_entry("emailPreferences", &self.email_preferences)?;
9243        }
9244        if !self._unknown_fields.is_empty() {
9245            for (key, value) in self._unknown_fields.iter() {
9246                state.serialize_entry(key, &value)?;
9247            }
9248        }
9249        state.end()
9250    }
9251}
9252
9253/// Defines additional types related to [TransferRun].
9254pub mod transfer_run {
9255    #[allow(unused_imports)]
9256    use super::*;
9257
9258    /// Data transfer destination.
9259    #[derive(Clone, Debug, PartialEq)]
9260    #[non_exhaustive]
9261    pub enum Destination {
9262        /// Output only. The BigQuery target dataset id.
9263        DestinationDatasetId(std::string::String),
9264    }
9265}
9266
9267/// Represents a user facing message for a particular data transfer run.
9268#[derive(Clone, Debug, Default, PartialEq)]
9269#[non_exhaustive]
9270pub struct TransferMessage {
9271    /// Time when message was logged.
9272    pub message_time: std::option::Option<wkt::Timestamp>,
9273
9274    /// Message severity.
9275    pub severity: crate::model::transfer_message::MessageSeverity,
9276
9277    /// Message text.
9278    pub message_text: std::string::String,
9279
9280    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9281}
9282
9283impl TransferMessage {
9284    pub fn new() -> Self {
9285        std::default::Default::default()
9286    }
9287
9288    /// Sets the value of [message_time][crate::model::TransferMessage::message_time].
9289    pub fn set_message_time<T>(mut self, v: T) -> Self
9290    where
9291        T: std::convert::Into<wkt::Timestamp>,
9292    {
9293        self.message_time = std::option::Option::Some(v.into());
9294        self
9295    }
9296
9297    /// Sets or clears the value of [message_time][crate::model::TransferMessage::message_time].
9298    pub fn set_or_clear_message_time<T>(mut self, v: std::option::Option<T>) -> Self
9299    where
9300        T: std::convert::Into<wkt::Timestamp>,
9301    {
9302        self.message_time = v.map(|x| x.into());
9303        self
9304    }
9305
9306    /// Sets the value of [severity][crate::model::TransferMessage::severity].
9307    pub fn set_severity<T: std::convert::Into<crate::model::transfer_message::MessageSeverity>>(
9308        mut self,
9309        v: T,
9310    ) -> Self {
9311        self.severity = v.into();
9312        self
9313    }
9314
9315    /// Sets the value of [message_text][crate::model::TransferMessage::message_text].
9316    pub fn set_message_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9317        self.message_text = v.into();
9318        self
9319    }
9320}
9321
9322impl wkt::message::Message for TransferMessage {
9323    fn typename() -> &'static str {
9324        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TransferMessage"
9325    }
9326}
9327
9328#[doc(hidden)]
9329impl<'de> serde::de::Deserialize<'de> for TransferMessage {
9330    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9331    where
9332        D: serde::Deserializer<'de>,
9333    {
9334        #[allow(non_camel_case_types)]
9335        #[doc(hidden)]
9336        #[derive(PartialEq, Eq, Hash)]
9337        enum __FieldTag {
9338            __message_time,
9339            __severity,
9340            __message_text,
9341            Unknown(std::string::String),
9342        }
9343        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9344            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9345            where
9346                D: serde::Deserializer<'de>,
9347            {
9348                struct Visitor;
9349                impl<'de> serde::de::Visitor<'de> for Visitor {
9350                    type Value = __FieldTag;
9351                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9352                        formatter.write_str("a field name for TransferMessage")
9353                    }
9354                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9355                    where
9356                        E: serde::de::Error,
9357                    {
9358                        use std::result::Result::Ok;
9359                        use std::string::ToString;
9360                        match value {
9361                            "messageTime" => Ok(__FieldTag::__message_time),
9362                            "message_time" => Ok(__FieldTag::__message_time),
9363                            "severity" => Ok(__FieldTag::__severity),
9364                            "messageText" => Ok(__FieldTag::__message_text),
9365                            "message_text" => Ok(__FieldTag::__message_text),
9366                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9367                        }
9368                    }
9369                }
9370                deserializer.deserialize_identifier(Visitor)
9371            }
9372        }
9373        struct Visitor;
9374        impl<'de> serde::de::Visitor<'de> for Visitor {
9375            type Value = TransferMessage;
9376            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9377                formatter.write_str("struct TransferMessage")
9378            }
9379            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9380            where
9381                A: serde::de::MapAccess<'de>,
9382            {
9383                #[allow(unused_imports)]
9384                use serde::de::Error;
9385                use std::option::Option::Some;
9386                let mut fields = std::collections::HashSet::new();
9387                let mut result = Self::Value::new();
9388                while let Some(tag) = map.next_key::<__FieldTag>()? {
9389                    #[allow(clippy::match_single_binding)]
9390                    match tag {
9391                        __FieldTag::__message_time => {
9392                            if !fields.insert(__FieldTag::__message_time) {
9393                                return std::result::Result::Err(A::Error::duplicate_field(
9394                                    "multiple values for message_time",
9395                                ));
9396                            }
9397                            result.message_time =
9398                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9399                        }
9400                        __FieldTag::__severity => {
9401                            if !fields.insert(__FieldTag::__severity) {
9402                                return std::result::Result::Err(A::Error::duplicate_field(
9403                                    "multiple values for severity",
9404                                ));
9405                            }
9406                            result.severity = map
9407                                .next_value::<std::option::Option<
9408                                    crate::model::transfer_message::MessageSeverity,
9409                                >>()?
9410                                .unwrap_or_default();
9411                        }
9412                        __FieldTag::__message_text => {
9413                            if !fields.insert(__FieldTag::__message_text) {
9414                                return std::result::Result::Err(A::Error::duplicate_field(
9415                                    "multiple values for message_text",
9416                                ));
9417                            }
9418                            result.message_text = map
9419                                .next_value::<std::option::Option<std::string::String>>()?
9420                                .unwrap_or_default();
9421                        }
9422                        __FieldTag::Unknown(key) => {
9423                            let value = map.next_value::<serde_json::Value>()?;
9424                            result._unknown_fields.insert(key, value);
9425                        }
9426                    }
9427                }
9428                std::result::Result::Ok(result)
9429            }
9430        }
9431        deserializer.deserialize_any(Visitor)
9432    }
9433}
9434
9435#[doc(hidden)]
9436impl serde::ser::Serialize for TransferMessage {
9437    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9438    where
9439        S: serde::ser::Serializer,
9440    {
9441        use serde::ser::SerializeMap;
9442        #[allow(unused_imports)]
9443        use std::option::Option::Some;
9444        let mut state = serializer.serialize_map(std::option::Option::None)?;
9445        if self.message_time.is_some() {
9446            state.serialize_entry("messageTime", &self.message_time)?;
9447        }
9448        if !wkt::internal::is_default(&self.severity) {
9449            state.serialize_entry("severity", &self.severity)?;
9450        }
9451        if !self.message_text.is_empty() {
9452            state.serialize_entry("messageText", &self.message_text)?;
9453        }
9454        if !self._unknown_fields.is_empty() {
9455            for (key, value) in self._unknown_fields.iter() {
9456                state.serialize_entry(key, &value)?;
9457            }
9458        }
9459        state.end()
9460    }
9461}
9462
9463/// Defines additional types related to [TransferMessage].
9464pub mod transfer_message {
9465    #[allow(unused_imports)]
9466    use super::*;
9467
9468    /// Represents data transfer user facing message severity.
9469    ///
9470    /// # Working with unknown values
9471    ///
9472    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9473    /// additional enum variants at any time. Adding new variants is not considered
9474    /// a breaking change. Applications should write their code in anticipation of:
9475    ///
9476    /// - New values appearing in future releases of the client library, **and**
9477    /// - New values received dynamically, without application changes.
9478    ///
9479    /// Please consult the [Working with enums] section in the user guide for some
9480    /// guidelines.
9481    ///
9482    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9483    #[derive(Clone, Debug, PartialEq)]
9484    #[non_exhaustive]
9485    pub enum MessageSeverity {
9486        /// No severity specified.
9487        Unspecified,
9488        /// Informational message.
9489        Info,
9490        /// Warning message.
9491        Warning,
9492        /// Error message.
9493        Error,
9494        /// If set, the enum was initialized with an unknown value.
9495        ///
9496        /// Applications can examine the value using [MessageSeverity::value] or
9497        /// [MessageSeverity::name].
9498        UnknownValue(message_severity::UnknownValue),
9499    }
9500
9501    #[doc(hidden)]
9502    pub mod message_severity {
9503        #[allow(unused_imports)]
9504        use super::*;
9505        #[derive(Clone, Debug, PartialEq)]
9506        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9507    }
9508
9509    impl MessageSeverity {
9510        /// Gets the enum value.
9511        ///
9512        /// Returns `None` if the enum contains an unknown value deserialized from
9513        /// the string representation of enums.
9514        pub fn value(&self) -> std::option::Option<i32> {
9515            match self {
9516                Self::Unspecified => std::option::Option::Some(0),
9517                Self::Info => std::option::Option::Some(1),
9518                Self::Warning => std::option::Option::Some(2),
9519                Self::Error => std::option::Option::Some(3),
9520                Self::UnknownValue(u) => u.0.value(),
9521            }
9522        }
9523
9524        /// Gets the enum value as a string.
9525        ///
9526        /// Returns `None` if the enum contains an unknown value deserialized from
9527        /// the integer representation of enums.
9528        pub fn name(&self) -> std::option::Option<&str> {
9529            match self {
9530                Self::Unspecified => std::option::Option::Some("MESSAGE_SEVERITY_UNSPECIFIED"),
9531                Self::Info => std::option::Option::Some("INFO"),
9532                Self::Warning => std::option::Option::Some("WARNING"),
9533                Self::Error => std::option::Option::Some("ERROR"),
9534                Self::UnknownValue(u) => u.0.name(),
9535            }
9536        }
9537    }
9538
9539    impl std::default::Default for MessageSeverity {
9540        fn default() -> Self {
9541            use std::convert::From;
9542            Self::from(0)
9543        }
9544    }
9545
9546    impl std::fmt::Display for MessageSeverity {
9547        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9548            wkt::internal::display_enum(f, self.name(), self.value())
9549        }
9550    }
9551
9552    impl std::convert::From<i32> for MessageSeverity {
9553        fn from(value: i32) -> Self {
9554            match value {
9555                0 => Self::Unspecified,
9556                1 => Self::Info,
9557                2 => Self::Warning,
9558                3 => Self::Error,
9559                _ => Self::UnknownValue(message_severity::UnknownValue(
9560                    wkt::internal::UnknownEnumValue::Integer(value),
9561                )),
9562            }
9563        }
9564    }
9565
9566    impl std::convert::From<&str> for MessageSeverity {
9567        fn from(value: &str) -> Self {
9568            use std::string::ToString;
9569            match value {
9570                "MESSAGE_SEVERITY_UNSPECIFIED" => Self::Unspecified,
9571                "INFO" => Self::Info,
9572                "WARNING" => Self::Warning,
9573                "ERROR" => Self::Error,
9574                _ => Self::UnknownValue(message_severity::UnknownValue(
9575                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9576                )),
9577            }
9578        }
9579    }
9580
9581    impl serde::ser::Serialize for MessageSeverity {
9582        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9583        where
9584            S: serde::Serializer,
9585        {
9586            match self {
9587                Self::Unspecified => serializer.serialize_i32(0),
9588                Self::Info => serializer.serialize_i32(1),
9589                Self::Warning => serializer.serialize_i32(2),
9590                Self::Error => serializer.serialize_i32(3),
9591                Self::UnknownValue(u) => u.0.serialize(serializer),
9592            }
9593        }
9594    }
9595
9596    impl<'de> serde::de::Deserialize<'de> for MessageSeverity {
9597        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9598        where
9599            D: serde::Deserializer<'de>,
9600        {
9601            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageSeverity>::new(
9602                ".google.cloud.bigquery.datatransfer.v1.TransferMessage.MessageSeverity",
9603            ))
9604        }
9605    }
9606}
9607
9608/// DEPRECATED. Represents data transfer type.
9609///
9610/// # Working with unknown values
9611///
9612/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9613/// additional enum variants at any time. Adding new variants is not considered
9614/// a breaking change. Applications should write their code in anticipation of:
9615///
9616/// - New values appearing in future releases of the client library, **and**
9617/// - New values received dynamically, without application changes.
9618///
9619/// Please consult the [Working with enums] section in the user guide for some
9620/// guidelines.
9621///
9622/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9623#[derive(Clone, Debug, PartialEq)]
9624#[non_exhaustive]
9625#[deprecated]
9626pub enum TransferType {
9627    /// Invalid or Unknown transfer type placeholder.
9628    Unspecified,
9629    /// Batch data transfer.
9630    Batch,
9631    /// Streaming data transfer. Streaming data source currently doesn't
9632    /// support multiple transfer configs per project.
9633    Streaming,
9634    /// If set, the enum was initialized with an unknown value.
9635    ///
9636    /// Applications can examine the value using [TransferType::value] or
9637    /// [TransferType::name].
9638    UnknownValue(transfer_type::UnknownValue),
9639}
9640
9641#[doc(hidden)]
9642pub mod transfer_type {
9643    #[allow(unused_imports)]
9644    use super::*;
9645    #[derive(Clone, Debug, PartialEq)]
9646    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9647}
9648
9649impl TransferType {
9650    /// Gets the enum value.
9651    ///
9652    /// Returns `None` if the enum contains an unknown value deserialized from
9653    /// the string representation of enums.
9654    pub fn value(&self) -> std::option::Option<i32> {
9655        match self {
9656            Self::Unspecified => std::option::Option::Some(0),
9657            Self::Batch => std::option::Option::Some(1),
9658            Self::Streaming => std::option::Option::Some(2),
9659            Self::UnknownValue(u) => u.0.value(),
9660        }
9661    }
9662
9663    /// Gets the enum value as a string.
9664    ///
9665    /// Returns `None` if the enum contains an unknown value deserialized from
9666    /// the integer representation of enums.
9667    pub fn name(&self) -> std::option::Option<&str> {
9668        match self {
9669            Self::Unspecified => std::option::Option::Some("TRANSFER_TYPE_UNSPECIFIED"),
9670            Self::Batch => std::option::Option::Some("BATCH"),
9671            Self::Streaming => std::option::Option::Some("STREAMING"),
9672            Self::UnknownValue(u) => u.0.name(),
9673        }
9674    }
9675}
9676
9677impl std::default::Default for TransferType {
9678    fn default() -> Self {
9679        use std::convert::From;
9680        Self::from(0)
9681    }
9682}
9683
9684impl std::fmt::Display for TransferType {
9685    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9686        wkt::internal::display_enum(f, self.name(), self.value())
9687    }
9688}
9689
9690impl std::convert::From<i32> for TransferType {
9691    fn from(value: i32) -> Self {
9692        match value {
9693            0 => Self::Unspecified,
9694            1 => Self::Batch,
9695            2 => Self::Streaming,
9696            _ => Self::UnknownValue(transfer_type::UnknownValue(
9697                wkt::internal::UnknownEnumValue::Integer(value),
9698            )),
9699        }
9700    }
9701}
9702
9703impl std::convert::From<&str> for TransferType {
9704    fn from(value: &str) -> Self {
9705        use std::string::ToString;
9706        match value {
9707            "TRANSFER_TYPE_UNSPECIFIED" => Self::Unspecified,
9708            "BATCH" => Self::Batch,
9709            "STREAMING" => Self::Streaming,
9710            _ => Self::UnknownValue(transfer_type::UnknownValue(
9711                wkt::internal::UnknownEnumValue::String(value.to_string()),
9712            )),
9713        }
9714    }
9715}
9716
9717impl serde::ser::Serialize for TransferType {
9718    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9719    where
9720        S: serde::Serializer,
9721    {
9722        match self {
9723            Self::Unspecified => serializer.serialize_i32(0),
9724            Self::Batch => serializer.serialize_i32(1),
9725            Self::Streaming => serializer.serialize_i32(2),
9726            Self::UnknownValue(u) => u.0.serialize(serializer),
9727        }
9728    }
9729}
9730
9731impl<'de> serde::de::Deserialize<'de> for TransferType {
9732    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9733    where
9734        D: serde::Deserializer<'de>,
9735    {
9736        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransferType>::new(
9737            ".google.cloud.bigquery.datatransfer.v1.TransferType",
9738        ))
9739    }
9740}
9741
9742/// Represents data transfer run state.
9743///
9744/// # Working with unknown values
9745///
9746/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9747/// additional enum variants at any time. Adding new variants is not considered
9748/// a breaking change. Applications should write their code in anticipation of:
9749///
9750/// - New values appearing in future releases of the client library, **and**
9751/// - New values received dynamically, without application changes.
9752///
9753/// Please consult the [Working with enums] section in the user guide for some
9754/// guidelines.
9755///
9756/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9757#[derive(Clone, Debug, PartialEq)]
9758#[non_exhaustive]
9759pub enum TransferState {
9760    /// State placeholder (0).
9761    Unspecified,
9762    /// Data transfer is scheduled and is waiting to be picked up by
9763    /// data transfer backend (2).
9764    Pending,
9765    /// Data transfer is in progress (3).
9766    Running,
9767    /// Data transfer completed successfully (4).
9768    Succeeded,
9769    /// Data transfer failed (5).
9770    Failed,
9771    /// Data transfer is cancelled (6).
9772    Cancelled,
9773    /// If set, the enum was initialized with an unknown value.
9774    ///
9775    /// Applications can examine the value using [TransferState::value] or
9776    /// [TransferState::name].
9777    UnknownValue(transfer_state::UnknownValue),
9778}
9779
9780#[doc(hidden)]
9781pub mod transfer_state {
9782    #[allow(unused_imports)]
9783    use super::*;
9784    #[derive(Clone, Debug, PartialEq)]
9785    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9786}
9787
9788impl TransferState {
9789    /// Gets the enum value.
9790    ///
9791    /// Returns `None` if the enum contains an unknown value deserialized from
9792    /// the string representation of enums.
9793    pub fn value(&self) -> std::option::Option<i32> {
9794        match self {
9795            Self::Unspecified => std::option::Option::Some(0),
9796            Self::Pending => std::option::Option::Some(2),
9797            Self::Running => std::option::Option::Some(3),
9798            Self::Succeeded => std::option::Option::Some(4),
9799            Self::Failed => std::option::Option::Some(5),
9800            Self::Cancelled => std::option::Option::Some(6),
9801            Self::UnknownValue(u) => u.0.value(),
9802        }
9803    }
9804
9805    /// Gets the enum value as a string.
9806    ///
9807    /// Returns `None` if the enum contains an unknown value deserialized from
9808    /// the integer representation of enums.
9809    pub fn name(&self) -> std::option::Option<&str> {
9810        match self {
9811            Self::Unspecified => std::option::Option::Some("TRANSFER_STATE_UNSPECIFIED"),
9812            Self::Pending => std::option::Option::Some("PENDING"),
9813            Self::Running => std::option::Option::Some("RUNNING"),
9814            Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9815            Self::Failed => std::option::Option::Some("FAILED"),
9816            Self::Cancelled => std::option::Option::Some("CANCELLED"),
9817            Self::UnknownValue(u) => u.0.name(),
9818        }
9819    }
9820}
9821
9822impl std::default::Default for TransferState {
9823    fn default() -> Self {
9824        use std::convert::From;
9825        Self::from(0)
9826    }
9827}
9828
9829impl std::fmt::Display for TransferState {
9830    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9831        wkt::internal::display_enum(f, self.name(), self.value())
9832    }
9833}
9834
9835impl std::convert::From<i32> for TransferState {
9836    fn from(value: i32) -> Self {
9837        match value {
9838            0 => Self::Unspecified,
9839            2 => Self::Pending,
9840            3 => Self::Running,
9841            4 => Self::Succeeded,
9842            5 => Self::Failed,
9843            6 => Self::Cancelled,
9844            _ => Self::UnknownValue(transfer_state::UnknownValue(
9845                wkt::internal::UnknownEnumValue::Integer(value),
9846            )),
9847        }
9848    }
9849}
9850
9851impl std::convert::From<&str> for TransferState {
9852    fn from(value: &str) -> Self {
9853        use std::string::ToString;
9854        match value {
9855            "TRANSFER_STATE_UNSPECIFIED" => Self::Unspecified,
9856            "PENDING" => Self::Pending,
9857            "RUNNING" => Self::Running,
9858            "SUCCEEDED" => Self::Succeeded,
9859            "FAILED" => Self::Failed,
9860            "CANCELLED" => Self::Cancelled,
9861            _ => Self::UnknownValue(transfer_state::UnknownValue(
9862                wkt::internal::UnknownEnumValue::String(value.to_string()),
9863            )),
9864        }
9865    }
9866}
9867
9868impl serde::ser::Serialize for TransferState {
9869    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9870    where
9871        S: serde::Serializer,
9872    {
9873        match self {
9874            Self::Unspecified => serializer.serialize_i32(0),
9875            Self::Pending => serializer.serialize_i32(2),
9876            Self::Running => serializer.serialize_i32(3),
9877            Self::Succeeded => serializer.serialize_i32(4),
9878            Self::Failed => serializer.serialize_i32(5),
9879            Self::Cancelled => serializer.serialize_i32(6),
9880            Self::UnknownValue(u) => u.0.serialize(serializer),
9881        }
9882    }
9883}
9884
9885impl<'de> serde::de::Deserialize<'de> for TransferState {
9886    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9887    where
9888        D: serde::Deserializer<'de>,
9889    {
9890        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransferState>::new(
9891            ".google.cloud.bigquery.datatransfer.v1.TransferState",
9892        ))
9893    }
9894}