Skip to main content

google_cloud_memorystore_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 Memorystore API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_memorystore_v1::client::Memorystore;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28///    project_id: &str,
29///    location_id: &str,
30/// ) -> anyhow::Result<()> {
31///     let client = Memorystore::builder().build().await?;
32///     let mut list = client.list_instances()
33///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
34///         .by_item();
35///     while let Some(item) = list.next().await.transpose()? {
36///         println!("{:?}", item);
37///     }
38///     Ok(())
39/// }
40/// ```
41///
42/// # Service Description
43///
44/// Service describing handlers for resources
45///
46/// # Configuration
47///
48/// To configure `Memorystore` use the `with_*` methods in the type returned
49/// by [builder()][Memorystore::builder]. The default configuration should
50/// work for most applications. Common configuration changes include
51///
52/// * [with_endpoint()]: by default this client uses the global default endpoint
53///   (`https://memorystore.googleapis.com`). Applications using regional
54///   endpoints or running in restricted networks (e.g. a network configured
55///   with [Private Google Access with VPC Service Controls]) may want to
56///   override this default.
57/// * [with_credentials()]: by default this client uses
58///   [Application Default Credentials]. Applications using custom
59///   authentication may need to override this default.
60///
61/// [with_endpoint()]: super::builder::memorystore::ClientBuilder::with_endpoint
62/// [with_credentials()]: super::builder::memorystore::ClientBuilder::with_credentials
63/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
64/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
65///
66/// # Pooling and Cloning
67///
68/// `Memorystore` holds a connection pool internally, it is advised to
69/// create one and reuse it. You do not need to wrap `Memorystore` in
70/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
71/// already uses an `Arc` internally.
72#[derive(Clone, Debug)]
73pub struct Memorystore {
74    inner: std::sync::Arc<dyn super::stub::dynamic::Memorystore>,
75}
76
77impl Memorystore {
78    /// Returns a builder for [Memorystore].
79    ///
80    /// ```
81    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
82    /// # use google_cloud_memorystore_v1::client::Memorystore;
83    /// let client = Memorystore::builder().build().await?;
84    /// # Ok(()) }
85    /// ```
86    pub fn builder() -> super::builder::memorystore::ClientBuilder {
87        crate::new_client_builder(super::builder::memorystore::client::Factory)
88    }
89
90    /// Creates a new client from the provided stub.
91    ///
92    /// The most common case for calling this function is in tests mocking the
93    /// client's behavior.
94    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
95    where
96        T: super::stub::Memorystore + 'static,
97    {
98        Self { inner: stub.into() }
99    }
100
101    pub(crate) async fn new(
102        config: gaxi::options::ClientConfig,
103    ) -> crate::ClientBuilderResult<Self> {
104        let inner = Self::build_inner(config).await?;
105        Ok(Self { inner })
106    }
107
108    async fn build_inner(
109        conf: gaxi::options::ClientConfig,
110    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Memorystore>> {
111        if gaxi::options::tracing_enabled(&conf) {
112            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
113        }
114        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
115    }
116
117    async fn build_transport(
118        conf: gaxi::options::ClientConfig,
119    ) -> crate::ClientBuilderResult<impl super::stub::Memorystore> {
120        super::transport::Memorystore::new(conf).await
121    }
122
123    async fn build_with_tracing(
124        conf: gaxi::options::ClientConfig,
125    ) -> crate::ClientBuilderResult<impl super::stub::Memorystore> {
126        Self::build_transport(conf)
127            .await
128            .map(super::tracing::Memorystore::new)
129    }
130
131    /// Lists Instances in a given project and location.
132    ///
133    /// # Example
134    /// ```
135    /// # use google_cloud_memorystore_v1::client::Memorystore;
136    /// use google_cloud_gax::paginator::ItemPaginator as _;
137    /// use google_cloud_memorystore_v1::Result;
138    /// async fn sample(
139    ///    client: &Memorystore, project_id: &str, location_id: &str
140    /// ) -> Result<()> {
141    ///     let mut list = client.list_instances()
142    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
143    ///         .by_item();
144    ///     while let Some(item) = list.next().await.transpose()? {
145    ///         println!("{:?}", item);
146    ///     }
147    ///     Ok(())
148    /// }
149    /// ```
150    pub fn list_instances(&self) -> super::builder::memorystore::ListInstances {
151        super::builder::memorystore::ListInstances::new(self.inner.clone())
152    }
153
154    /// Gets details of a single Instance.
155    ///
156    /// # Example
157    /// ```
158    /// # use google_cloud_memorystore_v1::client::Memorystore;
159    /// use google_cloud_memorystore_v1::Result;
160    /// async fn sample(
161    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str
162    /// ) -> Result<()> {
163    ///     let response = client.get_instance()
164    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
165    ///         .send().await?;
166    ///     println!("response {:?}", response);
167    ///     Ok(())
168    /// }
169    /// ```
170    pub fn get_instance(&self) -> super::builder::memorystore::GetInstance {
171        super::builder::memorystore::GetInstance::new(self.inner.clone())
172    }
173
174    /// Creates a new Instance in a given project and location.
175    ///
176    /// # Long running operations
177    ///
178    /// This method is used to start, and/or poll a [long-running Operation].
179    /// The [Working with long-running operations] chapter in the [user guide]
180    /// covers these operations in detail.
181    ///
182    /// [long-running operation]: https://google.aip.dev/151
183    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
184    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
185    ///
186    /// # Example
187    /// ```
188    /// # use google_cloud_memorystore_v1::client::Memorystore;
189    /// use google_cloud_lro::Poller;
190    /// use google_cloud_memorystore_v1::model::Instance;
191    /// use google_cloud_memorystore_v1::Result;
192    /// async fn sample(
193    ///    client: &Memorystore, project_id: &str, location_id: &str
194    /// ) -> Result<()> {
195    ///     let response = client.create_instance()
196    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
197    ///         .set_instance_id("instance_id_value")
198    ///         .set_instance(
199    ///             Instance::new()/* set fields */
200    ///         )
201    ///         .poller().until_done().await?;
202    ///     println!("response {:?}", response);
203    ///     Ok(())
204    /// }
205    /// ```
206    pub fn create_instance(&self) -> super::builder::memorystore::CreateInstance {
207        super::builder::memorystore::CreateInstance::new(self.inner.clone())
208    }
209
210    /// Updates the parameters of a single Instance.
211    ///
212    /// # Long running operations
213    ///
214    /// This method is used to start, and/or poll a [long-running Operation].
215    /// The [Working with long-running operations] chapter in the [user guide]
216    /// covers these operations in detail.
217    ///
218    /// [long-running operation]: https://google.aip.dev/151
219    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
220    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
221    ///
222    /// # Example
223    /// ```
224    /// # use google_cloud_memorystore_v1::client::Memorystore;
225    /// use google_cloud_lro::Poller;
226    /// # extern crate wkt as google_cloud_wkt;
227    /// use google_cloud_wkt::FieldMask;
228    /// use google_cloud_memorystore_v1::model::Instance;
229    /// use google_cloud_memorystore_v1::Result;
230    /// async fn sample(
231    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str
232    /// ) -> Result<()> {
233    ///     let response = client.update_instance()
234    ///         .set_instance(
235    ///             Instance::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))/* set fields */
236    ///         )
237    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
238    ///         .poller().until_done().await?;
239    ///     println!("response {:?}", response);
240    ///     Ok(())
241    /// }
242    /// ```
243    pub fn update_instance(&self) -> super::builder::memorystore::UpdateInstance {
244        super::builder::memorystore::UpdateInstance::new(self.inner.clone())
245    }
246
247    /// Deletes a single Instance.
248    ///
249    /// # Long running operations
250    ///
251    /// This method is used to start, and/or poll a [long-running Operation].
252    /// The [Working with long-running operations] chapter in the [user guide]
253    /// covers these operations in detail.
254    ///
255    /// [long-running operation]: https://google.aip.dev/151
256    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
257    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
258    ///
259    /// # Example
260    /// ```
261    /// # use google_cloud_memorystore_v1::client::Memorystore;
262    /// use google_cloud_lro::Poller;
263    /// use google_cloud_memorystore_v1::Result;
264    /// async fn sample(
265    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str
266    /// ) -> Result<()> {
267    ///     client.delete_instance()
268    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
269    ///         .poller().until_done().await?;
270    ///     Ok(())
271    /// }
272    /// ```
273    pub fn delete_instance(&self) -> super::builder::memorystore::DeleteInstance {
274        super::builder::memorystore::DeleteInstance::new(self.inner.clone())
275    }
276
277    /// Gets details about the certificate authority for an Instance.
278    ///
279    /// # Example
280    /// ```
281    /// # use google_cloud_memorystore_v1::client::Memorystore;
282    /// use google_cloud_memorystore_v1::Result;
283    /// async fn sample(
284    ///    client: &Memorystore
285    /// ) -> Result<()> {
286    ///     let response = client.get_certificate_authority()
287    ///         /* set fields */
288    ///         .send().await?;
289    ///     println!("response {:?}", response);
290    ///     Ok(())
291    /// }
292    /// ```
293    pub fn get_certificate_authority(
294        &self,
295    ) -> super::builder::memorystore::GetCertificateAuthority {
296        super::builder::memorystore::GetCertificateAuthority::new(self.inner.clone())
297    }
298
299    /// Gets the details of shared regional certificate authority information for
300    /// Memorystore instance.
301    ///
302    /// # Example
303    /// ```
304    /// # use google_cloud_memorystore_v1::client::Memorystore;
305    /// use google_cloud_memorystore_v1::Result;
306    /// async fn sample(
307    ///    client: &Memorystore, project_id: &str, location_id: &str
308    /// ) -> Result<()> {
309    ///     let response = client.get_shared_regional_certificate_authority()
310    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/sharedRegionalCertificateAuthority"))
311    ///         .send().await?;
312    ///     println!("response {:?}", response);
313    ///     Ok(())
314    /// }
315    /// ```
316    pub fn get_shared_regional_certificate_authority(
317        &self,
318    ) -> super::builder::memorystore::GetSharedRegionalCertificateAuthority {
319        super::builder::memorystore::GetSharedRegionalCertificateAuthority::new(self.inner.clone())
320    }
321
322    /// Reschedules upcoming maintenance event.
323    ///
324    /// # Long running operations
325    ///
326    /// This method is used to start, and/or poll a [long-running Operation].
327    /// The [Working with long-running operations] chapter in the [user guide]
328    /// covers these operations in detail.
329    ///
330    /// [long-running operation]: https://google.aip.dev/151
331    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
332    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
333    ///
334    /// # Example
335    /// ```
336    /// # use google_cloud_memorystore_v1::client::Memorystore;
337    /// use google_cloud_lro::Poller;
338    /// use google_cloud_memorystore_v1::Result;
339    /// async fn sample(
340    ///    client: &Memorystore
341    /// ) -> Result<()> {
342    ///     let response = client.reschedule_maintenance()
343    ///         /* set fields */
344    ///         .poller().until_done().await?;
345    ///     println!("response {:?}", response);
346    ///     Ok(())
347    /// }
348    /// ```
349    pub fn reschedule_maintenance(&self) -> super::builder::memorystore::RescheduleMaintenance {
350        super::builder::memorystore::RescheduleMaintenance::new(self.inner.clone())
351    }
352
353    /// Lists all backup collections owned by a consumer project in either the
354    /// specified location (region) or all locations.
355    ///
356    /// If `location_id` is specified as `-` (wildcard), then all regions
357    /// available to the project are queried, and the results are aggregated.
358    ///
359    /// # Example
360    /// ```
361    /// # use google_cloud_memorystore_v1::client::Memorystore;
362    /// use google_cloud_gax::paginator::ItemPaginator as _;
363    /// use google_cloud_memorystore_v1::Result;
364    /// async fn sample(
365    ///    client: &Memorystore, project_id: &str, location_id: &str
366    /// ) -> Result<()> {
367    ///     let mut list = client.list_backup_collections()
368    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
369    ///         .by_item();
370    ///     while let Some(item) = list.next().await.transpose()? {
371    ///         println!("{:?}", item);
372    ///     }
373    ///     Ok(())
374    /// }
375    /// ```
376    pub fn list_backup_collections(&self) -> super::builder::memorystore::ListBackupCollections {
377        super::builder::memorystore::ListBackupCollections::new(self.inner.clone())
378    }
379
380    /// Get a backup collection.
381    ///
382    /// # Example
383    /// ```
384    /// # use google_cloud_memorystore_v1::client::Memorystore;
385    /// use google_cloud_memorystore_v1::Result;
386    /// async fn sample(
387    ///    client: &Memorystore, project_id: &str, location_id: &str, backup_collection_id: &str
388    /// ) -> Result<()> {
389    ///     let response = client.get_backup_collection()
390    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}"))
391    ///         .send().await?;
392    ///     println!("response {:?}", response);
393    ///     Ok(())
394    /// }
395    /// ```
396    pub fn get_backup_collection(&self) -> super::builder::memorystore::GetBackupCollection {
397        super::builder::memorystore::GetBackupCollection::new(self.inner.clone())
398    }
399
400    /// Lists all backups owned by a backup collection.
401    ///
402    /// # Example
403    /// ```
404    /// # use google_cloud_memorystore_v1::client::Memorystore;
405    /// use google_cloud_gax::paginator::ItemPaginator as _;
406    /// use google_cloud_memorystore_v1::Result;
407    /// async fn sample(
408    ///    client: &Memorystore, project_id: &str, location_id: &str, backup_collection_id: &str
409    /// ) -> Result<()> {
410    ///     let mut list = client.list_backups()
411    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}"))
412    ///         .by_item();
413    ///     while let Some(item) = list.next().await.transpose()? {
414    ///         println!("{:?}", item);
415    ///     }
416    ///     Ok(())
417    /// }
418    /// ```
419    pub fn list_backups(&self) -> super::builder::memorystore::ListBackups {
420        super::builder::memorystore::ListBackups::new(self.inner.clone())
421    }
422
423    /// Gets the details of a specific backup.
424    ///
425    /// # Example
426    /// ```
427    /// # use google_cloud_memorystore_v1::client::Memorystore;
428    /// use google_cloud_memorystore_v1::Result;
429    /// async fn sample(
430    ///    client: &Memorystore, project_id: &str, location_id: &str, backup_collection_id: &str, backup_id: &str
431    /// ) -> Result<()> {
432    ///     let response = client.get_backup()
433    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}"))
434    ///         .send().await?;
435    ///     println!("response {:?}", response);
436    ///     Ok(())
437    /// }
438    /// ```
439    pub fn get_backup(&self) -> super::builder::memorystore::GetBackup {
440        super::builder::memorystore::GetBackup::new(self.inner.clone())
441    }
442
443    /// Deletes a specific backup.
444    ///
445    /// # Long running operations
446    ///
447    /// This method is used to start, and/or poll a [long-running Operation].
448    /// The [Working with long-running operations] chapter in the [user guide]
449    /// covers these operations in detail.
450    ///
451    /// [long-running operation]: https://google.aip.dev/151
452    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
453    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
454    ///
455    /// # Example
456    /// ```
457    /// # use google_cloud_memorystore_v1::client::Memorystore;
458    /// use google_cloud_lro::Poller;
459    /// use google_cloud_memorystore_v1::Result;
460    /// async fn sample(
461    ///    client: &Memorystore, project_id: &str, location_id: &str, backup_collection_id: &str, backup_id: &str
462    /// ) -> Result<()> {
463    ///     client.delete_backup()
464    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}"))
465    ///         .poller().until_done().await?;
466    ///     Ok(())
467    /// }
468    /// ```
469    pub fn delete_backup(&self) -> super::builder::memorystore::DeleteBackup {
470        super::builder::memorystore::DeleteBackup::new(self.inner.clone())
471    }
472
473    /// Exports a specific backup to a customer target Cloud Storage URI.
474    ///
475    /// # Long running operations
476    ///
477    /// This method is used to start, and/or poll a [long-running Operation].
478    /// The [Working with long-running operations] chapter in the [user guide]
479    /// covers these operations in detail.
480    ///
481    /// [long-running operation]: https://google.aip.dev/151
482    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
483    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
484    ///
485    /// # Example
486    /// ```
487    /// # use google_cloud_memorystore_v1::client::Memorystore;
488    /// use google_cloud_lro::Poller;
489    /// use google_cloud_memorystore_v1::Result;
490    /// async fn sample(
491    ///    client: &Memorystore
492    /// ) -> Result<()> {
493    ///     let response = client.export_backup()
494    ///         /* set fields */
495    ///         .poller().until_done().await?;
496    ///     println!("response {:?}", response);
497    ///     Ok(())
498    /// }
499    /// ```
500    pub fn export_backup(&self) -> super::builder::memorystore::ExportBackup {
501        super::builder::memorystore::ExportBackup::new(self.inner.clone())
502    }
503
504    /// Backup Instance.
505    /// If this is the first time a backup is being created, a backup collection
506    /// will be created at the backend, and this backup belongs to this collection.
507    /// Both collection and backup will have a resource name. Backup will be
508    /// executed for each shard. A replica (primary if nonHA) will be selected to
509    /// perform the execution. Backup call will be rejected if there is an ongoing
510    /// backup or update operation. Be aware that during preview, if the instance's
511    /// internal software version is too old, critical update will be performed
512    /// before actual backup. Once the internal software version is updated to the
513    /// minimum version required by the backup feature, subsequent backups will not
514    /// require critical update. After preview, there will be no critical update
515    /// needed for backup.
516    ///
517    /// # Long running operations
518    ///
519    /// This method is used to start, and/or poll a [long-running Operation].
520    /// The [Working with long-running operations] chapter in the [user guide]
521    /// covers these operations in detail.
522    ///
523    /// [long-running operation]: https://google.aip.dev/151
524    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
525    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
526    ///
527    /// # Example
528    /// ```
529    /// # use google_cloud_memorystore_v1::client::Memorystore;
530    /// use google_cloud_lro::Poller;
531    /// use google_cloud_memorystore_v1::Result;
532    /// async fn sample(
533    ///    client: &Memorystore
534    /// ) -> Result<()> {
535    ///     let response = client.backup_instance()
536    ///         /* set fields */
537    ///         .poller().until_done().await?;
538    ///     println!("response {:?}", response);
539    ///     Ok(())
540    /// }
541    /// ```
542    pub fn backup_instance(&self) -> super::builder::memorystore::BackupInstance {
543        super::builder::memorystore::BackupInstance::new(self.inner.clone())
544    }
545
546    /// Initiates the migration of a source instance to the target Memorystore
547    /// instance.
548    ///
549    /// After the successful completion of this operation, the target instance
550    /// will:
551    ///
552    /// 1. Set up replication with the source instance and replicate any writes to
553    ///    the source instance.
554    /// 1. Only allow reads.
555    ///
556    /// # Long running operations
557    ///
558    /// This method is used to start, and/or poll a [long-running Operation].
559    /// The [Working with long-running operations] chapter in the [user guide]
560    /// covers these operations in detail.
561    ///
562    /// [long-running operation]: https://google.aip.dev/151
563    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
564    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
565    ///
566    /// # Example
567    /// ```
568    /// # use google_cloud_memorystore_v1::client::Memorystore;
569    /// use google_cloud_lro::Poller;
570    /// use google_cloud_memorystore_v1::Result;
571    /// async fn sample(
572    ///    client: &Memorystore
573    /// ) -> Result<()> {
574    ///     let response = client.start_migration()
575    ///         /* set fields */
576    ///         .poller().until_done().await?;
577    ///     println!("response {:?}", response);
578    ///     Ok(())
579    /// }
580    /// ```
581    pub fn start_migration(&self) -> super::builder::memorystore::StartMigration {
582        super::builder::memorystore::StartMigration::new(self.inner.clone())
583    }
584
585    /// Finalizes the migration process.
586    ///
587    /// After the successful completion of this operation, the target instance
588    /// will:
589    ///
590    /// 1. Stop replicating from the source instance.
591    /// 1. Allow both reads and writes.
592    ///
593    /// # Long running operations
594    ///
595    /// This method is used to start, and/or poll a [long-running Operation].
596    /// The [Working with long-running operations] chapter in the [user guide]
597    /// covers these operations in detail.
598    ///
599    /// [long-running operation]: https://google.aip.dev/151
600    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
601    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
602    ///
603    /// # Example
604    /// ```
605    /// # use google_cloud_memorystore_v1::client::Memorystore;
606    /// use google_cloud_lro::Poller;
607    /// use google_cloud_memorystore_v1::Result;
608    /// async fn sample(
609    ///    client: &Memorystore
610    /// ) -> Result<()> {
611    ///     let response = client.finish_migration()
612    ///         /* set fields */
613    ///         .poller().until_done().await?;
614    ///     println!("response {:?}", response);
615    ///     Ok(())
616    /// }
617    /// ```
618    pub fn finish_migration(&self) -> super::builder::memorystore::FinishMigration {
619        super::builder::memorystore::FinishMigration::new(self.inner.clone())
620    }
621
622    /// Lists information about the supported locations for this service.
623    ///
624    /// This method lists locations based on the resource scope provided in
625    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
626    /// **Global locations**: If `name` is empty, the method lists the
627    /// public locations available to all projects. * **Project-specific
628    /// locations**: If `name` follows the format
629    /// `projects/{project}`, the method lists locations visible to that
630    /// specific project. This includes public, private, or other
631    /// project-specific locations enabled for the project.
632    ///
633    /// For gRPC and client library implementations, the resource name is
634    /// passed as the `name` field. For direct service calls, the resource
635    /// name is
636    /// incorporated into the request path based on the specific service
637    /// implementation and version.
638    ///
639    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
640    ///
641    /// # Example
642    /// ```
643    /// # use google_cloud_memorystore_v1::client::Memorystore;
644    /// use google_cloud_gax::paginator::ItemPaginator as _;
645    /// use google_cloud_memorystore_v1::Result;
646    /// async fn sample(
647    ///    client: &Memorystore
648    /// ) -> Result<()> {
649    ///     let mut list = client.list_locations()
650    ///         /* set fields */
651    ///         .by_item();
652    ///     while let Some(item) = list.next().await.transpose()? {
653    ///         println!("{:?}", item);
654    ///     }
655    ///     Ok(())
656    /// }
657    /// ```
658    pub fn list_locations(&self) -> super::builder::memorystore::ListLocations {
659        super::builder::memorystore::ListLocations::new(self.inner.clone())
660    }
661
662    /// Gets information about a location.
663    ///
664    /// # Example
665    /// ```
666    /// # use google_cloud_memorystore_v1::client::Memorystore;
667    /// use google_cloud_memorystore_v1::Result;
668    /// async fn sample(
669    ///    client: &Memorystore
670    /// ) -> Result<()> {
671    ///     let response = client.get_location()
672    ///         /* set fields */
673    ///         .send().await?;
674    ///     println!("response {:?}", response);
675    ///     Ok(())
676    /// }
677    /// ```
678    pub fn get_location(&self) -> super::builder::memorystore::GetLocation {
679        super::builder::memorystore::GetLocation::new(self.inner.clone())
680    }
681
682    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
683    ///
684    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
685    ///
686    /// # Example
687    /// ```
688    /// # use google_cloud_memorystore_v1::client::Memorystore;
689    /// use google_cloud_gax::paginator::ItemPaginator as _;
690    /// use google_cloud_memorystore_v1::Result;
691    /// async fn sample(
692    ///    client: &Memorystore
693    /// ) -> Result<()> {
694    ///     let mut list = client.list_operations()
695    ///         /* set fields */
696    ///         .by_item();
697    ///     while let Some(item) = list.next().await.transpose()? {
698    ///         println!("{:?}", item);
699    ///     }
700    ///     Ok(())
701    /// }
702    /// ```
703    pub fn list_operations(&self) -> super::builder::memorystore::ListOperations {
704        super::builder::memorystore::ListOperations::new(self.inner.clone())
705    }
706
707    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
708    ///
709    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
710    ///
711    /// # Example
712    /// ```
713    /// # use google_cloud_memorystore_v1::client::Memorystore;
714    /// use google_cloud_memorystore_v1::Result;
715    /// async fn sample(
716    ///    client: &Memorystore
717    /// ) -> Result<()> {
718    ///     let response = client.get_operation()
719    ///         /* set fields */
720    ///         .send().await?;
721    ///     println!("response {:?}", response);
722    ///     Ok(())
723    /// }
724    /// ```
725    pub fn get_operation(&self) -> super::builder::memorystore::GetOperation {
726        super::builder::memorystore::GetOperation::new(self.inner.clone())
727    }
728
729    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
730    ///
731    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
732    ///
733    /// # Example
734    /// ```
735    /// # use google_cloud_memorystore_v1::client::Memorystore;
736    /// use google_cloud_memorystore_v1::Result;
737    /// async fn sample(
738    ///    client: &Memorystore
739    /// ) -> Result<()> {
740    ///     client.delete_operation()
741    ///         /* set fields */
742    ///         .send().await?;
743    ///     Ok(())
744    /// }
745    /// ```
746    pub fn delete_operation(&self) -> super::builder::memorystore::DeleteOperation {
747        super::builder::memorystore::DeleteOperation::new(self.inner.clone())
748    }
749
750    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
751    ///
752    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
753    ///
754    /// # Example
755    /// ```
756    /// # use google_cloud_memorystore_v1::client::Memorystore;
757    /// use google_cloud_memorystore_v1::Result;
758    /// async fn sample(
759    ///    client: &Memorystore
760    /// ) -> Result<()> {
761    ///     client.cancel_operation()
762    ///         /* set fields */
763    ///         .send().await?;
764    ///     Ok(())
765    /// }
766    /// ```
767    pub fn cancel_operation(&self) -> super::builder::memorystore::CancelOperation {
768        super::builder::memorystore::CancelOperation::new(self.inner.clone())
769    }
770}