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