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