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