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