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