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