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