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