Skip to main content

google_cloud_spanner_admin_instance_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 Cloud Spanner API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26///     let client = InstanceAdmin::builder().build().await?;
27///     let parent = "parent_value";
28///     let mut list = client.list_instance_configs()
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/// Cloud Spanner Instance Admin API
40///
41/// The Cloud Spanner Instance Admin API can be used to create, delete,
42/// modify and list instances. Instances are dedicated Cloud Spanner serving
43/// and storage resources to be used by Cloud Spanner databases.
44///
45/// Each instance has a "configuration", which dictates where the
46/// serving resources for the Cloud Spanner instance are located (e.g.,
47/// US-central, Europe). Configurations are created by Google based on
48/// resource availability.
49///
50/// Cloud Spanner billing is based on the instances that exist and their
51/// sizes. After an instance exists, there are no additional
52/// per-database or per-operation charges for use of the instance
53/// (though there may be additional network bandwidth charges).
54/// Instances offer isolation: problems with databases in one instance
55/// will not affect other instances. However, within an instance
56/// databases can affect each other. For example, if one database in an
57/// instance receives a lot of requests and consumes most of the
58/// instance resources, fewer resources are available for other
59/// databases in that instance, and their performance may suffer.
60///
61/// # Configuration
62///
63/// To configure `InstanceAdmin` use the `with_*` methods in the type returned
64/// by [builder()][InstanceAdmin::builder]. The default configuration should
65/// work for most applications. Common configuration changes include
66///
67/// * [with_endpoint()]: by default this client uses the global default endpoint
68///   (`https://spanner.googleapis.com`). Applications using regional
69///   endpoints or running in restricted networks (e.g. a network configured
70//    with [Private Google Access with VPC Service Controls]) may want to
71///   override this default.
72/// * [with_credentials()]: by default this client uses
73///   [Application Default Credentials]. Applications using custom
74///   authentication may need to override this default.
75///
76/// [with_endpoint()]: super::builder::instance_admin::ClientBuilder::with_endpoint
77/// [with_credentials()]: super::builder::instance_admin::ClientBuilder::with_credentials
78/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
79/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
80///
81/// # Pooling and Cloning
82///
83/// `InstanceAdmin` holds a connection pool internally, it is advised to
84/// create one and reuse it. You do not need to wrap `InstanceAdmin` in
85/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
86/// already uses an `Arc` internally.
87#[derive(Clone, Debug)]
88pub struct InstanceAdmin {
89    inner: std::sync::Arc<dyn super::stub::dynamic::InstanceAdmin>,
90}
91
92impl InstanceAdmin {
93    /// Returns a builder for [InstanceAdmin].
94    ///
95    /// ```
96    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
97    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
98    /// let client = InstanceAdmin::builder().build().await?;
99    /// # Ok(()) }
100    /// ```
101    pub fn builder() -> super::builder::instance_admin::ClientBuilder {
102        crate::new_client_builder(super::builder::instance_admin::client::Factory)
103    }
104
105    /// Creates a new client from the provided stub.
106    ///
107    /// The most common case for calling this function is in tests mocking the
108    /// client's behavior.
109    pub fn from_stub<T>(stub: T) -> Self
110    where
111        T: super::stub::InstanceAdmin + 'static,
112    {
113        Self {
114            inner: std::sync::Arc::new(stub),
115        }
116    }
117
118    pub(crate) async fn new(
119        config: gaxi::options::ClientConfig,
120    ) -> crate::ClientBuilderResult<Self> {
121        let inner = Self::build_inner(config).await?;
122        Ok(Self { inner })
123    }
124
125    async fn build_inner(
126        conf: gaxi::options::ClientConfig,
127    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceAdmin>> {
128        if gaxi::options::tracing_enabled(&conf) {
129            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
130        }
131        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
132    }
133
134    async fn build_transport(
135        conf: gaxi::options::ClientConfig,
136    ) -> crate::ClientBuilderResult<impl super::stub::InstanceAdmin> {
137        super::transport::InstanceAdmin::new(conf).await
138    }
139
140    async fn build_with_tracing(
141        conf: gaxi::options::ClientConfig,
142    ) -> crate::ClientBuilderResult<impl super::stub::InstanceAdmin> {
143        Self::build_transport(conf)
144            .await
145            .map(super::tracing::InstanceAdmin::new)
146    }
147
148    /// Lists the supported instance configurations for a given project.
149    ///
150    /// Returns both Google-managed configurations and user-managed
151    /// configurations.
152    ///
153    /// # Example
154    /// ```
155    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
156    /// use google_cloud_gax::paginator::ItemPaginator as _;
157    /// use google_cloud_spanner_admin_instance_v1::Result;
158    /// async fn sample(
159    ///    client: &InstanceAdmin, parent: &str
160    /// ) -> Result<()> {
161    ///     let mut list = client.list_instance_configs()
162    ///         .set_parent(parent)
163    ///         .by_item();
164    ///     while let Some(item) = list.next().await.transpose()? {
165    ///         println!("{:?}", item);
166    ///     }
167    ///     Ok(())
168    /// }
169    /// ```
170    pub fn list_instance_configs(&self) -> super::builder::instance_admin::ListInstanceConfigs {
171        super::builder::instance_admin::ListInstanceConfigs::new(self.inner.clone())
172    }
173
174    /// Gets information about a particular instance configuration.
175    ///
176    /// # Example
177    /// ```
178    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
179    /// use google_cloud_spanner_admin_instance_v1::Result;
180    /// async fn sample(
181    ///    client: &InstanceAdmin, name: &str
182    /// ) -> Result<()> {
183    ///     let response = client.get_instance_config()
184    ///         .set_name(name)
185    ///         .send().await?;
186    ///     println!("response {:?}", response);
187    ///     Ok(())
188    /// }
189    /// ```
190    pub fn get_instance_config(&self) -> super::builder::instance_admin::GetInstanceConfig {
191        super::builder::instance_admin::GetInstanceConfig::new(self.inner.clone())
192    }
193
194    /// Creates an instance configuration and begins preparing it to be used. The
195    /// returned long-running operation
196    /// can be used to track the progress of preparing the new
197    /// instance configuration. The instance configuration name is assigned by the
198    /// caller. If the named instance configuration already exists,
199    /// `CreateInstanceConfig` returns `ALREADY_EXISTS`.
200    ///
201    /// Immediately after the request returns:
202    ///
203    /// * The instance configuration is readable via the API, with all requested
204    ///   attributes. The instance configuration's
205    ///   [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
206    ///   field is set to true. Its state is `CREATING`.
207    ///
208    /// While the operation is pending:
209    ///
210    /// * Cancelling the operation renders the instance configuration immediately
211    ///   unreadable via the API.
212    /// * Except for deleting the creating resource, all other attempts to modify
213    ///   the instance configuration are rejected.
214    ///
215    /// Upon completion of the returned operation:
216    ///
217    /// * Instances can be created using the instance configuration.
218    /// * The instance configuration's
219    ///   [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
220    ///   field becomes false. Its state becomes `READY`.
221    ///
222    /// The returned long-running operation will
223    /// have a name of the format
224    /// `<instance_config_name>/operations/<operation_id>` and can be used to track
225    /// creation of the instance configuration. The
226    /// metadata field type is
227    /// [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
228    /// The response field type is
229    /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if
230    /// successful.
231    ///
232    /// Authorization requires `spanner.instanceConfigs.create` permission on
233    /// the resource
234    /// [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent].
235    ///
236    /// [google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]: crate::model::CreateInstanceConfigMetadata
237    /// [google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]: crate::model::CreateInstanceConfigRequest::parent
238    /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
239    /// [google.spanner.admin.instance.v1.InstanceConfig.reconciling]: crate::model::InstanceConfig::reconciling
240    ///
241    /// # Long running operations
242    ///
243    /// This method is used to start, and/or poll a [long-running Operation].
244    /// The [Working with long-running operations] chapter in the [user guide]
245    /// covers these operations in detail.
246    ///
247    /// [long-running operation]: https://google.aip.dev/151
248    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
249    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
250    ///
251    /// # Example
252    /// ```
253    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
254    /// use google_cloud_lro::Poller;
255    /// use google_cloud_spanner_admin_instance_v1::Result;
256    /// async fn sample(
257    ///    client: &InstanceAdmin
258    /// ) -> Result<()> {
259    ///     let response = client.create_instance_config()
260    ///         /* set fields */
261    ///         .poller().until_done().await?;
262    ///     println!("response {:?}", response);
263    ///     Ok(())
264    /// }
265    /// ```
266    pub fn create_instance_config(&self) -> super::builder::instance_admin::CreateInstanceConfig {
267        super::builder::instance_admin::CreateInstanceConfig::new(self.inner.clone())
268    }
269
270    /// Updates an instance configuration. The returned
271    /// long-running operation can be used to track
272    /// the progress of updating the instance. If the named instance configuration
273    /// does not exist, returns `NOT_FOUND`.
274    ///
275    /// Only user-managed configurations can be updated.
276    ///
277    /// Immediately after the request returns:
278    ///
279    /// * The instance configuration's
280    ///   [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
281    ///   field is set to true.
282    ///
283    /// While the operation is pending:
284    ///
285    /// * Cancelling the operation sets its metadata's
286    ///   [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time].
287    ///   The operation is guaranteed to succeed at undoing all changes, after
288    ///   which point it terminates with a `CANCELLED` status.
289    /// * All other attempts to modify the instance configuration are rejected.
290    /// * Reading the instance configuration via the API continues to give the
291    ///   pre-request values.
292    ///
293    /// Upon completion of the returned operation:
294    ///
295    /// * Creating instances using the instance configuration uses the new
296    ///   values.
297    /// * The new values of the instance configuration are readable via the API.
298    /// * The instance configuration's
299    ///   [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
300    ///   field becomes false.
301    ///
302    /// The returned long-running operation will
303    /// have a name of the format
304    /// `<instance_config_name>/operations/<operation_id>` and can be used to track
305    /// the instance configuration modification.  The
306    /// metadata field type is
307    /// [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata].
308    /// The response field type is
309    /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if
310    /// successful.
311    ///
312    /// Authorization requires `spanner.instanceConfigs.update` permission on
313    /// the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name].
314    ///
315    /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
316    /// [google.spanner.admin.instance.v1.InstanceConfig.name]: crate::model::InstanceConfig::name
317    /// [google.spanner.admin.instance.v1.InstanceConfig.reconciling]: crate::model::InstanceConfig::reconciling
318    /// [google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]: crate::model::UpdateInstanceConfigMetadata
319    /// [google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]: crate::model::UpdateInstanceConfigMetadata::cancel_time
320    ///
321    /// # Long running operations
322    ///
323    /// This method is used to start, and/or poll a [long-running Operation].
324    /// The [Working with long-running operations] chapter in the [user guide]
325    /// covers these operations in detail.
326    ///
327    /// [long-running operation]: https://google.aip.dev/151
328    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
329    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
330    ///
331    /// # Example
332    /// ```
333    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
334    /// use google_cloud_lro::Poller;
335    /// use google_cloud_spanner_admin_instance_v1::Result;
336    /// async fn sample(
337    ///    client: &InstanceAdmin
338    /// ) -> Result<()> {
339    ///     let response = client.update_instance_config()
340    ///         /* set fields */
341    ///         .poller().until_done().await?;
342    ///     println!("response {:?}", response);
343    ///     Ok(())
344    /// }
345    /// ```
346    pub fn update_instance_config(&self) -> super::builder::instance_admin::UpdateInstanceConfig {
347        super::builder::instance_admin::UpdateInstanceConfig::new(self.inner.clone())
348    }
349
350    /// Deletes the instance configuration. Deletion is only allowed when no
351    /// instances are using the configuration. If any instances are using
352    /// the configuration, returns `FAILED_PRECONDITION`.
353    ///
354    /// Only user-managed configurations can be deleted.
355    ///
356    /// Authorization requires `spanner.instanceConfigs.delete` permission on
357    /// the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name].
358    ///
359    /// [google.spanner.admin.instance.v1.InstanceConfig.name]: crate::model::InstanceConfig::name
360    ///
361    /// # Example
362    /// ```
363    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
364    /// use google_cloud_spanner_admin_instance_v1::Result;
365    /// async fn sample(
366    ///    client: &InstanceAdmin, name: &str
367    /// ) -> Result<()> {
368    ///     client.delete_instance_config()
369    ///         .set_name(name)
370    ///         .send().await?;
371    ///     Ok(())
372    /// }
373    /// ```
374    pub fn delete_instance_config(&self) -> super::builder::instance_admin::DeleteInstanceConfig {
375        super::builder::instance_admin::DeleteInstanceConfig::new(self.inner.clone())
376    }
377
378    /// Lists the user-managed instance configuration long-running
379    /// operations in the given project. An instance
380    /// configuration operation has a name of the form
381    /// `projects/<project>/instanceConfigs/<instance_config>/operations/<operation>`.
382    /// The long-running operation
383    /// metadata field type
384    /// `metadata.type_url` describes the type of the metadata. Operations returned
385    /// include those that have completed/failed/canceled within the last 7 days,
386    /// and pending operations. Operations returned are ordered by
387    /// `operation.metadata.value.start_time` in descending order starting
388    /// from the most recently started operation.
389    ///
390    /// # Example
391    /// ```
392    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
393    /// use google_cloud_gax::paginator::ItemPaginator as _;
394    /// use google_cloud_spanner_admin_instance_v1::Result;
395    /// async fn sample(
396    ///    client: &InstanceAdmin
397    /// ) -> Result<()> {
398    ///     let mut list = client.list_instance_config_operations()
399    ///         /* set fields */
400    ///         .by_item();
401    ///     while let Some(item) = list.next().await.transpose()? {
402    ///         println!("{:?}", item);
403    ///     }
404    ///     Ok(())
405    /// }
406    /// ```
407    pub fn list_instance_config_operations(
408        &self,
409    ) -> super::builder::instance_admin::ListInstanceConfigOperations {
410        super::builder::instance_admin::ListInstanceConfigOperations::new(self.inner.clone())
411    }
412
413    /// Lists all instances in the given project.
414    ///
415    /// # Example
416    /// ```
417    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
418    /// use google_cloud_gax::paginator::ItemPaginator as _;
419    /// use google_cloud_spanner_admin_instance_v1::Result;
420    /// async fn sample(
421    ///    client: &InstanceAdmin, parent: &str
422    /// ) -> Result<()> {
423    ///     let mut list = client.list_instances()
424    ///         .set_parent(parent)
425    ///         .by_item();
426    ///     while let Some(item) = list.next().await.transpose()? {
427    ///         println!("{:?}", item);
428    ///     }
429    ///     Ok(())
430    /// }
431    /// ```
432    pub fn list_instances(&self) -> super::builder::instance_admin::ListInstances {
433        super::builder::instance_admin::ListInstances::new(self.inner.clone())
434    }
435
436    /// Lists all instance partitions for the given instance.
437    ///
438    /// # Example
439    /// ```
440    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
441    /// use google_cloud_gax::paginator::ItemPaginator as _;
442    /// use google_cloud_spanner_admin_instance_v1::Result;
443    /// async fn sample(
444    ///    client: &InstanceAdmin, parent: &str
445    /// ) -> Result<()> {
446    ///     let mut list = client.list_instance_partitions()
447    ///         .set_parent(parent)
448    ///         .by_item();
449    ///     while let Some(item) = list.next().await.transpose()? {
450    ///         println!("{:?}", item);
451    ///     }
452    ///     Ok(())
453    /// }
454    /// ```
455    pub fn list_instance_partitions(
456        &self,
457    ) -> super::builder::instance_admin::ListInstancePartitions {
458        super::builder::instance_admin::ListInstancePartitions::new(self.inner.clone())
459    }
460
461    /// Gets information about a particular instance.
462    ///
463    /// # Example
464    /// ```
465    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
466    /// use google_cloud_spanner_admin_instance_v1::Result;
467    /// async fn sample(
468    ///    client: &InstanceAdmin, name: &str
469    /// ) -> Result<()> {
470    ///     let response = client.get_instance()
471    ///         .set_name(name)
472    ///         .send().await?;
473    ///     println!("response {:?}", response);
474    ///     Ok(())
475    /// }
476    /// ```
477    pub fn get_instance(&self) -> super::builder::instance_admin::GetInstance {
478        super::builder::instance_admin::GetInstance::new(self.inner.clone())
479    }
480
481    /// Creates an instance and begins preparing it to begin serving. The
482    /// returned long-running operation
483    /// can be used to track the progress of preparing the new
484    /// instance. The instance name is assigned by the caller. If the
485    /// named instance already exists, `CreateInstance` returns
486    /// `ALREADY_EXISTS`.
487    ///
488    /// Immediately upon completion of this request:
489    ///
490    /// * The instance is readable via the API, with all requested attributes
491    ///   but no allocated resources. Its state is `CREATING`.
492    ///
493    /// Until completion of the returned operation:
494    ///
495    /// * Cancelling the operation renders the instance immediately unreadable
496    ///   via the API.
497    /// * The instance can be deleted.
498    /// * All other attempts to modify the instance are rejected.
499    ///
500    /// Upon completion of the returned operation:
501    ///
502    /// * Billing for all successfully-allocated resources begins (some types
503    ///   may have lower than the requested levels).
504    /// * Databases can be created in the instance.
505    /// * The instance's allocated resource levels are readable via the API.
506    /// * The instance's state becomes `READY`.
507    ///
508    /// The returned long-running operation will
509    /// have a name of the format `<instance_name>/operations/<operation_id>` and
510    /// can be used to track creation of the instance.  The
511    /// metadata field type is
512    /// [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata].
513    /// The response field type is
514    /// [Instance][google.spanner.admin.instance.v1.Instance], if successful.
515    ///
516    /// [google.spanner.admin.instance.v1.CreateInstanceMetadata]: crate::model::CreateInstanceMetadata
517    /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
518    ///
519    /// # Long running operations
520    ///
521    /// This method is used to start, and/or poll a [long-running Operation].
522    /// The [Working with long-running operations] chapter in the [user guide]
523    /// covers these operations in detail.
524    ///
525    /// [long-running operation]: https://google.aip.dev/151
526    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
527    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
528    ///
529    /// # Example
530    /// ```
531    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
532    /// use google_cloud_lro::Poller;
533    /// use google_cloud_spanner_admin_instance_v1::model::Instance;
534    /// use google_cloud_spanner_admin_instance_v1::Result;
535    /// async fn sample(
536    ///    client: &InstanceAdmin, parent: &str
537    /// ) -> Result<()> {
538    ///     let response = client.create_instance()
539    ///         .set_parent(parent)
540    ///         .set_instance_id("instance_id_value")
541    ///         .set_instance(
542    ///             Instance::new()/* set fields */
543    ///         )
544    ///         .poller().until_done().await?;
545    ///     println!("response {:?}", response);
546    ///     Ok(())
547    /// }
548    /// ```
549    pub fn create_instance(&self) -> super::builder::instance_admin::CreateInstance {
550        super::builder::instance_admin::CreateInstance::new(self.inner.clone())
551    }
552
553    /// Updates an instance, and begins allocating or releasing resources
554    /// as requested. The returned long-running operation can be used to track the
555    /// progress of updating the instance. If the named instance does not
556    /// exist, returns `NOT_FOUND`.
557    ///
558    /// Immediately upon completion of this request:
559    ///
560    /// * For resource types for which a decrease in the instance's allocation
561    ///   has been requested, billing is based on the newly-requested level.
562    ///
563    /// Until completion of the returned operation:
564    ///
565    /// * Cancelling the operation sets its metadata's
566    ///   [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time],
567    ///   and begins restoring resources to their pre-request values. The
568    ///   operation is guaranteed to succeed at undoing all resource changes,
569    ///   after which point it terminates with a `CANCELLED` status.
570    /// * All other attempts to modify the instance are rejected.
571    /// * Reading the instance via the API continues to give the pre-request
572    ///   resource levels.
573    ///
574    /// Upon completion of the returned operation:
575    ///
576    /// * Billing begins for all successfully-allocated resources (some types
577    ///   may have lower than the requested levels).
578    /// * All newly-reserved resources are available for serving the instance's
579    ///   tables.
580    /// * The instance's new resource levels are readable via the API.
581    ///
582    /// The returned long-running operation will
583    /// have a name of the format `<instance_name>/operations/<operation_id>` and
584    /// can be used to track the instance modification.  The
585    /// metadata field type is
586    /// [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata].
587    /// The response field type is
588    /// [Instance][google.spanner.admin.instance.v1.Instance], if successful.
589    ///
590    /// Authorization requires `spanner.instances.update` permission on
591    /// the resource [name][google.spanner.admin.instance.v1.Instance.name].
592    ///
593    /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
594    /// [google.spanner.admin.instance.v1.Instance.name]: crate::model::Instance::name
595    /// [google.spanner.admin.instance.v1.UpdateInstanceMetadata]: crate::model::UpdateInstanceMetadata
596    /// [google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time]: crate::model::UpdateInstanceMetadata::cancel_time
597    ///
598    /// # Long running operations
599    ///
600    /// This method is used to start, and/or poll a [long-running Operation].
601    /// The [Working with long-running operations] chapter in the [user guide]
602    /// covers these operations in detail.
603    ///
604    /// [long-running operation]: https://google.aip.dev/151
605    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
606    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
607    ///
608    /// # Example
609    /// ```
610    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
611    /// use google_cloud_lro::Poller;
612    /// use google_cloud_spanner_admin_instance_v1::model::Instance;
613    /// use google_cloud_spanner_admin_instance_v1::Result;
614    /// async fn sample(
615    ///    client: &InstanceAdmin, name: &str
616    /// ) -> Result<()> {
617    ///     let response = client.update_instance()
618    ///         .set_instance(
619    ///             Instance::new().set_name(name)/* set fields */
620    ///         )
621    ///         .poller().until_done().await?;
622    ///     println!("response {:?}", response);
623    ///     Ok(())
624    /// }
625    /// ```
626    pub fn update_instance(&self) -> super::builder::instance_admin::UpdateInstance {
627        super::builder::instance_admin::UpdateInstance::new(self.inner.clone())
628    }
629
630    /// Deletes an instance.
631    ///
632    /// Immediately upon completion of the request:
633    ///
634    /// * Billing ceases for all of the instance's reserved resources.
635    ///
636    /// Soon afterward:
637    ///
638    /// * The instance and *all of its databases* immediately and
639    ///   irrevocably disappear from the API. All data in the databases
640    ///   is permanently deleted.
641    ///
642    /// # Example
643    /// ```
644    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
645    /// use google_cloud_spanner_admin_instance_v1::Result;
646    /// async fn sample(
647    ///    client: &InstanceAdmin, name: &str
648    /// ) -> Result<()> {
649    ///     client.delete_instance()
650    ///         .set_name(name)
651    ///         .send().await?;
652    ///     Ok(())
653    /// }
654    /// ```
655    pub fn delete_instance(&self) -> super::builder::instance_admin::DeleteInstance {
656        super::builder::instance_admin::DeleteInstance::new(self.inner.clone())
657    }
658
659    /// Sets the access control policy on an instance resource. Replaces any
660    /// existing policy.
661    ///
662    /// Authorization requires `spanner.instances.setIamPolicy` on
663    /// [resource][google.iam.v1.SetIamPolicyRequest.resource].
664    ///
665    /// [google.iam.v1.SetIamPolicyRequest.resource]: google_cloud_iam_v1::model::SetIamPolicyRequest::resource
666    ///
667    /// # Example
668    /// ```
669    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
670    /// use google_cloud_spanner_admin_instance_v1::Result;
671    /// async fn sample(
672    ///    client: &InstanceAdmin
673    /// ) -> Result<()> {
674    ///     let response = client.set_iam_policy()
675    ///         /* set fields */
676    ///         .send().await?;
677    ///     println!("response {:?}", response);
678    ///     Ok(())
679    /// }
680    /// ```
681    pub fn set_iam_policy(&self) -> super::builder::instance_admin::SetIamPolicy {
682        super::builder::instance_admin::SetIamPolicy::new(self.inner.clone())
683    }
684
685    /// Gets the access control policy for an instance resource. Returns an empty
686    /// policy if an instance exists but does not have a policy set.
687    ///
688    /// Authorization requires `spanner.instances.getIamPolicy` on
689    /// [resource][google.iam.v1.GetIamPolicyRequest.resource].
690    ///
691    /// [google.iam.v1.GetIamPolicyRequest.resource]: google_cloud_iam_v1::model::GetIamPolicyRequest::resource
692    ///
693    /// # Example
694    /// ```
695    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
696    /// use google_cloud_spanner_admin_instance_v1::Result;
697    /// async fn sample(
698    ///    client: &InstanceAdmin
699    /// ) -> Result<()> {
700    ///     let response = client.get_iam_policy()
701    ///         /* set fields */
702    ///         .send().await?;
703    ///     println!("response {:?}", response);
704    ///     Ok(())
705    /// }
706    /// ```
707    pub fn get_iam_policy(&self) -> super::builder::instance_admin::GetIamPolicy {
708        super::builder::instance_admin::GetIamPolicy::new(self.inner.clone())
709    }
710
711    /// Returns permissions that the caller has on the specified instance resource.
712    ///
713    /// Attempting this RPC on a non-existent Cloud Spanner instance resource will
714    /// result in a NOT_FOUND error if the user has `spanner.instances.list`
715    /// permission on the containing Google Cloud Project. Otherwise returns an
716    /// empty set of permissions.
717    ///
718    /// # Example
719    /// ```
720    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
721    /// use google_cloud_spanner_admin_instance_v1::Result;
722    /// async fn sample(
723    ///    client: &InstanceAdmin
724    /// ) -> Result<()> {
725    ///     let response = client.test_iam_permissions()
726    ///         /* set fields */
727    ///         .send().await?;
728    ///     println!("response {:?}", response);
729    ///     Ok(())
730    /// }
731    /// ```
732    pub fn test_iam_permissions(&self) -> super::builder::instance_admin::TestIamPermissions {
733        super::builder::instance_admin::TestIamPermissions::new(self.inner.clone())
734    }
735
736    /// Gets information about a particular instance partition.
737    ///
738    /// # Example
739    /// ```
740    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
741    /// use google_cloud_spanner_admin_instance_v1::Result;
742    /// async fn sample(
743    ///    client: &InstanceAdmin, name: &str
744    /// ) -> Result<()> {
745    ///     let response = client.get_instance_partition()
746    ///         .set_name(name)
747    ///         .send().await?;
748    ///     println!("response {:?}", response);
749    ///     Ok(())
750    /// }
751    /// ```
752    pub fn get_instance_partition(&self) -> super::builder::instance_admin::GetInstancePartition {
753        super::builder::instance_admin::GetInstancePartition::new(self.inner.clone())
754    }
755
756    /// Creates an instance partition and begins preparing it to be used. The
757    /// returned long-running operation
758    /// can be used to track the progress of preparing the new instance partition.
759    /// The instance partition name is assigned by the caller. If the named
760    /// instance partition already exists, `CreateInstancePartition` returns
761    /// `ALREADY_EXISTS`.
762    ///
763    /// Immediately upon completion of this request:
764    ///
765    /// * The instance partition is readable via the API, with all requested
766    ///   attributes but no allocated resources. Its state is `CREATING`.
767    ///
768    /// Until completion of the returned operation:
769    ///
770    /// * Cancelling the operation renders the instance partition immediately
771    ///   unreadable via the API.
772    /// * The instance partition can be deleted.
773    /// * All other attempts to modify the instance partition are rejected.
774    ///
775    /// Upon completion of the returned operation:
776    ///
777    /// * Billing for all successfully-allocated resources begins (some types
778    ///   may have lower than the requested levels).
779    /// * Databases can start using this instance partition.
780    /// * The instance partition's allocated resource levels are readable via the
781    ///   API.
782    /// * The instance partition's state becomes `READY`.
783    ///
784    /// The returned long-running operation will
785    /// have a name of the format
786    /// `<instance_partition_name>/operations/<operation_id>` and can be used to
787    /// track creation of the instance partition.  The
788    /// metadata field type is
789    /// [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
790    /// The response field type is
791    /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
792    /// successful.
793    ///
794    /// [google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]: crate::model::CreateInstancePartitionMetadata
795    /// [google.spanner.admin.instance.v1.InstancePartition]: crate::model::InstancePartition
796    ///
797    /// # Long running operations
798    ///
799    /// This method is used to start, and/or poll a [long-running Operation].
800    /// The [Working with long-running operations] chapter in the [user guide]
801    /// covers these operations in detail.
802    ///
803    /// [long-running operation]: https://google.aip.dev/151
804    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
805    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
806    ///
807    /// # Example
808    /// ```
809    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
810    /// use google_cloud_lro::Poller;
811    /// use google_cloud_spanner_admin_instance_v1::Result;
812    /// async fn sample(
813    ///    client: &InstanceAdmin
814    /// ) -> Result<()> {
815    ///     let response = client.create_instance_partition()
816    ///         /* set fields */
817    ///         .poller().until_done().await?;
818    ///     println!("response {:?}", response);
819    ///     Ok(())
820    /// }
821    /// ```
822    pub fn create_instance_partition(
823        &self,
824    ) -> super::builder::instance_admin::CreateInstancePartition {
825        super::builder::instance_admin::CreateInstancePartition::new(self.inner.clone())
826    }
827
828    /// Deletes an existing instance partition. Requires that the
829    /// instance partition is not used by any database or backup and is not the
830    /// default instance partition of an instance.
831    ///
832    /// Authorization requires `spanner.instancePartitions.delete` permission on
833    /// the resource
834    /// [name][google.spanner.admin.instance.v1.InstancePartition.name].
835    ///
836    /// [google.spanner.admin.instance.v1.InstancePartition.name]: crate::model::InstancePartition::name
837    ///
838    /// # Example
839    /// ```
840    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
841    /// use google_cloud_spanner_admin_instance_v1::Result;
842    /// async fn sample(
843    ///    client: &InstanceAdmin, name: &str
844    /// ) -> Result<()> {
845    ///     client.delete_instance_partition()
846    ///         .set_name(name)
847    ///         .send().await?;
848    ///     Ok(())
849    /// }
850    /// ```
851    pub fn delete_instance_partition(
852        &self,
853    ) -> super::builder::instance_admin::DeleteInstancePartition {
854        super::builder::instance_admin::DeleteInstancePartition::new(self.inner.clone())
855    }
856
857    /// Updates an instance partition, and begins allocating or releasing resources
858    /// as requested. The returned long-running operation can be used to track the
859    /// progress of updating the instance partition. If the named instance
860    /// partition does not exist, returns `NOT_FOUND`.
861    ///
862    /// Immediately upon completion of this request:
863    ///
864    /// * For resource types for which a decrease in the instance partition's
865    ///   allocation has been requested, billing is based on the newly-requested
866    ///   level.
867    ///
868    /// Until completion of the returned operation:
869    ///
870    /// * Cancelling the operation sets its metadata's
871    ///   [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time],
872    ///   and begins restoring resources to their pre-request values. The
873    ///   operation is guaranteed to succeed at undoing all resource changes,
874    ///   after which point it terminates with a `CANCELLED` status.
875    /// * All other attempts to modify the instance partition are rejected.
876    /// * Reading the instance partition via the API continues to give the
877    ///   pre-request resource levels.
878    ///
879    /// Upon completion of the returned operation:
880    ///
881    /// * Billing begins for all successfully-allocated resources (some types
882    ///   may have lower than the requested levels).
883    /// * All newly-reserved resources are available for serving the instance
884    ///   partition's tables.
885    /// * The instance partition's new resource levels are readable via the API.
886    ///
887    /// The returned long-running operation will
888    /// have a name of the format
889    /// `<instance_partition_name>/operations/<operation_id>` and can be used to
890    /// track the instance partition modification. The
891    /// metadata field type is
892    /// [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata].
893    /// The response field type is
894    /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
895    /// successful.
896    ///
897    /// Authorization requires `spanner.instancePartitions.update` permission on
898    /// the resource
899    /// [name][google.spanner.admin.instance.v1.InstancePartition.name].
900    ///
901    /// [google.spanner.admin.instance.v1.InstancePartition]: crate::model::InstancePartition
902    /// [google.spanner.admin.instance.v1.InstancePartition.name]: crate::model::InstancePartition::name
903    /// [google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]: crate::model::UpdateInstancePartitionMetadata
904    /// [google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time]: crate::model::UpdateInstancePartitionMetadata::cancel_time
905    ///
906    /// # Long running operations
907    ///
908    /// This method is used to start, and/or poll a [long-running Operation].
909    /// The [Working with long-running operations] chapter in the [user guide]
910    /// covers these operations in detail.
911    ///
912    /// [long-running operation]: https://google.aip.dev/151
913    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
914    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
915    ///
916    /// # Example
917    /// ```
918    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
919    /// use google_cloud_lro::Poller;
920    /// use google_cloud_spanner_admin_instance_v1::Result;
921    /// async fn sample(
922    ///    client: &InstanceAdmin
923    /// ) -> Result<()> {
924    ///     let response = client.update_instance_partition()
925    ///         /* set fields */
926    ///         .poller().until_done().await?;
927    ///     println!("response {:?}", response);
928    ///     Ok(())
929    /// }
930    /// ```
931    pub fn update_instance_partition(
932        &self,
933    ) -> super::builder::instance_admin::UpdateInstancePartition {
934        super::builder::instance_admin::UpdateInstancePartition::new(self.inner.clone())
935    }
936
937    /// Lists instance partition long-running operations in the given instance.
938    /// An instance partition operation has a name of the form
939    /// `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`.
940    /// The long-running operation
941    /// metadata field type
942    /// `metadata.type_url` describes the type of the metadata. Operations returned
943    /// include those that have completed/failed/canceled within the last 7 days,
944    /// and pending operations. Operations returned are ordered by
945    /// `operation.metadata.value.start_time` in descending order starting from the
946    /// most recently started operation.
947    ///
948    /// Authorization requires `spanner.instancePartitionOperations.list`
949    /// permission on the resource
950    /// [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent].
951    ///
952    /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]: crate::model::ListInstancePartitionOperationsRequest::parent
953    ///
954    /// # Example
955    /// ```
956    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
957    /// use google_cloud_gax::paginator::ItemPaginator as _;
958    /// use google_cloud_spanner_admin_instance_v1::Result;
959    /// async fn sample(
960    ///    client: &InstanceAdmin
961    /// ) -> Result<()> {
962    ///     let mut list = client.list_instance_partition_operations()
963    ///         /* set fields */
964    ///         .by_item();
965    ///     while let Some(item) = list.next().await.transpose()? {
966    ///         println!("{:?}", item);
967    ///     }
968    ///     Ok(())
969    /// }
970    /// ```
971    pub fn list_instance_partition_operations(
972        &self,
973    ) -> super::builder::instance_admin::ListInstancePartitionOperations {
974        super::builder::instance_admin::ListInstancePartitionOperations::new(self.inner.clone())
975    }
976
977    /// Moves an instance to the target instance configuration. You can use the
978    /// returned long-running operation to track
979    /// the progress of moving the instance.
980    ///
981    /// `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of
982    /// the following criteria:
983    ///
984    /// * Is undergoing a move to a different instance configuration
985    /// * Has backups
986    /// * Has an ongoing update
987    /// * Contains any CMEK-enabled databases
988    /// * Is a free trial instance
989    ///
990    /// While the operation is pending:
991    ///
992    /// * All other attempts to modify the instance, including changes to its
993    ///   compute capacity, are rejected.
994    ///
995    /// * The following database and backup admin operations are rejected:
996    ///
997    ///   * `DatabaseAdmin.CreateDatabase`
998    ///   * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is
999    ///     specified in the request.)
1000    ///   * `DatabaseAdmin.RestoreDatabase`
1001    ///   * `DatabaseAdmin.CreateBackup`
1002    ///   * `DatabaseAdmin.CopyBackup`
1003    /// * Both the source and target instance configurations are subject to
1004    ///   hourly compute and storage charges.
1005    ///
1006    /// * The instance might experience higher read-write latencies and a higher
1007    ///   transaction abort rate. However, moving an instance doesn't cause any
1008    ///   downtime.
1009    ///
1010    ///
1011    /// The returned long-running operation has
1012    /// a name of the format
1013    /// `<instance_name>/operations/<operation_id>` and can be used to track
1014    /// the move instance operation. The
1015    /// metadata field type is
1016    /// [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata].
1017    /// The response field type is
1018    /// [Instance][google.spanner.admin.instance.v1.Instance],
1019    /// if successful.
1020    /// Cancelling the operation sets its metadata's
1021    /// [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time].
1022    /// Cancellation is not immediate because it involves moving any data
1023    /// previously moved to the target instance configuration back to the original
1024    /// instance configuration. You can use this operation to track the progress of
1025    /// the cancellation. Upon successful completion of the cancellation, the
1026    /// operation terminates with `CANCELLED` status.
1027    ///
1028    /// If not cancelled, upon completion of the returned operation:
1029    ///
1030    /// * The instance successfully moves to the target instance
1031    ///   configuration.
1032    /// * You are billed for compute and storage in target instance
1033    ///   configuration.
1034    ///
1035    /// Authorization requires the `spanner.instances.update` permission on
1036    /// the resource [instance][google.spanner.admin.instance.v1.Instance].
1037    ///
1038    /// For more details, see
1039    /// [Move an instance](https://cloud.google.com/spanner/docs/move-instance).
1040    ///
1041    /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
1042    /// [google.spanner.admin.instance.v1.MoveInstanceMetadata]: crate::model::MoveInstanceMetadata
1043    /// [google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]: crate::model::MoveInstanceMetadata::cancel_time
1044    ///
1045    /// # Long running operations
1046    ///
1047    /// This method is used to start, and/or poll a [long-running Operation].
1048    /// The [Working with long-running operations] chapter in the [user guide]
1049    /// covers these operations in detail.
1050    ///
1051    /// [long-running operation]: https://google.aip.dev/151
1052    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1053    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1054    ///
1055    /// # Example
1056    /// ```
1057    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
1058    /// use google_cloud_lro::Poller;
1059    /// use google_cloud_spanner_admin_instance_v1::Result;
1060    /// async fn sample(
1061    ///    client: &InstanceAdmin
1062    /// ) -> Result<()> {
1063    ///     let response = client.move_instance()
1064    ///         /* set fields */
1065    ///         .poller().until_done().await?;
1066    ///     println!("response {:?}", response);
1067    ///     Ok(())
1068    /// }
1069    /// ```
1070    pub fn move_instance(&self) -> super::builder::instance_admin::MoveInstance {
1071        super::builder::instance_admin::MoveInstance::new(self.inner.clone())
1072    }
1073
1074    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1075    ///
1076    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1077    ///
1078    /// # Example
1079    /// ```
1080    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
1081    /// use google_cloud_gax::paginator::ItemPaginator as _;
1082    /// use google_cloud_spanner_admin_instance_v1::Result;
1083    /// async fn sample(
1084    ///    client: &InstanceAdmin
1085    /// ) -> Result<()> {
1086    ///     let mut list = client.list_operations()
1087    ///         /* set fields */
1088    ///         .by_item();
1089    ///     while let Some(item) = list.next().await.transpose()? {
1090    ///         println!("{:?}", item);
1091    ///     }
1092    ///     Ok(())
1093    /// }
1094    /// ```
1095    pub fn list_operations(&self) -> super::builder::instance_admin::ListOperations {
1096        super::builder::instance_admin::ListOperations::new(self.inner.clone())
1097    }
1098
1099    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1100    ///
1101    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1102    ///
1103    /// # Example
1104    /// ```
1105    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
1106    /// use google_cloud_spanner_admin_instance_v1::Result;
1107    /// async fn sample(
1108    ///    client: &InstanceAdmin
1109    /// ) -> Result<()> {
1110    ///     let response = client.get_operation()
1111    ///         /* set fields */
1112    ///         .send().await?;
1113    ///     println!("response {:?}", response);
1114    ///     Ok(())
1115    /// }
1116    /// ```
1117    pub fn get_operation(&self) -> super::builder::instance_admin::GetOperation {
1118        super::builder::instance_admin::GetOperation::new(self.inner.clone())
1119    }
1120
1121    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1122    ///
1123    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1124    ///
1125    /// # Example
1126    /// ```
1127    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
1128    /// use google_cloud_spanner_admin_instance_v1::Result;
1129    /// async fn sample(
1130    ///    client: &InstanceAdmin
1131    /// ) -> Result<()> {
1132    ///     client.delete_operation()
1133    ///         /* set fields */
1134    ///         .send().await?;
1135    ///     Ok(())
1136    /// }
1137    /// ```
1138    pub fn delete_operation(&self) -> super::builder::instance_admin::DeleteOperation {
1139        super::builder::instance_admin::DeleteOperation::new(self.inner.clone())
1140    }
1141
1142    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1143    ///
1144    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1145    ///
1146    /// # Example
1147    /// ```
1148    /// # use google_cloud_spanner_admin_instance_v1::client::InstanceAdmin;
1149    /// use google_cloud_spanner_admin_instance_v1::Result;
1150    /// async fn sample(
1151    ///    client: &InstanceAdmin
1152    /// ) -> Result<()> {
1153    ///     client.cancel_operation()
1154    ///         /* set fields */
1155    ///         .send().await?;
1156    ///     Ok(())
1157    /// }
1158    /// ```
1159    pub fn cancel_operation(&self) -> super::builder::instance_admin::CancelOperation {
1160        super::builder::instance_admin::CancelOperation::new(self.inner.clone())
1161    }
1162}