google_cloud_bigquery_v2/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
17/// Request and client builders for [DatasetService][crate::client::DatasetService].
18pub mod dataset_service {
19 use crate::Result;
20
21 /// A builder for [DatasetService][crate::client::DatasetService].
22 ///
23 /// ```
24 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25 /// # use google_cloud_bigquery_v2::*;
26 /// # use builder::dataset_service::ClientBuilder;
27 /// # use client::DatasetService;
28 /// let builder : ClientBuilder = DatasetService::builder();
29 /// let client = builder
30 /// .with_endpoint("https://bigquery.googleapis.com")
31 /// .build().await?;
32 /// # Ok(()) }
33 /// ```
34 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::DatasetService;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = DatasetService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::DatasetService] 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::DatasetService>,
55 request: R,
56 options: crate::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::DatasetService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [DatasetService::get_dataset][crate::client::DatasetService::get_dataset] calls.
75 ///
76 /// # Example
77 /// ```
78 /// # use google_cloud_bigquery_v2::builder::dataset_service::GetDataset;
79 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
80 ///
81 /// let builder = prepare_request_builder();
82 /// let response = builder.send().await?;
83 /// # Ok(()) }
84 ///
85 /// fn prepare_request_builder() -> GetDataset {
86 /// # panic!();
87 /// // ... details omitted ...
88 /// }
89 /// ```
90 #[derive(Clone, Debug)]
91 pub struct GetDataset(RequestBuilder<crate::model::GetDatasetRequest>);
92
93 impl GetDataset {
94 pub(crate) fn new(
95 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
96 ) -> Self {
97 Self(RequestBuilder::new(stub))
98 }
99
100 /// Sets the full request, replacing any prior values.
101 pub fn with_request<V: Into<crate::model::GetDatasetRequest>>(mut self, v: V) -> Self {
102 self.0.request = v.into();
103 self
104 }
105
106 /// Sets all the options, replacing any prior values.
107 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108 self.0.options = v.into();
109 self
110 }
111
112 /// Sends the request.
113 pub async fn send(self) -> Result<crate::model::Dataset> {
114 (*self.0.stub)
115 .get_dataset(self.0.request, self.0.options)
116 .await
117 .map(crate::Response::into_body)
118 }
119
120 /// Sets the value of [project_id][crate::model::GetDatasetRequest::project_id].
121 ///
122 /// This is a **required** field for requests.
123 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
124 self.0.request.project_id = v.into();
125 self
126 }
127
128 /// Sets the value of [dataset_id][crate::model::GetDatasetRequest::dataset_id].
129 ///
130 /// This is a **required** field for requests.
131 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
132 self.0.request.dataset_id = v.into();
133 self
134 }
135
136 /// Sets the value of [dataset_view][crate::model::GetDatasetRequest::dataset_view].
137 pub fn set_dataset_view<T: Into<crate::model::get_dataset_request::DatasetView>>(
138 mut self,
139 v: T,
140 ) -> Self {
141 self.0.request.dataset_view = v.into();
142 self
143 }
144
145 /// Sets the value of [access_policy_version][crate::model::GetDatasetRequest::access_policy_version].
146 pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
147 self.0.request.access_policy_version = v.into();
148 self
149 }
150 }
151
152 #[doc(hidden)]
153 impl crate::RequestBuilder for GetDataset {
154 fn request_options(&mut self) -> &mut crate::RequestOptions {
155 &mut self.0.options
156 }
157 }
158
159 /// The request builder for [DatasetService::insert_dataset][crate::client::DatasetService::insert_dataset] calls.
160 ///
161 /// # Example
162 /// ```
163 /// # use google_cloud_bigquery_v2::builder::dataset_service::InsertDataset;
164 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
165 ///
166 /// let builder = prepare_request_builder();
167 /// let response = builder.send().await?;
168 /// # Ok(()) }
169 ///
170 /// fn prepare_request_builder() -> InsertDataset {
171 /// # panic!();
172 /// // ... details omitted ...
173 /// }
174 /// ```
175 #[derive(Clone, Debug)]
176 pub struct InsertDataset(RequestBuilder<crate::model::InsertDatasetRequest>);
177
178 impl InsertDataset {
179 pub(crate) fn new(
180 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
181 ) -> Self {
182 Self(RequestBuilder::new(stub))
183 }
184
185 /// Sets the full request, replacing any prior values.
186 pub fn with_request<V: Into<crate::model::InsertDatasetRequest>>(mut self, v: V) -> Self {
187 self.0.request = v.into();
188 self
189 }
190
191 /// Sets all the options, replacing any prior values.
192 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
193 self.0.options = v.into();
194 self
195 }
196
197 /// Sends the request.
198 pub async fn send(self) -> Result<crate::model::Dataset> {
199 (*self.0.stub)
200 .insert_dataset(self.0.request, self.0.options)
201 .await
202 .map(crate::Response::into_body)
203 }
204
205 /// Sets the value of [project_id][crate::model::InsertDatasetRequest::project_id].
206 ///
207 /// This is a **required** field for requests.
208 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
209 self.0.request.project_id = v.into();
210 self
211 }
212
213 /// Sets the value of [dataset][crate::model::InsertDatasetRequest::dataset].
214 ///
215 /// This is a **required** field for requests.
216 pub fn set_dataset<T>(mut self, v: T) -> Self
217 where
218 T: std::convert::Into<crate::model::Dataset>,
219 {
220 self.0.request.dataset = std::option::Option::Some(v.into());
221 self
222 }
223
224 /// Sets or clears the value of [dataset][crate::model::InsertDatasetRequest::dataset].
225 ///
226 /// This is a **required** field for requests.
227 pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
228 where
229 T: std::convert::Into<crate::model::Dataset>,
230 {
231 self.0.request.dataset = v.map(|x| x.into());
232 self
233 }
234
235 /// Sets the value of [access_policy_version][crate::model::InsertDatasetRequest::access_policy_version].
236 pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
237 self.0.request.access_policy_version = v.into();
238 self
239 }
240 }
241
242 #[doc(hidden)]
243 impl crate::RequestBuilder for InsertDataset {
244 fn request_options(&mut self) -> &mut crate::RequestOptions {
245 &mut self.0.options
246 }
247 }
248
249 /// The request builder for [DatasetService::patch_dataset][crate::client::DatasetService::patch_dataset] calls.
250 ///
251 /// # Example
252 /// ```
253 /// # use google_cloud_bigquery_v2::builder::dataset_service::PatchDataset;
254 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
255 ///
256 /// let builder = prepare_request_builder();
257 /// let response = builder.send().await?;
258 /// # Ok(()) }
259 ///
260 /// fn prepare_request_builder() -> PatchDataset {
261 /// # panic!();
262 /// // ... details omitted ...
263 /// }
264 /// ```
265 #[derive(Clone, Debug)]
266 pub struct PatchDataset(RequestBuilder<crate::model::UpdateOrPatchDatasetRequest>);
267
268 impl PatchDataset {
269 pub(crate) fn new(
270 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
271 ) -> Self {
272 Self(RequestBuilder::new(stub))
273 }
274
275 /// Sets the full request, replacing any prior values.
276 pub fn with_request<V: Into<crate::model::UpdateOrPatchDatasetRequest>>(
277 mut self,
278 v: V,
279 ) -> Self {
280 self.0.request = v.into();
281 self
282 }
283
284 /// Sets all the options, replacing any prior values.
285 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
286 self.0.options = v.into();
287 self
288 }
289
290 /// Sends the request.
291 pub async fn send(self) -> Result<crate::model::Dataset> {
292 (*self.0.stub)
293 .patch_dataset(self.0.request, self.0.options)
294 .await
295 .map(crate::Response::into_body)
296 }
297
298 /// Sets the value of [project_id][crate::model::UpdateOrPatchDatasetRequest::project_id].
299 ///
300 /// This is a **required** field for requests.
301 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
302 self.0.request.project_id = v.into();
303 self
304 }
305
306 /// Sets the value of [dataset_id][crate::model::UpdateOrPatchDatasetRequest::dataset_id].
307 ///
308 /// This is a **required** field for requests.
309 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
310 self.0.request.dataset_id = v.into();
311 self
312 }
313
314 /// Sets the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
315 ///
316 /// This is a **required** field for requests.
317 pub fn set_dataset<T>(mut self, v: T) -> Self
318 where
319 T: std::convert::Into<crate::model::Dataset>,
320 {
321 self.0.request.dataset = std::option::Option::Some(v.into());
322 self
323 }
324
325 /// Sets or clears the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
326 ///
327 /// This is a **required** field for requests.
328 pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
329 where
330 T: std::convert::Into<crate::model::Dataset>,
331 {
332 self.0.request.dataset = v.map(|x| x.into());
333 self
334 }
335
336 /// Sets the value of [update_mode][crate::model::UpdateOrPatchDatasetRequest::update_mode].
337 pub fn set_update_mode<
338 T: Into<crate::model::update_or_patch_dataset_request::UpdateMode>,
339 >(
340 mut self,
341 v: T,
342 ) -> Self {
343 self.0.request.update_mode = v.into();
344 self
345 }
346
347 /// Sets the value of [access_policy_version][crate::model::UpdateOrPatchDatasetRequest::access_policy_version].
348 pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
349 self.0.request.access_policy_version = v.into();
350 self
351 }
352 }
353
354 #[doc(hidden)]
355 impl crate::RequestBuilder for PatchDataset {
356 fn request_options(&mut self) -> &mut crate::RequestOptions {
357 &mut self.0.options
358 }
359 }
360
361 /// The request builder for [DatasetService::update_dataset][crate::client::DatasetService::update_dataset] calls.
362 ///
363 /// # Example
364 /// ```
365 /// # use google_cloud_bigquery_v2::builder::dataset_service::UpdateDataset;
366 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
367 ///
368 /// let builder = prepare_request_builder();
369 /// let response = builder.send().await?;
370 /// # Ok(()) }
371 ///
372 /// fn prepare_request_builder() -> UpdateDataset {
373 /// # panic!();
374 /// // ... details omitted ...
375 /// }
376 /// ```
377 #[derive(Clone, Debug)]
378 pub struct UpdateDataset(RequestBuilder<crate::model::UpdateOrPatchDatasetRequest>);
379
380 impl UpdateDataset {
381 pub(crate) fn new(
382 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
383 ) -> Self {
384 Self(RequestBuilder::new(stub))
385 }
386
387 /// Sets the full request, replacing any prior values.
388 pub fn with_request<V: Into<crate::model::UpdateOrPatchDatasetRequest>>(
389 mut self,
390 v: V,
391 ) -> Self {
392 self.0.request = v.into();
393 self
394 }
395
396 /// Sets all the options, replacing any prior values.
397 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
398 self.0.options = v.into();
399 self
400 }
401
402 /// Sends the request.
403 pub async fn send(self) -> Result<crate::model::Dataset> {
404 (*self.0.stub)
405 .update_dataset(self.0.request, self.0.options)
406 .await
407 .map(crate::Response::into_body)
408 }
409
410 /// Sets the value of [project_id][crate::model::UpdateOrPatchDatasetRequest::project_id].
411 ///
412 /// This is a **required** field for requests.
413 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
414 self.0.request.project_id = v.into();
415 self
416 }
417
418 /// Sets the value of [dataset_id][crate::model::UpdateOrPatchDatasetRequest::dataset_id].
419 ///
420 /// This is a **required** field for requests.
421 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
422 self.0.request.dataset_id = v.into();
423 self
424 }
425
426 /// Sets the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
427 ///
428 /// This is a **required** field for requests.
429 pub fn set_dataset<T>(mut self, v: T) -> Self
430 where
431 T: std::convert::Into<crate::model::Dataset>,
432 {
433 self.0.request.dataset = std::option::Option::Some(v.into());
434 self
435 }
436
437 /// Sets or clears the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
438 ///
439 /// This is a **required** field for requests.
440 pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
441 where
442 T: std::convert::Into<crate::model::Dataset>,
443 {
444 self.0.request.dataset = v.map(|x| x.into());
445 self
446 }
447
448 /// Sets the value of [update_mode][crate::model::UpdateOrPatchDatasetRequest::update_mode].
449 pub fn set_update_mode<
450 T: Into<crate::model::update_or_patch_dataset_request::UpdateMode>,
451 >(
452 mut self,
453 v: T,
454 ) -> Self {
455 self.0.request.update_mode = v.into();
456 self
457 }
458
459 /// Sets the value of [access_policy_version][crate::model::UpdateOrPatchDatasetRequest::access_policy_version].
460 pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
461 self.0.request.access_policy_version = v.into();
462 self
463 }
464 }
465
466 #[doc(hidden)]
467 impl crate::RequestBuilder for UpdateDataset {
468 fn request_options(&mut self) -> &mut crate::RequestOptions {
469 &mut self.0.options
470 }
471 }
472
473 /// The request builder for [DatasetService::delete_dataset][crate::client::DatasetService::delete_dataset] calls.
474 ///
475 /// # Example
476 /// ```
477 /// # use google_cloud_bigquery_v2::builder::dataset_service::DeleteDataset;
478 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
479 ///
480 /// let builder = prepare_request_builder();
481 /// let response = builder.send().await?;
482 /// # Ok(()) }
483 ///
484 /// fn prepare_request_builder() -> DeleteDataset {
485 /// # panic!();
486 /// // ... details omitted ...
487 /// }
488 /// ```
489 #[derive(Clone, Debug)]
490 pub struct DeleteDataset(RequestBuilder<crate::model::DeleteDatasetRequest>);
491
492 impl DeleteDataset {
493 pub(crate) fn new(
494 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
495 ) -> Self {
496 Self(RequestBuilder::new(stub))
497 }
498
499 /// Sets the full request, replacing any prior values.
500 pub fn with_request<V: Into<crate::model::DeleteDatasetRequest>>(mut self, v: V) -> Self {
501 self.0.request = v.into();
502 self
503 }
504
505 /// Sets all the options, replacing any prior values.
506 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
507 self.0.options = v.into();
508 self
509 }
510
511 /// Sends the request.
512 pub async fn send(self) -> Result<()> {
513 (*self.0.stub)
514 .delete_dataset(self.0.request, self.0.options)
515 .await
516 .map(crate::Response::into_body)
517 }
518
519 /// Sets the value of [project_id][crate::model::DeleteDatasetRequest::project_id].
520 ///
521 /// This is a **required** field for requests.
522 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
523 self.0.request.project_id = v.into();
524 self
525 }
526
527 /// Sets the value of [dataset_id][crate::model::DeleteDatasetRequest::dataset_id].
528 ///
529 /// This is a **required** field for requests.
530 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
531 self.0.request.dataset_id = v.into();
532 self
533 }
534
535 /// Sets the value of [delete_contents][crate::model::DeleteDatasetRequest::delete_contents].
536 pub fn set_delete_contents<T: Into<bool>>(mut self, v: T) -> Self {
537 self.0.request.delete_contents = v.into();
538 self
539 }
540 }
541
542 #[doc(hidden)]
543 impl crate::RequestBuilder for DeleteDataset {
544 fn request_options(&mut self) -> &mut crate::RequestOptions {
545 &mut self.0.options
546 }
547 }
548
549 /// The request builder for [DatasetService::list_datasets][crate::client::DatasetService::list_datasets] calls.
550 ///
551 /// # Example
552 /// ```
553 /// # use google_cloud_bigquery_v2::builder::dataset_service::ListDatasets;
554 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
555 /// use google_cloud_gax::paginator::ItemPaginator;
556 ///
557 /// let builder = prepare_request_builder();
558 /// let mut items = builder.by_item();
559 /// while let Some(result) = items.next().await {
560 /// let item = result?;
561 /// }
562 /// # Ok(()) }
563 ///
564 /// fn prepare_request_builder() -> ListDatasets {
565 /// # panic!();
566 /// // ... details omitted ...
567 /// }
568 /// ```
569 #[derive(Clone, Debug)]
570 pub struct ListDatasets(RequestBuilder<crate::model::ListDatasetsRequest>);
571
572 impl ListDatasets {
573 pub(crate) fn new(
574 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
575 ) -> Self {
576 Self(RequestBuilder::new(stub))
577 }
578
579 /// Sets the full request, replacing any prior values.
580 pub fn with_request<V: Into<crate::model::ListDatasetsRequest>>(mut self, v: V) -> Self {
581 self.0.request = v.into();
582 self
583 }
584
585 /// Sets all the options, replacing any prior values.
586 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
587 self.0.options = v.into();
588 self
589 }
590
591 /// Sends the request.
592 pub async fn send(self) -> Result<crate::model::DatasetList> {
593 (*self.0.stub)
594 .list_datasets(self.0.request, self.0.options)
595 .await
596 .map(crate::Response::into_body)
597 }
598
599 /// Streams each page in the collection.
600 pub fn by_page(
601 self,
602 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::DatasetList, crate::Error>
603 {
604 use std::clone::Clone;
605 let token = self.0.request.page_token.clone();
606 let execute = move |token: String| {
607 let mut builder = self.clone();
608 builder.0.request = builder.0.request.set_page_token(token);
609 builder.send()
610 };
611 google_cloud_gax::paginator::internal::new_paginator(token, execute)
612 }
613
614 /// Streams each item in the collection.
615 pub fn by_item(
616 self,
617 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::DatasetList, crate::Error>
618 {
619 use google_cloud_gax::paginator::Paginator;
620 self.by_page().items()
621 }
622
623 /// Sets the value of [project_id][crate::model::ListDatasetsRequest::project_id].
624 ///
625 /// This is a **required** field for requests.
626 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
627 self.0.request.project_id = v.into();
628 self
629 }
630
631 /// Sets the value of [max_results][crate::model::ListDatasetsRequest::max_results].
632 pub fn set_max_results<T>(mut self, v: T) -> Self
633 where
634 T: std::convert::Into<wkt::UInt32Value>,
635 {
636 self.0.request.max_results = std::option::Option::Some(v.into());
637 self
638 }
639
640 /// Sets or clears the value of [max_results][crate::model::ListDatasetsRequest::max_results].
641 pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
642 where
643 T: std::convert::Into<wkt::UInt32Value>,
644 {
645 self.0.request.max_results = v.map(|x| x.into());
646 self
647 }
648
649 /// Sets the value of [page_token][crate::model::ListDatasetsRequest::page_token].
650 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
651 self.0.request.page_token = v.into();
652 self
653 }
654
655 /// Sets the value of [all][crate::model::ListDatasetsRequest::all].
656 pub fn set_all<T: Into<bool>>(mut self, v: T) -> Self {
657 self.0.request.all = v.into();
658 self
659 }
660
661 /// Sets the value of [filter][crate::model::ListDatasetsRequest::filter].
662 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
663 self.0.request.filter = v.into();
664 self
665 }
666 }
667
668 #[doc(hidden)]
669 impl crate::RequestBuilder for ListDatasets {
670 fn request_options(&mut self) -> &mut crate::RequestOptions {
671 &mut self.0.options
672 }
673 }
674
675 /// The request builder for [DatasetService::undelete_dataset][crate::client::DatasetService::undelete_dataset] calls.
676 ///
677 /// # Example
678 /// ```
679 /// # use google_cloud_bigquery_v2::builder::dataset_service::UndeleteDataset;
680 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
681 ///
682 /// let builder = prepare_request_builder();
683 /// let response = builder.send().await?;
684 /// # Ok(()) }
685 ///
686 /// fn prepare_request_builder() -> UndeleteDataset {
687 /// # panic!();
688 /// // ... details omitted ...
689 /// }
690 /// ```
691 #[derive(Clone, Debug)]
692 pub struct UndeleteDataset(RequestBuilder<crate::model::UndeleteDatasetRequest>);
693
694 impl UndeleteDataset {
695 pub(crate) fn new(
696 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
697 ) -> Self {
698 Self(RequestBuilder::new(stub))
699 }
700
701 /// Sets the full request, replacing any prior values.
702 pub fn with_request<V: Into<crate::model::UndeleteDatasetRequest>>(mut self, v: V) -> Self {
703 self.0.request = v.into();
704 self
705 }
706
707 /// Sets all the options, replacing any prior values.
708 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
709 self.0.options = v.into();
710 self
711 }
712
713 /// Sends the request.
714 pub async fn send(self) -> Result<crate::model::Dataset> {
715 (*self.0.stub)
716 .undelete_dataset(self.0.request, self.0.options)
717 .await
718 .map(crate::Response::into_body)
719 }
720
721 /// Sets the value of [project_id][crate::model::UndeleteDatasetRequest::project_id].
722 ///
723 /// This is a **required** field for requests.
724 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
725 self.0.request.project_id = v.into();
726 self
727 }
728
729 /// Sets the value of [dataset_id][crate::model::UndeleteDatasetRequest::dataset_id].
730 ///
731 /// This is a **required** field for requests.
732 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
733 self.0.request.dataset_id = v.into();
734 self
735 }
736
737 /// Sets the value of [deletion_time][crate::model::UndeleteDatasetRequest::deletion_time].
738 pub fn set_deletion_time<T>(mut self, v: T) -> Self
739 where
740 T: std::convert::Into<wkt::Timestamp>,
741 {
742 self.0.request.deletion_time = std::option::Option::Some(v.into());
743 self
744 }
745
746 /// Sets or clears the value of [deletion_time][crate::model::UndeleteDatasetRequest::deletion_time].
747 pub fn set_or_clear_deletion_time<T>(mut self, v: std::option::Option<T>) -> Self
748 where
749 T: std::convert::Into<wkt::Timestamp>,
750 {
751 self.0.request.deletion_time = v.map(|x| x.into());
752 self
753 }
754 }
755
756 #[doc(hidden)]
757 impl crate::RequestBuilder for UndeleteDataset {
758 fn request_options(&mut self) -> &mut crate::RequestOptions {
759 &mut self.0.options
760 }
761 }
762}
763
764/// Request and client builders for [JobService][crate::client::JobService].
765pub mod job_service {
766 use crate::Result;
767
768 /// A builder for [JobService][crate::client::JobService].
769 ///
770 /// ```
771 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
772 /// # use google_cloud_bigquery_v2::*;
773 /// # use builder::job_service::ClientBuilder;
774 /// # use client::JobService;
775 /// let builder : ClientBuilder = JobService::builder();
776 /// let client = builder
777 /// .with_endpoint("https://bigquery.googleapis.com")
778 /// .build().await?;
779 /// # Ok(()) }
780 /// ```
781 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
782
783 pub(crate) mod client {
784 use super::super::super::client::JobService;
785 pub struct Factory;
786 impl crate::ClientFactory for Factory {
787 type Client = JobService;
788 type Credentials = gaxi::options::Credentials;
789 async fn build(
790 self,
791 config: gaxi::options::ClientConfig,
792 ) -> crate::ClientBuilderResult<Self::Client> {
793 Self::Client::new(config).await
794 }
795 }
796 }
797
798 /// Common implementation for [crate::client::JobService] request builders.
799 #[derive(Clone, Debug)]
800 pub(crate) struct RequestBuilder<R: std::default::Default> {
801 pub(crate) stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
802 pub(crate) request: R,
803 pub(crate) options: crate::RequestOptions,
804 }
805
806 impl<R> RequestBuilder<R>
807 where
808 R: std::default::Default,
809 {
810 pub(crate) fn new(
811 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
812 ) -> Self {
813 Self {
814 stub,
815 request: R::default(),
816 options: crate::RequestOptions::default(),
817 }
818 }
819 }
820
821 /// The request builder for [JobService::cancel_job][crate::client::JobService::cancel_job] calls.
822 ///
823 /// # Example
824 /// ```
825 /// # use google_cloud_bigquery_v2::builder::job_service::CancelJob;
826 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
827 ///
828 /// let builder = prepare_request_builder();
829 /// let response = builder.send().await?;
830 /// # Ok(()) }
831 ///
832 /// fn prepare_request_builder() -> CancelJob {
833 /// # panic!();
834 /// // ... details omitted ...
835 /// }
836 /// ```
837 #[derive(Clone, Debug)]
838 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
839
840 impl CancelJob {
841 pub(crate) fn new(
842 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
843 ) -> Self {
844 Self(RequestBuilder::new(stub))
845 }
846
847 /// Sets the full request, replacing any prior values.
848 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
849 self.0.request = v.into();
850 self
851 }
852
853 /// Sets all the options, replacing any prior values.
854 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
855 self.0.options = v.into();
856 self
857 }
858
859 /// Sends the request.
860 pub async fn send(self) -> Result<crate::model::JobCancelResponse> {
861 (*self.0.stub)
862 .cancel_job(self.0.request, self.0.options)
863 .await
864 .map(crate::Response::into_body)
865 }
866
867 /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
868 ///
869 /// This is a **required** field for requests.
870 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
871 self.0.request.project_id = v.into();
872 self
873 }
874
875 /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
876 ///
877 /// This is a **required** field for requests.
878 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
879 self.0.request.job_id = v.into();
880 self
881 }
882
883 /// Sets the value of [location][crate::model::CancelJobRequest::location].
884 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
885 self.0.request.location = v.into();
886 self
887 }
888 }
889
890 #[doc(hidden)]
891 impl crate::RequestBuilder for CancelJob {
892 fn request_options(&mut self) -> &mut crate::RequestOptions {
893 &mut self.0.options
894 }
895 }
896
897 /// The request builder for [JobService::get_job][crate::client::JobService::get_job] calls.
898 ///
899 /// # Example
900 /// ```
901 /// # use google_cloud_bigquery_v2::builder::job_service::GetJob;
902 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
903 ///
904 /// let builder = prepare_request_builder();
905 /// let response = builder.send().await?;
906 /// # Ok(()) }
907 ///
908 /// fn prepare_request_builder() -> GetJob {
909 /// # panic!();
910 /// // ... details omitted ...
911 /// }
912 /// ```
913 #[derive(Clone, Debug)]
914 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
915
916 impl GetJob {
917 pub(crate) fn new(
918 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
919 ) -> Self {
920 Self(RequestBuilder::new(stub))
921 }
922
923 /// Sets the full request, replacing any prior values.
924 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
925 self.0.request = v.into();
926 self
927 }
928
929 /// Sets all the options, replacing any prior values.
930 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
931 self.0.options = v.into();
932 self
933 }
934
935 /// Sends the request.
936 pub async fn send(self) -> Result<crate::model::Job> {
937 (*self.0.stub)
938 .get_job(self.0.request, self.0.options)
939 .await
940 .map(crate::Response::into_body)
941 }
942
943 /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
944 ///
945 /// This is a **required** field for requests.
946 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
947 self.0.request.project_id = v.into();
948 self
949 }
950
951 /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
952 ///
953 /// This is a **required** field for requests.
954 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
955 self.0.request.job_id = v.into();
956 self
957 }
958
959 /// Sets the value of [location][crate::model::GetJobRequest::location].
960 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
961 self.0.request.location = v.into();
962 self
963 }
964 }
965
966 #[doc(hidden)]
967 impl crate::RequestBuilder for GetJob {
968 fn request_options(&mut self) -> &mut crate::RequestOptions {
969 &mut self.0.options
970 }
971 }
972
973 /// The request builder for [JobService::insert_job][crate::client::JobService::insert_job] calls.
974 ///
975 /// # Example
976 /// ```
977 /// # use google_cloud_bigquery_v2::builder::job_service::InsertJob;
978 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
979 ///
980 /// let builder = prepare_request_builder();
981 /// let response = builder.send().await?;
982 /// # Ok(()) }
983 ///
984 /// fn prepare_request_builder() -> InsertJob {
985 /// # panic!();
986 /// // ... details omitted ...
987 /// }
988 /// ```
989 #[derive(Clone, Debug)]
990 pub struct InsertJob(pub(crate) RequestBuilder<crate::model::InsertJobRequest>);
991
992 impl InsertJob {
993 pub(crate) fn new(
994 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
995 ) -> Self {
996 Self(RequestBuilder::new(stub))
997 }
998
999 /// Sets the full request, replacing any prior values.
1000 pub fn with_request<V: Into<crate::model::InsertJobRequest>>(mut self, v: V) -> Self {
1001 self.0.request = v.into();
1002 self
1003 }
1004
1005 /// Sets all the options, replacing any prior values.
1006 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1007 self.0.options = v.into();
1008 self
1009 }
1010
1011 /// Sends the request.
1012 pub async fn send(self) -> Result<crate::model::Job> {
1013 (*self.0.stub)
1014 .insert_job(self.0.request, self.0.options)
1015 .await
1016 .map(crate::Response::into_body)
1017 }
1018
1019 /// Sets the value of [project_id][crate::model::InsertJobRequest::project_id].
1020 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1021 self.0.request.project_id = v.into();
1022 self
1023 }
1024
1025 /// Sets the value of [job][crate::model::InsertJobRequest::job].
1026 pub fn set_job<T>(mut self, v: T) -> Self
1027 where
1028 T: std::convert::Into<crate::model::Job>,
1029 {
1030 self.0.request.job = std::option::Option::Some(v.into());
1031 self
1032 }
1033
1034 /// Sets or clears the value of [job][crate::model::InsertJobRequest::job].
1035 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
1036 where
1037 T: std::convert::Into<crate::model::Job>,
1038 {
1039 self.0.request.job = v.map(|x| x.into());
1040 self
1041 }
1042 }
1043
1044 #[doc(hidden)]
1045 impl crate::RequestBuilder for InsertJob {
1046 fn request_options(&mut self) -> &mut crate::RequestOptions {
1047 &mut self.0.options
1048 }
1049 }
1050
1051 /// The request builder for [JobService::delete_job][crate::client::JobService::delete_job] calls.
1052 ///
1053 /// # Example
1054 /// ```
1055 /// # use google_cloud_bigquery_v2::builder::job_service::DeleteJob;
1056 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1057 ///
1058 /// let builder = prepare_request_builder();
1059 /// let response = builder.send().await?;
1060 /// # Ok(()) }
1061 ///
1062 /// fn prepare_request_builder() -> DeleteJob {
1063 /// # panic!();
1064 /// // ... details omitted ...
1065 /// }
1066 /// ```
1067 #[derive(Clone, Debug)]
1068 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
1069
1070 impl DeleteJob {
1071 pub(crate) fn new(
1072 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
1073 ) -> Self {
1074 Self(RequestBuilder::new(stub))
1075 }
1076
1077 /// Sets the full request, replacing any prior values.
1078 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
1079 self.0.request = v.into();
1080 self
1081 }
1082
1083 /// Sets all the options, replacing any prior values.
1084 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1085 self.0.options = v.into();
1086 self
1087 }
1088
1089 /// Sends the request.
1090 pub async fn send(self) -> Result<()> {
1091 (*self.0.stub)
1092 .delete_job(self.0.request, self.0.options)
1093 .await
1094 .map(crate::Response::into_body)
1095 }
1096
1097 /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
1098 ///
1099 /// This is a **required** field for requests.
1100 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1101 self.0.request.project_id = v.into();
1102 self
1103 }
1104
1105 /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
1106 ///
1107 /// This is a **required** field for requests.
1108 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109 self.0.request.job_id = v.into();
1110 self
1111 }
1112
1113 /// Sets the value of [location][crate::model::DeleteJobRequest::location].
1114 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
1115 self.0.request.location = v.into();
1116 self
1117 }
1118 }
1119
1120 #[doc(hidden)]
1121 impl crate::RequestBuilder for DeleteJob {
1122 fn request_options(&mut self) -> &mut crate::RequestOptions {
1123 &mut self.0.options
1124 }
1125 }
1126
1127 /// The request builder for [JobService::list_jobs][crate::client::JobService::list_jobs] calls.
1128 ///
1129 /// # Example
1130 /// ```
1131 /// # use google_cloud_bigquery_v2::builder::job_service::ListJobs;
1132 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1133 /// use google_cloud_gax::paginator::ItemPaginator;
1134 ///
1135 /// let builder = prepare_request_builder();
1136 /// let mut items = builder.by_item();
1137 /// while let Some(result) = items.next().await {
1138 /// let item = result?;
1139 /// }
1140 /// # Ok(()) }
1141 ///
1142 /// fn prepare_request_builder() -> ListJobs {
1143 /// # panic!();
1144 /// // ... details omitted ...
1145 /// }
1146 /// ```
1147 #[derive(Clone, Debug)]
1148 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
1149
1150 impl ListJobs {
1151 pub(crate) fn new(
1152 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
1153 ) -> Self {
1154 Self(RequestBuilder::new(stub))
1155 }
1156
1157 /// Sets the full request, replacing any prior values.
1158 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
1159 self.0.request = v.into();
1160 self
1161 }
1162
1163 /// Sets all the options, replacing any prior values.
1164 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1165 self.0.options = v.into();
1166 self
1167 }
1168
1169 /// Sends the request.
1170 pub async fn send(self) -> Result<crate::model::JobList> {
1171 (*self.0.stub)
1172 .list_jobs(self.0.request, self.0.options)
1173 .await
1174 .map(crate::Response::into_body)
1175 }
1176
1177 /// Streams each page in the collection.
1178 pub fn by_page(
1179 self,
1180 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::JobList, crate::Error>
1181 {
1182 use std::clone::Clone;
1183 let token = self.0.request.page_token.clone();
1184 let execute = move |token: String| {
1185 let mut builder = self.clone();
1186 builder.0.request = builder.0.request.set_page_token(token);
1187 builder.send()
1188 };
1189 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1190 }
1191
1192 /// Streams each item in the collection.
1193 pub fn by_item(
1194 self,
1195 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::JobList, crate::Error>
1196 {
1197 use google_cloud_gax::paginator::Paginator;
1198 self.by_page().items()
1199 }
1200
1201 /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
1202 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1203 self.0.request.project_id = v.into();
1204 self
1205 }
1206
1207 /// Sets the value of [all_users][crate::model::ListJobsRequest::all_users].
1208 pub fn set_all_users<T: Into<bool>>(mut self, v: T) -> Self {
1209 self.0.request.all_users = v.into();
1210 self
1211 }
1212
1213 /// Sets the value of [max_results][crate::model::ListJobsRequest::max_results].
1214 pub fn set_max_results<T>(mut self, v: T) -> Self
1215 where
1216 T: std::convert::Into<wkt::Int32Value>,
1217 {
1218 self.0.request.max_results = std::option::Option::Some(v.into());
1219 self
1220 }
1221
1222 /// Sets or clears the value of [max_results][crate::model::ListJobsRequest::max_results].
1223 pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
1224 where
1225 T: std::convert::Into<wkt::Int32Value>,
1226 {
1227 self.0.request.max_results = v.map(|x| x.into());
1228 self
1229 }
1230
1231 /// Sets the value of [min_creation_time][crate::model::ListJobsRequest::min_creation_time].
1232 pub fn set_min_creation_time<T: Into<u64>>(mut self, v: T) -> Self {
1233 self.0.request.min_creation_time = v.into();
1234 self
1235 }
1236
1237 /// Sets the value of [max_creation_time][crate::model::ListJobsRequest::max_creation_time].
1238 pub fn set_max_creation_time<T>(mut self, v: T) -> Self
1239 where
1240 T: std::convert::Into<wkt::UInt64Value>,
1241 {
1242 self.0.request.max_creation_time = std::option::Option::Some(v.into());
1243 self
1244 }
1245
1246 /// Sets or clears the value of [max_creation_time][crate::model::ListJobsRequest::max_creation_time].
1247 pub fn set_or_clear_max_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
1248 where
1249 T: std::convert::Into<wkt::UInt64Value>,
1250 {
1251 self.0.request.max_creation_time = v.map(|x| x.into());
1252 self
1253 }
1254
1255 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
1256 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1257 self.0.request.page_token = v.into();
1258 self
1259 }
1260
1261 /// Sets the value of [projection][crate::model::ListJobsRequest::projection].
1262 pub fn set_projection<T: Into<crate::model::list_jobs_request::Projection>>(
1263 mut self,
1264 v: T,
1265 ) -> Self {
1266 self.0.request.projection = v.into();
1267 self
1268 }
1269
1270 /// Sets the value of [state_filter][crate::model::ListJobsRequest::state_filter].
1271 pub fn set_state_filter<T, V>(mut self, v: T) -> Self
1272 where
1273 T: std::iter::IntoIterator<Item = V>,
1274 V: std::convert::Into<crate::model::list_jobs_request::StateFilter>,
1275 {
1276 use std::iter::Iterator;
1277 self.0.request.state_filter = v.into_iter().map(|i| i.into()).collect();
1278 self
1279 }
1280
1281 /// Sets the value of [parent_job_id][crate::model::ListJobsRequest::parent_job_id].
1282 pub fn set_parent_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1283 self.0.request.parent_job_id = v.into();
1284 self
1285 }
1286 }
1287
1288 #[doc(hidden)]
1289 impl crate::RequestBuilder for ListJobs {
1290 fn request_options(&mut self) -> &mut crate::RequestOptions {
1291 &mut self.0.options
1292 }
1293 }
1294
1295 /// The request builder for [JobService::get_query_results][crate::client::JobService::get_query_results] calls.
1296 ///
1297 /// # Example
1298 /// ```
1299 /// # use google_cloud_bigquery_v2::builder::job_service::GetQueryResults;
1300 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1301 ///
1302 /// let builder = prepare_request_builder();
1303 /// let response = builder.send().await?;
1304 /// # Ok(()) }
1305 ///
1306 /// fn prepare_request_builder() -> GetQueryResults {
1307 /// # panic!();
1308 /// // ... details omitted ...
1309 /// }
1310 /// ```
1311 #[derive(Clone, Debug)]
1312 pub struct GetQueryResults(RequestBuilder<crate::model::GetQueryResultsRequest>);
1313
1314 impl GetQueryResults {
1315 pub(crate) fn new(
1316 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
1317 ) -> Self {
1318 Self(RequestBuilder::new(stub))
1319 }
1320
1321 /// Sets the full request, replacing any prior values.
1322 pub fn with_request<V: Into<crate::model::GetQueryResultsRequest>>(mut self, v: V) -> Self {
1323 self.0.request = v.into();
1324 self
1325 }
1326
1327 /// Sets all the options, replacing any prior values.
1328 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1329 self.0.options = v.into();
1330 self
1331 }
1332
1333 /// Sends the request.
1334 pub async fn send(self) -> Result<crate::model::GetQueryResultsResponse> {
1335 (*self.0.stub)
1336 .get_query_results(self.0.request, self.0.options)
1337 .await
1338 .map(crate::Response::into_body)
1339 }
1340
1341 /// Sets the value of [project_id][crate::model::GetQueryResultsRequest::project_id].
1342 ///
1343 /// This is a **required** field for requests.
1344 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1345 self.0.request.project_id = v.into();
1346 self
1347 }
1348
1349 /// Sets the value of [job_id][crate::model::GetQueryResultsRequest::job_id].
1350 ///
1351 /// This is a **required** field for requests.
1352 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1353 self.0.request.job_id = v.into();
1354 self
1355 }
1356
1357 /// Sets the value of [start_index][crate::model::GetQueryResultsRequest::start_index].
1358 pub fn set_start_index<T>(mut self, v: T) -> Self
1359 where
1360 T: std::convert::Into<wkt::UInt64Value>,
1361 {
1362 self.0.request.start_index = std::option::Option::Some(v.into());
1363 self
1364 }
1365
1366 /// Sets or clears the value of [start_index][crate::model::GetQueryResultsRequest::start_index].
1367 pub fn set_or_clear_start_index<T>(mut self, v: std::option::Option<T>) -> Self
1368 where
1369 T: std::convert::Into<wkt::UInt64Value>,
1370 {
1371 self.0.request.start_index = v.map(|x| x.into());
1372 self
1373 }
1374
1375 /// Sets the value of [page_token][crate::model::GetQueryResultsRequest::page_token].
1376 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1377 self.0.request.page_token = v.into();
1378 self
1379 }
1380
1381 /// Sets the value of [max_results][crate::model::GetQueryResultsRequest::max_results].
1382 pub fn set_max_results<T>(mut self, v: T) -> Self
1383 where
1384 T: std::convert::Into<wkt::UInt32Value>,
1385 {
1386 self.0.request.max_results = std::option::Option::Some(v.into());
1387 self
1388 }
1389
1390 /// Sets or clears the value of [max_results][crate::model::GetQueryResultsRequest::max_results].
1391 pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
1392 where
1393 T: std::convert::Into<wkt::UInt32Value>,
1394 {
1395 self.0.request.max_results = v.map(|x| x.into());
1396 self
1397 }
1398
1399 /// Sets the value of [timeout_ms][crate::model::GetQueryResultsRequest::timeout_ms].
1400 pub fn set_timeout_ms<T>(mut self, v: T) -> Self
1401 where
1402 T: std::convert::Into<wkt::UInt32Value>,
1403 {
1404 self.0.request.timeout_ms = std::option::Option::Some(v.into());
1405 self
1406 }
1407
1408 /// Sets or clears the value of [timeout_ms][crate::model::GetQueryResultsRequest::timeout_ms].
1409 pub fn set_or_clear_timeout_ms<T>(mut self, v: std::option::Option<T>) -> Self
1410 where
1411 T: std::convert::Into<wkt::UInt32Value>,
1412 {
1413 self.0.request.timeout_ms = v.map(|x| x.into());
1414 self
1415 }
1416
1417 /// Sets the value of [location][crate::model::GetQueryResultsRequest::location].
1418 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419 self.0.request.location = v.into();
1420 self
1421 }
1422
1423 /// Sets the value of [format_options][crate::model::GetQueryResultsRequest::format_options].
1424 pub fn set_format_options<T>(mut self, v: T) -> Self
1425 where
1426 T: std::convert::Into<crate::model::DataFormatOptions>,
1427 {
1428 self.0.request.format_options = std::option::Option::Some(v.into());
1429 self
1430 }
1431
1432 /// Sets or clears the value of [format_options][crate::model::GetQueryResultsRequest::format_options].
1433 pub fn set_or_clear_format_options<T>(mut self, v: std::option::Option<T>) -> Self
1434 where
1435 T: std::convert::Into<crate::model::DataFormatOptions>,
1436 {
1437 self.0.request.format_options = v.map(|x| x.into());
1438 self
1439 }
1440 }
1441
1442 #[doc(hidden)]
1443 impl crate::RequestBuilder for GetQueryResults {
1444 fn request_options(&mut self) -> &mut crate::RequestOptions {
1445 &mut self.0.options
1446 }
1447 }
1448
1449 /// The request builder for [JobService::query][crate::client::JobService::query] calls.
1450 ///
1451 /// # Example
1452 /// ```
1453 /// # use google_cloud_bigquery_v2::builder::job_service::Query;
1454 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1455 ///
1456 /// let builder = prepare_request_builder();
1457 /// let response = builder.send().await?;
1458 /// # Ok(()) }
1459 ///
1460 /// fn prepare_request_builder() -> Query {
1461 /// # panic!();
1462 /// // ... details omitted ...
1463 /// }
1464 /// ```
1465 #[derive(Clone, Debug)]
1466 pub struct Query(RequestBuilder<crate::model::PostQueryRequest>);
1467
1468 impl Query {
1469 pub(crate) fn new(
1470 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
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::PostQueryRequest>>(mut self, v: V) -> Self {
1477 self.0.request = v.into();
1478 self
1479 }
1480
1481 /// Sets all the options, replacing any prior values.
1482 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1483 self.0.options = v.into();
1484 self
1485 }
1486
1487 /// Sends the request.
1488 pub async fn send(self) -> Result<crate::model::QueryResponse> {
1489 (*self.0.stub)
1490 .query(self.0.request, self.0.options)
1491 .await
1492 .map(crate::Response::into_body)
1493 }
1494
1495 /// Sets the value of [project_id][crate::model::PostQueryRequest::project_id].
1496 ///
1497 /// This is a **required** field for requests.
1498 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1499 self.0.request.project_id = v.into();
1500 self
1501 }
1502
1503 /// Sets the value of [query_request][crate::model::PostQueryRequest::query_request].
1504 pub fn set_query_request<T>(mut self, v: T) -> Self
1505 where
1506 T: std::convert::Into<crate::model::QueryRequest>,
1507 {
1508 self.0.request.query_request = std::option::Option::Some(v.into());
1509 self
1510 }
1511
1512 /// Sets or clears the value of [query_request][crate::model::PostQueryRequest::query_request].
1513 pub fn set_or_clear_query_request<T>(mut self, v: std::option::Option<T>) -> Self
1514 where
1515 T: std::convert::Into<crate::model::QueryRequest>,
1516 {
1517 self.0.request.query_request = v.map(|x| x.into());
1518 self
1519 }
1520 }
1521
1522 #[doc(hidden)]
1523 impl crate::RequestBuilder for Query {
1524 fn request_options(&mut self) -> &mut crate::RequestOptions {
1525 &mut self.0.options
1526 }
1527 }
1528}
1529
1530/// Request and client builders for [ModelService][crate::client::ModelService].
1531pub mod model_service {
1532 use crate::Result;
1533
1534 /// A builder for [ModelService][crate::client::ModelService].
1535 ///
1536 /// ```
1537 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1538 /// # use google_cloud_bigquery_v2::*;
1539 /// # use builder::model_service::ClientBuilder;
1540 /// # use client::ModelService;
1541 /// let builder : ClientBuilder = ModelService::builder();
1542 /// let client = builder
1543 /// .with_endpoint("https://bigquery.googleapis.com")
1544 /// .build().await?;
1545 /// # Ok(()) }
1546 /// ```
1547 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1548
1549 pub(crate) mod client {
1550 use super::super::super::client::ModelService;
1551 pub struct Factory;
1552 impl crate::ClientFactory for Factory {
1553 type Client = ModelService;
1554 type Credentials = gaxi::options::Credentials;
1555 async fn build(
1556 self,
1557 config: gaxi::options::ClientConfig,
1558 ) -> crate::ClientBuilderResult<Self::Client> {
1559 Self::Client::new(config).await
1560 }
1561 }
1562 }
1563
1564 /// Common implementation for [crate::client::ModelService] request builders.
1565 #[derive(Clone, Debug)]
1566 pub(crate) struct RequestBuilder<R: std::default::Default> {
1567 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1568 request: R,
1569 options: crate::RequestOptions,
1570 }
1571
1572 impl<R> RequestBuilder<R>
1573 where
1574 R: std::default::Default,
1575 {
1576 pub(crate) fn new(
1577 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1578 ) -> Self {
1579 Self {
1580 stub,
1581 request: R::default(),
1582 options: crate::RequestOptions::default(),
1583 }
1584 }
1585 }
1586
1587 /// The request builder for [ModelService::get_model][crate::client::ModelService::get_model] calls.
1588 ///
1589 /// # Example
1590 /// ```
1591 /// # use google_cloud_bigquery_v2::builder::model_service::GetModel;
1592 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1593 ///
1594 /// let builder = prepare_request_builder();
1595 /// let response = builder.send().await?;
1596 /// # Ok(()) }
1597 ///
1598 /// fn prepare_request_builder() -> GetModel {
1599 /// # panic!();
1600 /// // ... details omitted ...
1601 /// }
1602 /// ```
1603 #[derive(Clone, Debug)]
1604 pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
1605
1606 impl GetModel {
1607 pub(crate) fn new(
1608 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1609 ) -> Self {
1610 Self(RequestBuilder::new(stub))
1611 }
1612
1613 /// Sets the full request, replacing any prior values.
1614 pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
1615 self.0.request = v.into();
1616 self
1617 }
1618
1619 /// Sets all the options, replacing any prior values.
1620 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1621 self.0.options = v.into();
1622 self
1623 }
1624
1625 /// Sends the request.
1626 pub async fn send(self) -> Result<crate::model::Model> {
1627 (*self.0.stub)
1628 .get_model(self.0.request, self.0.options)
1629 .await
1630 .map(crate::Response::into_body)
1631 }
1632
1633 /// Sets the value of [project_id][crate::model::GetModelRequest::project_id].
1634 ///
1635 /// This is a **required** field for requests.
1636 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1637 self.0.request.project_id = v.into();
1638 self
1639 }
1640
1641 /// Sets the value of [dataset_id][crate::model::GetModelRequest::dataset_id].
1642 ///
1643 /// This is a **required** field for requests.
1644 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1645 self.0.request.dataset_id = v.into();
1646 self
1647 }
1648
1649 /// Sets the value of [model_id][crate::model::GetModelRequest::model_id].
1650 ///
1651 /// This is a **required** field for requests.
1652 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1653 self.0.request.model_id = v.into();
1654 self
1655 }
1656 }
1657
1658 #[doc(hidden)]
1659 impl crate::RequestBuilder for GetModel {
1660 fn request_options(&mut self) -> &mut crate::RequestOptions {
1661 &mut self.0.options
1662 }
1663 }
1664
1665 /// The request builder for [ModelService::list_models][crate::client::ModelService::list_models] calls.
1666 ///
1667 /// # Example
1668 /// ```
1669 /// # use google_cloud_bigquery_v2::builder::model_service::ListModels;
1670 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1671 /// use google_cloud_gax::paginator::ItemPaginator;
1672 ///
1673 /// let builder = prepare_request_builder();
1674 /// let mut items = builder.by_item();
1675 /// while let Some(result) = items.next().await {
1676 /// let item = result?;
1677 /// }
1678 /// # Ok(()) }
1679 ///
1680 /// fn prepare_request_builder() -> ListModels {
1681 /// # panic!();
1682 /// // ... details omitted ...
1683 /// }
1684 /// ```
1685 #[derive(Clone, Debug)]
1686 pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
1687
1688 impl ListModels {
1689 pub(crate) fn new(
1690 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1691 ) -> Self {
1692 Self(RequestBuilder::new(stub))
1693 }
1694
1695 /// Sets the full request, replacing any prior values.
1696 pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
1697 self.0.request = v.into();
1698 self
1699 }
1700
1701 /// Sets all the options, replacing any prior values.
1702 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1703 self.0.options = v.into();
1704 self
1705 }
1706
1707 /// Sends the request.
1708 pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
1709 (*self.0.stub)
1710 .list_models(self.0.request, self.0.options)
1711 .await
1712 .map(crate::Response::into_body)
1713 }
1714
1715 /// Streams each page in the collection.
1716 pub fn by_page(
1717 self,
1718 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListModelsResponse, crate::Error>
1719 {
1720 use std::clone::Clone;
1721 let token = self.0.request.page_token.clone();
1722 let execute = move |token: String| {
1723 let mut builder = self.clone();
1724 builder.0.request = builder.0.request.set_page_token(token);
1725 builder.send()
1726 };
1727 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1728 }
1729
1730 /// Streams each item in the collection.
1731 pub fn by_item(
1732 self,
1733 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1734 crate::model::ListModelsResponse,
1735 crate::Error,
1736 > {
1737 use google_cloud_gax::paginator::Paginator;
1738 self.by_page().items()
1739 }
1740
1741 /// Sets the value of [project_id][crate::model::ListModelsRequest::project_id].
1742 ///
1743 /// This is a **required** field for requests.
1744 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1745 self.0.request.project_id = v.into();
1746 self
1747 }
1748
1749 /// Sets the value of [dataset_id][crate::model::ListModelsRequest::dataset_id].
1750 ///
1751 /// This is a **required** field for requests.
1752 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1753 self.0.request.dataset_id = v.into();
1754 self
1755 }
1756
1757 /// Sets the value of [max_results][crate::model::ListModelsRequest::max_results].
1758 pub fn set_max_results<T>(mut self, v: T) -> Self
1759 where
1760 T: std::convert::Into<wkt::UInt32Value>,
1761 {
1762 self.0.request.max_results = std::option::Option::Some(v.into());
1763 self
1764 }
1765
1766 /// Sets or clears the value of [max_results][crate::model::ListModelsRequest::max_results].
1767 pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
1768 where
1769 T: std::convert::Into<wkt::UInt32Value>,
1770 {
1771 self.0.request.max_results = v.map(|x| x.into());
1772 self
1773 }
1774
1775 /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
1776 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1777 self.0.request.page_token = v.into();
1778 self
1779 }
1780 }
1781
1782 #[doc(hidden)]
1783 impl crate::RequestBuilder for ListModels {
1784 fn request_options(&mut self) -> &mut crate::RequestOptions {
1785 &mut self.0.options
1786 }
1787 }
1788
1789 /// The request builder for [ModelService::patch_model][crate::client::ModelService::patch_model] calls.
1790 ///
1791 /// # Example
1792 /// ```
1793 /// # use google_cloud_bigquery_v2::builder::model_service::PatchModel;
1794 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1795 ///
1796 /// let builder = prepare_request_builder();
1797 /// let response = builder.send().await?;
1798 /// # Ok(()) }
1799 ///
1800 /// fn prepare_request_builder() -> PatchModel {
1801 /// # panic!();
1802 /// // ... details omitted ...
1803 /// }
1804 /// ```
1805 #[derive(Clone, Debug)]
1806 pub struct PatchModel(RequestBuilder<crate::model::PatchModelRequest>);
1807
1808 impl PatchModel {
1809 pub(crate) fn new(
1810 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1811 ) -> Self {
1812 Self(RequestBuilder::new(stub))
1813 }
1814
1815 /// Sets the full request, replacing any prior values.
1816 pub fn with_request<V: Into<crate::model::PatchModelRequest>>(mut self, v: V) -> Self {
1817 self.0.request = v.into();
1818 self
1819 }
1820
1821 /// Sets all the options, replacing any prior values.
1822 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1823 self.0.options = v.into();
1824 self
1825 }
1826
1827 /// Sends the request.
1828 pub async fn send(self) -> Result<crate::model::Model> {
1829 (*self.0.stub)
1830 .patch_model(self.0.request, self.0.options)
1831 .await
1832 .map(crate::Response::into_body)
1833 }
1834
1835 /// Sets the value of [project_id][crate::model::PatchModelRequest::project_id].
1836 ///
1837 /// This is a **required** field for requests.
1838 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1839 self.0.request.project_id = v.into();
1840 self
1841 }
1842
1843 /// Sets the value of [dataset_id][crate::model::PatchModelRequest::dataset_id].
1844 ///
1845 /// This is a **required** field for requests.
1846 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1847 self.0.request.dataset_id = v.into();
1848 self
1849 }
1850
1851 /// Sets the value of [model_id][crate::model::PatchModelRequest::model_id].
1852 ///
1853 /// This is a **required** field for requests.
1854 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1855 self.0.request.model_id = v.into();
1856 self
1857 }
1858
1859 /// Sets the value of [model][crate::model::PatchModelRequest::model].
1860 ///
1861 /// This is a **required** field for requests.
1862 pub fn set_model<T>(mut self, v: T) -> Self
1863 where
1864 T: std::convert::Into<crate::model::Model>,
1865 {
1866 self.0.request.model = std::option::Option::Some(v.into());
1867 self
1868 }
1869
1870 /// Sets or clears the value of [model][crate::model::PatchModelRequest::model].
1871 ///
1872 /// This is a **required** field for requests.
1873 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
1874 where
1875 T: std::convert::Into<crate::model::Model>,
1876 {
1877 self.0.request.model = v.map(|x| x.into());
1878 self
1879 }
1880 }
1881
1882 #[doc(hidden)]
1883 impl crate::RequestBuilder for PatchModel {
1884 fn request_options(&mut self) -> &mut crate::RequestOptions {
1885 &mut self.0.options
1886 }
1887 }
1888
1889 /// The request builder for [ModelService::delete_model][crate::client::ModelService::delete_model] calls.
1890 ///
1891 /// # Example
1892 /// ```
1893 /// # use google_cloud_bigquery_v2::builder::model_service::DeleteModel;
1894 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1895 ///
1896 /// let builder = prepare_request_builder();
1897 /// let response = builder.send().await?;
1898 /// # Ok(()) }
1899 ///
1900 /// fn prepare_request_builder() -> DeleteModel {
1901 /// # panic!();
1902 /// // ... details omitted ...
1903 /// }
1904 /// ```
1905 #[derive(Clone, Debug)]
1906 pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
1907
1908 impl DeleteModel {
1909 pub(crate) fn new(
1910 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1911 ) -> Self {
1912 Self(RequestBuilder::new(stub))
1913 }
1914
1915 /// Sets the full request, replacing any prior values.
1916 pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
1917 self.0.request = v.into();
1918 self
1919 }
1920
1921 /// Sets all the options, replacing any prior values.
1922 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1923 self.0.options = v.into();
1924 self
1925 }
1926
1927 /// Sends the request.
1928 pub async fn send(self) -> Result<()> {
1929 (*self.0.stub)
1930 .delete_model(self.0.request, self.0.options)
1931 .await
1932 .map(crate::Response::into_body)
1933 }
1934
1935 /// Sets the value of [project_id][crate::model::DeleteModelRequest::project_id].
1936 ///
1937 /// This is a **required** field for requests.
1938 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1939 self.0.request.project_id = v.into();
1940 self
1941 }
1942
1943 /// Sets the value of [dataset_id][crate::model::DeleteModelRequest::dataset_id].
1944 ///
1945 /// This is a **required** field for requests.
1946 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1947 self.0.request.dataset_id = v.into();
1948 self
1949 }
1950
1951 /// Sets the value of [model_id][crate::model::DeleteModelRequest::model_id].
1952 ///
1953 /// This is a **required** field for requests.
1954 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1955 self.0.request.model_id = v.into();
1956 self
1957 }
1958 }
1959
1960 #[doc(hidden)]
1961 impl crate::RequestBuilder for DeleteModel {
1962 fn request_options(&mut self) -> &mut crate::RequestOptions {
1963 &mut self.0.options
1964 }
1965 }
1966}
1967
1968/// Request and client builders for [ProjectService][crate::client::ProjectService].
1969pub mod project_service {
1970 use crate::Result;
1971
1972 /// A builder for [ProjectService][crate::client::ProjectService].
1973 ///
1974 /// ```
1975 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1976 /// # use google_cloud_bigquery_v2::*;
1977 /// # use builder::project_service::ClientBuilder;
1978 /// # use client::ProjectService;
1979 /// let builder : ClientBuilder = ProjectService::builder();
1980 /// let client = builder
1981 /// .with_endpoint("https://bigquery.googleapis.com")
1982 /// .build().await?;
1983 /// # Ok(()) }
1984 /// ```
1985 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1986
1987 pub(crate) mod client {
1988 use super::super::super::client::ProjectService;
1989 pub struct Factory;
1990 impl crate::ClientFactory for Factory {
1991 type Client = ProjectService;
1992 type Credentials = gaxi::options::Credentials;
1993 async fn build(
1994 self,
1995 config: gaxi::options::ClientConfig,
1996 ) -> crate::ClientBuilderResult<Self::Client> {
1997 Self::Client::new(config).await
1998 }
1999 }
2000 }
2001
2002 /// Common implementation for [crate::client::ProjectService] request builders.
2003 #[derive(Clone, Debug)]
2004 pub(crate) struct RequestBuilder<R: std::default::Default> {
2005 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
2006 request: R,
2007 options: crate::RequestOptions,
2008 }
2009
2010 impl<R> RequestBuilder<R>
2011 where
2012 R: std::default::Default,
2013 {
2014 pub(crate) fn new(
2015 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
2016 ) -> Self {
2017 Self {
2018 stub,
2019 request: R::default(),
2020 options: crate::RequestOptions::default(),
2021 }
2022 }
2023 }
2024
2025 /// The request builder for [ProjectService::get_service_account][crate::client::ProjectService::get_service_account] calls.
2026 ///
2027 /// # Example
2028 /// ```
2029 /// # use google_cloud_bigquery_v2::builder::project_service::GetServiceAccount;
2030 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2031 ///
2032 /// let builder = prepare_request_builder();
2033 /// let response = builder.send().await?;
2034 /// # Ok(()) }
2035 ///
2036 /// fn prepare_request_builder() -> GetServiceAccount {
2037 /// # panic!();
2038 /// // ... details omitted ...
2039 /// }
2040 /// ```
2041 #[derive(Clone, Debug)]
2042 pub struct GetServiceAccount(RequestBuilder<crate::model::GetServiceAccountRequest>);
2043
2044 impl GetServiceAccount {
2045 pub(crate) fn new(
2046 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
2047 ) -> Self {
2048 Self(RequestBuilder::new(stub))
2049 }
2050
2051 /// Sets the full request, replacing any prior values.
2052 pub fn with_request<V: Into<crate::model::GetServiceAccountRequest>>(
2053 mut self,
2054 v: V,
2055 ) -> Self {
2056 self.0.request = v.into();
2057 self
2058 }
2059
2060 /// Sets all the options, replacing any prior values.
2061 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2062 self.0.options = v.into();
2063 self
2064 }
2065
2066 /// Sends the request.
2067 pub async fn send(self) -> Result<crate::model::GetServiceAccountResponse> {
2068 (*self.0.stub)
2069 .get_service_account(self.0.request, self.0.options)
2070 .await
2071 .map(crate::Response::into_body)
2072 }
2073
2074 /// Sets the value of [project_id][crate::model::GetServiceAccountRequest::project_id].
2075 ///
2076 /// This is a **required** field for requests.
2077 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2078 self.0.request.project_id = v.into();
2079 self
2080 }
2081 }
2082
2083 #[doc(hidden)]
2084 impl crate::RequestBuilder for GetServiceAccount {
2085 fn request_options(&mut self) -> &mut crate::RequestOptions {
2086 &mut self.0.options
2087 }
2088 }
2089}
2090
2091/// Request and client builders for [RoutineService][crate::client::RoutineService].
2092pub mod routine_service {
2093 use crate::Result;
2094
2095 /// A builder for [RoutineService][crate::client::RoutineService].
2096 ///
2097 /// ```
2098 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2099 /// # use google_cloud_bigquery_v2::*;
2100 /// # use builder::routine_service::ClientBuilder;
2101 /// # use client::RoutineService;
2102 /// let builder : ClientBuilder = RoutineService::builder();
2103 /// let client = builder
2104 /// .with_endpoint("https://bigquery.googleapis.com")
2105 /// .build().await?;
2106 /// # Ok(()) }
2107 /// ```
2108 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2109
2110 pub(crate) mod client {
2111 use super::super::super::client::RoutineService;
2112 pub struct Factory;
2113 impl crate::ClientFactory for Factory {
2114 type Client = RoutineService;
2115 type Credentials = gaxi::options::Credentials;
2116 async fn build(
2117 self,
2118 config: gaxi::options::ClientConfig,
2119 ) -> crate::ClientBuilderResult<Self::Client> {
2120 Self::Client::new(config).await
2121 }
2122 }
2123 }
2124
2125 /// Common implementation for [crate::client::RoutineService] request builders.
2126 #[derive(Clone, Debug)]
2127 pub(crate) struct RequestBuilder<R: std::default::Default> {
2128 stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2129 request: R,
2130 options: crate::RequestOptions,
2131 }
2132
2133 impl<R> RequestBuilder<R>
2134 where
2135 R: std::default::Default,
2136 {
2137 pub(crate) fn new(
2138 stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2139 ) -> Self {
2140 Self {
2141 stub,
2142 request: R::default(),
2143 options: crate::RequestOptions::default(),
2144 }
2145 }
2146 }
2147
2148 /// The request builder for [RoutineService::get_routine][crate::client::RoutineService::get_routine] calls.
2149 ///
2150 /// # Example
2151 /// ```
2152 /// # use google_cloud_bigquery_v2::builder::routine_service::GetRoutine;
2153 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2154 ///
2155 /// let builder = prepare_request_builder();
2156 /// let response = builder.send().await?;
2157 /// # Ok(()) }
2158 ///
2159 /// fn prepare_request_builder() -> GetRoutine {
2160 /// # panic!();
2161 /// // ... details omitted ...
2162 /// }
2163 /// ```
2164 #[derive(Clone, Debug)]
2165 pub struct GetRoutine(RequestBuilder<crate::model::GetRoutineRequest>);
2166
2167 impl GetRoutine {
2168 pub(crate) fn new(
2169 stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2170 ) -> Self {
2171 Self(RequestBuilder::new(stub))
2172 }
2173
2174 /// Sets the full request, replacing any prior values.
2175 pub fn with_request<V: Into<crate::model::GetRoutineRequest>>(mut self, v: V) -> Self {
2176 self.0.request = v.into();
2177 self
2178 }
2179
2180 /// Sets all the options, replacing any prior values.
2181 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2182 self.0.options = v.into();
2183 self
2184 }
2185
2186 /// Sends the request.
2187 pub async fn send(self) -> Result<crate::model::Routine> {
2188 (*self.0.stub)
2189 .get_routine(self.0.request, self.0.options)
2190 .await
2191 .map(crate::Response::into_body)
2192 }
2193
2194 /// Sets the value of [project_id][crate::model::GetRoutineRequest::project_id].
2195 ///
2196 /// This is a **required** field for requests.
2197 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2198 self.0.request.project_id = v.into();
2199 self
2200 }
2201
2202 /// Sets the value of [dataset_id][crate::model::GetRoutineRequest::dataset_id].
2203 ///
2204 /// This is a **required** field for requests.
2205 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2206 self.0.request.dataset_id = v.into();
2207 self
2208 }
2209
2210 /// Sets the value of [routine_id][crate::model::GetRoutineRequest::routine_id].
2211 ///
2212 /// This is a **required** field for requests.
2213 pub fn set_routine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2214 self.0.request.routine_id = v.into();
2215 self
2216 }
2217 }
2218
2219 #[doc(hidden)]
2220 impl crate::RequestBuilder for GetRoutine {
2221 fn request_options(&mut self) -> &mut crate::RequestOptions {
2222 &mut self.0.options
2223 }
2224 }
2225
2226 /// The request builder for [RoutineService::insert_routine][crate::client::RoutineService::insert_routine] calls.
2227 ///
2228 /// # Example
2229 /// ```
2230 /// # use google_cloud_bigquery_v2::builder::routine_service::InsertRoutine;
2231 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2232 ///
2233 /// let builder = prepare_request_builder();
2234 /// let response = builder.send().await?;
2235 /// # Ok(()) }
2236 ///
2237 /// fn prepare_request_builder() -> InsertRoutine {
2238 /// # panic!();
2239 /// // ... details omitted ...
2240 /// }
2241 /// ```
2242 #[derive(Clone, Debug)]
2243 pub struct InsertRoutine(RequestBuilder<crate::model::InsertRoutineRequest>);
2244
2245 impl InsertRoutine {
2246 pub(crate) fn new(
2247 stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2248 ) -> Self {
2249 Self(RequestBuilder::new(stub))
2250 }
2251
2252 /// Sets the full request, replacing any prior values.
2253 pub fn with_request<V: Into<crate::model::InsertRoutineRequest>>(mut self, v: V) -> Self {
2254 self.0.request = v.into();
2255 self
2256 }
2257
2258 /// Sets all the options, replacing any prior values.
2259 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2260 self.0.options = v.into();
2261 self
2262 }
2263
2264 /// Sends the request.
2265 pub async fn send(self) -> Result<crate::model::Routine> {
2266 (*self.0.stub)
2267 .insert_routine(self.0.request, self.0.options)
2268 .await
2269 .map(crate::Response::into_body)
2270 }
2271
2272 /// Sets the value of [project_id][crate::model::InsertRoutineRequest::project_id].
2273 ///
2274 /// This is a **required** field for requests.
2275 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2276 self.0.request.project_id = v.into();
2277 self
2278 }
2279
2280 /// Sets the value of [dataset_id][crate::model::InsertRoutineRequest::dataset_id].
2281 ///
2282 /// This is a **required** field for requests.
2283 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2284 self.0.request.dataset_id = v.into();
2285 self
2286 }
2287
2288 /// Sets the value of [routine][crate::model::InsertRoutineRequest::routine].
2289 ///
2290 /// This is a **required** field for requests.
2291 pub fn set_routine<T>(mut self, v: T) -> Self
2292 where
2293 T: std::convert::Into<crate::model::Routine>,
2294 {
2295 self.0.request.routine = std::option::Option::Some(v.into());
2296 self
2297 }
2298
2299 /// Sets or clears the value of [routine][crate::model::InsertRoutineRequest::routine].
2300 ///
2301 /// This is a **required** field for requests.
2302 pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
2303 where
2304 T: std::convert::Into<crate::model::Routine>,
2305 {
2306 self.0.request.routine = v.map(|x| x.into());
2307 self
2308 }
2309 }
2310
2311 #[doc(hidden)]
2312 impl crate::RequestBuilder for InsertRoutine {
2313 fn request_options(&mut self) -> &mut crate::RequestOptions {
2314 &mut self.0.options
2315 }
2316 }
2317
2318 /// The request builder for [RoutineService::update_routine][crate::client::RoutineService::update_routine] calls.
2319 ///
2320 /// # Example
2321 /// ```
2322 /// # use google_cloud_bigquery_v2::builder::routine_service::UpdateRoutine;
2323 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2324 ///
2325 /// let builder = prepare_request_builder();
2326 /// let response = builder.send().await?;
2327 /// # Ok(()) }
2328 ///
2329 /// fn prepare_request_builder() -> UpdateRoutine {
2330 /// # panic!();
2331 /// // ... details omitted ...
2332 /// }
2333 /// ```
2334 #[derive(Clone, Debug)]
2335 pub struct UpdateRoutine(RequestBuilder<crate::model::UpdateRoutineRequest>);
2336
2337 impl UpdateRoutine {
2338 pub(crate) fn new(
2339 stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2340 ) -> Self {
2341 Self(RequestBuilder::new(stub))
2342 }
2343
2344 /// Sets the full request, replacing any prior values.
2345 pub fn with_request<V: Into<crate::model::UpdateRoutineRequest>>(mut self, v: V) -> Self {
2346 self.0.request = v.into();
2347 self
2348 }
2349
2350 /// Sets all the options, replacing any prior values.
2351 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2352 self.0.options = v.into();
2353 self
2354 }
2355
2356 /// Sends the request.
2357 pub async fn send(self) -> Result<crate::model::Routine> {
2358 (*self.0.stub)
2359 .update_routine(self.0.request, self.0.options)
2360 .await
2361 .map(crate::Response::into_body)
2362 }
2363
2364 /// Sets the value of [project_id][crate::model::UpdateRoutineRequest::project_id].
2365 ///
2366 /// This is a **required** field for requests.
2367 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2368 self.0.request.project_id = v.into();
2369 self
2370 }
2371
2372 /// Sets the value of [dataset_id][crate::model::UpdateRoutineRequest::dataset_id].
2373 ///
2374 /// This is a **required** field for requests.
2375 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2376 self.0.request.dataset_id = v.into();
2377 self
2378 }
2379
2380 /// Sets the value of [routine_id][crate::model::UpdateRoutineRequest::routine_id].
2381 ///
2382 /// This is a **required** field for requests.
2383 pub fn set_routine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2384 self.0.request.routine_id = v.into();
2385 self
2386 }
2387
2388 /// Sets the value of [routine][crate::model::UpdateRoutineRequest::routine].
2389 ///
2390 /// This is a **required** field for requests.
2391 pub fn set_routine<T>(mut self, v: T) -> Self
2392 where
2393 T: std::convert::Into<crate::model::Routine>,
2394 {
2395 self.0.request.routine = std::option::Option::Some(v.into());
2396 self
2397 }
2398
2399 /// Sets or clears the value of [routine][crate::model::UpdateRoutineRequest::routine].
2400 ///
2401 /// This is a **required** field for requests.
2402 pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
2403 where
2404 T: std::convert::Into<crate::model::Routine>,
2405 {
2406 self.0.request.routine = v.map(|x| x.into());
2407 self
2408 }
2409 }
2410
2411 #[doc(hidden)]
2412 impl crate::RequestBuilder for UpdateRoutine {
2413 fn request_options(&mut self) -> &mut crate::RequestOptions {
2414 &mut self.0.options
2415 }
2416 }
2417
2418 /// The request builder for [RoutineService::delete_routine][crate::client::RoutineService::delete_routine] calls.
2419 ///
2420 /// # Example
2421 /// ```
2422 /// # use google_cloud_bigquery_v2::builder::routine_service::DeleteRoutine;
2423 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2424 ///
2425 /// let builder = prepare_request_builder();
2426 /// let response = builder.send().await?;
2427 /// # Ok(()) }
2428 ///
2429 /// fn prepare_request_builder() -> DeleteRoutine {
2430 /// # panic!();
2431 /// // ... details omitted ...
2432 /// }
2433 /// ```
2434 #[derive(Clone, Debug)]
2435 pub struct DeleteRoutine(RequestBuilder<crate::model::DeleteRoutineRequest>);
2436
2437 impl DeleteRoutine {
2438 pub(crate) fn new(
2439 stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2440 ) -> Self {
2441 Self(RequestBuilder::new(stub))
2442 }
2443
2444 /// Sets the full request, replacing any prior values.
2445 pub fn with_request<V: Into<crate::model::DeleteRoutineRequest>>(mut self, v: V) -> Self {
2446 self.0.request = v.into();
2447 self
2448 }
2449
2450 /// Sets all the options, replacing any prior values.
2451 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2452 self.0.options = v.into();
2453 self
2454 }
2455
2456 /// Sends the request.
2457 pub async fn send(self) -> Result<()> {
2458 (*self.0.stub)
2459 .delete_routine(self.0.request, self.0.options)
2460 .await
2461 .map(crate::Response::into_body)
2462 }
2463
2464 /// Sets the value of [project_id][crate::model::DeleteRoutineRequest::project_id].
2465 ///
2466 /// This is a **required** field for requests.
2467 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2468 self.0.request.project_id = v.into();
2469 self
2470 }
2471
2472 /// Sets the value of [dataset_id][crate::model::DeleteRoutineRequest::dataset_id].
2473 ///
2474 /// This is a **required** field for requests.
2475 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2476 self.0.request.dataset_id = v.into();
2477 self
2478 }
2479
2480 /// Sets the value of [routine_id][crate::model::DeleteRoutineRequest::routine_id].
2481 ///
2482 /// This is a **required** field for requests.
2483 pub fn set_routine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2484 self.0.request.routine_id = v.into();
2485 self
2486 }
2487 }
2488
2489 #[doc(hidden)]
2490 impl crate::RequestBuilder for DeleteRoutine {
2491 fn request_options(&mut self) -> &mut crate::RequestOptions {
2492 &mut self.0.options
2493 }
2494 }
2495
2496 /// The request builder for [RoutineService::list_routines][crate::client::RoutineService::list_routines] calls.
2497 ///
2498 /// # Example
2499 /// ```
2500 /// # use google_cloud_bigquery_v2::builder::routine_service::ListRoutines;
2501 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2502 /// use google_cloud_gax::paginator::ItemPaginator;
2503 ///
2504 /// let builder = prepare_request_builder();
2505 /// let mut items = builder.by_item();
2506 /// while let Some(result) = items.next().await {
2507 /// let item = result?;
2508 /// }
2509 /// # Ok(()) }
2510 ///
2511 /// fn prepare_request_builder() -> ListRoutines {
2512 /// # panic!();
2513 /// // ... details omitted ...
2514 /// }
2515 /// ```
2516 #[derive(Clone, Debug)]
2517 pub struct ListRoutines(RequestBuilder<crate::model::ListRoutinesRequest>);
2518
2519 impl ListRoutines {
2520 pub(crate) fn new(
2521 stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2522 ) -> Self {
2523 Self(RequestBuilder::new(stub))
2524 }
2525
2526 /// Sets the full request, replacing any prior values.
2527 pub fn with_request<V: Into<crate::model::ListRoutinesRequest>>(mut self, v: V) -> Self {
2528 self.0.request = v.into();
2529 self
2530 }
2531
2532 /// Sets all the options, replacing any prior values.
2533 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2534 self.0.options = v.into();
2535 self
2536 }
2537
2538 /// Sends the request.
2539 pub async fn send(self) -> Result<crate::model::ListRoutinesResponse> {
2540 (*self.0.stub)
2541 .list_routines(self.0.request, self.0.options)
2542 .await
2543 .map(crate::Response::into_body)
2544 }
2545
2546 /// Streams each page in the collection.
2547 pub fn by_page(
2548 self,
2549 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListRoutinesResponse, crate::Error>
2550 {
2551 use std::clone::Clone;
2552 let token = self.0.request.page_token.clone();
2553 let execute = move |token: String| {
2554 let mut builder = self.clone();
2555 builder.0.request = builder.0.request.set_page_token(token);
2556 builder.send()
2557 };
2558 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2559 }
2560
2561 /// Streams each item in the collection.
2562 pub fn by_item(
2563 self,
2564 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2565 crate::model::ListRoutinesResponse,
2566 crate::Error,
2567 > {
2568 use google_cloud_gax::paginator::Paginator;
2569 self.by_page().items()
2570 }
2571
2572 /// Sets the value of [project_id][crate::model::ListRoutinesRequest::project_id].
2573 ///
2574 /// This is a **required** field for requests.
2575 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2576 self.0.request.project_id = v.into();
2577 self
2578 }
2579
2580 /// Sets the value of [dataset_id][crate::model::ListRoutinesRequest::dataset_id].
2581 ///
2582 /// This is a **required** field for requests.
2583 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2584 self.0.request.dataset_id = v.into();
2585 self
2586 }
2587
2588 /// Sets the value of [max_results][crate::model::ListRoutinesRequest::max_results].
2589 pub fn set_max_results<T>(mut self, v: T) -> Self
2590 where
2591 T: std::convert::Into<wkt::UInt32Value>,
2592 {
2593 self.0.request.max_results = std::option::Option::Some(v.into());
2594 self
2595 }
2596
2597 /// Sets or clears the value of [max_results][crate::model::ListRoutinesRequest::max_results].
2598 pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
2599 where
2600 T: std::convert::Into<wkt::UInt32Value>,
2601 {
2602 self.0.request.max_results = v.map(|x| x.into());
2603 self
2604 }
2605
2606 /// Sets the value of [page_token][crate::model::ListRoutinesRequest::page_token].
2607 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2608 self.0.request.page_token = v.into();
2609 self
2610 }
2611
2612 /// Sets the value of [filter][crate::model::ListRoutinesRequest::filter].
2613 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2614 self.0.request.filter = v.into();
2615 self
2616 }
2617 }
2618
2619 #[doc(hidden)]
2620 impl crate::RequestBuilder for ListRoutines {
2621 fn request_options(&mut self) -> &mut crate::RequestOptions {
2622 &mut self.0.options
2623 }
2624 }
2625}
2626
2627/// Request and client builders for [RowAccessPolicyService][crate::client::RowAccessPolicyService].
2628pub mod row_access_policy_service {
2629 use crate::Result;
2630
2631 /// A builder for [RowAccessPolicyService][crate::client::RowAccessPolicyService].
2632 ///
2633 /// ```
2634 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2635 /// # use google_cloud_bigquery_v2::*;
2636 /// # use builder::row_access_policy_service::ClientBuilder;
2637 /// # use client::RowAccessPolicyService;
2638 /// let builder : ClientBuilder = RowAccessPolicyService::builder();
2639 /// let client = builder
2640 /// .with_endpoint("https://bigquery.googleapis.com")
2641 /// .build().await?;
2642 /// # Ok(()) }
2643 /// ```
2644 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2645
2646 pub(crate) mod client {
2647 use super::super::super::client::RowAccessPolicyService;
2648 pub struct Factory;
2649 impl crate::ClientFactory for Factory {
2650 type Client = RowAccessPolicyService;
2651 type Credentials = gaxi::options::Credentials;
2652 async fn build(
2653 self,
2654 config: gaxi::options::ClientConfig,
2655 ) -> crate::ClientBuilderResult<Self::Client> {
2656 Self::Client::new(config).await
2657 }
2658 }
2659 }
2660
2661 /// Common implementation for [crate::client::RowAccessPolicyService] request builders.
2662 #[derive(Clone, Debug)]
2663 pub(crate) struct RequestBuilder<R: std::default::Default> {
2664 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2665 request: R,
2666 options: crate::RequestOptions,
2667 }
2668
2669 impl<R> RequestBuilder<R>
2670 where
2671 R: std::default::Default,
2672 {
2673 pub(crate) fn new(
2674 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2675 ) -> Self {
2676 Self {
2677 stub,
2678 request: R::default(),
2679 options: crate::RequestOptions::default(),
2680 }
2681 }
2682 }
2683
2684 /// The request builder for [RowAccessPolicyService::list_row_access_policies][crate::client::RowAccessPolicyService::list_row_access_policies] calls.
2685 ///
2686 /// # Example
2687 /// ```
2688 /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::ListRowAccessPolicies;
2689 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2690 /// use google_cloud_gax::paginator::ItemPaginator;
2691 ///
2692 /// let builder = prepare_request_builder();
2693 /// let mut items = builder.by_item();
2694 /// while let Some(result) = items.next().await {
2695 /// let item = result?;
2696 /// }
2697 /// # Ok(()) }
2698 ///
2699 /// fn prepare_request_builder() -> ListRowAccessPolicies {
2700 /// # panic!();
2701 /// // ... details omitted ...
2702 /// }
2703 /// ```
2704 #[derive(Clone, Debug)]
2705 pub struct ListRowAccessPolicies(RequestBuilder<crate::model::ListRowAccessPoliciesRequest>);
2706
2707 impl ListRowAccessPolicies {
2708 pub(crate) fn new(
2709 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2710 ) -> Self {
2711 Self(RequestBuilder::new(stub))
2712 }
2713
2714 /// Sets the full request, replacing any prior values.
2715 pub fn with_request<V: Into<crate::model::ListRowAccessPoliciesRequest>>(
2716 mut self,
2717 v: V,
2718 ) -> Self {
2719 self.0.request = v.into();
2720 self
2721 }
2722
2723 /// Sets all the options, replacing any prior values.
2724 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2725 self.0.options = v.into();
2726 self
2727 }
2728
2729 /// Sends the request.
2730 pub async fn send(self) -> Result<crate::model::ListRowAccessPoliciesResponse> {
2731 (*self.0.stub)
2732 .list_row_access_policies(self.0.request, self.0.options)
2733 .await
2734 .map(crate::Response::into_body)
2735 }
2736
2737 /// Streams each page in the collection.
2738 pub fn by_page(
2739 self,
2740 ) -> impl google_cloud_gax::paginator::Paginator<
2741 crate::model::ListRowAccessPoliciesResponse,
2742 crate::Error,
2743 > {
2744 use std::clone::Clone;
2745 let token = self.0.request.page_token.clone();
2746 let execute = move |token: String| {
2747 let mut builder = self.clone();
2748 builder.0.request = builder.0.request.set_page_token(token);
2749 builder.send()
2750 };
2751 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2752 }
2753
2754 /// Streams each item in the collection.
2755 pub fn by_item(
2756 self,
2757 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2758 crate::model::ListRowAccessPoliciesResponse,
2759 crate::Error,
2760 > {
2761 use google_cloud_gax::paginator::Paginator;
2762 self.by_page().items()
2763 }
2764
2765 /// Sets the value of [project_id][crate::model::ListRowAccessPoliciesRequest::project_id].
2766 ///
2767 /// This is a **required** field for requests.
2768 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2769 self.0.request.project_id = v.into();
2770 self
2771 }
2772
2773 /// Sets the value of [dataset_id][crate::model::ListRowAccessPoliciesRequest::dataset_id].
2774 ///
2775 /// This is a **required** field for requests.
2776 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2777 self.0.request.dataset_id = v.into();
2778 self
2779 }
2780
2781 /// Sets the value of [table_id][crate::model::ListRowAccessPoliciesRequest::table_id].
2782 ///
2783 /// This is a **required** field for requests.
2784 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2785 self.0.request.table_id = v.into();
2786 self
2787 }
2788
2789 /// Sets the value of [page_token][crate::model::ListRowAccessPoliciesRequest::page_token].
2790 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2791 self.0.request.page_token = v.into();
2792 self
2793 }
2794
2795 /// Sets the value of [page_size][crate::model::ListRowAccessPoliciesRequest::page_size].
2796 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2797 self.0.request.page_size = v.into();
2798 self
2799 }
2800 }
2801
2802 #[doc(hidden)]
2803 impl crate::RequestBuilder for ListRowAccessPolicies {
2804 fn request_options(&mut self) -> &mut crate::RequestOptions {
2805 &mut self.0.options
2806 }
2807 }
2808
2809 /// The request builder for [RowAccessPolicyService::get_row_access_policy][crate::client::RowAccessPolicyService::get_row_access_policy] calls.
2810 ///
2811 /// # Example
2812 /// ```
2813 /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::GetRowAccessPolicy;
2814 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2815 ///
2816 /// let builder = prepare_request_builder();
2817 /// let response = builder.send().await?;
2818 /// # Ok(()) }
2819 ///
2820 /// fn prepare_request_builder() -> GetRowAccessPolicy {
2821 /// # panic!();
2822 /// // ... details omitted ...
2823 /// }
2824 /// ```
2825 #[derive(Clone, Debug)]
2826 pub struct GetRowAccessPolicy(RequestBuilder<crate::model::GetRowAccessPolicyRequest>);
2827
2828 impl GetRowAccessPolicy {
2829 pub(crate) fn new(
2830 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2831 ) -> Self {
2832 Self(RequestBuilder::new(stub))
2833 }
2834
2835 /// Sets the full request, replacing any prior values.
2836 pub fn with_request<V: Into<crate::model::GetRowAccessPolicyRequest>>(
2837 mut self,
2838 v: V,
2839 ) -> Self {
2840 self.0.request = v.into();
2841 self
2842 }
2843
2844 /// Sets all the options, replacing any prior values.
2845 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2846 self.0.options = v.into();
2847 self
2848 }
2849
2850 /// Sends the request.
2851 pub async fn send(self) -> Result<crate::model::RowAccessPolicy> {
2852 (*self.0.stub)
2853 .get_row_access_policy(self.0.request, self.0.options)
2854 .await
2855 .map(crate::Response::into_body)
2856 }
2857
2858 /// Sets the value of [project_id][crate::model::GetRowAccessPolicyRequest::project_id].
2859 ///
2860 /// This is a **required** field for requests.
2861 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2862 self.0.request.project_id = v.into();
2863 self
2864 }
2865
2866 /// Sets the value of [dataset_id][crate::model::GetRowAccessPolicyRequest::dataset_id].
2867 ///
2868 /// This is a **required** field for requests.
2869 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2870 self.0.request.dataset_id = v.into();
2871 self
2872 }
2873
2874 /// Sets the value of [table_id][crate::model::GetRowAccessPolicyRequest::table_id].
2875 ///
2876 /// This is a **required** field for requests.
2877 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2878 self.0.request.table_id = v.into();
2879 self
2880 }
2881
2882 /// Sets the value of [policy_id][crate::model::GetRowAccessPolicyRequest::policy_id].
2883 ///
2884 /// This is a **required** field for requests.
2885 pub fn set_policy_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2886 self.0.request.policy_id = v.into();
2887 self
2888 }
2889 }
2890
2891 #[doc(hidden)]
2892 impl crate::RequestBuilder for GetRowAccessPolicy {
2893 fn request_options(&mut self) -> &mut crate::RequestOptions {
2894 &mut self.0.options
2895 }
2896 }
2897
2898 /// The request builder for [RowAccessPolicyService::create_row_access_policy][crate::client::RowAccessPolicyService::create_row_access_policy] calls.
2899 ///
2900 /// # Example
2901 /// ```
2902 /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::CreateRowAccessPolicy;
2903 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2904 ///
2905 /// let builder = prepare_request_builder();
2906 /// let response = builder.send().await?;
2907 /// # Ok(()) }
2908 ///
2909 /// fn prepare_request_builder() -> CreateRowAccessPolicy {
2910 /// # panic!();
2911 /// // ... details omitted ...
2912 /// }
2913 /// ```
2914 #[derive(Clone, Debug)]
2915 pub struct CreateRowAccessPolicy(RequestBuilder<crate::model::CreateRowAccessPolicyRequest>);
2916
2917 impl CreateRowAccessPolicy {
2918 pub(crate) fn new(
2919 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2920 ) -> Self {
2921 Self(RequestBuilder::new(stub))
2922 }
2923
2924 /// Sets the full request, replacing any prior values.
2925 pub fn with_request<V: Into<crate::model::CreateRowAccessPolicyRequest>>(
2926 mut self,
2927 v: V,
2928 ) -> Self {
2929 self.0.request = v.into();
2930 self
2931 }
2932
2933 /// Sets all the options, replacing any prior values.
2934 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2935 self.0.options = v.into();
2936 self
2937 }
2938
2939 /// Sends the request.
2940 pub async fn send(self) -> Result<crate::model::RowAccessPolicy> {
2941 (*self.0.stub)
2942 .create_row_access_policy(self.0.request, self.0.options)
2943 .await
2944 .map(crate::Response::into_body)
2945 }
2946
2947 /// Sets the value of [project_id][crate::model::CreateRowAccessPolicyRequest::project_id].
2948 ///
2949 /// This is a **required** field for requests.
2950 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2951 self.0.request.project_id = v.into();
2952 self
2953 }
2954
2955 /// Sets the value of [dataset_id][crate::model::CreateRowAccessPolicyRequest::dataset_id].
2956 ///
2957 /// This is a **required** field for requests.
2958 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2959 self.0.request.dataset_id = v.into();
2960 self
2961 }
2962
2963 /// Sets the value of [table_id][crate::model::CreateRowAccessPolicyRequest::table_id].
2964 ///
2965 /// This is a **required** field for requests.
2966 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2967 self.0.request.table_id = v.into();
2968 self
2969 }
2970
2971 /// Sets the value of [row_access_policy][crate::model::CreateRowAccessPolicyRequest::row_access_policy].
2972 ///
2973 /// This is a **required** field for requests.
2974 pub fn set_row_access_policy<T>(mut self, v: T) -> Self
2975 where
2976 T: std::convert::Into<crate::model::RowAccessPolicy>,
2977 {
2978 self.0.request.row_access_policy = std::option::Option::Some(v.into());
2979 self
2980 }
2981
2982 /// Sets or clears the value of [row_access_policy][crate::model::CreateRowAccessPolicyRequest::row_access_policy].
2983 ///
2984 /// This is a **required** field for requests.
2985 pub fn set_or_clear_row_access_policy<T>(mut self, v: std::option::Option<T>) -> Self
2986 where
2987 T: std::convert::Into<crate::model::RowAccessPolicy>,
2988 {
2989 self.0.request.row_access_policy = v.map(|x| x.into());
2990 self
2991 }
2992 }
2993
2994 #[doc(hidden)]
2995 impl crate::RequestBuilder for CreateRowAccessPolicy {
2996 fn request_options(&mut self) -> &mut crate::RequestOptions {
2997 &mut self.0.options
2998 }
2999 }
3000
3001 /// The request builder for [RowAccessPolicyService::update_row_access_policy][crate::client::RowAccessPolicyService::update_row_access_policy] calls.
3002 ///
3003 /// # Example
3004 /// ```
3005 /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::UpdateRowAccessPolicy;
3006 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3007 ///
3008 /// let builder = prepare_request_builder();
3009 /// let response = builder.send().await?;
3010 /// # Ok(()) }
3011 ///
3012 /// fn prepare_request_builder() -> UpdateRowAccessPolicy {
3013 /// # panic!();
3014 /// // ... details omitted ...
3015 /// }
3016 /// ```
3017 #[derive(Clone, Debug)]
3018 pub struct UpdateRowAccessPolicy(RequestBuilder<crate::model::UpdateRowAccessPolicyRequest>);
3019
3020 impl UpdateRowAccessPolicy {
3021 pub(crate) fn new(
3022 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
3023 ) -> Self {
3024 Self(RequestBuilder::new(stub))
3025 }
3026
3027 /// Sets the full request, replacing any prior values.
3028 pub fn with_request<V: Into<crate::model::UpdateRowAccessPolicyRequest>>(
3029 mut self,
3030 v: V,
3031 ) -> Self {
3032 self.0.request = v.into();
3033 self
3034 }
3035
3036 /// Sets all the options, replacing any prior values.
3037 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3038 self.0.options = v.into();
3039 self
3040 }
3041
3042 /// Sends the request.
3043 pub async fn send(self) -> Result<crate::model::RowAccessPolicy> {
3044 (*self.0.stub)
3045 .update_row_access_policy(self.0.request, self.0.options)
3046 .await
3047 .map(crate::Response::into_body)
3048 }
3049
3050 /// Sets the value of [project_id][crate::model::UpdateRowAccessPolicyRequest::project_id].
3051 ///
3052 /// This is a **required** field for requests.
3053 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3054 self.0.request.project_id = v.into();
3055 self
3056 }
3057
3058 /// Sets the value of [dataset_id][crate::model::UpdateRowAccessPolicyRequest::dataset_id].
3059 ///
3060 /// This is a **required** field for requests.
3061 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3062 self.0.request.dataset_id = v.into();
3063 self
3064 }
3065
3066 /// Sets the value of [table_id][crate::model::UpdateRowAccessPolicyRequest::table_id].
3067 ///
3068 /// This is a **required** field for requests.
3069 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3070 self.0.request.table_id = v.into();
3071 self
3072 }
3073
3074 /// Sets the value of [policy_id][crate::model::UpdateRowAccessPolicyRequest::policy_id].
3075 ///
3076 /// This is a **required** field for requests.
3077 pub fn set_policy_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3078 self.0.request.policy_id = v.into();
3079 self
3080 }
3081
3082 /// Sets the value of [row_access_policy][crate::model::UpdateRowAccessPolicyRequest::row_access_policy].
3083 ///
3084 /// This is a **required** field for requests.
3085 pub fn set_row_access_policy<T>(mut self, v: T) -> Self
3086 where
3087 T: std::convert::Into<crate::model::RowAccessPolicy>,
3088 {
3089 self.0.request.row_access_policy = std::option::Option::Some(v.into());
3090 self
3091 }
3092
3093 /// Sets or clears the value of [row_access_policy][crate::model::UpdateRowAccessPolicyRequest::row_access_policy].
3094 ///
3095 /// This is a **required** field for requests.
3096 pub fn set_or_clear_row_access_policy<T>(mut self, v: std::option::Option<T>) -> Self
3097 where
3098 T: std::convert::Into<crate::model::RowAccessPolicy>,
3099 {
3100 self.0.request.row_access_policy = v.map(|x| x.into());
3101 self
3102 }
3103 }
3104
3105 #[doc(hidden)]
3106 impl crate::RequestBuilder for UpdateRowAccessPolicy {
3107 fn request_options(&mut self) -> &mut crate::RequestOptions {
3108 &mut self.0.options
3109 }
3110 }
3111
3112 /// The request builder for [RowAccessPolicyService::delete_row_access_policy][crate::client::RowAccessPolicyService::delete_row_access_policy] calls.
3113 ///
3114 /// # Example
3115 /// ```
3116 /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::DeleteRowAccessPolicy;
3117 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3118 ///
3119 /// let builder = prepare_request_builder();
3120 /// let response = builder.send().await?;
3121 /// # Ok(()) }
3122 ///
3123 /// fn prepare_request_builder() -> DeleteRowAccessPolicy {
3124 /// # panic!();
3125 /// // ... details omitted ...
3126 /// }
3127 /// ```
3128 #[derive(Clone, Debug)]
3129 pub struct DeleteRowAccessPolicy(RequestBuilder<crate::model::DeleteRowAccessPolicyRequest>);
3130
3131 impl DeleteRowAccessPolicy {
3132 pub(crate) fn new(
3133 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
3134 ) -> Self {
3135 Self(RequestBuilder::new(stub))
3136 }
3137
3138 /// Sets the full request, replacing any prior values.
3139 pub fn with_request<V: Into<crate::model::DeleteRowAccessPolicyRequest>>(
3140 mut self,
3141 v: V,
3142 ) -> Self {
3143 self.0.request = v.into();
3144 self
3145 }
3146
3147 /// Sets all the options, replacing any prior values.
3148 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3149 self.0.options = v.into();
3150 self
3151 }
3152
3153 /// Sends the request.
3154 pub async fn send(self) -> Result<()> {
3155 (*self.0.stub)
3156 .delete_row_access_policy(self.0.request, self.0.options)
3157 .await
3158 .map(crate::Response::into_body)
3159 }
3160
3161 /// Sets the value of [project_id][crate::model::DeleteRowAccessPolicyRequest::project_id].
3162 ///
3163 /// This is a **required** field for requests.
3164 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3165 self.0.request.project_id = v.into();
3166 self
3167 }
3168
3169 /// Sets the value of [dataset_id][crate::model::DeleteRowAccessPolicyRequest::dataset_id].
3170 ///
3171 /// This is a **required** field for requests.
3172 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3173 self.0.request.dataset_id = v.into();
3174 self
3175 }
3176
3177 /// Sets the value of [table_id][crate::model::DeleteRowAccessPolicyRequest::table_id].
3178 ///
3179 /// This is a **required** field for requests.
3180 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3181 self.0.request.table_id = v.into();
3182 self
3183 }
3184
3185 /// Sets the value of [policy_id][crate::model::DeleteRowAccessPolicyRequest::policy_id].
3186 ///
3187 /// This is a **required** field for requests.
3188 pub fn set_policy_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3189 self.0.request.policy_id = v.into();
3190 self
3191 }
3192
3193 /// Sets the value of [force][crate::model::DeleteRowAccessPolicyRequest::force].
3194 pub fn set_force<T>(mut self, v: T) -> Self
3195 where
3196 T: std::convert::Into<bool>,
3197 {
3198 self.0.request.force = std::option::Option::Some(v.into());
3199 self
3200 }
3201
3202 /// Sets or clears the value of [force][crate::model::DeleteRowAccessPolicyRequest::force].
3203 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
3204 where
3205 T: std::convert::Into<bool>,
3206 {
3207 self.0.request.force = v.map(|x| x.into());
3208 self
3209 }
3210 }
3211
3212 #[doc(hidden)]
3213 impl crate::RequestBuilder for DeleteRowAccessPolicy {
3214 fn request_options(&mut self) -> &mut crate::RequestOptions {
3215 &mut self.0.options
3216 }
3217 }
3218
3219 /// The request builder for [RowAccessPolicyService::batch_delete_row_access_policies][crate::client::RowAccessPolicyService::batch_delete_row_access_policies] calls.
3220 ///
3221 /// # Example
3222 /// ```
3223 /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::BatchDeleteRowAccessPolicies;
3224 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3225 ///
3226 /// let builder = prepare_request_builder();
3227 /// let response = builder.send().await?;
3228 /// # Ok(()) }
3229 ///
3230 /// fn prepare_request_builder() -> BatchDeleteRowAccessPolicies {
3231 /// # panic!();
3232 /// // ... details omitted ...
3233 /// }
3234 /// ```
3235 #[derive(Clone, Debug)]
3236 pub struct BatchDeleteRowAccessPolicies(
3237 RequestBuilder<crate::model::BatchDeleteRowAccessPoliciesRequest>,
3238 );
3239
3240 impl BatchDeleteRowAccessPolicies {
3241 pub(crate) fn new(
3242 stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
3243 ) -> Self {
3244 Self(RequestBuilder::new(stub))
3245 }
3246
3247 /// Sets the full request, replacing any prior values.
3248 pub fn with_request<V: Into<crate::model::BatchDeleteRowAccessPoliciesRequest>>(
3249 mut self,
3250 v: V,
3251 ) -> Self {
3252 self.0.request = v.into();
3253 self
3254 }
3255
3256 /// Sets all the options, replacing any prior values.
3257 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3258 self.0.options = v.into();
3259 self
3260 }
3261
3262 /// Sends the request.
3263 pub async fn send(self) -> Result<()> {
3264 (*self.0.stub)
3265 .batch_delete_row_access_policies(self.0.request, self.0.options)
3266 .await
3267 .map(crate::Response::into_body)
3268 }
3269
3270 /// Sets the value of [project_id][crate::model::BatchDeleteRowAccessPoliciesRequest::project_id].
3271 ///
3272 /// This is a **required** field for requests.
3273 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3274 self.0.request.project_id = v.into();
3275 self
3276 }
3277
3278 /// Sets the value of [dataset_id][crate::model::BatchDeleteRowAccessPoliciesRequest::dataset_id].
3279 ///
3280 /// This is a **required** field for requests.
3281 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3282 self.0.request.dataset_id = v.into();
3283 self
3284 }
3285
3286 /// Sets the value of [table_id][crate::model::BatchDeleteRowAccessPoliciesRequest::table_id].
3287 ///
3288 /// This is a **required** field for requests.
3289 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3290 self.0.request.table_id = v.into();
3291 self
3292 }
3293
3294 /// Sets the value of [policy_ids][crate::model::BatchDeleteRowAccessPoliciesRequest::policy_ids].
3295 ///
3296 /// This is a **required** field for requests.
3297 pub fn set_policy_ids<T, V>(mut self, v: T) -> Self
3298 where
3299 T: std::iter::IntoIterator<Item = V>,
3300 V: std::convert::Into<std::string::String>,
3301 {
3302 use std::iter::Iterator;
3303 self.0.request.policy_ids = v.into_iter().map(|i| i.into()).collect();
3304 self
3305 }
3306
3307 /// Sets the value of [force][crate::model::BatchDeleteRowAccessPoliciesRequest::force].
3308 pub fn set_force<T>(mut self, v: T) -> Self
3309 where
3310 T: std::convert::Into<bool>,
3311 {
3312 self.0.request.force = std::option::Option::Some(v.into());
3313 self
3314 }
3315
3316 /// Sets or clears the value of [force][crate::model::BatchDeleteRowAccessPoliciesRequest::force].
3317 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
3318 where
3319 T: std::convert::Into<bool>,
3320 {
3321 self.0.request.force = v.map(|x| x.into());
3322 self
3323 }
3324 }
3325
3326 #[doc(hidden)]
3327 impl crate::RequestBuilder for BatchDeleteRowAccessPolicies {
3328 fn request_options(&mut self) -> &mut crate::RequestOptions {
3329 &mut self.0.options
3330 }
3331 }
3332}
3333
3334/// Request and client builders for [TableService][crate::client::TableService].
3335pub mod table_service {
3336 use crate::Result;
3337
3338 /// A builder for [TableService][crate::client::TableService].
3339 ///
3340 /// ```
3341 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3342 /// # use google_cloud_bigquery_v2::*;
3343 /// # use builder::table_service::ClientBuilder;
3344 /// # use client::TableService;
3345 /// let builder : ClientBuilder = TableService::builder();
3346 /// let client = builder
3347 /// .with_endpoint("https://bigquery.googleapis.com")
3348 /// .build().await?;
3349 /// # Ok(()) }
3350 /// ```
3351 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3352
3353 pub(crate) mod client {
3354 use super::super::super::client::TableService;
3355 pub struct Factory;
3356 impl crate::ClientFactory for Factory {
3357 type Client = TableService;
3358 type Credentials = gaxi::options::Credentials;
3359 async fn build(
3360 self,
3361 config: gaxi::options::ClientConfig,
3362 ) -> crate::ClientBuilderResult<Self::Client> {
3363 Self::Client::new(config).await
3364 }
3365 }
3366 }
3367
3368 /// Common implementation for [crate::client::TableService] request builders.
3369 #[derive(Clone, Debug)]
3370 pub(crate) struct RequestBuilder<R: std::default::Default> {
3371 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3372 request: R,
3373 options: crate::RequestOptions,
3374 }
3375
3376 impl<R> RequestBuilder<R>
3377 where
3378 R: std::default::Default,
3379 {
3380 pub(crate) fn new(
3381 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3382 ) -> Self {
3383 Self {
3384 stub,
3385 request: R::default(),
3386 options: crate::RequestOptions::default(),
3387 }
3388 }
3389 }
3390
3391 /// The request builder for [TableService::get_table][crate::client::TableService::get_table] calls.
3392 ///
3393 /// # Example
3394 /// ```
3395 /// # use google_cloud_bigquery_v2::builder::table_service::GetTable;
3396 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3397 ///
3398 /// let builder = prepare_request_builder();
3399 /// let response = builder.send().await?;
3400 /// # Ok(()) }
3401 ///
3402 /// fn prepare_request_builder() -> GetTable {
3403 /// # panic!();
3404 /// // ... details omitted ...
3405 /// }
3406 /// ```
3407 #[derive(Clone, Debug)]
3408 pub struct GetTable(RequestBuilder<crate::model::GetTableRequest>);
3409
3410 impl GetTable {
3411 pub(crate) fn new(
3412 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3413 ) -> Self {
3414 Self(RequestBuilder::new(stub))
3415 }
3416
3417 /// Sets the full request, replacing any prior values.
3418 pub fn with_request<V: Into<crate::model::GetTableRequest>>(mut self, v: V) -> Self {
3419 self.0.request = v.into();
3420 self
3421 }
3422
3423 /// Sets all the options, replacing any prior values.
3424 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3425 self.0.options = v.into();
3426 self
3427 }
3428
3429 /// Sends the request.
3430 pub async fn send(self) -> Result<crate::model::Table> {
3431 (*self.0.stub)
3432 .get_table(self.0.request, self.0.options)
3433 .await
3434 .map(crate::Response::into_body)
3435 }
3436
3437 /// Sets the value of [project_id][crate::model::GetTableRequest::project_id].
3438 ///
3439 /// This is a **required** field for requests.
3440 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3441 self.0.request.project_id = v.into();
3442 self
3443 }
3444
3445 /// Sets the value of [dataset_id][crate::model::GetTableRequest::dataset_id].
3446 ///
3447 /// This is a **required** field for requests.
3448 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3449 self.0.request.dataset_id = v.into();
3450 self
3451 }
3452
3453 /// Sets the value of [table_id][crate::model::GetTableRequest::table_id].
3454 ///
3455 /// This is a **required** field for requests.
3456 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3457 self.0.request.table_id = v.into();
3458 self
3459 }
3460
3461 /// Sets the value of [selected_fields][crate::model::GetTableRequest::selected_fields].
3462 pub fn set_selected_fields<T: Into<std::string::String>>(mut self, v: T) -> Self {
3463 self.0.request.selected_fields = v.into();
3464 self
3465 }
3466
3467 /// Sets the value of [view][crate::model::GetTableRequest::view].
3468 pub fn set_view<T: Into<crate::model::get_table_request::TableMetadataView>>(
3469 mut self,
3470 v: T,
3471 ) -> Self {
3472 self.0.request.view = v.into();
3473 self
3474 }
3475 }
3476
3477 #[doc(hidden)]
3478 impl crate::RequestBuilder for GetTable {
3479 fn request_options(&mut self) -> &mut crate::RequestOptions {
3480 &mut self.0.options
3481 }
3482 }
3483
3484 /// The request builder for [TableService::insert_table][crate::client::TableService::insert_table] calls.
3485 ///
3486 /// # Example
3487 /// ```
3488 /// # use google_cloud_bigquery_v2::builder::table_service::InsertTable;
3489 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3490 ///
3491 /// let builder = prepare_request_builder();
3492 /// let response = builder.send().await?;
3493 /// # Ok(()) }
3494 ///
3495 /// fn prepare_request_builder() -> InsertTable {
3496 /// # panic!();
3497 /// // ... details omitted ...
3498 /// }
3499 /// ```
3500 #[derive(Clone, Debug)]
3501 pub struct InsertTable(RequestBuilder<crate::model::InsertTableRequest>);
3502
3503 impl InsertTable {
3504 pub(crate) fn new(
3505 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3506 ) -> Self {
3507 Self(RequestBuilder::new(stub))
3508 }
3509
3510 /// Sets the full request, replacing any prior values.
3511 pub fn with_request<V: Into<crate::model::InsertTableRequest>>(mut self, v: V) -> Self {
3512 self.0.request = v.into();
3513 self
3514 }
3515
3516 /// Sets all the options, replacing any prior values.
3517 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3518 self.0.options = v.into();
3519 self
3520 }
3521
3522 /// Sends the request.
3523 pub async fn send(self) -> Result<crate::model::Table> {
3524 (*self.0.stub)
3525 .insert_table(self.0.request, self.0.options)
3526 .await
3527 .map(crate::Response::into_body)
3528 }
3529
3530 /// Sets the value of [project_id][crate::model::InsertTableRequest::project_id].
3531 ///
3532 /// This is a **required** field for requests.
3533 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3534 self.0.request.project_id = v.into();
3535 self
3536 }
3537
3538 /// Sets the value of [dataset_id][crate::model::InsertTableRequest::dataset_id].
3539 ///
3540 /// This is a **required** field for requests.
3541 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3542 self.0.request.dataset_id = v.into();
3543 self
3544 }
3545
3546 /// Sets the value of [table][crate::model::InsertTableRequest::table].
3547 ///
3548 /// This is a **required** field for requests.
3549 pub fn set_table<T>(mut self, v: T) -> Self
3550 where
3551 T: std::convert::Into<crate::model::Table>,
3552 {
3553 self.0.request.table = std::option::Option::Some(v.into());
3554 self
3555 }
3556
3557 /// Sets or clears the value of [table][crate::model::InsertTableRequest::table].
3558 ///
3559 /// This is a **required** field for requests.
3560 pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
3561 where
3562 T: std::convert::Into<crate::model::Table>,
3563 {
3564 self.0.request.table = v.map(|x| x.into());
3565 self
3566 }
3567 }
3568
3569 #[doc(hidden)]
3570 impl crate::RequestBuilder for InsertTable {
3571 fn request_options(&mut self) -> &mut crate::RequestOptions {
3572 &mut self.0.options
3573 }
3574 }
3575
3576 /// The request builder for [TableService::patch_table][crate::client::TableService::patch_table] calls.
3577 ///
3578 /// # Example
3579 /// ```
3580 /// # use google_cloud_bigquery_v2::builder::table_service::PatchTable;
3581 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3582 ///
3583 /// let builder = prepare_request_builder();
3584 /// let response = builder.send().await?;
3585 /// # Ok(()) }
3586 ///
3587 /// fn prepare_request_builder() -> PatchTable {
3588 /// # panic!();
3589 /// // ... details omitted ...
3590 /// }
3591 /// ```
3592 #[derive(Clone, Debug)]
3593 pub struct PatchTable(RequestBuilder<crate::model::UpdateOrPatchTableRequest>);
3594
3595 impl PatchTable {
3596 pub(crate) fn new(
3597 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3598 ) -> Self {
3599 Self(RequestBuilder::new(stub))
3600 }
3601
3602 /// Sets the full request, replacing any prior values.
3603 pub fn with_request<V: Into<crate::model::UpdateOrPatchTableRequest>>(
3604 mut self,
3605 v: V,
3606 ) -> Self {
3607 self.0.request = v.into();
3608 self
3609 }
3610
3611 /// Sets all the options, replacing any prior values.
3612 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3613 self.0.options = v.into();
3614 self
3615 }
3616
3617 /// Sends the request.
3618 pub async fn send(self) -> Result<crate::model::Table> {
3619 (*self.0.stub)
3620 .patch_table(self.0.request, self.0.options)
3621 .await
3622 .map(crate::Response::into_body)
3623 }
3624
3625 /// Sets the value of [project_id][crate::model::UpdateOrPatchTableRequest::project_id].
3626 ///
3627 /// This is a **required** field for requests.
3628 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3629 self.0.request.project_id = v.into();
3630 self
3631 }
3632
3633 /// Sets the value of [dataset_id][crate::model::UpdateOrPatchTableRequest::dataset_id].
3634 ///
3635 /// This is a **required** field for requests.
3636 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3637 self.0.request.dataset_id = v.into();
3638 self
3639 }
3640
3641 /// Sets the value of [table_id][crate::model::UpdateOrPatchTableRequest::table_id].
3642 ///
3643 /// This is a **required** field for requests.
3644 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3645 self.0.request.table_id = v.into();
3646 self
3647 }
3648
3649 /// Sets the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3650 ///
3651 /// This is a **required** field for requests.
3652 pub fn set_table<T>(mut self, v: T) -> Self
3653 where
3654 T: std::convert::Into<crate::model::Table>,
3655 {
3656 self.0.request.table = std::option::Option::Some(v.into());
3657 self
3658 }
3659
3660 /// Sets or clears the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3661 ///
3662 /// This is a **required** field for requests.
3663 pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
3664 where
3665 T: std::convert::Into<crate::model::Table>,
3666 {
3667 self.0.request.table = v.map(|x| x.into());
3668 self
3669 }
3670
3671 /// Sets the value of [autodetect_schema][crate::model::UpdateOrPatchTableRequest::autodetect_schema].
3672 pub fn set_autodetect_schema<T: Into<bool>>(mut self, v: T) -> Self {
3673 self.0.request.autodetect_schema = v.into();
3674 self
3675 }
3676 }
3677
3678 #[doc(hidden)]
3679 impl crate::RequestBuilder for PatchTable {
3680 fn request_options(&mut self) -> &mut crate::RequestOptions {
3681 &mut self.0.options
3682 }
3683 }
3684
3685 /// The request builder for [TableService::update_table][crate::client::TableService::update_table] calls.
3686 ///
3687 /// # Example
3688 /// ```
3689 /// # use google_cloud_bigquery_v2::builder::table_service::UpdateTable;
3690 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3691 ///
3692 /// let builder = prepare_request_builder();
3693 /// let response = builder.send().await?;
3694 /// # Ok(()) }
3695 ///
3696 /// fn prepare_request_builder() -> UpdateTable {
3697 /// # panic!();
3698 /// // ... details omitted ...
3699 /// }
3700 /// ```
3701 #[derive(Clone, Debug)]
3702 pub struct UpdateTable(RequestBuilder<crate::model::UpdateOrPatchTableRequest>);
3703
3704 impl UpdateTable {
3705 pub(crate) fn new(
3706 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3707 ) -> Self {
3708 Self(RequestBuilder::new(stub))
3709 }
3710
3711 /// Sets the full request, replacing any prior values.
3712 pub fn with_request<V: Into<crate::model::UpdateOrPatchTableRequest>>(
3713 mut self,
3714 v: V,
3715 ) -> Self {
3716 self.0.request = v.into();
3717 self
3718 }
3719
3720 /// Sets all the options, replacing any prior values.
3721 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3722 self.0.options = v.into();
3723 self
3724 }
3725
3726 /// Sends the request.
3727 pub async fn send(self) -> Result<crate::model::Table> {
3728 (*self.0.stub)
3729 .update_table(self.0.request, self.0.options)
3730 .await
3731 .map(crate::Response::into_body)
3732 }
3733
3734 /// Sets the value of [project_id][crate::model::UpdateOrPatchTableRequest::project_id].
3735 ///
3736 /// This is a **required** field for requests.
3737 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3738 self.0.request.project_id = v.into();
3739 self
3740 }
3741
3742 /// Sets the value of [dataset_id][crate::model::UpdateOrPatchTableRequest::dataset_id].
3743 ///
3744 /// This is a **required** field for requests.
3745 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3746 self.0.request.dataset_id = v.into();
3747 self
3748 }
3749
3750 /// Sets the value of [table_id][crate::model::UpdateOrPatchTableRequest::table_id].
3751 ///
3752 /// This is a **required** field for requests.
3753 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3754 self.0.request.table_id = v.into();
3755 self
3756 }
3757
3758 /// Sets the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3759 ///
3760 /// This is a **required** field for requests.
3761 pub fn set_table<T>(mut self, v: T) -> Self
3762 where
3763 T: std::convert::Into<crate::model::Table>,
3764 {
3765 self.0.request.table = std::option::Option::Some(v.into());
3766 self
3767 }
3768
3769 /// Sets or clears the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3770 ///
3771 /// This is a **required** field for requests.
3772 pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
3773 where
3774 T: std::convert::Into<crate::model::Table>,
3775 {
3776 self.0.request.table = v.map(|x| x.into());
3777 self
3778 }
3779
3780 /// Sets the value of [autodetect_schema][crate::model::UpdateOrPatchTableRequest::autodetect_schema].
3781 pub fn set_autodetect_schema<T: Into<bool>>(mut self, v: T) -> Self {
3782 self.0.request.autodetect_schema = v.into();
3783 self
3784 }
3785 }
3786
3787 #[doc(hidden)]
3788 impl crate::RequestBuilder for UpdateTable {
3789 fn request_options(&mut self) -> &mut crate::RequestOptions {
3790 &mut self.0.options
3791 }
3792 }
3793
3794 /// The request builder for [TableService::delete_table][crate::client::TableService::delete_table] calls.
3795 ///
3796 /// # Example
3797 /// ```
3798 /// # use google_cloud_bigquery_v2::builder::table_service::DeleteTable;
3799 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3800 ///
3801 /// let builder = prepare_request_builder();
3802 /// let response = builder.send().await?;
3803 /// # Ok(()) }
3804 ///
3805 /// fn prepare_request_builder() -> DeleteTable {
3806 /// # panic!();
3807 /// // ... details omitted ...
3808 /// }
3809 /// ```
3810 #[derive(Clone, Debug)]
3811 pub struct DeleteTable(RequestBuilder<crate::model::DeleteTableRequest>);
3812
3813 impl DeleteTable {
3814 pub(crate) fn new(
3815 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3816 ) -> Self {
3817 Self(RequestBuilder::new(stub))
3818 }
3819
3820 /// Sets the full request, replacing any prior values.
3821 pub fn with_request<V: Into<crate::model::DeleteTableRequest>>(mut self, v: V) -> Self {
3822 self.0.request = v.into();
3823 self
3824 }
3825
3826 /// Sets all the options, replacing any prior values.
3827 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3828 self.0.options = v.into();
3829 self
3830 }
3831
3832 /// Sends the request.
3833 pub async fn send(self) -> Result<()> {
3834 (*self.0.stub)
3835 .delete_table(self.0.request, self.0.options)
3836 .await
3837 .map(crate::Response::into_body)
3838 }
3839
3840 /// Sets the value of [project_id][crate::model::DeleteTableRequest::project_id].
3841 ///
3842 /// This is a **required** field for requests.
3843 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3844 self.0.request.project_id = v.into();
3845 self
3846 }
3847
3848 /// Sets the value of [dataset_id][crate::model::DeleteTableRequest::dataset_id].
3849 ///
3850 /// This is a **required** field for requests.
3851 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3852 self.0.request.dataset_id = v.into();
3853 self
3854 }
3855
3856 /// Sets the value of [table_id][crate::model::DeleteTableRequest::table_id].
3857 ///
3858 /// This is a **required** field for requests.
3859 pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3860 self.0.request.table_id = v.into();
3861 self
3862 }
3863 }
3864
3865 #[doc(hidden)]
3866 impl crate::RequestBuilder for DeleteTable {
3867 fn request_options(&mut self) -> &mut crate::RequestOptions {
3868 &mut self.0.options
3869 }
3870 }
3871
3872 /// The request builder for [TableService::list_tables][crate::client::TableService::list_tables] calls.
3873 ///
3874 /// # Example
3875 /// ```
3876 /// # use google_cloud_bigquery_v2::builder::table_service::ListTables;
3877 /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3878 /// use google_cloud_gax::paginator::ItemPaginator;
3879 ///
3880 /// let builder = prepare_request_builder();
3881 /// let mut items = builder.by_item();
3882 /// while let Some(result) = items.next().await {
3883 /// let item = result?;
3884 /// }
3885 /// # Ok(()) }
3886 ///
3887 /// fn prepare_request_builder() -> ListTables {
3888 /// # panic!();
3889 /// // ... details omitted ...
3890 /// }
3891 /// ```
3892 #[derive(Clone, Debug)]
3893 pub struct ListTables(RequestBuilder<crate::model::ListTablesRequest>);
3894
3895 impl ListTables {
3896 pub(crate) fn new(
3897 stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3898 ) -> Self {
3899 Self(RequestBuilder::new(stub))
3900 }
3901
3902 /// Sets the full request, replacing any prior values.
3903 pub fn with_request<V: Into<crate::model::ListTablesRequest>>(mut self, v: V) -> Self {
3904 self.0.request = v.into();
3905 self
3906 }
3907
3908 /// Sets all the options, replacing any prior values.
3909 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3910 self.0.options = v.into();
3911 self
3912 }
3913
3914 /// Sends the request.
3915 pub async fn send(self) -> Result<crate::model::TableList> {
3916 (*self.0.stub)
3917 .list_tables(self.0.request, self.0.options)
3918 .await
3919 .map(crate::Response::into_body)
3920 }
3921
3922 /// Streams each page in the collection.
3923 pub fn by_page(
3924 self,
3925 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::TableList, crate::Error>
3926 {
3927 use std::clone::Clone;
3928 let token = self.0.request.page_token.clone();
3929 let execute = move |token: String| {
3930 let mut builder = self.clone();
3931 builder.0.request = builder.0.request.set_page_token(token);
3932 builder.send()
3933 };
3934 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3935 }
3936
3937 /// Streams each item in the collection.
3938 pub fn by_item(
3939 self,
3940 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::TableList, crate::Error>
3941 {
3942 use google_cloud_gax::paginator::Paginator;
3943 self.by_page().items()
3944 }
3945
3946 /// Sets the value of [project_id][crate::model::ListTablesRequest::project_id].
3947 ///
3948 /// This is a **required** field for requests.
3949 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3950 self.0.request.project_id = v.into();
3951 self
3952 }
3953
3954 /// Sets the value of [dataset_id][crate::model::ListTablesRequest::dataset_id].
3955 ///
3956 /// This is a **required** field for requests.
3957 pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3958 self.0.request.dataset_id = v.into();
3959 self
3960 }
3961
3962 /// Sets the value of [max_results][crate::model::ListTablesRequest::max_results].
3963 pub fn set_max_results<T>(mut self, v: T) -> Self
3964 where
3965 T: std::convert::Into<wkt::UInt32Value>,
3966 {
3967 self.0.request.max_results = std::option::Option::Some(v.into());
3968 self
3969 }
3970
3971 /// Sets or clears the value of [max_results][crate::model::ListTablesRequest::max_results].
3972 pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
3973 where
3974 T: std::convert::Into<wkt::UInt32Value>,
3975 {
3976 self.0.request.max_results = v.map(|x| x.into());
3977 self
3978 }
3979
3980 /// Sets the value of [page_token][crate::model::ListTablesRequest::page_token].
3981 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3982 self.0.request.page_token = v.into();
3983 self
3984 }
3985 }
3986
3987 #[doc(hidden)]
3988 impl crate::RequestBuilder for ListTables {
3989 fn request_options(&mut self) -> &mut crate::RequestOptions {
3990 &mut self.0.options
3991 }
3992 }
3993}