google_cloud_bigquery_analyticshub_v1/builder.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod analytics_hub_service {
18 use crate::Result;
19
20 /// A builder for [AnalyticsHubService][crate::client::AnalyticsHubService].
21 ///
22 /// ```
23 /// # async fn sample() -> gax::client_builder::Result<()> {
24 /// # use google_cloud_bigquery_analyticshub_v1::*;
25 /// # use builder::analytics_hub_service::ClientBuilder;
26 /// # use client::AnalyticsHubService;
27 /// let builder : ClientBuilder = AnalyticsHubService::builder();
28 /// let client = builder
29 /// .with_endpoint("https://analyticshub.googleapis.com")
30 /// .build().await?;
31 /// # Ok(()) }
32 /// ```
33 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::AnalyticsHubService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = AnalyticsHubService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::AnalyticsHubService] 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::AnalyticsHubService>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [AnalyticsHubService::list_data_exchanges][crate::client::AnalyticsHubService::list_data_exchanges] calls.
75 ///
76 /// # Example
77 /// ```
78 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListDataExchanges;
79 /// # async fn sample() -> gax::Result<()> {
80 /// use gax::paginator::ItemPaginator;
81 ///
82 /// let builder = prepare_request_builder();
83 /// let mut items = builder.by_item();
84 /// while let Some(result) = items.next().await {
85 /// let item = result?;
86 /// }
87 /// # Ok(()) }
88 ///
89 /// fn prepare_request_builder() -> ListDataExchanges {
90 /// # panic!();
91 /// // ... details omitted ...
92 /// }
93 /// ```
94 #[derive(Clone, Debug)]
95 pub struct ListDataExchanges(RequestBuilder<crate::model::ListDataExchangesRequest>);
96
97 impl ListDataExchanges {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 /// Sets the full request, replacing any prior values.
105 pub fn with_request<V: Into<crate::model::ListDataExchangesRequest>>(
106 mut self,
107 v: V,
108 ) -> Self {
109 self.0.request = v.into();
110 self
111 }
112
113 /// Sets all the options, replacing any prior values.
114 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
115 self.0.options = v.into();
116 self
117 }
118
119 /// Sends the request.
120 pub async fn send(self) -> Result<crate::model::ListDataExchangesResponse> {
121 (*self.0.stub)
122 .list_data_exchanges(self.0.request, self.0.options)
123 .await
124 .map(gax::response::Response::into_body)
125 }
126
127 /// Streams each page in the collection.
128 pub fn by_page(
129 self,
130 ) -> impl gax::paginator::Paginator<crate::model::ListDataExchangesResponse, gax::error::Error>
131 {
132 use std::clone::Clone;
133 let token = self.0.request.page_token.clone();
134 let execute = move |token: String| {
135 let mut builder = self.clone();
136 builder.0.request = builder.0.request.set_page_token(token);
137 builder.send()
138 };
139 gax::paginator::internal::new_paginator(token, execute)
140 }
141
142 /// Streams each item in the collection.
143 pub fn by_item(
144 self,
145 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataExchangesResponse, gax::error::Error>
146 {
147 use gax::paginator::Paginator;
148 self.by_page().items()
149 }
150
151 /// Sets the value of [parent][crate::model::ListDataExchangesRequest::parent].
152 ///
153 /// This is a **required** field for requests.
154 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
155 self.0.request.parent = v.into();
156 self
157 }
158
159 /// Sets the value of [page_size][crate::model::ListDataExchangesRequest::page_size].
160 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
161 self.0.request.page_size = v.into();
162 self
163 }
164
165 /// Sets the value of [page_token][crate::model::ListDataExchangesRequest::page_token].
166 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
167 self.0.request.page_token = v.into();
168 self
169 }
170 }
171
172 #[doc(hidden)]
173 impl gax::options::internal::RequestBuilder for ListDataExchanges {
174 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
175 &mut self.0.options
176 }
177 }
178
179 /// The request builder for [AnalyticsHubService::list_org_data_exchanges][crate::client::AnalyticsHubService::list_org_data_exchanges] calls.
180 ///
181 /// # Example
182 /// ```
183 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListOrgDataExchanges;
184 /// # async fn sample() -> gax::Result<()> {
185 /// use gax::paginator::ItemPaginator;
186 ///
187 /// let builder = prepare_request_builder();
188 /// let mut items = builder.by_item();
189 /// while let Some(result) = items.next().await {
190 /// let item = result?;
191 /// }
192 /// # Ok(()) }
193 ///
194 /// fn prepare_request_builder() -> ListOrgDataExchanges {
195 /// # panic!();
196 /// // ... details omitted ...
197 /// }
198 /// ```
199 #[derive(Clone, Debug)]
200 pub struct ListOrgDataExchanges(RequestBuilder<crate::model::ListOrgDataExchangesRequest>);
201
202 impl ListOrgDataExchanges {
203 pub(crate) fn new(
204 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
205 ) -> Self {
206 Self(RequestBuilder::new(stub))
207 }
208
209 /// Sets the full request, replacing any prior values.
210 pub fn with_request<V: Into<crate::model::ListOrgDataExchangesRequest>>(
211 mut self,
212 v: V,
213 ) -> Self {
214 self.0.request = v.into();
215 self
216 }
217
218 /// Sets all the options, replacing any prior values.
219 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
220 self.0.options = v.into();
221 self
222 }
223
224 /// Sends the request.
225 pub async fn send(self) -> Result<crate::model::ListOrgDataExchangesResponse> {
226 (*self.0.stub)
227 .list_org_data_exchanges(self.0.request, self.0.options)
228 .await
229 .map(gax::response::Response::into_body)
230 }
231
232 /// Streams each page in the collection.
233 pub fn by_page(
234 self,
235 ) -> impl gax::paginator::Paginator<crate::model::ListOrgDataExchangesResponse, gax::error::Error>
236 {
237 use std::clone::Clone;
238 let token = self.0.request.page_token.clone();
239 let execute = move |token: String| {
240 let mut builder = self.clone();
241 builder.0.request = builder.0.request.set_page_token(token);
242 builder.send()
243 };
244 gax::paginator::internal::new_paginator(token, execute)
245 }
246
247 /// Streams each item in the collection.
248 pub fn by_item(
249 self,
250 ) -> impl gax::paginator::ItemPaginator<
251 crate::model::ListOrgDataExchangesResponse,
252 gax::error::Error,
253 > {
254 use gax::paginator::Paginator;
255 self.by_page().items()
256 }
257
258 /// Sets the value of [organization][crate::model::ListOrgDataExchangesRequest::organization].
259 ///
260 /// This is a **required** field for requests.
261 pub fn set_organization<T: Into<std::string::String>>(mut self, v: T) -> Self {
262 self.0.request.organization = v.into();
263 self
264 }
265
266 /// Sets the value of [page_size][crate::model::ListOrgDataExchangesRequest::page_size].
267 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
268 self.0.request.page_size = v.into();
269 self
270 }
271
272 /// Sets the value of [page_token][crate::model::ListOrgDataExchangesRequest::page_token].
273 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
274 self.0.request.page_token = v.into();
275 self
276 }
277 }
278
279 #[doc(hidden)]
280 impl gax::options::internal::RequestBuilder for ListOrgDataExchanges {
281 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
282 &mut self.0.options
283 }
284 }
285
286 /// The request builder for [AnalyticsHubService::get_data_exchange][crate::client::AnalyticsHubService::get_data_exchange] calls.
287 ///
288 /// # Example
289 /// ```
290 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetDataExchange;
291 /// # async fn sample() -> gax::Result<()> {
292 ///
293 /// let builder = prepare_request_builder();
294 /// let response = builder.send().await?;
295 /// # Ok(()) }
296 ///
297 /// fn prepare_request_builder() -> GetDataExchange {
298 /// # panic!();
299 /// // ... details omitted ...
300 /// }
301 /// ```
302 #[derive(Clone, Debug)]
303 pub struct GetDataExchange(RequestBuilder<crate::model::GetDataExchangeRequest>);
304
305 impl GetDataExchange {
306 pub(crate) fn new(
307 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
308 ) -> Self {
309 Self(RequestBuilder::new(stub))
310 }
311
312 /// Sets the full request, replacing any prior values.
313 pub fn with_request<V: Into<crate::model::GetDataExchangeRequest>>(mut self, v: V) -> Self {
314 self.0.request = v.into();
315 self
316 }
317
318 /// Sets all the options, replacing any prior values.
319 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
320 self.0.options = v.into();
321 self
322 }
323
324 /// Sends the request.
325 pub async fn send(self) -> Result<crate::model::DataExchange> {
326 (*self.0.stub)
327 .get_data_exchange(self.0.request, self.0.options)
328 .await
329 .map(gax::response::Response::into_body)
330 }
331
332 /// Sets the value of [name][crate::model::GetDataExchangeRequest::name].
333 ///
334 /// This is a **required** field for requests.
335 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
336 self.0.request.name = v.into();
337 self
338 }
339 }
340
341 #[doc(hidden)]
342 impl gax::options::internal::RequestBuilder for GetDataExchange {
343 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
344 &mut self.0.options
345 }
346 }
347
348 /// The request builder for [AnalyticsHubService::create_data_exchange][crate::client::AnalyticsHubService::create_data_exchange] calls.
349 ///
350 /// # Example
351 /// ```
352 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::CreateDataExchange;
353 /// # async fn sample() -> gax::Result<()> {
354 ///
355 /// let builder = prepare_request_builder();
356 /// let response = builder.send().await?;
357 /// # Ok(()) }
358 ///
359 /// fn prepare_request_builder() -> CreateDataExchange {
360 /// # panic!();
361 /// // ... details omitted ...
362 /// }
363 /// ```
364 #[derive(Clone, Debug)]
365 pub struct CreateDataExchange(RequestBuilder<crate::model::CreateDataExchangeRequest>);
366
367 impl CreateDataExchange {
368 pub(crate) fn new(
369 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
370 ) -> Self {
371 Self(RequestBuilder::new(stub))
372 }
373
374 /// Sets the full request, replacing any prior values.
375 pub fn with_request<V: Into<crate::model::CreateDataExchangeRequest>>(
376 mut self,
377 v: V,
378 ) -> Self {
379 self.0.request = v.into();
380 self
381 }
382
383 /// Sets all the options, replacing any prior values.
384 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
385 self.0.options = v.into();
386 self
387 }
388
389 /// Sends the request.
390 pub async fn send(self) -> Result<crate::model::DataExchange> {
391 (*self.0.stub)
392 .create_data_exchange(self.0.request, self.0.options)
393 .await
394 .map(gax::response::Response::into_body)
395 }
396
397 /// Sets the value of [parent][crate::model::CreateDataExchangeRequest::parent].
398 ///
399 /// This is a **required** field for requests.
400 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
401 self.0.request.parent = v.into();
402 self
403 }
404
405 /// Sets the value of [data_exchange_id][crate::model::CreateDataExchangeRequest::data_exchange_id].
406 ///
407 /// This is a **required** field for requests.
408 pub fn set_data_exchange_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
409 self.0.request.data_exchange_id = v.into();
410 self
411 }
412
413 /// Sets the value of [data_exchange][crate::model::CreateDataExchangeRequest::data_exchange].
414 ///
415 /// This is a **required** field for requests.
416 pub fn set_data_exchange<T>(mut self, v: T) -> Self
417 where
418 T: std::convert::Into<crate::model::DataExchange>,
419 {
420 self.0.request.data_exchange = std::option::Option::Some(v.into());
421 self
422 }
423
424 /// Sets or clears the value of [data_exchange][crate::model::CreateDataExchangeRequest::data_exchange].
425 ///
426 /// This is a **required** field for requests.
427 pub fn set_or_clear_data_exchange<T>(mut self, v: std::option::Option<T>) -> Self
428 where
429 T: std::convert::Into<crate::model::DataExchange>,
430 {
431 self.0.request.data_exchange = v.map(|x| x.into());
432 self
433 }
434 }
435
436 #[doc(hidden)]
437 impl gax::options::internal::RequestBuilder for CreateDataExchange {
438 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
439 &mut self.0.options
440 }
441 }
442
443 /// The request builder for [AnalyticsHubService::update_data_exchange][crate::client::AnalyticsHubService::update_data_exchange] calls.
444 ///
445 /// # Example
446 /// ```
447 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::UpdateDataExchange;
448 /// # async fn sample() -> gax::Result<()> {
449 ///
450 /// let builder = prepare_request_builder();
451 /// let response = builder.send().await?;
452 /// # Ok(()) }
453 ///
454 /// fn prepare_request_builder() -> UpdateDataExchange {
455 /// # panic!();
456 /// // ... details omitted ...
457 /// }
458 /// ```
459 #[derive(Clone, Debug)]
460 pub struct UpdateDataExchange(RequestBuilder<crate::model::UpdateDataExchangeRequest>);
461
462 impl UpdateDataExchange {
463 pub(crate) fn new(
464 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
465 ) -> Self {
466 Self(RequestBuilder::new(stub))
467 }
468
469 /// Sets the full request, replacing any prior values.
470 pub fn with_request<V: Into<crate::model::UpdateDataExchangeRequest>>(
471 mut self,
472 v: V,
473 ) -> Self {
474 self.0.request = v.into();
475 self
476 }
477
478 /// Sets all the options, replacing any prior values.
479 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
480 self.0.options = v.into();
481 self
482 }
483
484 /// Sends the request.
485 pub async fn send(self) -> Result<crate::model::DataExchange> {
486 (*self.0.stub)
487 .update_data_exchange(self.0.request, self.0.options)
488 .await
489 .map(gax::response::Response::into_body)
490 }
491
492 /// Sets the value of [update_mask][crate::model::UpdateDataExchangeRequest::update_mask].
493 ///
494 /// This is a **required** field for requests.
495 pub fn set_update_mask<T>(mut self, v: T) -> Self
496 where
497 T: std::convert::Into<wkt::FieldMask>,
498 {
499 self.0.request.update_mask = std::option::Option::Some(v.into());
500 self
501 }
502
503 /// Sets or clears the value of [update_mask][crate::model::UpdateDataExchangeRequest::update_mask].
504 ///
505 /// This is a **required** field for requests.
506 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
507 where
508 T: std::convert::Into<wkt::FieldMask>,
509 {
510 self.0.request.update_mask = v.map(|x| x.into());
511 self
512 }
513
514 /// Sets the value of [data_exchange][crate::model::UpdateDataExchangeRequest::data_exchange].
515 ///
516 /// This is a **required** field for requests.
517 pub fn set_data_exchange<T>(mut self, v: T) -> Self
518 where
519 T: std::convert::Into<crate::model::DataExchange>,
520 {
521 self.0.request.data_exchange = std::option::Option::Some(v.into());
522 self
523 }
524
525 /// Sets or clears the value of [data_exchange][crate::model::UpdateDataExchangeRequest::data_exchange].
526 ///
527 /// This is a **required** field for requests.
528 pub fn set_or_clear_data_exchange<T>(mut self, v: std::option::Option<T>) -> Self
529 where
530 T: std::convert::Into<crate::model::DataExchange>,
531 {
532 self.0.request.data_exchange = v.map(|x| x.into());
533 self
534 }
535 }
536
537 #[doc(hidden)]
538 impl gax::options::internal::RequestBuilder for UpdateDataExchange {
539 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
540 &mut self.0.options
541 }
542 }
543
544 /// The request builder for [AnalyticsHubService::delete_data_exchange][crate::client::AnalyticsHubService::delete_data_exchange] calls.
545 ///
546 /// # Example
547 /// ```
548 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::DeleteDataExchange;
549 /// # async fn sample() -> gax::Result<()> {
550 ///
551 /// let builder = prepare_request_builder();
552 /// let response = builder.send().await?;
553 /// # Ok(()) }
554 ///
555 /// fn prepare_request_builder() -> DeleteDataExchange {
556 /// # panic!();
557 /// // ... details omitted ...
558 /// }
559 /// ```
560 #[derive(Clone, Debug)]
561 pub struct DeleteDataExchange(RequestBuilder<crate::model::DeleteDataExchangeRequest>);
562
563 impl DeleteDataExchange {
564 pub(crate) fn new(
565 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
566 ) -> Self {
567 Self(RequestBuilder::new(stub))
568 }
569
570 /// Sets the full request, replacing any prior values.
571 pub fn with_request<V: Into<crate::model::DeleteDataExchangeRequest>>(
572 mut self,
573 v: V,
574 ) -> Self {
575 self.0.request = v.into();
576 self
577 }
578
579 /// Sets all the options, replacing any prior values.
580 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
581 self.0.options = v.into();
582 self
583 }
584
585 /// Sends the request.
586 pub async fn send(self) -> Result<()> {
587 (*self.0.stub)
588 .delete_data_exchange(self.0.request, self.0.options)
589 .await
590 .map(gax::response::Response::into_body)
591 }
592
593 /// Sets the value of [name][crate::model::DeleteDataExchangeRequest::name].
594 ///
595 /// This is a **required** field for requests.
596 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
597 self.0.request.name = v.into();
598 self
599 }
600 }
601
602 #[doc(hidden)]
603 impl gax::options::internal::RequestBuilder for DeleteDataExchange {
604 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
605 &mut self.0.options
606 }
607 }
608
609 /// The request builder for [AnalyticsHubService::list_listings][crate::client::AnalyticsHubService::list_listings] calls.
610 ///
611 /// # Example
612 /// ```
613 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListListings;
614 /// # async fn sample() -> gax::Result<()> {
615 /// use gax::paginator::ItemPaginator;
616 ///
617 /// let builder = prepare_request_builder();
618 /// let mut items = builder.by_item();
619 /// while let Some(result) = items.next().await {
620 /// let item = result?;
621 /// }
622 /// # Ok(()) }
623 ///
624 /// fn prepare_request_builder() -> ListListings {
625 /// # panic!();
626 /// // ... details omitted ...
627 /// }
628 /// ```
629 #[derive(Clone, Debug)]
630 pub struct ListListings(RequestBuilder<crate::model::ListListingsRequest>);
631
632 impl ListListings {
633 pub(crate) fn new(
634 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
635 ) -> Self {
636 Self(RequestBuilder::new(stub))
637 }
638
639 /// Sets the full request, replacing any prior values.
640 pub fn with_request<V: Into<crate::model::ListListingsRequest>>(mut self, v: V) -> Self {
641 self.0.request = v.into();
642 self
643 }
644
645 /// Sets all the options, replacing any prior values.
646 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
647 self.0.options = v.into();
648 self
649 }
650
651 /// Sends the request.
652 pub async fn send(self) -> Result<crate::model::ListListingsResponse> {
653 (*self.0.stub)
654 .list_listings(self.0.request, self.0.options)
655 .await
656 .map(gax::response::Response::into_body)
657 }
658
659 /// Streams each page in the collection.
660 pub fn by_page(
661 self,
662 ) -> impl gax::paginator::Paginator<crate::model::ListListingsResponse, gax::error::Error>
663 {
664 use std::clone::Clone;
665 let token = self.0.request.page_token.clone();
666 let execute = move |token: String| {
667 let mut builder = self.clone();
668 builder.0.request = builder.0.request.set_page_token(token);
669 builder.send()
670 };
671 gax::paginator::internal::new_paginator(token, execute)
672 }
673
674 /// Streams each item in the collection.
675 pub fn by_item(
676 self,
677 ) -> impl gax::paginator::ItemPaginator<crate::model::ListListingsResponse, gax::error::Error>
678 {
679 use gax::paginator::Paginator;
680 self.by_page().items()
681 }
682
683 /// Sets the value of [parent][crate::model::ListListingsRequest::parent].
684 ///
685 /// This is a **required** field for requests.
686 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
687 self.0.request.parent = v.into();
688 self
689 }
690
691 /// Sets the value of [page_size][crate::model::ListListingsRequest::page_size].
692 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
693 self.0.request.page_size = v.into();
694 self
695 }
696
697 /// Sets the value of [page_token][crate::model::ListListingsRequest::page_token].
698 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
699 self.0.request.page_token = v.into();
700 self
701 }
702 }
703
704 #[doc(hidden)]
705 impl gax::options::internal::RequestBuilder for ListListings {
706 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
707 &mut self.0.options
708 }
709 }
710
711 /// The request builder for [AnalyticsHubService::get_listing][crate::client::AnalyticsHubService::get_listing] calls.
712 ///
713 /// # Example
714 /// ```
715 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetListing;
716 /// # async fn sample() -> gax::Result<()> {
717 ///
718 /// let builder = prepare_request_builder();
719 /// let response = builder.send().await?;
720 /// # Ok(()) }
721 ///
722 /// fn prepare_request_builder() -> GetListing {
723 /// # panic!();
724 /// // ... details omitted ...
725 /// }
726 /// ```
727 #[derive(Clone, Debug)]
728 pub struct GetListing(RequestBuilder<crate::model::GetListingRequest>);
729
730 impl GetListing {
731 pub(crate) fn new(
732 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
733 ) -> Self {
734 Self(RequestBuilder::new(stub))
735 }
736
737 /// Sets the full request, replacing any prior values.
738 pub fn with_request<V: Into<crate::model::GetListingRequest>>(mut self, v: V) -> Self {
739 self.0.request = v.into();
740 self
741 }
742
743 /// Sets all the options, replacing any prior values.
744 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
745 self.0.options = v.into();
746 self
747 }
748
749 /// Sends the request.
750 pub async fn send(self) -> Result<crate::model::Listing> {
751 (*self.0.stub)
752 .get_listing(self.0.request, self.0.options)
753 .await
754 .map(gax::response::Response::into_body)
755 }
756
757 /// Sets the value of [name][crate::model::GetListingRequest::name].
758 ///
759 /// This is a **required** field for requests.
760 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
761 self.0.request.name = v.into();
762 self
763 }
764 }
765
766 #[doc(hidden)]
767 impl gax::options::internal::RequestBuilder for GetListing {
768 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
769 &mut self.0.options
770 }
771 }
772
773 /// The request builder for [AnalyticsHubService::create_listing][crate::client::AnalyticsHubService::create_listing] calls.
774 ///
775 /// # Example
776 /// ```
777 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::CreateListing;
778 /// # async fn sample() -> gax::Result<()> {
779 ///
780 /// let builder = prepare_request_builder();
781 /// let response = builder.send().await?;
782 /// # Ok(()) }
783 ///
784 /// fn prepare_request_builder() -> CreateListing {
785 /// # panic!();
786 /// // ... details omitted ...
787 /// }
788 /// ```
789 #[derive(Clone, Debug)]
790 pub struct CreateListing(RequestBuilder<crate::model::CreateListingRequest>);
791
792 impl CreateListing {
793 pub(crate) fn new(
794 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
795 ) -> Self {
796 Self(RequestBuilder::new(stub))
797 }
798
799 /// Sets the full request, replacing any prior values.
800 pub fn with_request<V: Into<crate::model::CreateListingRequest>>(mut self, v: V) -> Self {
801 self.0.request = v.into();
802 self
803 }
804
805 /// Sets all the options, replacing any prior values.
806 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
807 self.0.options = v.into();
808 self
809 }
810
811 /// Sends the request.
812 pub async fn send(self) -> Result<crate::model::Listing> {
813 (*self.0.stub)
814 .create_listing(self.0.request, self.0.options)
815 .await
816 .map(gax::response::Response::into_body)
817 }
818
819 /// Sets the value of [parent][crate::model::CreateListingRequest::parent].
820 ///
821 /// This is a **required** field for requests.
822 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
823 self.0.request.parent = v.into();
824 self
825 }
826
827 /// Sets the value of [listing_id][crate::model::CreateListingRequest::listing_id].
828 ///
829 /// This is a **required** field for requests.
830 pub fn set_listing_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
831 self.0.request.listing_id = v.into();
832 self
833 }
834
835 /// Sets the value of [listing][crate::model::CreateListingRequest::listing].
836 ///
837 /// This is a **required** field for requests.
838 pub fn set_listing<T>(mut self, v: T) -> Self
839 where
840 T: std::convert::Into<crate::model::Listing>,
841 {
842 self.0.request.listing = std::option::Option::Some(v.into());
843 self
844 }
845
846 /// Sets or clears the value of [listing][crate::model::CreateListingRequest::listing].
847 ///
848 /// This is a **required** field for requests.
849 pub fn set_or_clear_listing<T>(mut self, v: std::option::Option<T>) -> Self
850 where
851 T: std::convert::Into<crate::model::Listing>,
852 {
853 self.0.request.listing = v.map(|x| x.into());
854 self
855 }
856 }
857
858 #[doc(hidden)]
859 impl gax::options::internal::RequestBuilder for CreateListing {
860 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
861 &mut self.0.options
862 }
863 }
864
865 /// The request builder for [AnalyticsHubService::update_listing][crate::client::AnalyticsHubService::update_listing] calls.
866 ///
867 /// # Example
868 /// ```
869 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::UpdateListing;
870 /// # async fn sample() -> gax::Result<()> {
871 ///
872 /// let builder = prepare_request_builder();
873 /// let response = builder.send().await?;
874 /// # Ok(()) }
875 ///
876 /// fn prepare_request_builder() -> UpdateListing {
877 /// # panic!();
878 /// // ... details omitted ...
879 /// }
880 /// ```
881 #[derive(Clone, Debug)]
882 pub struct UpdateListing(RequestBuilder<crate::model::UpdateListingRequest>);
883
884 impl UpdateListing {
885 pub(crate) fn new(
886 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
887 ) -> Self {
888 Self(RequestBuilder::new(stub))
889 }
890
891 /// Sets the full request, replacing any prior values.
892 pub fn with_request<V: Into<crate::model::UpdateListingRequest>>(mut self, v: V) -> Self {
893 self.0.request = v.into();
894 self
895 }
896
897 /// Sets all the options, replacing any prior values.
898 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
899 self.0.options = v.into();
900 self
901 }
902
903 /// Sends the request.
904 pub async fn send(self) -> Result<crate::model::Listing> {
905 (*self.0.stub)
906 .update_listing(self.0.request, self.0.options)
907 .await
908 .map(gax::response::Response::into_body)
909 }
910
911 /// Sets the value of [update_mask][crate::model::UpdateListingRequest::update_mask].
912 ///
913 /// This is a **required** field for requests.
914 pub fn set_update_mask<T>(mut self, v: T) -> Self
915 where
916 T: std::convert::Into<wkt::FieldMask>,
917 {
918 self.0.request.update_mask = std::option::Option::Some(v.into());
919 self
920 }
921
922 /// Sets or clears the value of [update_mask][crate::model::UpdateListingRequest::update_mask].
923 ///
924 /// This is a **required** field for requests.
925 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
926 where
927 T: std::convert::Into<wkt::FieldMask>,
928 {
929 self.0.request.update_mask = v.map(|x| x.into());
930 self
931 }
932
933 /// Sets the value of [listing][crate::model::UpdateListingRequest::listing].
934 ///
935 /// This is a **required** field for requests.
936 pub fn set_listing<T>(mut self, v: T) -> Self
937 where
938 T: std::convert::Into<crate::model::Listing>,
939 {
940 self.0.request.listing = std::option::Option::Some(v.into());
941 self
942 }
943
944 /// Sets or clears the value of [listing][crate::model::UpdateListingRequest::listing].
945 ///
946 /// This is a **required** field for requests.
947 pub fn set_or_clear_listing<T>(mut self, v: std::option::Option<T>) -> Self
948 where
949 T: std::convert::Into<crate::model::Listing>,
950 {
951 self.0.request.listing = v.map(|x| x.into());
952 self
953 }
954 }
955
956 #[doc(hidden)]
957 impl gax::options::internal::RequestBuilder for UpdateListing {
958 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
959 &mut self.0.options
960 }
961 }
962
963 /// The request builder for [AnalyticsHubService::delete_listing][crate::client::AnalyticsHubService::delete_listing] calls.
964 ///
965 /// # Example
966 /// ```
967 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::DeleteListing;
968 /// # async fn sample() -> gax::Result<()> {
969 ///
970 /// let builder = prepare_request_builder();
971 /// let response = builder.send().await?;
972 /// # Ok(()) }
973 ///
974 /// fn prepare_request_builder() -> DeleteListing {
975 /// # panic!();
976 /// // ... details omitted ...
977 /// }
978 /// ```
979 #[derive(Clone, Debug)]
980 pub struct DeleteListing(RequestBuilder<crate::model::DeleteListingRequest>);
981
982 impl DeleteListing {
983 pub(crate) fn new(
984 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
985 ) -> Self {
986 Self(RequestBuilder::new(stub))
987 }
988
989 /// Sets the full request, replacing any prior values.
990 pub fn with_request<V: Into<crate::model::DeleteListingRequest>>(mut self, v: V) -> Self {
991 self.0.request = v.into();
992 self
993 }
994
995 /// Sets all the options, replacing any prior values.
996 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
997 self.0.options = v.into();
998 self
999 }
1000
1001 /// Sends the request.
1002 pub async fn send(self) -> Result<()> {
1003 (*self.0.stub)
1004 .delete_listing(self.0.request, self.0.options)
1005 .await
1006 .map(gax::response::Response::into_body)
1007 }
1008
1009 /// Sets the value of [name][crate::model::DeleteListingRequest::name].
1010 ///
1011 /// This is a **required** field for requests.
1012 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1013 self.0.request.name = v.into();
1014 self
1015 }
1016
1017 /// Sets the value of [delete_commercial][crate::model::DeleteListingRequest::delete_commercial].
1018 pub fn set_delete_commercial<T: Into<bool>>(mut self, v: T) -> Self {
1019 self.0.request.delete_commercial = v.into();
1020 self
1021 }
1022 }
1023
1024 #[doc(hidden)]
1025 impl gax::options::internal::RequestBuilder for DeleteListing {
1026 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1027 &mut self.0.options
1028 }
1029 }
1030
1031 /// The request builder for [AnalyticsHubService::subscribe_listing][crate::client::AnalyticsHubService::subscribe_listing] calls.
1032 ///
1033 /// # Example
1034 /// ```
1035 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::SubscribeListing;
1036 /// # async fn sample() -> gax::Result<()> {
1037 ///
1038 /// let builder = prepare_request_builder();
1039 /// let response = builder.send().await?;
1040 /// # Ok(()) }
1041 ///
1042 /// fn prepare_request_builder() -> SubscribeListing {
1043 /// # panic!();
1044 /// // ... details omitted ...
1045 /// }
1046 /// ```
1047 #[derive(Clone, Debug)]
1048 pub struct SubscribeListing(RequestBuilder<crate::model::SubscribeListingRequest>);
1049
1050 impl SubscribeListing {
1051 pub(crate) fn new(
1052 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1053 ) -> Self {
1054 Self(RequestBuilder::new(stub))
1055 }
1056
1057 /// Sets the full request, replacing any prior values.
1058 pub fn with_request<V: Into<crate::model::SubscribeListingRequest>>(
1059 mut self,
1060 v: V,
1061 ) -> Self {
1062 self.0.request = v.into();
1063 self
1064 }
1065
1066 /// Sets all the options, replacing any prior values.
1067 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1068 self.0.options = v.into();
1069 self
1070 }
1071
1072 /// Sends the request.
1073 pub async fn send(self) -> Result<crate::model::SubscribeListingResponse> {
1074 (*self.0.stub)
1075 .subscribe_listing(self.0.request, self.0.options)
1076 .await
1077 .map(gax::response::Response::into_body)
1078 }
1079
1080 /// Sets the value of [name][crate::model::SubscribeListingRequest::name].
1081 ///
1082 /// This is a **required** field for requests.
1083 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1084 self.0.request.name = v.into();
1085 self
1086 }
1087
1088 /// Sets the value of [destination][crate::model::SubscribeListingRequest::destination].
1089 ///
1090 /// Note that all the setters affecting `destination` are
1091 /// mutually exclusive.
1092 pub fn set_destination<
1093 T: Into<Option<crate::model::subscribe_listing_request::Destination>>,
1094 >(
1095 mut self,
1096 v: T,
1097 ) -> Self {
1098 self.0.request.destination = v.into();
1099 self
1100 }
1101
1102 /// Sets the value of [destination][crate::model::SubscribeListingRequest::destination]
1103 /// to hold a `DestinationDataset`.
1104 ///
1105 /// Note that all the setters affecting `destination` are
1106 /// mutually exclusive.
1107 pub fn set_destination_dataset<
1108 T: std::convert::Into<std::boxed::Box<crate::model::DestinationDataset>>,
1109 >(
1110 mut self,
1111 v: T,
1112 ) -> Self {
1113 self.0.request = self.0.request.set_destination_dataset(v);
1114 self
1115 }
1116
1117 /// Sets the value of [destination][crate::model::SubscribeListingRequest::destination]
1118 /// to hold a `DestinationPubsubSubscription`.
1119 ///
1120 /// Note that all the setters affecting `destination` are
1121 /// mutually exclusive.
1122 pub fn set_destination_pubsub_subscription<
1123 T: std::convert::Into<std::boxed::Box<crate::model::DestinationPubSubSubscription>>,
1124 >(
1125 mut self,
1126 v: T,
1127 ) -> Self {
1128 self.0.request = self.0.request.set_destination_pubsub_subscription(v);
1129 self
1130 }
1131 }
1132
1133 #[doc(hidden)]
1134 impl gax::options::internal::RequestBuilder for SubscribeListing {
1135 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1136 &mut self.0.options
1137 }
1138 }
1139
1140 /// The request builder for [AnalyticsHubService::subscribe_data_exchange][crate::client::AnalyticsHubService::subscribe_data_exchange] calls.
1141 ///
1142 /// # Example
1143 /// ```
1144 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::SubscribeDataExchange;
1145 /// # async fn sample() -> gax::Result<()> {
1146 /// use lro::Poller;
1147 ///
1148 /// let builder = prepare_request_builder();
1149 /// let response = builder.poller().until_done().await?;
1150 /// # Ok(()) }
1151 ///
1152 /// fn prepare_request_builder() -> SubscribeDataExchange {
1153 /// # panic!();
1154 /// // ... details omitted ...
1155 /// }
1156 /// ```
1157 #[derive(Clone, Debug)]
1158 pub struct SubscribeDataExchange(RequestBuilder<crate::model::SubscribeDataExchangeRequest>);
1159
1160 impl SubscribeDataExchange {
1161 pub(crate) fn new(
1162 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1163 ) -> Self {
1164 Self(RequestBuilder::new(stub))
1165 }
1166
1167 /// Sets the full request, replacing any prior values.
1168 pub fn with_request<V: Into<crate::model::SubscribeDataExchangeRequest>>(
1169 mut self,
1170 v: V,
1171 ) -> Self {
1172 self.0.request = v.into();
1173 self
1174 }
1175
1176 /// Sets all the options, replacing any prior values.
1177 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1178 self.0.options = v.into();
1179 self
1180 }
1181
1182 /// Sends the request.
1183 ///
1184 /// # Long running operations
1185 ///
1186 /// This starts, but does not poll, a longrunning operation. More information
1187 /// on [subscribe_data_exchange][crate::client::AnalyticsHubService::subscribe_data_exchange].
1188 pub async fn send(self) -> Result<longrunning::model::Operation> {
1189 (*self.0.stub)
1190 .subscribe_data_exchange(self.0.request, self.0.options)
1191 .await
1192 .map(gax::response::Response::into_body)
1193 }
1194
1195 /// Creates a [Poller][lro::Poller] to work with `subscribe_data_exchange`.
1196 pub fn poller(
1197 self,
1198 ) -> impl lro::Poller<crate::model::SubscribeDataExchangeResponse, crate::model::OperationMetadata>
1199 {
1200 type Operation = lro::internal::Operation<
1201 crate::model::SubscribeDataExchangeResponse,
1202 crate::model::OperationMetadata,
1203 >;
1204 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1205 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1206
1207 let stub = self.0.stub.clone();
1208 let mut options = self.0.options.clone();
1209 options.set_retry_policy(gax::retry_policy::NeverRetry);
1210 let query = move |name| {
1211 let stub = stub.clone();
1212 let options = options.clone();
1213 async {
1214 let op = GetOperation::new(stub)
1215 .set_name(name)
1216 .with_options(options)
1217 .send()
1218 .await?;
1219 Ok(Operation::new(op))
1220 }
1221 };
1222
1223 let start = move || async {
1224 let op = self.send().await?;
1225 Ok(Operation::new(op))
1226 };
1227
1228 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1229 }
1230
1231 /// Sets the value of [name][crate::model::SubscribeDataExchangeRequest::name].
1232 ///
1233 /// This is a **required** field for requests.
1234 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1235 self.0.request.name = v.into();
1236 self
1237 }
1238
1239 /// Sets the value of [destination][crate::model::SubscribeDataExchangeRequest::destination].
1240 ///
1241 /// This is a **required** field for requests.
1242 pub fn set_destination<T: Into<std::string::String>>(mut self, v: T) -> Self {
1243 self.0.request.destination = v.into();
1244 self
1245 }
1246
1247 /// Sets the value of [destination_dataset][crate::model::SubscribeDataExchangeRequest::destination_dataset].
1248 pub fn set_destination_dataset<T>(mut self, v: T) -> Self
1249 where
1250 T: std::convert::Into<crate::model::DestinationDataset>,
1251 {
1252 self.0.request.destination_dataset = std::option::Option::Some(v.into());
1253 self
1254 }
1255
1256 /// Sets or clears the value of [destination_dataset][crate::model::SubscribeDataExchangeRequest::destination_dataset].
1257 pub fn set_or_clear_destination_dataset<T>(mut self, v: std::option::Option<T>) -> Self
1258 where
1259 T: std::convert::Into<crate::model::DestinationDataset>,
1260 {
1261 self.0.request.destination_dataset = v.map(|x| x.into());
1262 self
1263 }
1264
1265 /// Sets the value of [subscription][crate::model::SubscribeDataExchangeRequest::subscription].
1266 ///
1267 /// This is a **required** field for requests.
1268 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1269 self.0.request.subscription = v.into();
1270 self
1271 }
1272
1273 /// Sets the value of [subscriber_contact][crate::model::SubscribeDataExchangeRequest::subscriber_contact].
1274 pub fn set_subscriber_contact<T: Into<std::string::String>>(mut self, v: T) -> Self {
1275 self.0.request.subscriber_contact = v.into();
1276 self
1277 }
1278 }
1279
1280 #[doc(hidden)]
1281 impl gax::options::internal::RequestBuilder for SubscribeDataExchange {
1282 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1283 &mut self.0.options
1284 }
1285 }
1286
1287 /// The request builder for [AnalyticsHubService::refresh_subscription][crate::client::AnalyticsHubService::refresh_subscription] calls.
1288 ///
1289 /// # Example
1290 /// ```
1291 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::RefreshSubscription;
1292 /// # async fn sample() -> gax::Result<()> {
1293 /// use lro::Poller;
1294 ///
1295 /// let builder = prepare_request_builder();
1296 /// let response = builder.poller().until_done().await?;
1297 /// # Ok(()) }
1298 ///
1299 /// fn prepare_request_builder() -> RefreshSubscription {
1300 /// # panic!();
1301 /// // ... details omitted ...
1302 /// }
1303 /// ```
1304 #[derive(Clone, Debug)]
1305 pub struct RefreshSubscription(RequestBuilder<crate::model::RefreshSubscriptionRequest>);
1306
1307 impl RefreshSubscription {
1308 pub(crate) fn new(
1309 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1310 ) -> Self {
1311 Self(RequestBuilder::new(stub))
1312 }
1313
1314 /// Sets the full request, replacing any prior values.
1315 pub fn with_request<V: Into<crate::model::RefreshSubscriptionRequest>>(
1316 mut self,
1317 v: V,
1318 ) -> Self {
1319 self.0.request = v.into();
1320 self
1321 }
1322
1323 /// Sets all the options, replacing any prior values.
1324 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1325 self.0.options = v.into();
1326 self
1327 }
1328
1329 /// Sends the request.
1330 ///
1331 /// # Long running operations
1332 ///
1333 /// This starts, but does not poll, a longrunning operation. More information
1334 /// on [refresh_subscription][crate::client::AnalyticsHubService::refresh_subscription].
1335 pub async fn send(self) -> Result<longrunning::model::Operation> {
1336 (*self.0.stub)
1337 .refresh_subscription(self.0.request, self.0.options)
1338 .await
1339 .map(gax::response::Response::into_body)
1340 }
1341
1342 /// Creates a [Poller][lro::Poller] to work with `refresh_subscription`.
1343 pub fn poller(
1344 self,
1345 ) -> impl lro::Poller<crate::model::RefreshSubscriptionResponse, crate::model::OperationMetadata>
1346 {
1347 type Operation = lro::internal::Operation<
1348 crate::model::RefreshSubscriptionResponse,
1349 crate::model::OperationMetadata,
1350 >;
1351 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1352 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1353
1354 let stub = self.0.stub.clone();
1355 let mut options = self.0.options.clone();
1356 options.set_retry_policy(gax::retry_policy::NeverRetry);
1357 let query = move |name| {
1358 let stub = stub.clone();
1359 let options = options.clone();
1360 async {
1361 let op = GetOperation::new(stub)
1362 .set_name(name)
1363 .with_options(options)
1364 .send()
1365 .await?;
1366 Ok(Operation::new(op))
1367 }
1368 };
1369
1370 let start = move || async {
1371 let op = self.send().await?;
1372 Ok(Operation::new(op))
1373 };
1374
1375 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1376 }
1377
1378 /// Sets the value of [name][crate::model::RefreshSubscriptionRequest::name].
1379 ///
1380 /// This is a **required** field for requests.
1381 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1382 self.0.request.name = v.into();
1383 self
1384 }
1385 }
1386
1387 #[doc(hidden)]
1388 impl gax::options::internal::RequestBuilder for RefreshSubscription {
1389 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1390 &mut self.0.options
1391 }
1392 }
1393
1394 /// The request builder for [AnalyticsHubService::get_subscription][crate::client::AnalyticsHubService::get_subscription] calls.
1395 ///
1396 /// # Example
1397 /// ```
1398 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetSubscription;
1399 /// # async fn sample() -> gax::Result<()> {
1400 ///
1401 /// let builder = prepare_request_builder();
1402 /// let response = builder.send().await?;
1403 /// # Ok(()) }
1404 ///
1405 /// fn prepare_request_builder() -> GetSubscription {
1406 /// # panic!();
1407 /// // ... details omitted ...
1408 /// }
1409 /// ```
1410 #[derive(Clone, Debug)]
1411 pub struct GetSubscription(RequestBuilder<crate::model::GetSubscriptionRequest>);
1412
1413 impl GetSubscription {
1414 pub(crate) fn new(
1415 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1416 ) -> Self {
1417 Self(RequestBuilder::new(stub))
1418 }
1419
1420 /// Sets the full request, replacing any prior values.
1421 pub fn with_request<V: Into<crate::model::GetSubscriptionRequest>>(mut self, v: V) -> Self {
1422 self.0.request = v.into();
1423 self
1424 }
1425
1426 /// Sets all the options, replacing any prior values.
1427 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1428 self.0.options = v.into();
1429 self
1430 }
1431
1432 /// Sends the request.
1433 pub async fn send(self) -> Result<crate::model::Subscription> {
1434 (*self.0.stub)
1435 .get_subscription(self.0.request, self.0.options)
1436 .await
1437 .map(gax::response::Response::into_body)
1438 }
1439
1440 /// Sets the value of [name][crate::model::GetSubscriptionRequest::name].
1441 ///
1442 /// This is a **required** field for requests.
1443 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1444 self.0.request.name = v.into();
1445 self
1446 }
1447 }
1448
1449 #[doc(hidden)]
1450 impl gax::options::internal::RequestBuilder for GetSubscription {
1451 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1452 &mut self.0.options
1453 }
1454 }
1455
1456 /// The request builder for [AnalyticsHubService::list_subscriptions][crate::client::AnalyticsHubService::list_subscriptions] calls.
1457 ///
1458 /// # Example
1459 /// ```
1460 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListSubscriptions;
1461 /// # async fn sample() -> gax::Result<()> {
1462 /// use gax::paginator::ItemPaginator;
1463 ///
1464 /// let builder = prepare_request_builder();
1465 /// let mut items = builder.by_item();
1466 /// while let Some(result) = items.next().await {
1467 /// let item = result?;
1468 /// }
1469 /// # Ok(()) }
1470 ///
1471 /// fn prepare_request_builder() -> ListSubscriptions {
1472 /// # panic!();
1473 /// // ... details omitted ...
1474 /// }
1475 /// ```
1476 #[derive(Clone, Debug)]
1477 pub struct ListSubscriptions(RequestBuilder<crate::model::ListSubscriptionsRequest>);
1478
1479 impl ListSubscriptions {
1480 pub(crate) fn new(
1481 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1482 ) -> Self {
1483 Self(RequestBuilder::new(stub))
1484 }
1485
1486 /// Sets the full request, replacing any prior values.
1487 pub fn with_request<V: Into<crate::model::ListSubscriptionsRequest>>(
1488 mut self,
1489 v: V,
1490 ) -> Self {
1491 self.0.request = v.into();
1492 self
1493 }
1494
1495 /// Sets all the options, replacing any prior values.
1496 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1497 self.0.options = v.into();
1498 self
1499 }
1500
1501 /// Sends the request.
1502 pub async fn send(self) -> Result<crate::model::ListSubscriptionsResponse> {
1503 (*self.0.stub)
1504 .list_subscriptions(self.0.request, self.0.options)
1505 .await
1506 .map(gax::response::Response::into_body)
1507 }
1508
1509 /// Streams each page in the collection.
1510 pub fn by_page(
1511 self,
1512 ) -> impl gax::paginator::Paginator<crate::model::ListSubscriptionsResponse, gax::error::Error>
1513 {
1514 use std::clone::Clone;
1515 let token = self.0.request.page_token.clone();
1516 let execute = move |token: String| {
1517 let mut builder = self.clone();
1518 builder.0.request = builder.0.request.set_page_token(token);
1519 builder.send()
1520 };
1521 gax::paginator::internal::new_paginator(token, execute)
1522 }
1523
1524 /// Streams each item in the collection.
1525 pub fn by_item(
1526 self,
1527 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSubscriptionsResponse, gax::error::Error>
1528 {
1529 use gax::paginator::Paginator;
1530 self.by_page().items()
1531 }
1532
1533 /// Sets the value of [parent][crate::model::ListSubscriptionsRequest::parent].
1534 ///
1535 /// This is a **required** field for requests.
1536 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1537 self.0.request.parent = v.into();
1538 self
1539 }
1540
1541 /// Sets the value of [filter][crate::model::ListSubscriptionsRequest::filter].
1542 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1543 self.0.request.filter = v.into();
1544 self
1545 }
1546
1547 /// Sets the value of [page_size][crate::model::ListSubscriptionsRequest::page_size].
1548 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1549 self.0.request.page_size = v.into();
1550 self
1551 }
1552
1553 /// Sets the value of [page_token][crate::model::ListSubscriptionsRequest::page_token].
1554 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1555 self.0.request.page_token = v.into();
1556 self
1557 }
1558 }
1559
1560 #[doc(hidden)]
1561 impl gax::options::internal::RequestBuilder for ListSubscriptions {
1562 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1563 &mut self.0.options
1564 }
1565 }
1566
1567 /// The request builder for [AnalyticsHubService::list_shared_resource_subscriptions][crate::client::AnalyticsHubService::list_shared_resource_subscriptions] calls.
1568 ///
1569 /// # Example
1570 /// ```
1571 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListSharedResourceSubscriptions;
1572 /// # async fn sample() -> gax::Result<()> {
1573 /// use gax::paginator::ItemPaginator;
1574 ///
1575 /// let builder = prepare_request_builder();
1576 /// let mut items = builder.by_item();
1577 /// while let Some(result) = items.next().await {
1578 /// let item = result?;
1579 /// }
1580 /// # Ok(()) }
1581 ///
1582 /// fn prepare_request_builder() -> ListSharedResourceSubscriptions {
1583 /// # panic!();
1584 /// // ... details omitted ...
1585 /// }
1586 /// ```
1587 #[derive(Clone, Debug)]
1588 pub struct ListSharedResourceSubscriptions(
1589 RequestBuilder<crate::model::ListSharedResourceSubscriptionsRequest>,
1590 );
1591
1592 impl ListSharedResourceSubscriptions {
1593 pub(crate) fn new(
1594 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1595 ) -> Self {
1596 Self(RequestBuilder::new(stub))
1597 }
1598
1599 /// Sets the full request, replacing any prior values.
1600 pub fn with_request<V: Into<crate::model::ListSharedResourceSubscriptionsRequest>>(
1601 mut self,
1602 v: V,
1603 ) -> Self {
1604 self.0.request = v.into();
1605 self
1606 }
1607
1608 /// Sets all the options, replacing any prior values.
1609 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1610 self.0.options = v.into();
1611 self
1612 }
1613
1614 /// Sends the request.
1615 pub async fn send(self) -> Result<crate::model::ListSharedResourceSubscriptionsResponse> {
1616 (*self.0.stub)
1617 .list_shared_resource_subscriptions(self.0.request, self.0.options)
1618 .await
1619 .map(gax::response::Response::into_body)
1620 }
1621
1622 /// Streams each page in the collection.
1623 pub fn by_page(
1624 self,
1625 ) -> impl gax::paginator::Paginator<
1626 crate::model::ListSharedResourceSubscriptionsResponse,
1627 gax::error::Error,
1628 > {
1629 use std::clone::Clone;
1630 let token = self.0.request.page_token.clone();
1631 let execute = move |token: String| {
1632 let mut builder = self.clone();
1633 builder.0.request = builder.0.request.set_page_token(token);
1634 builder.send()
1635 };
1636 gax::paginator::internal::new_paginator(token, execute)
1637 }
1638
1639 /// Streams each item in the collection.
1640 pub fn by_item(
1641 self,
1642 ) -> impl gax::paginator::ItemPaginator<
1643 crate::model::ListSharedResourceSubscriptionsResponse,
1644 gax::error::Error,
1645 > {
1646 use gax::paginator::Paginator;
1647 self.by_page().items()
1648 }
1649
1650 /// Sets the value of [resource][crate::model::ListSharedResourceSubscriptionsRequest::resource].
1651 ///
1652 /// This is a **required** field for requests.
1653 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.0.request.resource = v.into();
1655 self
1656 }
1657
1658 /// Sets the value of [include_deleted_subscriptions][crate::model::ListSharedResourceSubscriptionsRequest::include_deleted_subscriptions].
1659 pub fn set_include_deleted_subscriptions<T: Into<bool>>(mut self, v: T) -> Self {
1660 self.0.request.include_deleted_subscriptions = v.into();
1661 self
1662 }
1663
1664 /// Sets the value of [page_size][crate::model::ListSharedResourceSubscriptionsRequest::page_size].
1665 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1666 self.0.request.page_size = v.into();
1667 self
1668 }
1669
1670 /// Sets the value of [page_token][crate::model::ListSharedResourceSubscriptionsRequest::page_token].
1671 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1672 self.0.request.page_token = v.into();
1673 self
1674 }
1675 }
1676
1677 #[doc(hidden)]
1678 impl gax::options::internal::RequestBuilder for ListSharedResourceSubscriptions {
1679 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1680 &mut self.0.options
1681 }
1682 }
1683
1684 /// The request builder for [AnalyticsHubService::revoke_subscription][crate::client::AnalyticsHubService::revoke_subscription] calls.
1685 ///
1686 /// # Example
1687 /// ```
1688 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::RevokeSubscription;
1689 /// # async fn sample() -> gax::Result<()> {
1690 ///
1691 /// let builder = prepare_request_builder();
1692 /// let response = builder.send().await?;
1693 /// # Ok(()) }
1694 ///
1695 /// fn prepare_request_builder() -> RevokeSubscription {
1696 /// # panic!();
1697 /// // ... details omitted ...
1698 /// }
1699 /// ```
1700 #[derive(Clone, Debug)]
1701 pub struct RevokeSubscription(RequestBuilder<crate::model::RevokeSubscriptionRequest>);
1702
1703 impl RevokeSubscription {
1704 pub(crate) fn new(
1705 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1706 ) -> Self {
1707 Self(RequestBuilder::new(stub))
1708 }
1709
1710 /// Sets the full request, replacing any prior values.
1711 pub fn with_request<V: Into<crate::model::RevokeSubscriptionRequest>>(
1712 mut self,
1713 v: V,
1714 ) -> Self {
1715 self.0.request = v.into();
1716 self
1717 }
1718
1719 /// Sets all the options, replacing any prior values.
1720 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1721 self.0.options = v.into();
1722 self
1723 }
1724
1725 /// Sends the request.
1726 pub async fn send(self) -> Result<crate::model::RevokeSubscriptionResponse> {
1727 (*self.0.stub)
1728 .revoke_subscription(self.0.request, self.0.options)
1729 .await
1730 .map(gax::response::Response::into_body)
1731 }
1732
1733 /// Sets the value of [name][crate::model::RevokeSubscriptionRequest::name].
1734 ///
1735 /// This is a **required** field for requests.
1736 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1737 self.0.request.name = v.into();
1738 self
1739 }
1740
1741 /// Sets the value of [revoke_commercial][crate::model::RevokeSubscriptionRequest::revoke_commercial].
1742 pub fn set_revoke_commercial<T: Into<bool>>(mut self, v: T) -> Self {
1743 self.0.request.revoke_commercial = v.into();
1744 self
1745 }
1746 }
1747
1748 #[doc(hidden)]
1749 impl gax::options::internal::RequestBuilder for RevokeSubscription {
1750 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1751 &mut self.0.options
1752 }
1753 }
1754
1755 /// The request builder for [AnalyticsHubService::delete_subscription][crate::client::AnalyticsHubService::delete_subscription] calls.
1756 ///
1757 /// # Example
1758 /// ```
1759 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::DeleteSubscription;
1760 /// # async fn sample() -> gax::Result<()> {
1761 /// use lro::Poller;
1762 ///
1763 /// let builder = prepare_request_builder();
1764 /// let response = builder.poller().until_done().await?;
1765 /// # Ok(()) }
1766 ///
1767 /// fn prepare_request_builder() -> DeleteSubscription {
1768 /// # panic!();
1769 /// // ... details omitted ...
1770 /// }
1771 /// ```
1772 #[derive(Clone, Debug)]
1773 pub struct DeleteSubscription(RequestBuilder<crate::model::DeleteSubscriptionRequest>);
1774
1775 impl DeleteSubscription {
1776 pub(crate) fn new(
1777 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1778 ) -> Self {
1779 Self(RequestBuilder::new(stub))
1780 }
1781
1782 /// Sets the full request, replacing any prior values.
1783 pub fn with_request<V: Into<crate::model::DeleteSubscriptionRequest>>(
1784 mut self,
1785 v: V,
1786 ) -> Self {
1787 self.0.request = v.into();
1788 self
1789 }
1790
1791 /// Sets all the options, replacing any prior values.
1792 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1793 self.0.options = v.into();
1794 self
1795 }
1796
1797 /// Sends the request.
1798 ///
1799 /// # Long running operations
1800 ///
1801 /// This starts, but does not poll, a longrunning operation. More information
1802 /// on [delete_subscription][crate::client::AnalyticsHubService::delete_subscription].
1803 pub async fn send(self) -> Result<longrunning::model::Operation> {
1804 (*self.0.stub)
1805 .delete_subscription(self.0.request, self.0.options)
1806 .await
1807 .map(gax::response::Response::into_body)
1808 }
1809
1810 /// Creates a [Poller][lro::Poller] to work with `delete_subscription`.
1811 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1812 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1813 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1814 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1815
1816 let stub = self.0.stub.clone();
1817 let mut options = self.0.options.clone();
1818 options.set_retry_policy(gax::retry_policy::NeverRetry);
1819 let query = move |name| {
1820 let stub = stub.clone();
1821 let options = options.clone();
1822 async {
1823 let op = GetOperation::new(stub)
1824 .set_name(name)
1825 .with_options(options)
1826 .send()
1827 .await?;
1828 Ok(Operation::new(op))
1829 }
1830 };
1831
1832 let start = move || async {
1833 let op = self.send().await?;
1834 Ok(Operation::new(op))
1835 };
1836
1837 lro::internal::new_unit_response_poller(
1838 polling_error_policy,
1839 polling_backoff_policy,
1840 start,
1841 query,
1842 )
1843 }
1844
1845 /// Sets the value of [name][crate::model::DeleteSubscriptionRequest::name].
1846 ///
1847 /// This is a **required** field for requests.
1848 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1849 self.0.request.name = v.into();
1850 self
1851 }
1852 }
1853
1854 #[doc(hidden)]
1855 impl gax::options::internal::RequestBuilder for DeleteSubscription {
1856 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1857 &mut self.0.options
1858 }
1859 }
1860
1861 /// The request builder for [AnalyticsHubService::get_iam_policy][crate::client::AnalyticsHubService::get_iam_policy] calls.
1862 ///
1863 /// # Example
1864 /// ```
1865 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetIamPolicy;
1866 /// # async fn sample() -> gax::Result<()> {
1867 ///
1868 /// let builder = prepare_request_builder();
1869 /// let response = builder.send().await?;
1870 /// # Ok(()) }
1871 ///
1872 /// fn prepare_request_builder() -> GetIamPolicy {
1873 /// # panic!();
1874 /// // ... details omitted ...
1875 /// }
1876 /// ```
1877 #[derive(Clone, Debug)]
1878 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1879
1880 impl GetIamPolicy {
1881 pub(crate) fn new(
1882 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1883 ) -> Self {
1884 Self(RequestBuilder::new(stub))
1885 }
1886
1887 /// Sets the full request, replacing any prior values.
1888 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1889 self.0.request = v.into();
1890 self
1891 }
1892
1893 /// Sets all the options, replacing any prior values.
1894 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1895 self.0.options = v.into();
1896 self
1897 }
1898
1899 /// Sends the request.
1900 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1901 (*self.0.stub)
1902 .get_iam_policy(self.0.request, self.0.options)
1903 .await
1904 .map(gax::response::Response::into_body)
1905 }
1906
1907 /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1908 ///
1909 /// This is a **required** field for requests.
1910 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1911 self.0.request.resource = v.into();
1912 self
1913 }
1914
1915 /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1916 pub fn set_options<T>(mut self, v: T) -> Self
1917 where
1918 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1919 {
1920 self.0.request.options = std::option::Option::Some(v.into());
1921 self
1922 }
1923
1924 /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1925 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1926 where
1927 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1928 {
1929 self.0.request.options = v.map(|x| x.into());
1930 self
1931 }
1932 }
1933
1934 #[doc(hidden)]
1935 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1936 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1937 &mut self.0.options
1938 }
1939 }
1940
1941 /// The request builder for [AnalyticsHubService::set_iam_policy][crate::client::AnalyticsHubService::set_iam_policy] calls.
1942 ///
1943 /// # Example
1944 /// ```
1945 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::SetIamPolicy;
1946 /// # async fn sample() -> gax::Result<()> {
1947 ///
1948 /// let builder = prepare_request_builder();
1949 /// let response = builder.send().await?;
1950 /// # Ok(()) }
1951 ///
1952 /// fn prepare_request_builder() -> SetIamPolicy {
1953 /// # panic!();
1954 /// // ... details omitted ...
1955 /// }
1956 /// ```
1957 #[derive(Clone, Debug)]
1958 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1959
1960 impl SetIamPolicy {
1961 pub(crate) fn new(
1962 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1963 ) -> Self {
1964 Self(RequestBuilder::new(stub))
1965 }
1966
1967 /// Sets the full request, replacing any prior values.
1968 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1969 self.0.request = v.into();
1970 self
1971 }
1972
1973 /// Sets all the options, replacing any prior values.
1974 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1975 self.0.options = v.into();
1976 self
1977 }
1978
1979 /// Sends the request.
1980 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1981 (*self.0.stub)
1982 .set_iam_policy(self.0.request, self.0.options)
1983 .await
1984 .map(gax::response::Response::into_body)
1985 }
1986
1987 /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1988 ///
1989 /// This is a **required** field for requests.
1990 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1991 self.0.request.resource = v.into();
1992 self
1993 }
1994
1995 /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1996 ///
1997 /// This is a **required** field for requests.
1998 pub fn set_policy<T>(mut self, v: T) -> Self
1999 where
2000 T: std::convert::Into<iam_v1::model::Policy>,
2001 {
2002 self.0.request.policy = std::option::Option::Some(v.into());
2003 self
2004 }
2005
2006 /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2007 ///
2008 /// This is a **required** field for requests.
2009 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2010 where
2011 T: std::convert::Into<iam_v1::model::Policy>,
2012 {
2013 self.0.request.policy = v.map(|x| x.into());
2014 self
2015 }
2016
2017 /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2018 pub fn set_update_mask<T>(mut self, v: T) -> Self
2019 where
2020 T: std::convert::Into<wkt::FieldMask>,
2021 {
2022 self.0.request.update_mask = std::option::Option::Some(v.into());
2023 self
2024 }
2025
2026 /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2027 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2028 where
2029 T: std::convert::Into<wkt::FieldMask>,
2030 {
2031 self.0.request.update_mask = v.map(|x| x.into());
2032 self
2033 }
2034 }
2035
2036 #[doc(hidden)]
2037 impl gax::options::internal::RequestBuilder for SetIamPolicy {
2038 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2039 &mut self.0.options
2040 }
2041 }
2042
2043 /// The request builder for [AnalyticsHubService::test_iam_permissions][crate::client::AnalyticsHubService::test_iam_permissions] calls.
2044 ///
2045 /// # Example
2046 /// ```
2047 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::TestIamPermissions;
2048 /// # async fn sample() -> gax::Result<()> {
2049 ///
2050 /// let builder = prepare_request_builder();
2051 /// let response = builder.send().await?;
2052 /// # Ok(()) }
2053 ///
2054 /// fn prepare_request_builder() -> TestIamPermissions {
2055 /// # panic!();
2056 /// // ... details omitted ...
2057 /// }
2058 /// ```
2059 #[derive(Clone, Debug)]
2060 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2061
2062 impl TestIamPermissions {
2063 pub(crate) fn new(
2064 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2065 ) -> Self {
2066 Self(RequestBuilder::new(stub))
2067 }
2068
2069 /// Sets the full request, replacing any prior values.
2070 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2071 mut self,
2072 v: V,
2073 ) -> Self {
2074 self.0.request = v.into();
2075 self
2076 }
2077
2078 /// Sets all the options, replacing any prior values.
2079 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2080 self.0.options = v.into();
2081 self
2082 }
2083
2084 /// Sends the request.
2085 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2086 (*self.0.stub)
2087 .test_iam_permissions(self.0.request, self.0.options)
2088 .await
2089 .map(gax::response::Response::into_body)
2090 }
2091
2092 /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
2093 ///
2094 /// This is a **required** field for requests.
2095 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2096 self.0.request.resource = v.into();
2097 self
2098 }
2099
2100 /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
2101 ///
2102 /// This is a **required** field for requests.
2103 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2104 where
2105 T: std::iter::IntoIterator<Item = V>,
2106 V: std::convert::Into<std::string::String>,
2107 {
2108 use std::iter::Iterator;
2109 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2110 self
2111 }
2112 }
2113
2114 #[doc(hidden)]
2115 impl gax::options::internal::RequestBuilder for TestIamPermissions {
2116 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2117 &mut self.0.options
2118 }
2119 }
2120
2121 /// The request builder for [AnalyticsHubService::create_query_template][crate::client::AnalyticsHubService::create_query_template] calls.
2122 ///
2123 /// # Example
2124 /// ```
2125 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::CreateQueryTemplate;
2126 /// # async fn sample() -> gax::Result<()> {
2127 ///
2128 /// let builder = prepare_request_builder();
2129 /// let response = builder.send().await?;
2130 /// # Ok(()) }
2131 ///
2132 /// fn prepare_request_builder() -> CreateQueryTemplate {
2133 /// # panic!();
2134 /// // ... details omitted ...
2135 /// }
2136 /// ```
2137 #[derive(Clone, Debug)]
2138 pub struct CreateQueryTemplate(RequestBuilder<crate::model::CreateQueryTemplateRequest>);
2139
2140 impl CreateQueryTemplate {
2141 pub(crate) fn new(
2142 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2143 ) -> Self {
2144 Self(RequestBuilder::new(stub))
2145 }
2146
2147 /// Sets the full request, replacing any prior values.
2148 pub fn with_request<V: Into<crate::model::CreateQueryTemplateRequest>>(
2149 mut self,
2150 v: V,
2151 ) -> Self {
2152 self.0.request = v.into();
2153 self
2154 }
2155
2156 /// Sets all the options, replacing any prior values.
2157 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2158 self.0.options = v.into();
2159 self
2160 }
2161
2162 /// Sends the request.
2163 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2164 (*self.0.stub)
2165 .create_query_template(self.0.request, self.0.options)
2166 .await
2167 .map(gax::response::Response::into_body)
2168 }
2169
2170 /// Sets the value of [parent][crate::model::CreateQueryTemplateRequest::parent].
2171 ///
2172 /// This is a **required** field for requests.
2173 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2174 self.0.request.parent = v.into();
2175 self
2176 }
2177
2178 /// Sets the value of [query_template_id][crate::model::CreateQueryTemplateRequest::query_template_id].
2179 ///
2180 /// This is a **required** field for requests.
2181 pub fn set_query_template_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2182 self.0.request.query_template_id = v.into();
2183 self
2184 }
2185
2186 /// Sets the value of [query_template][crate::model::CreateQueryTemplateRequest::query_template].
2187 ///
2188 /// This is a **required** field for requests.
2189 pub fn set_query_template<T>(mut self, v: T) -> Self
2190 where
2191 T: std::convert::Into<crate::model::QueryTemplate>,
2192 {
2193 self.0.request.query_template = std::option::Option::Some(v.into());
2194 self
2195 }
2196
2197 /// Sets or clears the value of [query_template][crate::model::CreateQueryTemplateRequest::query_template].
2198 ///
2199 /// This is a **required** field for requests.
2200 pub fn set_or_clear_query_template<T>(mut self, v: std::option::Option<T>) -> Self
2201 where
2202 T: std::convert::Into<crate::model::QueryTemplate>,
2203 {
2204 self.0.request.query_template = v.map(|x| x.into());
2205 self
2206 }
2207 }
2208
2209 #[doc(hidden)]
2210 impl gax::options::internal::RequestBuilder for CreateQueryTemplate {
2211 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2212 &mut self.0.options
2213 }
2214 }
2215
2216 /// The request builder for [AnalyticsHubService::get_query_template][crate::client::AnalyticsHubService::get_query_template] calls.
2217 ///
2218 /// # Example
2219 /// ```
2220 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetQueryTemplate;
2221 /// # async fn sample() -> gax::Result<()> {
2222 ///
2223 /// let builder = prepare_request_builder();
2224 /// let response = builder.send().await?;
2225 /// # Ok(()) }
2226 ///
2227 /// fn prepare_request_builder() -> GetQueryTemplate {
2228 /// # panic!();
2229 /// // ... details omitted ...
2230 /// }
2231 /// ```
2232 #[derive(Clone, Debug)]
2233 pub struct GetQueryTemplate(RequestBuilder<crate::model::GetQueryTemplateRequest>);
2234
2235 impl GetQueryTemplate {
2236 pub(crate) fn new(
2237 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2238 ) -> Self {
2239 Self(RequestBuilder::new(stub))
2240 }
2241
2242 /// Sets the full request, replacing any prior values.
2243 pub fn with_request<V: Into<crate::model::GetQueryTemplateRequest>>(
2244 mut self,
2245 v: V,
2246 ) -> Self {
2247 self.0.request = v.into();
2248 self
2249 }
2250
2251 /// Sets all the options, replacing any prior values.
2252 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2253 self.0.options = v.into();
2254 self
2255 }
2256
2257 /// Sends the request.
2258 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2259 (*self.0.stub)
2260 .get_query_template(self.0.request, self.0.options)
2261 .await
2262 .map(gax::response::Response::into_body)
2263 }
2264
2265 /// Sets the value of [name][crate::model::GetQueryTemplateRequest::name].
2266 ///
2267 /// This is a **required** field for requests.
2268 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2269 self.0.request.name = v.into();
2270 self
2271 }
2272 }
2273
2274 #[doc(hidden)]
2275 impl gax::options::internal::RequestBuilder for GetQueryTemplate {
2276 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2277 &mut self.0.options
2278 }
2279 }
2280
2281 /// The request builder for [AnalyticsHubService::list_query_templates][crate::client::AnalyticsHubService::list_query_templates] calls.
2282 ///
2283 /// # Example
2284 /// ```
2285 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListQueryTemplates;
2286 /// # async fn sample() -> gax::Result<()> {
2287 /// use gax::paginator::ItemPaginator;
2288 ///
2289 /// let builder = prepare_request_builder();
2290 /// let mut items = builder.by_item();
2291 /// while let Some(result) = items.next().await {
2292 /// let item = result?;
2293 /// }
2294 /// # Ok(()) }
2295 ///
2296 /// fn prepare_request_builder() -> ListQueryTemplates {
2297 /// # panic!();
2298 /// // ... details omitted ...
2299 /// }
2300 /// ```
2301 #[derive(Clone, Debug)]
2302 pub struct ListQueryTemplates(RequestBuilder<crate::model::ListQueryTemplatesRequest>);
2303
2304 impl ListQueryTemplates {
2305 pub(crate) fn new(
2306 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2307 ) -> Self {
2308 Self(RequestBuilder::new(stub))
2309 }
2310
2311 /// Sets the full request, replacing any prior values.
2312 pub fn with_request<V: Into<crate::model::ListQueryTemplatesRequest>>(
2313 mut self,
2314 v: V,
2315 ) -> Self {
2316 self.0.request = v.into();
2317 self
2318 }
2319
2320 /// Sets all the options, replacing any prior values.
2321 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2322 self.0.options = v.into();
2323 self
2324 }
2325
2326 /// Sends the request.
2327 pub async fn send(self) -> Result<crate::model::ListQueryTemplatesResponse> {
2328 (*self.0.stub)
2329 .list_query_templates(self.0.request, self.0.options)
2330 .await
2331 .map(gax::response::Response::into_body)
2332 }
2333
2334 /// Streams each page in the collection.
2335 pub fn by_page(
2336 self,
2337 ) -> impl gax::paginator::Paginator<crate::model::ListQueryTemplatesResponse, gax::error::Error>
2338 {
2339 use std::clone::Clone;
2340 let token = self.0.request.page_token.clone();
2341 let execute = move |token: String| {
2342 let mut builder = self.clone();
2343 builder.0.request = builder.0.request.set_page_token(token);
2344 builder.send()
2345 };
2346 gax::paginator::internal::new_paginator(token, execute)
2347 }
2348
2349 /// Streams each item in the collection.
2350 pub fn by_item(
2351 self,
2352 ) -> impl gax::paginator::ItemPaginator<
2353 crate::model::ListQueryTemplatesResponse,
2354 gax::error::Error,
2355 > {
2356 use gax::paginator::Paginator;
2357 self.by_page().items()
2358 }
2359
2360 /// Sets the value of [parent][crate::model::ListQueryTemplatesRequest::parent].
2361 ///
2362 /// This is a **required** field for requests.
2363 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2364 self.0.request.parent = v.into();
2365 self
2366 }
2367
2368 /// Sets the value of [page_size][crate::model::ListQueryTemplatesRequest::page_size].
2369 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2370 self.0.request.page_size = v.into();
2371 self
2372 }
2373
2374 /// Sets the value of [page_token][crate::model::ListQueryTemplatesRequest::page_token].
2375 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2376 self.0.request.page_token = v.into();
2377 self
2378 }
2379 }
2380
2381 #[doc(hidden)]
2382 impl gax::options::internal::RequestBuilder for ListQueryTemplates {
2383 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2384 &mut self.0.options
2385 }
2386 }
2387
2388 /// The request builder for [AnalyticsHubService::update_query_template][crate::client::AnalyticsHubService::update_query_template] calls.
2389 ///
2390 /// # Example
2391 /// ```
2392 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::UpdateQueryTemplate;
2393 /// # async fn sample() -> gax::Result<()> {
2394 ///
2395 /// let builder = prepare_request_builder();
2396 /// let response = builder.send().await?;
2397 /// # Ok(()) }
2398 ///
2399 /// fn prepare_request_builder() -> UpdateQueryTemplate {
2400 /// # panic!();
2401 /// // ... details omitted ...
2402 /// }
2403 /// ```
2404 #[derive(Clone, Debug)]
2405 pub struct UpdateQueryTemplate(RequestBuilder<crate::model::UpdateQueryTemplateRequest>);
2406
2407 impl UpdateQueryTemplate {
2408 pub(crate) fn new(
2409 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2410 ) -> Self {
2411 Self(RequestBuilder::new(stub))
2412 }
2413
2414 /// Sets the full request, replacing any prior values.
2415 pub fn with_request<V: Into<crate::model::UpdateQueryTemplateRequest>>(
2416 mut self,
2417 v: V,
2418 ) -> Self {
2419 self.0.request = v.into();
2420 self
2421 }
2422
2423 /// Sets all the options, replacing any prior values.
2424 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2425 self.0.options = v.into();
2426 self
2427 }
2428
2429 /// Sends the request.
2430 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2431 (*self.0.stub)
2432 .update_query_template(self.0.request, self.0.options)
2433 .await
2434 .map(gax::response::Response::into_body)
2435 }
2436
2437 /// Sets the value of [update_mask][crate::model::UpdateQueryTemplateRequest::update_mask].
2438 pub fn set_update_mask<T>(mut self, v: T) -> Self
2439 where
2440 T: std::convert::Into<wkt::FieldMask>,
2441 {
2442 self.0.request.update_mask = std::option::Option::Some(v.into());
2443 self
2444 }
2445
2446 /// Sets or clears the value of [update_mask][crate::model::UpdateQueryTemplateRequest::update_mask].
2447 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2448 where
2449 T: std::convert::Into<wkt::FieldMask>,
2450 {
2451 self.0.request.update_mask = v.map(|x| x.into());
2452 self
2453 }
2454
2455 /// Sets the value of [query_template][crate::model::UpdateQueryTemplateRequest::query_template].
2456 ///
2457 /// This is a **required** field for requests.
2458 pub fn set_query_template<T>(mut self, v: T) -> Self
2459 where
2460 T: std::convert::Into<crate::model::QueryTemplate>,
2461 {
2462 self.0.request.query_template = std::option::Option::Some(v.into());
2463 self
2464 }
2465
2466 /// Sets or clears the value of [query_template][crate::model::UpdateQueryTemplateRequest::query_template].
2467 ///
2468 /// This is a **required** field for requests.
2469 pub fn set_or_clear_query_template<T>(mut self, v: std::option::Option<T>) -> Self
2470 where
2471 T: std::convert::Into<crate::model::QueryTemplate>,
2472 {
2473 self.0.request.query_template = v.map(|x| x.into());
2474 self
2475 }
2476 }
2477
2478 #[doc(hidden)]
2479 impl gax::options::internal::RequestBuilder for UpdateQueryTemplate {
2480 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2481 &mut self.0.options
2482 }
2483 }
2484
2485 /// The request builder for [AnalyticsHubService::delete_query_template][crate::client::AnalyticsHubService::delete_query_template] calls.
2486 ///
2487 /// # Example
2488 /// ```
2489 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::DeleteQueryTemplate;
2490 /// # async fn sample() -> gax::Result<()> {
2491 ///
2492 /// let builder = prepare_request_builder();
2493 /// let response = builder.send().await?;
2494 /// # Ok(()) }
2495 ///
2496 /// fn prepare_request_builder() -> DeleteQueryTemplate {
2497 /// # panic!();
2498 /// // ... details omitted ...
2499 /// }
2500 /// ```
2501 #[derive(Clone, Debug)]
2502 pub struct DeleteQueryTemplate(RequestBuilder<crate::model::DeleteQueryTemplateRequest>);
2503
2504 impl DeleteQueryTemplate {
2505 pub(crate) fn new(
2506 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2507 ) -> Self {
2508 Self(RequestBuilder::new(stub))
2509 }
2510
2511 /// Sets the full request, replacing any prior values.
2512 pub fn with_request<V: Into<crate::model::DeleteQueryTemplateRequest>>(
2513 mut self,
2514 v: V,
2515 ) -> Self {
2516 self.0.request = v.into();
2517 self
2518 }
2519
2520 /// Sets all the options, replacing any prior values.
2521 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2522 self.0.options = v.into();
2523 self
2524 }
2525
2526 /// Sends the request.
2527 pub async fn send(self) -> Result<()> {
2528 (*self.0.stub)
2529 .delete_query_template(self.0.request, self.0.options)
2530 .await
2531 .map(gax::response::Response::into_body)
2532 }
2533
2534 /// Sets the value of [name][crate::model::DeleteQueryTemplateRequest::name].
2535 ///
2536 /// This is a **required** field for requests.
2537 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2538 self.0.request.name = v.into();
2539 self
2540 }
2541 }
2542
2543 #[doc(hidden)]
2544 impl gax::options::internal::RequestBuilder for DeleteQueryTemplate {
2545 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2546 &mut self.0.options
2547 }
2548 }
2549
2550 /// The request builder for [AnalyticsHubService::submit_query_template][crate::client::AnalyticsHubService::submit_query_template] calls.
2551 ///
2552 /// # Example
2553 /// ```
2554 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::SubmitQueryTemplate;
2555 /// # async fn sample() -> gax::Result<()> {
2556 ///
2557 /// let builder = prepare_request_builder();
2558 /// let response = builder.send().await?;
2559 /// # Ok(()) }
2560 ///
2561 /// fn prepare_request_builder() -> SubmitQueryTemplate {
2562 /// # panic!();
2563 /// // ... details omitted ...
2564 /// }
2565 /// ```
2566 #[derive(Clone, Debug)]
2567 pub struct SubmitQueryTemplate(RequestBuilder<crate::model::SubmitQueryTemplateRequest>);
2568
2569 impl SubmitQueryTemplate {
2570 pub(crate) fn new(
2571 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2572 ) -> Self {
2573 Self(RequestBuilder::new(stub))
2574 }
2575
2576 /// Sets the full request, replacing any prior values.
2577 pub fn with_request<V: Into<crate::model::SubmitQueryTemplateRequest>>(
2578 mut self,
2579 v: V,
2580 ) -> Self {
2581 self.0.request = v.into();
2582 self
2583 }
2584
2585 /// Sets all the options, replacing any prior values.
2586 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2587 self.0.options = v.into();
2588 self
2589 }
2590
2591 /// Sends the request.
2592 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2593 (*self.0.stub)
2594 .submit_query_template(self.0.request, self.0.options)
2595 .await
2596 .map(gax::response::Response::into_body)
2597 }
2598
2599 /// Sets the value of [name][crate::model::SubmitQueryTemplateRequest::name].
2600 ///
2601 /// This is a **required** field for requests.
2602 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2603 self.0.request.name = v.into();
2604 self
2605 }
2606 }
2607
2608 #[doc(hidden)]
2609 impl gax::options::internal::RequestBuilder for SubmitQueryTemplate {
2610 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2611 &mut self.0.options
2612 }
2613 }
2614
2615 /// The request builder for [AnalyticsHubService::approve_query_template][crate::client::AnalyticsHubService::approve_query_template] calls.
2616 ///
2617 /// # Example
2618 /// ```
2619 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ApproveQueryTemplate;
2620 /// # async fn sample() -> gax::Result<()> {
2621 ///
2622 /// let builder = prepare_request_builder();
2623 /// let response = builder.send().await?;
2624 /// # Ok(()) }
2625 ///
2626 /// fn prepare_request_builder() -> ApproveQueryTemplate {
2627 /// # panic!();
2628 /// // ... details omitted ...
2629 /// }
2630 /// ```
2631 #[derive(Clone, Debug)]
2632 pub struct ApproveQueryTemplate(RequestBuilder<crate::model::ApproveQueryTemplateRequest>);
2633
2634 impl ApproveQueryTemplate {
2635 pub(crate) fn new(
2636 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2637 ) -> Self {
2638 Self(RequestBuilder::new(stub))
2639 }
2640
2641 /// Sets the full request, replacing any prior values.
2642 pub fn with_request<V: Into<crate::model::ApproveQueryTemplateRequest>>(
2643 mut self,
2644 v: V,
2645 ) -> Self {
2646 self.0.request = v.into();
2647 self
2648 }
2649
2650 /// Sets all the options, replacing any prior values.
2651 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2652 self.0.options = v.into();
2653 self
2654 }
2655
2656 /// Sends the request.
2657 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2658 (*self.0.stub)
2659 .approve_query_template(self.0.request, self.0.options)
2660 .await
2661 .map(gax::response::Response::into_body)
2662 }
2663
2664 /// Sets the value of [name][crate::model::ApproveQueryTemplateRequest::name].
2665 ///
2666 /// This is a **required** field for requests.
2667 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2668 self.0.request.name = v.into();
2669 self
2670 }
2671 }
2672
2673 #[doc(hidden)]
2674 impl gax::options::internal::RequestBuilder for ApproveQueryTemplate {
2675 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2676 &mut self.0.options
2677 }
2678 }
2679
2680 /// The request builder for [AnalyticsHubService::get_operation][crate::client::AnalyticsHubService::get_operation] calls.
2681 ///
2682 /// # Example
2683 /// ```
2684 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetOperation;
2685 /// # async fn sample() -> gax::Result<()> {
2686 ///
2687 /// let builder = prepare_request_builder();
2688 /// let response = builder.send().await?;
2689 /// # Ok(()) }
2690 ///
2691 /// fn prepare_request_builder() -> GetOperation {
2692 /// # panic!();
2693 /// // ... details omitted ...
2694 /// }
2695 /// ```
2696 #[derive(Clone, Debug)]
2697 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2698
2699 impl GetOperation {
2700 pub(crate) fn new(
2701 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2702 ) -> Self {
2703 Self(RequestBuilder::new(stub))
2704 }
2705
2706 /// Sets the full request, replacing any prior values.
2707 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2708 mut self,
2709 v: V,
2710 ) -> Self {
2711 self.0.request = v.into();
2712 self
2713 }
2714
2715 /// Sets all the options, replacing any prior values.
2716 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2717 self.0.options = v.into();
2718 self
2719 }
2720
2721 /// Sends the request.
2722 pub async fn send(self) -> Result<longrunning::model::Operation> {
2723 (*self.0.stub)
2724 .get_operation(self.0.request, self.0.options)
2725 .await
2726 .map(gax::response::Response::into_body)
2727 }
2728
2729 /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2730 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2731 self.0.request.name = v.into();
2732 self
2733 }
2734 }
2735
2736 #[doc(hidden)]
2737 impl gax::options::internal::RequestBuilder for GetOperation {
2738 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2739 &mut self.0.options
2740 }
2741 }
2742}