Skip to main content

google_cloud_bigquery_datatransfer_v1/
builder.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
17pub mod data_transfer_service {
18    use crate::Result;
19
20    /// A builder for [DataTransferService][crate::client::DataTransferService].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_bigquery_datatransfer_v1::*;
25    /// # use builder::data_transfer_service::ClientBuilder;
26    /// # use client::DataTransferService;
27    /// let builder : ClientBuilder = DataTransferService::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://bigquerydatatransfer.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::DataTransferService;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = DataTransferService;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::DataTransferService] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [DataTransferService::get_data_source][crate::client::DataTransferService::get_data_source] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::GetDataSource;
79    /// # async fn sample() -> gax::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> GetDataSource {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[derive(Clone, Debug)]
91    pub struct GetDataSource(RequestBuilder<crate::model::GetDataSourceRequest>);
92
93    impl GetDataSource {
94        pub(crate) fn new(
95            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
96        ) -> Self {
97            Self(RequestBuilder::new(stub))
98        }
99
100        /// Sets the full request, replacing any prior values.
101        pub fn with_request<V: Into<crate::model::GetDataSourceRequest>>(mut self, v: V) -> Self {
102            self.0.request = v.into();
103            self
104        }
105
106        /// Sets all the options, replacing any prior values.
107        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
108            self.0.options = v.into();
109            self
110        }
111
112        /// Sends the request.
113        pub async fn send(self) -> Result<crate::model::DataSource> {
114            (*self.0.stub)
115                .get_data_source(self.0.request, self.0.options)
116                .await
117                .map(gax::response::Response::into_body)
118        }
119
120        /// Sets the value of [name][crate::model::GetDataSourceRequest::name].
121        ///
122        /// This is a **required** field for requests.
123        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
124            self.0.request.name = v.into();
125            self
126        }
127    }
128
129    #[doc(hidden)]
130    impl gax::options::internal::RequestBuilder for GetDataSource {
131        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
132            &mut self.0.options
133        }
134    }
135
136    /// The request builder for [DataTransferService::list_data_sources][crate::client::DataTransferService::list_data_sources] calls.
137    ///
138    /// # Example
139    /// ```
140    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::ListDataSources;
141    /// # async fn sample() -> gax::Result<()> {
142    /// use gax::paginator::ItemPaginator;
143    ///
144    /// let builder = prepare_request_builder();
145    /// let mut items = builder.by_item();
146    /// while let Some(result) = items.next().await {
147    ///   let item = result?;
148    /// }
149    /// # Ok(()) }
150    ///
151    /// fn prepare_request_builder() -> ListDataSources {
152    ///   # panic!();
153    ///   // ... details omitted ...
154    /// }
155    /// ```
156    #[derive(Clone, Debug)]
157    pub struct ListDataSources(RequestBuilder<crate::model::ListDataSourcesRequest>);
158
159    impl ListDataSources {
160        pub(crate) fn new(
161            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
162        ) -> Self {
163            Self(RequestBuilder::new(stub))
164        }
165
166        /// Sets the full request, replacing any prior values.
167        pub fn with_request<V: Into<crate::model::ListDataSourcesRequest>>(mut self, v: V) -> Self {
168            self.0.request = v.into();
169            self
170        }
171
172        /// Sets all the options, replacing any prior values.
173        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
174            self.0.options = v.into();
175            self
176        }
177
178        /// Sends the request.
179        pub async fn send(self) -> Result<crate::model::ListDataSourcesResponse> {
180            (*self.0.stub)
181                .list_data_sources(self.0.request, self.0.options)
182                .await
183                .map(gax::response::Response::into_body)
184        }
185
186        /// Streams each page in the collection.
187        pub fn by_page(
188            self,
189        ) -> impl gax::paginator::Paginator<crate::model::ListDataSourcesResponse, gax::error::Error>
190        {
191            use std::clone::Clone;
192            let token = self.0.request.page_token.clone();
193            let execute = move |token: String| {
194                let mut builder = self.clone();
195                builder.0.request = builder.0.request.set_page_token(token);
196                builder.send()
197            };
198            gax::paginator::internal::new_paginator(token, execute)
199        }
200
201        /// Streams each item in the collection.
202        pub fn by_item(
203            self,
204        ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataSourcesResponse, gax::error::Error>
205        {
206            use gax::paginator::Paginator;
207            self.by_page().items()
208        }
209
210        /// Sets the value of [parent][crate::model::ListDataSourcesRequest::parent].
211        ///
212        /// This is a **required** field for requests.
213        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
214            self.0.request.parent = v.into();
215            self
216        }
217
218        /// Sets the value of [page_token][crate::model::ListDataSourcesRequest::page_token].
219        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
220            self.0.request.page_token = v.into();
221            self
222        }
223
224        /// Sets the value of [page_size][crate::model::ListDataSourcesRequest::page_size].
225        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
226            self.0.request.page_size = v.into();
227            self
228        }
229    }
230
231    #[doc(hidden)]
232    impl gax::options::internal::RequestBuilder for ListDataSources {
233        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
234            &mut self.0.options
235        }
236    }
237
238    /// The request builder for [DataTransferService::create_transfer_config][crate::client::DataTransferService::create_transfer_config] calls.
239    ///
240    /// # Example
241    /// ```
242    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::CreateTransferConfig;
243    /// # async fn sample() -> gax::Result<()> {
244    ///
245    /// let builder = prepare_request_builder();
246    /// let response = builder.send().await?;
247    /// # Ok(()) }
248    ///
249    /// fn prepare_request_builder() -> CreateTransferConfig {
250    ///   # panic!();
251    ///   // ... details omitted ...
252    /// }
253    /// ```
254    #[derive(Clone, Debug)]
255    pub struct CreateTransferConfig(RequestBuilder<crate::model::CreateTransferConfigRequest>);
256
257    impl CreateTransferConfig {
258        pub(crate) fn new(
259            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
260        ) -> Self {
261            Self(RequestBuilder::new(stub))
262        }
263
264        /// Sets the full request, replacing any prior values.
265        pub fn with_request<V: Into<crate::model::CreateTransferConfigRequest>>(
266            mut self,
267            v: V,
268        ) -> Self {
269            self.0.request = v.into();
270            self
271        }
272
273        /// Sets all the options, replacing any prior values.
274        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
275            self.0.options = v.into();
276            self
277        }
278
279        /// Sends the request.
280        pub async fn send(self) -> Result<crate::model::TransferConfig> {
281            (*self.0.stub)
282                .create_transfer_config(self.0.request, self.0.options)
283                .await
284                .map(gax::response::Response::into_body)
285        }
286
287        /// Sets the value of [parent][crate::model::CreateTransferConfigRequest::parent].
288        ///
289        /// This is a **required** field for requests.
290        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
291            self.0.request.parent = v.into();
292            self
293        }
294
295        /// Sets the value of [transfer_config][crate::model::CreateTransferConfigRequest::transfer_config].
296        ///
297        /// This is a **required** field for requests.
298        pub fn set_transfer_config<T>(mut self, v: T) -> Self
299        where
300            T: std::convert::Into<crate::model::TransferConfig>,
301        {
302            self.0.request.transfer_config = std::option::Option::Some(v.into());
303            self
304        }
305
306        /// Sets or clears the value of [transfer_config][crate::model::CreateTransferConfigRequest::transfer_config].
307        ///
308        /// This is a **required** field for requests.
309        pub fn set_or_clear_transfer_config<T>(mut self, v: std::option::Option<T>) -> Self
310        where
311            T: std::convert::Into<crate::model::TransferConfig>,
312        {
313            self.0.request.transfer_config = v.map(|x| x.into());
314            self
315        }
316
317        /// Sets the value of [authorization_code][crate::model::CreateTransferConfigRequest::authorization_code].
318        #[deprecated]
319        pub fn set_authorization_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
320            self.0.request.authorization_code = v.into();
321            self
322        }
323
324        /// Sets the value of [version_info][crate::model::CreateTransferConfigRequest::version_info].
325        pub fn set_version_info<T: Into<std::string::String>>(mut self, v: T) -> Self {
326            self.0.request.version_info = v.into();
327            self
328        }
329
330        /// Sets the value of [service_account_name][crate::model::CreateTransferConfigRequest::service_account_name].
331        pub fn set_service_account_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
332            self.0.request.service_account_name = v.into();
333            self
334        }
335    }
336
337    #[doc(hidden)]
338    impl gax::options::internal::RequestBuilder for CreateTransferConfig {
339        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
340            &mut self.0.options
341        }
342    }
343
344    /// The request builder for [DataTransferService::update_transfer_config][crate::client::DataTransferService::update_transfer_config] calls.
345    ///
346    /// # Example
347    /// ```
348    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::UpdateTransferConfig;
349    /// # async fn sample() -> gax::Result<()> {
350    ///
351    /// let builder = prepare_request_builder();
352    /// let response = builder.send().await?;
353    /// # Ok(()) }
354    ///
355    /// fn prepare_request_builder() -> UpdateTransferConfig {
356    ///   # panic!();
357    ///   // ... details omitted ...
358    /// }
359    /// ```
360    #[derive(Clone, Debug)]
361    pub struct UpdateTransferConfig(RequestBuilder<crate::model::UpdateTransferConfigRequest>);
362
363    impl UpdateTransferConfig {
364        pub(crate) fn new(
365            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
366        ) -> Self {
367            Self(RequestBuilder::new(stub))
368        }
369
370        /// Sets the full request, replacing any prior values.
371        pub fn with_request<V: Into<crate::model::UpdateTransferConfigRequest>>(
372            mut self,
373            v: V,
374        ) -> Self {
375            self.0.request = v.into();
376            self
377        }
378
379        /// Sets all the options, replacing any prior values.
380        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
381            self.0.options = v.into();
382            self
383        }
384
385        /// Sends the request.
386        pub async fn send(self) -> Result<crate::model::TransferConfig> {
387            (*self.0.stub)
388                .update_transfer_config(self.0.request, self.0.options)
389                .await
390                .map(gax::response::Response::into_body)
391        }
392
393        /// Sets the value of [transfer_config][crate::model::UpdateTransferConfigRequest::transfer_config].
394        ///
395        /// This is a **required** field for requests.
396        pub fn set_transfer_config<T>(mut self, v: T) -> Self
397        where
398            T: std::convert::Into<crate::model::TransferConfig>,
399        {
400            self.0.request.transfer_config = std::option::Option::Some(v.into());
401            self
402        }
403
404        /// Sets or clears the value of [transfer_config][crate::model::UpdateTransferConfigRequest::transfer_config].
405        ///
406        /// This is a **required** field for requests.
407        pub fn set_or_clear_transfer_config<T>(mut self, v: std::option::Option<T>) -> Self
408        where
409            T: std::convert::Into<crate::model::TransferConfig>,
410        {
411            self.0.request.transfer_config = v.map(|x| x.into());
412            self
413        }
414
415        /// Sets the value of [authorization_code][crate::model::UpdateTransferConfigRequest::authorization_code].
416        #[deprecated]
417        pub fn set_authorization_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
418            self.0.request.authorization_code = v.into();
419            self
420        }
421
422        /// Sets the value of [update_mask][crate::model::UpdateTransferConfigRequest::update_mask].
423        ///
424        /// This is a **required** field for requests.
425        pub fn set_update_mask<T>(mut self, v: T) -> Self
426        where
427            T: std::convert::Into<wkt::FieldMask>,
428        {
429            self.0.request.update_mask = std::option::Option::Some(v.into());
430            self
431        }
432
433        /// Sets or clears the value of [update_mask][crate::model::UpdateTransferConfigRequest::update_mask].
434        ///
435        /// This is a **required** field for requests.
436        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
437        where
438            T: std::convert::Into<wkt::FieldMask>,
439        {
440            self.0.request.update_mask = v.map(|x| x.into());
441            self
442        }
443
444        /// Sets the value of [version_info][crate::model::UpdateTransferConfigRequest::version_info].
445        pub fn set_version_info<T: Into<std::string::String>>(mut self, v: T) -> Self {
446            self.0.request.version_info = v.into();
447            self
448        }
449
450        /// Sets the value of [service_account_name][crate::model::UpdateTransferConfigRequest::service_account_name].
451        pub fn set_service_account_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
452            self.0.request.service_account_name = v.into();
453            self
454        }
455    }
456
457    #[doc(hidden)]
458    impl gax::options::internal::RequestBuilder for UpdateTransferConfig {
459        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
460            &mut self.0.options
461        }
462    }
463
464    /// The request builder for [DataTransferService::delete_transfer_config][crate::client::DataTransferService::delete_transfer_config] calls.
465    ///
466    /// # Example
467    /// ```
468    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::DeleteTransferConfig;
469    /// # async fn sample() -> gax::Result<()> {
470    ///
471    /// let builder = prepare_request_builder();
472    /// let response = builder.send().await?;
473    /// # Ok(()) }
474    ///
475    /// fn prepare_request_builder() -> DeleteTransferConfig {
476    ///   # panic!();
477    ///   // ... details omitted ...
478    /// }
479    /// ```
480    #[derive(Clone, Debug)]
481    pub struct DeleteTransferConfig(RequestBuilder<crate::model::DeleteTransferConfigRequest>);
482
483    impl DeleteTransferConfig {
484        pub(crate) fn new(
485            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
486        ) -> Self {
487            Self(RequestBuilder::new(stub))
488        }
489
490        /// Sets the full request, replacing any prior values.
491        pub fn with_request<V: Into<crate::model::DeleteTransferConfigRequest>>(
492            mut self,
493            v: V,
494        ) -> Self {
495            self.0.request = v.into();
496            self
497        }
498
499        /// Sets all the options, replacing any prior values.
500        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
501            self.0.options = v.into();
502            self
503        }
504
505        /// Sends the request.
506        pub async fn send(self) -> Result<()> {
507            (*self.0.stub)
508                .delete_transfer_config(self.0.request, self.0.options)
509                .await
510                .map(gax::response::Response::into_body)
511        }
512
513        /// Sets the value of [name][crate::model::DeleteTransferConfigRequest::name].
514        ///
515        /// This is a **required** field for requests.
516        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
517            self.0.request.name = v.into();
518            self
519        }
520    }
521
522    #[doc(hidden)]
523    impl gax::options::internal::RequestBuilder for DeleteTransferConfig {
524        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
525            &mut self.0.options
526        }
527    }
528
529    /// The request builder for [DataTransferService::get_transfer_config][crate::client::DataTransferService::get_transfer_config] calls.
530    ///
531    /// # Example
532    /// ```
533    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::GetTransferConfig;
534    /// # async fn sample() -> gax::Result<()> {
535    ///
536    /// let builder = prepare_request_builder();
537    /// let response = builder.send().await?;
538    /// # Ok(()) }
539    ///
540    /// fn prepare_request_builder() -> GetTransferConfig {
541    ///   # panic!();
542    ///   // ... details omitted ...
543    /// }
544    /// ```
545    #[derive(Clone, Debug)]
546    pub struct GetTransferConfig(RequestBuilder<crate::model::GetTransferConfigRequest>);
547
548    impl GetTransferConfig {
549        pub(crate) fn new(
550            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
551        ) -> Self {
552            Self(RequestBuilder::new(stub))
553        }
554
555        /// Sets the full request, replacing any prior values.
556        pub fn with_request<V: Into<crate::model::GetTransferConfigRequest>>(
557            mut self,
558            v: V,
559        ) -> Self {
560            self.0.request = v.into();
561            self
562        }
563
564        /// Sets all the options, replacing any prior values.
565        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
566            self.0.options = v.into();
567            self
568        }
569
570        /// Sends the request.
571        pub async fn send(self) -> Result<crate::model::TransferConfig> {
572            (*self.0.stub)
573                .get_transfer_config(self.0.request, self.0.options)
574                .await
575                .map(gax::response::Response::into_body)
576        }
577
578        /// Sets the value of [name][crate::model::GetTransferConfigRequest::name].
579        ///
580        /// This is a **required** field for requests.
581        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
582            self.0.request.name = v.into();
583            self
584        }
585    }
586
587    #[doc(hidden)]
588    impl gax::options::internal::RequestBuilder for GetTransferConfig {
589        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
590            &mut self.0.options
591        }
592    }
593
594    /// The request builder for [DataTransferService::list_transfer_configs][crate::client::DataTransferService::list_transfer_configs] calls.
595    ///
596    /// # Example
597    /// ```
598    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::ListTransferConfigs;
599    /// # async fn sample() -> gax::Result<()> {
600    /// use gax::paginator::ItemPaginator;
601    ///
602    /// let builder = prepare_request_builder();
603    /// let mut items = builder.by_item();
604    /// while let Some(result) = items.next().await {
605    ///   let item = result?;
606    /// }
607    /// # Ok(()) }
608    ///
609    /// fn prepare_request_builder() -> ListTransferConfigs {
610    ///   # panic!();
611    ///   // ... details omitted ...
612    /// }
613    /// ```
614    #[derive(Clone, Debug)]
615    pub struct ListTransferConfigs(RequestBuilder<crate::model::ListTransferConfigsRequest>);
616
617    impl ListTransferConfigs {
618        pub(crate) fn new(
619            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
620        ) -> Self {
621            Self(RequestBuilder::new(stub))
622        }
623
624        /// Sets the full request, replacing any prior values.
625        pub fn with_request<V: Into<crate::model::ListTransferConfigsRequest>>(
626            mut self,
627            v: V,
628        ) -> Self {
629            self.0.request = v.into();
630            self
631        }
632
633        /// Sets all the options, replacing any prior values.
634        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
635            self.0.options = v.into();
636            self
637        }
638
639        /// Sends the request.
640        pub async fn send(self) -> Result<crate::model::ListTransferConfigsResponse> {
641            (*self.0.stub)
642                .list_transfer_configs(self.0.request, self.0.options)
643                .await
644                .map(gax::response::Response::into_body)
645        }
646
647        /// Streams each page in the collection.
648        pub fn by_page(
649            self,
650        ) -> impl gax::paginator::Paginator<crate::model::ListTransferConfigsResponse, gax::error::Error>
651        {
652            use std::clone::Clone;
653            let token = self.0.request.page_token.clone();
654            let execute = move |token: String| {
655                let mut builder = self.clone();
656                builder.0.request = builder.0.request.set_page_token(token);
657                builder.send()
658            };
659            gax::paginator::internal::new_paginator(token, execute)
660        }
661
662        /// Streams each item in the collection.
663        pub fn by_item(
664            self,
665        ) -> impl gax::paginator::ItemPaginator<
666            crate::model::ListTransferConfigsResponse,
667            gax::error::Error,
668        > {
669            use gax::paginator::Paginator;
670            self.by_page().items()
671        }
672
673        /// Sets the value of [parent][crate::model::ListTransferConfigsRequest::parent].
674        ///
675        /// This is a **required** field for requests.
676        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
677            self.0.request.parent = v.into();
678            self
679        }
680
681        /// Sets the value of [data_source_ids][crate::model::ListTransferConfigsRequest::data_source_ids].
682        pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
683        where
684            T: std::iter::IntoIterator<Item = V>,
685            V: std::convert::Into<std::string::String>,
686        {
687            use std::iter::Iterator;
688            self.0.request.data_source_ids = v.into_iter().map(|i| i.into()).collect();
689            self
690        }
691
692        /// Sets the value of [page_token][crate::model::ListTransferConfigsRequest::page_token].
693        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
694            self.0.request.page_token = v.into();
695            self
696        }
697
698        /// Sets the value of [page_size][crate::model::ListTransferConfigsRequest::page_size].
699        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
700            self.0.request.page_size = v.into();
701            self
702        }
703    }
704
705    #[doc(hidden)]
706    impl gax::options::internal::RequestBuilder for ListTransferConfigs {
707        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
708            &mut self.0.options
709        }
710    }
711
712    /// The request builder for [DataTransferService::schedule_transfer_runs][crate::client::DataTransferService::schedule_transfer_runs] calls.
713    ///
714    /// # Example
715    /// ```
716    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::ScheduleTransferRuns;
717    /// # async fn sample() -> gax::Result<()> {
718    ///
719    /// let builder = prepare_request_builder();
720    /// let response = builder.send().await?;
721    /// # Ok(()) }
722    ///
723    /// fn prepare_request_builder() -> ScheduleTransferRuns {
724    ///   # panic!();
725    ///   // ... details omitted ...
726    /// }
727    /// ```
728    #[derive(Clone, Debug)]
729    pub struct ScheduleTransferRuns(RequestBuilder<crate::model::ScheduleTransferRunsRequest>);
730
731    impl ScheduleTransferRuns {
732        pub(crate) fn new(
733            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
734        ) -> Self {
735            Self(RequestBuilder::new(stub))
736        }
737
738        /// Sets the full request, replacing any prior values.
739        pub fn with_request<V: Into<crate::model::ScheduleTransferRunsRequest>>(
740            mut self,
741            v: V,
742        ) -> Self {
743            self.0.request = v.into();
744            self
745        }
746
747        /// Sets all the options, replacing any prior values.
748        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
749            self.0.options = v.into();
750            self
751        }
752
753        /// Sends the request.
754        pub async fn send(self) -> Result<crate::model::ScheduleTransferRunsResponse> {
755            (*self.0.stub)
756                .schedule_transfer_runs(self.0.request, self.0.options)
757                .await
758                .map(gax::response::Response::into_body)
759        }
760
761        /// Sets the value of [parent][crate::model::ScheduleTransferRunsRequest::parent].
762        ///
763        /// This is a **required** field for requests.
764        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
765            self.0.request.parent = v.into();
766            self
767        }
768
769        /// Sets the value of [start_time][crate::model::ScheduleTransferRunsRequest::start_time].
770        ///
771        /// This is a **required** field for requests.
772        pub fn set_start_time<T>(mut self, v: T) -> Self
773        where
774            T: std::convert::Into<wkt::Timestamp>,
775        {
776            self.0.request.start_time = std::option::Option::Some(v.into());
777            self
778        }
779
780        /// Sets or clears the value of [start_time][crate::model::ScheduleTransferRunsRequest::start_time].
781        ///
782        /// This is a **required** field for requests.
783        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
784        where
785            T: std::convert::Into<wkt::Timestamp>,
786        {
787            self.0.request.start_time = v.map(|x| x.into());
788            self
789        }
790
791        /// Sets the value of [end_time][crate::model::ScheduleTransferRunsRequest::end_time].
792        ///
793        /// This is a **required** field for requests.
794        pub fn set_end_time<T>(mut self, v: T) -> Self
795        where
796            T: std::convert::Into<wkt::Timestamp>,
797        {
798            self.0.request.end_time = std::option::Option::Some(v.into());
799            self
800        }
801
802        /// Sets or clears the value of [end_time][crate::model::ScheduleTransferRunsRequest::end_time].
803        ///
804        /// This is a **required** field for requests.
805        pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
806        where
807            T: std::convert::Into<wkt::Timestamp>,
808        {
809            self.0.request.end_time = v.map(|x| x.into());
810            self
811        }
812    }
813
814    #[doc(hidden)]
815    impl gax::options::internal::RequestBuilder for ScheduleTransferRuns {
816        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
817            &mut self.0.options
818        }
819    }
820
821    /// The request builder for [DataTransferService::start_manual_transfer_runs][crate::client::DataTransferService::start_manual_transfer_runs] calls.
822    ///
823    /// # Example
824    /// ```
825    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::StartManualTransferRuns;
826    /// # async fn sample() -> gax::Result<()> {
827    ///
828    /// let builder = prepare_request_builder();
829    /// let response = builder.send().await?;
830    /// # Ok(()) }
831    ///
832    /// fn prepare_request_builder() -> StartManualTransferRuns {
833    ///   # panic!();
834    ///   // ... details omitted ...
835    /// }
836    /// ```
837    #[derive(Clone, Debug)]
838    pub struct StartManualTransferRuns(
839        RequestBuilder<crate::model::StartManualTransferRunsRequest>,
840    );
841
842    impl StartManualTransferRuns {
843        pub(crate) fn new(
844            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
845        ) -> Self {
846            Self(RequestBuilder::new(stub))
847        }
848
849        /// Sets the full request, replacing any prior values.
850        pub fn with_request<V: Into<crate::model::StartManualTransferRunsRequest>>(
851            mut self,
852            v: V,
853        ) -> Self {
854            self.0.request = v.into();
855            self
856        }
857
858        /// Sets all the options, replacing any prior values.
859        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
860            self.0.options = v.into();
861            self
862        }
863
864        /// Sends the request.
865        pub async fn send(self) -> Result<crate::model::StartManualTransferRunsResponse> {
866            (*self.0.stub)
867                .start_manual_transfer_runs(self.0.request, self.0.options)
868                .await
869                .map(gax::response::Response::into_body)
870        }
871
872        /// Sets the value of [parent][crate::model::StartManualTransferRunsRequest::parent].
873        ///
874        /// This is a **required** field for requests.
875        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
876            self.0.request.parent = v.into();
877            self
878        }
879
880        /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time].
881        ///
882        /// Note that all the setters affecting `time` are
883        /// mutually exclusive.
884        pub fn set_time<T: Into<Option<crate::model::start_manual_transfer_runs_request::Time>>>(
885            mut self,
886            v: T,
887        ) -> Self {
888            self.0.request.time = v.into();
889            self
890        }
891
892        /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
893        /// to hold a `RequestedTimeRange`.
894        ///
895        /// Note that all the setters affecting `time` are
896        /// mutually exclusive.
897        pub fn set_requested_time_range<
898            T: std::convert::Into<
899                    std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
900                >,
901        >(
902            mut self,
903            v: T,
904        ) -> Self {
905            self.0.request = self.0.request.set_requested_time_range(v);
906            self
907        }
908
909        /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
910        /// to hold a `RequestedRunTime`.
911        ///
912        /// Note that all the setters affecting `time` are
913        /// mutually exclusive.
914        pub fn set_requested_run_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
915            mut self,
916            v: T,
917        ) -> Self {
918            self.0.request = self.0.request.set_requested_run_time(v);
919            self
920        }
921    }
922
923    #[doc(hidden)]
924    impl gax::options::internal::RequestBuilder for StartManualTransferRuns {
925        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
926            &mut self.0.options
927        }
928    }
929
930    /// The request builder for [DataTransferService::get_transfer_run][crate::client::DataTransferService::get_transfer_run] calls.
931    ///
932    /// # Example
933    /// ```
934    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::GetTransferRun;
935    /// # async fn sample() -> gax::Result<()> {
936    ///
937    /// let builder = prepare_request_builder();
938    /// let response = builder.send().await?;
939    /// # Ok(()) }
940    ///
941    /// fn prepare_request_builder() -> GetTransferRun {
942    ///   # panic!();
943    ///   // ... details omitted ...
944    /// }
945    /// ```
946    #[derive(Clone, Debug)]
947    pub struct GetTransferRun(RequestBuilder<crate::model::GetTransferRunRequest>);
948
949    impl GetTransferRun {
950        pub(crate) fn new(
951            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
952        ) -> Self {
953            Self(RequestBuilder::new(stub))
954        }
955
956        /// Sets the full request, replacing any prior values.
957        pub fn with_request<V: Into<crate::model::GetTransferRunRequest>>(mut self, v: V) -> Self {
958            self.0.request = v.into();
959            self
960        }
961
962        /// Sets all the options, replacing any prior values.
963        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
964            self.0.options = v.into();
965            self
966        }
967
968        /// Sends the request.
969        pub async fn send(self) -> Result<crate::model::TransferRun> {
970            (*self.0.stub)
971                .get_transfer_run(self.0.request, self.0.options)
972                .await
973                .map(gax::response::Response::into_body)
974        }
975
976        /// Sets the value of [name][crate::model::GetTransferRunRequest::name].
977        ///
978        /// This is a **required** field for requests.
979        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
980            self.0.request.name = v.into();
981            self
982        }
983    }
984
985    #[doc(hidden)]
986    impl gax::options::internal::RequestBuilder for GetTransferRun {
987        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
988            &mut self.0.options
989        }
990    }
991
992    /// The request builder for [DataTransferService::delete_transfer_run][crate::client::DataTransferService::delete_transfer_run] calls.
993    ///
994    /// # Example
995    /// ```
996    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::DeleteTransferRun;
997    /// # async fn sample() -> gax::Result<()> {
998    ///
999    /// let builder = prepare_request_builder();
1000    /// let response = builder.send().await?;
1001    /// # Ok(()) }
1002    ///
1003    /// fn prepare_request_builder() -> DeleteTransferRun {
1004    ///   # panic!();
1005    ///   // ... details omitted ...
1006    /// }
1007    /// ```
1008    #[derive(Clone, Debug)]
1009    pub struct DeleteTransferRun(RequestBuilder<crate::model::DeleteTransferRunRequest>);
1010
1011    impl DeleteTransferRun {
1012        pub(crate) fn new(
1013            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1014        ) -> Self {
1015            Self(RequestBuilder::new(stub))
1016        }
1017
1018        /// Sets the full request, replacing any prior values.
1019        pub fn with_request<V: Into<crate::model::DeleteTransferRunRequest>>(
1020            mut self,
1021            v: V,
1022        ) -> Self {
1023            self.0.request = v.into();
1024            self
1025        }
1026
1027        /// Sets all the options, replacing any prior values.
1028        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1029            self.0.options = v.into();
1030            self
1031        }
1032
1033        /// Sends the request.
1034        pub async fn send(self) -> Result<()> {
1035            (*self.0.stub)
1036                .delete_transfer_run(self.0.request, self.0.options)
1037                .await
1038                .map(gax::response::Response::into_body)
1039        }
1040
1041        /// Sets the value of [name][crate::model::DeleteTransferRunRequest::name].
1042        ///
1043        /// This is a **required** field for requests.
1044        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1045            self.0.request.name = v.into();
1046            self
1047        }
1048    }
1049
1050    #[doc(hidden)]
1051    impl gax::options::internal::RequestBuilder for DeleteTransferRun {
1052        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1053            &mut self.0.options
1054        }
1055    }
1056
1057    /// The request builder for [DataTransferService::list_transfer_runs][crate::client::DataTransferService::list_transfer_runs] calls.
1058    ///
1059    /// # Example
1060    /// ```
1061    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::ListTransferRuns;
1062    /// # async fn sample() -> gax::Result<()> {
1063    /// use gax::paginator::ItemPaginator;
1064    ///
1065    /// let builder = prepare_request_builder();
1066    /// let mut items = builder.by_item();
1067    /// while let Some(result) = items.next().await {
1068    ///   let item = result?;
1069    /// }
1070    /// # Ok(()) }
1071    ///
1072    /// fn prepare_request_builder() -> ListTransferRuns {
1073    ///   # panic!();
1074    ///   // ... details omitted ...
1075    /// }
1076    /// ```
1077    #[derive(Clone, Debug)]
1078    pub struct ListTransferRuns(RequestBuilder<crate::model::ListTransferRunsRequest>);
1079
1080    impl ListTransferRuns {
1081        pub(crate) fn new(
1082            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1083        ) -> Self {
1084            Self(RequestBuilder::new(stub))
1085        }
1086
1087        /// Sets the full request, replacing any prior values.
1088        pub fn with_request<V: Into<crate::model::ListTransferRunsRequest>>(
1089            mut self,
1090            v: V,
1091        ) -> Self {
1092            self.0.request = v.into();
1093            self
1094        }
1095
1096        /// Sets all the options, replacing any prior values.
1097        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1098            self.0.options = v.into();
1099            self
1100        }
1101
1102        /// Sends the request.
1103        pub async fn send(self) -> Result<crate::model::ListTransferRunsResponse> {
1104            (*self.0.stub)
1105                .list_transfer_runs(self.0.request, self.0.options)
1106                .await
1107                .map(gax::response::Response::into_body)
1108        }
1109
1110        /// Streams each page in the collection.
1111        pub fn by_page(
1112            self,
1113        ) -> impl gax::paginator::Paginator<crate::model::ListTransferRunsResponse, gax::error::Error>
1114        {
1115            use std::clone::Clone;
1116            let token = self.0.request.page_token.clone();
1117            let execute = move |token: String| {
1118                let mut builder = self.clone();
1119                builder.0.request = builder.0.request.set_page_token(token);
1120                builder.send()
1121            };
1122            gax::paginator::internal::new_paginator(token, execute)
1123        }
1124
1125        /// Streams each item in the collection.
1126        pub fn by_item(
1127            self,
1128        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTransferRunsResponse, gax::error::Error>
1129        {
1130            use gax::paginator::Paginator;
1131            self.by_page().items()
1132        }
1133
1134        /// Sets the value of [parent][crate::model::ListTransferRunsRequest::parent].
1135        ///
1136        /// This is a **required** field for requests.
1137        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1138            self.0.request.parent = v.into();
1139            self
1140        }
1141
1142        /// Sets the value of [states][crate::model::ListTransferRunsRequest::states].
1143        pub fn set_states<T, V>(mut self, v: T) -> Self
1144        where
1145            T: std::iter::IntoIterator<Item = V>,
1146            V: std::convert::Into<crate::model::TransferState>,
1147        {
1148            use std::iter::Iterator;
1149            self.0.request.states = v.into_iter().map(|i| i.into()).collect();
1150            self
1151        }
1152
1153        /// Sets the value of [page_token][crate::model::ListTransferRunsRequest::page_token].
1154        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1155            self.0.request.page_token = v.into();
1156            self
1157        }
1158
1159        /// Sets the value of [page_size][crate::model::ListTransferRunsRequest::page_size].
1160        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1161            self.0.request.page_size = v.into();
1162            self
1163        }
1164
1165        /// Sets the value of [run_attempt][crate::model::ListTransferRunsRequest::run_attempt].
1166        pub fn set_run_attempt<T: Into<crate::model::list_transfer_runs_request::RunAttempt>>(
1167            mut self,
1168            v: T,
1169        ) -> Self {
1170            self.0.request.run_attempt = v.into();
1171            self
1172        }
1173    }
1174
1175    #[doc(hidden)]
1176    impl gax::options::internal::RequestBuilder for ListTransferRuns {
1177        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1178            &mut self.0.options
1179        }
1180    }
1181
1182    /// The request builder for [DataTransferService::list_transfer_logs][crate::client::DataTransferService::list_transfer_logs] calls.
1183    ///
1184    /// # Example
1185    /// ```
1186    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::ListTransferLogs;
1187    /// # async fn sample() -> gax::Result<()> {
1188    /// use gax::paginator::ItemPaginator;
1189    ///
1190    /// let builder = prepare_request_builder();
1191    /// let mut items = builder.by_item();
1192    /// while let Some(result) = items.next().await {
1193    ///   let item = result?;
1194    /// }
1195    /// # Ok(()) }
1196    ///
1197    /// fn prepare_request_builder() -> ListTransferLogs {
1198    ///   # panic!();
1199    ///   // ... details omitted ...
1200    /// }
1201    /// ```
1202    #[derive(Clone, Debug)]
1203    pub struct ListTransferLogs(RequestBuilder<crate::model::ListTransferLogsRequest>);
1204
1205    impl ListTransferLogs {
1206        pub(crate) fn new(
1207            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1208        ) -> Self {
1209            Self(RequestBuilder::new(stub))
1210        }
1211
1212        /// Sets the full request, replacing any prior values.
1213        pub fn with_request<V: Into<crate::model::ListTransferLogsRequest>>(
1214            mut self,
1215            v: V,
1216        ) -> Self {
1217            self.0.request = v.into();
1218            self
1219        }
1220
1221        /// Sets all the options, replacing any prior values.
1222        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1223            self.0.options = v.into();
1224            self
1225        }
1226
1227        /// Sends the request.
1228        pub async fn send(self) -> Result<crate::model::ListTransferLogsResponse> {
1229            (*self.0.stub)
1230                .list_transfer_logs(self.0.request, self.0.options)
1231                .await
1232                .map(gax::response::Response::into_body)
1233        }
1234
1235        /// Streams each page in the collection.
1236        pub fn by_page(
1237            self,
1238        ) -> impl gax::paginator::Paginator<crate::model::ListTransferLogsResponse, gax::error::Error>
1239        {
1240            use std::clone::Clone;
1241            let token = self.0.request.page_token.clone();
1242            let execute = move |token: String| {
1243                let mut builder = self.clone();
1244                builder.0.request = builder.0.request.set_page_token(token);
1245                builder.send()
1246            };
1247            gax::paginator::internal::new_paginator(token, execute)
1248        }
1249
1250        /// Streams each item in the collection.
1251        pub fn by_item(
1252            self,
1253        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTransferLogsResponse, gax::error::Error>
1254        {
1255            use gax::paginator::Paginator;
1256            self.by_page().items()
1257        }
1258
1259        /// Sets the value of [parent][crate::model::ListTransferLogsRequest::parent].
1260        ///
1261        /// This is a **required** field for requests.
1262        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1263            self.0.request.parent = v.into();
1264            self
1265        }
1266
1267        /// Sets the value of [page_token][crate::model::ListTransferLogsRequest::page_token].
1268        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1269            self.0.request.page_token = v.into();
1270            self
1271        }
1272
1273        /// Sets the value of [page_size][crate::model::ListTransferLogsRequest::page_size].
1274        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1275            self.0.request.page_size = v.into();
1276            self
1277        }
1278
1279        /// Sets the value of [message_types][crate::model::ListTransferLogsRequest::message_types].
1280        pub fn set_message_types<T, V>(mut self, v: T) -> Self
1281        where
1282            T: std::iter::IntoIterator<Item = V>,
1283            V: std::convert::Into<crate::model::transfer_message::MessageSeverity>,
1284        {
1285            use std::iter::Iterator;
1286            self.0.request.message_types = v.into_iter().map(|i| i.into()).collect();
1287            self
1288        }
1289    }
1290
1291    #[doc(hidden)]
1292    impl gax::options::internal::RequestBuilder for ListTransferLogs {
1293        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1294            &mut self.0.options
1295        }
1296    }
1297
1298    /// The request builder for [DataTransferService::check_valid_creds][crate::client::DataTransferService::check_valid_creds] calls.
1299    ///
1300    /// # Example
1301    /// ```
1302    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::CheckValidCreds;
1303    /// # async fn sample() -> gax::Result<()> {
1304    ///
1305    /// let builder = prepare_request_builder();
1306    /// let response = builder.send().await?;
1307    /// # Ok(()) }
1308    ///
1309    /// fn prepare_request_builder() -> CheckValidCreds {
1310    ///   # panic!();
1311    ///   // ... details omitted ...
1312    /// }
1313    /// ```
1314    #[derive(Clone, Debug)]
1315    pub struct CheckValidCreds(RequestBuilder<crate::model::CheckValidCredsRequest>);
1316
1317    impl CheckValidCreds {
1318        pub(crate) fn new(
1319            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1320        ) -> Self {
1321            Self(RequestBuilder::new(stub))
1322        }
1323
1324        /// Sets the full request, replacing any prior values.
1325        pub fn with_request<V: Into<crate::model::CheckValidCredsRequest>>(mut self, v: V) -> Self {
1326            self.0.request = v.into();
1327            self
1328        }
1329
1330        /// Sets all the options, replacing any prior values.
1331        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1332            self.0.options = v.into();
1333            self
1334        }
1335
1336        /// Sends the request.
1337        pub async fn send(self) -> Result<crate::model::CheckValidCredsResponse> {
1338            (*self.0.stub)
1339                .check_valid_creds(self.0.request, self.0.options)
1340                .await
1341                .map(gax::response::Response::into_body)
1342        }
1343
1344        /// Sets the value of [name][crate::model::CheckValidCredsRequest::name].
1345        ///
1346        /// This is a **required** field for requests.
1347        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1348            self.0.request.name = v.into();
1349            self
1350        }
1351    }
1352
1353    #[doc(hidden)]
1354    impl gax::options::internal::RequestBuilder for CheckValidCreds {
1355        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1356            &mut self.0.options
1357        }
1358    }
1359
1360    /// The request builder for [DataTransferService::enroll_data_sources][crate::client::DataTransferService::enroll_data_sources] calls.
1361    ///
1362    /// # Example
1363    /// ```
1364    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::EnrollDataSources;
1365    /// # async fn sample() -> gax::Result<()> {
1366    ///
1367    /// let builder = prepare_request_builder();
1368    /// let response = builder.send().await?;
1369    /// # Ok(()) }
1370    ///
1371    /// fn prepare_request_builder() -> EnrollDataSources {
1372    ///   # panic!();
1373    ///   // ... details omitted ...
1374    /// }
1375    /// ```
1376    #[derive(Clone, Debug)]
1377    pub struct EnrollDataSources(RequestBuilder<crate::model::EnrollDataSourcesRequest>);
1378
1379    impl EnrollDataSources {
1380        pub(crate) fn new(
1381            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1382        ) -> Self {
1383            Self(RequestBuilder::new(stub))
1384        }
1385
1386        /// Sets the full request, replacing any prior values.
1387        pub fn with_request<V: Into<crate::model::EnrollDataSourcesRequest>>(
1388            mut self,
1389            v: V,
1390        ) -> Self {
1391            self.0.request = v.into();
1392            self
1393        }
1394
1395        /// Sets all the options, replacing any prior values.
1396        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1397            self.0.options = v.into();
1398            self
1399        }
1400
1401        /// Sends the request.
1402        pub async fn send(self) -> Result<()> {
1403            (*self.0.stub)
1404                .enroll_data_sources(self.0.request, self.0.options)
1405                .await
1406                .map(gax::response::Response::into_body)
1407        }
1408
1409        /// Sets the value of [name][crate::model::EnrollDataSourcesRequest::name].
1410        ///
1411        /// This is a **required** field for requests.
1412        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1413            self.0.request.name = v.into();
1414            self
1415        }
1416
1417        /// Sets the value of [data_source_ids][crate::model::EnrollDataSourcesRequest::data_source_ids].
1418        pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
1419        where
1420            T: std::iter::IntoIterator<Item = V>,
1421            V: std::convert::Into<std::string::String>,
1422        {
1423            use std::iter::Iterator;
1424            self.0.request.data_source_ids = v.into_iter().map(|i| i.into()).collect();
1425            self
1426        }
1427    }
1428
1429    #[doc(hidden)]
1430    impl gax::options::internal::RequestBuilder for EnrollDataSources {
1431        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1432            &mut self.0.options
1433        }
1434    }
1435
1436    /// The request builder for [DataTransferService::unenroll_data_sources][crate::client::DataTransferService::unenroll_data_sources] calls.
1437    ///
1438    /// # Example
1439    /// ```
1440    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::UnenrollDataSources;
1441    /// # async fn sample() -> gax::Result<()> {
1442    ///
1443    /// let builder = prepare_request_builder();
1444    /// let response = builder.send().await?;
1445    /// # Ok(()) }
1446    ///
1447    /// fn prepare_request_builder() -> UnenrollDataSources {
1448    ///   # panic!();
1449    ///   // ... details omitted ...
1450    /// }
1451    /// ```
1452    #[derive(Clone, Debug)]
1453    pub struct UnenrollDataSources(RequestBuilder<crate::model::UnenrollDataSourcesRequest>);
1454
1455    impl UnenrollDataSources {
1456        pub(crate) fn new(
1457            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1458        ) -> Self {
1459            Self(RequestBuilder::new(stub))
1460        }
1461
1462        /// Sets the full request, replacing any prior values.
1463        pub fn with_request<V: Into<crate::model::UnenrollDataSourcesRequest>>(
1464            mut self,
1465            v: V,
1466        ) -> Self {
1467            self.0.request = v.into();
1468            self
1469        }
1470
1471        /// Sets all the options, replacing any prior values.
1472        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1473            self.0.options = v.into();
1474            self
1475        }
1476
1477        /// Sends the request.
1478        pub async fn send(self) -> Result<()> {
1479            (*self.0.stub)
1480                .unenroll_data_sources(self.0.request, self.0.options)
1481                .await
1482                .map(gax::response::Response::into_body)
1483        }
1484
1485        /// Sets the value of [name][crate::model::UnenrollDataSourcesRequest::name].
1486        ///
1487        /// This is a **required** field for requests.
1488        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1489            self.0.request.name = v.into();
1490            self
1491        }
1492
1493        /// Sets the value of [data_source_ids][crate::model::UnenrollDataSourcesRequest::data_source_ids].
1494        pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
1495        where
1496            T: std::iter::IntoIterator<Item = V>,
1497            V: std::convert::Into<std::string::String>,
1498        {
1499            use std::iter::Iterator;
1500            self.0.request.data_source_ids = v.into_iter().map(|i| i.into()).collect();
1501            self
1502        }
1503    }
1504
1505    #[doc(hidden)]
1506    impl gax::options::internal::RequestBuilder for UnenrollDataSources {
1507        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1508            &mut self.0.options
1509        }
1510    }
1511
1512    /// The request builder for [DataTransferService::list_locations][crate::client::DataTransferService::list_locations] calls.
1513    ///
1514    /// # Example
1515    /// ```
1516    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::ListLocations;
1517    /// # async fn sample() -> gax::Result<()> {
1518    /// use gax::paginator::ItemPaginator;
1519    ///
1520    /// let builder = prepare_request_builder();
1521    /// let mut items = builder.by_item();
1522    /// while let Some(result) = items.next().await {
1523    ///   let item = result?;
1524    /// }
1525    /// # Ok(()) }
1526    ///
1527    /// fn prepare_request_builder() -> ListLocations {
1528    ///   # panic!();
1529    ///   // ... details omitted ...
1530    /// }
1531    /// ```
1532    #[derive(Clone, Debug)]
1533    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1534
1535    impl ListLocations {
1536        pub(crate) fn new(
1537            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1538        ) -> Self {
1539            Self(RequestBuilder::new(stub))
1540        }
1541
1542        /// Sets the full request, replacing any prior values.
1543        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1544            mut self,
1545            v: V,
1546        ) -> Self {
1547            self.0.request = v.into();
1548            self
1549        }
1550
1551        /// Sets all the options, replacing any prior values.
1552        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1553            self.0.options = v.into();
1554            self
1555        }
1556
1557        /// Sends the request.
1558        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1559            (*self.0.stub)
1560                .list_locations(self.0.request, self.0.options)
1561                .await
1562                .map(gax::response::Response::into_body)
1563        }
1564
1565        /// Streams each page in the collection.
1566        pub fn by_page(
1567            self,
1568        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1569        {
1570            use std::clone::Clone;
1571            let token = self.0.request.page_token.clone();
1572            let execute = move |token: String| {
1573                let mut builder = self.clone();
1574                builder.0.request = builder.0.request.set_page_token(token);
1575                builder.send()
1576            };
1577            gax::paginator::internal::new_paginator(token, execute)
1578        }
1579
1580        /// Streams each item in the collection.
1581        pub fn by_item(
1582            self,
1583        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1584        {
1585            use gax::paginator::Paginator;
1586            self.by_page().items()
1587        }
1588
1589        /// Sets the value of [name][location::model::ListLocationsRequest::name].
1590        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1591            self.0.request.name = v.into();
1592            self
1593        }
1594
1595        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
1596        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1597            self.0.request.filter = v.into();
1598            self
1599        }
1600
1601        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
1602        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1603            self.0.request.page_size = v.into();
1604            self
1605        }
1606
1607        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
1608        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1609            self.0.request.page_token = v.into();
1610            self
1611        }
1612    }
1613
1614    #[doc(hidden)]
1615    impl gax::options::internal::RequestBuilder for ListLocations {
1616        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1617            &mut self.0.options
1618        }
1619    }
1620
1621    /// The request builder for [DataTransferService::get_location][crate::client::DataTransferService::get_location] calls.
1622    ///
1623    /// # Example
1624    /// ```
1625    /// # use google_cloud_bigquery_datatransfer_v1::builder::data_transfer_service::GetLocation;
1626    /// # async fn sample() -> gax::Result<()> {
1627    ///
1628    /// let builder = prepare_request_builder();
1629    /// let response = builder.send().await?;
1630    /// # Ok(()) }
1631    ///
1632    /// fn prepare_request_builder() -> GetLocation {
1633    ///   # panic!();
1634    ///   // ... details omitted ...
1635    /// }
1636    /// ```
1637    #[derive(Clone, Debug)]
1638    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1639
1640    impl GetLocation {
1641        pub(crate) fn new(
1642            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataTransferService>,
1643        ) -> Self {
1644            Self(RequestBuilder::new(stub))
1645        }
1646
1647        /// Sets the full request, replacing any prior values.
1648        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1649            self.0.request = v.into();
1650            self
1651        }
1652
1653        /// Sets all the options, replacing any prior values.
1654        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1655            self.0.options = v.into();
1656            self
1657        }
1658
1659        /// Sends the request.
1660        pub async fn send(self) -> Result<location::model::Location> {
1661            (*self.0.stub)
1662                .get_location(self.0.request, self.0.options)
1663                .await
1664                .map(gax::response::Response::into_body)
1665        }
1666
1667        /// Sets the value of [name][location::model::GetLocationRequest::name].
1668        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1669            self.0.request.name = v.into();
1670            self
1671        }
1672    }
1673
1674    #[doc(hidden)]
1675    impl gax::options::internal::RequestBuilder for GetLocation {
1676        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1677            &mut self.0.options
1678        }
1679    }
1680}