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