Skip to main content

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