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 all the token auth users for a token based auth enabled instance.
623    ///
624    /// # Example
625    /// ```
626    /// # use google_cloud_memorystore_v1::client::Memorystore;
627    /// use google_cloud_gax::paginator::ItemPaginator as _;
628    /// use google_cloud_memorystore_v1::Result;
629    /// async fn sample(
630    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str
631    /// ) -> Result<()> {
632    ///     let mut list = client.list_token_auth_users()
633    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"))
634    ///         .by_item();
635    ///     while let Some(item) = list.next().await.transpose()? {
636    ///         println!("{:?}", item);
637    ///     }
638    ///     Ok(())
639    /// }
640    /// ```
641    pub fn list_token_auth_users(&self) -> super::builder::memorystore::ListTokenAuthUsers {
642        super::builder::memorystore::ListTokenAuthUsers::new(self.inner.clone())
643    }
644
645    /// Gets a specific token auth user for a token based auth enabled instance.
646    ///
647    /// # Example
648    /// ```
649    /// # use google_cloud_memorystore_v1::client::Memorystore;
650    /// use google_cloud_memorystore_v1::Result;
651    /// async fn sample(
652    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str, token_auth_user_id: &str
653    /// ) -> Result<()> {
654    ///     let response = client.get_token_auth_user()
655    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"))
656    ///         .send().await?;
657    ///     println!("response {:?}", response);
658    ///     Ok(())
659    /// }
660    /// ```
661    pub fn get_token_auth_user(&self) -> super::builder::memorystore::GetTokenAuthUser {
662        super::builder::memorystore::GetTokenAuthUser::new(self.inner.clone())
663    }
664
665    /// Lists all the auth tokens for a specific token auth user.
666    ///
667    /// # Example
668    /// ```
669    /// # use google_cloud_memorystore_v1::client::Memorystore;
670    /// use google_cloud_gax::paginator::ItemPaginator as _;
671    /// use google_cloud_memorystore_v1::Result;
672    /// async fn sample(
673    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str, token_auth_user_id: &str
674    /// ) -> Result<()> {
675    ///     let mut list = client.list_auth_tokens()
676    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"))
677    ///         .by_item();
678    ///     while let Some(item) = list.next().await.transpose()? {
679    ///         println!("{:?}", item);
680    ///     }
681    ///     Ok(())
682    /// }
683    /// ```
684    pub fn list_auth_tokens(&self) -> super::builder::memorystore::ListAuthTokens {
685        super::builder::memorystore::ListAuthTokens::new(self.inner.clone())
686    }
687
688    /// Gets a token based auth enabled instance's auth token for a given user.
689    ///
690    /// # Example
691    /// ```
692    /// # use google_cloud_memorystore_v1::client::Memorystore;
693    /// use google_cloud_memorystore_v1::Result;
694    /// async fn sample(
695    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str, token_auth_user_id: &str, auth_token_id: &str
696    /// ) -> Result<()> {
697    ///     let response = client.get_auth_token()
698    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}/authTokens/{auth_token_id}"))
699    ///         .send().await?;
700    ///     println!("response {:?}", response);
701    ///     Ok(())
702    /// }
703    /// ```
704    pub fn get_auth_token(&self) -> super::builder::memorystore::GetAuthToken {
705        super::builder::memorystore::GetAuthToken::new(self.inner.clone())
706    }
707
708    /// Adds a token auth user for a token based auth enabled instance.
709    ///
710    /// # Long running operations
711    ///
712    /// This method is used to start, and/or poll a [long-running Operation].
713    /// The [Working with long-running operations] chapter in the [user guide]
714    /// covers these operations in detail.
715    ///
716    /// [long-running operation]: https://google.aip.dev/151
717    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
718    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
719    ///
720    /// # Example
721    /// ```
722    /// # use google_cloud_memorystore_v1::client::Memorystore;
723    /// use google_cloud_lro::Poller;
724    /// use google_cloud_memorystore_v1::Result;
725    /// async fn sample(
726    ///    client: &Memorystore
727    /// ) -> Result<()> {
728    ///     let response = client.add_token_auth_user()
729    ///         /* set fields */
730    ///         .poller().until_done().await?;
731    ///     println!("response {:?}", response);
732    ///     Ok(())
733    /// }
734    /// ```
735    pub fn add_token_auth_user(&self) -> super::builder::memorystore::AddTokenAuthUser {
736        super::builder::memorystore::AddTokenAuthUser::new(self.inner.clone())
737    }
738
739    /// Deletes a token auth user for a token based auth enabled instance.
740    ///
741    /// # Long running operations
742    ///
743    /// This method is used to start, and/or poll a [long-running Operation].
744    /// The [Working with long-running operations] chapter in the [user guide]
745    /// covers these operations in detail.
746    ///
747    /// [long-running operation]: https://google.aip.dev/151
748    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
749    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
750    ///
751    /// # Example
752    /// ```
753    /// # use google_cloud_memorystore_v1::client::Memorystore;
754    /// use google_cloud_lro::Poller;
755    /// use google_cloud_memorystore_v1::Result;
756    /// async fn sample(
757    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str, token_auth_user_id: &str
758    /// ) -> Result<()> {
759    ///     client.delete_token_auth_user()
760    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"))
761    ///         .poller().until_done().await?;
762    ///     Ok(())
763    /// }
764    /// ```
765    pub fn delete_token_auth_user(&self) -> super::builder::memorystore::DeleteTokenAuthUser {
766        super::builder::memorystore::DeleteTokenAuthUser::new(self.inner.clone())
767    }
768
769    /// Adds a token for a user of a token based auth enabled instance.
770    ///
771    /// # Long running operations
772    ///
773    /// This method is used to start, and/or poll a [long-running Operation].
774    /// The [Working with long-running operations] chapter in the [user guide]
775    /// covers these operations in detail.
776    ///
777    /// [long-running operation]: https://google.aip.dev/151
778    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
779    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
780    ///
781    /// # Example
782    /// ```
783    /// # use google_cloud_memorystore_v1::client::Memorystore;
784    /// use google_cloud_lro::Poller;
785    /// use google_cloud_memorystore_v1::Result;
786    /// async fn sample(
787    ///    client: &Memorystore
788    /// ) -> Result<()> {
789    ///     let response = client.add_auth_token()
790    ///         /* set fields */
791    ///         .poller().until_done().await?;
792    ///     println!("response {:?}", response);
793    ///     Ok(())
794    /// }
795    /// ```
796    pub fn add_auth_token(&self) -> super::builder::memorystore::AddAuthToken {
797        super::builder::memorystore::AddAuthToken::new(self.inner.clone())
798    }
799
800    /// Deletes a token for a user of a token based auth enabled instance.
801    ///
802    /// # Long running operations
803    ///
804    /// This method is used to start, and/or poll a [long-running Operation].
805    /// The [Working with long-running operations] chapter in the [user guide]
806    /// covers these operations in detail.
807    ///
808    /// [long-running operation]: https://google.aip.dev/151
809    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
810    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
811    ///
812    /// # Example
813    /// ```
814    /// # use google_cloud_memorystore_v1::client::Memorystore;
815    /// use google_cloud_lro::Poller;
816    /// use google_cloud_memorystore_v1::Result;
817    /// async fn sample(
818    ///    client: &Memorystore, project_id: &str, location_id: &str, instance_id: &str, token_auth_user_id: &str, auth_token_id: &str
819    /// ) -> Result<()> {
820    ///     client.delete_auth_token()
821    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}/authTokens/{auth_token_id}"))
822    ///         .poller().until_done().await?;
823    ///     Ok(())
824    /// }
825    /// ```
826    pub fn delete_auth_token(&self) -> super::builder::memorystore::DeleteAuthToken {
827        super::builder::memorystore::DeleteAuthToken::new(self.inner.clone())
828    }
829
830    /// Lists information about the supported locations for this service.
831    ///
832    /// This method lists locations based on the resource scope provided in
833    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
834    /// **Global locations**: If `name` is empty, the method lists the
835    /// public locations available to all projects. * **Project-specific
836    /// locations**: If `name` follows the format
837    /// `projects/{project}`, the method lists locations visible to that
838    /// specific project. This includes public, private, or other
839    /// project-specific locations enabled for the project.
840    ///
841    /// For gRPC and client library implementations, the resource name is
842    /// passed as the `name` field. For direct service calls, the resource
843    /// name is
844    /// incorporated into the request path based on the specific service
845    /// implementation and version.
846    ///
847    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
848    ///
849    /// # Example
850    /// ```
851    /// # use google_cloud_memorystore_v1::client::Memorystore;
852    /// use google_cloud_gax::paginator::ItemPaginator as _;
853    /// use google_cloud_memorystore_v1::Result;
854    /// async fn sample(
855    ///    client: &Memorystore
856    /// ) -> Result<()> {
857    ///     let mut list = client.list_locations()
858    ///         /* set fields */
859    ///         .by_item();
860    ///     while let Some(item) = list.next().await.transpose()? {
861    ///         println!("{:?}", item);
862    ///     }
863    ///     Ok(())
864    /// }
865    /// ```
866    pub fn list_locations(&self) -> super::builder::memorystore::ListLocations {
867        super::builder::memorystore::ListLocations::new(self.inner.clone())
868    }
869
870    /// Gets information about a location.
871    ///
872    /// # Example
873    /// ```
874    /// # use google_cloud_memorystore_v1::client::Memorystore;
875    /// use google_cloud_memorystore_v1::Result;
876    /// async fn sample(
877    ///    client: &Memorystore
878    /// ) -> Result<()> {
879    ///     let response = client.get_location()
880    ///         /* set fields */
881    ///         .send().await?;
882    ///     println!("response {:?}", response);
883    ///     Ok(())
884    /// }
885    /// ```
886    pub fn get_location(&self) -> super::builder::memorystore::GetLocation {
887        super::builder::memorystore::GetLocation::new(self.inner.clone())
888    }
889
890    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
891    ///
892    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
893    ///
894    /// # Example
895    /// ```
896    /// # use google_cloud_memorystore_v1::client::Memorystore;
897    /// use google_cloud_gax::paginator::ItemPaginator as _;
898    /// use google_cloud_memorystore_v1::Result;
899    /// async fn sample(
900    ///    client: &Memorystore
901    /// ) -> Result<()> {
902    ///     let mut list = client.list_operations()
903    ///         /* set fields */
904    ///         .by_item();
905    ///     while let Some(item) = list.next().await.transpose()? {
906    ///         println!("{:?}", item);
907    ///     }
908    ///     Ok(())
909    /// }
910    /// ```
911    pub fn list_operations(&self) -> super::builder::memorystore::ListOperations {
912        super::builder::memorystore::ListOperations::new(self.inner.clone())
913    }
914
915    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
916    ///
917    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
918    ///
919    /// # Example
920    /// ```
921    /// # use google_cloud_memorystore_v1::client::Memorystore;
922    /// use google_cloud_memorystore_v1::Result;
923    /// async fn sample(
924    ///    client: &Memorystore
925    /// ) -> Result<()> {
926    ///     let response = client.get_operation()
927    ///         /* set fields */
928    ///         .send().await?;
929    ///     println!("response {:?}", response);
930    ///     Ok(())
931    /// }
932    /// ```
933    pub fn get_operation(&self) -> super::builder::memorystore::GetOperation {
934        super::builder::memorystore::GetOperation::new(self.inner.clone())
935    }
936
937    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
938    ///
939    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
940    ///
941    /// # Example
942    /// ```
943    /// # use google_cloud_memorystore_v1::client::Memorystore;
944    /// use google_cloud_memorystore_v1::Result;
945    /// async fn sample(
946    ///    client: &Memorystore
947    /// ) -> Result<()> {
948    ///     client.delete_operation()
949    ///         /* set fields */
950    ///         .send().await?;
951    ///     Ok(())
952    /// }
953    /// ```
954    pub fn delete_operation(&self) -> super::builder::memorystore::DeleteOperation {
955        super::builder::memorystore::DeleteOperation::new(self.inner.clone())
956    }
957
958    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
959    ///
960    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
961    ///
962    /// # Example
963    /// ```
964    /// # use google_cloud_memorystore_v1::client::Memorystore;
965    /// use google_cloud_memorystore_v1::Result;
966    /// async fn sample(
967    ///    client: &Memorystore
968    /// ) -> Result<()> {
969    ///     client.cancel_operation()
970    ///         /* set fields */
971    ///         .send().await?;
972    ///     Ok(())
973    /// }
974    /// ```
975    pub fn cancel_operation(&self) -> super::builder::memorystore::CancelOperation {
976        super::builder::memorystore::CancelOperation::new(self.inner.clone())
977    }
978}