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    use std::sync::Arc;
20
21    /// A builder for [DataTransferService][super::super::client::DataTransferService].
22    ///
23    /// ```
24    /// # tokio_test::block_on(async {
25    /// # use google_cloud_bigquery_datatransfer_v1::*;
26    /// # use builder::data_transfer_service::ClientBuilder;
27    /// # use client::DataTransferService;
28    /// let builder : ClientBuilder = DataTransferService::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://bigquerydatatransfer.googleapis.com")
31    ///     .build().await?;
32    /// # gax::Result::<()>::Ok(()) });
33    /// ```
34    pub type ClientBuilder =
35        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37    pub(crate) mod client {
38        use super::super::super::client::DataTransferService;
39        pub struct Factory;
40        impl gax::client_builder::internal::ClientFactory for Factory {
41            type Client = DataTransferService;
42            type Credentials = gaxi::options::Credentials;
43            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
44                Self::Client::new(config).await
45            }
46        }
47    }
48
49    /// Common implementation for [super::super::client::DataTransferService] request builders.
50    #[derive(Clone, Debug)]
51    pub(crate) struct RequestBuilder<R: std::default::Default> {
52        stub: Arc<dyn super::super::stub::dynamic::DataTransferService>,
53        request: R,
54        options: gax::options::RequestOptions,
55    }
56
57    impl<R> RequestBuilder<R>
58    where
59        R: std::default::Default,
60    {
61        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
62            Self {
63                stub,
64                request: R::default(),
65                options: gax::options::RequestOptions::default(),
66            }
67        }
68    }
69
70    /// The request builder for [DataTransferService::get_data_source][super::super::client::DataTransferService::get_data_source] calls.
71    #[derive(Clone, Debug)]
72    pub struct GetDataSource(RequestBuilder<crate::model::GetDataSourceRequest>);
73
74    impl GetDataSource {
75        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
76            Self(RequestBuilder::new(stub))
77        }
78
79        /// Sets the full request, replacing any prior values.
80        pub fn with_request<V: Into<crate::model::GetDataSourceRequest>>(mut self, v: V) -> Self {
81            self.0.request = v.into();
82            self
83        }
84
85        /// Sets all the options, replacing any prior values.
86        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
87            self.0.options = v.into();
88            self
89        }
90
91        /// Sends the request.
92        pub async fn send(self) -> Result<crate::model::DataSource> {
93            (*self.0.stub)
94                .get_data_source(self.0.request, self.0.options)
95                .await
96                .map(gax::response::Response::into_body)
97        }
98
99        /// Sets the value of [name][crate::model::GetDataSourceRequest::name].
100        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
101            self.0.request.name = v.into();
102            self
103        }
104    }
105
106    #[doc(hidden)]
107    impl gax::options::internal::RequestBuilder for GetDataSource {
108        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
109            &mut self.0.options
110        }
111    }
112
113    /// The request builder for [DataTransferService::list_data_sources][super::super::client::DataTransferService::list_data_sources] calls.
114    #[derive(Clone, Debug)]
115    pub struct ListDataSources(RequestBuilder<crate::model::ListDataSourcesRequest>);
116
117    impl ListDataSources {
118        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
119            Self(RequestBuilder::new(stub))
120        }
121
122        /// Sets the full request, replacing any prior values.
123        pub fn with_request<V: Into<crate::model::ListDataSourcesRequest>>(mut self, v: V) -> Self {
124            self.0.request = v.into();
125            self
126        }
127
128        /// Sets all the options, replacing any prior values.
129        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
130            self.0.options = v.into();
131            self
132        }
133
134        /// Sends the request.
135        pub async fn send(self) -> Result<crate::model::ListDataSourcesResponse> {
136            (*self.0.stub)
137                .list_data_sources(self.0.request, self.0.options)
138                .await
139                .map(gax::response::Response::into_body)
140        }
141
142        /// Streams the responses back.
143        pub async fn paginator(
144            self,
145        ) -> impl gax::paginator::Paginator<crate::model::ListDataSourcesResponse, gax::error::Error>
146        {
147            use std::clone::Clone;
148            let token = self.0.request.page_token.clone();
149            let execute = move |token: String| {
150                let mut builder = self.clone();
151                builder.0.request = builder.0.request.set_page_token(token);
152                builder.send()
153            };
154            gax::paginator::internal::new_paginator(token, execute)
155        }
156
157        /// Sets the value of [parent][crate::model::ListDataSourcesRequest::parent].
158        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
159            self.0.request.parent = v.into();
160            self
161        }
162
163        /// Sets the value of [page_token][crate::model::ListDataSourcesRequest::page_token].
164        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165            self.0.request.page_token = v.into();
166            self
167        }
168
169        /// Sets the value of [page_size][crate::model::ListDataSourcesRequest::page_size].
170        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
171            self.0.request.page_size = v.into();
172            self
173        }
174    }
175
176    #[doc(hidden)]
177    impl gax::options::internal::RequestBuilder for ListDataSources {
178        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
179            &mut self.0.options
180        }
181    }
182
183    /// The request builder for [DataTransferService::create_transfer_config][super::super::client::DataTransferService::create_transfer_config] calls.
184    #[derive(Clone, Debug)]
185    pub struct CreateTransferConfig(RequestBuilder<crate::model::CreateTransferConfigRequest>);
186
187    impl CreateTransferConfig {
188        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
189            Self(RequestBuilder::new(stub))
190        }
191
192        /// Sets the full request, replacing any prior values.
193        pub fn with_request<V: Into<crate::model::CreateTransferConfigRequest>>(
194            mut self,
195            v: V,
196        ) -> Self {
197            self.0.request = v.into();
198            self
199        }
200
201        /// Sets all the options, replacing any prior values.
202        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
203            self.0.options = v.into();
204            self
205        }
206
207        /// Sends the request.
208        pub async fn send(self) -> Result<crate::model::TransferConfig> {
209            (*self.0.stub)
210                .create_transfer_config(self.0.request, self.0.options)
211                .await
212                .map(gax::response::Response::into_body)
213        }
214
215        /// Sets the value of [parent][crate::model::CreateTransferConfigRequest::parent].
216        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
217            self.0.request.parent = v.into();
218            self
219        }
220
221        /// Sets the value of [transfer_config][crate::model::CreateTransferConfigRequest::transfer_config].
222        pub fn set_transfer_config<T: Into<std::option::Option<crate::model::TransferConfig>>>(
223            mut self,
224            v: T,
225        ) -> Self {
226            self.0.request.transfer_config = v.into();
227            self
228        }
229
230        /// Sets the value of [authorization_code][crate::model::CreateTransferConfigRequest::authorization_code].
231        pub fn set_authorization_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
232            self.0.request.authorization_code = v.into();
233            self
234        }
235
236        /// Sets the value of [version_info][crate::model::CreateTransferConfigRequest::version_info].
237        pub fn set_version_info<T: Into<std::string::String>>(mut self, v: T) -> Self {
238            self.0.request.version_info = v.into();
239            self
240        }
241
242        /// Sets the value of [service_account_name][crate::model::CreateTransferConfigRequest::service_account_name].
243        pub fn set_service_account_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
244            self.0.request.service_account_name = v.into();
245            self
246        }
247    }
248
249    #[doc(hidden)]
250    impl gax::options::internal::RequestBuilder for CreateTransferConfig {
251        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
252            &mut self.0.options
253        }
254    }
255
256    /// The request builder for [DataTransferService::update_transfer_config][super::super::client::DataTransferService::update_transfer_config] calls.
257    #[derive(Clone, Debug)]
258    pub struct UpdateTransferConfig(RequestBuilder<crate::model::UpdateTransferConfigRequest>);
259
260    impl UpdateTransferConfig {
261        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
262            Self(RequestBuilder::new(stub))
263        }
264
265        /// Sets the full request, replacing any prior values.
266        pub fn with_request<V: Into<crate::model::UpdateTransferConfigRequest>>(
267            mut self,
268            v: V,
269        ) -> Self {
270            self.0.request = v.into();
271            self
272        }
273
274        /// Sets all the options, replacing any prior values.
275        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
276            self.0.options = v.into();
277            self
278        }
279
280        /// Sends the request.
281        pub async fn send(self) -> Result<crate::model::TransferConfig> {
282            (*self.0.stub)
283                .update_transfer_config(self.0.request, self.0.options)
284                .await
285                .map(gax::response::Response::into_body)
286        }
287
288        /// Sets the value of [transfer_config][crate::model::UpdateTransferConfigRequest::transfer_config].
289        pub fn set_transfer_config<T: Into<std::option::Option<crate::model::TransferConfig>>>(
290            mut self,
291            v: T,
292        ) -> Self {
293            self.0.request.transfer_config = v.into();
294            self
295        }
296
297        /// Sets the value of [authorization_code][crate::model::UpdateTransferConfigRequest::authorization_code].
298        pub fn set_authorization_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
299            self.0.request.authorization_code = v.into();
300            self
301        }
302
303        /// Sets the value of [update_mask][crate::model::UpdateTransferConfigRequest::update_mask].
304        pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
305            mut self,
306            v: T,
307        ) -> Self {
308            self.0.request.update_mask = v.into();
309            self
310        }
311
312        /// Sets the value of [version_info][crate::model::UpdateTransferConfigRequest::version_info].
313        pub fn set_version_info<T: Into<std::string::String>>(mut self, v: T) -> Self {
314            self.0.request.version_info = v.into();
315            self
316        }
317
318        /// Sets the value of [service_account_name][crate::model::UpdateTransferConfigRequest::service_account_name].
319        pub fn set_service_account_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
320            self.0.request.service_account_name = v.into();
321            self
322        }
323    }
324
325    #[doc(hidden)]
326    impl gax::options::internal::RequestBuilder for UpdateTransferConfig {
327        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
328            &mut self.0.options
329        }
330    }
331
332    /// The request builder for [DataTransferService::delete_transfer_config][super::super::client::DataTransferService::delete_transfer_config] calls.
333    #[derive(Clone, Debug)]
334    pub struct DeleteTransferConfig(RequestBuilder<crate::model::DeleteTransferConfigRequest>);
335
336    impl DeleteTransferConfig {
337        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
338            Self(RequestBuilder::new(stub))
339        }
340
341        /// Sets the full request, replacing any prior values.
342        pub fn with_request<V: Into<crate::model::DeleteTransferConfigRequest>>(
343            mut self,
344            v: V,
345        ) -> Self {
346            self.0.request = v.into();
347            self
348        }
349
350        /// Sets all the options, replacing any prior values.
351        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
352            self.0.options = v.into();
353            self
354        }
355
356        /// Sends the request.
357        pub async fn send(self) -> Result<()> {
358            (*self.0.stub)
359                .delete_transfer_config(self.0.request, self.0.options)
360                .await
361                .map(gax::response::Response::into_body)
362        }
363
364        /// Sets the value of [name][crate::model::DeleteTransferConfigRequest::name].
365        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
366            self.0.request.name = v.into();
367            self
368        }
369    }
370
371    #[doc(hidden)]
372    impl gax::options::internal::RequestBuilder for DeleteTransferConfig {
373        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
374            &mut self.0.options
375        }
376    }
377
378    /// The request builder for [DataTransferService::get_transfer_config][super::super::client::DataTransferService::get_transfer_config] calls.
379    #[derive(Clone, Debug)]
380    pub struct GetTransferConfig(RequestBuilder<crate::model::GetTransferConfigRequest>);
381
382    impl GetTransferConfig {
383        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
384            Self(RequestBuilder::new(stub))
385        }
386
387        /// Sets the full request, replacing any prior values.
388        pub fn with_request<V: Into<crate::model::GetTransferConfigRequest>>(
389            mut self,
390            v: V,
391        ) -> Self {
392            self.0.request = v.into();
393            self
394        }
395
396        /// Sets all the options, replacing any prior values.
397        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
398            self.0.options = v.into();
399            self
400        }
401
402        /// Sends the request.
403        pub async fn send(self) -> Result<crate::model::TransferConfig> {
404            (*self.0.stub)
405                .get_transfer_config(self.0.request, self.0.options)
406                .await
407                .map(gax::response::Response::into_body)
408        }
409
410        /// Sets the value of [name][crate::model::GetTransferConfigRequest::name].
411        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
412            self.0.request.name = v.into();
413            self
414        }
415    }
416
417    #[doc(hidden)]
418    impl gax::options::internal::RequestBuilder for GetTransferConfig {
419        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
420            &mut self.0.options
421        }
422    }
423
424    /// The request builder for [DataTransferService::list_transfer_configs][super::super::client::DataTransferService::list_transfer_configs] calls.
425    #[derive(Clone, Debug)]
426    pub struct ListTransferConfigs(RequestBuilder<crate::model::ListTransferConfigsRequest>);
427
428    impl ListTransferConfigs {
429        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
430            Self(RequestBuilder::new(stub))
431        }
432
433        /// Sets the full request, replacing any prior values.
434        pub fn with_request<V: Into<crate::model::ListTransferConfigsRequest>>(
435            mut self,
436            v: V,
437        ) -> Self {
438            self.0.request = v.into();
439            self
440        }
441
442        /// Sets all the options, replacing any prior values.
443        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
444            self.0.options = v.into();
445            self
446        }
447
448        /// Sends the request.
449        pub async fn send(self) -> Result<crate::model::ListTransferConfigsResponse> {
450            (*self.0.stub)
451                .list_transfer_configs(self.0.request, self.0.options)
452                .await
453                .map(gax::response::Response::into_body)
454        }
455
456        /// Streams the responses back.
457        pub async fn paginator(
458            self,
459        ) -> impl gax::paginator::Paginator<crate::model::ListTransferConfigsResponse, gax::error::Error>
460        {
461            use std::clone::Clone;
462            let token = self.0.request.page_token.clone();
463            let execute = move |token: String| {
464                let mut builder = self.clone();
465                builder.0.request = builder.0.request.set_page_token(token);
466                builder.send()
467            };
468            gax::paginator::internal::new_paginator(token, execute)
469        }
470
471        /// Sets the value of [parent][crate::model::ListTransferConfigsRequest::parent].
472        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
473            self.0.request.parent = v.into();
474            self
475        }
476
477        /// Sets the value of [page_token][crate::model::ListTransferConfigsRequest::page_token].
478        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
479            self.0.request.page_token = v.into();
480            self
481        }
482
483        /// Sets the value of [page_size][crate::model::ListTransferConfigsRequest::page_size].
484        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
485            self.0.request.page_size = v.into();
486            self
487        }
488
489        /// Sets the value of [data_source_ids][crate::model::ListTransferConfigsRequest::data_source_ids].
490        pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
491        where
492            T: std::iter::IntoIterator<Item = V>,
493            V: std::convert::Into<std::string::String>,
494        {
495            use std::iter::Iterator;
496            self.0.request.data_source_ids = v.into_iter().map(|i| i.into()).collect();
497            self
498        }
499    }
500
501    #[doc(hidden)]
502    impl gax::options::internal::RequestBuilder for ListTransferConfigs {
503        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
504            &mut self.0.options
505        }
506    }
507
508    /// The request builder for [DataTransferService::schedule_transfer_runs][super::super::client::DataTransferService::schedule_transfer_runs] calls.
509    #[derive(Clone, Debug)]
510    pub struct ScheduleTransferRuns(RequestBuilder<crate::model::ScheduleTransferRunsRequest>);
511
512    impl ScheduleTransferRuns {
513        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
514            Self(RequestBuilder::new(stub))
515        }
516
517        /// Sets the full request, replacing any prior values.
518        pub fn with_request<V: Into<crate::model::ScheduleTransferRunsRequest>>(
519            mut self,
520            v: V,
521        ) -> Self {
522            self.0.request = v.into();
523            self
524        }
525
526        /// Sets all the options, replacing any prior values.
527        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
528            self.0.options = v.into();
529            self
530        }
531
532        /// Sends the request.
533        pub async fn send(self) -> Result<crate::model::ScheduleTransferRunsResponse> {
534            (*self.0.stub)
535                .schedule_transfer_runs(self.0.request, self.0.options)
536                .await
537                .map(gax::response::Response::into_body)
538        }
539
540        /// Sets the value of [parent][crate::model::ScheduleTransferRunsRequest::parent].
541        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
542            self.0.request.parent = v.into();
543            self
544        }
545
546        /// Sets the value of [start_time][crate::model::ScheduleTransferRunsRequest::start_time].
547        pub fn set_start_time<T: Into<std::option::Option<wkt::Timestamp>>>(
548            mut self,
549            v: T,
550        ) -> Self {
551            self.0.request.start_time = v.into();
552            self
553        }
554
555        /// Sets the value of [end_time][crate::model::ScheduleTransferRunsRequest::end_time].
556        pub fn set_end_time<T: Into<std::option::Option<wkt::Timestamp>>>(mut self, v: T) -> Self {
557            self.0.request.end_time = v.into();
558            self
559        }
560    }
561
562    #[doc(hidden)]
563    impl gax::options::internal::RequestBuilder for ScheduleTransferRuns {
564        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
565            &mut self.0.options
566        }
567    }
568
569    /// The request builder for [DataTransferService::start_manual_transfer_runs][super::super::client::DataTransferService::start_manual_transfer_runs] calls.
570    #[derive(Clone, Debug)]
571    pub struct StartManualTransferRuns(
572        RequestBuilder<crate::model::StartManualTransferRunsRequest>,
573    );
574
575    impl StartManualTransferRuns {
576        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
577            Self(RequestBuilder::new(stub))
578        }
579
580        /// Sets the full request, replacing any prior values.
581        pub fn with_request<V: Into<crate::model::StartManualTransferRunsRequest>>(
582            mut self,
583            v: V,
584        ) -> Self {
585            self.0.request = v.into();
586            self
587        }
588
589        /// Sets all the options, replacing any prior values.
590        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
591            self.0.options = v.into();
592            self
593        }
594
595        /// Sends the request.
596        pub async fn send(self) -> Result<crate::model::StartManualTransferRunsResponse> {
597            (*self.0.stub)
598                .start_manual_transfer_runs(self.0.request, self.0.options)
599                .await
600                .map(gax::response::Response::into_body)
601        }
602
603        /// Sets the value of [parent][crate::model::StartManualTransferRunsRequest::parent].
604        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
605            self.0.request.parent = v.into();
606            self
607        }
608
609        /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time].
610        ///
611        /// Note that all the setters affecting `time` are
612        /// mutually exclusive.
613        pub fn set_time<T: Into<Option<crate::model::start_manual_transfer_runs_request::Time>>>(
614            mut self,
615            v: T,
616        ) -> Self {
617            self.0.request.time = v.into();
618            self
619        }
620
621        /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
622        /// to hold a `RequestedTimeRange`.
623        ///
624        /// Note that all the setters affecting `time` are
625        /// mutually exclusive.
626        pub fn set_requested_time_range<
627            T: std::convert::Into<
628                    std::boxed::Box<crate::model::start_manual_transfer_runs_request::TimeRange>,
629                >,
630        >(
631            mut self,
632            v: T,
633        ) -> Self {
634            self.0.request = self.0.request.set_requested_time_range(v);
635            self
636        }
637
638        /// Sets the value of [time][crate::model::StartManualTransferRunsRequest::time]
639        /// to hold a `RequestedRunTime`.
640        ///
641        /// Note that all the setters affecting `time` are
642        /// mutually exclusive.
643        pub fn set_requested_run_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
644            mut self,
645            v: T,
646        ) -> Self {
647            self.0.request = self.0.request.set_requested_run_time(v);
648            self
649        }
650    }
651
652    #[doc(hidden)]
653    impl gax::options::internal::RequestBuilder for StartManualTransferRuns {
654        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
655            &mut self.0.options
656        }
657    }
658
659    /// The request builder for [DataTransferService::get_transfer_run][super::super::client::DataTransferService::get_transfer_run] calls.
660    #[derive(Clone, Debug)]
661    pub struct GetTransferRun(RequestBuilder<crate::model::GetTransferRunRequest>);
662
663    impl GetTransferRun {
664        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
665            Self(RequestBuilder::new(stub))
666        }
667
668        /// Sets the full request, replacing any prior values.
669        pub fn with_request<V: Into<crate::model::GetTransferRunRequest>>(mut self, v: V) -> Self {
670            self.0.request = v.into();
671            self
672        }
673
674        /// Sets all the options, replacing any prior values.
675        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
676            self.0.options = v.into();
677            self
678        }
679
680        /// Sends the request.
681        pub async fn send(self) -> Result<crate::model::TransferRun> {
682            (*self.0.stub)
683                .get_transfer_run(self.0.request, self.0.options)
684                .await
685                .map(gax::response::Response::into_body)
686        }
687
688        /// Sets the value of [name][crate::model::GetTransferRunRequest::name].
689        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
690            self.0.request.name = v.into();
691            self
692        }
693    }
694
695    #[doc(hidden)]
696    impl gax::options::internal::RequestBuilder for GetTransferRun {
697        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
698            &mut self.0.options
699        }
700    }
701
702    /// The request builder for [DataTransferService::delete_transfer_run][super::super::client::DataTransferService::delete_transfer_run] calls.
703    #[derive(Clone, Debug)]
704    pub struct DeleteTransferRun(RequestBuilder<crate::model::DeleteTransferRunRequest>);
705
706    impl DeleteTransferRun {
707        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
708            Self(RequestBuilder::new(stub))
709        }
710
711        /// Sets the full request, replacing any prior values.
712        pub fn with_request<V: Into<crate::model::DeleteTransferRunRequest>>(
713            mut self,
714            v: V,
715        ) -> Self {
716            self.0.request = v.into();
717            self
718        }
719
720        /// Sets all the options, replacing any prior values.
721        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
722            self.0.options = v.into();
723            self
724        }
725
726        /// Sends the request.
727        pub async fn send(self) -> Result<()> {
728            (*self.0.stub)
729                .delete_transfer_run(self.0.request, self.0.options)
730                .await
731                .map(gax::response::Response::into_body)
732        }
733
734        /// Sets the value of [name][crate::model::DeleteTransferRunRequest::name].
735        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
736            self.0.request.name = v.into();
737            self
738        }
739    }
740
741    #[doc(hidden)]
742    impl gax::options::internal::RequestBuilder for DeleteTransferRun {
743        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
744            &mut self.0.options
745        }
746    }
747
748    /// The request builder for [DataTransferService::list_transfer_runs][super::super::client::DataTransferService::list_transfer_runs] calls.
749    #[derive(Clone, Debug)]
750    pub struct ListTransferRuns(RequestBuilder<crate::model::ListTransferRunsRequest>);
751
752    impl ListTransferRuns {
753        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
754            Self(RequestBuilder::new(stub))
755        }
756
757        /// Sets the full request, replacing any prior values.
758        pub fn with_request<V: Into<crate::model::ListTransferRunsRequest>>(
759            mut self,
760            v: V,
761        ) -> Self {
762            self.0.request = v.into();
763            self
764        }
765
766        /// Sets all the options, replacing any prior values.
767        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
768            self.0.options = v.into();
769            self
770        }
771
772        /// Sends the request.
773        pub async fn send(self) -> Result<crate::model::ListTransferRunsResponse> {
774            (*self.0.stub)
775                .list_transfer_runs(self.0.request, self.0.options)
776                .await
777                .map(gax::response::Response::into_body)
778        }
779
780        /// Streams the responses back.
781        pub async fn paginator(
782            self,
783        ) -> impl gax::paginator::Paginator<crate::model::ListTransferRunsResponse, gax::error::Error>
784        {
785            use std::clone::Clone;
786            let token = self.0.request.page_token.clone();
787            let execute = move |token: String| {
788                let mut builder = self.clone();
789                builder.0.request = builder.0.request.set_page_token(token);
790                builder.send()
791            };
792            gax::paginator::internal::new_paginator(token, execute)
793        }
794
795        /// Sets the value of [parent][crate::model::ListTransferRunsRequest::parent].
796        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
797            self.0.request.parent = v.into();
798            self
799        }
800
801        /// Sets the value of [page_token][crate::model::ListTransferRunsRequest::page_token].
802        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
803            self.0.request.page_token = v.into();
804            self
805        }
806
807        /// Sets the value of [page_size][crate::model::ListTransferRunsRequest::page_size].
808        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
809            self.0.request.page_size = v.into();
810            self
811        }
812
813        /// Sets the value of [run_attempt][crate::model::ListTransferRunsRequest::run_attempt].
814        pub fn set_run_attempt<T: Into<crate::model::list_transfer_runs_request::RunAttempt>>(
815            mut self,
816            v: T,
817        ) -> Self {
818            self.0.request.run_attempt = v.into();
819            self
820        }
821
822        /// Sets the value of [states][crate::model::ListTransferRunsRequest::states].
823        pub fn set_states<T, V>(mut self, v: T) -> Self
824        where
825            T: std::iter::IntoIterator<Item = V>,
826            V: std::convert::Into<crate::model::TransferState>,
827        {
828            use std::iter::Iterator;
829            self.0.request.states = v.into_iter().map(|i| i.into()).collect();
830            self
831        }
832    }
833
834    #[doc(hidden)]
835    impl gax::options::internal::RequestBuilder for ListTransferRuns {
836        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
837            &mut self.0.options
838        }
839    }
840
841    /// The request builder for [DataTransferService::list_transfer_logs][super::super::client::DataTransferService::list_transfer_logs] calls.
842    #[derive(Clone, Debug)]
843    pub struct ListTransferLogs(RequestBuilder<crate::model::ListTransferLogsRequest>);
844
845    impl ListTransferLogs {
846        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
847            Self(RequestBuilder::new(stub))
848        }
849
850        /// Sets the full request, replacing any prior values.
851        pub fn with_request<V: Into<crate::model::ListTransferLogsRequest>>(
852            mut self,
853            v: V,
854        ) -> Self {
855            self.0.request = v.into();
856            self
857        }
858
859        /// Sets all the options, replacing any prior values.
860        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
861            self.0.options = v.into();
862            self
863        }
864
865        /// Sends the request.
866        pub async fn send(self) -> Result<crate::model::ListTransferLogsResponse> {
867            (*self.0.stub)
868                .list_transfer_logs(self.0.request, self.0.options)
869                .await
870                .map(gax::response::Response::into_body)
871        }
872
873        /// Streams the responses back.
874        pub async fn paginator(
875            self,
876        ) -> impl gax::paginator::Paginator<crate::model::ListTransferLogsResponse, gax::error::Error>
877        {
878            use std::clone::Clone;
879            let token = self.0.request.page_token.clone();
880            let execute = move |token: String| {
881                let mut builder = self.clone();
882                builder.0.request = builder.0.request.set_page_token(token);
883                builder.send()
884            };
885            gax::paginator::internal::new_paginator(token, execute)
886        }
887
888        /// Sets the value of [parent][crate::model::ListTransferLogsRequest::parent].
889        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
890            self.0.request.parent = v.into();
891            self
892        }
893
894        /// Sets the value of [page_token][crate::model::ListTransferLogsRequest::page_token].
895        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
896            self.0.request.page_token = v.into();
897            self
898        }
899
900        /// Sets the value of [page_size][crate::model::ListTransferLogsRequest::page_size].
901        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
902            self.0.request.page_size = v.into();
903            self
904        }
905
906        /// Sets the value of [message_types][crate::model::ListTransferLogsRequest::message_types].
907        pub fn set_message_types<T, V>(mut self, v: T) -> Self
908        where
909            T: std::iter::IntoIterator<Item = V>,
910            V: std::convert::Into<crate::model::transfer_message::MessageSeverity>,
911        {
912            use std::iter::Iterator;
913            self.0.request.message_types = v.into_iter().map(|i| i.into()).collect();
914            self
915        }
916    }
917
918    #[doc(hidden)]
919    impl gax::options::internal::RequestBuilder for ListTransferLogs {
920        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
921            &mut self.0.options
922        }
923    }
924
925    /// The request builder for [DataTransferService::check_valid_creds][super::super::client::DataTransferService::check_valid_creds] calls.
926    #[derive(Clone, Debug)]
927    pub struct CheckValidCreds(RequestBuilder<crate::model::CheckValidCredsRequest>);
928
929    impl CheckValidCreds {
930        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
931            Self(RequestBuilder::new(stub))
932        }
933
934        /// Sets the full request, replacing any prior values.
935        pub fn with_request<V: Into<crate::model::CheckValidCredsRequest>>(mut self, v: V) -> Self {
936            self.0.request = v.into();
937            self
938        }
939
940        /// Sets all the options, replacing any prior values.
941        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
942            self.0.options = v.into();
943            self
944        }
945
946        /// Sends the request.
947        pub async fn send(self) -> Result<crate::model::CheckValidCredsResponse> {
948            (*self.0.stub)
949                .check_valid_creds(self.0.request, self.0.options)
950                .await
951                .map(gax::response::Response::into_body)
952        }
953
954        /// Sets the value of [name][crate::model::CheckValidCredsRequest::name].
955        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
956            self.0.request.name = v.into();
957            self
958        }
959    }
960
961    #[doc(hidden)]
962    impl gax::options::internal::RequestBuilder for CheckValidCreds {
963        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
964            &mut self.0.options
965        }
966    }
967
968    /// The request builder for [DataTransferService::enroll_data_sources][super::super::client::DataTransferService::enroll_data_sources] calls.
969    #[derive(Clone, Debug)]
970    pub struct EnrollDataSources(RequestBuilder<crate::model::EnrollDataSourcesRequest>);
971
972    impl EnrollDataSources {
973        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
974            Self(RequestBuilder::new(stub))
975        }
976
977        /// Sets the full request, replacing any prior values.
978        pub fn with_request<V: Into<crate::model::EnrollDataSourcesRequest>>(
979            mut self,
980            v: V,
981        ) -> Self {
982            self.0.request = v.into();
983            self
984        }
985
986        /// Sets all the options, replacing any prior values.
987        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
988            self.0.options = v.into();
989            self
990        }
991
992        /// Sends the request.
993        pub async fn send(self) -> Result<()> {
994            (*self.0.stub)
995                .enroll_data_sources(self.0.request, self.0.options)
996                .await
997                .map(gax::response::Response::into_body)
998        }
999
1000        /// Sets the value of [name][crate::model::EnrollDataSourcesRequest::name].
1001        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1002            self.0.request.name = v.into();
1003            self
1004        }
1005
1006        /// Sets the value of [data_source_ids][crate::model::EnrollDataSourcesRequest::data_source_ids].
1007        pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
1008        where
1009            T: std::iter::IntoIterator<Item = V>,
1010            V: std::convert::Into<std::string::String>,
1011        {
1012            use std::iter::Iterator;
1013            self.0.request.data_source_ids = v.into_iter().map(|i| i.into()).collect();
1014            self
1015        }
1016    }
1017
1018    #[doc(hidden)]
1019    impl gax::options::internal::RequestBuilder for EnrollDataSources {
1020        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1021            &mut self.0.options
1022        }
1023    }
1024
1025    /// The request builder for [DataTransferService::unenroll_data_sources][super::super::client::DataTransferService::unenroll_data_sources] calls.
1026    #[derive(Clone, Debug)]
1027    pub struct UnenrollDataSources(RequestBuilder<crate::model::UnenrollDataSourcesRequest>);
1028
1029    impl UnenrollDataSources {
1030        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
1031            Self(RequestBuilder::new(stub))
1032        }
1033
1034        /// Sets the full request, replacing any prior values.
1035        pub fn with_request<V: Into<crate::model::UnenrollDataSourcesRequest>>(
1036            mut self,
1037            v: V,
1038        ) -> Self {
1039            self.0.request = v.into();
1040            self
1041        }
1042
1043        /// Sets all the options, replacing any prior values.
1044        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1045            self.0.options = v.into();
1046            self
1047        }
1048
1049        /// Sends the request.
1050        pub async fn send(self) -> Result<()> {
1051            (*self.0.stub)
1052                .unenroll_data_sources(self.0.request, self.0.options)
1053                .await
1054                .map(gax::response::Response::into_body)
1055        }
1056
1057        /// Sets the value of [name][crate::model::UnenrollDataSourcesRequest::name].
1058        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1059            self.0.request.name = v.into();
1060            self
1061        }
1062
1063        /// Sets the value of [data_source_ids][crate::model::UnenrollDataSourcesRequest::data_source_ids].
1064        pub fn set_data_source_ids<T, V>(mut self, v: T) -> Self
1065        where
1066            T: std::iter::IntoIterator<Item = V>,
1067            V: std::convert::Into<std::string::String>,
1068        {
1069            use std::iter::Iterator;
1070            self.0.request.data_source_ids = v.into_iter().map(|i| i.into()).collect();
1071            self
1072        }
1073    }
1074
1075    #[doc(hidden)]
1076    impl gax::options::internal::RequestBuilder for UnenrollDataSources {
1077        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1078            &mut self.0.options
1079        }
1080    }
1081
1082    /// The request builder for [DataTransferService::list_locations][super::super::client::DataTransferService::list_locations] calls.
1083    #[derive(Clone, Debug)]
1084    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1085
1086    impl ListLocations {
1087        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
1088            Self(RequestBuilder::new(stub))
1089        }
1090
1091        /// Sets the full request, replacing any prior values.
1092        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1093            mut self,
1094            v: V,
1095        ) -> Self {
1096            self.0.request = v.into();
1097            self
1098        }
1099
1100        /// Sets all the options, replacing any prior values.
1101        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1102            self.0.options = v.into();
1103            self
1104        }
1105
1106        /// Sends the request.
1107        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1108            (*self.0.stub)
1109                .list_locations(self.0.request, self.0.options)
1110                .await
1111                .map(gax::response::Response::into_body)
1112        }
1113
1114        /// Streams the responses back.
1115        pub async fn paginator(
1116            self,
1117        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1118        {
1119            use std::clone::Clone;
1120            let token = self.0.request.page_token.clone();
1121            let execute = move |token: String| {
1122                let mut builder = self.clone();
1123                builder.0.request = builder.0.request.set_page_token(token);
1124                builder.send()
1125            };
1126            gax::paginator::internal::new_paginator(token, execute)
1127        }
1128
1129        /// Sets the value of [name][location::model::ListLocationsRequest::name].
1130        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1131            self.0.request.name = v.into();
1132            self
1133        }
1134
1135        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
1136        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1137            self.0.request.filter = v.into();
1138            self
1139        }
1140
1141        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
1142        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1143            self.0.request.page_size = v.into();
1144            self
1145        }
1146
1147        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
1148        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1149            self.0.request.page_token = v.into();
1150            self
1151        }
1152    }
1153
1154    #[doc(hidden)]
1155    impl gax::options::internal::RequestBuilder for ListLocations {
1156        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1157            &mut self.0.options
1158        }
1159    }
1160
1161    /// The request builder for [DataTransferService::get_location][super::super::client::DataTransferService::get_location] calls.
1162    #[derive(Clone, Debug)]
1163    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1164
1165    impl GetLocation {
1166        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DataTransferService>) -> Self {
1167            Self(RequestBuilder::new(stub))
1168        }
1169
1170        /// Sets the full request, replacing any prior values.
1171        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1172            self.0.request = v.into();
1173            self
1174        }
1175
1176        /// Sets all the options, replacing any prior values.
1177        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1178            self.0.options = v.into();
1179            self
1180        }
1181
1182        /// Sends the request.
1183        pub async fn send(self) -> Result<location::model::Location> {
1184            (*self.0.stub)
1185                .get_location(self.0.request, self.0.options)
1186                .await
1187                .map(gax::response::Response::into_body)
1188        }
1189
1190        /// Sets the value of [name][location::model::GetLocationRequest::name].
1191        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1192            self.0.request.name = v.into();
1193            self
1194        }
1195    }
1196
1197    #[doc(hidden)]
1198    impl gax::options::internal::RequestBuilder for GetLocation {
1199        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1200            &mut self.0.options
1201        }
1202    }
1203}