google_cloud_bigtable_admin_v2/
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 Cloud Bigtable Admin API.
20///
21/// # Example
22/// ```
23/// # tokio_test::block_on(async {
24/// # use google_cloud_bigtable_admin_v2::client::BigtableInstanceAdmin;
25/// let client = BigtableInstanceAdmin::builder().build().await?;
26/// // use `client` to make requests to the Cloud Bigtable Admin API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// Service for creating, configuring, and deleting Cloud Bigtable Instances and
33/// Clusters. Provides access to the Instance and Cluster schemas only, not the
34/// tables' metadata or data stored in those tables.
35///
36/// # Configuration
37///
38/// To configure `BigtableInstanceAdmin` use the `with_*` methods in the type returned
39/// by [builder()][BigtableInstanceAdmin::builder]. The default configuration should
40/// work for most applications. Common configuration changes include
41///
42/// * [with_endpoint()]: by default this client uses the global default endpoint
43///   (`https://bigtableadmin.googleapis.com`). Applications using regional
44///   endpoints or running in restricted networks (e.g. a network configured
45//    with [Private Google Access with VPC Service Controls]) may want to
46///   override this default.
47/// * [with_credentials()]: by default this client uses
48///   [Application Default Credentials]. Applications using custom
49///   authentication may need to override this default.
50///
51/// [with_endpoint()]: super::builder::bigtable_instance_admin::ClientBuilder::with_endpoint
52/// [with_credentials()]: super::builder::bigtable_instance_admin::ClientBuilder::credentials
53/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
54/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
55///
56/// # Pooling and Cloning
57///
58/// `BigtableInstanceAdmin` holds a connection pool internally, it is advised to
59/// create one and the reuse it.  You do not need to wrap `BigtableInstanceAdmin` in
60/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
61/// already uses an `Arc` internally.
62#[derive(Clone, Debug)]
63pub struct BigtableInstanceAdmin {
64    inner: std::sync::Arc<dyn super::stub::dynamic::BigtableInstanceAdmin>,
65}
66
67impl BigtableInstanceAdmin {
68    /// Returns a builder for [BigtableInstanceAdmin].
69    ///
70    /// ```
71    /// # tokio_test::block_on(async {
72    /// # use google_cloud_bigtable_admin_v2::client::BigtableInstanceAdmin;
73    /// let client = BigtableInstanceAdmin::builder().build().await?;
74    /// # gax::client_builder::Result::<()>::Ok(()) });
75    /// ```
76    pub fn builder() -> super::builder::bigtable_instance_admin::ClientBuilder {
77        gax::client_builder::internal::new_builder(
78            super::builder::bigtable_instance_admin::client::Factory,
79        )
80    }
81
82    /// Creates a new client from the provided stub.
83    ///
84    /// The most common case for calling this function is in tests mocking the
85    /// client's behavior.
86    pub fn from_stub<T>(stub: T) -> Self
87    where
88        T: super::stub::BigtableInstanceAdmin + 'static,
89    {
90        Self {
91            inner: std::sync::Arc::new(stub),
92        }
93    }
94
95    pub(crate) async fn new(
96        config: gaxi::options::ClientConfig,
97    ) -> gax::client_builder::Result<Self> {
98        let inner = Self::build_inner(config).await?;
99        Ok(Self { inner })
100    }
101
102    async fn build_inner(
103        conf: gaxi::options::ClientConfig,
104    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::BigtableInstanceAdmin>>
105    {
106        if gaxi::options::tracing_enabled(&conf) {
107            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
108        }
109        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
110    }
111
112    async fn build_transport(
113        conf: gaxi::options::ClientConfig,
114    ) -> gax::client_builder::Result<impl super::stub::BigtableInstanceAdmin> {
115        super::transport::BigtableInstanceAdmin::new(conf).await
116    }
117
118    async fn build_with_tracing(
119        conf: gaxi::options::ClientConfig,
120    ) -> gax::client_builder::Result<impl super::stub::BigtableInstanceAdmin> {
121        Self::build_transport(conf)
122            .await
123            .map(super::tracing::BigtableInstanceAdmin::new)
124    }
125
126    /// Create an instance within a project.
127    ///
128    /// Note that exactly one of Cluster.serve_nodes and
129    /// Cluster.cluster_config.cluster_autoscaling_config can be set. If
130    /// serve_nodes is set to non-zero, then the cluster is manually scaled. If
131    /// cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is
132    /// enabled.
133    ///
134    /// # Long running operations
135    ///
136    /// This method is used to start, and/or poll a [long-running Operation].
137    /// The [Working with long-running operations] chapter in the [user guide]
138    /// covers these operations in detail.
139    ///
140    /// [long-running operation]: https://google.aip.dev/151
141    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
142    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
143    pub fn create_instance(&self) -> super::builder::bigtable_instance_admin::CreateInstance {
144        super::builder::bigtable_instance_admin::CreateInstance::new(self.inner.clone())
145    }
146
147    /// Gets information about an instance.
148    pub fn get_instance(&self) -> super::builder::bigtable_instance_admin::GetInstance {
149        super::builder::bigtable_instance_admin::GetInstance::new(self.inner.clone())
150    }
151
152    /// Lists information about instances in a project.
153    pub fn list_instances(&self) -> super::builder::bigtable_instance_admin::ListInstances {
154        super::builder::bigtable_instance_admin::ListInstances::new(self.inner.clone())
155    }
156
157    /// Updates an instance within a project. This method updates only the display
158    /// name and type for an Instance. To update other Instance properties, such as
159    /// labels, use PartialUpdateInstance.
160    pub fn update_instance(&self) -> super::builder::bigtable_instance_admin::UpdateInstance {
161        super::builder::bigtable_instance_admin::UpdateInstance::new(self.inner.clone())
162    }
163
164    /// Partially updates an instance within a project. This method can modify all
165    /// fields of an Instance and is the preferred way to update an Instance.
166    ///
167    /// # Long running operations
168    ///
169    /// This method is used to start, and/or poll a [long-running Operation].
170    /// The [Working with long-running operations] chapter in the [user guide]
171    /// covers these operations in detail.
172    ///
173    /// [long-running operation]: https://google.aip.dev/151
174    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
175    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
176    pub fn partial_update_instance(
177        &self,
178    ) -> super::builder::bigtable_instance_admin::PartialUpdateInstance {
179        super::builder::bigtable_instance_admin::PartialUpdateInstance::new(self.inner.clone())
180    }
181
182    /// Delete an instance from a project.
183    pub fn delete_instance(&self) -> super::builder::bigtable_instance_admin::DeleteInstance {
184        super::builder::bigtable_instance_admin::DeleteInstance::new(self.inner.clone())
185    }
186
187    /// Creates a cluster within an instance.
188    ///
189    /// Note that exactly one of Cluster.serve_nodes and
190    /// Cluster.cluster_config.cluster_autoscaling_config can be set. If
191    /// serve_nodes is set to non-zero, then the cluster is manually scaled. If
192    /// cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is
193    /// enabled.
194    ///
195    /// # Long running operations
196    ///
197    /// This method is used to start, and/or poll a [long-running Operation].
198    /// The [Working with long-running operations] chapter in the [user guide]
199    /// covers these operations in detail.
200    ///
201    /// [long-running operation]: https://google.aip.dev/151
202    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
203    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
204    pub fn create_cluster(&self) -> super::builder::bigtable_instance_admin::CreateCluster {
205        super::builder::bigtable_instance_admin::CreateCluster::new(self.inner.clone())
206    }
207
208    /// Gets information about a cluster.
209    pub fn get_cluster(&self) -> super::builder::bigtable_instance_admin::GetCluster {
210        super::builder::bigtable_instance_admin::GetCluster::new(self.inner.clone())
211    }
212
213    /// Lists information about clusters in an instance.
214    pub fn list_clusters(&self) -> super::builder::bigtable_instance_admin::ListClusters {
215        super::builder::bigtable_instance_admin::ListClusters::new(self.inner.clone())
216    }
217
218    /// Updates a cluster within an instance.
219    ///
220    /// Note that UpdateCluster does not support updating
221    /// cluster_config.cluster_autoscaling_config. In order to update it, you
222    /// must use PartialUpdateCluster.
223    ///
224    /// # Long running operations
225    ///
226    /// This method is used to start, and/or poll a [long-running Operation].
227    /// The [Working with long-running operations] chapter in the [user guide]
228    /// covers these operations in detail.
229    ///
230    /// [long-running operation]: https://google.aip.dev/151
231    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
232    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
233    pub fn update_cluster(&self) -> super::builder::bigtable_instance_admin::UpdateCluster {
234        super::builder::bigtable_instance_admin::UpdateCluster::new(self.inner.clone())
235    }
236
237    /// Partially updates a cluster within a project. This method is the preferred
238    /// way to update a Cluster.
239    ///
240    /// To enable and update autoscaling, set
241    /// cluster_config.cluster_autoscaling_config. When autoscaling is enabled,
242    /// serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it
243    /// are ignored. Note that an update cannot simultaneously set serve_nodes to
244    /// non-zero and cluster_config.cluster_autoscaling_config to non-empty, and
245    /// also specify both in the update_mask.
246    ///
247    /// To disable autoscaling, clear cluster_config.cluster_autoscaling_config,
248    /// and explicitly set a serve_node count via the update_mask.
249    ///
250    /// # Long running operations
251    ///
252    /// This method is used to start, and/or poll a [long-running Operation].
253    /// The [Working with long-running operations] chapter in the [user guide]
254    /// covers these operations in detail.
255    ///
256    /// [long-running operation]: https://google.aip.dev/151
257    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
258    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
259    pub fn partial_update_cluster(
260        &self,
261    ) -> super::builder::bigtable_instance_admin::PartialUpdateCluster {
262        super::builder::bigtable_instance_admin::PartialUpdateCluster::new(self.inner.clone())
263    }
264
265    /// Deletes a cluster from an instance.
266    pub fn delete_cluster(&self) -> super::builder::bigtable_instance_admin::DeleteCluster {
267        super::builder::bigtable_instance_admin::DeleteCluster::new(self.inner.clone())
268    }
269
270    /// Creates an app profile within an instance.
271    pub fn create_app_profile(&self) -> super::builder::bigtable_instance_admin::CreateAppProfile {
272        super::builder::bigtable_instance_admin::CreateAppProfile::new(self.inner.clone())
273    }
274
275    /// Gets information about an app profile.
276    pub fn get_app_profile(&self) -> super::builder::bigtable_instance_admin::GetAppProfile {
277        super::builder::bigtable_instance_admin::GetAppProfile::new(self.inner.clone())
278    }
279
280    /// Lists information about app profiles in an instance.
281    pub fn list_app_profiles(&self) -> super::builder::bigtable_instance_admin::ListAppProfiles {
282        super::builder::bigtable_instance_admin::ListAppProfiles::new(self.inner.clone())
283    }
284
285    /// Updates an app profile within an instance.
286    ///
287    /// # Long running operations
288    ///
289    /// This method is used to start, and/or poll a [long-running Operation].
290    /// The [Working with long-running operations] chapter in the [user guide]
291    /// covers these operations in detail.
292    ///
293    /// [long-running operation]: https://google.aip.dev/151
294    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
295    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
296    pub fn update_app_profile(&self) -> super::builder::bigtable_instance_admin::UpdateAppProfile {
297        super::builder::bigtable_instance_admin::UpdateAppProfile::new(self.inner.clone())
298    }
299
300    /// Deletes an app profile from an instance.
301    pub fn delete_app_profile(&self) -> super::builder::bigtable_instance_admin::DeleteAppProfile {
302        super::builder::bigtable_instance_admin::DeleteAppProfile::new(self.inner.clone())
303    }
304
305    /// Gets the access control policy for an instance resource. Returns an empty
306    /// policy if an instance exists but does not have a policy set.
307    pub fn get_iam_policy(&self) -> super::builder::bigtable_instance_admin::GetIamPolicy {
308        super::builder::bigtable_instance_admin::GetIamPolicy::new(self.inner.clone())
309    }
310
311    /// Sets the access control policy on an instance resource. Replaces any
312    /// existing policy.
313    pub fn set_iam_policy(&self) -> super::builder::bigtable_instance_admin::SetIamPolicy {
314        super::builder::bigtable_instance_admin::SetIamPolicy::new(self.inner.clone())
315    }
316
317    /// Returns permissions that the caller has on the specified instance resource.
318    pub fn test_iam_permissions(
319        &self,
320    ) -> super::builder::bigtable_instance_admin::TestIamPermissions {
321        super::builder::bigtable_instance_admin::TestIamPermissions::new(self.inner.clone())
322    }
323
324    /// Lists hot tablets in a cluster, within the time range provided. Hot
325    /// tablets are ordered based on CPU usage.
326    pub fn list_hot_tablets(&self) -> super::builder::bigtable_instance_admin::ListHotTablets {
327        super::builder::bigtable_instance_admin::ListHotTablets::new(self.inner.clone())
328    }
329
330    /// Creates a logical view within an instance.
331    ///
332    /// # Long running operations
333    ///
334    /// This method is used to start, and/or poll a [long-running Operation].
335    /// The [Working with long-running operations] chapter in the [user guide]
336    /// covers these operations in detail.
337    ///
338    /// [long-running operation]: https://google.aip.dev/151
339    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
340    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
341    pub fn create_logical_view(
342        &self,
343    ) -> super::builder::bigtable_instance_admin::CreateLogicalView {
344        super::builder::bigtable_instance_admin::CreateLogicalView::new(self.inner.clone())
345    }
346
347    /// Gets information about a logical view.
348    pub fn get_logical_view(&self) -> super::builder::bigtable_instance_admin::GetLogicalView {
349        super::builder::bigtable_instance_admin::GetLogicalView::new(self.inner.clone())
350    }
351
352    /// Lists information about logical views in an instance.
353    pub fn list_logical_views(&self) -> super::builder::bigtable_instance_admin::ListLogicalViews {
354        super::builder::bigtable_instance_admin::ListLogicalViews::new(self.inner.clone())
355    }
356
357    /// Updates a logical view within an instance.
358    ///
359    /// # Long running operations
360    ///
361    /// This method is used to start, and/or poll a [long-running Operation].
362    /// The [Working with long-running operations] chapter in the [user guide]
363    /// covers these operations in detail.
364    ///
365    /// [long-running operation]: https://google.aip.dev/151
366    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
367    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
368    pub fn update_logical_view(
369        &self,
370    ) -> super::builder::bigtable_instance_admin::UpdateLogicalView {
371        super::builder::bigtable_instance_admin::UpdateLogicalView::new(self.inner.clone())
372    }
373
374    /// Deletes a logical view from an instance.
375    pub fn delete_logical_view(
376        &self,
377    ) -> super::builder::bigtable_instance_admin::DeleteLogicalView {
378        super::builder::bigtable_instance_admin::DeleteLogicalView::new(self.inner.clone())
379    }
380
381    /// Creates a materialized view within an instance.
382    ///
383    /// # Long running operations
384    ///
385    /// This method is used to start, and/or poll a [long-running Operation].
386    /// The [Working with long-running operations] chapter in the [user guide]
387    /// covers these operations in detail.
388    ///
389    /// [long-running operation]: https://google.aip.dev/151
390    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
391    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
392    pub fn create_materialized_view(
393        &self,
394    ) -> super::builder::bigtable_instance_admin::CreateMaterializedView {
395        super::builder::bigtable_instance_admin::CreateMaterializedView::new(self.inner.clone())
396    }
397
398    /// Gets information about a materialized view.
399    pub fn get_materialized_view(
400        &self,
401    ) -> super::builder::bigtable_instance_admin::GetMaterializedView {
402        super::builder::bigtable_instance_admin::GetMaterializedView::new(self.inner.clone())
403    }
404
405    /// Lists information about materialized views in an instance.
406    pub fn list_materialized_views(
407        &self,
408    ) -> super::builder::bigtable_instance_admin::ListMaterializedViews {
409        super::builder::bigtable_instance_admin::ListMaterializedViews::new(self.inner.clone())
410    }
411
412    /// Updates a materialized view within an instance.
413    ///
414    /// # Long running operations
415    ///
416    /// This method is used to start, and/or poll a [long-running Operation].
417    /// The [Working with long-running operations] chapter in the [user guide]
418    /// covers these operations in detail.
419    ///
420    /// [long-running operation]: https://google.aip.dev/151
421    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
422    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
423    pub fn update_materialized_view(
424        &self,
425    ) -> super::builder::bigtable_instance_admin::UpdateMaterializedView {
426        super::builder::bigtable_instance_admin::UpdateMaterializedView::new(self.inner.clone())
427    }
428
429    /// Deletes a materialized view from an instance.
430    pub fn delete_materialized_view(
431        &self,
432    ) -> super::builder::bigtable_instance_admin::DeleteMaterializedView {
433        super::builder::bigtable_instance_admin::DeleteMaterializedView::new(self.inner.clone())
434    }
435
436    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
437    ///
438    /// [google.longrunning.Operations]: longrunning::client::Operations
439    pub fn list_operations(&self) -> super::builder::bigtable_instance_admin::ListOperations {
440        super::builder::bigtable_instance_admin::ListOperations::new(self.inner.clone())
441    }
442
443    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
444    ///
445    /// [google.longrunning.Operations]: longrunning::client::Operations
446    pub fn get_operation(&self) -> super::builder::bigtable_instance_admin::GetOperation {
447        super::builder::bigtable_instance_admin::GetOperation::new(self.inner.clone())
448    }
449
450    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
451    ///
452    /// [google.longrunning.Operations]: longrunning::client::Operations
453    pub fn delete_operation(&self) -> super::builder::bigtable_instance_admin::DeleteOperation {
454        super::builder::bigtable_instance_admin::DeleteOperation::new(self.inner.clone())
455    }
456
457    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
458    ///
459    /// [google.longrunning.Operations]: longrunning::client::Operations
460    pub fn cancel_operation(&self) -> super::builder::bigtable_instance_admin::CancelOperation {
461        super::builder::bigtable_instance_admin::CancelOperation::new(self.inner.clone())
462    }
463}
464
465/// Implements a client for the Cloud Bigtable Admin API.
466///
467/// # Example
468/// ```
469/// # tokio_test::block_on(async {
470/// # use google_cloud_bigtable_admin_v2::client::BigtableTableAdmin;
471/// let client = BigtableTableAdmin::builder().build().await?;
472/// // use `client` to make requests to the Cloud Bigtable Admin API.
473/// # gax::client_builder::Result::<()>::Ok(()) });
474/// ```
475///
476/// # Service Description
477///
478/// Service for creating, configuring, and deleting Cloud Bigtable tables.
479///
480/// Provides access to the table schemas only, not the data stored within
481/// the tables.
482///
483/// # Configuration
484///
485/// To configure `BigtableTableAdmin` use the `with_*` methods in the type returned
486/// by [builder()][BigtableTableAdmin::builder]. The default configuration should
487/// work for most applications. Common configuration changes include
488///
489/// * [with_endpoint()]: by default this client uses the global default endpoint
490///   (`https://bigtableadmin.googleapis.com`). Applications using regional
491///   endpoints or running in restricted networks (e.g. a network configured
492//    with [Private Google Access with VPC Service Controls]) may want to
493///   override this default.
494/// * [with_credentials()]: by default this client uses
495///   [Application Default Credentials]. Applications using custom
496///   authentication may need to override this default.
497///
498/// [with_endpoint()]: super::builder::bigtable_table_admin::ClientBuilder::with_endpoint
499/// [with_credentials()]: super::builder::bigtable_table_admin::ClientBuilder::credentials
500/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
501/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
502///
503/// # Pooling and Cloning
504///
505/// `BigtableTableAdmin` holds a connection pool internally, it is advised to
506/// create one and the reuse it.  You do not need to wrap `BigtableTableAdmin` in
507/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
508/// already uses an `Arc` internally.
509#[derive(Clone, Debug)]
510pub struct BigtableTableAdmin {
511    inner: std::sync::Arc<dyn super::stub::dynamic::BigtableTableAdmin>,
512}
513
514impl BigtableTableAdmin {
515    /// Returns a builder for [BigtableTableAdmin].
516    ///
517    /// ```
518    /// # tokio_test::block_on(async {
519    /// # use google_cloud_bigtable_admin_v2::client::BigtableTableAdmin;
520    /// let client = BigtableTableAdmin::builder().build().await?;
521    /// # gax::client_builder::Result::<()>::Ok(()) });
522    /// ```
523    pub fn builder() -> super::builder::bigtable_table_admin::ClientBuilder {
524        gax::client_builder::internal::new_builder(
525            super::builder::bigtable_table_admin::client::Factory,
526        )
527    }
528
529    /// Creates a new client from the provided stub.
530    ///
531    /// The most common case for calling this function is in tests mocking the
532    /// client's behavior.
533    pub fn from_stub<T>(stub: T) -> Self
534    where
535        T: super::stub::BigtableTableAdmin + 'static,
536    {
537        Self {
538            inner: std::sync::Arc::new(stub),
539        }
540    }
541
542    pub(crate) async fn new(
543        config: gaxi::options::ClientConfig,
544    ) -> gax::client_builder::Result<Self> {
545        let inner = Self::build_inner(config).await?;
546        Ok(Self { inner })
547    }
548
549    async fn build_inner(
550        conf: gaxi::options::ClientConfig,
551    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::BigtableTableAdmin>>
552    {
553        if gaxi::options::tracing_enabled(&conf) {
554            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
555        }
556        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
557    }
558
559    async fn build_transport(
560        conf: gaxi::options::ClientConfig,
561    ) -> gax::client_builder::Result<impl super::stub::BigtableTableAdmin> {
562        super::transport::BigtableTableAdmin::new(conf).await
563    }
564
565    async fn build_with_tracing(
566        conf: gaxi::options::ClientConfig,
567    ) -> gax::client_builder::Result<impl super::stub::BigtableTableAdmin> {
568        Self::build_transport(conf)
569            .await
570            .map(super::tracing::BigtableTableAdmin::new)
571    }
572
573    /// Creates a new table in the specified instance.
574    /// The table can be created with a full set of initial column families,
575    /// specified in the request.
576    pub fn create_table(&self) -> super::builder::bigtable_table_admin::CreateTable {
577        super::builder::bigtable_table_admin::CreateTable::new(self.inner.clone())
578    }
579
580    /// Creates a new table from the specified snapshot. The target table must
581    /// not exist. The snapshot and the table must be in the same instance.
582    ///
583    /// Note: This is a private alpha release of Cloud Bigtable snapshots. This
584    /// feature is not currently available to most Cloud Bigtable customers. This
585    /// feature might be changed in backward-incompatible ways and is not
586    /// recommended for production use. It is not subject to any SLA or deprecation
587    /// policy.
588    ///
589    /// # Long running operations
590    ///
591    /// This method is used to start, and/or poll a [long-running Operation].
592    /// The [Working with long-running operations] chapter in the [user guide]
593    /// covers these operations in detail.
594    ///
595    /// [long-running operation]: https://google.aip.dev/151
596    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
597    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
598    pub fn create_table_from_snapshot(
599        &self,
600    ) -> super::builder::bigtable_table_admin::CreateTableFromSnapshot {
601        super::builder::bigtable_table_admin::CreateTableFromSnapshot::new(self.inner.clone())
602    }
603
604    /// Lists all tables served from a specified instance.
605    pub fn list_tables(&self) -> super::builder::bigtable_table_admin::ListTables {
606        super::builder::bigtable_table_admin::ListTables::new(self.inner.clone())
607    }
608
609    /// Gets metadata information about the specified table.
610    pub fn get_table(&self) -> super::builder::bigtable_table_admin::GetTable {
611        super::builder::bigtable_table_admin::GetTable::new(self.inner.clone())
612    }
613
614    /// Updates a specified table.
615    ///
616    /// # Long running operations
617    ///
618    /// This method is used to start, and/or poll a [long-running Operation].
619    /// The [Working with long-running operations] chapter in the [user guide]
620    /// covers these operations in detail.
621    ///
622    /// [long-running operation]: https://google.aip.dev/151
623    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
624    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
625    pub fn update_table(&self) -> super::builder::bigtable_table_admin::UpdateTable {
626        super::builder::bigtable_table_admin::UpdateTable::new(self.inner.clone())
627    }
628
629    /// Permanently deletes a specified table and all of its data.
630    pub fn delete_table(&self) -> super::builder::bigtable_table_admin::DeleteTable {
631        super::builder::bigtable_table_admin::DeleteTable::new(self.inner.clone())
632    }
633
634    /// Restores a specified table which was accidentally deleted.
635    ///
636    /// # Long running operations
637    ///
638    /// This method is used to start, and/or poll a [long-running Operation].
639    /// The [Working with long-running operations] chapter in the [user guide]
640    /// covers these operations in detail.
641    ///
642    /// [long-running operation]: https://google.aip.dev/151
643    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
644    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
645    pub fn undelete_table(&self) -> super::builder::bigtable_table_admin::UndeleteTable {
646        super::builder::bigtable_table_admin::UndeleteTable::new(self.inner.clone())
647    }
648
649    /// Creates a new AuthorizedView in a table.
650    ///
651    /// # Long running operations
652    ///
653    /// This method is used to start, and/or poll a [long-running Operation].
654    /// The [Working with long-running operations] chapter in the [user guide]
655    /// covers these operations in detail.
656    ///
657    /// [long-running operation]: https://google.aip.dev/151
658    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
659    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
660    pub fn create_authorized_view(
661        &self,
662    ) -> super::builder::bigtable_table_admin::CreateAuthorizedView {
663        super::builder::bigtable_table_admin::CreateAuthorizedView::new(self.inner.clone())
664    }
665
666    /// Lists all AuthorizedViews from a specific table.
667    pub fn list_authorized_views(
668        &self,
669    ) -> super::builder::bigtable_table_admin::ListAuthorizedViews {
670        super::builder::bigtable_table_admin::ListAuthorizedViews::new(self.inner.clone())
671    }
672
673    /// Gets information from a specified AuthorizedView.
674    pub fn get_authorized_view(&self) -> super::builder::bigtable_table_admin::GetAuthorizedView {
675        super::builder::bigtable_table_admin::GetAuthorizedView::new(self.inner.clone())
676    }
677
678    /// Updates an AuthorizedView in a table.
679    ///
680    /// # Long running operations
681    ///
682    /// This method is used to start, and/or poll a [long-running Operation].
683    /// The [Working with long-running operations] chapter in the [user guide]
684    /// covers these operations in detail.
685    ///
686    /// [long-running operation]: https://google.aip.dev/151
687    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
688    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
689    pub fn update_authorized_view(
690        &self,
691    ) -> super::builder::bigtable_table_admin::UpdateAuthorizedView {
692        super::builder::bigtable_table_admin::UpdateAuthorizedView::new(self.inner.clone())
693    }
694
695    /// Permanently deletes a specified AuthorizedView.
696    pub fn delete_authorized_view(
697        &self,
698    ) -> super::builder::bigtable_table_admin::DeleteAuthorizedView {
699        super::builder::bigtable_table_admin::DeleteAuthorizedView::new(self.inner.clone())
700    }
701
702    /// Performs a series of column family modifications on the specified table.
703    /// Either all or none of the modifications will occur before this method
704    /// returns, but data requests received prior to that point may see a table
705    /// where only some modifications have taken effect.
706    pub fn modify_column_families(
707        &self,
708    ) -> super::builder::bigtable_table_admin::ModifyColumnFamilies {
709        super::builder::bigtable_table_admin::ModifyColumnFamilies::new(self.inner.clone())
710    }
711
712    /// Permanently drop/delete a row range from a specified table. The request can
713    /// specify whether to delete all rows in a table, or only those that match a
714    /// particular prefix.
715    pub fn drop_row_range(&self) -> super::builder::bigtable_table_admin::DropRowRange {
716        super::builder::bigtable_table_admin::DropRowRange::new(self.inner.clone())
717    }
718
719    /// Generates a consistency token for a Table, which can be used in
720    /// CheckConsistency to check whether mutations to the table that finished
721    /// before this call started have been replicated. The tokens will be available
722    /// for 90 days.
723    pub fn generate_consistency_token(
724        &self,
725    ) -> super::builder::bigtable_table_admin::GenerateConsistencyToken {
726        super::builder::bigtable_table_admin::GenerateConsistencyToken::new(self.inner.clone())
727    }
728
729    /// Checks replication consistency based on a consistency token, that is, if
730    /// replication has caught up based on the conditions specified in the token
731    /// and the check request.
732    pub fn check_consistency(&self) -> super::builder::bigtable_table_admin::CheckConsistency {
733        super::builder::bigtable_table_admin::CheckConsistency::new(self.inner.clone())
734    }
735
736    /// Creates a new snapshot in the specified cluster from the specified
737    /// source table. The cluster and the table must be in the same instance.
738    ///
739    /// Note: This is a private alpha release of Cloud Bigtable snapshots. This
740    /// feature is not currently available to most Cloud Bigtable customers. This
741    /// feature might be changed in backward-incompatible ways and is not
742    /// recommended for production use. It is not subject to any SLA or deprecation
743    /// policy.
744    ///
745    /// # Long running operations
746    ///
747    /// This method is used to start, and/or poll a [long-running Operation].
748    /// The [Working with long-running operations] chapter in the [user guide]
749    /// covers these operations in detail.
750    ///
751    /// [long-running operation]: https://google.aip.dev/151
752    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
753    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
754    pub fn snapshot_table(&self) -> super::builder::bigtable_table_admin::SnapshotTable {
755        super::builder::bigtable_table_admin::SnapshotTable::new(self.inner.clone())
756    }
757
758    /// Gets metadata information about the specified snapshot.
759    ///
760    /// Note: This is a private alpha release of Cloud Bigtable snapshots. This
761    /// feature is not currently available to most Cloud Bigtable customers. This
762    /// feature might be changed in backward-incompatible ways and is not
763    /// recommended for production use. It is not subject to any SLA or deprecation
764    /// policy.
765    pub fn get_snapshot(&self) -> super::builder::bigtable_table_admin::GetSnapshot {
766        super::builder::bigtable_table_admin::GetSnapshot::new(self.inner.clone())
767    }
768
769    /// Lists all snapshots associated with the specified cluster.
770    ///
771    /// Note: This is a private alpha release of Cloud Bigtable snapshots. This
772    /// feature is not currently available to most Cloud Bigtable customers. This
773    /// feature might be changed in backward-incompatible ways and is not
774    /// recommended for production use. It is not subject to any SLA or deprecation
775    /// policy.
776    pub fn list_snapshots(&self) -> super::builder::bigtable_table_admin::ListSnapshots {
777        super::builder::bigtable_table_admin::ListSnapshots::new(self.inner.clone())
778    }
779
780    /// Permanently deletes the specified snapshot.
781    ///
782    /// Note: This is a private alpha release of Cloud Bigtable snapshots. This
783    /// feature is not currently available to most Cloud Bigtable customers. This
784    /// feature might be changed in backward-incompatible ways and is not
785    /// recommended for production use. It is not subject to any SLA or deprecation
786    /// policy.
787    pub fn delete_snapshot(&self) -> super::builder::bigtable_table_admin::DeleteSnapshot {
788        super::builder::bigtable_table_admin::DeleteSnapshot::new(self.inner.clone())
789    }
790
791    /// Starts creating a new Cloud Bigtable Backup.  The returned backup
792    /// [long-running operation][google.longrunning.Operation] can be used to
793    /// track creation of the backup. The
794    /// [metadata][google.longrunning.Operation.metadata] field type is
795    /// [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The
796    /// [response][google.longrunning.Operation.response] field type is
797    /// [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the
798    /// returned operation will stop the creation and delete the backup.
799    ///
800    /// [google.bigtable.admin.v2.Backup]: crate::model::Backup
801    /// [google.bigtable.admin.v2.CreateBackupMetadata]: crate::model::CreateBackupMetadata
802    /// [google.longrunning.Operation]: longrunning::model::Operation
803    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
804    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
805    ///
806    /// # Long running operations
807    ///
808    /// This method is used to start, and/or poll a [long-running Operation].
809    /// The [Working with long-running operations] chapter in the [user guide]
810    /// covers these operations in detail.
811    ///
812    /// [long-running operation]: https://google.aip.dev/151
813    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
814    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
815    pub fn create_backup(&self) -> super::builder::bigtable_table_admin::CreateBackup {
816        super::builder::bigtable_table_admin::CreateBackup::new(self.inner.clone())
817    }
818
819    /// Gets metadata on a pending or completed Cloud Bigtable Backup.
820    pub fn get_backup(&self) -> super::builder::bigtable_table_admin::GetBackup {
821        super::builder::bigtable_table_admin::GetBackup::new(self.inner.clone())
822    }
823
824    /// Updates a pending or completed Cloud Bigtable Backup.
825    pub fn update_backup(&self) -> super::builder::bigtable_table_admin::UpdateBackup {
826        super::builder::bigtable_table_admin::UpdateBackup::new(self.inner.clone())
827    }
828
829    /// Deletes a pending or completed Cloud Bigtable backup.
830    pub fn delete_backup(&self) -> super::builder::bigtable_table_admin::DeleteBackup {
831        super::builder::bigtable_table_admin::DeleteBackup::new(self.inner.clone())
832    }
833
834    /// Lists Cloud Bigtable backups. Returns both completed and pending
835    /// backups.
836    pub fn list_backups(&self) -> super::builder::bigtable_table_admin::ListBackups {
837        super::builder::bigtable_table_admin::ListBackups::new(self.inner.clone())
838    }
839
840    /// Create a new table by restoring from a completed backup.  The
841    /// returned table [long-running operation][google.longrunning.Operation] can
842    /// be used to track the progress of the operation, and to cancel it.  The
843    /// [metadata][google.longrunning.Operation.metadata] field type is
844    /// [RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata].  The
845    /// [response][google.longrunning.Operation.response] type is
846    /// [Table][google.bigtable.admin.v2.Table], if successful.
847    ///
848    /// [google.bigtable.admin.v2.RestoreTableMetadata]: crate::model::RestoreTableMetadata
849    /// [google.bigtable.admin.v2.Table]: crate::model::Table
850    /// [google.longrunning.Operation]: longrunning::model::Operation
851    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
852    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
853    ///
854    /// # Long running operations
855    ///
856    /// This method is used to start, and/or poll a [long-running Operation].
857    /// The [Working with long-running operations] chapter in the [user guide]
858    /// covers these operations in detail.
859    ///
860    /// [long-running operation]: https://google.aip.dev/151
861    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
862    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
863    pub fn restore_table(&self) -> super::builder::bigtable_table_admin::RestoreTable {
864        super::builder::bigtable_table_admin::RestoreTable::new(self.inner.clone())
865    }
866
867    /// Copy a Cloud Bigtable backup to a new backup in the destination cluster
868    /// located in the destination instance and project.
869    ///
870    /// # Long running operations
871    ///
872    /// This method is used to start, and/or poll a [long-running Operation].
873    /// The [Working with long-running operations] chapter in the [user guide]
874    /// covers these operations in detail.
875    ///
876    /// [long-running operation]: https://google.aip.dev/151
877    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
878    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
879    pub fn copy_backup(&self) -> super::builder::bigtable_table_admin::CopyBackup {
880        super::builder::bigtable_table_admin::CopyBackup::new(self.inner.clone())
881    }
882
883    /// Gets the access control policy for a Bigtable resource.
884    /// Returns an empty policy if the resource exists but does not have a policy
885    /// set.
886    pub fn get_iam_policy(&self) -> super::builder::bigtable_table_admin::GetIamPolicy {
887        super::builder::bigtable_table_admin::GetIamPolicy::new(self.inner.clone())
888    }
889
890    /// Sets the access control policy on a Bigtable resource.
891    /// Replaces any existing policy.
892    pub fn set_iam_policy(&self) -> super::builder::bigtable_table_admin::SetIamPolicy {
893        super::builder::bigtable_table_admin::SetIamPolicy::new(self.inner.clone())
894    }
895
896    /// Returns permissions that the caller has on the specified Bigtable
897    /// resource.
898    pub fn test_iam_permissions(&self) -> super::builder::bigtable_table_admin::TestIamPermissions {
899        super::builder::bigtable_table_admin::TestIamPermissions::new(self.inner.clone())
900    }
901
902    /// Creates a new schema bundle in the specified table.
903    ///
904    /// # Long running operations
905    ///
906    /// This method is used to start, and/or poll a [long-running Operation].
907    /// The [Working with long-running operations] chapter in the [user guide]
908    /// covers these operations in detail.
909    ///
910    /// [long-running operation]: https://google.aip.dev/151
911    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
912    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
913    pub fn create_schema_bundle(&self) -> super::builder::bigtable_table_admin::CreateSchemaBundle {
914        super::builder::bigtable_table_admin::CreateSchemaBundle::new(self.inner.clone())
915    }
916
917    /// Updates a schema bundle in the specified table.
918    ///
919    /// # Long running operations
920    ///
921    /// This method is used to start, and/or poll a [long-running Operation].
922    /// The [Working with long-running operations] chapter in the [user guide]
923    /// covers these operations in detail.
924    ///
925    /// [long-running operation]: https://google.aip.dev/151
926    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
927    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
928    pub fn update_schema_bundle(&self) -> super::builder::bigtable_table_admin::UpdateSchemaBundle {
929        super::builder::bigtable_table_admin::UpdateSchemaBundle::new(self.inner.clone())
930    }
931
932    /// Gets metadata information about the specified schema bundle.
933    pub fn get_schema_bundle(&self) -> super::builder::bigtable_table_admin::GetSchemaBundle {
934        super::builder::bigtable_table_admin::GetSchemaBundle::new(self.inner.clone())
935    }
936
937    /// Lists all schema bundles associated with the specified table.
938    pub fn list_schema_bundles(&self) -> super::builder::bigtable_table_admin::ListSchemaBundles {
939        super::builder::bigtable_table_admin::ListSchemaBundles::new(self.inner.clone())
940    }
941
942    /// Deletes a schema bundle in the specified table.
943    pub fn delete_schema_bundle(&self) -> super::builder::bigtable_table_admin::DeleteSchemaBundle {
944        super::builder::bigtable_table_admin::DeleteSchemaBundle::new(self.inner.clone())
945    }
946
947    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
948    ///
949    /// [google.longrunning.Operations]: longrunning::client::Operations
950    pub fn list_operations(&self) -> super::builder::bigtable_table_admin::ListOperations {
951        super::builder::bigtable_table_admin::ListOperations::new(self.inner.clone())
952    }
953
954    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
955    ///
956    /// [google.longrunning.Operations]: longrunning::client::Operations
957    pub fn get_operation(&self) -> super::builder::bigtable_table_admin::GetOperation {
958        super::builder::bigtable_table_admin::GetOperation::new(self.inner.clone())
959    }
960
961    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
962    ///
963    /// [google.longrunning.Operations]: longrunning::client::Operations
964    pub fn delete_operation(&self) -> super::builder::bigtable_table_admin::DeleteOperation {
965        super::builder::bigtable_table_admin::DeleteOperation::new(self.inner.clone())
966    }
967
968    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
969    ///
970    /// [google.longrunning.Operations]: longrunning::client::Operations
971    pub fn cancel_operation(&self) -> super::builder::bigtable_table_admin::CancelOperation {
972        super::builder::bigtable_table_admin::CancelOperation::new(self.inner.clone())
973    }
974}