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
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// A parameter used to define custom fields in a data source definition.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct DataSourceParameter {
43    /// Parameter identifier.
44    pub param_id: std::string::String,
45
46    /// Parameter display name in the user interface.
47    pub display_name: std::string::String,
48
49    /// Parameter description.
50    pub description: std::string::String,
51
52    /// Parameter type.
53    pub r#type: crate::model::data_source_parameter::Type,
54
55    /// Is parameter required.
56    pub required: bool,
57
58    /// Deprecated. This field has no effect.
59    pub repeated: bool,
60
61    /// Regular expression which can be used for parameter validation.
62    pub validation_regex: std::string::String,
63
64    /// All possible values for the parameter.
65    pub allowed_values: std::vec::Vec<std::string::String>,
66
67    /// For integer and double values specifies minimum allowed value.
68    pub min_value: std::option::Option<wkt::DoubleValue>,
69
70    /// For integer and double values specifies maximum allowed value.
71    pub max_value: std::option::Option<wkt::DoubleValue>,
72
73    /// Deprecated. This field has no effect.
74    pub fields: std::vec::Vec<crate::model::DataSourceParameter>,
75
76    /// Description of the requirements for this field, in case the user input does
77    /// not fulfill the regex pattern or min/max values.
78    pub validation_description: std::string::String,
79
80    /// URL to a help document to further explain the naming requirements.
81    pub validation_help_url: std::string::String,
82
83    /// Cannot be changed after initial creation.
84    pub immutable: bool,
85
86    /// Deprecated. This field has no effect.
87    pub recurse: bool,
88
89    /// If true, it should not be used in new transfers, and it should not be
90    /// visible to users.
91    pub deprecated: bool,
92
93    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
94}
95
96impl DataSourceParameter {
97    pub fn new() -> Self {
98        std::default::Default::default()
99    }
100
101    /// Sets the value of [param_id][crate::model::DataSourceParameter::param_id].
102    ///
103    /// # Example
104    /// ```ignore,no_run
105    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
106    /// let x = DataSourceParameter::new().set_param_id("example");
107    /// ```
108    pub fn set_param_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
109        self.param_id = v.into();
110        self
111    }
112
113    /// Sets the value of [display_name][crate::model::DataSourceParameter::display_name].
114    ///
115    /// # Example
116    /// ```ignore,no_run
117    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
118    /// let x = DataSourceParameter::new().set_display_name("example");
119    /// ```
120    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
121        self.display_name = v.into();
122        self
123    }
124
125    /// Sets the value of [description][crate::model::DataSourceParameter::description].
126    ///
127    /// # Example
128    /// ```ignore,no_run
129    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
130    /// let x = DataSourceParameter::new().set_description("example");
131    /// ```
132    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
133        self.description = v.into();
134        self
135    }
136
137    /// Sets the value of [r#type][crate::model::DataSourceParameter::type].
138    ///
139    /// # Example
140    /// ```ignore,no_run
141    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
142    /// use google_cloud_bigquery_datatransfer_v1::model::data_source_parameter::Type;
143    /// let x0 = DataSourceParameter::new().set_type(Type::String);
144    /// let x1 = DataSourceParameter::new().set_type(Type::Integer);
145    /// let x2 = DataSourceParameter::new().set_type(Type::Double);
146    /// ```
147    pub fn set_type<T: std::convert::Into<crate::model::data_source_parameter::Type>>(
148        mut self,
149        v: T,
150    ) -> Self {
151        self.r#type = v.into();
152        self
153    }
154
155    /// Sets the value of [required][crate::model::DataSourceParameter::required].
156    ///
157    /// # Example
158    /// ```ignore,no_run
159    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
160    /// let x = DataSourceParameter::new().set_required(true);
161    /// ```
162    pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
163        self.required = v.into();
164        self
165    }
166
167    /// Sets the value of [repeated][crate::model::DataSourceParameter::repeated].
168    ///
169    /// # Example
170    /// ```ignore,no_run
171    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
172    /// let x = DataSourceParameter::new().set_repeated(true);
173    /// ```
174    pub fn set_repeated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
175        self.repeated = v.into();
176        self
177    }
178
179    /// Sets the value of [validation_regex][crate::model::DataSourceParameter::validation_regex].
180    ///
181    /// # Example
182    /// ```ignore,no_run
183    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
184    /// let x = DataSourceParameter::new().set_validation_regex("example");
185    /// ```
186    pub fn set_validation_regex<T: std::convert::Into<std::string::String>>(
187        mut self,
188        v: T,
189    ) -> Self {
190        self.validation_regex = v.into();
191        self
192    }
193
194    /// Sets the value of [allowed_values][crate::model::DataSourceParameter::allowed_values].
195    ///
196    /// # Example
197    /// ```ignore,no_run
198    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
199    /// let x = DataSourceParameter::new().set_allowed_values(["a", "b", "c"]);
200    /// ```
201    pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
202    where
203        T: std::iter::IntoIterator<Item = V>,
204        V: std::convert::Into<std::string::String>,
205    {
206        use std::iter::Iterator;
207        self.allowed_values = v.into_iter().map(|i| i.into()).collect();
208        self
209    }
210
211    /// Sets the value of [min_value][crate::model::DataSourceParameter::min_value].
212    ///
213    /// # Example
214    /// ```ignore,no_run
215    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
216    /// use wkt::DoubleValue;
217    /// let x = DataSourceParameter::new().set_min_value(DoubleValue::default()/* use setters */);
218    /// ```
219    pub fn set_min_value<T>(mut self, v: T) -> Self
220    where
221        T: std::convert::Into<wkt::DoubleValue>,
222    {
223        self.min_value = std::option::Option::Some(v.into());
224        self
225    }
226
227    /// Sets or clears the value of [min_value][crate::model::DataSourceParameter::min_value].
228    ///
229    /// # Example
230    /// ```ignore,no_run
231    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
232    /// use wkt::DoubleValue;
233    /// let x = DataSourceParameter::new().set_or_clear_min_value(Some(DoubleValue::default()/* use setters */));
234    /// let x = DataSourceParameter::new().set_or_clear_min_value(None::<DoubleValue>);
235    /// ```
236    pub fn set_or_clear_min_value<T>(mut self, v: std::option::Option<T>) -> Self
237    where
238        T: std::convert::Into<wkt::DoubleValue>,
239    {
240        self.min_value = v.map(|x| x.into());
241        self
242    }
243
244    /// Sets the value of [max_value][crate::model::DataSourceParameter::max_value].
245    ///
246    /// # Example
247    /// ```ignore,no_run
248    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
249    /// use wkt::DoubleValue;
250    /// let x = DataSourceParameter::new().set_max_value(DoubleValue::default()/* use setters */);
251    /// ```
252    pub fn set_max_value<T>(mut self, v: T) -> Self
253    where
254        T: std::convert::Into<wkt::DoubleValue>,
255    {
256        self.max_value = std::option::Option::Some(v.into());
257        self
258    }
259
260    /// Sets or clears the value of [max_value][crate::model::DataSourceParameter::max_value].
261    ///
262    /// # Example
263    /// ```ignore,no_run
264    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
265    /// use wkt::DoubleValue;
266    /// let x = DataSourceParameter::new().set_or_clear_max_value(Some(DoubleValue::default()/* use setters */));
267    /// let x = DataSourceParameter::new().set_or_clear_max_value(None::<DoubleValue>);
268    /// ```
269    pub fn set_or_clear_max_value<T>(mut self, v: std::option::Option<T>) -> Self
270    where
271        T: std::convert::Into<wkt::DoubleValue>,
272    {
273        self.max_value = v.map(|x| x.into());
274        self
275    }
276
277    /// Sets the value of [fields][crate::model::DataSourceParameter::fields].
278    ///
279    /// # Example
280    /// ```ignore,no_run
281    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
282    /// let x = DataSourceParameter::new()
283    ///     .set_fields([
284    ///         DataSourceParameter::default()/* use setters */,
285    ///         DataSourceParameter::default()/* use (different) setters */,
286    ///     ]);
287    /// ```
288    pub fn set_fields<T, V>(mut self, v: T) -> Self
289    where
290        T: std::iter::IntoIterator<Item = V>,
291        V: std::convert::Into<crate::model::DataSourceParameter>,
292    {
293        use std::iter::Iterator;
294        self.fields = v.into_iter().map(|i| i.into()).collect();
295        self
296    }
297
298    /// Sets the value of [validation_description][crate::model::DataSourceParameter::validation_description].
299    ///
300    /// # Example
301    /// ```ignore,no_run
302    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
303    /// let x = DataSourceParameter::new().set_validation_description("example");
304    /// ```
305    pub fn set_validation_description<T: std::convert::Into<std::string::String>>(
306        mut self,
307        v: T,
308    ) -> Self {
309        self.validation_description = v.into();
310        self
311    }
312
313    /// Sets the value of [validation_help_url][crate::model::DataSourceParameter::validation_help_url].
314    ///
315    /// # Example
316    /// ```ignore,no_run
317    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
318    /// let x = DataSourceParameter::new().set_validation_help_url("example");
319    /// ```
320    pub fn set_validation_help_url<T: std::convert::Into<std::string::String>>(
321        mut self,
322        v: T,
323    ) -> Self {
324        self.validation_help_url = v.into();
325        self
326    }
327
328    /// Sets the value of [immutable][crate::model::DataSourceParameter::immutable].
329    ///
330    /// # Example
331    /// ```ignore,no_run
332    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
333    /// let x = DataSourceParameter::new().set_immutable(true);
334    /// ```
335    pub fn set_immutable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
336        self.immutable = v.into();
337        self
338    }
339
340    /// Sets the value of [recurse][crate::model::DataSourceParameter::recurse].
341    ///
342    /// # Example
343    /// ```ignore,no_run
344    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
345    /// let x = DataSourceParameter::new().set_recurse(true);
346    /// ```
347    pub fn set_recurse<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
348        self.recurse = v.into();
349        self
350    }
351
352    /// Sets the value of [deprecated][crate::model::DataSourceParameter::deprecated].
353    ///
354    /// # Example
355    /// ```ignore,no_run
356    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
357    /// let x = DataSourceParameter::new().set_deprecated(true);
358    /// ```
359    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
360        self.deprecated = v.into();
361        self
362    }
363}
364
365impl wkt::message::Message for DataSourceParameter {
366    fn typename() -> &'static str {
367        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DataSourceParameter"
368    }
369}
370
371/// Defines additional types related to [DataSourceParameter].
372pub mod data_source_parameter {
373    #[allow(unused_imports)]
374    use super::*;
375
376    /// Parameter type.
377    ///
378    /// # Working with unknown values
379    ///
380    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
381    /// additional enum variants at any time. Adding new variants is not considered
382    /// a breaking change. Applications should write their code in anticipation of:
383    ///
384    /// - New values appearing in future releases of the client library, **and**
385    /// - New values received dynamically, without application changes.
386    ///
387    /// Please consult the [Working with enums] section in the user guide for some
388    /// guidelines.
389    ///
390    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
391    #[derive(Clone, Debug, PartialEq)]
392    #[non_exhaustive]
393    pub enum Type {
394        /// Type unspecified.
395        Unspecified,
396        /// String parameter.
397        String,
398        /// Integer parameter (64-bits).
399        /// Will be serialized to json as string.
400        Integer,
401        /// Double precision floating point parameter.
402        Double,
403        /// Boolean parameter.
404        Boolean,
405        /// Deprecated. This field has no effect.
406        Record,
407        /// Page ID for a Google+ Page.
408        PlusPage,
409        /// List of strings parameter.
410        List,
411        /// If set, the enum was initialized with an unknown value.
412        ///
413        /// Applications can examine the value using [Type::value] or
414        /// [Type::name].
415        UnknownValue(r#type::UnknownValue),
416    }
417
418    #[doc(hidden)]
419    pub mod r#type {
420        #[allow(unused_imports)]
421        use super::*;
422        #[derive(Clone, Debug, PartialEq)]
423        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
424    }
425
426    impl Type {
427        /// Gets the enum value.
428        ///
429        /// Returns `None` if the enum contains an unknown value deserialized from
430        /// the string representation of enums.
431        pub fn value(&self) -> std::option::Option<i32> {
432            match self {
433                Self::Unspecified => std::option::Option::Some(0),
434                Self::String => std::option::Option::Some(1),
435                Self::Integer => std::option::Option::Some(2),
436                Self::Double => std::option::Option::Some(3),
437                Self::Boolean => std::option::Option::Some(4),
438                Self::Record => std::option::Option::Some(5),
439                Self::PlusPage => std::option::Option::Some(6),
440                Self::List => std::option::Option::Some(7),
441                Self::UnknownValue(u) => u.0.value(),
442            }
443        }
444
445        /// Gets the enum value as a string.
446        ///
447        /// Returns `None` if the enum contains an unknown value deserialized from
448        /// the integer representation of enums.
449        pub fn name(&self) -> std::option::Option<&str> {
450            match self {
451                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
452                Self::String => std::option::Option::Some("STRING"),
453                Self::Integer => std::option::Option::Some("INTEGER"),
454                Self::Double => std::option::Option::Some("DOUBLE"),
455                Self::Boolean => std::option::Option::Some("BOOLEAN"),
456                Self::Record => std::option::Option::Some("RECORD"),
457                Self::PlusPage => std::option::Option::Some("PLUS_PAGE"),
458                Self::List => std::option::Option::Some("LIST"),
459                Self::UnknownValue(u) => u.0.name(),
460            }
461        }
462    }
463
464    impl std::default::Default for Type {
465        fn default() -> Self {
466            use std::convert::From;
467            Self::from(0)
468        }
469    }
470
471    impl std::fmt::Display for Type {
472        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
473            wkt::internal::display_enum(f, self.name(), self.value())
474        }
475    }
476
477    impl std::convert::From<i32> for Type {
478        fn from(value: i32) -> Self {
479            match value {
480                0 => Self::Unspecified,
481                1 => Self::String,
482                2 => Self::Integer,
483                3 => Self::Double,
484                4 => Self::Boolean,
485                5 => Self::Record,
486                6 => Self::PlusPage,
487                7 => Self::List,
488                _ => Self::UnknownValue(r#type::UnknownValue(
489                    wkt::internal::UnknownEnumValue::Integer(value),
490                )),
491            }
492        }
493    }
494
495    impl std::convert::From<&str> for Type {
496        fn from(value: &str) -> Self {
497            use std::string::ToString;
498            match value {
499                "TYPE_UNSPECIFIED" => Self::Unspecified,
500                "STRING" => Self::String,
501                "INTEGER" => Self::Integer,
502                "DOUBLE" => Self::Double,
503                "BOOLEAN" => Self::Boolean,
504                "RECORD" => Self::Record,
505                "PLUS_PAGE" => Self::PlusPage,
506                "LIST" => Self::List,
507                _ => Self::UnknownValue(r#type::UnknownValue(
508                    wkt::internal::UnknownEnumValue::String(value.to_string()),
509                )),
510            }
511        }
512    }
513
514    impl serde::ser::Serialize for Type {
515        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
516        where
517            S: serde::Serializer,
518        {
519            match self {
520                Self::Unspecified => serializer.serialize_i32(0),
521                Self::String => serializer.serialize_i32(1),
522                Self::Integer => serializer.serialize_i32(2),
523                Self::Double => serializer.serialize_i32(3),
524                Self::Boolean => serializer.serialize_i32(4),
525                Self::Record => serializer.serialize_i32(5),
526                Self::PlusPage => serializer.serialize_i32(6),
527                Self::List => serializer.serialize_i32(7),
528                Self::UnknownValue(u) => u.0.serialize(serializer),
529            }
530        }
531    }
532
533    impl<'de> serde::de::Deserialize<'de> for Type {
534        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
535        where
536            D: serde::Deserializer<'de>,
537        {
538            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
539                ".google.cloud.bigquery.datatransfer.v1.DataSourceParameter.Type",
540            ))
541        }
542    }
543}
544
545/// Defines the properties and custom parameters for a data source.
546#[derive(Clone, Default, PartialEq)]
547#[non_exhaustive]
548pub struct DataSource {
549    /// Output only. Data source resource name.
550    pub name: std::string::String,
551
552    /// Data source id.
553    pub data_source_id: std::string::String,
554
555    /// User friendly data source name.
556    pub display_name: std::string::String,
557
558    /// User friendly data source description string.
559    pub description: std::string::String,
560
561    /// Data source client id which should be used to receive refresh token.
562    pub client_id: std::string::String,
563
564    /// Api auth scopes for which refresh token needs to be obtained. These are
565    /// scopes needed by a data source to prepare data and ingest them into
566    /// BigQuery, e.g., <https://www.googleapis.com/auth/bigquery>
567    pub scopes: std::vec::Vec<std::string::String>,
568
569    /// Deprecated. This field has no effect.
570    #[deprecated]
571    pub transfer_type: crate::model::TransferType,
572
573    /// Deprecated. This field has no effect.
574    #[deprecated]
575    pub supports_multiple_transfers: bool,
576
577    /// The number of seconds to wait for an update from the data source
578    /// before the Data Transfer Service marks the transfer as FAILED.
579    pub update_deadline_seconds: i32,
580
581    /// Default data transfer schedule.
582    /// Examples of valid schedules include:
583    /// `1st,3rd monday of month 15:30`,
584    /// `every wed,fri of jan,jun 13:15`, and
585    /// `first sunday of quarter 00:00`.
586    pub default_schedule: std::string::String,
587
588    /// Specifies whether the data source supports a user defined schedule, or
589    /// operates on the default schedule.
590    /// When set to `true`, user can override default schedule.
591    pub supports_custom_schedule: bool,
592
593    /// Data source parameters.
594    pub parameters: std::vec::Vec<crate::model::DataSourceParameter>,
595
596    /// Url for the help document for this data source.
597    pub help_url: std::string::String,
598
599    /// Indicates the type of authorization.
600    pub authorization_type: crate::model::data_source::AuthorizationType,
601
602    /// Specifies whether the data source supports automatic data refresh for the
603    /// past few days, and how it's supported.
604    /// For some data sources, data might not be complete until a few days later,
605    /// so it's useful to refresh data automatically.
606    pub data_refresh_type: crate::model::data_source::DataRefreshType,
607
608    /// Default data refresh window on days.
609    /// Only meaningful when `data_refresh_type` = `SLIDING_WINDOW`.
610    pub default_data_refresh_window_days: i32,
611
612    /// Disables backfilling and manual run scheduling
613    /// for the data source.
614    pub manual_runs_disabled: bool,
615
616    /// The minimum interval for scheduler to schedule runs.
617    pub minimum_schedule_interval: std::option::Option<wkt::Duration>,
618
619    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
620}
621
622impl DataSource {
623    pub fn new() -> Self {
624        std::default::Default::default()
625    }
626
627    /// Sets the value of [name][crate::model::DataSource::name].
628    ///
629    /// # Example
630    /// ```ignore,no_run
631    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
632    /// let x = DataSource::new().set_name("example");
633    /// ```
634    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
635        self.name = v.into();
636        self
637    }
638
639    /// Sets the value of [data_source_id][crate::model::DataSource::data_source_id].
640    ///
641    /// # Example
642    /// ```ignore,no_run
643    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
644    /// let x = DataSource::new().set_data_source_id("example");
645    /// ```
646    pub fn set_data_source_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
647        self.data_source_id = v.into();
648        self
649    }
650
651    /// Sets the value of [display_name][crate::model::DataSource::display_name].
652    ///
653    /// # Example
654    /// ```ignore,no_run
655    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
656    /// let x = DataSource::new().set_display_name("example");
657    /// ```
658    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
659        self.display_name = v.into();
660        self
661    }
662
663    /// Sets the value of [description][crate::model::DataSource::description].
664    ///
665    /// # Example
666    /// ```ignore,no_run
667    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
668    /// let x = DataSource::new().set_description("example");
669    /// ```
670    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
671        self.description = v.into();
672        self
673    }
674
675    /// Sets the value of [client_id][crate::model::DataSource::client_id].
676    ///
677    /// # Example
678    /// ```ignore,no_run
679    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
680    /// let x = DataSource::new().set_client_id("example");
681    /// ```
682    pub fn set_client_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
683        self.client_id = v.into();
684        self
685    }
686
687    /// Sets the value of [scopes][crate::model::DataSource::scopes].
688    ///
689    /// # Example
690    /// ```ignore,no_run
691    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
692    /// let x = DataSource::new().set_scopes(["a", "b", "c"]);
693    /// ```
694    pub fn set_scopes<T, V>(mut self, v: T) -> Self
695    where
696        T: std::iter::IntoIterator<Item = V>,
697        V: std::convert::Into<std::string::String>,
698    {
699        use std::iter::Iterator;
700        self.scopes = v.into_iter().map(|i| i.into()).collect();
701        self
702    }
703
704    /// Sets the value of [transfer_type][crate::model::DataSource::transfer_type].
705    ///
706    /// # Example
707    /// ```ignore,no_run
708    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
709    /// use google_cloud_bigquery_datatransfer_v1::model::TransferType;
710    /// let x0 = DataSource::new().set_transfer_type(TransferType::Batch);
711    /// let x1 = DataSource::new().set_transfer_type(TransferType::Streaming);
712    /// ```
713    #[deprecated]
714    pub fn set_transfer_type<T: std::convert::Into<crate::model::TransferType>>(
715        mut self,
716        v: T,
717    ) -> Self {
718        self.transfer_type = v.into();
719        self
720    }
721
722    /// Sets the value of [supports_multiple_transfers][crate::model::DataSource::supports_multiple_transfers].
723    ///
724    /// # Example
725    /// ```ignore,no_run
726    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
727    /// let x = DataSource::new().set_supports_multiple_transfers(true);
728    /// ```
729    #[deprecated]
730    pub fn set_supports_multiple_transfers<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
731        self.supports_multiple_transfers = v.into();
732        self
733    }
734
735    /// Sets the value of [update_deadline_seconds][crate::model::DataSource::update_deadline_seconds].
736    ///
737    /// # Example
738    /// ```ignore,no_run
739    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
740    /// let x = DataSource::new().set_update_deadline_seconds(42);
741    /// ```
742    pub fn set_update_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
743        self.update_deadline_seconds = v.into();
744        self
745    }
746
747    /// Sets the value of [default_schedule][crate::model::DataSource::default_schedule].
748    ///
749    /// # Example
750    /// ```ignore,no_run
751    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
752    /// let x = DataSource::new().set_default_schedule("example");
753    /// ```
754    pub fn set_default_schedule<T: std::convert::Into<std::string::String>>(
755        mut self,
756        v: T,
757    ) -> Self {
758        self.default_schedule = v.into();
759        self
760    }
761
762    /// Sets the value of [supports_custom_schedule][crate::model::DataSource::supports_custom_schedule].
763    ///
764    /// # Example
765    /// ```ignore,no_run
766    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
767    /// let x = DataSource::new().set_supports_custom_schedule(true);
768    /// ```
769    pub fn set_supports_custom_schedule<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
770        self.supports_custom_schedule = v.into();
771        self
772    }
773
774    /// Sets the value of [parameters][crate::model::DataSource::parameters].
775    ///
776    /// # Example
777    /// ```ignore,no_run
778    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
779    /// use google_cloud_bigquery_datatransfer_v1::model::DataSourceParameter;
780    /// let x = DataSource::new()
781    ///     .set_parameters([
782    ///         DataSourceParameter::default()/* use setters */,
783    ///         DataSourceParameter::default()/* use (different) setters */,
784    ///     ]);
785    /// ```
786    pub fn set_parameters<T, V>(mut self, v: T) -> Self
787    where
788        T: std::iter::IntoIterator<Item = V>,
789        V: std::convert::Into<crate::model::DataSourceParameter>,
790    {
791        use std::iter::Iterator;
792        self.parameters = v.into_iter().map(|i| i.into()).collect();
793        self
794    }
795
796    /// Sets the value of [help_url][crate::model::DataSource::help_url].
797    ///
798    /// # Example
799    /// ```ignore,no_run
800    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
801    /// let x = DataSource::new().set_help_url("example");
802    /// ```
803    pub fn set_help_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
804        self.help_url = v.into();
805        self
806    }
807
808    /// Sets the value of [authorization_type][crate::model::DataSource::authorization_type].
809    ///
810    /// # Example
811    /// ```ignore,no_run
812    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
813    /// use google_cloud_bigquery_datatransfer_v1::model::data_source::AuthorizationType;
814    /// let x0 = DataSource::new().set_authorization_type(AuthorizationType::AuthorizationCode);
815    /// let x1 = DataSource::new().set_authorization_type(AuthorizationType::GooglePlusAuthorizationCode);
816    /// let x2 = DataSource::new().set_authorization_type(AuthorizationType::FirstPartyOauth);
817    /// ```
818    pub fn set_authorization_type<
819        T: std::convert::Into<crate::model::data_source::AuthorizationType>,
820    >(
821        mut self,
822        v: T,
823    ) -> Self {
824        self.authorization_type = v.into();
825        self
826    }
827
828    /// Sets the value of [data_refresh_type][crate::model::DataSource::data_refresh_type].
829    ///
830    /// # Example
831    /// ```ignore,no_run
832    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
833    /// use google_cloud_bigquery_datatransfer_v1::model::data_source::DataRefreshType;
834    /// let x0 = DataSource::new().set_data_refresh_type(DataRefreshType::SlidingWindow);
835    /// let x1 = DataSource::new().set_data_refresh_type(DataRefreshType::CustomSlidingWindow);
836    /// ```
837    pub fn set_data_refresh_type<
838        T: std::convert::Into<crate::model::data_source::DataRefreshType>,
839    >(
840        mut self,
841        v: T,
842    ) -> Self {
843        self.data_refresh_type = v.into();
844        self
845    }
846
847    /// Sets the value of [default_data_refresh_window_days][crate::model::DataSource::default_data_refresh_window_days].
848    ///
849    /// # Example
850    /// ```ignore,no_run
851    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
852    /// let x = DataSource::new().set_default_data_refresh_window_days(42);
853    /// ```
854    pub fn set_default_data_refresh_window_days<T: std::convert::Into<i32>>(
855        mut self,
856        v: T,
857    ) -> Self {
858        self.default_data_refresh_window_days = v.into();
859        self
860    }
861
862    /// Sets the value of [manual_runs_disabled][crate::model::DataSource::manual_runs_disabled].
863    ///
864    /// # Example
865    /// ```ignore,no_run
866    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
867    /// let x = DataSource::new().set_manual_runs_disabled(true);
868    /// ```
869    pub fn set_manual_runs_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
870        self.manual_runs_disabled = v.into();
871        self
872    }
873
874    /// Sets the value of [minimum_schedule_interval][crate::model::DataSource::minimum_schedule_interval].
875    ///
876    /// # Example
877    /// ```ignore,no_run
878    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
879    /// use wkt::Duration;
880    /// let x = DataSource::new().set_minimum_schedule_interval(Duration::default()/* use setters */);
881    /// ```
882    pub fn set_minimum_schedule_interval<T>(mut self, v: T) -> Self
883    where
884        T: std::convert::Into<wkt::Duration>,
885    {
886        self.minimum_schedule_interval = std::option::Option::Some(v.into());
887        self
888    }
889
890    /// Sets or clears the value of [minimum_schedule_interval][crate::model::DataSource::minimum_schedule_interval].
891    ///
892    /// # Example
893    /// ```ignore,no_run
894    /// # use google_cloud_bigquery_datatransfer_v1::model::DataSource;
895    /// use wkt::Duration;
896    /// let x = DataSource::new().set_or_clear_minimum_schedule_interval(Some(Duration::default()/* use setters */));
897    /// let x = DataSource::new().set_or_clear_minimum_schedule_interval(None::<Duration>);
898    /// ```
899    pub fn set_or_clear_minimum_schedule_interval<T>(mut self, v: std::option::Option<T>) -> Self
900    where
901        T: std::convert::Into<wkt::Duration>,
902    {
903        self.minimum_schedule_interval = v.map(|x| x.into());
904        self
905    }
906}
907
908impl wkt::message::Message for DataSource {
909    fn typename() -> &'static str {
910        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DataSource"
911    }
912}
913
914/// Defines additional types related to [DataSource].
915pub mod data_source {
916    #[allow(unused_imports)]
917    use super::*;
918
919    /// The type of authorization needed for this data source.
920    ///
921    /// # Working with unknown values
922    ///
923    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
924    /// additional enum variants at any time. Adding new variants is not considered
925    /// a breaking change. Applications should write their code in anticipation of:
926    ///
927    /// - New values appearing in future releases of the client library, **and**
928    /// - New values received dynamically, without application changes.
929    ///
930    /// Please consult the [Working with enums] section in the user guide for some
931    /// guidelines.
932    ///
933    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
934    #[derive(Clone, Debug, PartialEq)]
935    #[non_exhaustive]
936    pub enum AuthorizationType {
937        /// Type unspecified.
938        Unspecified,
939        /// Use OAuth 2 authorization codes that can be exchanged
940        /// for a refresh token on the backend.
941        AuthorizationCode,
942        /// Return an authorization code for a given Google+ page that can then be
943        /// exchanged for a refresh token on the backend.
944        GooglePlusAuthorizationCode,
945        /// Use First Party OAuth.
946        FirstPartyOauth,
947        /// If set, the enum was initialized with an unknown value.
948        ///
949        /// Applications can examine the value using [AuthorizationType::value] or
950        /// [AuthorizationType::name].
951        UnknownValue(authorization_type::UnknownValue),
952    }
953
954    #[doc(hidden)]
955    pub mod authorization_type {
956        #[allow(unused_imports)]
957        use super::*;
958        #[derive(Clone, Debug, PartialEq)]
959        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
960    }
961
962    impl AuthorizationType {
963        /// Gets the enum value.
964        ///
965        /// Returns `None` if the enum contains an unknown value deserialized from
966        /// the string representation of enums.
967        pub fn value(&self) -> std::option::Option<i32> {
968            match self {
969                Self::Unspecified => std::option::Option::Some(0),
970                Self::AuthorizationCode => std::option::Option::Some(1),
971                Self::GooglePlusAuthorizationCode => std::option::Option::Some(2),
972                Self::FirstPartyOauth => std::option::Option::Some(3),
973                Self::UnknownValue(u) => u.0.value(),
974            }
975        }
976
977        /// Gets the enum value as a string.
978        ///
979        /// Returns `None` if the enum contains an unknown value deserialized from
980        /// the integer representation of enums.
981        pub fn name(&self) -> std::option::Option<&str> {
982            match self {
983                Self::Unspecified => std::option::Option::Some("AUTHORIZATION_TYPE_UNSPECIFIED"),
984                Self::AuthorizationCode => std::option::Option::Some("AUTHORIZATION_CODE"),
985                Self::GooglePlusAuthorizationCode => {
986                    std::option::Option::Some("GOOGLE_PLUS_AUTHORIZATION_CODE")
987                }
988                Self::FirstPartyOauth => std::option::Option::Some("FIRST_PARTY_OAUTH"),
989                Self::UnknownValue(u) => u.0.name(),
990            }
991        }
992    }
993
994    impl std::default::Default for AuthorizationType {
995        fn default() -> Self {
996            use std::convert::From;
997            Self::from(0)
998        }
999    }
1000
1001    impl std::fmt::Display for AuthorizationType {
1002        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1003            wkt::internal::display_enum(f, self.name(), self.value())
1004        }
1005    }
1006
1007    impl std::convert::From<i32> for AuthorizationType {
1008        fn from(value: i32) -> Self {
1009            match value {
1010                0 => Self::Unspecified,
1011                1 => Self::AuthorizationCode,
1012                2 => Self::GooglePlusAuthorizationCode,
1013                3 => Self::FirstPartyOauth,
1014                _ => Self::UnknownValue(authorization_type::UnknownValue(
1015                    wkt::internal::UnknownEnumValue::Integer(value),
1016                )),
1017            }
1018        }
1019    }
1020
1021    impl std::convert::From<&str> for AuthorizationType {
1022        fn from(value: &str) -> Self {
1023            use std::string::ToString;
1024            match value {
1025                "AUTHORIZATION_TYPE_UNSPECIFIED" => Self::Unspecified,
1026                "AUTHORIZATION_CODE" => Self::AuthorizationCode,
1027                "GOOGLE_PLUS_AUTHORIZATION_CODE" => Self::GooglePlusAuthorizationCode,
1028                "FIRST_PARTY_OAUTH" => Self::FirstPartyOauth,
1029                _ => Self::UnknownValue(authorization_type::UnknownValue(
1030                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1031                )),
1032            }
1033        }
1034    }
1035
1036    impl serde::ser::Serialize for AuthorizationType {
1037        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1038        where
1039            S: serde::Serializer,
1040        {
1041            match self {
1042                Self::Unspecified => serializer.serialize_i32(0),
1043                Self::AuthorizationCode => serializer.serialize_i32(1),
1044                Self::GooglePlusAuthorizationCode => serializer.serialize_i32(2),
1045                Self::FirstPartyOauth => serializer.serialize_i32(3),
1046                Self::UnknownValue(u) => u.0.serialize(serializer),
1047            }
1048        }
1049    }
1050
1051    impl<'de> serde::de::Deserialize<'de> for AuthorizationType {
1052        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1053        where
1054            D: serde::Deserializer<'de>,
1055        {
1056            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthorizationType>::new(
1057                ".google.cloud.bigquery.datatransfer.v1.DataSource.AuthorizationType",
1058            ))
1059        }
1060    }
1061
1062    /// Represents how the data source supports data auto refresh.
1063    ///
1064    /// # Working with unknown values
1065    ///
1066    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1067    /// additional enum variants at any time. Adding new variants is not considered
1068    /// a breaking change. Applications should write their code in anticipation of:
1069    ///
1070    /// - New values appearing in future releases of the client library, **and**
1071    /// - New values received dynamically, without application changes.
1072    ///
1073    /// Please consult the [Working with enums] section in the user guide for some
1074    /// guidelines.
1075    ///
1076    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1077    #[derive(Clone, Debug, PartialEq)]
1078    #[non_exhaustive]
1079    pub enum DataRefreshType {
1080        /// The data source won't support data auto refresh, which is default value.
1081        Unspecified,
1082        /// The data source supports data auto refresh, and runs will be scheduled
1083        /// for the past few days. Does not allow custom values to be set for each
1084        /// transfer config.
1085        SlidingWindow,
1086        /// The data source supports data auto refresh, and runs will be scheduled
1087        /// for the past few days. Allows custom values to be set for each transfer
1088        /// config.
1089        CustomSlidingWindow,
1090        /// If set, the enum was initialized with an unknown value.
1091        ///
1092        /// Applications can examine the value using [DataRefreshType::value] or
1093        /// [DataRefreshType::name].
1094        UnknownValue(data_refresh_type::UnknownValue),
1095    }
1096
1097    #[doc(hidden)]
1098    pub mod data_refresh_type {
1099        #[allow(unused_imports)]
1100        use super::*;
1101        #[derive(Clone, Debug, PartialEq)]
1102        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1103    }
1104
1105    impl DataRefreshType {
1106        /// Gets the enum value.
1107        ///
1108        /// Returns `None` if the enum contains an unknown value deserialized from
1109        /// the string representation of enums.
1110        pub fn value(&self) -> std::option::Option<i32> {
1111            match self {
1112                Self::Unspecified => std::option::Option::Some(0),
1113                Self::SlidingWindow => std::option::Option::Some(1),
1114                Self::CustomSlidingWindow => std::option::Option::Some(2),
1115                Self::UnknownValue(u) => u.0.value(),
1116            }
1117        }
1118
1119        /// Gets the enum value as a string.
1120        ///
1121        /// Returns `None` if the enum contains an unknown value deserialized from
1122        /// the integer representation of enums.
1123        pub fn name(&self) -> std::option::Option<&str> {
1124            match self {
1125                Self::Unspecified => std::option::Option::Some("DATA_REFRESH_TYPE_UNSPECIFIED"),
1126                Self::SlidingWindow => std::option::Option::Some("SLIDING_WINDOW"),
1127                Self::CustomSlidingWindow => std::option::Option::Some("CUSTOM_SLIDING_WINDOW"),
1128                Self::UnknownValue(u) => u.0.name(),
1129            }
1130        }
1131    }
1132
1133    impl std::default::Default for DataRefreshType {
1134        fn default() -> Self {
1135            use std::convert::From;
1136            Self::from(0)
1137        }
1138    }
1139
1140    impl std::fmt::Display for DataRefreshType {
1141        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1142            wkt::internal::display_enum(f, self.name(), self.value())
1143        }
1144    }
1145
1146    impl std::convert::From<i32> for DataRefreshType {
1147        fn from(value: i32) -> Self {
1148            match value {
1149                0 => Self::Unspecified,
1150                1 => Self::SlidingWindow,
1151                2 => Self::CustomSlidingWindow,
1152                _ => Self::UnknownValue(data_refresh_type::UnknownValue(
1153                    wkt::internal::UnknownEnumValue::Integer(value),
1154                )),
1155            }
1156        }
1157    }
1158
1159    impl std::convert::From<&str> for DataRefreshType {
1160        fn from(value: &str) -> Self {
1161            use std::string::ToString;
1162            match value {
1163                "DATA_REFRESH_TYPE_UNSPECIFIED" => Self::Unspecified,
1164                "SLIDING_WINDOW" => Self::SlidingWindow,
1165                "CUSTOM_SLIDING_WINDOW" => Self::CustomSlidingWindow,
1166                _ => Self::UnknownValue(data_refresh_type::UnknownValue(
1167                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1168                )),
1169            }
1170        }
1171    }
1172
1173    impl serde::ser::Serialize for DataRefreshType {
1174        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1175        where
1176            S: serde::Serializer,
1177        {
1178            match self {
1179                Self::Unspecified => serializer.serialize_i32(0),
1180                Self::SlidingWindow => serializer.serialize_i32(1),
1181                Self::CustomSlidingWindow => serializer.serialize_i32(2),
1182                Self::UnknownValue(u) => u.0.serialize(serializer),
1183            }
1184        }
1185    }
1186
1187    impl<'de> serde::de::Deserialize<'de> for DataRefreshType {
1188        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1189        where
1190            D: serde::Deserializer<'de>,
1191        {
1192            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataRefreshType>::new(
1193                ".google.cloud.bigquery.datatransfer.v1.DataSource.DataRefreshType",
1194            ))
1195        }
1196    }
1197}
1198
1199/// A request to get data source info.
1200#[derive(Clone, Default, PartialEq)]
1201#[non_exhaustive]
1202pub struct GetDataSourceRequest {
1203    /// Required. The field will contain name of the resource requested, for
1204    /// example: `projects/{project_id}/dataSources/{data_source_id}` or
1205    /// `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
1206    pub name: std::string::String,
1207
1208    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1209}
1210
1211impl GetDataSourceRequest {
1212    pub fn new() -> Self {
1213        std::default::Default::default()
1214    }
1215
1216    /// Sets the value of [name][crate::model::GetDataSourceRequest::name].
1217    ///
1218    /// # Example
1219    /// ```ignore,no_run
1220    /// # use google_cloud_bigquery_datatransfer_v1::model::GetDataSourceRequest;
1221    /// let x = GetDataSourceRequest::new().set_name("example");
1222    /// ```
1223    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1224        self.name = v.into();
1225        self
1226    }
1227}
1228
1229impl wkt::message::Message for GetDataSourceRequest {
1230    fn typename() -> &'static str {
1231        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.GetDataSourceRequest"
1232    }
1233}
1234
1235/// Request to list supported data sources and their data transfer settings.
1236#[derive(Clone, Default, PartialEq)]
1237#[non_exhaustive]
1238pub struct ListDataSourcesRequest {
1239    /// Required. The BigQuery project id for which data sources should be
1240    /// returned. Must be in the form: `projects/{project_id}` or
1241    /// `projects/{project_id}/locations/{location_id}`
1242    pub parent: std::string::String,
1243
1244    /// Pagination token, which can be used to request a specific page
1245    /// of `ListDataSourcesRequest` list results. For multiple-page
1246    /// results, `ListDataSourcesResponse` outputs
1247    /// a `next_page` token, which can be used as the
1248    /// `page_token` value to request the next page of list results.
1249    pub page_token: std::string::String,
1250
1251    /// Page size. The default page size is the maximum value of 1000 results.
1252    pub page_size: i32,
1253
1254    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1255}
1256
1257impl ListDataSourcesRequest {
1258    pub fn new() -> Self {
1259        std::default::Default::default()
1260    }
1261
1262    /// Sets the value of [parent][crate::model::ListDataSourcesRequest::parent].
1263    ///
1264    /// # Example
1265    /// ```ignore,no_run
1266    /// # use google_cloud_bigquery_datatransfer_v1::model::ListDataSourcesRequest;
1267    /// let x = ListDataSourcesRequest::new().set_parent("example");
1268    /// ```
1269    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1270        self.parent = v.into();
1271        self
1272    }
1273
1274    /// Sets the value of [page_token][crate::model::ListDataSourcesRequest::page_token].
1275    ///
1276    /// # Example
1277    /// ```ignore,no_run
1278    /// # use google_cloud_bigquery_datatransfer_v1::model::ListDataSourcesRequest;
1279    /// let x = ListDataSourcesRequest::new().set_page_token("example");
1280    /// ```
1281    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1282        self.page_token = v.into();
1283        self
1284    }
1285
1286    /// Sets the value of [page_size][crate::model::ListDataSourcesRequest::page_size].
1287    ///
1288    /// # Example
1289    /// ```ignore,no_run
1290    /// # use google_cloud_bigquery_datatransfer_v1::model::ListDataSourcesRequest;
1291    /// let x = ListDataSourcesRequest::new().set_page_size(42);
1292    /// ```
1293    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1294        self.page_size = v.into();
1295        self
1296    }
1297}
1298
1299impl wkt::message::Message for ListDataSourcesRequest {
1300    fn typename() -> &'static str {
1301        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListDataSourcesRequest"
1302    }
1303}
1304
1305/// Returns list of supported data sources and their metadata.
1306#[derive(Clone, Default, PartialEq)]
1307#[non_exhaustive]
1308pub struct ListDataSourcesResponse {
1309    /// List of supported data sources and their transfer settings.
1310    pub data_sources: std::vec::Vec<crate::model::DataSource>,
1311
1312    /// Output only. The next-pagination token. For multiple-page list results,
1313    /// this token can be used as the
1314    /// `ListDataSourcesRequest.page_token`
1315    /// to request the next page of list results.
1316    pub next_page_token: std::string::String,
1317
1318    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1319}
1320
1321impl ListDataSourcesResponse {
1322    pub fn new() -> Self {
1323        std::default::Default::default()
1324    }
1325
1326    /// Sets the value of [data_sources][crate::model::ListDataSourcesResponse::data_sources].
1327    ///
1328    /// # Example
1329    /// ```ignore,no_run
1330    /// # use google_cloud_bigquery_datatransfer_v1::model::ListDataSourcesResponse;
1331    /// use google_cloud_bigquery_datatransfer_v1::model::DataSource;
1332    /// let x = ListDataSourcesResponse::new()
1333    ///     .set_data_sources([
1334    ///         DataSource::default()/* use setters */,
1335    ///         DataSource::default()/* use (different) setters */,
1336    ///     ]);
1337    /// ```
1338    pub fn set_data_sources<T, V>(mut self, v: T) -> Self
1339    where
1340        T: std::iter::IntoIterator<Item = V>,
1341        V: std::convert::Into<crate::model::DataSource>,
1342    {
1343        use std::iter::Iterator;
1344        self.data_sources = v.into_iter().map(|i| i.into()).collect();
1345        self
1346    }
1347
1348    /// Sets the value of [next_page_token][crate::model::ListDataSourcesResponse::next_page_token].
1349    ///
1350    /// # Example
1351    /// ```ignore,no_run
1352    /// # use google_cloud_bigquery_datatransfer_v1::model::ListDataSourcesResponse;
1353    /// let x = ListDataSourcesResponse::new().set_next_page_token("example");
1354    /// ```
1355    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1356        self.next_page_token = v.into();
1357        self
1358    }
1359}
1360
1361impl wkt::message::Message for ListDataSourcesResponse {
1362    fn typename() -> &'static str {
1363        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListDataSourcesResponse"
1364    }
1365}
1366
1367#[doc(hidden)]
1368impl gax::paginator::internal::PageableResponse for ListDataSourcesResponse {
1369    type PageItem = crate::model::DataSource;
1370
1371    fn items(self) -> std::vec::Vec<Self::PageItem> {
1372        self.data_sources
1373    }
1374
1375    fn next_page_token(&self) -> std::string::String {
1376        use std::clone::Clone;
1377        self.next_page_token.clone()
1378    }
1379}
1380
1381/// A request to create a data transfer configuration. If new credentials are
1382/// needed for this transfer configuration, authorization info must be provided.
1383/// If authorization info is provided, the transfer configuration will be
1384/// associated with the user id corresponding to the authorization info.
1385/// Otherwise, the transfer configuration will be associated with the calling
1386/// user.
1387///
1388/// When using a cross project service account for creating a transfer config,
1389/// you must enable cross project service account usage. For more information,
1390/// see [Disable attachment of service accounts to resources in other
1391/// projects](https://cloud.google.com/resource-manager/docs/organization-policy/restricting-service-accounts#disable_cross_project_service_accounts).
1392#[derive(Clone, Default, PartialEq)]
1393#[non_exhaustive]
1394pub struct CreateTransferConfigRequest {
1395    /// Required. The BigQuery project id where the transfer configuration should
1396    /// be created. Must be in the format
1397    /// projects/{project_id}/locations/{location_id} or projects/{project_id}. If
1398    /// specified location and location of the destination bigquery dataset do not
1399    /// match - the request will fail.
1400    pub parent: std::string::String,
1401
1402    /// Required. Data transfer configuration to create.
1403    pub transfer_config: std::option::Option<crate::model::TransferConfig>,
1404
1405    /// Deprecated: Authorization code was required when
1406    /// `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used
1407    /// in any data sources. Use `version_info` instead.
1408    ///
1409    /// Optional OAuth2 authorization code to use with this transfer configuration.
1410    /// This is required only if `transferConfig.dataSourceId` is 'youtube_channel'
1411    /// and new credentials are needed, as indicated by `CheckValidCreds`. In order
1412    /// to obtain authorization_code, make a request to the following URL:
1413    ///
1414    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
1415    ///   returned by ListDataSources method.
1416    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
1417    ///   method.
1418    ///
1419    /// Note that this should not be set when `service_account_name` is used to
1420    /// create the transfer config.
1421    #[deprecated]
1422    pub authorization_code: std::string::String,
1423
1424    /// Optional version info. This parameter replaces `authorization_code` which
1425    /// is no longer used in any data sources. This is required only if
1426    /// `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials
1427    /// are needed, as indicated by `CheckValidCreds`. In order to obtain version
1428    /// info, make a request to the following URL:
1429    ///
1430    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
1431    ///   returned by ListDataSources method.
1432    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
1433    ///   method.
1434    ///
1435    /// Note that this should not be set when `service_account_name` is used to
1436    /// create the transfer config.
1437    pub version_info: std::string::String,
1438
1439    /// Optional service account email. If this field is set, the transfer config
1440    /// will be created with this service account's credentials. It requires that
1441    /// the requesting user calling this API has permissions to act as this service
1442    /// account.
1443    ///
1444    /// Note that not all data sources support service account credentials when
1445    /// creating a transfer config. For the latest list of data sources, read about
1446    /// [using service
1447    /// accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
1448    pub service_account_name: std::string::String,
1449
1450    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1451}
1452
1453impl CreateTransferConfigRequest {
1454    pub fn new() -> Self {
1455        std::default::Default::default()
1456    }
1457
1458    /// Sets the value of [parent][crate::model::CreateTransferConfigRequest::parent].
1459    ///
1460    /// # Example
1461    /// ```ignore,no_run
1462    /// # use google_cloud_bigquery_datatransfer_v1::model::CreateTransferConfigRequest;
1463    /// let x = CreateTransferConfigRequest::new().set_parent("example");
1464    /// ```
1465    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1466        self.parent = v.into();
1467        self
1468    }
1469
1470    /// Sets the value of [transfer_config][crate::model::CreateTransferConfigRequest::transfer_config].
1471    ///
1472    /// # Example
1473    /// ```ignore,no_run
1474    /// # use google_cloud_bigquery_datatransfer_v1::model::CreateTransferConfigRequest;
1475    /// use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
1476    /// let x = CreateTransferConfigRequest::new().set_transfer_config(TransferConfig::default()/* use setters */);
1477    /// ```
1478    pub fn set_transfer_config<T>(mut self, v: T) -> Self
1479    where
1480        T: std::convert::Into<crate::model::TransferConfig>,
1481    {
1482        self.transfer_config = std::option::Option::Some(v.into());
1483        self
1484    }
1485
1486    /// Sets or clears the value of [transfer_config][crate::model::CreateTransferConfigRequest::transfer_config].
1487    ///
1488    /// # Example
1489    /// ```ignore,no_run
1490    /// # use google_cloud_bigquery_datatransfer_v1::model::CreateTransferConfigRequest;
1491    /// use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
1492    /// let x = CreateTransferConfigRequest::new().set_or_clear_transfer_config(Some(TransferConfig::default()/* use setters */));
1493    /// let x = CreateTransferConfigRequest::new().set_or_clear_transfer_config(None::<TransferConfig>);
1494    /// ```
1495    pub fn set_or_clear_transfer_config<T>(mut self, v: std::option::Option<T>) -> Self
1496    where
1497        T: std::convert::Into<crate::model::TransferConfig>,
1498    {
1499        self.transfer_config = v.map(|x| x.into());
1500        self
1501    }
1502
1503    /// Sets the value of [authorization_code][crate::model::CreateTransferConfigRequest::authorization_code].
1504    ///
1505    /// # Example
1506    /// ```ignore,no_run
1507    /// # use google_cloud_bigquery_datatransfer_v1::model::CreateTransferConfigRequest;
1508    /// let x = CreateTransferConfigRequest::new().set_authorization_code("example");
1509    /// ```
1510    #[deprecated]
1511    pub fn set_authorization_code<T: std::convert::Into<std::string::String>>(
1512        mut self,
1513        v: T,
1514    ) -> Self {
1515        self.authorization_code = v.into();
1516        self
1517    }
1518
1519    /// Sets the value of [version_info][crate::model::CreateTransferConfigRequest::version_info].
1520    ///
1521    /// # Example
1522    /// ```ignore,no_run
1523    /// # use google_cloud_bigquery_datatransfer_v1::model::CreateTransferConfigRequest;
1524    /// let x = CreateTransferConfigRequest::new().set_version_info("example");
1525    /// ```
1526    pub fn set_version_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1527        self.version_info = v.into();
1528        self
1529    }
1530
1531    /// Sets the value of [service_account_name][crate::model::CreateTransferConfigRequest::service_account_name].
1532    ///
1533    /// # Example
1534    /// ```ignore,no_run
1535    /// # use google_cloud_bigquery_datatransfer_v1::model::CreateTransferConfigRequest;
1536    /// let x = CreateTransferConfigRequest::new().set_service_account_name("example");
1537    /// ```
1538    pub fn set_service_account_name<T: std::convert::Into<std::string::String>>(
1539        mut self,
1540        v: T,
1541    ) -> Self {
1542        self.service_account_name = v.into();
1543        self
1544    }
1545}
1546
1547impl wkt::message::Message for CreateTransferConfigRequest {
1548    fn typename() -> &'static str {
1549        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest"
1550    }
1551}
1552
1553/// A request to update a transfer configuration. To update the user id of the
1554/// transfer configuration, authorization info needs to be provided.
1555///
1556/// When using a cross project service account for updating a transfer config,
1557/// you must enable cross project service account usage. For more information,
1558/// see [Disable attachment of service accounts to resources in other
1559/// projects](https://cloud.google.com/resource-manager/docs/organization-policy/restricting-service-accounts#disable_cross_project_service_accounts).
1560#[derive(Clone, Default, PartialEq)]
1561#[non_exhaustive]
1562pub struct UpdateTransferConfigRequest {
1563    /// Required. Data transfer configuration to create.
1564    pub transfer_config: std::option::Option<crate::model::TransferConfig>,
1565
1566    /// Deprecated: Authorization code was required when
1567    /// `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used
1568    /// in any data sources. Use `version_info` instead.
1569    ///
1570    /// Optional OAuth2 authorization code to use with this transfer configuration.
1571    /// This is required only if `transferConfig.dataSourceId` is 'youtube_channel'
1572    /// and new credentials are needed, as indicated by `CheckValidCreds`. In order
1573    /// to obtain authorization_code, make a request to the following URL:
1574    ///
1575    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
1576    ///   returned by ListDataSources method.
1577    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
1578    ///   method.
1579    ///
1580    /// Note that this should not be set when `service_account_name` is used to
1581    /// update the transfer config.
1582    #[deprecated]
1583    pub authorization_code: std::string::String,
1584
1585    /// Required. Required list of fields to be updated in this request.
1586    pub update_mask: std::option::Option<wkt::FieldMask>,
1587
1588    /// Optional version info. This parameter replaces `authorization_code` which
1589    /// is no longer used in any data sources. This is required only if
1590    /// `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials
1591    /// are needed, as indicated by `CheckValidCreds`. In order to obtain version
1592    /// info, make a request to the following URL:
1593    ///
1594    /// * The \<var\>client_id\</var\> is the OAuth client_id of the data source as
1595    ///   returned by ListDataSources method.
1596    /// * \<var\>data_source_scopes\</var\> are the scopes returned by ListDataSources
1597    ///   method.
1598    ///
1599    /// Note that this should not be set when `service_account_name` is used to
1600    /// update the transfer config.
1601    pub version_info: std::string::String,
1602
1603    /// Optional service account email. If this field is set, the transfer config
1604    /// will be created with this service account's credentials. It requires that
1605    /// the requesting user calling this API has permissions to act as this service
1606    /// account.
1607    ///
1608    /// Note that not all data sources support service account credentials when
1609    /// creating a transfer config. For the latest list of data sources, read about
1610    /// [using service
1611    /// accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
1612    pub service_account_name: std::string::String,
1613
1614    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1615}
1616
1617impl UpdateTransferConfigRequest {
1618    pub fn new() -> Self {
1619        std::default::Default::default()
1620    }
1621
1622    /// Sets the value of [transfer_config][crate::model::UpdateTransferConfigRequest::transfer_config].
1623    ///
1624    /// # Example
1625    /// ```ignore,no_run
1626    /// # use google_cloud_bigquery_datatransfer_v1::model::UpdateTransferConfigRequest;
1627    /// use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
1628    /// let x = UpdateTransferConfigRequest::new().set_transfer_config(TransferConfig::default()/* use setters */);
1629    /// ```
1630    pub fn set_transfer_config<T>(mut self, v: T) -> Self
1631    where
1632        T: std::convert::Into<crate::model::TransferConfig>,
1633    {
1634        self.transfer_config = std::option::Option::Some(v.into());
1635        self
1636    }
1637
1638    /// Sets or clears the value of [transfer_config][crate::model::UpdateTransferConfigRequest::transfer_config].
1639    ///
1640    /// # Example
1641    /// ```ignore,no_run
1642    /// # use google_cloud_bigquery_datatransfer_v1::model::UpdateTransferConfigRequest;
1643    /// use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
1644    /// let x = UpdateTransferConfigRequest::new().set_or_clear_transfer_config(Some(TransferConfig::default()/* use setters */));
1645    /// let x = UpdateTransferConfigRequest::new().set_or_clear_transfer_config(None::<TransferConfig>);
1646    /// ```
1647    pub fn set_or_clear_transfer_config<T>(mut self, v: std::option::Option<T>) -> Self
1648    where
1649        T: std::convert::Into<crate::model::TransferConfig>,
1650    {
1651        self.transfer_config = v.map(|x| x.into());
1652        self
1653    }
1654
1655    /// Sets the value of [authorization_code][crate::model::UpdateTransferConfigRequest::authorization_code].
1656    ///
1657    /// # Example
1658    /// ```ignore,no_run
1659    /// # use google_cloud_bigquery_datatransfer_v1::model::UpdateTransferConfigRequest;
1660    /// let x = UpdateTransferConfigRequest::new().set_authorization_code("example");
1661    /// ```
1662    #[deprecated]
1663    pub fn set_authorization_code<T: std::convert::Into<std::string::String>>(
1664        mut self,
1665        v: T,
1666    ) -> Self {
1667        self.authorization_code = v.into();
1668        self
1669    }
1670
1671    /// Sets the value of [update_mask][crate::model::UpdateTransferConfigRequest::update_mask].
1672    ///
1673    /// # Example
1674    /// ```ignore,no_run
1675    /// # use google_cloud_bigquery_datatransfer_v1::model::UpdateTransferConfigRequest;
1676    /// use wkt::FieldMask;
1677    /// let x = UpdateTransferConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1678    /// ```
1679    pub fn set_update_mask<T>(mut self, v: T) -> Self
1680    where
1681        T: std::convert::Into<wkt::FieldMask>,
1682    {
1683        self.update_mask = std::option::Option::Some(v.into());
1684        self
1685    }
1686
1687    /// Sets or clears the value of [update_mask][crate::model::UpdateTransferConfigRequest::update_mask].
1688    ///
1689    /// # Example
1690    /// ```ignore,no_run
1691    /// # use google_cloud_bigquery_datatransfer_v1::model::UpdateTransferConfigRequest;
1692    /// use wkt::FieldMask;
1693    /// let x = UpdateTransferConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1694    /// let x = UpdateTransferConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1695    /// ```
1696    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1697    where
1698        T: std::convert::Into<wkt::FieldMask>,
1699    {
1700        self.update_mask = v.map(|x| x.into());
1701        self
1702    }
1703
1704    /// Sets the value of [version_info][crate::model::UpdateTransferConfigRequest::version_info].
1705    ///
1706    /// # Example
1707    /// ```ignore,no_run
1708    /// # use google_cloud_bigquery_datatransfer_v1::model::UpdateTransferConfigRequest;
1709    /// let x = UpdateTransferConfigRequest::new().set_version_info("example");
1710    /// ```
1711    pub fn set_version_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1712        self.version_info = v.into();
1713        self
1714    }
1715
1716    /// Sets the value of [service_account_name][crate::model::UpdateTransferConfigRequest::service_account_name].
1717    ///
1718    /// # Example
1719    /// ```ignore,no_run
1720    /// # use google_cloud_bigquery_datatransfer_v1::model::UpdateTransferConfigRequest;
1721    /// let x = UpdateTransferConfigRequest::new().set_service_account_name("example");
1722    /// ```
1723    pub fn set_service_account_name<T: std::convert::Into<std::string::String>>(
1724        mut self,
1725        v: T,
1726    ) -> Self {
1727        self.service_account_name = v.into();
1728        self
1729    }
1730}
1731
1732impl wkt::message::Message for UpdateTransferConfigRequest {
1733    fn typename() -> &'static str {
1734        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest"
1735    }
1736}
1737
1738/// A request to get data transfer information.
1739#[derive(Clone, Default, PartialEq)]
1740#[non_exhaustive]
1741pub struct GetTransferConfigRequest {
1742    /// Required. The field will contain name of the resource requested, for
1743    /// example: `projects/{project_id}/transferConfigs/{config_id}` or
1744    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1745    pub name: std::string::String,
1746
1747    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1748}
1749
1750impl GetTransferConfigRequest {
1751    pub fn new() -> Self {
1752        std::default::Default::default()
1753    }
1754
1755    /// Sets the value of [name][crate::model::GetTransferConfigRequest::name].
1756    ///
1757    /// # Example
1758    /// ```ignore,no_run
1759    /// # use google_cloud_bigquery_datatransfer_v1::model::GetTransferConfigRequest;
1760    /// let x = GetTransferConfigRequest::new().set_name("example");
1761    /// ```
1762    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1763        self.name = v.into();
1764        self
1765    }
1766}
1767
1768impl wkt::message::Message for GetTransferConfigRequest {
1769    fn typename() -> &'static str {
1770        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.GetTransferConfigRequest"
1771    }
1772}
1773
1774/// A request to delete data transfer information. All associated transfer runs
1775/// and log messages will be deleted as well.
1776#[derive(Clone, Default, PartialEq)]
1777#[non_exhaustive]
1778pub struct DeleteTransferConfigRequest {
1779    /// Required. The field will contain name of the resource requested, for
1780    /// example: `projects/{project_id}/transferConfigs/{config_id}` or
1781    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1782    pub name: std::string::String,
1783
1784    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1785}
1786
1787impl DeleteTransferConfigRequest {
1788    pub fn new() -> Self {
1789        std::default::Default::default()
1790    }
1791
1792    /// Sets the value of [name][crate::model::DeleteTransferConfigRequest::name].
1793    ///
1794    /// # Example
1795    /// ```ignore,no_run
1796    /// # use google_cloud_bigquery_datatransfer_v1::model::DeleteTransferConfigRequest;
1797    /// let x = DeleteTransferConfigRequest::new().set_name("example");
1798    /// ```
1799    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1800        self.name = v.into();
1801        self
1802    }
1803}
1804
1805impl wkt::message::Message for DeleteTransferConfigRequest {
1806    fn typename() -> &'static str {
1807        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DeleteTransferConfigRequest"
1808    }
1809}
1810
1811/// A request to get data transfer run information.
1812#[derive(Clone, Default, PartialEq)]
1813#[non_exhaustive]
1814pub struct GetTransferRunRequest {
1815    /// Required. The field will contain name of the resource requested, for
1816    /// example: `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`
1817    /// or
1818    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1819    pub name: std::string::String,
1820
1821    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1822}
1823
1824impl GetTransferRunRequest {
1825    pub fn new() -> Self {
1826        std::default::Default::default()
1827    }
1828
1829    /// Sets the value of [name][crate::model::GetTransferRunRequest::name].
1830    ///
1831    /// # Example
1832    /// ```ignore,no_run
1833    /// # use google_cloud_bigquery_datatransfer_v1::model::GetTransferRunRequest;
1834    /// let x = GetTransferRunRequest::new().set_name("example");
1835    /// ```
1836    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1837        self.name = v.into();
1838        self
1839    }
1840}
1841
1842impl wkt::message::Message for GetTransferRunRequest {
1843    fn typename() -> &'static str {
1844        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.GetTransferRunRequest"
1845    }
1846}
1847
1848/// A request to delete data transfer run information.
1849#[derive(Clone, Default, PartialEq)]
1850#[non_exhaustive]
1851pub struct DeleteTransferRunRequest {
1852    /// Required. The field will contain name of the resource requested, for
1853    /// example: `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}`
1854    /// or
1855    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1856    pub name: std::string::String,
1857
1858    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1859}
1860
1861impl DeleteTransferRunRequest {
1862    pub fn new() -> Self {
1863        std::default::Default::default()
1864    }
1865
1866    /// Sets the value of [name][crate::model::DeleteTransferRunRequest::name].
1867    ///
1868    /// # Example
1869    /// ```ignore,no_run
1870    /// # use google_cloud_bigquery_datatransfer_v1::model::DeleteTransferRunRequest;
1871    /// let x = DeleteTransferRunRequest::new().set_name("example");
1872    /// ```
1873    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1874        self.name = v.into();
1875        self
1876    }
1877}
1878
1879impl wkt::message::Message for DeleteTransferRunRequest {
1880    fn typename() -> &'static str {
1881        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.DeleteTransferRunRequest"
1882    }
1883}
1884
1885/// A request to list data transfers configured for a BigQuery project.
1886#[derive(Clone, Default, PartialEq)]
1887#[non_exhaustive]
1888pub struct ListTransferConfigsRequest {
1889    /// Required. The BigQuery project id for which transfer configs
1890    /// should be returned: `projects/{project_id}` or
1891    /// `projects/{project_id}/locations/{location_id}`
1892    pub parent: std::string::String,
1893
1894    /// When specified, only configurations of requested data sources are returned.
1895    pub data_source_ids: std::vec::Vec<std::string::String>,
1896
1897    /// Pagination token, which can be used to request a specific page
1898    /// of `ListTransfersRequest` list results. For multiple-page
1899    /// results, `ListTransfersResponse` outputs
1900    /// a `next_page` token, which can be used as the
1901    /// `page_token` value to request the next page of list results.
1902    pub page_token: std::string::String,
1903
1904    /// Page size. The default page size is the maximum value of 1000 results.
1905    pub page_size: i32,
1906
1907    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1908}
1909
1910impl ListTransferConfigsRequest {
1911    pub fn new() -> Self {
1912        std::default::Default::default()
1913    }
1914
1915    /// Sets the value of [parent][crate::model::ListTransferConfigsRequest::parent].
1916    ///
1917    /// # Example
1918    /// ```ignore,no_run
1919    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferConfigsRequest;
1920    /// let x = ListTransferConfigsRequest::new().set_parent("example");
1921    /// ```
1922    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1923        self.parent = v.into();
1924        self
1925    }
1926
1927    /// Sets the value of [data_source_ids][crate::model::ListTransferConfigsRequest::data_source_ids].
1928    ///
1929    /// # Example
1930    /// ```ignore,no_run
1931    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferConfigsRequest;
1932    /// let x = ListTransferConfigsRequest::new().set_data_source_ids(["a", "b", "c"]);
1933    /// ```
1934    pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
1935    where
1936        T: std::iter::IntoIterator<Item = V>,
1937        V: std::convert::Into<std::string::String>,
1938    {
1939        use std::iter::Iterator;
1940        self.data_source_ids = v.into_iter().map(|i| i.into()).collect();
1941        self
1942    }
1943
1944    /// Sets the value of [page_token][crate::model::ListTransferConfigsRequest::page_token].
1945    ///
1946    /// # Example
1947    /// ```ignore,no_run
1948    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferConfigsRequest;
1949    /// let x = ListTransferConfigsRequest::new().set_page_token("example");
1950    /// ```
1951    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1952        self.page_token = v.into();
1953        self
1954    }
1955
1956    /// Sets the value of [page_size][crate::model::ListTransferConfigsRequest::page_size].
1957    ///
1958    /// # Example
1959    /// ```ignore,no_run
1960    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferConfigsRequest;
1961    /// let x = ListTransferConfigsRequest::new().set_page_size(42);
1962    /// ```
1963    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1964        self.page_size = v.into();
1965        self
1966    }
1967}
1968
1969impl wkt::message::Message for ListTransferConfigsRequest {
1970    fn typename() -> &'static str {
1971        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferConfigsRequest"
1972    }
1973}
1974
1975/// The returned list of pipelines in the project.
1976#[derive(Clone, Default, PartialEq)]
1977#[non_exhaustive]
1978pub struct ListTransferConfigsResponse {
1979    /// Output only. The stored pipeline transfer configurations.
1980    pub transfer_configs: std::vec::Vec<crate::model::TransferConfig>,
1981
1982    /// Output only. The next-pagination token. For multiple-page list results,
1983    /// this token can be used as the
1984    /// `ListTransferConfigsRequest.page_token`
1985    /// to request the next page of list results.
1986    pub next_page_token: std::string::String,
1987
1988    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1989}
1990
1991impl ListTransferConfigsResponse {
1992    pub fn new() -> Self {
1993        std::default::Default::default()
1994    }
1995
1996    /// Sets the value of [transfer_configs][crate::model::ListTransferConfigsResponse::transfer_configs].
1997    ///
1998    /// # Example
1999    /// ```ignore,no_run
2000    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferConfigsResponse;
2001    /// use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
2002    /// let x = ListTransferConfigsResponse::new()
2003    ///     .set_transfer_configs([
2004    ///         TransferConfig::default()/* use setters */,
2005    ///         TransferConfig::default()/* use (different) setters */,
2006    ///     ]);
2007    /// ```
2008    pub fn set_transfer_configs<T, V>(mut self, v: T) -> Self
2009    where
2010        T: std::iter::IntoIterator<Item = V>,
2011        V: std::convert::Into<crate::model::TransferConfig>,
2012    {
2013        use std::iter::Iterator;
2014        self.transfer_configs = v.into_iter().map(|i| i.into()).collect();
2015        self
2016    }
2017
2018    /// Sets the value of [next_page_token][crate::model::ListTransferConfigsResponse::next_page_token].
2019    ///
2020    /// # Example
2021    /// ```ignore,no_run
2022    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferConfigsResponse;
2023    /// let x = ListTransferConfigsResponse::new().set_next_page_token("example");
2024    /// ```
2025    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2026        self.next_page_token = v.into();
2027        self
2028    }
2029}
2030
2031impl wkt::message::Message for ListTransferConfigsResponse {
2032    fn typename() -> &'static str {
2033        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferConfigsResponse"
2034    }
2035}
2036
2037#[doc(hidden)]
2038impl gax::paginator::internal::PageableResponse for ListTransferConfigsResponse {
2039    type PageItem = crate::model::TransferConfig;
2040
2041    fn items(self) -> std::vec::Vec<Self::PageItem> {
2042        self.transfer_configs
2043    }
2044
2045    fn next_page_token(&self) -> std::string::String {
2046        use std::clone::Clone;
2047        self.next_page_token.clone()
2048    }
2049}
2050
2051/// A request to list data transfer runs.
2052#[derive(Clone, Default, PartialEq)]
2053#[non_exhaustive]
2054pub struct ListTransferRunsRequest {
2055    /// Required. Name of transfer configuration for which transfer runs should be
2056    /// retrieved. Format of transfer configuration resource name is:
2057    /// `projects/{project_id}/transferConfigs/{config_id}` or
2058    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
2059    pub parent: std::string::String,
2060
2061    /// When specified, only transfer runs with requested states are returned.
2062    pub states: std::vec::Vec<crate::model::TransferState>,
2063
2064    /// Pagination token, which can be used to request a specific page
2065    /// of `ListTransferRunsRequest` list results. For multiple-page
2066    /// results, `ListTransferRunsResponse` outputs
2067    /// a `next_page` token, which can be used as the
2068    /// `page_token` value to request the next page of list results.
2069    pub page_token: std::string::String,
2070
2071    /// Page size. The default page size is the maximum value of 1000 results.
2072    pub page_size: i32,
2073
2074    /// Indicates how run attempts are to be pulled.
2075    pub run_attempt: crate::model::list_transfer_runs_request::RunAttempt,
2076
2077    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2078}
2079
2080impl ListTransferRunsRequest {
2081    pub fn new() -> Self {
2082        std::default::Default::default()
2083    }
2084
2085    /// Sets the value of [parent][crate::model::ListTransferRunsRequest::parent].
2086    ///
2087    /// # Example
2088    /// ```ignore,no_run
2089    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferRunsRequest;
2090    /// let x = ListTransferRunsRequest::new().set_parent("example");
2091    /// ```
2092    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2093        self.parent = v.into();
2094        self
2095    }
2096
2097    /// Sets the value of [states][crate::model::ListTransferRunsRequest::states].
2098    ///
2099    /// # Example
2100    /// ```ignore,no_run
2101    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferRunsRequest;
2102    /// use google_cloud_bigquery_datatransfer_v1::model::TransferState;
2103    /// let x = ListTransferRunsRequest::new().set_states([
2104    ///     TransferState::Pending,
2105    ///     TransferState::Running,
2106    ///     TransferState::Succeeded,
2107    /// ]);
2108    /// ```
2109    pub fn set_states<T, V>(mut self, v: T) -> Self
2110    where
2111        T: std::iter::IntoIterator<Item = V>,
2112        V: std::convert::Into<crate::model::TransferState>,
2113    {
2114        use std::iter::Iterator;
2115        self.states = v.into_iter().map(|i| i.into()).collect();
2116        self
2117    }
2118
2119    /// Sets the value of [page_token][crate::model::ListTransferRunsRequest::page_token].
2120    ///
2121    /// # Example
2122    /// ```ignore,no_run
2123    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferRunsRequest;
2124    /// let x = ListTransferRunsRequest::new().set_page_token("example");
2125    /// ```
2126    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2127        self.page_token = v.into();
2128        self
2129    }
2130
2131    /// Sets the value of [page_size][crate::model::ListTransferRunsRequest::page_size].
2132    ///
2133    /// # Example
2134    /// ```ignore,no_run
2135    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferRunsRequest;
2136    /// let x = ListTransferRunsRequest::new().set_page_size(42);
2137    /// ```
2138    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2139        self.page_size = v.into();
2140        self
2141    }
2142
2143    /// Sets the value of [run_attempt][crate::model::ListTransferRunsRequest::run_attempt].
2144    ///
2145    /// # Example
2146    /// ```ignore,no_run
2147    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferRunsRequest;
2148    /// use google_cloud_bigquery_datatransfer_v1::model::list_transfer_runs_request::RunAttempt;
2149    /// let x0 = ListTransferRunsRequest::new().set_run_attempt(RunAttempt::Latest);
2150    /// ```
2151    pub fn set_run_attempt<
2152        T: std::convert::Into<crate::model::list_transfer_runs_request::RunAttempt>,
2153    >(
2154        mut self,
2155        v: T,
2156    ) -> Self {
2157        self.run_attempt = v.into();
2158        self
2159    }
2160}
2161
2162impl wkt::message::Message for ListTransferRunsRequest {
2163    fn typename() -> &'static str {
2164        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferRunsRequest"
2165    }
2166}
2167
2168/// Defines additional types related to [ListTransferRunsRequest].
2169pub mod list_transfer_runs_request {
2170    #[allow(unused_imports)]
2171    use super::*;
2172
2173    /// Represents which runs should be pulled.
2174    ///
2175    /// # Working with unknown values
2176    ///
2177    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2178    /// additional enum variants at any time. Adding new variants is not considered
2179    /// a breaking change. Applications should write their code in anticipation of:
2180    ///
2181    /// - New values appearing in future releases of the client library, **and**
2182    /// - New values received dynamically, without application changes.
2183    ///
2184    /// Please consult the [Working with enums] section in the user guide for some
2185    /// guidelines.
2186    ///
2187    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2188    #[derive(Clone, Debug, PartialEq)]
2189    #[non_exhaustive]
2190    pub enum RunAttempt {
2191        /// All runs should be returned.
2192        Unspecified,
2193        /// Only latest run per day should be returned.
2194        Latest,
2195        /// If set, the enum was initialized with an unknown value.
2196        ///
2197        /// Applications can examine the value using [RunAttempt::value] or
2198        /// [RunAttempt::name].
2199        UnknownValue(run_attempt::UnknownValue),
2200    }
2201
2202    #[doc(hidden)]
2203    pub mod run_attempt {
2204        #[allow(unused_imports)]
2205        use super::*;
2206        #[derive(Clone, Debug, PartialEq)]
2207        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2208    }
2209
2210    impl RunAttempt {
2211        /// Gets the enum value.
2212        ///
2213        /// Returns `None` if the enum contains an unknown value deserialized from
2214        /// the string representation of enums.
2215        pub fn value(&self) -> std::option::Option<i32> {
2216            match self {
2217                Self::Unspecified => std::option::Option::Some(0),
2218                Self::Latest => std::option::Option::Some(1),
2219                Self::UnknownValue(u) => u.0.value(),
2220            }
2221        }
2222
2223        /// Gets the enum value as a string.
2224        ///
2225        /// Returns `None` if the enum contains an unknown value deserialized from
2226        /// the integer representation of enums.
2227        pub fn name(&self) -> std::option::Option<&str> {
2228            match self {
2229                Self::Unspecified => std::option::Option::Some("RUN_ATTEMPT_UNSPECIFIED"),
2230                Self::Latest => std::option::Option::Some("LATEST"),
2231                Self::UnknownValue(u) => u.0.name(),
2232            }
2233        }
2234    }
2235
2236    impl std::default::Default for RunAttempt {
2237        fn default() -> Self {
2238            use std::convert::From;
2239            Self::from(0)
2240        }
2241    }
2242
2243    impl std::fmt::Display for RunAttempt {
2244        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2245            wkt::internal::display_enum(f, self.name(), self.value())
2246        }
2247    }
2248
2249    impl std::convert::From<i32> for RunAttempt {
2250        fn from(value: i32) -> Self {
2251            match value {
2252                0 => Self::Unspecified,
2253                1 => Self::Latest,
2254                _ => Self::UnknownValue(run_attempt::UnknownValue(
2255                    wkt::internal::UnknownEnumValue::Integer(value),
2256                )),
2257            }
2258        }
2259    }
2260
2261    impl std::convert::From<&str> for RunAttempt {
2262        fn from(value: &str) -> Self {
2263            use std::string::ToString;
2264            match value {
2265                "RUN_ATTEMPT_UNSPECIFIED" => Self::Unspecified,
2266                "LATEST" => Self::Latest,
2267                _ => Self::UnknownValue(run_attempt::UnknownValue(
2268                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2269                )),
2270            }
2271        }
2272    }
2273
2274    impl serde::ser::Serialize for RunAttempt {
2275        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2276        where
2277            S: serde::Serializer,
2278        {
2279            match self {
2280                Self::Unspecified => serializer.serialize_i32(0),
2281                Self::Latest => serializer.serialize_i32(1),
2282                Self::UnknownValue(u) => u.0.serialize(serializer),
2283            }
2284        }
2285    }
2286
2287    impl<'de> serde::de::Deserialize<'de> for RunAttempt {
2288        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2289        where
2290            D: serde::Deserializer<'de>,
2291        {
2292            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RunAttempt>::new(
2293                ".google.cloud.bigquery.datatransfer.v1.ListTransferRunsRequest.RunAttempt",
2294            ))
2295        }
2296    }
2297}
2298
2299/// The returned list of pipelines in the project.
2300#[derive(Clone, Default, PartialEq)]
2301#[non_exhaustive]
2302pub struct ListTransferRunsResponse {
2303    /// Output only. The stored pipeline transfer runs.
2304    pub transfer_runs: std::vec::Vec<crate::model::TransferRun>,
2305
2306    /// Output only. The next-pagination token. For multiple-page list results,
2307    /// this token can be used as the
2308    /// `ListTransferRunsRequest.page_token`
2309    /// to request the next page of list results.
2310    pub next_page_token: std::string::String,
2311
2312    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2313}
2314
2315impl ListTransferRunsResponse {
2316    pub fn new() -> Self {
2317        std::default::Default::default()
2318    }
2319
2320    /// Sets the value of [transfer_runs][crate::model::ListTransferRunsResponse::transfer_runs].
2321    ///
2322    /// # Example
2323    /// ```ignore,no_run
2324    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferRunsResponse;
2325    /// use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
2326    /// let x = ListTransferRunsResponse::new()
2327    ///     .set_transfer_runs([
2328    ///         TransferRun::default()/* use setters */,
2329    ///         TransferRun::default()/* use (different) setters */,
2330    ///     ]);
2331    /// ```
2332    pub fn set_transfer_runs<T, V>(mut self, v: T) -> Self
2333    where
2334        T: std::iter::IntoIterator<Item = V>,
2335        V: std::convert::Into<crate::model::TransferRun>,
2336    {
2337        use std::iter::Iterator;
2338        self.transfer_runs = v.into_iter().map(|i| i.into()).collect();
2339        self
2340    }
2341
2342    /// Sets the value of [next_page_token][crate::model::ListTransferRunsResponse::next_page_token].
2343    ///
2344    /// # Example
2345    /// ```ignore,no_run
2346    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferRunsResponse;
2347    /// let x = ListTransferRunsResponse::new().set_next_page_token("example");
2348    /// ```
2349    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2350        self.next_page_token = v.into();
2351        self
2352    }
2353}
2354
2355impl wkt::message::Message for ListTransferRunsResponse {
2356    fn typename() -> &'static str {
2357        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferRunsResponse"
2358    }
2359}
2360
2361#[doc(hidden)]
2362impl gax::paginator::internal::PageableResponse for ListTransferRunsResponse {
2363    type PageItem = crate::model::TransferRun;
2364
2365    fn items(self) -> std::vec::Vec<Self::PageItem> {
2366        self.transfer_runs
2367    }
2368
2369    fn next_page_token(&self) -> std::string::String {
2370        use std::clone::Clone;
2371        self.next_page_token.clone()
2372    }
2373}
2374
2375/// A request to get user facing log messages associated with data transfer run.
2376#[derive(Clone, Default, PartialEq)]
2377#[non_exhaustive]
2378pub struct ListTransferLogsRequest {
2379    /// Required. Transfer run name in the form:
2380    /// `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` or
2381    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
2382    pub parent: std::string::String,
2383
2384    /// Pagination token, which can be used to request a specific page
2385    /// of `ListTransferLogsRequest` list results. For multiple-page
2386    /// results, `ListTransferLogsResponse` outputs
2387    /// a `next_page` token, which can be used as the
2388    /// `page_token` value to request the next page of list results.
2389    pub page_token: std::string::String,
2390
2391    /// Page size. The default page size is the maximum value of 1000 results.
2392    pub page_size: i32,
2393
2394    /// Message types to return. If not populated - INFO, WARNING and ERROR
2395    /// messages are returned.
2396    pub message_types: std::vec::Vec<crate::model::transfer_message::MessageSeverity>,
2397
2398    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2399}
2400
2401impl ListTransferLogsRequest {
2402    pub fn new() -> Self {
2403        std::default::Default::default()
2404    }
2405
2406    /// Sets the value of [parent][crate::model::ListTransferLogsRequest::parent].
2407    ///
2408    /// # Example
2409    /// ```ignore,no_run
2410    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferLogsRequest;
2411    /// let x = ListTransferLogsRequest::new().set_parent("example");
2412    /// ```
2413    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2414        self.parent = v.into();
2415        self
2416    }
2417
2418    /// Sets the value of [page_token][crate::model::ListTransferLogsRequest::page_token].
2419    ///
2420    /// # Example
2421    /// ```ignore,no_run
2422    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferLogsRequest;
2423    /// let x = ListTransferLogsRequest::new().set_page_token("example");
2424    /// ```
2425    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2426        self.page_token = v.into();
2427        self
2428    }
2429
2430    /// Sets the value of [page_size][crate::model::ListTransferLogsRequest::page_size].
2431    ///
2432    /// # Example
2433    /// ```ignore,no_run
2434    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferLogsRequest;
2435    /// let x = ListTransferLogsRequest::new().set_page_size(42);
2436    /// ```
2437    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2438        self.page_size = v.into();
2439        self
2440    }
2441
2442    /// Sets the value of [message_types][crate::model::ListTransferLogsRequest::message_types].
2443    ///
2444    /// # Example
2445    /// ```ignore,no_run
2446    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferLogsRequest;
2447    /// use google_cloud_bigquery_datatransfer_v1::model::transfer_message::MessageSeverity;
2448    /// let x = ListTransferLogsRequest::new().set_message_types([
2449    ///     MessageSeverity::Info,
2450    ///     MessageSeverity::Warning,
2451    ///     MessageSeverity::Error,
2452    /// ]);
2453    /// ```
2454    pub fn set_message_types<T, V>(mut self, v: T) -> Self
2455    where
2456        T: std::iter::IntoIterator<Item = V>,
2457        V: std::convert::Into<crate::model::transfer_message::MessageSeverity>,
2458    {
2459        use std::iter::Iterator;
2460        self.message_types = v.into_iter().map(|i| i.into()).collect();
2461        self
2462    }
2463}
2464
2465impl wkt::message::Message for ListTransferLogsRequest {
2466    fn typename() -> &'static str {
2467        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferLogsRequest"
2468    }
2469}
2470
2471/// The returned list transfer run messages.
2472#[derive(Clone, Default, PartialEq)]
2473#[non_exhaustive]
2474pub struct ListTransferLogsResponse {
2475    /// Output only. The stored pipeline transfer messages.
2476    pub transfer_messages: std::vec::Vec<crate::model::TransferMessage>,
2477
2478    /// Output only. The next-pagination token. For multiple-page list results,
2479    /// this token can be used as the
2480    /// `GetTransferRunLogRequest.page_token`
2481    /// to request the next page of list results.
2482    pub next_page_token: std::string::String,
2483
2484    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2485}
2486
2487impl ListTransferLogsResponse {
2488    pub fn new() -> Self {
2489        std::default::Default::default()
2490    }
2491
2492    /// Sets the value of [transfer_messages][crate::model::ListTransferLogsResponse::transfer_messages].
2493    ///
2494    /// # Example
2495    /// ```ignore,no_run
2496    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferLogsResponse;
2497    /// use google_cloud_bigquery_datatransfer_v1::model::TransferMessage;
2498    /// let x = ListTransferLogsResponse::new()
2499    ///     .set_transfer_messages([
2500    ///         TransferMessage::default()/* use setters */,
2501    ///         TransferMessage::default()/* use (different) setters */,
2502    ///     ]);
2503    /// ```
2504    pub fn set_transfer_messages<T, V>(mut self, v: T) -> Self
2505    where
2506        T: std::iter::IntoIterator<Item = V>,
2507        V: std::convert::Into<crate::model::TransferMessage>,
2508    {
2509        use std::iter::Iterator;
2510        self.transfer_messages = v.into_iter().map(|i| i.into()).collect();
2511        self
2512    }
2513
2514    /// Sets the value of [next_page_token][crate::model::ListTransferLogsResponse::next_page_token].
2515    ///
2516    /// # Example
2517    /// ```ignore,no_run
2518    /// # use google_cloud_bigquery_datatransfer_v1::model::ListTransferLogsResponse;
2519    /// let x = ListTransferLogsResponse::new().set_next_page_token("example");
2520    /// ```
2521    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2522        self.next_page_token = v.into();
2523        self
2524    }
2525}
2526
2527impl wkt::message::Message for ListTransferLogsResponse {
2528    fn typename() -> &'static str {
2529        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ListTransferLogsResponse"
2530    }
2531}
2532
2533#[doc(hidden)]
2534impl gax::paginator::internal::PageableResponse for ListTransferLogsResponse {
2535    type PageItem = crate::model::TransferMessage;
2536
2537    fn items(self) -> std::vec::Vec<Self::PageItem> {
2538        self.transfer_messages
2539    }
2540
2541    fn next_page_token(&self) -> std::string::String {
2542        use std::clone::Clone;
2543        self.next_page_token.clone()
2544    }
2545}
2546
2547/// A request to determine whether the user has valid credentials. This method
2548/// is used to limit the number of OAuth popups in the user interface. The
2549/// user id is inferred from the API call context.
2550/// If the data source has the Google+ authorization type, this method
2551/// returns false, as it cannot be determined whether the credentials are
2552/// already valid merely based on the user id.
2553#[derive(Clone, Default, PartialEq)]
2554#[non_exhaustive]
2555pub struct CheckValidCredsRequest {
2556    /// Required. The data source in the form:
2557    /// `projects/{project_id}/dataSources/{data_source_id}` or
2558    /// `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`.
2559    pub name: std::string::String,
2560
2561    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2562}
2563
2564impl CheckValidCredsRequest {
2565    pub fn new() -> Self {
2566        std::default::Default::default()
2567    }
2568
2569    /// Sets the value of [name][crate::model::CheckValidCredsRequest::name].
2570    ///
2571    /// # Example
2572    /// ```ignore,no_run
2573    /// # use google_cloud_bigquery_datatransfer_v1::model::CheckValidCredsRequest;
2574    /// let x = CheckValidCredsRequest::new().set_name("example");
2575    /// ```
2576    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2577        self.name = v.into();
2578        self
2579    }
2580}
2581
2582impl wkt::message::Message for CheckValidCredsRequest {
2583    fn typename() -> &'static str {
2584        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.CheckValidCredsRequest"
2585    }
2586}
2587
2588/// A response indicating whether the credentials exist and are valid.
2589#[derive(Clone, Default, PartialEq)]
2590#[non_exhaustive]
2591pub struct CheckValidCredsResponse {
2592    /// If set to `true`, the credentials exist and are valid.
2593    pub has_valid_creds: bool,
2594
2595    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2596}
2597
2598impl CheckValidCredsResponse {
2599    pub fn new() -> Self {
2600        std::default::Default::default()
2601    }
2602
2603    /// Sets the value of [has_valid_creds][crate::model::CheckValidCredsResponse::has_valid_creds].
2604    ///
2605    /// # Example
2606    /// ```ignore,no_run
2607    /// # use google_cloud_bigquery_datatransfer_v1::model::CheckValidCredsResponse;
2608    /// let x = CheckValidCredsResponse::new().set_has_valid_creds(true);
2609    /// ```
2610    pub fn set_has_valid_creds<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2611        self.has_valid_creds = v.into();
2612        self
2613    }
2614}
2615
2616impl wkt::message::Message for CheckValidCredsResponse {
2617    fn typename() -> &'static str {
2618        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.CheckValidCredsResponse"
2619    }
2620}
2621
2622/// A request to schedule transfer runs for a time range.
2623#[derive(Clone, Default, PartialEq)]
2624#[non_exhaustive]
2625pub struct ScheduleTransferRunsRequest {
2626    /// Required. Transfer configuration name in the form:
2627    /// `projects/{project_id}/transferConfigs/{config_id}` or
2628    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
2629    pub parent: std::string::String,
2630
2631    /// Required. Start time of the range of transfer runs. For example,
2632    /// `"2017-05-25T00:00:00+00:00"`.
2633    pub start_time: std::option::Option<wkt::Timestamp>,
2634
2635    /// Required. End time of the range of transfer runs. For example,
2636    /// `"2017-05-30T00:00:00+00:00"`.
2637    pub end_time: std::option::Option<wkt::Timestamp>,
2638
2639    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2640}
2641
2642impl ScheduleTransferRunsRequest {
2643    pub fn new() -> Self {
2644        std::default::Default::default()
2645    }
2646
2647    /// Sets the value of [parent][crate::model::ScheduleTransferRunsRequest::parent].
2648    ///
2649    /// # Example
2650    /// ```ignore,no_run
2651    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleTransferRunsRequest;
2652    /// let x = ScheduleTransferRunsRequest::new().set_parent("example");
2653    /// ```
2654    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2655        self.parent = v.into();
2656        self
2657    }
2658
2659    /// Sets the value of [start_time][crate::model::ScheduleTransferRunsRequest::start_time].
2660    ///
2661    /// # Example
2662    /// ```ignore,no_run
2663    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleTransferRunsRequest;
2664    /// use wkt::Timestamp;
2665    /// let x = ScheduleTransferRunsRequest::new().set_start_time(Timestamp::default()/* use setters */);
2666    /// ```
2667    pub fn set_start_time<T>(mut self, v: T) -> Self
2668    where
2669        T: std::convert::Into<wkt::Timestamp>,
2670    {
2671        self.start_time = std::option::Option::Some(v.into());
2672        self
2673    }
2674
2675    /// Sets or clears the value of [start_time][crate::model::ScheduleTransferRunsRequest::start_time].
2676    ///
2677    /// # Example
2678    /// ```ignore,no_run
2679    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleTransferRunsRequest;
2680    /// use wkt::Timestamp;
2681    /// let x = ScheduleTransferRunsRequest::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2682    /// let x = ScheduleTransferRunsRequest::new().set_or_clear_start_time(None::<Timestamp>);
2683    /// ```
2684    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2685    where
2686        T: std::convert::Into<wkt::Timestamp>,
2687    {
2688        self.start_time = v.map(|x| x.into());
2689        self
2690    }
2691
2692    /// Sets the value of [end_time][crate::model::ScheduleTransferRunsRequest::end_time].
2693    ///
2694    /// # Example
2695    /// ```ignore,no_run
2696    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleTransferRunsRequest;
2697    /// use wkt::Timestamp;
2698    /// let x = ScheduleTransferRunsRequest::new().set_end_time(Timestamp::default()/* use setters */);
2699    /// ```
2700    pub fn set_end_time<T>(mut self, v: T) -> Self
2701    where
2702        T: std::convert::Into<wkt::Timestamp>,
2703    {
2704        self.end_time = std::option::Option::Some(v.into());
2705        self
2706    }
2707
2708    /// Sets or clears the value of [end_time][crate::model::ScheduleTransferRunsRequest::end_time].
2709    ///
2710    /// # Example
2711    /// ```ignore,no_run
2712    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleTransferRunsRequest;
2713    /// use wkt::Timestamp;
2714    /// let x = ScheduleTransferRunsRequest::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
2715    /// let x = ScheduleTransferRunsRequest::new().set_or_clear_end_time(None::<Timestamp>);
2716    /// ```
2717    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2718    where
2719        T: std::convert::Into<wkt::Timestamp>,
2720    {
2721        self.end_time = v.map(|x| x.into());
2722        self
2723    }
2724}
2725
2726impl wkt::message::Message for ScheduleTransferRunsRequest {
2727    fn typename() -> &'static str {
2728        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleTransferRunsRequest"
2729    }
2730}
2731
2732/// A response to schedule transfer runs for a time range.
2733#[derive(Clone, Default, PartialEq)]
2734#[non_exhaustive]
2735pub struct ScheduleTransferRunsResponse {
2736    /// The transfer runs that were scheduled.
2737    pub runs: std::vec::Vec<crate::model::TransferRun>,
2738
2739    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2740}
2741
2742impl ScheduleTransferRunsResponse {
2743    pub fn new() -> Self {
2744        std::default::Default::default()
2745    }
2746
2747    /// Sets the value of [runs][crate::model::ScheduleTransferRunsResponse::runs].
2748    ///
2749    /// # Example
2750    /// ```ignore,no_run
2751    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleTransferRunsResponse;
2752    /// use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
2753    /// let x = ScheduleTransferRunsResponse::new()
2754    ///     .set_runs([
2755    ///         TransferRun::default()/* use setters */,
2756    ///         TransferRun::default()/* use (different) setters */,
2757    ///     ]);
2758    /// ```
2759    pub fn set_runs<T, V>(mut self, v: T) -> Self
2760    where
2761        T: std::iter::IntoIterator<Item = V>,
2762        V: std::convert::Into<crate::model::TransferRun>,
2763    {
2764        use std::iter::Iterator;
2765        self.runs = v.into_iter().map(|i| i.into()).collect();
2766        self
2767    }
2768}
2769
2770impl wkt::message::Message for ScheduleTransferRunsResponse {
2771    fn typename() -> &'static str {
2772        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleTransferRunsResponse"
2773    }
2774}
2775
2776/// A request to start manual transfer runs.
2777#[derive(Clone, Default, PartialEq)]
2778#[non_exhaustive]
2779pub struct StartManualTransferRunsRequest {
2780    /// Required. Transfer configuration name in the form:
2781    /// `projects/{project_id}/transferConfigs/{config_id}` or
2782    /// `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
2783    pub parent: std::string::String,
2784
2785    /// The requested time specification - this can be a time range or a specific
2786    /// run_time.
2787    pub time: std::option::Option<crate::model::start_manual_transfer_runs_request::Time>,
2788
2789    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2790}
2791
2792impl StartManualTransferRunsRequest {
2793    pub fn new() -> Self {
2794        std::default::Default::default()
2795    }
2796
2797    /// Sets the value of [parent][crate::model::StartManualTransferRunsRequest::parent].
2798    ///
2799    /// # Example
2800    /// ```ignore,no_run
2801    /// # use google_cloud_bigquery_datatransfer_v1::model::StartManualTransferRunsRequest;
2802    /// let x = StartManualTransferRunsRequest::new().set_parent("example");
2803    /// ```
2804    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2805        self.parent = v.into();
2806        self
2807    }
2808
2809    /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time].
2810    ///
2811    /// Note that all the setters affecting `time` are mutually
2812    /// exclusive.
2813    ///
2814    /// # Example
2815    /// ```ignore,no_run
2816    /// # use google_cloud_bigquery_datatransfer_v1::model::StartManualTransferRunsRequest;
2817    /// use google_cloud_bigquery_datatransfer_v1::model::start_manual_transfer_runs_request::TimeRange;
2818    /// let x = StartManualTransferRunsRequest::new().set_time(Some(
2819    ///     google_cloud_bigquery_datatransfer_v1::model::start_manual_transfer_runs_request::Time::RequestedTimeRange(TimeRange::default().into())));
2820    /// ```
2821    pub fn set_time<
2822        T: std::convert::Into<
2823                std::option::Option<crate::model::start_manual_transfer_runs_request::Time>,
2824            >,
2825    >(
2826        mut self,
2827        v: T,
2828    ) -> Self {
2829        self.time = v.into();
2830        self
2831    }
2832
2833    /// The value of [time][crate::model::StartManualTransferRunsRequest::time]
2834    /// if it holds a `RequestedTimeRange`, `None` if the field is not set or
2835    /// holds a different branch.
2836    pub fn requested_time_range(
2837        &self,
2838    ) -> std::option::Option<
2839        &std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
2840    > {
2841        #[allow(unreachable_patterns)]
2842        self.time.as_ref().and_then(|v| match v {
2843            crate::model::start_manual_transfer_runs_request::Time::RequestedTimeRange(v) => {
2844                std::option::Option::Some(v)
2845            }
2846            _ => std::option::Option::None,
2847        })
2848    }
2849
2850    /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
2851    /// to hold a `RequestedTimeRange`.
2852    ///
2853    /// Note that all the setters affecting `time` are
2854    /// mutually exclusive.
2855    ///
2856    /// # Example
2857    /// ```ignore,no_run
2858    /// # use google_cloud_bigquery_datatransfer_v1::model::StartManualTransferRunsRequest;
2859    /// use google_cloud_bigquery_datatransfer_v1::model::start_manual_transfer_runs_request::TimeRange;
2860    /// let x = StartManualTransferRunsRequest::new().set_requested_time_range(TimeRange::default()/* use setters */);
2861    /// assert!(x.requested_time_range().is_some());
2862    /// assert!(x.requested_run_time().is_none());
2863    /// ```
2864    pub fn set_requested_time_range<
2865        T: std::convert::Into<
2866                std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
2867            >,
2868    >(
2869        mut self,
2870        v: T,
2871    ) -> Self {
2872        self.time = std::option::Option::Some(
2873            crate::model::start_manual_transfer_runs_request::Time::RequestedTimeRange(v.into()),
2874        );
2875        self
2876    }
2877
2878    /// The value of [time][crate::model::StartManualTransferRunsRequest::time]
2879    /// if it holds a `RequestedRunTime`, `None` if the field is not set or
2880    /// holds a different branch.
2881    pub fn requested_run_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
2882        #[allow(unreachable_patterns)]
2883        self.time.as_ref().and_then(|v| match v {
2884            crate::model::start_manual_transfer_runs_request::Time::RequestedRunTime(v) => {
2885                std::option::Option::Some(v)
2886            }
2887            _ => std::option::Option::None,
2888        })
2889    }
2890
2891    /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
2892    /// to hold a `RequestedRunTime`.
2893    ///
2894    /// Note that all the setters affecting `time` are
2895    /// mutually exclusive.
2896    ///
2897    /// # Example
2898    /// ```ignore,no_run
2899    /// # use google_cloud_bigquery_datatransfer_v1::model::StartManualTransferRunsRequest;
2900    /// use wkt::Timestamp;
2901    /// let x = StartManualTransferRunsRequest::new().set_requested_run_time(Timestamp::default()/* use setters */);
2902    /// assert!(x.requested_run_time().is_some());
2903    /// assert!(x.requested_time_range().is_none());
2904    /// ```
2905    pub fn set_requested_run_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2906        mut self,
2907        v: T,
2908    ) -> Self {
2909        self.time = std::option::Option::Some(
2910            crate::model::start_manual_transfer_runs_request::Time::RequestedRunTime(v.into()),
2911        );
2912        self
2913    }
2914}
2915
2916impl wkt::message::Message for StartManualTransferRunsRequest {
2917    fn typename() -> &'static str {
2918        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsRequest"
2919    }
2920}
2921
2922/// Defines additional types related to [StartManualTransferRunsRequest].
2923pub mod start_manual_transfer_runs_request {
2924    #[allow(unused_imports)]
2925    use super::*;
2926
2927    /// A specification for a time range, this will request transfer runs with
2928    /// run_time between start_time (inclusive) and end_time (exclusive).
2929    #[derive(Clone, Default, PartialEq)]
2930    #[non_exhaustive]
2931    pub struct TimeRange {
2932        /// Start time of the range of transfer runs. For example,
2933        /// `"2017-05-25T00:00:00+00:00"`. The start_time must be strictly less than
2934        /// the end_time. Creates transfer runs where run_time is in the range
2935        /// between start_time (inclusive) and end_time (exclusive).
2936        pub start_time: std::option::Option<wkt::Timestamp>,
2937
2938        /// End time of the range of transfer runs. For example,
2939        /// `"2017-05-30T00:00:00+00:00"`. The end_time must not be in the future.
2940        /// Creates transfer runs where run_time is in the range between start_time
2941        /// (inclusive) and end_time (exclusive).
2942        pub end_time: std::option::Option<wkt::Timestamp>,
2943
2944        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2945    }
2946
2947    impl TimeRange {
2948        pub fn new() -> Self {
2949            std::default::Default::default()
2950        }
2951
2952        /// Sets the value of [start_time][crate::model::start_manual_transfer_runs_request::TimeRange::start_time].
2953        ///
2954        /// # Example
2955        /// ```ignore,no_run
2956        /// # use google_cloud_bigquery_datatransfer_v1::model::start_manual_transfer_runs_request::TimeRange;
2957        /// use wkt::Timestamp;
2958        /// let x = TimeRange::new().set_start_time(Timestamp::default()/* use setters */);
2959        /// ```
2960        pub fn set_start_time<T>(mut self, v: T) -> Self
2961        where
2962            T: std::convert::Into<wkt::Timestamp>,
2963        {
2964            self.start_time = std::option::Option::Some(v.into());
2965            self
2966        }
2967
2968        /// Sets or clears the value of [start_time][crate::model::start_manual_transfer_runs_request::TimeRange::start_time].
2969        ///
2970        /// # Example
2971        /// ```ignore,no_run
2972        /// # use google_cloud_bigquery_datatransfer_v1::model::start_manual_transfer_runs_request::TimeRange;
2973        /// use wkt::Timestamp;
2974        /// let x = TimeRange::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2975        /// let x = TimeRange::new().set_or_clear_start_time(None::<Timestamp>);
2976        /// ```
2977        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2978        where
2979            T: std::convert::Into<wkt::Timestamp>,
2980        {
2981            self.start_time = v.map(|x| x.into());
2982            self
2983        }
2984
2985        /// Sets the value of [end_time][crate::model::start_manual_transfer_runs_request::TimeRange::end_time].
2986        ///
2987        /// # Example
2988        /// ```ignore,no_run
2989        /// # use google_cloud_bigquery_datatransfer_v1::model::start_manual_transfer_runs_request::TimeRange;
2990        /// use wkt::Timestamp;
2991        /// let x = TimeRange::new().set_end_time(Timestamp::default()/* use setters */);
2992        /// ```
2993        pub fn set_end_time<T>(mut self, v: T) -> Self
2994        where
2995            T: std::convert::Into<wkt::Timestamp>,
2996        {
2997            self.end_time = std::option::Option::Some(v.into());
2998            self
2999        }
3000
3001        /// Sets or clears the value of [end_time][crate::model::start_manual_transfer_runs_request::TimeRange::end_time].
3002        ///
3003        /// # Example
3004        /// ```ignore,no_run
3005        /// # use google_cloud_bigquery_datatransfer_v1::model::start_manual_transfer_runs_request::TimeRange;
3006        /// use wkt::Timestamp;
3007        /// let x = TimeRange::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3008        /// let x = TimeRange::new().set_or_clear_end_time(None::<Timestamp>);
3009        /// ```
3010        pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3011        where
3012            T: std::convert::Into<wkt::Timestamp>,
3013        {
3014            self.end_time = v.map(|x| x.into());
3015            self
3016        }
3017    }
3018
3019    impl wkt::message::Message for TimeRange {
3020        fn typename() -> &'static str {
3021            "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsRequest.TimeRange"
3022        }
3023    }
3024
3025    /// The requested time specification - this can be a time range or a specific
3026    /// run_time.
3027    #[derive(Clone, Debug, PartialEq)]
3028    #[non_exhaustive]
3029    pub enum Time {
3030        /// A time_range start and end timestamp for historical data files or reports
3031        /// that are scheduled to be transferred by the scheduled transfer run.
3032        /// requested_time_range must be a past time and cannot include future time
3033        /// values.
3034        RequestedTimeRange(
3035            std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
3036        ),
3037        /// A run_time timestamp for historical data files or reports
3038        /// that are scheduled to be transferred by the scheduled transfer run.
3039        /// requested_run_time must be a past time and cannot include future time
3040        /// values.
3041        RequestedRunTime(std::boxed::Box<wkt::Timestamp>),
3042    }
3043}
3044
3045/// A response to start manual transfer runs.
3046#[derive(Clone, Default, PartialEq)]
3047#[non_exhaustive]
3048pub struct StartManualTransferRunsResponse {
3049    /// The transfer runs that were created.
3050    pub runs: std::vec::Vec<crate::model::TransferRun>,
3051
3052    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3053}
3054
3055impl StartManualTransferRunsResponse {
3056    pub fn new() -> Self {
3057        std::default::Default::default()
3058    }
3059
3060    /// Sets the value of [runs][crate::model::StartManualTransferRunsResponse::runs].
3061    ///
3062    /// # Example
3063    /// ```ignore,no_run
3064    /// # use google_cloud_bigquery_datatransfer_v1::model::StartManualTransferRunsResponse;
3065    /// use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
3066    /// let x = StartManualTransferRunsResponse::new()
3067    ///     .set_runs([
3068    ///         TransferRun::default()/* use setters */,
3069    ///         TransferRun::default()/* use (different) setters */,
3070    ///     ]);
3071    /// ```
3072    pub fn set_runs<T, V>(mut self, v: T) -> Self
3073    where
3074        T: std::iter::IntoIterator<Item = V>,
3075        V: std::convert::Into<crate::model::TransferRun>,
3076    {
3077        use std::iter::Iterator;
3078        self.runs = v.into_iter().map(|i| i.into()).collect();
3079        self
3080    }
3081}
3082
3083impl wkt::message::Message for StartManualTransferRunsResponse {
3084    fn typename() -> &'static str {
3085        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.StartManualTransferRunsResponse"
3086    }
3087}
3088
3089/// A request to enroll a set of data sources so they are visible in the
3090/// BigQuery UI's `Transfer` tab.
3091#[derive(Clone, Default, PartialEq)]
3092#[non_exhaustive]
3093pub struct EnrollDataSourcesRequest {
3094    /// Required. The name of the project resource in the form:
3095    /// `projects/{project_id}`
3096    pub name: std::string::String,
3097
3098    /// Data sources that are enrolled. It is required to provide at least one
3099    /// data source id.
3100    pub data_source_ids: std::vec::Vec<std::string::String>,
3101
3102    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3103}
3104
3105impl EnrollDataSourcesRequest {
3106    pub fn new() -> Self {
3107        std::default::Default::default()
3108    }
3109
3110    /// Sets the value of [name][crate::model::EnrollDataSourcesRequest::name].
3111    ///
3112    /// # Example
3113    /// ```ignore,no_run
3114    /// # use google_cloud_bigquery_datatransfer_v1::model::EnrollDataSourcesRequest;
3115    /// let x = EnrollDataSourcesRequest::new().set_name("example");
3116    /// ```
3117    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3118        self.name = v.into();
3119        self
3120    }
3121
3122    /// Sets the value of [data_source_ids][crate::model::EnrollDataSourcesRequest::data_source_ids].
3123    ///
3124    /// # Example
3125    /// ```ignore,no_run
3126    /// # use google_cloud_bigquery_datatransfer_v1::model::EnrollDataSourcesRequest;
3127    /// let x = EnrollDataSourcesRequest::new().set_data_source_ids(["a", "b", "c"]);
3128    /// ```
3129    pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
3130    where
3131        T: std::iter::IntoIterator<Item = V>,
3132        V: std::convert::Into<std::string::String>,
3133    {
3134        use std::iter::Iterator;
3135        self.data_source_ids = v.into_iter().map(|i| i.into()).collect();
3136        self
3137    }
3138}
3139
3140impl wkt::message::Message for EnrollDataSourcesRequest {
3141    fn typename() -> &'static str {
3142        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EnrollDataSourcesRequest"
3143    }
3144}
3145
3146/// A request to unenroll a set of data sources so they are no longer visible in
3147/// the BigQuery UI's `Transfer` tab.
3148#[derive(Clone, Default, PartialEq)]
3149#[non_exhaustive]
3150pub struct UnenrollDataSourcesRequest {
3151    /// Required. The name of the project resource in the form:
3152    /// `projects/{project_id}`
3153    pub name: std::string::String,
3154
3155    /// Data sources that are unenrolled. It is required to provide at least one
3156    /// data source id.
3157    pub data_source_ids: std::vec::Vec<std::string::String>,
3158
3159    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3160}
3161
3162impl UnenrollDataSourcesRequest {
3163    pub fn new() -> Self {
3164        std::default::Default::default()
3165    }
3166
3167    /// Sets the value of [name][crate::model::UnenrollDataSourcesRequest::name].
3168    ///
3169    /// # Example
3170    /// ```ignore,no_run
3171    /// # use google_cloud_bigquery_datatransfer_v1::model::UnenrollDataSourcesRequest;
3172    /// let x = UnenrollDataSourcesRequest::new().set_name("example");
3173    /// ```
3174    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3175        self.name = v.into();
3176        self
3177    }
3178
3179    /// Sets the value of [data_source_ids][crate::model::UnenrollDataSourcesRequest::data_source_ids].
3180    ///
3181    /// # Example
3182    /// ```ignore,no_run
3183    /// # use google_cloud_bigquery_datatransfer_v1::model::UnenrollDataSourcesRequest;
3184    /// let x = UnenrollDataSourcesRequest::new().set_data_source_ids(["a", "b", "c"]);
3185    /// ```
3186    pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
3187    where
3188        T: std::iter::IntoIterator<Item = V>,
3189        V: std::convert::Into<std::string::String>,
3190    {
3191        use std::iter::Iterator;
3192        self.data_source_ids = v.into_iter().map(|i| i.into()).collect();
3193        self
3194    }
3195}
3196
3197impl wkt::message::Message for UnenrollDataSourcesRequest {
3198    fn typename() -> &'static str {
3199        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.UnenrollDataSourcesRequest"
3200    }
3201}
3202
3203/// Represents preferences for sending email notifications for transfer run
3204/// events.
3205#[derive(Clone, Default, PartialEq)]
3206#[non_exhaustive]
3207pub struct EmailPreferences {
3208    /// If true, email notifications will be sent on transfer run failures.
3209    pub enable_failure_email: bool,
3210
3211    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3212}
3213
3214impl EmailPreferences {
3215    pub fn new() -> Self {
3216        std::default::Default::default()
3217    }
3218
3219    /// Sets the value of [enable_failure_email][crate::model::EmailPreferences::enable_failure_email].
3220    ///
3221    /// # Example
3222    /// ```ignore,no_run
3223    /// # use google_cloud_bigquery_datatransfer_v1::model::EmailPreferences;
3224    /// let x = EmailPreferences::new().set_enable_failure_email(true);
3225    /// ```
3226    pub fn set_enable_failure_email<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3227        self.enable_failure_email = v.into();
3228        self
3229    }
3230}
3231
3232impl wkt::message::Message for EmailPreferences {
3233    fn typename() -> &'static str {
3234        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EmailPreferences"
3235    }
3236}
3237
3238/// Options customizing the data transfer schedule.
3239#[derive(Clone, Default, PartialEq)]
3240#[non_exhaustive]
3241pub struct ScheduleOptions {
3242    /// If true, automatic scheduling of data transfer runs for this configuration
3243    /// will be disabled. The runs can be started on ad-hoc basis using
3244    /// StartManualTransferRuns API. When automatic scheduling is disabled, the
3245    /// TransferConfig.schedule field will be ignored.
3246    pub disable_auto_scheduling: bool,
3247
3248    /// Specifies time to start scheduling transfer runs. The first run will be
3249    /// scheduled at or after the start time according to a recurrence pattern
3250    /// defined in the schedule string. The start time can be changed at any
3251    /// moment. The time when a data transfer can be triggered manually is not
3252    /// limited by this option.
3253    pub start_time: std::option::Option<wkt::Timestamp>,
3254
3255    /// Defines time to stop scheduling transfer runs. A transfer run cannot be
3256    /// scheduled at or after the end time. The end time can be changed at any
3257    /// moment. The time when a data transfer can be triggered manually is not
3258    /// limited by this option.
3259    pub end_time: std::option::Option<wkt::Timestamp>,
3260
3261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3262}
3263
3264impl ScheduleOptions {
3265    pub fn new() -> Self {
3266        std::default::Default::default()
3267    }
3268
3269    /// Sets the value of [disable_auto_scheduling][crate::model::ScheduleOptions::disable_auto_scheduling].
3270    ///
3271    /// # Example
3272    /// ```ignore,no_run
3273    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptions;
3274    /// let x = ScheduleOptions::new().set_disable_auto_scheduling(true);
3275    /// ```
3276    pub fn set_disable_auto_scheduling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3277        self.disable_auto_scheduling = v.into();
3278        self
3279    }
3280
3281    /// Sets the value of [start_time][crate::model::ScheduleOptions::start_time].
3282    ///
3283    /// # Example
3284    /// ```ignore,no_run
3285    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptions;
3286    /// use wkt::Timestamp;
3287    /// let x = ScheduleOptions::new().set_start_time(Timestamp::default()/* use setters */);
3288    /// ```
3289    pub fn set_start_time<T>(mut self, v: T) -> Self
3290    where
3291        T: std::convert::Into<wkt::Timestamp>,
3292    {
3293        self.start_time = std::option::Option::Some(v.into());
3294        self
3295    }
3296
3297    /// Sets or clears the value of [start_time][crate::model::ScheduleOptions::start_time].
3298    ///
3299    /// # Example
3300    /// ```ignore,no_run
3301    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptions;
3302    /// use wkt::Timestamp;
3303    /// let x = ScheduleOptions::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3304    /// let x = ScheduleOptions::new().set_or_clear_start_time(None::<Timestamp>);
3305    /// ```
3306    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3307    where
3308        T: std::convert::Into<wkt::Timestamp>,
3309    {
3310        self.start_time = v.map(|x| x.into());
3311        self
3312    }
3313
3314    /// Sets the value of [end_time][crate::model::ScheduleOptions::end_time].
3315    ///
3316    /// # Example
3317    /// ```ignore,no_run
3318    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptions;
3319    /// use wkt::Timestamp;
3320    /// let x = ScheduleOptions::new().set_end_time(Timestamp::default()/* use setters */);
3321    /// ```
3322    pub fn set_end_time<T>(mut self, v: T) -> Self
3323    where
3324        T: std::convert::Into<wkt::Timestamp>,
3325    {
3326        self.end_time = std::option::Option::Some(v.into());
3327        self
3328    }
3329
3330    /// Sets or clears the value of [end_time][crate::model::ScheduleOptions::end_time].
3331    ///
3332    /// # Example
3333    /// ```ignore,no_run
3334    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptions;
3335    /// use wkt::Timestamp;
3336    /// let x = ScheduleOptions::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3337    /// let x = ScheduleOptions::new().set_or_clear_end_time(None::<Timestamp>);
3338    /// ```
3339    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3340    where
3341        T: std::convert::Into<wkt::Timestamp>,
3342    {
3343        self.end_time = v.map(|x| x.into());
3344        self
3345    }
3346}
3347
3348impl wkt::message::Message for ScheduleOptions {
3349    fn typename() -> &'static str {
3350        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleOptions"
3351    }
3352}
3353
3354/// V2 options customizing different types of data transfer schedule.
3355/// This field supports existing time-based and manual transfer schedule. Also
3356/// supports Event-Driven transfer schedule. ScheduleOptionsV2 cannot be used
3357/// together with ScheduleOptions/Schedule.
3358#[derive(Clone, Default, PartialEq)]
3359#[non_exhaustive]
3360pub struct ScheduleOptionsV2 {
3361    /// Data transfer schedules.
3362    pub schedule: std::option::Option<crate::model::schedule_options_v_2::Schedule>,
3363
3364    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3365}
3366
3367impl ScheduleOptionsV2 {
3368    pub fn new() -> Self {
3369        std::default::Default::default()
3370    }
3371
3372    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule].
3373    ///
3374    /// Note that all the setters affecting `schedule` are mutually
3375    /// exclusive.
3376    ///
3377    /// # Example
3378    /// ```ignore,no_run
3379    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptionsV2;
3380    /// use google_cloud_bigquery_datatransfer_v1::model::TimeBasedSchedule;
3381    /// let x = ScheduleOptionsV2::new().set_schedule(Some(
3382    ///     google_cloud_bigquery_datatransfer_v1::model::schedule_options_v_2::Schedule::TimeBasedSchedule(TimeBasedSchedule::default().into())));
3383    /// ```
3384    pub fn set_schedule<
3385        T: std::convert::Into<std::option::Option<crate::model::schedule_options_v_2::Schedule>>,
3386    >(
3387        mut self,
3388        v: T,
3389    ) -> Self {
3390        self.schedule = v.into();
3391        self
3392    }
3393
3394    /// The value of [schedule][crate::model::ScheduleOptionsV2::schedule]
3395    /// if it holds a `TimeBasedSchedule`, `None` if the field is not set or
3396    /// holds a different branch.
3397    pub fn time_based_schedule(
3398        &self,
3399    ) -> std::option::Option<&std::boxed::Box<crate::model::TimeBasedSchedule>> {
3400        #[allow(unreachable_patterns)]
3401        self.schedule.as_ref().and_then(|v| match v {
3402            crate::model::schedule_options_v_2::Schedule::TimeBasedSchedule(v) => {
3403                std::option::Option::Some(v)
3404            }
3405            _ => std::option::Option::None,
3406        })
3407    }
3408
3409    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule]
3410    /// to hold a `TimeBasedSchedule`.
3411    ///
3412    /// Note that all the setters affecting `schedule` are
3413    /// mutually exclusive.
3414    ///
3415    /// # Example
3416    /// ```ignore,no_run
3417    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptionsV2;
3418    /// use google_cloud_bigquery_datatransfer_v1::model::TimeBasedSchedule;
3419    /// let x = ScheduleOptionsV2::new().set_time_based_schedule(TimeBasedSchedule::default()/* use setters */);
3420    /// assert!(x.time_based_schedule().is_some());
3421    /// assert!(x.manual_schedule().is_none());
3422    /// assert!(x.event_driven_schedule().is_none());
3423    /// ```
3424    pub fn set_time_based_schedule<
3425        T: std::convert::Into<std::boxed::Box<crate::model::TimeBasedSchedule>>,
3426    >(
3427        mut self,
3428        v: T,
3429    ) -> Self {
3430        self.schedule = std::option::Option::Some(
3431            crate::model::schedule_options_v_2::Schedule::TimeBasedSchedule(v.into()),
3432        );
3433        self
3434    }
3435
3436    /// The value of [schedule][crate::model::ScheduleOptionsV2::schedule]
3437    /// if it holds a `ManualSchedule`, `None` if the field is not set or
3438    /// holds a different branch.
3439    pub fn manual_schedule(
3440        &self,
3441    ) -> std::option::Option<&std::boxed::Box<crate::model::ManualSchedule>> {
3442        #[allow(unreachable_patterns)]
3443        self.schedule.as_ref().and_then(|v| match v {
3444            crate::model::schedule_options_v_2::Schedule::ManualSchedule(v) => {
3445                std::option::Option::Some(v)
3446            }
3447            _ => std::option::Option::None,
3448        })
3449    }
3450
3451    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule]
3452    /// to hold a `ManualSchedule`.
3453    ///
3454    /// Note that all the setters affecting `schedule` are
3455    /// mutually exclusive.
3456    ///
3457    /// # Example
3458    /// ```ignore,no_run
3459    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptionsV2;
3460    /// use google_cloud_bigquery_datatransfer_v1::model::ManualSchedule;
3461    /// let x = ScheduleOptionsV2::new().set_manual_schedule(ManualSchedule::default()/* use setters */);
3462    /// assert!(x.manual_schedule().is_some());
3463    /// assert!(x.time_based_schedule().is_none());
3464    /// assert!(x.event_driven_schedule().is_none());
3465    /// ```
3466    pub fn set_manual_schedule<
3467        T: std::convert::Into<std::boxed::Box<crate::model::ManualSchedule>>,
3468    >(
3469        mut self,
3470        v: T,
3471    ) -> Self {
3472        self.schedule = std::option::Option::Some(
3473            crate::model::schedule_options_v_2::Schedule::ManualSchedule(v.into()),
3474        );
3475        self
3476    }
3477
3478    /// The value of [schedule][crate::model::ScheduleOptionsV2::schedule]
3479    /// if it holds a `EventDrivenSchedule`, `None` if the field is not set or
3480    /// holds a different branch.
3481    pub fn event_driven_schedule(
3482        &self,
3483    ) -> std::option::Option<&std::boxed::Box<crate::model::EventDrivenSchedule>> {
3484        #[allow(unreachable_patterns)]
3485        self.schedule.as_ref().and_then(|v| match v {
3486            crate::model::schedule_options_v_2::Schedule::EventDrivenSchedule(v) => {
3487                std::option::Option::Some(v)
3488            }
3489            _ => std::option::Option::None,
3490        })
3491    }
3492
3493    /// Sets the value of [schedule][crate::model::ScheduleOptionsV2::schedule]
3494    /// to hold a `EventDrivenSchedule`.
3495    ///
3496    /// Note that all the setters affecting `schedule` are
3497    /// mutually exclusive.
3498    ///
3499    /// # Example
3500    /// ```ignore,no_run
3501    /// # use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptionsV2;
3502    /// use google_cloud_bigquery_datatransfer_v1::model::EventDrivenSchedule;
3503    /// let x = ScheduleOptionsV2::new().set_event_driven_schedule(EventDrivenSchedule::default()/* use setters */);
3504    /// assert!(x.event_driven_schedule().is_some());
3505    /// assert!(x.time_based_schedule().is_none());
3506    /// assert!(x.manual_schedule().is_none());
3507    /// ```
3508    pub fn set_event_driven_schedule<
3509        T: std::convert::Into<std::boxed::Box<crate::model::EventDrivenSchedule>>,
3510    >(
3511        mut self,
3512        v: T,
3513    ) -> Self {
3514        self.schedule = std::option::Option::Some(
3515            crate::model::schedule_options_v_2::Schedule::EventDrivenSchedule(v.into()),
3516        );
3517        self
3518    }
3519}
3520
3521impl wkt::message::Message for ScheduleOptionsV2 {
3522    fn typename() -> &'static str {
3523        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ScheduleOptionsV2"
3524    }
3525}
3526
3527/// Defines additional types related to [ScheduleOptionsV2].
3528pub mod schedule_options_v_2 {
3529    #[allow(unused_imports)]
3530    use super::*;
3531
3532    /// Data transfer schedules.
3533    #[derive(Clone, Debug, PartialEq)]
3534    #[non_exhaustive]
3535    pub enum Schedule {
3536        /// Time based transfer schedule options. This is the default schedule
3537        /// option.
3538        TimeBasedSchedule(std::boxed::Box<crate::model::TimeBasedSchedule>),
3539        /// Manual transfer schedule. If set, the transfer run will not be
3540        /// auto-scheduled by the system, unless the client invokes
3541        /// StartManualTransferRuns.  This is equivalent to
3542        /// disable_auto_scheduling = true.
3543        ManualSchedule(std::boxed::Box<crate::model::ManualSchedule>),
3544        /// Event driven transfer schedule options. If set, the transfer will be
3545        /// scheduled upon events arrial.
3546        EventDrivenSchedule(std::boxed::Box<crate::model::EventDrivenSchedule>),
3547    }
3548}
3549
3550/// Options customizing the time based transfer schedule.
3551/// Options are migrated from the original ScheduleOptions message.
3552#[derive(Clone, Default, PartialEq)]
3553#[non_exhaustive]
3554pub struct TimeBasedSchedule {
3555    /// Data transfer schedule.
3556    /// If the data source does not support a custom schedule, this should be
3557    /// empty. If it is empty, the default value for the data source will be used.
3558    /// The specified times are in UTC.
3559    /// Examples of valid format:
3560    /// `1st,3rd monday of month 15:30`,
3561    /// `every wed,fri of jan,jun 13:15`, and
3562    /// `first sunday of quarter 00:00`.
3563    /// See more explanation about the format here:
3564    /// <https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format>
3565    ///
3566    /// NOTE: The minimum interval time between recurring transfers depends on the
3567    /// data source; refer to the documentation for your data source.
3568    pub schedule: std::string::String,
3569
3570    /// Specifies time to start scheduling transfer runs. The first run will be
3571    /// scheduled at or after the start time according to a recurrence pattern
3572    /// defined in the schedule string. The start time can be changed at any
3573    /// moment.
3574    pub start_time: std::option::Option<wkt::Timestamp>,
3575
3576    /// Defines time to stop scheduling transfer runs. A transfer run cannot be
3577    /// scheduled at or after the end time. The end time can be changed at any
3578    /// moment.
3579    pub end_time: std::option::Option<wkt::Timestamp>,
3580
3581    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3582}
3583
3584impl TimeBasedSchedule {
3585    pub fn new() -> Self {
3586        std::default::Default::default()
3587    }
3588
3589    /// Sets the value of [schedule][crate::model::TimeBasedSchedule::schedule].
3590    ///
3591    /// # Example
3592    /// ```ignore,no_run
3593    /// # use google_cloud_bigquery_datatransfer_v1::model::TimeBasedSchedule;
3594    /// let x = TimeBasedSchedule::new().set_schedule("example");
3595    /// ```
3596    pub fn set_schedule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3597        self.schedule = v.into();
3598        self
3599    }
3600
3601    /// Sets the value of [start_time][crate::model::TimeBasedSchedule::start_time].
3602    ///
3603    /// # Example
3604    /// ```ignore,no_run
3605    /// # use google_cloud_bigquery_datatransfer_v1::model::TimeBasedSchedule;
3606    /// use wkt::Timestamp;
3607    /// let x = TimeBasedSchedule::new().set_start_time(Timestamp::default()/* use setters */);
3608    /// ```
3609    pub fn set_start_time<T>(mut self, v: T) -> Self
3610    where
3611        T: std::convert::Into<wkt::Timestamp>,
3612    {
3613        self.start_time = std::option::Option::Some(v.into());
3614        self
3615    }
3616
3617    /// Sets or clears the value of [start_time][crate::model::TimeBasedSchedule::start_time].
3618    ///
3619    /// # Example
3620    /// ```ignore,no_run
3621    /// # use google_cloud_bigquery_datatransfer_v1::model::TimeBasedSchedule;
3622    /// use wkt::Timestamp;
3623    /// let x = TimeBasedSchedule::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3624    /// let x = TimeBasedSchedule::new().set_or_clear_start_time(None::<Timestamp>);
3625    /// ```
3626    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3627    where
3628        T: std::convert::Into<wkt::Timestamp>,
3629    {
3630        self.start_time = v.map(|x| x.into());
3631        self
3632    }
3633
3634    /// Sets the value of [end_time][crate::model::TimeBasedSchedule::end_time].
3635    ///
3636    /// # Example
3637    /// ```ignore,no_run
3638    /// # use google_cloud_bigquery_datatransfer_v1::model::TimeBasedSchedule;
3639    /// use wkt::Timestamp;
3640    /// let x = TimeBasedSchedule::new().set_end_time(Timestamp::default()/* use setters */);
3641    /// ```
3642    pub fn set_end_time<T>(mut self, v: T) -> Self
3643    where
3644        T: std::convert::Into<wkt::Timestamp>,
3645    {
3646        self.end_time = std::option::Option::Some(v.into());
3647        self
3648    }
3649
3650    /// Sets or clears the value of [end_time][crate::model::TimeBasedSchedule::end_time].
3651    ///
3652    /// # Example
3653    /// ```ignore,no_run
3654    /// # use google_cloud_bigquery_datatransfer_v1::model::TimeBasedSchedule;
3655    /// use wkt::Timestamp;
3656    /// let x = TimeBasedSchedule::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3657    /// let x = TimeBasedSchedule::new().set_or_clear_end_time(None::<Timestamp>);
3658    /// ```
3659    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3660    where
3661        T: std::convert::Into<wkt::Timestamp>,
3662    {
3663        self.end_time = v.map(|x| x.into());
3664        self
3665    }
3666}
3667
3668impl wkt::message::Message for TimeBasedSchedule {
3669    fn typename() -> &'static str {
3670        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TimeBasedSchedule"
3671    }
3672}
3673
3674/// Options customizing manual transfers schedule.
3675#[derive(Clone, Default, PartialEq)]
3676#[non_exhaustive]
3677pub struct ManualSchedule {
3678    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3679}
3680
3681impl ManualSchedule {
3682    pub fn new() -> Self {
3683        std::default::Default::default()
3684    }
3685}
3686
3687impl wkt::message::Message for ManualSchedule {
3688    fn typename() -> &'static str {
3689        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.ManualSchedule"
3690    }
3691}
3692
3693/// Options customizing EventDriven transfers schedule.
3694#[derive(Clone, Default, PartialEq)]
3695#[non_exhaustive]
3696pub struct EventDrivenSchedule {
3697    /// Pub/Sub subscription name used to receive events.
3698    /// Only Google Cloud Storage data source support this option.
3699    /// Format: projects/{project}/subscriptions/{subscription}
3700    pub pubsub_subscription: std::string::String,
3701
3702    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3703}
3704
3705impl EventDrivenSchedule {
3706    pub fn new() -> Self {
3707        std::default::Default::default()
3708    }
3709
3710    /// Sets the value of [pubsub_subscription][crate::model::EventDrivenSchedule::pubsub_subscription].
3711    ///
3712    /// # Example
3713    /// ```ignore,no_run
3714    /// # use google_cloud_bigquery_datatransfer_v1::model::EventDrivenSchedule;
3715    /// let x = EventDrivenSchedule::new().set_pubsub_subscription("example");
3716    /// ```
3717    pub fn set_pubsub_subscription<T: std::convert::Into<std::string::String>>(
3718        mut self,
3719        v: T,
3720    ) -> Self {
3721        self.pubsub_subscription = v.into();
3722        self
3723    }
3724}
3725
3726impl wkt::message::Message for EventDrivenSchedule {
3727    fn typename() -> &'static str {
3728        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EventDrivenSchedule"
3729    }
3730}
3731
3732/// Information about a user.
3733#[derive(Clone, Default, PartialEq)]
3734#[non_exhaustive]
3735pub struct UserInfo {
3736    /// E-mail address of the user.
3737    pub email: std::option::Option<std::string::String>,
3738
3739    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3740}
3741
3742impl UserInfo {
3743    pub fn new() -> Self {
3744        std::default::Default::default()
3745    }
3746
3747    /// Sets the value of [email][crate::model::UserInfo::email].
3748    ///
3749    /// # Example
3750    /// ```ignore,no_run
3751    /// # use google_cloud_bigquery_datatransfer_v1::model::UserInfo;
3752    /// let x = UserInfo::new().set_email("example");
3753    /// ```
3754    pub fn set_email<T>(mut self, v: T) -> Self
3755    where
3756        T: std::convert::Into<std::string::String>,
3757    {
3758        self.email = std::option::Option::Some(v.into());
3759        self
3760    }
3761
3762    /// Sets or clears the value of [email][crate::model::UserInfo::email].
3763    ///
3764    /// # Example
3765    /// ```ignore,no_run
3766    /// # use google_cloud_bigquery_datatransfer_v1::model::UserInfo;
3767    /// let x = UserInfo::new().set_or_clear_email(Some("example"));
3768    /// let x = UserInfo::new().set_or_clear_email(None::<String>);
3769    /// ```
3770    pub fn set_or_clear_email<T>(mut self, v: std::option::Option<T>) -> Self
3771    where
3772        T: std::convert::Into<std::string::String>,
3773    {
3774        self.email = v.map(|x| x.into());
3775        self
3776    }
3777}
3778
3779impl wkt::message::Message for UserInfo {
3780    fn typename() -> &'static str {
3781        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.UserInfo"
3782    }
3783}
3784
3785/// Represents a data transfer configuration. A transfer configuration
3786/// contains all metadata needed to perform a data transfer. For example,
3787/// `destination_dataset_id` specifies where data should be stored.
3788/// When a new transfer configuration is created, the specified
3789/// `destination_dataset_id` is created when needed and shared with the
3790/// appropriate data source service account.
3791#[derive(Clone, Default, PartialEq)]
3792#[non_exhaustive]
3793pub struct TransferConfig {
3794    /// Identifier. The resource name of the transfer config.
3795    /// Transfer config names have the form either
3796    /// `projects/{project_id}/locations/{region}/transferConfigs/{config_id}` or
3797    /// `projects/{project_id}/transferConfigs/{config_id}`,
3798    /// where `config_id` is usually a UUID, even though it is not
3799    /// guaranteed or required. The name is ignored when creating a transfer
3800    /// config.
3801    pub name: std::string::String,
3802
3803    /// User specified display name for the data transfer.
3804    pub display_name: std::string::String,
3805
3806    /// Data source ID. This cannot be changed once data transfer is created. The
3807    /// full list of available data source IDs can be returned through an API call:
3808    /// <https://cloud.google.com/bigquery-transfer/docs/reference/datatransfer/rest/v1/projects.locations.dataSources/list>
3809    pub data_source_id: std::string::String,
3810
3811    /// Parameters specific to each data source. For more information see the
3812    /// bq tab in the 'Setting up a data transfer' section for each data source.
3813    /// For example the parameters for Cloud Storage transfers are listed here:
3814    /// <https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq>
3815    pub params: std::option::Option<wkt::Struct>,
3816
3817    /// Data transfer schedule.
3818    /// If the data source does not support a custom schedule, this should be
3819    /// empty. If it is empty, the default value for the data source will be used.
3820    /// The specified times are in UTC.
3821    /// Examples of valid format:
3822    /// `1st,3rd monday of month 15:30`,
3823    /// `every wed,fri of jan,jun 13:15`, and
3824    /// `first sunday of quarter 00:00`.
3825    /// See more explanation about the format here:
3826    /// <https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format>
3827    ///
3828    /// NOTE: The minimum interval time between recurring transfers depends on the
3829    /// data source; refer to the documentation for your data source.
3830    pub schedule: std::string::String,
3831
3832    /// Options customizing the data transfer schedule.
3833    pub schedule_options: std::option::Option<crate::model::ScheduleOptions>,
3834
3835    /// Options customizing different types of data transfer schedule.
3836    /// This field replaces "schedule" and "schedule_options" fields.
3837    /// ScheduleOptionsV2 cannot be used together with ScheduleOptions/Schedule.
3838    pub schedule_options_v2: std::option::Option<crate::model::ScheduleOptionsV2>,
3839
3840    /// The number of days to look back to automatically refresh the data.
3841    /// For example, if `data_refresh_window_days = 10`, then every day
3842    /// BigQuery reingests data for [today-10, today-1], rather than ingesting data
3843    /// for just [today-1].
3844    /// Only valid if the data source supports the feature. Set the value to 0
3845    /// to use the default value.
3846    pub data_refresh_window_days: i32,
3847
3848    /// Is this config disabled. When set to true, no runs will be scheduled for
3849    /// this transfer config.
3850    pub disabled: bool,
3851
3852    /// Output only. Data transfer modification time. Ignored by server on input.
3853    pub update_time: std::option::Option<wkt::Timestamp>,
3854
3855    /// Output only. Next time when data transfer will run.
3856    pub next_run_time: std::option::Option<wkt::Timestamp>,
3857
3858    /// Output only. State of the most recently updated transfer run.
3859    pub state: crate::model::TransferState,
3860
3861    /// Deprecated. Unique ID of the user on whose behalf transfer is done.
3862    pub user_id: i64,
3863
3864    /// Output only. Region in which BigQuery dataset is located.
3865    pub dataset_region: std::string::String,
3866
3867    /// Pub/Sub topic where notifications will be sent after transfer runs
3868    /// associated with this transfer config finish.
3869    ///
3870    /// The format for specifying a pubsub topic is:
3871    /// `projects/{project_id}/topics/{topic_id}`
3872    pub notification_pubsub_topic: std::string::String,
3873
3874    /// Email notifications will be sent according to these preferences
3875    /// to the email address of the user who owns this transfer config.
3876    pub email_preferences: std::option::Option<crate::model::EmailPreferences>,
3877
3878    /// Output only. Information about the user whose credentials are used to
3879    /// transfer data. Populated only for `transferConfigs.get` requests. In case
3880    /// the user information is not available, this field will not be populated.
3881    pub owner_info: std::option::Option<crate::model::UserInfo>,
3882
3883    /// The encryption configuration part. Currently, it is only used for the
3884    /// optional KMS key name. The BigQuery service account of your project must be
3885    /// granted permissions to use the key. Read methods will return the key name
3886    /// applied in effect. Write methods will apply the key if it is present, or
3887    /// otherwise try to apply project default keys if it is absent.
3888    pub encryption_configuration: std::option::Option<crate::model::EncryptionConfiguration>,
3889
3890    /// Output only. Error code with detailed information about reason of the
3891    /// latest config failure.
3892    pub error: std::option::Option<rpc::model::Status>,
3893
3894    /// The desination of the transfer config.
3895    pub destination: std::option::Option<crate::model::transfer_config::Destination>,
3896
3897    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3898}
3899
3900impl TransferConfig {
3901    pub fn new() -> Self {
3902        std::default::Default::default()
3903    }
3904
3905    /// Sets the value of [name][crate::model::TransferConfig::name].
3906    ///
3907    /// # Example
3908    /// ```ignore,no_run
3909    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
3910    /// let x = TransferConfig::new().set_name("example");
3911    /// ```
3912    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3913        self.name = v.into();
3914        self
3915    }
3916
3917    /// Sets the value of [display_name][crate::model::TransferConfig::display_name].
3918    ///
3919    /// # Example
3920    /// ```ignore,no_run
3921    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
3922    /// let x = TransferConfig::new().set_display_name("example");
3923    /// ```
3924    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3925        self.display_name = v.into();
3926        self
3927    }
3928
3929    /// Sets the value of [data_source_id][crate::model::TransferConfig::data_source_id].
3930    ///
3931    /// # Example
3932    /// ```ignore,no_run
3933    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
3934    /// let x = TransferConfig::new().set_data_source_id("example");
3935    /// ```
3936    pub fn set_data_source_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3937        self.data_source_id = v.into();
3938        self
3939    }
3940
3941    /// Sets the value of [params][crate::model::TransferConfig::params].
3942    ///
3943    /// # Example
3944    /// ```ignore,no_run
3945    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
3946    /// use wkt::Struct;
3947    /// let x = TransferConfig::new().set_params(Struct::default()/* use setters */);
3948    /// ```
3949    pub fn set_params<T>(mut self, v: T) -> Self
3950    where
3951        T: std::convert::Into<wkt::Struct>,
3952    {
3953        self.params = std::option::Option::Some(v.into());
3954        self
3955    }
3956
3957    /// Sets or clears the value of [params][crate::model::TransferConfig::params].
3958    ///
3959    /// # Example
3960    /// ```ignore,no_run
3961    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
3962    /// use wkt::Struct;
3963    /// let x = TransferConfig::new().set_or_clear_params(Some(Struct::default()/* use setters */));
3964    /// let x = TransferConfig::new().set_or_clear_params(None::<Struct>);
3965    /// ```
3966    pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
3967    where
3968        T: std::convert::Into<wkt::Struct>,
3969    {
3970        self.params = v.map(|x| x.into());
3971        self
3972    }
3973
3974    /// Sets the value of [schedule][crate::model::TransferConfig::schedule].
3975    ///
3976    /// # Example
3977    /// ```ignore,no_run
3978    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
3979    /// let x = TransferConfig::new().set_schedule("example");
3980    /// ```
3981    pub fn set_schedule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3982        self.schedule = v.into();
3983        self
3984    }
3985
3986    /// Sets the value of [schedule_options][crate::model::TransferConfig::schedule_options].
3987    ///
3988    /// # Example
3989    /// ```ignore,no_run
3990    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
3991    /// use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptions;
3992    /// let x = TransferConfig::new().set_schedule_options(ScheduleOptions::default()/* use setters */);
3993    /// ```
3994    pub fn set_schedule_options<T>(mut self, v: T) -> Self
3995    where
3996        T: std::convert::Into<crate::model::ScheduleOptions>,
3997    {
3998        self.schedule_options = std::option::Option::Some(v.into());
3999        self
4000    }
4001
4002    /// Sets or clears the value of [schedule_options][crate::model::TransferConfig::schedule_options].
4003    ///
4004    /// # Example
4005    /// ```ignore,no_run
4006    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4007    /// use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptions;
4008    /// let x = TransferConfig::new().set_or_clear_schedule_options(Some(ScheduleOptions::default()/* use setters */));
4009    /// let x = TransferConfig::new().set_or_clear_schedule_options(None::<ScheduleOptions>);
4010    /// ```
4011    pub fn set_or_clear_schedule_options<T>(mut self, v: std::option::Option<T>) -> Self
4012    where
4013        T: std::convert::Into<crate::model::ScheduleOptions>,
4014    {
4015        self.schedule_options = v.map(|x| x.into());
4016        self
4017    }
4018
4019    /// Sets the value of [schedule_options_v2][crate::model::TransferConfig::schedule_options_v2].
4020    ///
4021    /// # Example
4022    /// ```ignore,no_run
4023    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4024    /// use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptionsV2;
4025    /// let x = TransferConfig::new().set_schedule_options_v2(ScheduleOptionsV2::default()/* use setters */);
4026    /// ```
4027    pub fn set_schedule_options_v2<T>(mut self, v: T) -> Self
4028    where
4029        T: std::convert::Into<crate::model::ScheduleOptionsV2>,
4030    {
4031        self.schedule_options_v2 = std::option::Option::Some(v.into());
4032        self
4033    }
4034
4035    /// Sets or clears the value of [schedule_options_v2][crate::model::TransferConfig::schedule_options_v2].
4036    ///
4037    /// # Example
4038    /// ```ignore,no_run
4039    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4040    /// use google_cloud_bigquery_datatransfer_v1::model::ScheduleOptionsV2;
4041    /// let x = TransferConfig::new().set_or_clear_schedule_options_v2(Some(ScheduleOptionsV2::default()/* use setters */));
4042    /// let x = TransferConfig::new().set_or_clear_schedule_options_v2(None::<ScheduleOptionsV2>);
4043    /// ```
4044    pub fn set_or_clear_schedule_options_v2<T>(mut self, v: std::option::Option<T>) -> Self
4045    where
4046        T: std::convert::Into<crate::model::ScheduleOptionsV2>,
4047    {
4048        self.schedule_options_v2 = v.map(|x| x.into());
4049        self
4050    }
4051
4052    /// Sets the value of [data_refresh_window_days][crate::model::TransferConfig::data_refresh_window_days].
4053    ///
4054    /// # Example
4055    /// ```ignore,no_run
4056    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4057    /// let x = TransferConfig::new().set_data_refresh_window_days(42);
4058    /// ```
4059    pub fn set_data_refresh_window_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4060        self.data_refresh_window_days = v.into();
4061        self
4062    }
4063
4064    /// Sets the value of [disabled][crate::model::TransferConfig::disabled].
4065    ///
4066    /// # Example
4067    /// ```ignore,no_run
4068    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4069    /// let x = TransferConfig::new().set_disabled(true);
4070    /// ```
4071    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4072        self.disabled = v.into();
4073        self
4074    }
4075
4076    /// Sets the value of [update_time][crate::model::TransferConfig::update_time].
4077    ///
4078    /// # Example
4079    /// ```ignore,no_run
4080    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4081    /// use wkt::Timestamp;
4082    /// let x = TransferConfig::new().set_update_time(Timestamp::default()/* use setters */);
4083    /// ```
4084    pub fn set_update_time<T>(mut self, v: T) -> Self
4085    where
4086        T: std::convert::Into<wkt::Timestamp>,
4087    {
4088        self.update_time = std::option::Option::Some(v.into());
4089        self
4090    }
4091
4092    /// Sets or clears the value of [update_time][crate::model::TransferConfig::update_time].
4093    ///
4094    /// # Example
4095    /// ```ignore,no_run
4096    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4097    /// use wkt::Timestamp;
4098    /// let x = TransferConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4099    /// let x = TransferConfig::new().set_or_clear_update_time(None::<Timestamp>);
4100    /// ```
4101    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4102    where
4103        T: std::convert::Into<wkt::Timestamp>,
4104    {
4105        self.update_time = v.map(|x| x.into());
4106        self
4107    }
4108
4109    /// Sets the value of [next_run_time][crate::model::TransferConfig::next_run_time].
4110    ///
4111    /// # Example
4112    /// ```ignore,no_run
4113    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4114    /// use wkt::Timestamp;
4115    /// let x = TransferConfig::new().set_next_run_time(Timestamp::default()/* use setters */);
4116    /// ```
4117    pub fn set_next_run_time<T>(mut self, v: T) -> Self
4118    where
4119        T: std::convert::Into<wkt::Timestamp>,
4120    {
4121        self.next_run_time = std::option::Option::Some(v.into());
4122        self
4123    }
4124
4125    /// Sets or clears the value of [next_run_time][crate::model::TransferConfig::next_run_time].
4126    ///
4127    /// # Example
4128    /// ```ignore,no_run
4129    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4130    /// use wkt::Timestamp;
4131    /// let x = TransferConfig::new().set_or_clear_next_run_time(Some(Timestamp::default()/* use setters */));
4132    /// let x = TransferConfig::new().set_or_clear_next_run_time(None::<Timestamp>);
4133    /// ```
4134    pub fn set_or_clear_next_run_time<T>(mut self, v: std::option::Option<T>) -> Self
4135    where
4136        T: std::convert::Into<wkt::Timestamp>,
4137    {
4138        self.next_run_time = v.map(|x| x.into());
4139        self
4140    }
4141
4142    /// Sets the value of [state][crate::model::TransferConfig::state].
4143    ///
4144    /// # Example
4145    /// ```ignore,no_run
4146    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4147    /// use google_cloud_bigquery_datatransfer_v1::model::TransferState;
4148    /// let x0 = TransferConfig::new().set_state(TransferState::Pending);
4149    /// let x1 = TransferConfig::new().set_state(TransferState::Running);
4150    /// let x2 = TransferConfig::new().set_state(TransferState::Succeeded);
4151    /// ```
4152    pub fn set_state<T: std::convert::Into<crate::model::TransferState>>(mut self, v: T) -> Self {
4153        self.state = v.into();
4154        self
4155    }
4156
4157    /// Sets the value of [user_id][crate::model::TransferConfig::user_id].
4158    ///
4159    /// # Example
4160    /// ```ignore,no_run
4161    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4162    /// let x = TransferConfig::new().set_user_id(42);
4163    /// ```
4164    pub fn set_user_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4165        self.user_id = v.into();
4166        self
4167    }
4168
4169    /// Sets the value of [dataset_region][crate::model::TransferConfig::dataset_region].
4170    ///
4171    /// # Example
4172    /// ```ignore,no_run
4173    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4174    /// let x = TransferConfig::new().set_dataset_region("example");
4175    /// ```
4176    pub fn set_dataset_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4177        self.dataset_region = v.into();
4178        self
4179    }
4180
4181    /// Sets the value of [notification_pubsub_topic][crate::model::TransferConfig::notification_pubsub_topic].
4182    ///
4183    /// # Example
4184    /// ```ignore,no_run
4185    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4186    /// let x = TransferConfig::new().set_notification_pubsub_topic("example");
4187    /// ```
4188    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
4189        mut self,
4190        v: T,
4191    ) -> Self {
4192        self.notification_pubsub_topic = v.into();
4193        self
4194    }
4195
4196    /// Sets the value of [email_preferences][crate::model::TransferConfig::email_preferences].
4197    ///
4198    /// # Example
4199    /// ```ignore,no_run
4200    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4201    /// use google_cloud_bigquery_datatransfer_v1::model::EmailPreferences;
4202    /// let x = TransferConfig::new().set_email_preferences(EmailPreferences::default()/* use setters */);
4203    /// ```
4204    pub fn set_email_preferences<T>(mut self, v: T) -> Self
4205    where
4206        T: std::convert::Into<crate::model::EmailPreferences>,
4207    {
4208        self.email_preferences = std::option::Option::Some(v.into());
4209        self
4210    }
4211
4212    /// Sets or clears the value of [email_preferences][crate::model::TransferConfig::email_preferences].
4213    ///
4214    /// # Example
4215    /// ```ignore,no_run
4216    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4217    /// use google_cloud_bigquery_datatransfer_v1::model::EmailPreferences;
4218    /// let x = TransferConfig::new().set_or_clear_email_preferences(Some(EmailPreferences::default()/* use setters */));
4219    /// let x = TransferConfig::new().set_or_clear_email_preferences(None::<EmailPreferences>);
4220    /// ```
4221    pub fn set_or_clear_email_preferences<T>(mut self, v: std::option::Option<T>) -> Self
4222    where
4223        T: std::convert::Into<crate::model::EmailPreferences>,
4224    {
4225        self.email_preferences = v.map(|x| x.into());
4226        self
4227    }
4228
4229    /// Sets the value of [owner_info][crate::model::TransferConfig::owner_info].
4230    ///
4231    /// # Example
4232    /// ```ignore,no_run
4233    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4234    /// use google_cloud_bigquery_datatransfer_v1::model::UserInfo;
4235    /// let x = TransferConfig::new().set_owner_info(UserInfo::default()/* use setters */);
4236    /// ```
4237    pub fn set_owner_info<T>(mut self, v: T) -> Self
4238    where
4239        T: std::convert::Into<crate::model::UserInfo>,
4240    {
4241        self.owner_info = std::option::Option::Some(v.into());
4242        self
4243    }
4244
4245    /// Sets or clears the value of [owner_info][crate::model::TransferConfig::owner_info].
4246    ///
4247    /// # Example
4248    /// ```ignore,no_run
4249    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4250    /// use google_cloud_bigquery_datatransfer_v1::model::UserInfo;
4251    /// let x = TransferConfig::new().set_or_clear_owner_info(Some(UserInfo::default()/* use setters */));
4252    /// let x = TransferConfig::new().set_or_clear_owner_info(None::<UserInfo>);
4253    /// ```
4254    pub fn set_or_clear_owner_info<T>(mut self, v: std::option::Option<T>) -> Self
4255    where
4256        T: std::convert::Into<crate::model::UserInfo>,
4257    {
4258        self.owner_info = v.map(|x| x.into());
4259        self
4260    }
4261
4262    /// Sets the value of [encryption_configuration][crate::model::TransferConfig::encryption_configuration].
4263    ///
4264    /// # Example
4265    /// ```ignore,no_run
4266    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4267    /// use google_cloud_bigquery_datatransfer_v1::model::EncryptionConfiguration;
4268    /// let x = TransferConfig::new().set_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
4269    /// ```
4270    pub fn set_encryption_configuration<T>(mut self, v: T) -> Self
4271    where
4272        T: std::convert::Into<crate::model::EncryptionConfiguration>,
4273    {
4274        self.encryption_configuration = std::option::Option::Some(v.into());
4275        self
4276    }
4277
4278    /// Sets or clears the value of [encryption_configuration][crate::model::TransferConfig::encryption_configuration].
4279    ///
4280    /// # Example
4281    /// ```ignore,no_run
4282    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4283    /// use google_cloud_bigquery_datatransfer_v1::model::EncryptionConfiguration;
4284    /// let x = TransferConfig::new().set_or_clear_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
4285    /// let x = TransferConfig::new().set_or_clear_encryption_configuration(None::<EncryptionConfiguration>);
4286    /// ```
4287    pub fn set_or_clear_encryption_configuration<T>(mut self, v: std::option::Option<T>) -> Self
4288    where
4289        T: std::convert::Into<crate::model::EncryptionConfiguration>,
4290    {
4291        self.encryption_configuration = v.map(|x| x.into());
4292        self
4293    }
4294
4295    /// Sets the value of [error][crate::model::TransferConfig::error].
4296    ///
4297    /// # Example
4298    /// ```ignore,no_run
4299    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4300    /// use rpc::model::Status;
4301    /// let x = TransferConfig::new().set_error(Status::default()/* use setters */);
4302    /// ```
4303    pub fn set_error<T>(mut self, v: T) -> Self
4304    where
4305        T: std::convert::Into<rpc::model::Status>,
4306    {
4307        self.error = std::option::Option::Some(v.into());
4308        self
4309    }
4310
4311    /// Sets or clears the value of [error][crate::model::TransferConfig::error].
4312    ///
4313    /// # Example
4314    /// ```ignore,no_run
4315    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4316    /// use rpc::model::Status;
4317    /// let x = TransferConfig::new().set_or_clear_error(Some(Status::default()/* use setters */));
4318    /// let x = TransferConfig::new().set_or_clear_error(None::<Status>);
4319    /// ```
4320    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
4321    where
4322        T: std::convert::Into<rpc::model::Status>,
4323    {
4324        self.error = v.map(|x| x.into());
4325        self
4326    }
4327
4328    /// Sets the value of [destination][crate::model::TransferConfig::destination].
4329    ///
4330    /// Note that all the setters affecting `destination` are mutually
4331    /// exclusive.
4332    ///
4333    /// # Example
4334    /// ```ignore,no_run
4335    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4336    /// use google_cloud_bigquery_datatransfer_v1::model::transfer_config::Destination;
4337    /// let x = TransferConfig::new().set_destination(Some(Destination::DestinationDatasetId("example".to_string())));
4338    /// ```
4339    pub fn set_destination<
4340        T: std::convert::Into<std::option::Option<crate::model::transfer_config::Destination>>,
4341    >(
4342        mut self,
4343        v: T,
4344    ) -> Self {
4345        self.destination = v.into();
4346        self
4347    }
4348
4349    /// The value of [destination][crate::model::TransferConfig::destination]
4350    /// if it holds a `DestinationDatasetId`, `None` if the field is not set or
4351    /// holds a different branch.
4352    pub fn destination_dataset_id(&self) -> std::option::Option<&std::string::String> {
4353        #[allow(unreachable_patterns)]
4354        self.destination.as_ref().and_then(|v| match v {
4355            crate::model::transfer_config::Destination::DestinationDatasetId(v) => {
4356                std::option::Option::Some(v)
4357            }
4358            _ => std::option::Option::None,
4359        })
4360    }
4361
4362    /// Sets the value of [destination][crate::model::TransferConfig::destination]
4363    /// to hold a `DestinationDatasetId`.
4364    ///
4365    /// Note that all the setters affecting `destination` are
4366    /// mutually exclusive.
4367    ///
4368    /// # Example
4369    /// ```ignore,no_run
4370    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferConfig;
4371    /// let x = TransferConfig::new().set_destination_dataset_id("example");
4372    /// assert!(x.destination_dataset_id().is_some());
4373    /// ```
4374    pub fn set_destination_dataset_id<T: std::convert::Into<std::string::String>>(
4375        mut self,
4376        v: T,
4377    ) -> Self {
4378        self.destination = std::option::Option::Some(
4379            crate::model::transfer_config::Destination::DestinationDatasetId(v.into()),
4380        );
4381        self
4382    }
4383}
4384
4385impl wkt::message::Message for TransferConfig {
4386    fn typename() -> &'static str {
4387        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TransferConfig"
4388    }
4389}
4390
4391/// Defines additional types related to [TransferConfig].
4392pub mod transfer_config {
4393    #[allow(unused_imports)]
4394    use super::*;
4395
4396    /// The desination of the transfer config.
4397    #[derive(Clone, Debug, PartialEq)]
4398    #[non_exhaustive]
4399    pub enum Destination {
4400        /// The BigQuery target dataset id.
4401        DestinationDatasetId(std::string::String),
4402    }
4403}
4404
4405/// Represents the encryption configuration for a transfer.
4406#[derive(Clone, Default, PartialEq)]
4407#[non_exhaustive]
4408pub struct EncryptionConfiguration {
4409    /// The name of the KMS key used for encrypting BigQuery data.
4410    pub kms_key_name: std::option::Option<wkt::StringValue>,
4411
4412    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4413}
4414
4415impl EncryptionConfiguration {
4416    pub fn new() -> Self {
4417        std::default::Default::default()
4418    }
4419
4420    /// Sets the value of [kms_key_name][crate::model::EncryptionConfiguration::kms_key_name].
4421    ///
4422    /// # Example
4423    /// ```ignore,no_run
4424    /// # use google_cloud_bigquery_datatransfer_v1::model::EncryptionConfiguration;
4425    /// use wkt::StringValue;
4426    /// let x = EncryptionConfiguration::new().set_kms_key_name(StringValue::default()/* use setters */);
4427    /// ```
4428    pub fn set_kms_key_name<T>(mut self, v: T) -> Self
4429    where
4430        T: std::convert::Into<wkt::StringValue>,
4431    {
4432        self.kms_key_name = std::option::Option::Some(v.into());
4433        self
4434    }
4435
4436    /// Sets or clears the value of [kms_key_name][crate::model::EncryptionConfiguration::kms_key_name].
4437    ///
4438    /// # Example
4439    /// ```ignore,no_run
4440    /// # use google_cloud_bigquery_datatransfer_v1::model::EncryptionConfiguration;
4441    /// use wkt::StringValue;
4442    /// let x = EncryptionConfiguration::new().set_or_clear_kms_key_name(Some(StringValue::default()/* use setters */));
4443    /// let x = EncryptionConfiguration::new().set_or_clear_kms_key_name(None::<StringValue>);
4444    /// ```
4445    pub fn set_or_clear_kms_key_name<T>(mut self, v: std::option::Option<T>) -> Self
4446    where
4447        T: std::convert::Into<wkt::StringValue>,
4448    {
4449        self.kms_key_name = v.map(|x| x.into());
4450        self
4451    }
4452}
4453
4454impl wkt::message::Message for EncryptionConfiguration {
4455    fn typename() -> &'static str {
4456        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.EncryptionConfiguration"
4457    }
4458}
4459
4460/// Represents a data transfer run.
4461#[derive(Clone, Default, PartialEq)]
4462#[non_exhaustive]
4463pub struct TransferRun {
4464    /// Identifier. The resource name of the transfer run.
4465    /// Transfer run names have the form
4466    /// `projects/{project_id}/locations/{location}/transferConfigs/{config_id}/runs/{run_id}`.
4467    /// The name is ignored when creating a transfer run.
4468    pub name: std::string::String,
4469
4470    /// Minimum time after which a transfer run can be started.
4471    pub schedule_time: std::option::Option<wkt::Timestamp>,
4472
4473    /// For batch transfer runs, specifies the date and time of the data should be
4474    /// ingested.
4475    pub run_time: std::option::Option<wkt::Timestamp>,
4476
4477    /// Status of the transfer run.
4478    pub error_status: std::option::Option<rpc::model::Status>,
4479
4480    /// Output only. Time when transfer run was started.
4481    /// Parameter ignored by server for input requests.
4482    pub start_time: std::option::Option<wkt::Timestamp>,
4483
4484    /// Output only. Time when transfer run ended.
4485    /// Parameter ignored by server for input requests.
4486    pub end_time: std::option::Option<wkt::Timestamp>,
4487
4488    /// Output only. Last time the data transfer run state was updated.
4489    pub update_time: std::option::Option<wkt::Timestamp>,
4490
4491    /// Output only. Parameters specific to each data source. For more information
4492    /// see the bq tab in the 'Setting up a data transfer' section for each data
4493    /// source. For example the parameters for Cloud Storage transfers are listed
4494    /// here:
4495    /// <https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq>
4496    pub params: std::option::Option<wkt::Struct>,
4497
4498    /// Output only. Data source id.
4499    pub data_source_id: std::string::String,
4500
4501    /// Data transfer run state. Ignored for input requests.
4502    pub state: crate::model::TransferState,
4503
4504    /// Deprecated. Unique ID of the user on whose behalf transfer is done.
4505    pub user_id: i64,
4506
4507    /// Output only. Describes the schedule of this transfer run if it was
4508    /// created as part of a regular schedule. For batch transfer runs that are
4509    /// scheduled manually, this is empty.
4510    /// NOTE: the system might choose to delay the schedule depending on the
4511    /// current load, so `schedule_time` doesn't always match this.
4512    pub schedule: std::string::String,
4513
4514    /// Output only. Pub/Sub topic where a notification will be sent after this
4515    /// transfer run finishes.
4516    ///
4517    /// The format for specifying a pubsub topic is:
4518    /// `projects/{project_id}/topics/{topic_id}`
4519    pub notification_pubsub_topic: std::string::String,
4520
4521    /// Output only. Email notifications will be sent according to these
4522    /// preferences to the email address of the user who owns the transfer config
4523    /// this run was derived from.
4524    pub email_preferences: std::option::Option<crate::model::EmailPreferences>,
4525
4526    /// Data transfer destination.
4527    pub destination: std::option::Option<crate::model::transfer_run::Destination>,
4528
4529    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4530}
4531
4532impl TransferRun {
4533    pub fn new() -> Self {
4534        std::default::Default::default()
4535    }
4536
4537    /// Sets the value of [name][crate::model::TransferRun::name].
4538    ///
4539    /// # Example
4540    /// ```ignore,no_run
4541    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4542    /// let x = TransferRun::new().set_name("example");
4543    /// ```
4544    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4545        self.name = v.into();
4546        self
4547    }
4548
4549    /// Sets the value of [schedule_time][crate::model::TransferRun::schedule_time].
4550    ///
4551    /// # Example
4552    /// ```ignore,no_run
4553    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4554    /// use wkt::Timestamp;
4555    /// let x = TransferRun::new().set_schedule_time(Timestamp::default()/* use setters */);
4556    /// ```
4557    pub fn set_schedule_time<T>(mut self, v: T) -> Self
4558    where
4559        T: std::convert::Into<wkt::Timestamp>,
4560    {
4561        self.schedule_time = std::option::Option::Some(v.into());
4562        self
4563    }
4564
4565    /// Sets or clears the value of [schedule_time][crate::model::TransferRun::schedule_time].
4566    ///
4567    /// # Example
4568    /// ```ignore,no_run
4569    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4570    /// use wkt::Timestamp;
4571    /// let x = TransferRun::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
4572    /// let x = TransferRun::new().set_or_clear_schedule_time(None::<Timestamp>);
4573    /// ```
4574    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
4575    where
4576        T: std::convert::Into<wkt::Timestamp>,
4577    {
4578        self.schedule_time = v.map(|x| x.into());
4579        self
4580    }
4581
4582    /// Sets the value of [run_time][crate::model::TransferRun::run_time].
4583    ///
4584    /// # Example
4585    /// ```ignore,no_run
4586    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4587    /// use wkt::Timestamp;
4588    /// let x = TransferRun::new().set_run_time(Timestamp::default()/* use setters */);
4589    /// ```
4590    pub fn set_run_time<T>(mut self, v: T) -> Self
4591    where
4592        T: std::convert::Into<wkt::Timestamp>,
4593    {
4594        self.run_time = std::option::Option::Some(v.into());
4595        self
4596    }
4597
4598    /// Sets or clears the value of [run_time][crate::model::TransferRun::run_time].
4599    ///
4600    /// # Example
4601    /// ```ignore,no_run
4602    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4603    /// use wkt::Timestamp;
4604    /// let x = TransferRun::new().set_or_clear_run_time(Some(Timestamp::default()/* use setters */));
4605    /// let x = TransferRun::new().set_or_clear_run_time(None::<Timestamp>);
4606    /// ```
4607    pub fn set_or_clear_run_time<T>(mut self, v: std::option::Option<T>) -> Self
4608    where
4609        T: std::convert::Into<wkt::Timestamp>,
4610    {
4611        self.run_time = v.map(|x| x.into());
4612        self
4613    }
4614
4615    /// Sets the value of [error_status][crate::model::TransferRun::error_status].
4616    ///
4617    /// # Example
4618    /// ```ignore,no_run
4619    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4620    /// use rpc::model::Status;
4621    /// let x = TransferRun::new().set_error_status(Status::default()/* use setters */);
4622    /// ```
4623    pub fn set_error_status<T>(mut self, v: T) -> Self
4624    where
4625        T: std::convert::Into<rpc::model::Status>,
4626    {
4627        self.error_status = std::option::Option::Some(v.into());
4628        self
4629    }
4630
4631    /// Sets or clears the value of [error_status][crate::model::TransferRun::error_status].
4632    ///
4633    /// # Example
4634    /// ```ignore,no_run
4635    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4636    /// use rpc::model::Status;
4637    /// let x = TransferRun::new().set_or_clear_error_status(Some(Status::default()/* use setters */));
4638    /// let x = TransferRun::new().set_or_clear_error_status(None::<Status>);
4639    /// ```
4640    pub fn set_or_clear_error_status<T>(mut self, v: std::option::Option<T>) -> Self
4641    where
4642        T: std::convert::Into<rpc::model::Status>,
4643    {
4644        self.error_status = v.map(|x| x.into());
4645        self
4646    }
4647
4648    /// Sets the value of [start_time][crate::model::TransferRun::start_time].
4649    ///
4650    /// # Example
4651    /// ```ignore,no_run
4652    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4653    /// use wkt::Timestamp;
4654    /// let x = TransferRun::new().set_start_time(Timestamp::default()/* use setters */);
4655    /// ```
4656    pub fn set_start_time<T>(mut self, v: T) -> Self
4657    where
4658        T: std::convert::Into<wkt::Timestamp>,
4659    {
4660        self.start_time = std::option::Option::Some(v.into());
4661        self
4662    }
4663
4664    /// Sets or clears the value of [start_time][crate::model::TransferRun::start_time].
4665    ///
4666    /// # Example
4667    /// ```ignore,no_run
4668    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4669    /// use wkt::Timestamp;
4670    /// let x = TransferRun::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4671    /// let x = TransferRun::new().set_or_clear_start_time(None::<Timestamp>);
4672    /// ```
4673    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4674    where
4675        T: std::convert::Into<wkt::Timestamp>,
4676    {
4677        self.start_time = v.map(|x| x.into());
4678        self
4679    }
4680
4681    /// Sets the value of [end_time][crate::model::TransferRun::end_time].
4682    ///
4683    /// # Example
4684    /// ```ignore,no_run
4685    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4686    /// use wkt::Timestamp;
4687    /// let x = TransferRun::new().set_end_time(Timestamp::default()/* use setters */);
4688    /// ```
4689    pub fn set_end_time<T>(mut self, v: T) -> Self
4690    where
4691        T: std::convert::Into<wkt::Timestamp>,
4692    {
4693        self.end_time = std::option::Option::Some(v.into());
4694        self
4695    }
4696
4697    /// Sets or clears the value of [end_time][crate::model::TransferRun::end_time].
4698    ///
4699    /// # Example
4700    /// ```ignore,no_run
4701    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4702    /// use wkt::Timestamp;
4703    /// let x = TransferRun::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4704    /// let x = TransferRun::new().set_or_clear_end_time(None::<Timestamp>);
4705    /// ```
4706    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4707    where
4708        T: std::convert::Into<wkt::Timestamp>,
4709    {
4710        self.end_time = v.map(|x| x.into());
4711        self
4712    }
4713
4714    /// Sets the value of [update_time][crate::model::TransferRun::update_time].
4715    ///
4716    /// # Example
4717    /// ```ignore,no_run
4718    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4719    /// use wkt::Timestamp;
4720    /// let x = TransferRun::new().set_update_time(Timestamp::default()/* use setters */);
4721    /// ```
4722    pub fn set_update_time<T>(mut self, v: T) -> Self
4723    where
4724        T: std::convert::Into<wkt::Timestamp>,
4725    {
4726        self.update_time = std::option::Option::Some(v.into());
4727        self
4728    }
4729
4730    /// Sets or clears the value of [update_time][crate::model::TransferRun::update_time].
4731    ///
4732    /// # Example
4733    /// ```ignore,no_run
4734    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4735    /// use wkt::Timestamp;
4736    /// let x = TransferRun::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4737    /// let x = TransferRun::new().set_or_clear_update_time(None::<Timestamp>);
4738    /// ```
4739    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4740    where
4741        T: std::convert::Into<wkt::Timestamp>,
4742    {
4743        self.update_time = v.map(|x| x.into());
4744        self
4745    }
4746
4747    /// Sets the value of [params][crate::model::TransferRun::params].
4748    ///
4749    /// # Example
4750    /// ```ignore,no_run
4751    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4752    /// use wkt::Struct;
4753    /// let x = TransferRun::new().set_params(Struct::default()/* use setters */);
4754    /// ```
4755    pub fn set_params<T>(mut self, v: T) -> Self
4756    where
4757        T: std::convert::Into<wkt::Struct>,
4758    {
4759        self.params = std::option::Option::Some(v.into());
4760        self
4761    }
4762
4763    /// Sets or clears the value of [params][crate::model::TransferRun::params].
4764    ///
4765    /// # Example
4766    /// ```ignore,no_run
4767    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4768    /// use wkt::Struct;
4769    /// let x = TransferRun::new().set_or_clear_params(Some(Struct::default()/* use setters */));
4770    /// let x = TransferRun::new().set_or_clear_params(None::<Struct>);
4771    /// ```
4772    pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
4773    where
4774        T: std::convert::Into<wkt::Struct>,
4775    {
4776        self.params = v.map(|x| x.into());
4777        self
4778    }
4779
4780    /// Sets the value of [data_source_id][crate::model::TransferRun::data_source_id].
4781    ///
4782    /// # Example
4783    /// ```ignore,no_run
4784    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4785    /// let x = TransferRun::new().set_data_source_id("example");
4786    /// ```
4787    pub fn set_data_source_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4788        self.data_source_id = v.into();
4789        self
4790    }
4791
4792    /// Sets the value of [state][crate::model::TransferRun::state].
4793    ///
4794    /// # Example
4795    /// ```ignore,no_run
4796    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4797    /// use google_cloud_bigquery_datatransfer_v1::model::TransferState;
4798    /// let x0 = TransferRun::new().set_state(TransferState::Pending);
4799    /// let x1 = TransferRun::new().set_state(TransferState::Running);
4800    /// let x2 = TransferRun::new().set_state(TransferState::Succeeded);
4801    /// ```
4802    pub fn set_state<T: std::convert::Into<crate::model::TransferState>>(mut self, v: T) -> Self {
4803        self.state = v.into();
4804        self
4805    }
4806
4807    /// Sets the value of [user_id][crate::model::TransferRun::user_id].
4808    ///
4809    /// # Example
4810    /// ```ignore,no_run
4811    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4812    /// let x = TransferRun::new().set_user_id(42);
4813    /// ```
4814    pub fn set_user_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4815        self.user_id = v.into();
4816        self
4817    }
4818
4819    /// Sets the value of [schedule][crate::model::TransferRun::schedule].
4820    ///
4821    /// # Example
4822    /// ```ignore,no_run
4823    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4824    /// let x = TransferRun::new().set_schedule("example");
4825    /// ```
4826    pub fn set_schedule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4827        self.schedule = v.into();
4828        self
4829    }
4830
4831    /// Sets the value of [notification_pubsub_topic][crate::model::TransferRun::notification_pubsub_topic].
4832    ///
4833    /// # Example
4834    /// ```ignore,no_run
4835    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4836    /// let x = TransferRun::new().set_notification_pubsub_topic("example");
4837    /// ```
4838    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
4839        mut self,
4840        v: T,
4841    ) -> Self {
4842        self.notification_pubsub_topic = v.into();
4843        self
4844    }
4845
4846    /// Sets the value of [email_preferences][crate::model::TransferRun::email_preferences].
4847    ///
4848    /// # Example
4849    /// ```ignore,no_run
4850    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4851    /// use google_cloud_bigquery_datatransfer_v1::model::EmailPreferences;
4852    /// let x = TransferRun::new().set_email_preferences(EmailPreferences::default()/* use setters */);
4853    /// ```
4854    pub fn set_email_preferences<T>(mut self, v: T) -> Self
4855    where
4856        T: std::convert::Into<crate::model::EmailPreferences>,
4857    {
4858        self.email_preferences = std::option::Option::Some(v.into());
4859        self
4860    }
4861
4862    /// Sets or clears the value of [email_preferences][crate::model::TransferRun::email_preferences].
4863    ///
4864    /// # Example
4865    /// ```ignore,no_run
4866    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4867    /// use google_cloud_bigquery_datatransfer_v1::model::EmailPreferences;
4868    /// let x = TransferRun::new().set_or_clear_email_preferences(Some(EmailPreferences::default()/* use setters */));
4869    /// let x = TransferRun::new().set_or_clear_email_preferences(None::<EmailPreferences>);
4870    /// ```
4871    pub fn set_or_clear_email_preferences<T>(mut self, v: std::option::Option<T>) -> Self
4872    where
4873        T: std::convert::Into<crate::model::EmailPreferences>,
4874    {
4875        self.email_preferences = v.map(|x| x.into());
4876        self
4877    }
4878
4879    /// Sets the value of [destination][crate::model::TransferRun::destination].
4880    ///
4881    /// Note that all the setters affecting `destination` are mutually
4882    /// exclusive.
4883    ///
4884    /// # Example
4885    /// ```ignore,no_run
4886    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4887    /// use google_cloud_bigquery_datatransfer_v1::model::transfer_run::Destination;
4888    /// let x = TransferRun::new().set_destination(Some(Destination::DestinationDatasetId("example".to_string())));
4889    /// ```
4890    pub fn set_destination<
4891        T: std::convert::Into<std::option::Option<crate::model::transfer_run::Destination>>,
4892    >(
4893        mut self,
4894        v: T,
4895    ) -> Self {
4896        self.destination = v.into();
4897        self
4898    }
4899
4900    /// The value of [destination][crate::model::TransferRun::destination]
4901    /// if it holds a `DestinationDatasetId`, `None` if the field is not set or
4902    /// holds a different branch.
4903    pub fn destination_dataset_id(&self) -> std::option::Option<&std::string::String> {
4904        #[allow(unreachable_patterns)]
4905        self.destination.as_ref().and_then(|v| match v {
4906            crate::model::transfer_run::Destination::DestinationDatasetId(v) => {
4907                std::option::Option::Some(v)
4908            }
4909            _ => std::option::Option::None,
4910        })
4911    }
4912
4913    /// Sets the value of [destination][crate::model::TransferRun::destination]
4914    /// to hold a `DestinationDatasetId`.
4915    ///
4916    /// Note that all the setters affecting `destination` are
4917    /// mutually exclusive.
4918    ///
4919    /// # Example
4920    /// ```ignore,no_run
4921    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferRun;
4922    /// let x = TransferRun::new().set_destination_dataset_id("example");
4923    /// assert!(x.destination_dataset_id().is_some());
4924    /// ```
4925    pub fn set_destination_dataset_id<T: std::convert::Into<std::string::String>>(
4926        mut self,
4927        v: T,
4928    ) -> Self {
4929        self.destination = std::option::Option::Some(
4930            crate::model::transfer_run::Destination::DestinationDatasetId(v.into()),
4931        );
4932        self
4933    }
4934}
4935
4936impl wkt::message::Message for TransferRun {
4937    fn typename() -> &'static str {
4938        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TransferRun"
4939    }
4940}
4941
4942/// Defines additional types related to [TransferRun].
4943pub mod transfer_run {
4944    #[allow(unused_imports)]
4945    use super::*;
4946
4947    /// Data transfer destination.
4948    #[derive(Clone, Debug, PartialEq)]
4949    #[non_exhaustive]
4950    pub enum Destination {
4951        /// Output only. The BigQuery target dataset id.
4952        DestinationDatasetId(std::string::String),
4953    }
4954}
4955
4956/// Represents a user facing message for a particular data transfer run.
4957#[derive(Clone, Default, PartialEq)]
4958#[non_exhaustive]
4959pub struct TransferMessage {
4960    /// Time when message was logged.
4961    pub message_time: std::option::Option<wkt::Timestamp>,
4962
4963    /// Message severity.
4964    pub severity: crate::model::transfer_message::MessageSeverity,
4965
4966    /// Message text.
4967    pub message_text: std::string::String,
4968
4969    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4970}
4971
4972impl TransferMessage {
4973    pub fn new() -> Self {
4974        std::default::Default::default()
4975    }
4976
4977    /// Sets the value of [message_time][crate::model::TransferMessage::message_time].
4978    ///
4979    /// # Example
4980    /// ```ignore,no_run
4981    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferMessage;
4982    /// use wkt::Timestamp;
4983    /// let x = TransferMessage::new().set_message_time(Timestamp::default()/* use setters */);
4984    /// ```
4985    pub fn set_message_time<T>(mut self, v: T) -> Self
4986    where
4987        T: std::convert::Into<wkt::Timestamp>,
4988    {
4989        self.message_time = std::option::Option::Some(v.into());
4990        self
4991    }
4992
4993    /// Sets or clears the value of [message_time][crate::model::TransferMessage::message_time].
4994    ///
4995    /// # Example
4996    /// ```ignore,no_run
4997    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferMessage;
4998    /// use wkt::Timestamp;
4999    /// let x = TransferMessage::new().set_or_clear_message_time(Some(Timestamp::default()/* use setters */));
5000    /// let x = TransferMessage::new().set_or_clear_message_time(None::<Timestamp>);
5001    /// ```
5002    pub fn set_or_clear_message_time<T>(mut self, v: std::option::Option<T>) -> Self
5003    where
5004        T: std::convert::Into<wkt::Timestamp>,
5005    {
5006        self.message_time = v.map(|x| x.into());
5007        self
5008    }
5009
5010    /// Sets the value of [severity][crate::model::TransferMessage::severity].
5011    ///
5012    /// # Example
5013    /// ```ignore,no_run
5014    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferMessage;
5015    /// use google_cloud_bigquery_datatransfer_v1::model::transfer_message::MessageSeverity;
5016    /// let x0 = TransferMessage::new().set_severity(MessageSeverity::Info);
5017    /// let x1 = TransferMessage::new().set_severity(MessageSeverity::Warning);
5018    /// let x2 = TransferMessage::new().set_severity(MessageSeverity::Error);
5019    /// ```
5020    pub fn set_severity<T: std::convert::Into<crate::model::transfer_message::MessageSeverity>>(
5021        mut self,
5022        v: T,
5023    ) -> Self {
5024        self.severity = v.into();
5025        self
5026    }
5027
5028    /// Sets the value of [message_text][crate::model::TransferMessage::message_text].
5029    ///
5030    /// # Example
5031    /// ```ignore,no_run
5032    /// # use google_cloud_bigquery_datatransfer_v1::model::TransferMessage;
5033    /// let x = TransferMessage::new().set_message_text("example");
5034    /// ```
5035    pub fn set_message_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5036        self.message_text = v.into();
5037        self
5038    }
5039}
5040
5041impl wkt::message::Message for TransferMessage {
5042    fn typename() -> &'static str {
5043        "type.googleapis.com/google.cloud.bigquery.datatransfer.v1.TransferMessage"
5044    }
5045}
5046
5047/// Defines additional types related to [TransferMessage].
5048pub mod transfer_message {
5049    #[allow(unused_imports)]
5050    use super::*;
5051
5052    /// Represents data transfer user facing message severity.
5053    ///
5054    /// # Working with unknown values
5055    ///
5056    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5057    /// additional enum variants at any time. Adding new variants is not considered
5058    /// a breaking change. Applications should write their code in anticipation of:
5059    ///
5060    /// - New values appearing in future releases of the client library, **and**
5061    /// - New values received dynamically, without application changes.
5062    ///
5063    /// Please consult the [Working with enums] section in the user guide for some
5064    /// guidelines.
5065    ///
5066    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5067    #[derive(Clone, Debug, PartialEq)]
5068    #[non_exhaustive]
5069    pub enum MessageSeverity {
5070        /// No severity specified.
5071        Unspecified,
5072        /// Informational message.
5073        Info,
5074        /// Warning message.
5075        Warning,
5076        /// Error message.
5077        Error,
5078        /// If set, the enum was initialized with an unknown value.
5079        ///
5080        /// Applications can examine the value using [MessageSeverity::value] or
5081        /// [MessageSeverity::name].
5082        UnknownValue(message_severity::UnknownValue),
5083    }
5084
5085    #[doc(hidden)]
5086    pub mod message_severity {
5087        #[allow(unused_imports)]
5088        use super::*;
5089        #[derive(Clone, Debug, PartialEq)]
5090        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5091    }
5092
5093    impl MessageSeverity {
5094        /// Gets the enum value.
5095        ///
5096        /// Returns `None` if the enum contains an unknown value deserialized from
5097        /// the string representation of enums.
5098        pub fn value(&self) -> std::option::Option<i32> {
5099            match self {
5100                Self::Unspecified => std::option::Option::Some(0),
5101                Self::Info => std::option::Option::Some(1),
5102                Self::Warning => std::option::Option::Some(2),
5103                Self::Error => std::option::Option::Some(3),
5104                Self::UnknownValue(u) => u.0.value(),
5105            }
5106        }
5107
5108        /// Gets the enum value as a string.
5109        ///
5110        /// Returns `None` if the enum contains an unknown value deserialized from
5111        /// the integer representation of enums.
5112        pub fn name(&self) -> std::option::Option<&str> {
5113            match self {
5114                Self::Unspecified => std::option::Option::Some("MESSAGE_SEVERITY_UNSPECIFIED"),
5115                Self::Info => std::option::Option::Some("INFO"),
5116                Self::Warning => std::option::Option::Some("WARNING"),
5117                Self::Error => std::option::Option::Some("ERROR"),
5118                Self::UnknownValue(u) => u.0.name(),
5119            }
5120        }
5121    }
5122
5123    impl std::default::Default for MessageSeverity {
5124        fn default() -> Self {
5125            use std::convert::From;
5126            Self::from(0)
5127        }
5128    }
5129
5130    impl std::fmt::Display for MessageSeverity {
5131        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5132            wkt::internal::display_enum(f, self.name(), self.value())
5133        }
5134    }
5135
5136    impl std::convert::From<i32> for MessageSeverity {
5137        fn from(value: i32) -> Self {
5138            match value {
5139                0 => Self::Unspecified,
5140                1 => Self::Info,
5141                2 => Self::Warning,
5142                3 => Self::Error,
5143                _ => Self::UnknownValue(message_severity::UnknownValue(
5144                    wkt::internal::UnknownEnumValue::Integer(value),
5145                )),
5146            }
5147        }
5148    }
5149
5150    impl std::convert::From<&str> for MessageSeverity {
5151        fn from(value: &str) -> Self {
5152            use std::string::ToString;
5153            match value {
5154                "MESSAGE_SEVERITY_UNSPECIFIED" => Self::Unspecified,
5155                "INFO" => Self::Info,
5156                "WARNING" => Self::Warning,
5157                "ERROR" => Self::Error,
5158                _ => Self::UnknownValue(message_severity::UnknownValue(
5159                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5160                )),
5161            }
5162        }
5163    }
5164
5165    impl serde::ser::Serialize for MessageSeverity {
5166        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5167        where
5168            S: serde::Serializer,
5169        {
5170            match self {
5171                Self::Unspecified => serializer.serialize_i32(0),
5172                Self::Info => serializer.serialize_i32(1),
5173                Self::Warning => serializer.serialize_i32(2),
5174                Self::Error => serializer.serialize_i32(3),
5175                Self::UnknownValue(u) => u.0.serialize(serializer),
5176            }
5177        }
5178    }
5179
5180    impl<'de> serde::de::Deserialize<'de> for MessageSeverity {
5181        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5182        where
5183            D: serde::Deserializer<'de>,
5184        {
5185            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageSeverity>::new(
5186                ".google.cloud.bigquery.datatransfer.v1.TransferMessage.MessageSeverity",
5187            ))
5188        }
5189    }
5190}
5191
5192/// DEPRECATED. Represents data transfer type.
5193///
5194/// # Working with unknown values
5195///
5196/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5197/// additional enum variants at any time. Adding new variants is not considered
5198/// a breaking change. Applications should write their code in anticipation of:
5199///
5200/// - New values appearing in future releases of the client library, **and**
5201/// - New values received dynamically, without application changes.
5202///
5203/// Please consult the [Working with enums] section in the user guide for some
5204/// guidelines.
5205///
5206/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5207#[derive(Clone, Debug, PartialEq)]
5208#[non_exhaustive]
5209#[deprecated]
5210pub enum TransferType {
5211    /// Invalid or Unknown transfer type placeholder.
5212    Unspecified,
5213    /// Batch data transfer.
5214    Batch,
5215    /// Streaming data transfer. Streaming data source currently doesn't
5216    /// support multiple transfer configs per project.
5217    Streaming,
5218    /// If set, the enum was initialized with an unknown value.
5219    ///
5220    /// Applications can examine the value using [TransferType::value] or
5221    /// [TransferType::name].
5222    UnknownValue(transfer_type::UnknownValue),
5223}
5224
5225#[doc(hidden)]
5226pub mod transfer_type {
5227    #[allow(unused_imports)]
5228    use super::*;
5229    #[derive(Clone, Debug, PartialEq)]
5230    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5231}
5232
5233impl TransferType {
5234    /// Gets the enum value.
5235    ///
5236    /// Returns `None` if the enum contains an unknown value deserialized from
5237    /// the string representation of enums.
5238    pub fn value(&self) -> std::option::Option<i32> {
5239        match self {
5240            Self::Unspecified => std::option::Option::Some(0),
5241            Self::Batch => std::option::Option::Some(1),
5242            Self::Streaming => std::option::Option::Some(2),
5243            Self::UnknownValue(u) => u.0.value(),
5244        }
5245    }
5246
5247    /// Gets the enum value as a string.
5248    ///
5249    /// Returns `None` if the enum contains an unknown value deserialized from
5250    /// the integer representation of enums.
5251    pub fn name(&self) -> std::option::Option<&str> {
5252        match self {
5253            Self::Unspecified => std::option::Option::Some("TRANSFER_TYPE_UNSPECIFIED"),
5254            Self::Batch => std::option::Option::Some("BATCH"),
5255            Self::Streaming => std::option::Option::Some("STREAMING"),
5256            Self::UnknownValue(u) => u.0.name(),
5257        }
5258    }
5259}
5260
5261impl std::default::Default for TransferType {
5262    fn default() -> Self {
5263        use std::convert::From;
5264        Self::from(0)
5265    }
5266}
5267
5268impl std::fmt::Display for TransferType {
5269    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5270        wkt::internal::display_enum(f, self.name(), self.value())
5271    }
5272}
5273
5274impl std::convert::From<i32> for TransferType {
5275    fn from(value: i32) -> Self {
5276        match value {
5277            0 => Self::Unspecified,
5278            1 => Self::Batch,
5279            2 => Self::Streaming,
5280            _ => Self::UnknownValue(transfer_type::UnknownValue(
5281                wkt::internal::UnknownEnumValue::Integer(value),
5282            )),
5283        }
5284    }
5285}
5286
5287impl std::convert::From<&str> for TransferType {
5288    fn from(value: &str) -> Self {
5289        use std::string::ToString;
5290        match value {
5291            "TRANSFER_TYPE_UNSPECIFIED" => Self::Unspecified,
5292            "BATCH" => Self::Batch,
5293            "STREAMING" => Self::Streaming,
5294            _ => Self::UnknownValue(transfer_type::UnknownValue(
5295                wkt::internal::UnknownEnumValue::String(value.to_string()),
5296            )),
5297        }
5298    }
5299}
5300
5301impl serde::ser::Serialize for TransferType {
5302    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5303    where
5304        S: serde::Serializer,
5305    {
5306        match self {
5307            Self::Unspecified => serializer.serialize_i32(0),
5308            Self::Batch => serializer.serialize_i32(1),
5309            Self::Streaming => serializer.serialize_i32(2),
5310            Self::UnknownValue(u) => u.0.serialize(serializer),
5311        }
5312    }
5313}
5314
5315impl<'de> serde::de::Deserialize<'de> for TransferType {
5316    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5317    where
5318        D: serde::Deserializer<'de>,
5319    {
5320        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransferType>::new(
5321            ".google.cloud.bigquery.datatransfer.v1.TransferType",
5322        ))
5323    }
5324}
5325
5326/// Represents data transfer run state.
5327///
5328/// # Working with unknown values
5329///
5330/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5331/// additional enum variants at any time. Adding new variants is not considered
5332/// a breaking change. Applications should write their code in anticipation of:
5333///
5334/// - New values appearing in future releases of the client library, **and**
5335/// - New values received dynamically, without application changes.
5336///
5337/// Please consult the [Working with enums] section in the user guide for some
5338/// guidelines.
5339///
5340/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5341#[derive(Clone, Debug, PartialEq)]
5342#[non_exhaustive]
5343pub enum TransferState {
5344    /// State placeholder (0).
5345    Unspecified,
5346    /// Data transfer is scheduled and is waiting to be picked up by
5347    /// data transfer backend (2).
5348    Pending,
5349    /// Data transfer is in progress (3).
5350    Running,
5351    /// Data transfer completed successfully (4).
5352    Succeeded,
5353    /// Data transfer failed (5).
5354    Failed,
5355    /// Data transfer is cancelled (6).
5356    Cancelled,
5357    /// If set, the enum was initialized with an unknown value.
5358    ///
5359    /// Applications can examine the value using [TransferState::value] or
5360    /// [TransferState::name].
5361    UnknownValue(transfer_state::UnknownValue),
5362}
5363
5364#[doc(hidden)]
5365pub mod transfer_state {
5366    #[allow(unused_imports)]
5367    use super::*;
5368    #[derive(Clone, Debug, PartialEq)]
5369    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5370}
5371
5372impl TransferState {
5373    /// Gets the enum value.
5374    ///
5375    /// Returns `None` if the enum contains an unknown value deserialized from
5376    /// the string representation of enums.
5377    pub fn value(&self) -> std::option::Option<i32> {
5378        match self {
5379            Self::Unspecified => std::option::Option::Some(0),
5380            Self::Pending => std::option::Option::Some(2),
5381            Self::Running => std::option::Option::Some(3),
5382            Self::Succeeded => std::option::Option::Some(4),
5383            Self::Failed => std::option::Option::Some(5),
5384            Self::Cancelled => std::option::Option::Some(6),
5385            Self::UnknownValue(u) => u.0.value(),
5386        }
5387    }
5388
5389    /// Gets the enum value as a string.
5390    ///
5391    /// Returns `None` if the enum contains an unknown value deserialized from
5392    /// the integer representation of enums.
5393    pub fn name(&self) -> std::option::Option<&str> {
5394        match self {
5395            Self::Unspecified => std::option::Option::Some("TRANSFER_STATE_UNSPECIFIED"),
5396            Self::Pending => std::option::Option::Some("PENDING"),
5397            Self::Running => std::option::Option::Some("RUNNING"),
5398            Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
5399            Self::Failed => std::option::Option::Some("FAILED"),
5400            Self::Cancelled => std::option::Option::Some("CANCELLED"),
5401            Self::UnknownValue(u) => u.0.name(),
5402        }
5403    }
5404}
5405
5406impl std::default::Default for TransferState {
5407    fn default() -> Self {
5408        use std::convert::From;
5409        Self::from(0)
5410    }
5411}
5412
5413impl std::fmt::Display for TransferState {
5414    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5415        wkt::internal::display_enum(f, self.name(), self.value())
5416    }
5417}
5418
5419impl std::convert::From<i32> for TransferState {
5420    fn from(value: i32) -> Self {
5421        match value {
5422            0 => Self::Unspecified,
5423            2 => Self::Pending,
5424            3 => Self::Running,
5425            4 => Self::Succeeded,
5426            5 => Self::Failed,
5427            6 => Self::Cancelled,
5428            _ => Self::UnknownValue(transfer_state::UnknownValue(
5429                wkt::internal::UnknownEnumValue::Integer(value),
5430            )),
5431        }
5432    }
5433}
5434
5435impl std::convert::From<&str> for TransferState {
5436    fn from(value: &str) -> Self {
5437        use std::string::ToString;
5438        match value {
5439            "TRANSFER_STATE_UNSPECIFIED" => Self::Unspecified,
5440            "PENDING" => Self::Pending,
5441            "RUNNING" => Self::Running,
5442            "SUCCEEDED" => Self::Succeeded,
5443            "FAILED" => Self::Failed,
5444            "CANCELLED" => Self::Cancelled,
5445            _ => Self::UnknownValue(transfer_state::UnknownValue(
5446                wkt::internal::UnknownEnumValue::String(value.to_string()),
5447            )),
5448        }
5449    }
5450}
5451
5452impl serde::ser::Serialize for TransferState {
5453    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5454    where
5455        S: serde::Serializer,
5456    {
5457        match self {
5458            Self::Unspecified => serializer.serialize_i32(0),
5459            Self::Pending => serializer.serialize_i32(2),
5460            Self::Running => serializer.serialize_i32(3),
5461            Self::Succeeded => serializer.serialize_i32(4),
5462            Self::Failed => serializer.serialize_i32(5),
5463            Self::Cancelled => serializer.serialize_i32(6),
5464            Self::UnknownValue(u) => u.0.serialize(serializer),
5465        }
5466    }
5467}
5468
5469impl<'de> serde::de::Deserialize<'de> for TransferState {
5470    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5471    where
5472        D: serde::Deserializer<'de>,
5473    {
5474        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransferState>::new(
5475            ".google.cloud.bigquery.datatransfer.v1.TransferState",
5476        ))
5477    }
5478}