Skip to main content

google_cloud_bigquery_analyticshub_v1/
client.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#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Analytics Hub API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26///    project_id: &str,
27///    location_id: &str,
28/// ) -> anyhow::Result<()> {
29///     let client = AnalyticsHubService::builder().build().await?;
30///     let mut list = client.list_data_exchanges()
31///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
32///         .by_item();
33///     while let Some(item) = list.next().await.transpose()? {
34///         println!("{:?}", item);
35///     }
36///     Ok(())
37/// }
38/// ```
39///
40/// # Service Description
41///
42/// The `AnalyticsHubService` API facilitates data sharing within and across
43/// organizations. It allows data providers to publish listings that reference
44/// shared datasets. With Analytics Hub, users can discover and search for
45/// listings that they have access to. Subscribers can view and subscribe to
46/// listings. When you subscribe to a listing, Analytics Hub creates a linked
47/// dataset in your project.
48///
49/// # Configuration
50///
51/// To configure `AnalyticsHubService` use the `with_*` methods in the type returned
52/// by [builder()][AnalyticsHubService::builder]. The default configuration should
53/// work for most applications. Common configuration changes include
54///
55/// * [with_endpoint()]: by default this client uses the global default endpoint
56///   (`https://analyticshub.googleapis.com`). Applications using regional
57///   endpoints or running in restricted networks (e.g. a network configured
58///   with [Private Google Access with VPC Service Controls]) may want to
59///   override this default.
60/// * [with_credentials()]: by default this client uses
61///   [Application Default Credentials]. Applications using custom
62///   authentication may need to override this default.
63///
64/// [with_endpoint()]: super::builder::analytics_hub_service::ClientBuilder::with_endpoint
65/// [with_credentials()]: super::builder::analytics_hub_service::ClientBuilder::with_credentials
66/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
67/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
68///
69/// # Pooling and Cloning
70///
71/// `AnalyticsHubService` holds a connection pool internally, it is advised to
72/// create one and reuse it. You do not need to wrap `AnalyticsHubService` in
73/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
74/// already uses an `Arc` internally.
75#[derive(Clone, Debug)]
76pub struct AnalyticsHubService {
77    inner: std::sync::Arc<dyn super::stub::dynamic::AnalyticsHubService>,
78}
79
80impl AnalyticsHubService {
81    /// Returns a builder for [AnalyticsHubService].
82    ///
83    /// ```
84    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
85    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
86    /// let client = AnalyticsHubService::builder().build().await?;
87    /// # Ok(()) }
88    /// ```
89    pub fn builder() -> super::builder::analytics_hub_service::ClientBuilder {
90        crate::new_client_builder(super::builder::analytics_hub_service::client::Factory)
91    }
92
93    /// Creates a new client from the provided stub.
94    ///
95    /// The most common case for calling this function is in tests mocking the
96    /// client's behavior.
97    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
98    where
99        T: super::stub::AnalyticsHubService + 'static,
100    {
101        Self { inner: stub.into() }
102    }
103
104    pub(crate) async fn new(
105        config: gaxi::options::ClientConfig,
106    ) -> crate::ClientBuilderResult<Self> {
107        let inner = Self::build_inner(config).await?;
108        Ok(Self { inner })
109    }
110
111    async fn build_inner(
112        conf: gaxi::options::ClientConfig,
113    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AnalyticsHubService>>
114    {
115        if gaxi::options::tracing_enabled(&conf) {
116            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
117        }
118        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
119    }
120
121    async fn build_transport(
122        conf: gaxi::options::ClientConfig,
123    ) -> crate::ClientBuilderResult<impl super::stub::AnalyticsHubService> {
124        super::transport::AnalyticsHubService::new(conf).await
125    }
126
127    async fn build_with_tracing(
128        conf: gaxi::options::ClientConfig,
129    ) -> crate::ClientBuilderResult<impl super::stub::AnalyticsHubService> {
130        Self::build_transport(conf)
131            .await
132            .map(super::tracing::AnalyticsHubService::new)
133    }
134
135    /// Lists all data exchanges in a given project and location.
136    ///
137    /// # Example
138    /// ```
139    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
140    /// use google_cloud_gax::paginator::ItemPaginator as _;
141    /// use google_cloud_bigquery_analyticshub_v1::Result;
142    /// async fn sample(
143    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str
144    /// ) -> Result<()> {
145    ///     let mut list = client.list_data_exchanges()
146    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
147    ///         .by_item();
148    ///     while let Some(item) = list.next().await.transpose()? {
149    ///         println!("{:?}", item);
150    ///     }
151    ///     Ok(())
152    /// }
153    /// ```
154    pub fn list_data_exchanges(&self) -> super::builder::analytics_hub_service::ListDataExchanges {
155        super::builder::analytics_hub_service::ListDataExchanges::new(self.inner.clone())
156    }
157
158    /// Lists all data exchanges from projects in a given organization and
159    /// location.
160    ///
161    /// # Example
162    /// ```
163    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
164    /// use google_cloud_gax::paginator::ItemPaginator as _;
165    /// use google_cloud_bigquery_analyticshub_v1::Result;
166    /// async fn sample(
167    ///    client: &AnalyticsHubService
168    /// ) -> Result<()> {
169    ///     let mut list = client.list_org_data_exchanges()
170    ///         /* set fields */
171    ///         .by_item();
172    ///     while let Some(item) = list.next().await.transpose()? {
173    ///         println!("{:?}", item);
174    ///     }
175    ///     Ok(())
176    /// }
177    /// ```
178    pub fn list_org_data_exchanges(
179        &self,
180    ) -> super::builder::analytics_hub_service::ListOrgDataExchanges {
181        super::builder::analytics_hub_service::ListOrgDataExchanges::new(self.inner.clone())
182    }
183
184    /// Gets the details of a data exchange.
185    ///
186    /// # Example
187    /// ```
188    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
189    /// use google_cloud_bigquery_analyticshub_v1::Result;
190    /// async fn sample(
191    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str
192    /// ) -> Result<()> {
193    ///     let response = client.get_data_exchange()
194    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}"))
195    ///         .send().await?;
196    ///     println!("response {:?}", response);
197    ///     Ok(())
198    /// }
199    /// ```
200    pub fn get_data_exchange(&self) -> super::builder::analytics_hub_service::GetDataExchange {
201        super::builder::analytics_hub_service::GetDataExchange::new(self.inner.clone())
202    }
203
204    /// Creates a new data exchange.
205    ///
206    /// # Example
207    /// ```
208    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
209    /// use google_cloud_bigquery_analyticshub_v1::model::DataExchange;
210    /// use google_cloud_bigquery_analyticshub_v1::Result;
211    /// async fn sample(
212    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str
213    /// ) -> Result<()> {
214    ///     let response = client.create_data_exchange()
215    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
216    ///         .set_data_exchange(
217    ///             DataExchange::new()/* set fields */
218    ///         )
219    ///         .send().await?;
220    ///     println!("response {:?}", response);
221    ///     Ok(())
222    /// }
223    /// ```
224    pub fn create_data_exchange(
225        &self,
226    ) -> super::builder::analytics_hub_service::CreateDataExchange {
227        super::builder::analytics_hub_service::CreateDataExchange::new(self.inner.clone())
228    }
229
230    /// Updates an existing data exchange.
231    ///
232    /// # Example
233    /// ```
234    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
235    /// # extern crate wkt as google_cloud_wkt;
236    /// use google_cloud_wkt::FieldMask;
237    /// use google_cloud_bigquery_analyticshub_v1::model::DataExchange;
238    /// use google_cloud_bigquery_analyticshub_v1::Result;
239    /// async fn sample(
240    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str
241    /// ) -> Result<()> {
242    ///     let response = client.update_data_exchange()
243    ///         .set_data_exchange(
244    ///             DataExchange::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}"))/* set fields */
245    ///         )
246    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
247    ///         .send().await?;
248    ///     println!("response {:?}", response);
249    ///     Ok(())
250    /// }
251    /// ```
252    pub fn update_data_exchange(
253        &self,
254    ) -> super::builder::analytics_hub_service::UpdateDataExchange {
255        super::builder::analytics_hub_service::UpdateDataExchange::new(self.inner.clone())
256    }
257
258    /// Deletes an existing data exchange.
259    ///
260    /// # Example
261    /// ```
262    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
263    /// use google_cloud_bigquery_analyticshub_v1::Result;
264    /// async fn sample(
265    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str
266    /// ) -> Result<()> {
267    ///     client.delete_data_exchange()
268    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}"))
269    ///         .send().await?;
270    ///     Ok(())
271    /// }
272    /// ```
273    pub fn delete_data_exchange(
274        &self,
275    ) -> super::builder::analytics_hub_service::DeleteDataExchange {
276        super::builder::analytics_hub_service::DeleteDataExchange::new(self.inner.clone())
277    }
278
279    /// Lists all listings in a given project and location.
280    ///
281    /// # Example
282    /// ```
283    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
284    /// use google_cloud_gax::paginator::ItemPaginator as _;
285    /// use google_cloud_bigquery_analyticshub_v1::Result;
286    /// async fn sample(
287    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str
288    /// ) -> Result<()> {
289    ///     let mut list = client.list_listings()
290    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}"))
291    ///         .by_item();
292    ///     while let Some(item) = list.next().await.transpose()? {
293    ///         println!("{:?}", item);
294    ///     }
295    ///     Ok(())
296    /// }
297    /// ```
298    pub fn list_listings(&self) -> super::builder::analytics_hub_service::ListListings {
299        super::builder::analytics_hub_service::ListListings::new(self.inner.clone())
300    }
301
302    /// Gets the details of a listing.
303    ///
304    /// # Example
305    /// ```
306    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
307    /// use google_cloud_bigquery_analyticshub_v1::Result;
308    /// async fn sample(
309    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str, listing_id: &str
310    /// ) -> Result<()> {
311    ///     let response = client.get_listing()
312    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}/listings/{listing_id}"))
313    ///         .send().await?;
314    ///     println!("response {:?}", response);
315    ///     Ok(())
316    /// }
317    /// ```
318    pub fn get_listing(&self) -> super::builder::analytics_hub_service::GetListing {
319        super::builder::analytics_hub_service::GetListing::new(self.inner.clone())
320    }
321
322    /// Creates a new listing.
323    ///
324    /// # Example
325    /// ```
326    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
327    /// use google_cloud_bigquery_analyticshub_v1::model::Listing;
328    /// use google_cloud_bigquery_analyticshub_v1::Result;
329    /// async fn sample(
330    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str
331    /// ) -> Result<()> {
332    ///     let response = client.create_listing()
333    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}"))
334    ///         .set_listing_id("listing_id_value")
335    ///         .set_listing(
336    ///             Listing::new()/* set fields */
337    ///         )
338    ///         .send().await?;
339    ///     println!("response {:?}", response);
340    ///     Ok(())
341    /// }
342    /// ```
343    pub fn create_listing(&self) -> super::builder::analytics_hub_service::CreateListing {
344        super::builder::analytics_hub_service::CreateListing::new(self.inner.clone())
345    }
346
347    /// Updates an existing listing.
348    ///
349    /// # Example
350    /// ```
351    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
352    /// # extern crate wkt as google_cloud_wkt;
353    /// use google_cloud_wkt::FieldMask;
354    /// use google_cloud_bigquery_analyticshub_v1::model::Listing;
355    /// use google_cloud_bigquery_analyticshub_v1::Result;
356    /// async fn sample(
357    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str, listing_id: &str
358    /// ) -> Result<()> {
359    ///     let response = client.update_listing()
360    ///         .set_listing(
361    ///             Listing::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}/listings/{listing_id}"))/* set fields */
362    ///         )
363    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
364    ///         .send().await?;
365    ///     println!("response {:?}", response);
366    ///     Ok(())
367    /// }
368    /// ```
369    pub fn update_listing(&self) -> super::builder::analytics_hub_service::UpdateListing {
370        super::builder::analytics_hub_service::UpdateListing::new(self.inner.clone())
371    }
372
373    /// Deletes a listing.
374    ///
375    /// # Example
376    /// ```
377    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
378    /// use google_cloud_bigquery_analyticshub_v1::Result;
379    /// async fn sample(
380    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str, listing_id: &str
381    /// ) -> Result<()> {
382    ///     client.delete_listing()
383    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}/listings/{listing_id}"))
384    ///         .send().await?;
385    ///     Ok(())
386    /// }
387    /// ```
388    pub fn delete_listing(&self) -> super::builder::analytics_hub_service::DeleteListing {
389        super::builder::analytics_hub_service::DeleteListing::new(self.inner.clone())
390    }
391
392    /// Subscribes to a listing.
393    ///
394    /// Currently, with Analytics Hub, you can create listings that
395    /// reference only BigQuery datasets.
396    /// Upon subscription to a listing for a BigQuery dataset, Analytics Hub
397    /// creates a linked dataset in the subscriber's project.
398    ///
399    /// # Example
400    /// ```
401    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
402    /// use google_cloud_bigquery_analyticshub_v1::Result;
403    /// async fn sample(
404    ///    client: &AnalyticsHubService
405    /// ) -> Result<()> {
406    ///     let response = client.subscribe_listing()
407    ///         /* set fields */
408    ///         .send().await?;
409    ///     println!("response {:?}", response);
410    ///     Ok(())
411    /// }
412    /// ```
413    pub fn subscribe_listing(&self) -> super::builder::analytics_hub_service::SubscribeListing {
414        super::builder::analytics_hub_service::SubscribeListing::new(self.inner.clone())
415    }
416
417    /// Creates a Subscription to a Data Clean Room. This is a
418    /// long-running operation as it will create one or more linked datasets.
419    /// Throws a Bad Request error if the Data Exchange does not contain any
420    /// listings.
421    ///
422    /// # Long running operations
423    ///
424    /// This method is used to start, and/or poll a [long-running Operation].
425    /// The [Working with long-running operations] chapter in the [user guide]
426    /// covers these operations in detail.
427    ///
428    /// [long-running operation]: https://google.aip.dev/151
429    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
430    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
431    ///
432    /// # Example
433    /// ```
434    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
435    /// use google_cloud_lro::Poller;
436    /// use google_cloud_bigquery_analyticshub_v1::Result;
437    /// async fn sample(
438    ///    client: &AnalyticsHubService
439    /// ) -> Result<()> {
440    ///     let response = client.subscribe_data_exchange()
441    ///         /* set fields */
442    ///         .poller().until_done().await?;
443    ///     println!("response {:?}", response);
444    ///     Ok(())
445    /// }
446    /// ```
447    pub fn subscribe_data_exchange(
448        &self,
449    ) -> super::builder::analytics_hub_service::SubscribeDataExchange {
450        super::builder::analytics_hub_service::SubscribeDataExchange::new(self.inner.clone())
451    }
452
453    /// Refreshes a Subscription to a Data Exchange. A Data Exchange can become
454    /// stale when a publisher adds or removes data. This is a long-running
455    /// operation as it may create many linked datasets.
456    ///
457    /// # Long running operations
458    ///
459    /// This method is used to start, and/or poll a [long-running Operation].
460    /// The [Working with long-running operations] chapter in the [user guide]
461    /// covers these operations in detail.
462    ///
463    /// [long-running operation]: https://google.aip.dev/151
464    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
465    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
466    ///
467    /// # Example
468    /// ```
469    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
470    /// use google_cloud_lro::Poller;
471    /// use google_cloud_bigquery_analyticshub_v1::Result;
472    /// async fn sample(
473    ///    client: &AnalyticsHubService
474    /// ) -> Result<()> {
475    ///     let response = client.refresh_subscription()
476    ///         /* set fields */
477    ///         .poller().until_done().await?;
478    ///     println!("response {:?}", response);
479    ///     Ok(())
480    /// }
481    /// ```
482    pub fn refresh_subscription(
483        &self,
484    ) -> super::builder::analytics_hub_service::RefreshSubscription {
485        super::builder::analytics_hub_service::RefreshSubscription::new(self.inner.clone())
486    }
487
488    /// Gets the details of a Subscription.
489    ///
490    /// # Example
491    /// ```
492    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
493    /// use google_cloud_bigquery_analyticshub_v1::Result;
494    /// async fn sample(
495    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, subscription_id: &str
496    /// ) -> Result<()> {
497    ///     let response = client.get_subscription()
498    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/subscriptions/{subscription_id}"))
499    ///         .send().await?;
500    ///     println!("response {:?}", response);
501    ///     Ok(())
502    /// }
503    /// ```
504    pub fn get_subscription(&self) -> super::builder::analytics_hub_service::GetSubscription {
505        super::builder::analytics_hub_service::GetSubscription::new(self.inner.clone())
506    }
507
508    /// Lists all subscriptions in a given project and location.
509    ///
510    /// # Example
511    /// ```
512    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
513    /// use google_cloud_gax::paginator::ItemPaginator as _;
514    /// use google_cloud_bigquery_analyticshub_v1::Result;
515    /// async fn sample(
516    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str
517    /// ) -> Result<()> {
518    ///     let mut list = client.list_subscriptions()
519    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
520    ///         .by_item();
521    ///     while let Some(item) = list.next().await.transpose()? {
522    ///         println!("{:?}", item);
523    ///     }
524    ///     Ok(())
525    /// }
526    /// ```
527    pub fn list_subscriptions(&self) -> super::builder::analytics_hub_service::ListSubscriptions {
528        super::builder::analytics_hub_service::ListSubscriptions::new(self.inner.clone())
529    }
530
531    /// Lists all subscriptions on a given Data Exchange or Listing.
532    ///
533    /// # Example
534    /// ```
535    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
536    /// use google_cloud_gax::paginator::ItemPaginator as _;
537    /// use google_cloud_bigquery_analyticshub_v1::Result;
538    /// async fn sample(
539    ///    client: &AnalyticsHubService
540    /// ) -> Result<()> {
541    ///     let mut list = client.list_shared_resource_subscriptions()
542    ///         /* set fields */
543    ///         .by_item();
544    ///     while let Some(item) = list.next().await.transpose()? {
545    ///         println!("{:?}", item);
546    ///     }
547    ///     Ok(())
548    /// }
549    /// ```
550    pub fn list_shared_resource_subscriptions(
551        &self,
552    ) -> super::builder::analytics_hub_service::ListSharedResourceSubscriptions {
553        super::builder::analytics_hub_service::ListSharedResourceSubscriptions::new(
554            self.inner.clone(),
555        )
556    }
557
558    /// Revokes a given subscription.
559    ///
560    /// # Example
561    /// ```
562    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
563    /// use google_cloud_bigquery_analyticshub_v1::Result;
564    /// async fn sample(
565    ///    client: &AnalyticsHubService
566    /// ) -> Result<()> {
567    ///     let response = client.revoke_subscription()
568    ///         /* set fields */
569    ///         .send().await?;
570    ///     println!("response {:?}", response);
571    ///     Ok(())
572    /// }
573    /// ```
574    pub fn revoke_subscription(&self) -> super::builder::analytics_hub_service::RevokeSubscription {
575        super::builder::analytics_hub_service::RevokeSubscription::new(self.inner.clone())
576    }
577
578    /// Deletes a subscription.
579    ///
580    /// # Long running operations
581    ///
582    /// This method is used to start, and/or poll a [long-running Operation].
583    /// The [Working with long-running operations] chapter in the [user guide]
584    /// covers these operations in detail.
585    ///
586    /// [long-running operation]: https://google.aip.dev/151
587    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
588    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
589    ///
590    /// # Example
591    /// ```
592    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
593    /// use google_cloud_lro::Poller;
594    /// use google_cloud_bigquery_analyticshub_v1::Result;
595    /// async fn sample(
596    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, subscription_id: &str
597    /// ) -> Result<()> {
598    ///     client.delete_subscription()
599    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/subscriptions/{subscription_id}"))
600    ///         .poller().until_done().await?;
601    ///     Ok(())
602    /// }
603    /// ```
604    pub fn delete_subscription(&self) -> super::builder::analytics_hub_service::DeleteSubscription {
605        super::builder::analytics_hub_service::DeleteSubscription::new(self.inner.clone())
606    }
607
608    /// Gets the IAM policy.
609    ///
610    /// # Example
611    /// ```
612    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
613    /// use google_cloud_bigquery_analyticshub_v1::Result;
614    /// async fn sample(
615    ///    client: &AnalyticsHubService
616    /// ) -> Result<()> {
617    ///     let response = client.get_iam_policy()
618    ///         /* set fields */
619    ///         .send().await?;
620    ///     println!("response {:?}", response);
621    ///     Ok(())
622    /// }
623    /// ```
624    pub fn get_iam_policy(&self) -> super::builder::analytics_hub_service::GetIamPolicy {
625        super::builder::analytics_hub_service::GetIamPolicy::new(self.inner.clone())
626    }
627
628    /// Sets the IAM policy.
629    ///
630    /// # Example
631    /// ```
632    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
633    /// use google_cloud_bigquery_analyticshub_v1::Result;
634    /// async fn sample(
635    ///    client: &AnalyticsHubService
636    /// ) -> Result<()> {
637    ///     let response = client.set_iam_policy()
638    ///         /* set fields */
639    ///         .send().await?;
640    ///     println!("response {:?}", response);
641    ///     Ok(())
642    /// }
643    /// ```
644    pub fn set_iam_policy(&self) -> super::builder::analytics_hub_service::SetIamPolicy {
645        super::builder::analytics_hub_service::SetIamPolicy::new(self.inner.clone())
646    }
647
648    /// Returns the permissions that a caller has.
649    ///
650    /// # Example
651    /// ```
652    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
653    /// use google_cloud_bigquery_analyticshub_v1::Result;
654    /// async fn sample(
655    ///    client: &AnalyticsHubService
656    /// ) -> Result<()> {
657    ///     let response = client.test_iam_permissions()
658    ///         /* set fields */
659    ///         .send().await?;
660    ///     println!("response {:?}", response);
661    ///     Ok(())
662    /// }
663    /// ```
664    pub fn test_iam_permissions(
665        &self,
666    ) -> super::builder::analytics_hub_service::TestIamPermissions {
667        super::builder::analytics_hub_service::TestIamPermissions::new(self.inner.clone())
668    }
669
670    /// Creates a new QueryTemplate
671    ///
672    /// # Example
673    /// ```
674    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
675    /// use google_cloud_bigquery_analyticshub_v1::model::QueryTemplate;
676    /// use google_cloud_bigquery_analyticshub_v1::Result;
677    /// async fn sample(
678    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str
679    /// ) -> Result<()> {
680    ///     let response = client.create_query_template()
681    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}"))
682    ///         .set_query_template(
683    ///             QueryTemplate::new()/* set fields */
684    ///         )
685    ///         .send().await?;
686    ///     println!("response {:?}", response);
687    ///     Ok(())
688    /// }
689    /// ```
690    pub fn create_query_template(
691        &self,
692    ) -> super::builder::analytics_hub_service::CreateQueryTemplate {
693        super::builder::analytics_hub_service::CreateQueryTemplate::new(self.inner.clone())
694    }
695
696    /// Gets a QueryTemplate
697    ///
698    /// # Example
699    /// ```
700    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
701    /// use google_cloud_bigquery_analyticshub_v1::Result;
702    /// async fn sample(
703    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str, query_template_id: &str
704    /// ) -> Result<()> {
705    ///     let response = client.get_query_template()
706    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}/queryTemplates/{query_template_id}"))
707    ///         .send().await?;
708    ///     println!("response {:?}", response);
709    ///     Ok(())
710    /// }
711    /// ```
712    pub fn get_query_template(&self) -> super::builder::analytics_hub_service::GetQueryTemplate {
713        super::builder::analytics_hub_service::GetQueryTemplate::new(self.inner.clone())
714    }
715
716    /// Lists all QueryTemplates in a given project and location.
717    ///
718    /// # Example
719    /// ```
720    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
721    /// use google_cloud_gax::paginator::ItemPaginator as _;
722    /// use google_cloud_bigquery_analyticshub_v1::Result;
723    /// async fn sample(
724    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str
725    /// ) -> Result<()> {
726    ///     let mut list = client.list_query_templates()
727    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}"))
728    ///         .by_item();
729    ///     while let Some(item) = list.next().await.transpose()? {
730    ///         println!("{:?}", item);
731    ///     }
732    ///     Ok(())
733    /// }
734    /// ```
735    pub fn list_query_templates(
736        &self,
737    ) -> super::builder::analytics_hub_service::ListQueryTemplates {
738        super::builder::analytics_hub_service::ListQueryTemplates::new(self.inner.clone())
739    }
740
741    /// Updates an existing QueryTemplate
742    ///
743    /// # Example
744    /// ```
745    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
746    /// # extern crate wkt as google_cloud_wkt;
747    /// use google_cloud_wkt::FieldMask;
748    /// use google_cloud_bigquery_analyticshub_v1::model::QueryTemplate;
749    /// use google_cloud_bigquery_analyticshub_v1::Result;
750    /// async fn sample(
751    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str, query_template_id: &str
752    /// ) -> Result<()> {
753    ///     let response = client.update_query_template()
754    ///         .set_query_template(
755    ///             QueryTemplate::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}/queryTemplates/{query_template_id}"))/* set fields */
756    ///         )
757    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
758    ///         .send().await?;
759    ///     println!("response {:?}", response);
760    ///     Ok(())
761    /// }
762    /// ```
763    pub fn update_query_template(
764        &self,
765    ) -> super::builder::analytics_hub_service::UpdateQueryTemplate {
766        super::builder::analytics_hub_service::UpdateQueryTemplate::new(self.inner.clone())
767    }
768
769    /// Deletes a query template.
770    ///
771    /// # Example
772    /// ```
773    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
774    /// use google_cloud_bigquery_analyticshub_v1::Result;
775    /// async fn sample(
776    ///    client: &AnalyticsHubService, project_id: &str, location_id: &str, data_exchange_id: &str, query_template_id: &str
777    /// ) -> Result<()> {
778    ///     client.delete_query_template()
779    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataExchanges/{data_exchange_id}/queryTemplates/{query_template_id}"))
780    ///         .send().await?;
781    ///     Ok(())
782    /// }
783    /// ```
784    pub fn delete_query_template(
785        &self,
786    ) -> super::builder::analytics_hub_service::DeleteQueryTemplate {
787        super::builder::analytics_hub_service::DeleteQueryTemplate::new(self.inner.clone())
788    }
789
790    /// Submits a query template for approval.
791    ///
792    /// # Example
793    /// ```
794    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
795    /// use google_cloud_bigquery_analyticshub_v1::Result;
796    /// async fn sample(
797    ///    client: &AnalyticsHubService
798    /// ) -> Result<()> {
799    ///     let response = client.submit_query_template()
800    ///         /* set fields */
801    ///         .send().await?;
802    ///     println!("response {:?}", response);
803    ///     Ok(())
804    /// }
805    /// ```
806    pub fn submit_query_template(
807        &self,
808    ) -> super::builder::analytics_hub_service::SubmitQueryTemplate {
809        super::builder::analytics_hub_service::SubmitQueryTemplate::new(self.inner.clone())
810    }
811
812    /// Approves a query template.
813    ///
814    /// # Example
815    /// ```
816    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
817    /// use google_cloud_bigquery_analyticshub_v1::Result;
818    /// async fn sample(
819    ///    client: &AnalyticsHubService
820    /// ) -> Result<()> {
821    ///     let response = client.approve_query_template()
822    ///         /* set fields */
823    ///         .send().await?;
824    ///     println!("response {:?}", response);
825    ///     Ok(())
826    /// }
827    /// ```
828    pub fn approve_query_template(
829        &self,
830    ) -> super::builder::analytics_hub_service::ApproveQueryTemplate {
831        super::builder::analytics_hub_service::ApproveQueryTemplate::new(self.inner.clone())
832    }
833
834    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
835    ///
836    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
837    ///
838    /// # Example
839    /// ```
840    /// # use google_cloud_bigquery_analyticshub_v1::client::AnalyticsHubService;
841    /// use google_cloud_bigquery_analyticshub_v1::Result;
842    /// async fn sample(
843    ///    client: &AnalyticsHubService
844    /// ) -> Result<()> {
845    ///     let response = client.get_operation()
846    ///         /* set fields */
847    ///         .send().await?;
848    ///     println!("response {:?}", response);
849    ///     Ok(())
850    /// }
851    /// ```
852    pub fn get_operation(&self) -> super::builder::analytics_hub_service::GetOperation {
853        super::builder::analytics_hub_service::GetOperation::new(self.inner.clone())
854    }
855}