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
1217 let stub = self.0.stub.clone();
1218 let mut options = self.0.options.clone();
1219 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1220 let query = move |name| {
1221 let stub = stub.clone();
1222 let options = options.clone();
1223 async {
1224 let op = GetOperation::new(stub)
1225 .set_name(name)
1226 .with_options(options)
1227 .send()
1228 .await?;
1229 Ok(Operation::new(op))
1230 }
1231 };
1232
1233 let start = move || async {
1234 let op = self.send().await?;
1235 Ok(Operation::new(op))
1236 };
1237
1238 google_cloud_lro::internal::new_poller(
1239 polling_error_policy,
1240 polling_backoff_policy,
1241 start,
1242 query,
1243 )
1244 }
1245
1246 /// Sets the value of [name][crate::model::SubscribeDataExchangeRequest::name].
1247 ///
1248 /// This is a **required** field for requests.
1249 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1250 self.0.request.name = v.into();
1251 self
1252 }
1253
1254 /// Sets the value of [destination][crate::model::SubscribeDataExchangeRequest::destination].
1255 ///
1256 /// This is a **required** field for requests.
1257 pub fn set_destination<T: Into<std::string::String>>(mut self, v: T) -> Self {
1258 self.0.request.destination = v.into();
1259 self
1260 }
1261
1262 /// Sets the value of [destination_dataset][crate::model::SubscribeDataExchangeRequest::destination_dataset].
1263 pub fn set_destination_dataset<T>(mut self, v: T) -> Self
1264 where
1265 T: std::convert::Into<crate::model::DestinationDataset>,
1266 {
1267 self.0.request.destination_dataset = std::option::Option::Some(v.into());
1268 self
1269 }
1270
1271 /// Sets or clears the value of [destination_dataset][crate::model::SubscribeDataExchangeRequest::destination_dataset].
1272 pub fn set_or_clear_destination_dataset<T>(mut self, v: std::option::Option<T>) -> Self
1273 where
1274 T: std::convert::Into<crate::model::DestinationDataset>,
1275 {
1276 self.0.request.destination_dataset = v.map(|x| x.into());
1277 self
1278 }
1279
1280 /// Sets the value of [subscription][crate::model::SubscribeDataExchangeRequest::subscription].
1281 ///
1282 /// This is a **required** field for requests.
1283 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1284 self.0.request.subscription = v.into();
1285 self
1286 }
1287
1288 /// Sets the value of [subscriber_contact][crate::model::SubscribeDataExchangeRequest::subscriber_contact].
1289 pub fn set_subscriber_contact<T: Into<std::string::String>>(mut self, v: T) -> Self {
1290 self.0.request.subscriber_contact = v.into();
1291 self
1292 }
1293 }
1294
1295 #[doc(hidden)]
1296 impl crate::RequestBuilder for SubscribeDataExchange {
1297 fn request_options(&mut self) -> &mut crate::RequestOptions {
1298 &mut self.0.options
1299 }
1300 }
1301
1302 /// The request builder for [AnalyticsHubService::refresh_subscription][crate::client::AnalyticsHubService::refresh_subscription] calls.
1303 ///
1304 /// # Example
1305 /// ```
1306 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::RefreshSubscription;
1307 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1308 /// use google_cloud_lro::Poller;
1309 ///
1310 /// let builder = prepare_request_builder();
1311 /// let response = builder.poller().until_done().await?;
1312 /// # Ok(()) }
1313 ///
1314 /// fn prepare_request_builder() -> RefreshSubscription {
1315 /// # panic!();
1316 /// // ... details omitted ...
1317 /// }
1318 /// ```
1319 #[derive(Clone, Debug)]
1320 pub struct RefreshSubscription(RequestBuilder<crate::model::RefreshSubscriptionRequest>);
1321
1322 impl RefreshSubscription {
1323 pub(crate) fn new(
1324 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1325 ) -> Self {
1326 Self(RequestBuilder::new(stub))
1327 }
1328
1329 /// Sets the full request, replacing any prior values.
1330 pub fn with_request<V: Into<crate::model::RefreshSubscriptionRequest>>(
1331 mut self,
1332 v: V,
1333 ) -> Self {
1334 self.0.request = v.into();
1335 self
1336 }
1337
1338 /// Sets all the options, replacing any prior values.
1339 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1340 self.0.options = v.into();
1341 self
1342 }
1343
1344 /// Sends the request.
1345 ///
1346 /// # Long running operations
1347 ///
1348 /// This starts, but does not poll, a longrunning operation. More information
1349 /// on [refresh_subscription][crate::client::AnalyticsHubService::refresh_subscription].
1350 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1351 (*self.0.stub)
1352 .refresh_subscription(self.0.request, self.0.options)
1353 .await
1354 .map(crate::Response::into_body)
1355 }
1356
1357 /// Creates a [Poller][google_cloud_lro::Poller] to work with `refresh_subscription`.
1358 pub fn poller(
1359 self,
1360 ) -> impl google_cloud_lro::Poller<
1361 crate::model::RefreshSubscriptionResponse,
1362 crate::model::OperationMetadata,
1363 > {
1364 type Operation = google_cloud_lro::internal::Operation<
1365 crate::model::RefreshSubscriptionResponse,
1366 crate::model::OperationMetadata,
1367 >;
1368 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1369 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1370
1371 let stub = self.0.stub.clone();
1372 let mut options = self.0.options.clone();
1373 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1374 let query = move |name| {
1375 let stub = stub.clone();
1376 let options = options.clone();
1377 async {
1378 let op = GetOperation::new(stub)
1379 .set_name(name)
1380 .with_options(options)
1381 .send()
1382 .await?;
1383 Ok(Operation::new(op))
1384 }
1385 };
1386
1387 let start = move || async {
1388 let op = self.send().await?;
1389 Ok(Operation::new(op))
1390 };
1391
1392 google_cloud_lro::internal::new_poller(
1393 polling_error_policy,
1394 polling_backoff_policy,
1395 start,
1396 query,
1397 )
1398 }
1399
1400 /// Sets the value of [name][crate::model::RefreshSubscriptionRequest::name].
1401 ///
1402 /// This is a **required** field for requests.
1403 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1404 self.0.request.name = v.into();
1405 self
1406 }
1407 }
1408
1409 #[doc(hidden)]
1410 impl crate::RequestBuilder for RefreshSubscription {
1411 fn request_options(&mut self) -> &mut crate::RequestOptions {
1412 &mut self.0.options
1413 }
1414 }
1415
1416 /// The request builder for [AnalyticsHubService::get_subscription][crate::client::AnalyticsHubService::get_subscription] calls.
1417 ///
1418 /// # Example
1419 /// ```
1420 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetSubscription;
1421 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1422 ///
1423 /// let builder = prepare_request_builder();
1424 /// let response = builder.send().await?;
1425 /// # Ok(()) }
1426 ///
1427 /// fn prepare_request_builder() -> GetSubscription {
1428 /// # panic!();
1429 /// // ... details omitted ...
1430 /// }
1431 /// ```
1432 #[derive(Clone, Debug)]
1433 pub struct GetSubscription(RequestBuilder<crate::model::GetSubscriptionRequest>);
1434
1435 impl GetSubscription {
1436 pub(crate) fn new(
1437 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1438 ) -> Self {
1439 Self(RequestBuilder::new(stub))
1440 }
1441
1442 /// Sets the full request, replacing any prior values.
1443 pub fn with_request<V: Into<crate::model::GetSubscriptionRequest>>(mut self, v: V) -> Self {
1444 self.0.request = v.into();
1445 self
1446 }
1447
1448 /// Sets all the options, replacing any prior values.
1449 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1450 self.0.options = v.into();
1451 self
1452 }
1453
1454 /// Sends the request.
1455 pub async fn send(self) -> Result<crate::model::Subscription> {
1456 (*self.0.stub)
1457 .get_subscription(self.0.request, self.0.options)
1458 .await
1459 .map(crate::Response::into_body)
1460 }
1461
1462 /// Sets the value of [name][crate::model::GetSubscriptionRequest::name].
1463 ///
1464 /// This is a **required** field for requests.
1465 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1466 self.0.request.name = v.into();
1467 self
1468 }
1469 }
1470
1471 #[doc(hidden)]
1472 impl crate::RequestBuilder for GetSubscription {
1473 fn request_options(&mut self) -> &mut crate::RequestOptions {
1474 &mut self.0.options
1475 }
1476 }
1477
1478 /// The request builder for [AnalyticsHubService::list_subscriptions][crate::client::AnalyticsHubService::list_subscriptions] calls.
1479 ///
1480 /// # Example
1481 /// ```
1482 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListSubscriptions;
1483 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1484 /// use google_cloud_gax::paginator::ItemPaginator;
1485 ///
1486 /// let builder = prepare_request_builder();
1487 /// let mut items = builder.by_item();
1488 /// while let Some(result) = items.next().await {
1489 /// let item = result?;
1490 /// }
1491 /// # Ok(()) }
1492 ///
1493 /// fn prepare_request_builder() -> ListSubscriptions {
1494 /// # panic!();
1495 /// // ... details omitted ...
1496 /// }
1497 /// ```
1498 #[derive(Clone, Debug)]
1499 pub struct ListSubscriptions(RequestBuilder<crate::model::ListSubscriptionsRequest>);
1500
1501 impl ListSubscriptions {
1502 pub(crate) fn new(
1503 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1504 ) -> Self {
1505 Self(RequestBuilder::new(stub))
1506 }
1507
1508 /// Sets the full request, replacing any prior values.
1509 pub fn with_request<V: Into<crate::model::ListSubscriptionsRequest>>(
1510 mut self,
1511 v: V,
1512 ) -> Self {
1513 self.0.request = v.into();
1514 self
1515 }
1516
1517 /// Sets all the options, replacing any prior values.
1518 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1519 self.0.options = v.into();
1520 self
1521 }
1522
1523 /// Sends the request.
1524 pub async fn send(self) -> Result<crate::model::ListSubscriptionsResponse> {
1525 (*self.0.stub)
1526 .list_subscriptions(self.0.request, self.0.options)
1527 .await
1528 .map(crate::Response::into_body)
1529 }
1530
1531 /// Streams each page in the collection.
1532 pub fn by_page(
1533 self,
1534 ) -> impl google_cloud_gax::paginator::Paginator<
1535 crate::model::ListSubscriptionsResponse,
1536 crate::Error,
1537 > {
1538 use std::clone::Clone;
1539 let token = self.0.request.page_token.clone();
1540 let execute = move |token: String| {
1541 let mut builder = self.clone();
1542 builder.0.request = builder.0.request.set_page_token(token);
1543 builder.send()
1544 };
1545 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1546 }
1547
1548 /// Streams each item in the collection.
1549 pub fn by_item(
1550 self,
1551 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1552 crate::model::ListSubscriptionsResponse,
1553 crate::Error,
1554 > {
1555 use google_cloud_gax::paginator::Paginator;
1556 self.by_page().items()
1557 }
1558
1559 /// Sets the value of [parent][crate::model::ListSubscriptionsRequest::parent].
1560 ///
1561 /// This is a **required** field for requests.
1562 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1563 self.0.request.parent = v.into();
1564 self
1565 }
1566
1567 /// Sets the value of [filter][crate::model::ListSubscriptionsRequest::filter].
1568 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1569 self.0.request.filter = v.into();
1570 self
1571 }
1572
1573 /// Sets the value of [page_size][crate::model::ListSubscriptionsRequest::page_size].
1574 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1575 self.0.request.page_size = v.into();
1576 self
1577 }
1578
1579 /// Sets the value of [page_token][crate::model::ListSubscriptionsRequest::page_token].
1580 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1581 self.0.request.page_token = v.into();
1582 self
1583 }
1584 }
1585
1586 #[doc(hidden)]
1587 impl crate::RequestBuilder for ListSubscriptions {
1588 fn request_options(&mut self) -> &mut crate::RequestOptions {
1589 &mut self.0.options
1590 }
1591 }
1592
1593 /// The request builder for [AnalyticsHubService::list_shared_resource_subscriptions][crate::client::AnalyticsHubService::list_shared_resource_subscriptions] calls.
1594 ///
1595 /// # Example
1596 /// ```
1597 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListSharedResourceSubscriptions;
1598 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1599 /// use google_cloud_gax::paginator::ItemPaginator;
1600 ///
1601 /// let builder = prepare_request_builder();
1602 /// let mut items = builder.by_item();
1603 /// while let Some(result) = items.next().await {
1604 /// let item = result?;
1605 /// }
1606 /// # Ok(()) }
1607 ///
1608 /// fn prepare_request_builder() -> ListSharedResourceSubscriptions {
1609 /// # panic!();
1610 /// // ... details omitted ...
1611 /// }
1612 /// ```
1613 #[derive(Clone, Debug)]
1614 pub struct ListSharedResourceSubscriptions(
1615 RequestBuilder<crate::model::ListSharedResourceSubscriptionsRequest>,
1616 );
1617
1618 impl ListSharedResourceSubscriptions {
1619 pub(crate) fn new(
1620 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1621 ) -> Self {
1622 Self(RequestBuilder::new(stub))
1623 }
1624
1625 /// Sets the full request, replacing any prior values.
1626 pub fn with_request<V: Into<crate::model::ListSharedResourceSubscriptionsRequest>>(
1627 mut self,
1628 v: V,
1629 ) -> Self {
1630 self.0.request = v.into();
1631 self
1632 }
1633
1634 /// Sets all the options, replacing any prior values.
1635 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1636 self.0.options = v.into();
1637 self
1638 }
1639
1640 /// Sends the request.
1641 pub async fn send(self) -> Result<crate::model::ListSharedResourceSubscriptionsResponse> {
1642 (*self.0.stub)
1643 .list_shared_resource_subscriptions(self.0.request, self.0.options)
1644 .await
1645 .map(crate::Response::into_body)
1646 }
1647
1648 /// Streams each page in the collection.
1649 pub fn by_page(
1650 self,
1651 ) -> impl google_cloud_gax::paginator::Paginator<
1652 crate::model::ListSharedResourceSubscriptionsResponse,
1653 crate::Error,
1654 > {
1655 use std::clone::Clone;
1656 let token = self.0.request.page_token.clone();
1657 let execute = move |token: String| {
1658 let mut builder = self.clone();
1659 builder.0.request = builder.0.request.set_page_token(token);
1660 builder.send()
1661 };
1662 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1663 }
1664
1665 /// Streams each item in the collection.
1666 pub fn by_item(
1667 self,
1668 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1669 crate::model::ListSharedResourceSubscriptionsResponse,
1670 crate::Error,
1671 > {
1672 use google_cloud_gax::paginator::Paginator;
1673 self.by_page().items()
1674 }
1675
1676 /// Sets the value of [resource][crate::model::ListSharedResourceSubscriptionsRequest::resource].
1677 ///
1678 /// This is a **required** field for requests.
1679 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1680 self.0.request.resource = v.into();
1681 self
1682 }
1683
1684 /// Sets the value of [include_deleted_subscriptions][crate::model::ListSharedResourceSubscriptionsRequest::include_deleted_subscriptions].
1685 pub fn set_include_deleted_subscriptions<T: Into<bool>>(mut self, v: T) -> Self {
1686 self.0.request.include_deleted_subscriptions = v.into();
1687 self
1688 }
1689
1690 /// Sets the value of [page_size][crate::model::ListSharedResourceSubscriptionsRequest::page_size].
1691 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1692 self.0.request.page_size = v.into();
1693 self
1694 }
1695
1696 /// Sets the value of [page_token][crate::model::ListSharedResourceSubscriptionsRequest::page_token].
1697 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1698 self.0.request.page_token = v.into();
1699 self
1700 }
1701 }
1702
1703 #[doc(hidden)]
1704 impl crate::RequestBuilder for ListSharedResourceSubscriptions {
1705 fn request_options(&mut self) -> &mut crate::RequestOptions {
1706 &mut self.0.options
1707 }
1708 }
1709
1710 /// The request builder for [AnalyticsHubService::revoke_subscription][crate::client::AnalyticsHubService::revoke_subscription] calls.
1711 ///
1712 /// # Example
1713 /// ```
1714 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::RevokeSubscription;
1715 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1716 ///
1717 /// let builder = prepare_request_builder();
1718 /// let response = builder.send().await?;
1719 /// # Ok(()) }
1720 ///
1721 /// fn prepare_request_builder() -> RevokeSubscription {
1722 /// # panic!();
1723 /// // ... details omitted ...
1724 /// }
1725 /// ```
1726 #[derive(Clone, Debug)]
1727 pub struct RevokeSubscription(RequestBuilder<crate::model::RevokeSubscriptionRequest>);
1728
1729 impl RevokeSubscription {
1730 pub(crate) fn new(
1731 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1732 ) -> Self {
1733 Self(RequestBuilder::new(stub))
1734 }
1735
1736 /// Sets the full request, replacing any prior values.
1737 pub fn with_request<V: Into<crate::model::RevokeSubscriptionRequest>>(
1738 mut self,
1739 v: V,
1740 ) -> Self {
1741 self.0.request = v.into();
1742 self
1743 }
1744
1745 /// Sets all the options, replacing any prior values.
1746 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1747 self.0.options = v.into();
1748 self
1749 }
1750
1751 /// Sends the request.
1752 pub async fn send(self) -> Result<crate::model::RevokeSubscriptionResponse> {
1753 (*self.0.stub)
1754 .revoke_subscription(self.0.request, self.0.options)
1755 .await
1756 .map(crate::Response::into_body)
1757 }
1758
1759 /// Sets the value of [name][crate::model::RevokeSubscriptionRequest::name].
1760 ///
1761 /// This is a **required** field for requests.
1762 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1763 self.0.request.name = v.into();
1764 self
1765 }
1766
1767 /// Sets the value of [revoke_commercial][crate::model::RevokeSubscriptionRequest::revoke_commercial].
1768 pub fn set_revoke_commercial<T: Into<bool>>(mut self, v: T) -> Self {
1769 self.0.request.revoke_commercial = v.into();
1770 self
1771 }
1772 }
1773
1774 #[doc(hidden)]
1775 impl crate::RequestBuilder for RevokeSubscription {
1776 fn request_options(&mut self) -> &mut crate::RequestOptions {
1777 &mut self.0.options
1778 }
1779 }
1780
1781 /// The request builder for [AnalyticsHubService::delete_subscription][crate::client::AnalyticsHubService::delete_subscription] calls.
1782 ///
1783 /// # Example
1784 /// ```
1785 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::DeleteSubscription;
1786 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1787 /// use google_cloud_lro::Poller;
1788 ///
1789 /// let builder = prepare_request_builder();
1790 /// let response = builder.poller().until_done().await?;
1791 /// # Ok(()) }
1792 ///
1793 /// fn prepare_request_builder() -> DeleteSubscription {
1794 /// # panic!();
1795 /// // ... details omitted ...
1796 /// }
1797 /// ```
1798 #[derive(Clone, Debug)]
1799 pub struct DeleteSubscription(RequestBuilder<crate::model::DeleteSubscriptionRequest>);
1800
1801 impl DeleteSubscription {
1802 pub(crate) fn new(
1803 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1804 ) -> Self {
1805 Self(RequestBuilder::new(stub))
1806 }
1807
1808 /// Sets the full request, replacing any prior values.
1809 pub fn with_request<V: Into<crate::model::DeleteSubscriptionRequest>>(
1810 mut self,
1811 v: V,
1812 ) -> Self {
1813 self.0.request = v.into();
1814 self
1815 }
1816
1817 /// Sets all the options, replacing any prior values.
1818 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1819 self.0.options = v.into();
1820 self
1821 }
1822
1823 /// Sends the request.
1824 ///
1825 /// # Long running operations
1826 ///
1827 /// This starts, but does not poll, a longrunning operation. More information
1828 /// on [delete_subscription][crate::client::AnalyticsHubService::delete_subscription].
1829 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1830 (*self.0.stub)
1831 .delete_subscription(self.0.request, self.0.options)
1832 .await
1833 .map(crate::Response::into_body)
1834 }
1835
1836 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_subscription`.
1837 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
1838 type Operation =
1839 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1840 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1841 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1842
1843 let stub = self.0.stub.clone();
1844 let mut options = self.0.options.clone();
1845 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1846 let query = move |name| {
1847 let stub = stub.clone();
1848 let options = options.clone();
1849 async {
1850 let op = GetOperation::new(stub)
1851 .set_name(name)
1852 .with_options(options)
1853 .send()
1854 .await?;
1855 Ok(Operation::new(op))
1856 }
1857 };
1858
1859 let start = move || async {
1860 let op = self.send().await?;
1861 Ok(Operation::new(op))
1862 };
1863
1864 google_cloud_lro::internal::new_unit_response_poller(
1865 polling_error_policy,
1866 polling_backoff_policy,
1867 start,
1868 query,
1869 )
1870 }
1871
1872 /// Sets the value of [name][crate::model::DeleteSubscriptionRequest::name].
1873 ///
1874 /// This is a **required** field for requests.
1875 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1876 self.0.request.name = v.into();
1877 self
1878 }
1879 }
1880
1881 #[doc(hidden)]
1882 impl crate::RequestBuilder for DeleteSubscription {
1883 fn request_options(&mut self) -> &mut crate::RequestOptions {
1884 &mut self.0.options
1885 }
1886 }
1887
1888 /// The request builder for [AnalyticsHubService::get_iam_policy][crate::client::AnalyticsHubService::get_iam_policy] calls.
1889 ///
1890 /// # Example
1891 /// ```
1892 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetIamPolicy;
1893 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1894 ///
1895 /// let builder = prepare_request_builder();
1896 /// let response = builder.send().await?;
1897 /// # Ok(()) }
1898 ///
1899 /// fn prepare_request_builder() -> GetIamPolicy {
1900 /// # panic!();
1901 /// // ... details omitted ...
1902 /// }
1903 /// ```
1904 #[derive(Clone, Debug)]
1905 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1906
1907 impl GetIamPolicy {
1908 pub(crate) fn new(
1909 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1910 ) -> Self {
1911 Self(RequestBuilder::new(stub))
1912 }
1913
1914 /// Sets the full request, replacing any prior values.
1915 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1916 mut self,
1917 v: V,
1918 ) -> Self {
1919 self.0.request = v.into();
1920 self
1921 }
1922
1923 /// Sets all the options, replacing any prior values.
1924 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1925 self.0.options = v.into();
1926 self
1927 }
1928
1929 /// Sends the request.
1930 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1931 (*self.0.stub)
1932 .get_iam_policy(self.0.request, self.0.options)
1933 .await
1934 .map(crate::Response::into_body)
1935 }
1936
1937 /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
1938 ///
1939 /// This is a **required** field for requests.
1940 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1941 self.0.request.resource = v.into();
1942 self
1943 }
1944
1945 /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1946 pub fn set_options<T>(mut self, v: T) -> Self
1947 where
1948 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1949 {
1950 self.0.request.options = std::option::Option::Some(v.into());
1951 self
1952 }
1953
1954 /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1955 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1956 where
1957 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1958 {
1959 self.0.request.options = v.map(|x| x.into());
1960 self
1961 }
1962 }
1963
1964 #[doc(hidden)]
1965 impl crate::RequestBuilder for GetIamPolicy {
1966 fn request_options(&mut self) -> &mut crate::RequestOptions {
1967 &mut self.0.options
1968 }
1969 }
1970
1971 /// The request builder for [AnalyticsHubService::set_iam_policy][crate::client::AnalyticsHubService::set_iam_policy] calls.
1972 ///
1973 /// # Example
1974 /// ```
1975 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::SetIamPolicy;
1976 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
1977 ///
1978 /// let builder = prepare_request_builder();
1979 /// let response = builder.send().await?;
1980 /// # Ok(()) }
1981 ///
1982 /// fn prepare_request_builder() -> SetIamPolicy {
1983 /// # panic!();
1984 /// // ... details omitted ...
1985 /// }
1986 /// ```
1987 #[derive(Clone, Debug)]
1988 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1989
1990 impl SetIamPolicy {
1991 pub(crate) fn new(
1992 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
1993 ) -> Self {
1994 Self(RequestBuilder::new(stub))
1995 }
1996
1997 /// Sets the full request, replacing any prior values.
1998 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1999 mut self,
2000 v: V,
2001 ) -> Self {
2002 self.0.request = v.into();
2003 self
2004 }
2005
2006 /// Sets all the options, replacing any prior values.
2007 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2008 self.0.options = v.into();
2009 self
2010 }
2011
2012 /// Sends the request.
2013 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2014 (*self.0.stub)
2015 .set_iam_policy(self.0.request, self.0.options)
2016 .await
2017 .map(crate::Response::into_body)
2018 }
2019
2020 /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
2021 ///
2022 /// This is a **required** field for requests.
2023 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2024 self.0.request.resource = v.into();
2025 self
2026 }
2027
2028 /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2029 ///
2030 /// This is a **required** field for requests.
2031 pub fn set_policy<T>(mut self, v: T) -> Self
2032 where
2033 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2034 {
2035 self.0.request.policy = std::option::Option::Some(v.into());
2036 self
2037 }
2038
2039 /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2040 ///
2041 /// This is a **required** field for requests.
2042 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2043 where
2044 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2045 {
2046 self.0.request.policy = v.map(|x| x.into());
2047 self
2048 }
2049
2050 /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2051 pub fn set_update_mask<T>(mut self, v: T) -> Self
2052 where
2053 T: std::convert::Into<wkt::FieldMask>,
2054 {
2055 self.0.request.update_mask = std::option::Option::Some(v.into());
2056 self
2057 }
2058
2059 /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2060 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2061 where
2062 T: std::convert::Into<wkt::FieldMask>,
2063 {
2064 self.0.request.update_mask = v.map(|x| x.into());
2065 self
2066 }
2067 }
2068
2069 #[doc(hidden)]
2070 impl crate::RequestBuilder for SetIamPolicy {
2071 fn request_options(&mut self) -> &mut crate::RequestOptions {
2072 &mut self.0.options
2073 }
2074 }
2075
2076 /// The request builder for [AnalyticsHubService::test_iam_permissions][crate::client::AnalyticsHubService::test_iam_permissions] calls.
2077 ///
2078 /// # Example
2079 /// ```
2080 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::TestIamPermissions;
2081 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2082 ///
2083 /// let builder = prepare_request_builder();
2084 /// let response = builder.send().await?;
2085 /// # Ok(()) }
2086 ///
2087 /// fn prepare_request_builder() -> TestIamPermissions {
2088 /// # panic!();
2089 /// // ... details omitted ...
2090 /// }
2091 /// ```
2092 #[derive(Clone, Debug)]
2093 pub struct TestIamPermissions(
2094 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
2095 );
2096
2097 impl TestIamPermissions {
2098 pub(crate) fn new(
2099 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2100 ) -> Self {
2101 Self(RequestBuilder::new(stub))
2102 }
2103
2104 /// Sets the full request, replacing any prior values.
2105 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
2106 mut self,
2107 v: V,
2108 ) -> Self {
2109 self.0.request = v.into();
2110 self
2111 }
2112
2113 /// Sets all the options, replacing any prior values.
2114 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2115 self.0.options = v.into();
2116 self
2117 }
2118
2119 /// Sends the request.
2120 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
2121 (*self.0.stub)
2122 .test_iam_permissions(self.0.request, self.0.options)
2123 .await
2124 .map(crate::Response::into_body)
2125 }
2126
2127 /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
2128 ///
2129 /// This is a **required** field for requests.
2130 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2131 self.0.request.resource = v.into();
2132 self
2133 }
2134
2135 /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
2136 ///
2137 /// This is a **required** field for requests.
2138 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2139 where
2140 T: std::iter::IntoIterator<Item = V>,
2141 V: std::convert::Into<std::string::String>,
2142 {
2143 use std::iter::Iterator;
2144 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2145 self
2146 }
2147 }
2148
2149 #[doc(hidden)]
2150 impl crate::RequestBuilder for TestIamPermissions {
2151 fn request_options(&mut self) -> &mut crate::RequestOptions {
2152 &mut self.0.options
2153 }
2154 }
2155
2156 /// The request builder for [AnalyticsHubService::create_query_template][crate::client::AnalyticsHubService::create_query_template] calls.
2157 ///
2158 /// # Example
2159 /// ```
2160 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::CreateQueryTemplate;
2161 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2162 ///
2163 /// let builder = prepare_request_builder();
2164 /// let response = builder.send().await?;
2165 /// # Ok(()) }
2166 ///
2167 /// fn prepare_request_builder() -> CreateQueryTemplate {
2168 /// # panic!();
2169 /// // ... details omitted ...
2170 /// }
2171 /// ```
2172 #[derive(Clone, Debug)]
2173 pub struct CreateQueryTemplate(RequestBuilder<crate::model::CreateQueryTemplateRequest>);
2174
2175 impl CreateQueryTemplate {
2176 pub(crate) fn new(
2177 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2178 ) -> Self {
2179 Self(RequestBuilder::new(stub))
2180 }
2181
2182 /// Sets the full request, replacing any prior values.
2183 pub fn with_request<V: Into<crate::model::CreateQueryTemplateRequest>>(
2184 mut self,
2185 v: V,
2186 ) -> Self {
2187 self.0.request = v.into();
2188 self
2189 }
2190
2191 /// Sets all the options, replacing any prior values.
2192 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2193 self.0.options = v.into();
2194 self
2195 }
2196
2197 /// Sends the request.
2198 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2199 (*self.0.stub)
2200 .create_query_template(self.0.request, self.0.options)
2201 .await
2202 .map(crate::Response::into_body)
2203 }
2204
2205 /// Sets the value of [parent][crate::model::CreateQueryTemplateRequest::parent].
2206 ///
2207 /// This is a **required** field for requests.
2208 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2209 self.0.request.parent = v.into();
2210 self
2211 }
2212
2213 /// Sets the value of [query_template_id][crate::model::CreateQueryTemplateRequest::query_template_id].
2214 ///
2215 /// This is a **required** field for requests.
2216 pub fn set_query_template_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2217 self.0.request.query_template_id = v.into();
2218 self
2219 }
2220
2221 /// Sets the value of [query_template][crate::model::CreateQueryTemplateRequest::query_template].
2222 ///
2223 /// This is a **required** field for requests.
2224 pub fn set_query_template<T>(mut self, v: T) -> Self
2225 where
2226 T: std::convert::Into<crate::model::QueryTemplate>,
2227 {
2228 self.0.request.query_template = std::option::Option::Some(v.into());
2229 self
2230 }
2231
2232 /// Sets or clears the value of [query_template][crate::model::CreateQueryTemplateRequest::query_template].
2233 ///
2234 /// This is a **required** field for requests.
2235 pub fn set_or_clear_query_template<T>(mut self, v: std::option::Option<T>) -> Self
2236 where
2237 T: std::convert::Into<crate::model::QueryTemplate>,
2238 {
2239 self.0.request.query_template = v.map(|x| x.into());
2240 self
2241 }
2242 }
2243
2244 #[doc(hidden)]
2245 impl crate::RequestBuilder for CreateQueryTemplate {
2246 fn request_options(&mut self) -> &mut crate::RequestOptions {
2247 &mut self.0.options
2248 }
2249 }
2250
2251 /// The request builder for [AnalyticsHubService::get_query_template][crate::client::AnalyticsHubService::get_query_template] calls.
2252 ///
2253 /// # Example
2254 /// ```
2255 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetQueryTemplate;
2256 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2257 ///
2258 /// let builder = prepare_request_builder();
2259 /// let response = builder.send().await?;
2260 /// # Ok(()) }
2261 ///
2262 /// fn prepare_request_builder() -> GetQueryTemplate {
2263 /// # panic!();
2264 /// // ... details omitted ...
2265 /// }
2266 /// ```
2267 #[derive(Clone, Debug)]
2268 pub struct GetQueryTemplate(RequestBuilder<crate::model::GetQueryTemplateRequest>);
2269
2270 impl GetQueryTemplate {
2271 pub(crate) fn new(
2272 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2273 ) -> Self {
2274 Self(RequestBuilder::new(stub))
2275 }
2276
2277 /// Sets the full request, replacing any prior values.
2278 pub fn with_request<V: Into<crate::model::GetQueryTemplateRequest>>(
2279 mut self,
2280 v: V,
2281 ) -> Self {
2282 self.0.request = v.into();
2283 self
2284 }
2285
2286 /// Sets all the options, replacing any prior values.
2287 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2288 self.0.options = v.into();
2289 self
2290 }
2291
2292 /// Sends the request.
2293 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2294 (*self.0.stub)
2295 .get_query_template(self.0.request, self.0.options)
2296 .await
2297 .map(crate::Response::into_body)
2298 }
2299
2300 /// Sets the value of [name][crate::model::GetQueryTemplateRequest::name].
2301 ///
2302 /// This is a **required** field for requests.
2303 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2304 self.0.request.name = v.into();
2305 self
2306 }
2307 }
2308
2309 #[doc(hidden)]
2310 impl crate::RequestBuilder for GetQueryTemplate {
2311 fn request_options(&mut self) -> &mut crate::RequestOptions {
2312 &mut self.0.options
2313 }
2314 }
2315
2316 /// The request builder for [AnalyticsHubService::list_query_templates][crate::client::AnalyticsHubService::list_query_templates] calls.
2317 ///
2318 /// # Example
2319 /// ```
2320 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ListQueryTemplates;
2321 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2322 /// use google_cloud_gax::paginator::ItemPaginator;
2323 ///
2324 /// let builder = prepare_request_builder();
2325 /// let mut items = builder.by_item();
2326 /// while let Some(result) = items.next().await {
2327 /// let item = result?;
2328 /// }
2329 /// # Ok(()) }
2330 ///
2331 /// fn prepare_request_builder() -> ListQueryTemplates {
2332 /// # panic!();
2333 /// // ... details omitted ...
2334 /// }
2335 /// ```
2336 #[derive(Clone, Debug)]
2337 pub struct ListQueryTemplates(RequestBuilder<crate::model::ListQueryTemplatesRequest>);
2338
2339 impl ListQueryTemplates {
2340 pub(crate) fn new(
2341 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2342 ) -> Self {
2343 Self(RequestBuilder::new(stub))
2344 }
2345
2346 /// Sets the full request, replacing any prior values.
2347 pub fn with_request<V: Into<crate::model::ListQueryTemplatesRequest>>(
2348 mut self,
2349 v: V,
2350 ) -> Self {
2351 self.0.request = v.into();
2352 self
2353 }
2354
2355 /// Sets all the options, replacing any prior values.
2356 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2357 self.0.options = v.into();
2358 self
2359 }
2360
2361 /// Sends the request.
2362 pub async fn send(self) -> Result<crate::model::ListQueryTemplatesResponse> {
2363 (*self.0.stub)
2364 .list_query_templates(self.0.request, self.0.options)
2365 .await
2366 .map(crate::Response::into_body)
2367 }
2368
2369 /// Streams each page in the collection.
2370 pub fn by_page(
2371 self,
2372 ) -> impl google_cloud_gax::paginator::Paginator<
2373 crate::model::ListQueryTemplatesResponse,
2374 crate::Error,
2375 > {
2376 use std::clone::Clone;
2377 let token = self.0.request.page_token.clone();
2378 let execute = move |token: String| {
2379 let mut builder = self.clone();
2380 builder.0.request = builder.0.request.set_page_token(token);
2381 builder.send()
2382 };
2383 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2384 }
2385
2386 /// Streams each item in the collection.
2387 pub fn by_item(
2388 self,
2389 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2390 crate::model::ListQueryTemplatesResponse,
2391 crate::Error,
2392 > {
2393 use google_cloud_gax::paginator::Paginator;
2394 self.by_page().items()
2395 }
2396
2397 /// Sets the value of [parent][crate::model::ListQueryTemplatesRequest::parent].
2398 ///
2399 /// This is a **required** field for requests.
2400 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2401 self.0.request.parent = v.into();
2402 self
2403 }
2404
2405 /// Sets the value of [page_size][crate::model::ListQueryTemplatesRequest::page_size].
2406 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2407 self.0.request.page_size = v.into();
2408 self
2409 }
2410
2411 /// Sets the value of [page_token][crate::model::ListQueryTemplatesRequest::page_token].
2412 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2413 self.0.request.page_token = v.into();
2414 self
2415 }
2416 }
2417
2418 #[doc(hidden)]
2419 impl crate::RequestBuilder for ListQueryTemplates {
2420 fn request_options(&mut self) -> &mut crate::RequestOptions {
2421 &mut self.0.options
2422 }
2423 }
2424
2425 /// The request builder for [AnalyticsHubService::update_query_template][crate::client::AnalyticsHubService::update_query_template] calls.
2426 ///
2427 /// # Example
2428 /// ```
2429 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::UpdateQueryTemplate;
2430 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2431 ///
2432 /// let builder = prepare_request_builder();
2433 /// let response = builder.send().await?;
2434 /// # Ok(()) }
2435 ///
2436 /// fn prepare_request_builder() -> UpdateQueryTemplate {
2437 /// # panic!();
2438 /// // ... details omitted ...
2439 /// }
2440 /// ```
2441 #[derive(Clone, Debug)]
2442 pub struct UpdateQueryTemplate(RequestBuilder<crate::model::UpdateQueryTemplateRequest>);
2443
2444 impl UpdateQueryTemplate {
2445 pub(crate) fn new(
2446 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2447 ) -> Self {
2448 Self(RequestBuilder::new(stub))
2449 }
2450
2451 /// Sets the full request, replacing any prior values.
2452 pub fn with_request<V: Into<crate::model::UpdateQueryTemplateRequest>>(
2453 mut self,
2454 v: V,
2455 ) -> Self {
2456 self.0.request = v.into();
2457 self
2458 }
2459
2460 /// Sets all the options, replacing any prior values.
2461 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2462 self.0.options = v.into();
2463 self
2464 }
2465
2466 /// Sends the request.
2467 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2468 (*self.0.stub)
2469 .update_query_template(self.0.request, self.0.options)
2470 .await
2471 .map(crate::Response::into_body)
2472 }
2473
2474 /// Sets the value of [update_mask][crate::model::UpdateQueryTemplateRequest::update_mask].
2475 pub fn set_update_mask<T>(mut self, v: T) -> Self
2476 where
2477 T: std::convert::Into<wkt::FieldMask>,
2478 {
2479 self.0.request.update_mask = std::option::Option::Some(v.into());
2480 self
2481 }
2482
2483 /// Sets or clears the value of [update_mask][crate::model::UpdateQueryTemplateRequest::update_mask].
2484 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2485 where
2486 T: std::convert::Into<wkt::FieldMask>,
2487 {
2488 self.0.request.update_mask = v.map(|x| x.into());
2489 self
2490 }
2491
2492 /// Sets the value of [query_template][crate::model::UpdateQueryTemplateRequest::query_template].
2493 ///
2494 /// This is a **required** field for requests.
2495 pub fn set_query_template<T>(mut self, v: T) -> Self
2496 where
2497 T: std::convert::Into<crate::model::QueryTemplate>,
2498 {
2499 self.0.request.query_template = std::option::Option::Some(v.into());
2500 self
2501 }
2502
2503 /// Sets or clears the value of [query_template][crate::model::UpdateQueryTemplateRequest::query_template].
2504 ///
2505 /// This is a **required** field for requests.
2506 pub fn set_or_clear_query_template<T>(mut self, v: std::option::Option<T>) -> Self
2507 where
2508 T: std::convert::Into<crate::model::QueryTemplate>,
2509 {
2510 self.0.request.query_template = v.map(|x| x.into());
2511 self
2512 }
2513 }
2514
2515 #[doc(hidden)]
2516 impl crate::RequestBuilder for UpdateQueryTemplate {
2517 fn request_options(&mut self) -> &mut crate::RequestOptions {
2518 &mut self.0.options
2519 }
2520 }
2521
2522 /// The request builder for [AnalyticsHubService::delete_query_template][crate::client::AnalyticsHubService::delete_query_template] calls.
2523 ///
2524 /// # Example
2525 /// ```
2526 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::DeleteQueryTemplate;
2527 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2528 ///
2529 /// let builder = prepare_request_builder();
2530 /// let response = builder.send().await?;
2531 /// # Ok(()) }
2532 ///
2533 /// fn prepare_request_builder() -> DeleteQueryTemplate {
2534 /// # panic!();
2535 /// // ... details omitted ...
2536 /// }
2537 /// ```
2538 #[derive(Clone, Debug)]
2539 pub struct DeleteQueryTemplate(RequestBuilder<crate::model::DeleteQueryTemplateRequest>);
2540
2541 impl DeleteQueryTemplate {
2542 pub(crate) fn new(
2543 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2544 ) -> Self {
2545 Self(RequestBuilder::new(stub))
2546 }
2547
2548 /// Sets the full request, replacing any prior values.
2549 pub fn with_request<V: Into<crate::model::DeleteQueryTemplateRequest>>(
2550 mut self,
2551 v: V,
2552 ) -> Self {
2553 self.0.request = v.into();
2554 self
2555 }
2556
2557 /// Sets all the options, replacing any prior values.
2558 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2559 self.0.options = v.into();
2560 self
2561 }
2562
2563 /// Sends the request.
2564 pub async fn send(self) -> Result<()> {
2565 (*self.0.stub)
2566 .delete_query_template(self.0.request, self.0.options)
2567 .await
2568 .map(crate::Response::into_body)
2569 }
2570
2571 /// Sets the value of [name][crate::model::DeleteQueryTemplateRequest::name].
2572 ///
2573 /// This is a **required** field for requests.
2574 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2575 self.0.request.name = v.into();
2576 self
2577 }
2578 }
2579
2580 #[doc(hidden)]
2581 impl crate::RequestBuilder for DeleteQueryTemplate {
2582 fn request_options(&mut self) -> &mut crate::RequestOptions {
2583 &mut self.0.options
2584 }
2585 }
2586
2587 /// The request builder for [AnalyticsHubService::submit_query_template][crate::client::AnalyticsHubService::submit_query_template] calls.
2588 ///
2589 /// # Example
2590 /// ```
2591 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::SubmitQueryTemplate;
2592 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2593 ///
2594 /// let builder = prepare_request_builder();
2595 /// let response = builder.send().await?;
2596 /// # Ok(()) }
2597 ///
2598 /// fn prepare_request_builder() -> SubmitQueryTemplate {
2599 /// # panic!();
2600 /// // ... details omitted ...
2601 /// }
2602 /// ```
2603 #[derive(Clone, Debug)]
2604 pub struct SubmitQueryTemplate(RequestBuilder<crate::model::SubmitQueryTemplateRequest>);
2605
2606 impl SubmitQueryTemplate {
2607 pub(crate) fn new(
2608 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2609 ) -> Self {
2610 Self(RequestBuilder::new(stub))
2611 }
2612
2613 /// Sets the full request, replacing any prior values.
2614 pub fn with_request<V: Into<crate::model::SubmitQueryTemplateRequest>>(
2615 mut self,
2616 v: V,
2617 ) -> Self {
2618 self.0.request = v.into();
2619 self
2620 }
2621
2622 /// Sets all the options, replacing any prior values.
2623 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2624 self.0.options = v.into();
2625 self
2626 }
2627
2628 /// Sends the request.
2629 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2630 (*self.0.stub)
2631 .submit_query_template(self.0.request, self.0.options)
2632 .await
2633 .map(crate::Response::into_body)
2634 }
2635
2636 /// Sets the value of [name][crate::model::SubmitQueryTemplateRequest::name].
2637 ///
2638 /// This is a **required** field for requests.
2639 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2640 self.0.request.name = v.into();
2641 self
2642 }
2643 }
2644
2645 #[doc(hidden)]
2646 impl crate::RequestBuilder for SubmitQueryTemplate {
2647 fn request_options(&mut self) -> &mut crate::RequestOptions {
2648 &mut self.0.options
2649 }
2650 }
2651
2652 /// The request builder for [AnalyticsHubService::approve_query_template][crate::client::AnalyticsHubService::approve_query_template] calls.
2653 ///
2654 /// # Example
2655 /// ```
2656 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::ApproveQueryTemplate;
2657 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2658 ///
2659 /// let builder = prepare_request_builder();
2660 /// let response = builder.send().await?;
2661 /// # Ok(()) }
2662 ///
2663 /// fn prepare_request_builder() -> ApproveQueryTemplate {
2664 /// # panic!();
2665 /// // ... details omitted ...
2666 /// }
2667 /// ```
2668 #[derive(Clone, Debug)]
2669 pub struct ApproveQueryTemplate(RequestBuilder<crate::model::ApproveQueryTemplateRequest>);
2670
2671 impl ApproveQueryTemplate {
2672 pub(crate) fn new(
2673 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2674 ) -> Self {
2675 Self(RequestBuilder::new(stub))
2676 }
2677
2678 /// Sets the full request, replacing any prior values.
2679 pub fn with_request<V: Into<crate::model::ApproveQueryTemplateRequest>>(
2680 mut self,
2681 v: V,
2682 ) -> Self {
2683 self.0.request = v.into();
2684 self
2685 }
2686
2687 /// Sets all the options, replacing any prior values.
2688 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2689 self.0.options = v.into();
2690 self
2691 }
2692
2693 /// Sends the request.
2694 pub async fn send(self) -> Result<crate::model::QueryTemplate> {
2695 (*self.0.stub)
2696 .approve_query_template(self.0.request, self.0.options)
2697 .await
2698 .map(crate::Response::into_body)
2699 }
2700
2701 /// Sets the value of [name][crate::model::ApproveQueryTemplateRequest::name].
2702 ///
2703 /// This is a **required** field for requests.
2704 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2705 self.0.request.name = v.into();
2706 self
2707 }
2708 }
2709
2710 #[doc(hidden)]
2711 impl crate::RequestBuilder for ApproveQueryTemplate {
2712 fn request_options(&mut self) -> &mut crate::RequestOptions {
2713 &mut self.0.options
2714 }
2715 }
2716
2717 /// The request builder for [AnalyticsHubService::get_operation][crate::client::AnalyticsHubService::get_operation] calls.
2718 ///
2719 /// # Example
2720 /// ```
2721 /// # use google_cloud_bigquery_analyticshub_v1::builder::analytics_hub_service::GetOperation;
2722 /// # async fn sample() -> google_cloud_bigquery_analyticshub_v1::Result<()> {
2723 ///
2724 /// let builder = prepare_request_builder();
2725 /// let response = builder.send().await?;
2726 /// # Ok(()) }
2727 ///
2728 /// fn prepare_request_builder() -> GetOperation {
2729 /// # panic!();
2730 /// // ... details omitted ...
2731 /// }
2732 /// ```
2733 #[derive(Clone, Debug)]
2734 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2735
2736 impl GetOperation {
2737 pub(crate) fn new(
2738 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsHubService>,
2739 ) -> Self {
2740 Self(RequestBuilder::new(stub))
2741 }
2742
2743 /// Sets the full request, replacing any prior values.
2744 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2745 mut self,
2746 v: V,
2747 ) -> Self {
2748 self.0.request = v.into();
2749 self
2750 }
2751
2752 /// Sets all the options, replacing any prior values.
2753 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2754 self.0.options = v.into();
2755 self
2756 }
2757
2758 /// Sends the request.
2759 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2760 (*self.0.stub)
2761 .get_operation(self.0.request, self.0.options)
2762 .await
2763 .map(crate::Response::into_body)
2764 }
2765
2766 /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2767 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2768 self.0.request.name = v.into();
2769 self
2770 }
2771 }
2772
2773 #[doc(hidden)]
2774 impl crate::RequestBuilder for GetOperation {
2775 fn request_options(&mut self) -> &mut crate::RequestOptions {
2776 &mut self.0.options
2777 }
2778 }
2779}