Skip to main content

google_cloud_config_v1/
client.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Infrastructure Manager API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_config_v1::client::Config;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26///     let client = Config::builder().build().await?;
27///     let parent = "parent_value";
28///     let mut list = client.list_deployments()
29///         .set_parent(parent)
30///         .by_item();
31///     while let Some(item) = list.next().await.transpose()? {
32///         println!("{:?}", item);
33///     }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// Infrastructure Manager is a managed service that automates the deployment and
40/// management of Google Cloud infrastructure resources.
41///
42/// # Configuration
43///
44/// To configure `Config` use the `with_*` methods in the type returned
45/// by [builder()][Config::builder]. The default configuration should
46/// work for most applications. Common configuration changes include
47///
48/// * [with_endpoint()]: by default this client uses the global default endpoint
49///   (`https://config.googleapis.com`). Applications using regional
50///   endpoints or running in restricted networks (e.g. a network configured
51//    with [Private Google Access with VPC Service Controls]) may want to
52///   override this default.
53/// * [with_credentials()]: by default this client uses
54///   [Application Default Credentials]. Applications using custom
55///   authentication may need to override this default.
56///
57/// [with_endpoint()]: super::builder::config::ClientBuilder::with_endpoint
58/// [with_credentials()]: super::builder::config::ClientBuilder::with_credentials
59/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
60/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
61///
62/// # Pooling and Cloning
63///
64/// `Config` holds a connection pool internally, it is advised to
65/// create one and reuse it. You do not need to wrap `Config` in
66/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
67/// already uses an `Arc` internally.
68#[derive(Clone, Debug)]
69pub struct Config {
70    inner: std::sync::Arc<dyn super::stub::dynamic::Config>,
71}
72
73impl Config {
74    /// Returns a builder for [Config].
75    ///
76    /// ```
77    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
78    /// # use google_cloud_config_v1::client::Config;
79    /// let client = Config::builder().build().await?;
80    /// # Ok(()) }
81    /// ```
82    pub fn builder() -> super::builder::config::ClientBuilder {
83        crate::new_client_builder(super::builder::config::client::Factory)
84    }
85
86    /// Creates a new client from the provided stub.
87    ///
88    /// The most common case for calling this function is in tests mocking the
89    /// client's behavior.
90    pub fn from_stub<T>(stub: T) -> Self
91    where
92        T: super::stub::Config + 'static,
93    {
94        Self {
95            inner: std::sync::Arc::new(stub),
96        }
97    }
98
99    pub(crate) async fn new(
100        config: gaxi::options::ClientConfig,
101    ) -> crate::ClientBuilderResult<Self> {
102        let inner = Self::build_inner(config).await?;
103        Ok(Self { inner })
104    }
105
106    async fn build_inner(
107        conf: gaxi::options::ClientConfig,
108    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Config>> {
109        if gaxi::options::tracing_enabled(&conf) {
110            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
111        }
112        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
113    }
114
115    async fn build_transport(
116        conf: gaxi::options::ClientConfig,
117    ) -> crate::ClientBuilderResult<impl super::stub::Config> {
118        super::transport::Config::new(conf).await
119    }
120
121    async fn build_with_tracing(
122        conf: gaxi::options::ClientConfig,
123    ) -> crate::ClientBuilderResult<impl super::stub::Config> {
124        Self::build_transport(conf)
125            .await
126            .map(super::tracing::Config::new)
127    }
128
129    /// Lists [Deployment][google.cloud.config.v1.Deployment]s in a given project
130    /// and location.
131    ///
132    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
133    ///
134    /// # Example
135    /// ```
136    /// # use google_cloud_config_v1::client::Config;
137    /// use google_cloud_gax::paginator::ItemPaginator as _;
138    /// use google_cloud_config_v1::Result;
139    /// async fn sample(
140    ///    client: &Config, parent: &str
141    /// ) -> Result<()> {
142    ///     let mut list = client.list_deployments()
143    ///         .set_parent(parent)
144    ///         .by_item();
145    ///     while let Some(item) = list.next().await.transpose()? {
146    ///         println!("{:?}", item);
147    ///     }
148    ///     Ok(())
149    /// }
150    /// ```
151    pub fn list_deployments(&self) -> super::builder::config::ListDeployments {
152        super::builder::config::ListDeployments::new(self.inner.clone())
153    }
154
155    /// Gets details about a [Deployment][google.cloud.config.v1.Deployment].
156    ///
157    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
158    ///
159    /// # Example
160    /// ```
161    /// # use google_cloud_config_v1::client::Config;
162    /// use google_cloud_config_v1::Result;
163    /// async fn sample(
164    ///    client: &Config, name: &str
165    /// ) -> Result<()> {
166    ///     let response = client.get_deployment()
167    ///         .set_name(name)
168    ///         .send().await?;
169    ///     println!("response {:?}", response);
170    ///     Ok(())
171    /// }
172    /// ```
173    pub fn get_deployment(&self) -> super::builder::config::GetDeployment {
174        super::builder::config::GetDeployment::new(self.inner.clone())
175    }
176
177    /// Creates a [Deployment][google.cloud.config.v1.Deployment].
178    ///
179    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
180    ///
181    /// # Long running operations
182    ///
183    /// This method is used to start, and/or poll a [long-running Operation].
184    /// The [Working with long-running operations] chapter in the [user guide]
185    /// covers these operations in detail.
186    ///
187    /// [long-running operation]: https://google.aip.dev/151
188    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
189    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
190    ///
191    /// # Example
192    /// ```
193    /// # use google_cloud_config_v1::client::Config;
194    /// use google_cloud_lro::Poller;
195    /// use google_cloud_config_v1::model::Deployment;
196    /// use google_cloud_config_v1::Result;
197    /// async fn sample(
198    ///    client: &Config, parent: &str
199    /// ) -> Result<()> {
200    ///     let response = client.create_deployment()
201    ///         .set_parent(parent)
202    ///         .set_deployment_id("deployment_id_value")
203    ///         .set_deployment(
204    ///             Deployment::new()/* set fields */
205    ///         )
206    ///         .poller().until_done().await?;
207    ///     println!("response {:?}", response);
208    ///     Ok(())
209    /// }
210    /// ```
211    pub fn create_deployment(&self) -> super::builder::config::CreateDeployment {
212        super::builder::config::CreateDeployment::new(self.inner.clone())
213    }
214
215    /// Updates a [Deployment][google.cloud.config.v1.Deployment].
216    ///
217    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
218    ///
219    /// # Long running operations
220    ///
221    /// This method is used to start, and/or poll a [long-running Operation].
222    /// The [Working with long-running operations] chapter in the [user guide]
223    /// covers these operations in detail.
224    ///
225    /// [long-running operation]: https://google.aip.dev/151
226    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
227    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
228    ///
229    /// # Example
230    /// ```
231    /// # use google_cloud_config_v1::client::Config;
232    /// use google_cloud_lro::Poller;
233    /// # extern crate wkt as google_cloud_wkt;
234    /// use google_cloud_wkt::FieldMask;
235    /// use google_cloud_config_v1::model::Deployment;
236    /// use google_cloud_config_v1::Result;
237    /// async fn sample(
238    ///    client: &Config, name: &str
239    /// ) -> Result<()> {
240    ///     let response = client.update_deployment()
241    ///         .set_deployment(
242    ///             Deployment::new().set_name(name)/* set fields */
243    ///         )
244    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
245    ///         .poller().until_done().await?;
246    ///     println!("response {:?}", response);
247    ///     Ok(())
248    /// }
249    /// ```
250    pub fn update_deployment(&self) -> super::builder::config::UpdateDeployment {
251        super::builder::config::UpdateDeployment::new(self.inner.clone())
252    }
253
254    /// Deletes a [Deployment][google.cloud.config.v1.Deployment].
255    ///
256    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
257    ///
258    /// # Long running operations
259    ///
260    /// This method is used to start, and/or poll a [long-running Operation].
261    /// The [Working with long-running operations] chapter in the [user guide]
262    /// covers these operations in detail.
263    ///
264    /// [long-running operation]: https://google.aip.dev/151
265    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
266    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
267    ///
268    /// # Example
269    /// ```
270    /// # use google_cloud_config_v1::client::Config;
271    /// use google_cloud_lro::Poller;
272    /// use google_cloud_config_v1::Result;
273    /// async fn sample(
274    ///    client: &Config, name: &str
275    /// ) -> Result<()> {
276    ///     let response = client.delete_deployment()
277    ///         .set_name(name)
278    ///         .poller().until_done().await?;
279    ///     println!("response {:?}", response);
280    ///     Ok(())
281    /// }
282    /// ```
283    pub fn delete_deployment(&self) -> super::builder::config::DeleteDeployment {
284        super::builder::config::DeleteDeployment::new(self.inner.clone())
285    }
286
287    /// Lists [Revision][google.cloud.config.v1.Revision]s of a deployment.
288    ///
289    /// [google.cloud.config.v1.Revision]: crate::model::Revision
290    ///
291    /// # Example
292    /// ```
293    /// # use google_cloud_config_v1::client::Config;
294    /// use google_cloud_gax::paginator::ItemPaginator as _;
295    /// use google_cloud_config_v1::Result;
296    /// async fn sample(
297    ///    client: &Config, parent: &str
298    /// ) -> Result<()> {
299    ///     let mut list = client.list_revisions()
300    ///         .set_parent(parent)
301    ///         .by_item();
302    ///     while let Some(item) = list.next().await.transpose()? {
303    ///         println!("{:?}", item);
304    ///     }
305    ///     Ok(())
306    /// }
307    /// ```
308    pub fn list_revisions(&self) -> super::builder::config::ListRevisions {
309        super::builder::config::ListRevisions::new(self.inner.clone())
310    }
311
312    /// Gets details about a [Revision][google.cloud.config.v1.Revision].
313    ///
314    /// [google.cloud.config.v1.Revision]: crate::model::Revision
315    ///
316    /// # Example
317    /// ```
318    /// # use google_cloud_config_v1::client::Config;
319    /// use google_cloud_config_v1::Result;
320    /// async fn sample(
321    ///    client: &Config, name: &str
322    /// ) -> Result<()> {
323    ///     let response = client.get_revision()
324    ///         .set_name(name)
325    ///         .send().await?;
326    ///     println!("response {:?}", response);
327    ///     Ok(())
328    /// }
329    /// ```
330    pub fn get_revision(&self) -> super::builder::config::GetRevision {
331        super::builder::config::GetRevision::new(self.inner.clone())
332    }
333
334    /// Gets details about a [Resource][google.cloud.config.v1.Resource] deployed
335    /// by Infra Manager.
336    ///
337    /// [google.cloud.config.v1.Resource]: crate::model::Resource
338    ///
339    /// # Example
340    /// ```
341    /// # use google_cloud_config_v1::client::Config;
342    /// use google_cloud_config_v1::Result;
343    /// async fn sample(
344    ///    client: &Config, name: &str
345    /// ) -> Result<()> {
346    ///     let response = client.get_resource()
347    ///         .set_name(name)
348    ///         .send().await?;
349    ///     println!("response {:?}", response);
350    ///     Ok(())
351    /// }
352    /// ```
353    pub fn get_resource(&self) -> super::builder::config::GetResource {
354        super::builder::config::GetResource::new(self.inner.clone())
355    }
356
357    /// Lists [Resources][google.cloud.config.v1.Resource] in a given revision.
358    ///
359    /// [google.cloud.config.v1.Resource]: crate::model::Resource
360    ///
361    /// # Example
362    /// ```
363    /// # use google_cloud_config_v1::client::Config;
364    /// use google_cloud_gax::paginator::ItemPaginator as _;
365    /// use google_cloud_config_v1::Result;
366    /// async fn sample(
367    ///    client: &Config, parent: &str
368    /// ) -> Result<()> {
369    ///     let mut list = client.list_resources()
370    ///         .set_parent(parent)
371    ///         .by_item();
372    ///     while let Some(item) = list.next().await.transpose()? {
373    ///         println!("{:?}", item);
374    ///     }
375    ///     Ok(())
376    /// }
377    /// ```
378    pub fn list_resources(&self) -> super::builder::config::ListResources {
379        super::builder::config::ListResources::new(self.inner.clone())
380    }
381
382    /// Exports Terraform state file from a given deployment.
383    ///
384    /// # Example
385    /// ```
386    /// # use google_cloud_config_v1::client::Config;
387    /// use google_cloud_config_v1::Result;
388    /// async fn sample(
389    ///    client: &Config
390    /// ) -> Result<()> {
391    ///     let response = client.export_deployment_statefile()
392    ///         /* set fields */
393    ///         .send().await?;
394    ///     println!("response {:?}", response);
395    ///     Ok(())
396    /// }
397    /// ```
398    pub fn export_deployment_statefile(&self) -> super::builder::config::ExportDeploymentStatefile {
399        super::builder::config::ExportDeploymentStatefile::new(self.inner.clone())
400    }
401
402    /// Exports Terraform state file from a given revision.
403    ///
404    /// # Example
405    /// ```
406    /// # use google_cloud_config_v1::client::Config;
407    /// use google_cloud_config_v1::Result;
408    /// async fn sample(
409    ///    client: &Config
410    /// ) -> Result<()> {
411    ///     let response = client.export_revision_statefile()
412    ///         /* set fields */
413    ///         .send().await?;
414    ///     println!("response {:?}", response);
415    ///     Ok(())
416    /// }
417    /// ```
418    pub fn export_revision_statefile(&self) -> super::builder::config::ExportRevisionStatefile {
419        super::builder::config::ExportRevisionStatefile::new(self.inner.clone())
420    }
421
422    /// Imports Terraform state file in a given deployment. The state file does not
423    /// take effect until the Deployment has been unlocked.
424    ///
425    /// # Example
426    /// ```
427    /// # use google_cloud_config_v1::client::Config;
428    /// use google_cloud_config_v1::Result;
429    /// async fn sample(
430    ///    client: &Config
431    /// ) -> Result<()> {
432    ///     let response = client.import_statefile()
433    ///         /* set fields */
434    ///         .send().await?;
435    ///     println!("response {:?}", response);
436    ///     Ok(())
437    /// }
438    /// ```
439    pub fn import_statefile(&self) -> super::builder::config::ImportStatefile {
440        super::builder::config::ImportStatefile::new(self.inner.clone())
441    }
442
443    /// Deletes Terraform state file in a given deployment.
444    ///
445    /// # Example
446    /// ```
447    /// # use google_cloud_config_v1::client::Config;
448    /// use google_cloud_config_v1::Result;
449    /// async fn sample(
450    ///    client: &Config, name: &str
451    /// ) -> Result<()> {
452    ///     client.delete_statefile()
453    ///         .set_name(name)
454    ///         .send().await?;
455    ///     Ok(())
456    /// }
457    /// ```
458    pub fn delete_statefile(&self) -> super::builder::config::DeleteStatefile {
459        super::builder::config::DeleteStatefile::new(self.inner.clone())
460    }
461
462    /// Locks a deployment.
463    ///
464    /// # Long running operations
465    ///
466    /// This method is used to start, and/or poll a [long-running Operation].
467    /// The [Working with long-running operations] chapter in the [user guide]
468    /// covers these operations in detail.
469    ///
470    /// [long-running operation]: https://google.aip.dev/151
471    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
472    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
473    ///
474    /// # Example
475    /// ```
476    /// # use google_cloud_config_v1::client::Config;
477    /// use google_cloud_lro::Poller;
478    /// use google_cloud_config_v1::Result;
479    /// async fn sample(
480    ///    client: &Config
481    /// ) -> Result<()> {
482    ///     let response = client.lock_deployment()
483    ///         /* set fields */
484    ///         .poller().until_done().await?;
485    ///     println!("response {:?}", response);
486    ///     Ok(())
487    /// }
488    /// ```
489    pub fn lock_deployment(&self) -> super::builder::config::LockDeployment {
490        super::builder::config::LockDeployment::new(self.inner.clone())
491    }
492
493    /// Unlocks a locked deployment.
494    ///
495    /// # Long running operations
496    ///
497    /// This method is used to start, and/or poll a [long-running Operation].
498    /// The [Working with long-running operations] chapter in the [user guide]
499    /// covers these operations in detail.
500    ///
501    /// [long-running operation]: https://google.aip.dev/151
502    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
503    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
504    ///
505    /// # Example
506    /// ```
507    /// # use google_cloud_config_v1::client::Config;
508    /// use google_cloud_lro::Poller;
509    /// use google_cloud_config_v1::Result;
510    /// async fn sample(
511    ///    client: &Config
512    /// ) -> Result<()> {
513    ///     let response = client.unlock_deployment()
514    ///         /* set fields */
515    ///         .poller().until_done().await?;
516    ///     println!("response {:?}", response);
517    ///     Ok(())
518    /// }
519    /// ```
520    pub fn unlock_deployment(&self) -> super::builder::config::UnlockDeployment {
521        super::builder::config::UnlockDeployment::new(self.inner.clone())
522    }
523
524    /// Exports the lock info on a locked deployment.
525    ///
526    /// # Example
527    /// ```
528    /// # use google_cloud_config_v1::client::Config;
529    /// use google_cloud_config_v1::Result;
530    /// async fn sample(
531    ///    client: &Config
532    /// ) -> Result<()> {
533    ///     let response = client.export_lock_info()
534    ///         /* set fields */
535    ///         .send().await?;
536    ///     println!("response {:?}", response);
537    ///     Ok(())
538    /// }
539    /// ```
540    pub fn export_lock_info(&self) -> super::builder::config::ExportLockInfo {
541        super::builder::config::ExportLockInfo::new(self.inner.clone())
542    }
543
544    /// Creates a [Preview][google.cloud.config.v1.Preview].
545    ///
546    /// [google.cloud.config.v1.Preview]: crate::model::Preview
547    ///
548    /// # Long running operations
549    ///
550    /// This method is used to start, and/or poll a [long-running Operation].
551    /// The [Working with long-running operations] chapter in the [user guide]
552    /// covers these operations in detail.
553    ///
554    /// [long-running operation]: https://google.aip.dev/151
555    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
556    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
557    ///
558    /// # Example
559    /// ```
560    /// # use google_cloud_config_v1::client::Config;
561    /// use google_cloud_lro::Poller;
562    /// use google_cloud_config_v1::model::Preview;
563    /// use google_cloud_config_v1::Result;
564    /// async fn sample(
565    ///    client: &Config, parent: &str
566    /// ) -> Result<()> {
567    ///     let response = client.create_preview()
568    ///         .set_parent(parent)
569    ///         .set_preview_id("preview_id_value")
570    ///         .set_preview(
571    ///             Preview::new()/* set fields */
572    ///         )
573    ///         .poller().until_done().await?;
574    ///     println!("response {:?}", response);
575    ///     Ok(())
576    /// }
577    /// ```
578    pub fn create_preview(&self) -> super::builder::config::CreatePreview {
579        super::builder::config::CreatePreview::new(self.inner.clone())
580    }
581
582    /// Gets details about a [Preview][google.cloud.config.v1.Preview].
583    ///
584    /// [google.cloud.config.v1.Preview]: crate::model::Preview
585    ///
586    /// # Example
587    /// ```
588    /// # use google_cloud_config_v1::client::Config;
589    /// use google_cloud_config_v1::Result;
590    /// async fn sample(
591    ///    client: &Config, name: &str
592    /// ) -> Result<()> {
593    ///     let response = client.get_preview()
594    ///         .set_name(name)
595    ///         .send().await?;
596    ///     println!("response {:?}", response);
597    ///     Ok(())
598    /// }
599    /// ```
600    pub fn get_preview(&self) -> super::builder::config::GetPreview {
601        super::builder::config::GetPreview::new(self.inner.clone())
602    }
603
604    /// Lists [Preview][google.cloud.config.v1.Preview]s in a given project and
605    /// location.
606    ///
607    /// [google.cloud.config.v1.Preview]: crate::model::Preview
608    ///
609    /// # Example
610    /// ```
611    /// # use google_cloud_config_v1::client::Config;
612    /// use google_cloud_gax::paginator::ItemPaginator as _;
613    /// use google_cloud_config_v1::Result;
614    /// async fn sample(
615    ///    client: &Config, parent: &str
616    /// ) -> Result<()> {
617    ///     let mut list = client.list_previews()
618    ///         .set_parent(parent)
619    ///         .by_item();
620    ///     while let Some(item) = list.next().await.transpose()? {
621    ///         println!("{:?}", item);
622    ///     }
623    ///     Ok(())
624    /// }
625    /// ```
626    pub fn list_previews(&self) -> super::builder::config::ListPreviews {
627        super::builder::config::ListPreviews::new(self.inner.clone())
628    }
629
630    /// Deletes a [Preview][google.cloud.config.v1.Preview].
631    ///
632    /// [google.cloud.config.v1.Preview]: crate::model::Preview
633    ///
634    /// # Long running operations
635    ///
636    /// This method is used to start, and/or poll a [long-running Operation].
637    /// The [Working with long-running operations] chapter in the [user guide]
638    /// covers these operations in detail.
639    ///
640    /// [long-running operation]: https://google.aip.dev/151
641    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
642    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
643    ///
644    /// # Example
645    /// ```
646    /// # use google_cloud_config_v1::client::Config;
647    /// use google_cloud_lro::Poller;
648    /// use google_cloud_config_v1::Result;
649    /// async fn sample(
650    ///    client: &Config, name: &str
651    /// ) -> Result<()> {
652    ///     let response = client.delete_preview()
653    ///         .set_name(name)
654    ///         .poller().until_done().await?;
655    ///     println!("response {:?}", response);
656    ///     Ok(())
657    /// }
658    /// ```
659    pub fn delete_preview(&self) -> super::builder::config::DeletePreview {
660        super::builder::config::DeletePreview::new(self.inner.clone())
661    }
662
663    /// Export [Preview][google.cloud.config.v1.Preview] results.
664    ///
665    /// [google.cloud.config.v1.Preview]: crate::model::Preview
666    ///
667    /// # Example
668    /// ```
669    /// # use google_cloud_config_v1::client::Config;
670    /// use google_cloud_config_v1::Result;
671    /// async fn sample(
672    ///    client: &Config
673    /// ) -> Result<()> {
674    ///     let response = client.export_preview_result()
675    ///         /* set fields */
676    ///         .send().await?;
677    ///     println!("response {:?}", response);
678    ///     Ok(())
679    /// }
680    /// ```
681    pub fn export_preview_result(&self) -> super::builder::config::ExportPreviewResult {
682        super::builder::config::ExportPreviewResult::new(self.inner.clone())
683    }
684
685    /// Lists [TerraformVersion][google.cloud.config.v1.TerraformVersion]s in a
686    /// given project and location.
687    ///
688    /// [google.cloud.config.v1.TerraformVersion]: crate::model::TerraformVersion
689    ///
690    /// # Example
691    /// ```
692    /// # use google_cloud_config_v1::client::Config;
693    /// use google_cloud_gax::paginator::ItemPaginator as _;
694    /// use google_cloud_config_v1::Result;
695    /// async fn sample(
696    ///    client: &Config, parent: &str
697    /// ) -> Result<()> {
698    ///     let mut list = client.list_terraform_versions()
699    ///         .set_parent(parent)
700    ///         .by_item();
701    ///     while let Some(item) = list.next().await.transpose()? {
702    ///         println!("{:?}", item);
703    ///     }
704    ///     Ok(())
705    /// }
706    /// ```
707    pub fn list_terraform_versions(&self) -> super::builder::config::ListTerraformVersions {
708        super::builder::config::ListTerraformVersions::new(self.inner.clone())
709    }
710
711    /// Gets details about a
712    /// [TerraformVersion][google.cloud.config.v1.TerraformVersion].
713    ///
714    /// [google.cloud.config.v1.TerraformVersion]: crate::model::TerraformVersion
715    ///
716    /// # Example
717    /// ```
718    /// # use google_cloud_config_v1::client::Config;
719    /// use google_cloud_config_v1::Result;
720    /// async fn sample(
721    ///    client: &Config, name: &str
722    /// ) -> Result<()> {
723    ///     let response = client.get_terraform_version()
724    ///         .set_name(name)
725    ///         .send().await?;
726    ///     println!("response {:?}", response);
727    ///     Ok(())
728    /// }
729    /// ```
730    pub fn get_terraform_version(&self) -> super::builder::config::GetTerraformVersion {
731        super::builder::config::GetTerraformVersion::new(self.inner.clone())
732    }
733
734    /// Lists ResourceChanges for a given preview.
735    ///
736    /// # Example
737    /// ```
738    /// # use google_cloud_config_v1::client::Config;
739    /// use google_cloud_gax::paginator::ItemPaginator as _;
740    /// use google_cloud_config_v1::Result;
741    /// async fn sample(
742    ///    client: &Config, parent: &str
743    /// ) -> Result<()> {
744    ///     let mut list = client.list_resource_changes()
745    ///         .set_parent(parent)
746    ///         .by_item();
747    ///     while let Some(item) = list.next().await.transpose()? {
748    ///         println!("{:?}", item);
749    ///     }
750    ///     Ok(())
751    /// }
752    /// ```
753    pub fn list_resource_changes(&self) -> super::builder::config::ListResourceChanges {
754        super::builder::config::ListResourceChanges::new(self.inner.clone())
755    }
756
757    /// Get a ResourceChange for a given preview.
758    ///
759    /// # Example
760    /// ```
761    /// # use google_cloud_config_v1::client::Config;
762    /// use google_cloud_config_v1::Result;
763    /// async fn sample(
764    ///    client: &Config, name: &str
765    /// ) -> Result<()> {
766    ///     let response = client.get_resource_change()
767    ///         .set_name(name)
768    ///         .send().await?;
769    ///     println!("response {:?}", response);
770    ///     Ok(())
771    /// }
772    /// ```
773    pub fn get_resource_change(&self) -> super::builder::config::GetResourceChange {
774        super::builder::config::GetResourceChange::new(self.inner.clone())
775    }
776
777    /// List ResourceDrifts for a given preview.
778    ///
779    /// # Example
780    /// ```
781    /// # use google_cloud_config_v1::client::Config;
782    /// use google_cloud_gax::paginator::ItemPaginator as _;
783    /// use google_cloud_config_v1::Result;
784    /// async fn sample(
785    ///    client: &Config, parent: &str
786    /// ) -> Result<()> {
787    ///     let mut list = client.list_resource_drifts()
788    ///         .set_parent(parent)
789    ///         .by_item();
790    ///     while let Some(item) = list.next().await.transpose()? {
791    ///         println!("{:?}", item);
792    ///     }
793    ///     Ok(())
794    /// }
795    /// ```
796    pub fn list_resource_drifts(&self) -> super::builder::config::ListResourceDrifts {
797        super::builder::config::ListResourceDrifts::new(self.inner.clone())
798    }
799
800    /// Get a ResourceDrift for a given preview.
801    ///
802    /// # Example
803    /// ```
804    /// # use google_cloud_config_v1::client::Config;
805    /// use google_cloud_config_v1::Result;
806    /// async fn sample(
807    ///    client: &Config, name: &str
808    /// ) -> Result<()> {
809    ///     let response = client.get_resource_drift()
810    ///         .set_name(name)
811    ///         .send().await?;
812    ///     println!("response {:?}", response);
813    ///     Ok(())
814    /// }
815    /// ```
816    pub fn get_resource_drift(&self) -> super::builder::config::GetResourceDrift {
817        super::builder::config::GetResourceDrift::new(self.inner.clone())
818    }
819
820    /// Get the AutoMigrationConfig for a given project and location.
821    ///
822    /// # Example
823    /// ```
824    /// # use google_cloud_config_v1::client::Config;
825    /// use google_cloud_config_v1::Result;
826    /// async fn sample(
827    ///    client: &Config, name: &str
828    /// ) -> Result<()> {
829    ///     let response = client.get_auto_migration_config()
830    ///         .set_name(name)
831    ///         .send().await?;
832    ///     println!("response {:?}", response);
833    ///     Ok(())
834    /// }
835    /// ```
836    pub fn get_auto_migration_config(&self) -> super::builder::config::GetAutoMigrationConfig {
837        super::builder::config::GetAutoMigrationConfig::new(self.inner.clone())
838    }
839
840    /// Updates the AutoMigrationConfig for a given project and location.
841    ///
842    /// # Long running operations
843    ///
844    /// This method is used to start, and/or poll a [long-running Operation].
845    /// The [Working with long-running operations] chapter in the [user guide]
846    /// covers these operations in detail.
847    ///
848    /// [long-running operation]: https://google.aip.dev/151
849    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
850    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
851    ///
852    /// # Example
853    /// ```
854    /// # use google_cloud_config_v1::client::Config;
855    /// use google_cloud_lro::Poller;
856    /// # extern crate wkt as google_cloud_wkt;
857    /// use google_cloud_wkt::FieldMask;
858    /// use google_cloud_config_v1::model::AutoMigrationConfig;
859    /// use google_cloud_config_v1::Result;
860    /// async fn sample(
861    ///    client: &Config, name: &str
862    /// ) -> Result<()> {
863    ///     let response = client.update_auto_migration_config()
864    ///         .set_auto_migration_config(
865    ///             AutoMigrationConfig::new().set_name(name)/* set fields */
866    ///         )
867    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
868    ///         .poller().until_done().await?;
869    ///     println!("response {:?}", response);
870    ///     Ok(())
871    /// }
872    /// ```
873    pub fn update_auto_migration_config(
874        &self,
875    ) -> super::builder::config::UpdateAutoMigrationConfig {
876        super::builder::config::UpdateAutoMigrationConfig::new(self.inner.clone())
877    }
878
879    /// Lists information about the supported locations for this service.
880    ///
881    /// # Example
882    /// ```
883    /// # use google_cloud_config_v1::client::Config;
884    /// use google_cloud_gax::paginator::ItemPaginator as _;
885    /// use google_cloud_config_v1::Result;
886    /// async fn sample(
887    ///    client: &Config
888    /// ) -> Result<()> {
889    ///     let mut list = client.list_locations()
890    ///         /* set fields */
891    ///         .by_item();
892    ///     while let Some(item) = list.next().await.transpose()? {
893    ///         println!("{:?}", item);
894    ///     }
895    ///     Ok(())
896    /// }
897    /// ```
898    pub fn list_locations(&self) -> super::builder::config::ListLocations {
899        super::builder::config::ListLocations::new(self.inner.clone())
900    }
901
902    /// Gets information about a location.
903    ///
904    /// # Example
905    /// ```
906    /// # use google_cloud_config_v1::client::Config;
907    /// use google_cloud_config_v1::Result;
908    /// async fn sample(
909    ///    client: &Config
910    /// ) -> Result<()> {
911    ///     let response = client.get_location()
912    ///         /* set fields */
913    ///         .send().await?;
914    ///     println!("response {:?}", response);
915    ///     Ok(())
916    /// }
917    /// ```
918    pub fn get_location(&self) -> super::builder::config::GetLocation {
919        super::builder::config::GetLocation::new(self.inner.clone())
920    }
921
922    /// Sets the access control policy on the specified resource. Replaces
923    /// any existing policy.
924    ///
925    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
926    /// errors.
927    ///
928    /// # Example
929    /// ```
930    /// # use google_cloud_config_v1::client::Config;
931    /// use google_cloud_config_v1::Result;
932    /// async fn sample(
933    ///    client: &Config
934    /// ) -> Result<()> {
935    ///     let response = client.set_iam_policy()
936    ///         /* set fields */
937    ///         .send().await?;
938    ///     println!("response {:?}", response);
939    ///     Ok(())
940    /// }
941    /// ```
942    pub fn set_iam_policy(&self) -> super::builder::config::SetIamPolicy {
943        super::builder::config::SetIamPolicy::new(self.inner.clone())
944    }
945
946    /// Gets the access control policy for a resource. Returns an empty policy
947    /// if the resource exists and does not have a policy set.
948    ///
949    /// # Example
950    /// ```
951    /// # use google_cloud_config_v1::client::Config;
952    /// use google_cloud_config_v1::Result;
953    /// async fn sample(
954    ///    client: &Config
955    /// ) -> Result<()> {
956    ///     let response = client.get_iam_policy()
957    ///         /* set fields */
958    ///         .send().await?;
959    ///     println!("response {:?}", response);
960    ///     Ok(())
961    /// }
962    /// ```
963    pub fn get_iam_policy(&self) -> super::builder::config::GetIamPolicy {
964        super::builder::config::GetIamPolicy::new(self.inner.clone())
965    }
966
967    /// Returns permissions that a caller has on the specified resource. If the
968    /// resource does not exist, this will return an empty set of
969    /// permissions, not a `NOT_FOUND` error.
970    ///
971    /// Note: This operation is designed to be used for building
972    /// permission-aware UIs and command-line tools, not for authorization
973    /// checking. This operation may "fail open" without warning.
974    ///
975    /// # Example
976    /// ```
977    /// # use google_cloud_config_v1::client::Config;
978    /// use google_cloud_config_v1::Result;
979    /// async fn sample(
980    ///    client: &Config
981    /// ) -> Result<()> {
982    ///     let response = client.test_iam_permissions()
983    ///         /* set fields */
984    ///         .send().await?;
985    ///     println!("response {:?}", response);
986    ///     Ok(())
987    /// }
988    /// ```
989    pub fn test_iam_permissions(&self) -> super::builder::config::TestIamPermissions {
990        super::builder::config::TestIamPermissions::new(self.inner.clone())
991    }
992
993    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
994    ///
995    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
996    ///
997    /// # Example
998    /// ```
999    /// # use google_cloud_config_v1::client::Config;
1000    /// use google_cloud_gax::paginator::ItemPaginator as _;
1001    /// use google_cloud_config_v1::Result;
1002    /// async fn sample(
1003    ///    client: &Config
1004    /// ) -> Result<()> {
1005    ///     let mut list = client.list_operations()
1006    ///         /* set fields */
1007    ///         .by_item();
1008    ///     while let Some(item) = list.next().await.transpose()? {
1009    ///         println!("{:?}", item);
1010    ///     }
1011    ///     Ok(())
1012    /// }
1013    /// ```
1014    pub fn list_operations(&self) -> super::builder::config::ListOperations {
1015        super::builder::config::ListOperations::new(self.inner.clone())
1016    }
1017
1018    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1019    ///
1020    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1021    ///
1022    /// # Example
1023    /// ```
1024    /// # use google_cloud_config_v1::client::Config;
1025    /// use google_cloud_config_v1::Result;
1026    /// async fn sample(
1027    ///    client: &Config
1028    /// ) -> Result<()> {
1029    ///     let response = client.get_operation()
1030    ///         /* set fields */
1031    ///         .send().await?;
1032    ///     println!("response {:?}", response);
1033    ///     Ok(())
1034    /// }
1035    /// ```
1036    pub fn get_operation(&self) -> super::builder::config::GetOperation {
1037        super::builder::config::GetOperation::new(self.inner.clone())
1038    }
1039
1040    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1041    ///
1042    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1043    ///
1044    /// # Example
1045    /// ```
1046    /// # use google_cloud_config_v1::client::Config;
1047    /// use google_cloud_config_v1::Result;
1048    /// async fn sample(
1049    ///    client: &Config
1050    /// ) -> Result<()> {
1051    ///     client.delete_operation()
1052    ///         /* set fields */
1053    ///         .send().await?;
1054    ///     Ok(())
1055    /// }
1056    /// ```
1057    pub fn delete_operation(&self) -> super::builder::config::DeleteOperation {
1058        super::builder::config::DeleteOperation::new(self.inner.clone())
1059    }
1060
1061    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1062    ///
1063    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1064    ///
1065    /// # Example
1066    /// ```
1067    /// # use google_cloud_config_v1::client::Config;
1068    /// use google_cloud_config_v1::Result;
1069    /// async fn sample(
1070    ///    client: &Config
1071    /// ) -> Result<()> {
1072    ///     client.cancel_operation()
1073    ///         /* set fields */
1074    ///         .send().await?;
1075    ///     Ok(())
1076    /// }
1077    /// ```
1078    pub fn cancel_operation(&self) -> super::builder::config::CancelOperation {
1079        super::builder::config::CancelOperation::new(self.inner.clone())
1080    }
1081}