Skip to main content

google_cloud_resourcemanager_v3/
client.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Cloud Resource Manager API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_resourcemanager_v3::client::Folders;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28///    parent: &str,
29/// ) -> anyhow::Result<()> {
30///     let client = Folders::builder().build().await?;
31///     let mut list = client.list_folders()
32///         .set_parent(parent)
33///         .by_item();
34///     while let Some(item) = list.next().await.transpose()? {
35///         println!("{:?}", item);
36///     }
37///     Ok(())
38/// }
39/// ```
40///
41/// # Service Description
42///
43/// Manages Cloud Platform folder resources.
44/// Folders can be used to organize the resources under an
45/// organization and to control the policies applied to groups of resources.
46///
47/// # Configuration
48///
49/// To configure `Folders` use the `with_*` methods in the type returned
50/// by [builder()][Folders::builder]. The default configuration should
51/// work for most applications. Common configuration changes include
52///
53/// * [with_endpoint()]: by default this client uses the global default endpoint
54///   (`https://cloudresourcemanager.googleapis.com`). Applications using regional
55///   endpoints or running in restricted networks (e.g. a network configured
56///   with [Private Google Access with VPC Service Controls]) may want to
57///   override this default.
58/// * [with_credentials()]: by default this client uses
59///   [Application Default Credentials]. Applications using custom
60///   authentication may need to override this default.
61///
62/// [with_endpoint()]: super::builder::folders::ClientBuilder::with_endpoint
63/// [with_credentials()]: super::builder::folders::ClientBuilder::with_credentials
64/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
65/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
66///
67/// # Pooling and Cloning
68///
69/// `Folders` holds a connection pool internally, it is advised to
70/// create one and reuse it. You do not need to wrap `Folders` in
71/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
72/// already uses an `Arc` internally.
73#[derive(Clone, Debug)]
74pub struct Folders {
75    inner: std::sync::Arc<dyn super::stub::dynamic::Folders>,
76}
77
78impl Folders {
79    /// Returns a builder for [Folders].
80    ///
81    /// ```
82    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
83    /// # use google_cloud_resourcemanager_v3::client::Folders;
84    /// let client = Folders::builder().build().await?;
85    /// # Ok(()) }
86    /// ```
87    pub fn builder() -> super::builder::folders::ClientBuilder {
88        crate::new_client_builder(super::builder::folders::client::Factory)
89    }
90
91    /// Creates a new client from the provided stub.
92    ///
93    /// The most common case for calling this function is in tests mocking the
94    /// client's behavior.
95    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
96    where
97        T: super::stub::Folders + 'static,
98    {
99        Self { inner: stub.into() }
100    }
101
102    pub(crate) async fn new(
103        config: gaxi::options::ClientConfig,
104    ) -> crate::ClientBuilderResult<Self> {
105        let inner = Self::build_inner(config).await?;
106        Ok(Self { inner })
107    }
108
109    async fn build_inner(
110        conf: gaxi::options::ClientConfig,
111    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Folders>> {
112        if gaxi::options::tracing_enabled(&conf) {
113            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
114        }
115        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
116    }
117
118    async fn build_transport(
119        conf: gaxi::options::ClientConfig,
120    ) -> crate::ClientBuilderResult<impl super::stub::Folders> {
121        super::transport::Folders::new(conf).await
122    }
123
124    async fn build_with_tracing(
125        conf: gaxi::options::ClientConfig,
126    ) -> crate::ClientBuilderResult<impl super::stub::Folders> {
127        Self::build_transport(conf)
128            .await
129            .map(super::tracing::Folders::new)
130    }
131
132    /// Retrieves a folder identified by the supplied resource name.
133    /// Valid folder resource names have the format `folders/{folder_id}`
134    /// (for example, `folders/1234`).
135    /// The caller must have `resourcemanager.folders.get` permission on the
136    /// identified folder.
137    ///
138    /// # Example
139    /// ```
140    /// # use google_cloud_resourcemanager_v3::client::Folders;
141    /// use google_cloud_resourcemanager_v3::Result;
142    /// async fn sample(
143    ///    client: &Folders, folder_id: &str
144    /// ) -> Result<()> {
145    ///     let response = client.get_folder()
146    ///         .set_name(format!("folders/{folder_id}"))
147    ///         .send().await?;
148    ///     println!("response {:?}", response);
149    ///     Ok(())
150    /// }
151    /// ```
152    pub fn get_folder(&self) -> super::builder::folders::GetFolder {
153        super::builder::folders::GetFolder::new(self.inner.clone())
154    }
155
156    /// Lists the folders that are direct descendants of supplied parent resource.
157    /// `list()` provides a strongly consistent view of the folders underneath
158    /// the specified parent resource.
159    /// `list()` returns folders sorted based upon the (ascending) lexical ordering
160    /// of their display_name.
161    /// The caller must have `resourcemanager.folders.list` permission on the
162    /// identified parent.
163    ///
164    /// # Example
165    /// ```
166    /// # use google_cloud_resourcemanager_v3::client::Folders;
167    /// use google_cloud_gax::paginator::ItemPaginator as _;
168    /// use google_cloud_resourcemanager_v3::Result;
169    /// async fn sample(
170    ///    client: &Folders, parent: &str
171    /// ) -> Result<()> {
172    ///     let mut list = client.list_folders()
173    ///         .set_parent(parent)
174    ///         .by_item();
175    ///     while let Some(item) = list.next().await.transpose()? {
176    ///         println!("{:?}", item);
177    ///     }
178    ///     Ok(())
179    /// }
180    /// ```
181    pub fn list_folders(&self) -> super::builder::folders::ListFolders {
182        super::builder::folders::ListFolders::new(self.inner.clone())
183    }
184
185    /// Search for folders that match specific filter criteria.
186    /// `search()` provides an eventually consistent view of the folders a user has
187    /// access to which meet the specified filter criteria.
188    ///
189    /// This will only return folders on which the caller has the
190    /// permission `resourcemanager.folders.get`.
191    ///
192    /// # Example
193    /// ```
194    /// # use google_cloud_resourcemanager_v3::client::Folders;
195    /// use google_cloud_gax::paginator::ItemPaginator as _;
196    /// use google_cloud_resourcemanager_v3::Result;
197    /// async fn sample(
198    ///    client: &Folders
199    /// ) -> Result<()> {
200    ///     let mut list = client.search_folders()
201    ///         /* set fields */
202    ///         .by_item();
203    ///     while let Some(item) = list.next().await.transpose()? {
204    ///         println!("{:?}", item);
205    ///     }
206    ///     Ok(())
207    /// }
208    /// ```
209    pub fn search_folders(&self) -> super::builder::folders::SearchFolders {
210        super::builder::folders::SearchFolders::new(self.inner.clone())
211    }
212
213    /// Creates a folder in the resource hierarchy.
214    /// Returns an `Operation` which can be used to track the progress of the
215    /// folder creation workflow.
216    /// Upon success, the `Operation.response` field will be populated with the
217    /// created Folder.
218    ///
219    /// In order to succeed, the addition of this new folder must not violate
220    /// the folder naming, height, or fanout constraints.
221    ///
222    /// + The folder's `display_name` must be distinct from all other folders that
223    ///   share its parent.
224    /// + The addition of the folder must not cause the active folder hierarchy
225    ///   to exceed a height of 10. Note, the full active + deleted folder hierarchy
226    ///   is allowed to reach a height of 20; this provides additional headroom when
227    ///   moving folders that contain deleted folders.
228    /// + The addition of the folder must not cause the total number of folders
229    ///   under its parent to exceed 300.
230    ///
231    /// If the operation fails due to a folder constraint violation, some errors
232    /// may be returned by the `CreateFolder` request, with status code
233    /// `FAILED_PRECONDITION` and an error description. Other folder constraint
234    /// violations will be communicated in the `Operation`, with the specific
235    /// `PreconditionFailure` returned in the details list in the `Operation.error`
236    /// field.
237    ///
238    /// The caller must have `resourcemanager.folders.create` permission on the
239    /// identified parent.
240    ///
241    /// # Long running operations
242    ///
243    /// This method is used to start, and/or poll a [long-running Operation].
244    /// The [Working with long-running operations] chapter in the [user guide]
245    /// covers these operations in detail.
246    ///
247    /// [long-running operation]: https://google.aip.dev/151
248    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
249    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
250    ///
251    /// # Example
252    /// ```
253    /// # use google_cloud_resourcemanager_v3::client::Folders;
254    /// use google_cloud_lro::Poller;
255    /// use google_cloud_resourcemanager_v3::Result;
256    /// async fn sample(
257    ///    client: &Folders
258    /// ) -> Result<()> {
259    ///     let response = client.create_folder()
260    ///         /* set fields */
261    ///         .poller().until_done().await?;
262    ///     println!("response {:?}", response);
263    ///     Ok(())
264    /// }
265    /// ```
266    pub fn create_folder(&self) -> super::builder::folders::CreateFolder {
267        super::builder::folders::CreateFolder::new(self.inner.clone())
268    }
269
270    /// Updates a folder, changing its `display_name`.
271    /// Changes to the folder `display_name` will be rejected if they violate
272    /// either the `display_name` formatting rules or the naming constraints
273    /// described in the
274    /// [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder]
275    /// documentation.
276    ///
277    /// The folder's `display_name` must start and end with a letter or digit,
278    /// may contain letters, digits, spaces, hyphens and underscores and can be
279    /// between 3 and 30 characters. This is captured by the regular expression:
280    /// `[\p{L}\p{N}][\p{L}\p{N}_- ]{1,28}[\p{L}\p{N}]`.
281    /// The caller must have `resourcemanager.folders.update` permission on the
282    /// identified folder.
283    ///
284    /// If the update fails due to the unique name constraint then a
285    /// `PreconditionFailure` explaining this violation will be returned
286    /// in the Status.details field.
287    ///
288    /// [google.cloud.resourcemanager.v3.Folders.CreateFolder]: crate::client::Folders::create_folder
289    ///
290    /// # Long running operations
291    ///
292    /// This method is used to start, and/or poll a [long-running Operation].
293    /// The [Working with long-running operations] chapter in the [user guide]
294    /// covers these operations in detail.
295    ///
296    /// [long-running operation]: https://google.aip.dev/151
297    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
298    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
299    ///
300    /// # Example
301    /// ```
302    /// # use google_cloud_resourcemanager_v3::client::Folders;
303    /// use google_cloud_lro::Poller;
304    /// # extern crate wkt as google_cloud_wkt;
305    /// use google_cloud_wkt::FieldMask;
306    /// use google_cloud_resourcemanager_v3::model::Folder;
307    /// use google_cloud_resourcemanager_v3::Result;
308    /// async fn sample(
309    ///    client: &Folders, folder_id: &str
310    /// ) -> Result<()> {
311    ///     let response = client.update_folder()
312    ///         .set_folder(
313    ///             Folder::new().set_name(format!("folders/{folder_id}"))/* set fields */
314    ///         )
315    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
316    ///         .poller().until_done().await?;
317    ///     println!("response {:?}", response);
318    ///     Ok(())
319    /// }
320    /// ```
321    pub fn update_folder(&self) -> super::builder::folders::UpdateFolder {
322        super::builder::folders::UpdateFolder::new(self.inner.clone())
323    }
324
325    /// Moves a folder under a new resource parent.
326    /// Returns an `Operation` which can be used to track the progress of the
327    /// folder move workflow.
328    /// Upon success, the `Operation.response` field will be populated with the
329    /// moved folder.
330    /// Upon failure, a `FolderOperationError` categorizing the failure cause will
331    /// be returned - if the failure occurs synchronously then the
332    /// `FolderOperationError` will be returned in the `Status.details` field.
333    /// If it occurs asynchronously, then the FolderOperation will be returned
334    /// in the `Operation.error` field.
335    /// In addition, the `Operation.metadata` field will be populated with a
336    /// `FolderOperation` message as an aid to stateless clients.
337    /// Folder moves will be rejected if they violate either the naming, height,
338    /// or fanout constraints described in the
339    /// [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder]
340    /// documentation. The caller must have `resourcemanager.folders.move`
341    /// permission on the folder's current and proposed new parent.
342    ///
343    /// [google.cloud.resourcemanager.v3.Folders.CreateFolder]: crate::client::Folders::create_folder
344    ///
345    /// # Long running operations
346    ///
347    /// This method is used to start, and/or poll a [long-running Operation].
348    /// The [Working with long-running operations] chapter in the [user guide]
349    /// covers these operations in detail.
350    ///
351    /// [long-running operation]: https://google.aip.dev/151
352    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
353    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
354    ///
355    /// # Example
356    /// ```
357    /// # use google_cloud_resourcemanager_v3::client::Folders;
358    /// use google_cloud_lro::Poller;
359    /// use google_cloud_resourcemanager_v3::Result;
360    /// async fn sample(
361    ///    client: &Folders
362    /// ) -> Result<()> {
363    ///     let response = client.move_folder()
364    ///         /* set fields */
365    ///         .poller().until_done().await?;
366    ///     println!("response {:?}", response);
367    ///     Ok(())
368    /// }
369    /// ```
370    pub fn move_folder(&self) -> super::builder::folders::MoveFolder {
371        super::builder::folders::MoveFolder::new(self.inner.clone())
372    }
373
374    /// Requests deletion of a folder. The folder is moved into the
375    /// [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
376    /// state immediately, and is deleted approximately 30 days later. This method
377    /// may only be called on an empty folder, where a folder is empty if it
378    /// doesn't contain any folders or projects in the
379    /// [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If
380    /// called on a folder in
381    /// [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
382    /// state the operation will result in a no-op success.
383    /// The caller must have `resourcemanager.folders.delete` permission on the
384    /// identified folder.
385    ///
386    /// [google.cloud.resourcemanager.v3.Folder.State.ACTIVE]: crate::model::folder::State::Active
387    /// [google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]: crate::model::folder::State::DeleteRequested
388    ///
389    /// # Long running operations
390    ///
391    /// This method is used to start, and/or poll a [long-running Operation].
392    /// The [Working with long-running operations] chapter in the [user guide]
393    /// covers these operations in detail.
394    ///
395    /// [long-running operation]: https://google.aip.dev/151
396    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
397    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
398    ///
399    /// # Example
400    /// ```
401    /// # use google_cloud_resourcemanager_v3::client::Folders;
402    /// use google_cloud_lro::Poller;
403    /// use google_cloud_resourcemanager_v3::Result;
404    /// async fn sample(
405    ///    client: &Folders, folder_id: &str
406    /// ) -> Result<()> {
407    ///     let response = client.delete_folder()
408    ///         .set_name(format!("folders/{folder_id}"))
409    ///         .poller().until_done().await?;
410    ///     println!("response {:?}", response);
411    ///     Ok(())
412    /// }
413    /// ```
414    pub fn delete_folder(&self) -> super::builder::folders::DeleteFolder {
415        super::builder::folders::DeleteFolder::new(self.inner.clone())
416    }
417
418    /// Cancels the deletion request for a folder. This method may be called on a
419    /// folder in any state. If the folder is in the
420    /// [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state the
421    /// result will be a no-op success. In order to succeed, the folder's parent
422    /// must be in the
423    /// [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. In
424    /// addition, reintroducing the folder into the tree must not violate folder
425    /// naming, height, and fanout constraints described in the
426    /// [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder]
427    /// documentation. The caller must have `resourcemanager.folders.undelete`
428    /// permission on the identified folder.
429    ///
430    /// [google.cloud.resourcemanager.v3.Folder.State.ACTIVE]: crate::model::folder::State::Active
431    /// [google.cloud.resourcemanager.v3.Folders.CreateFolder]: crate::client::Folders::create_folder
432    ///
433    /// # Long running operations
434    ///
435    /// This method is used to start, and/or poll a [long-running Operation].
436    /// The [Working with long-running operations] chapter in the [user guide]
437    /// covers these operations in detail.
438    ///
439    /// [long-running operation]: https://google.aip.dev/151
440    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
441    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
442    ///
443    /// # Example
444    /// ```
445    /// # use google_cloud_resourcemanager_v3::client::Folders;
446    /// use google_cloud_lro::Poller;
447    /// use google_cloud_resourcemanager_v3::Result;
448    /// async fn sample(
449    ///    client: &Folders, folder_id: &str
450    /// ) -> Result<()> {
451    ///     let response = client.undelete_folder()
452    ///         .set_name(format!("folders/{folder_id}"))
453    ///         .poller().until_done().await?;
454    ///     println!("response {:?}", response);
455    ///     Ok(())
456    /// }
457    /// ```
458    pub fn undelete_folder(&self) -> super::builder::folders::UndeleteFolder {
459        super::builder::folders::UndeleteFolder::new(self.inner.clone())
460    }
461
462    /// Gets the access control policy for a folder. The returned policy may be
463    /// empty if no such policy or resource exists. The `resource` field should
464    /// be the folder's resource name, for example: "folders/1234".
465    /// The caller must have `resourcemanager.folders.getIamPolicy` permission
466    /// on the identified folder.
467    ///
468    /// # Example
469    /// ```
470    /// # use google_cloud_resourcemanager_v3::client::Folders;
471    /// use google_cloud_resourcemanager_v3::Result;
472    /// async fn sample(
473    ///    client: &Folders
474    /// ) -> Result<()> {
475    ///     let response = client.get_iam_policy()
476    ///         /* set fields */
477    ///         .send().await?;
478    ///     println!("response {:?}", response);
479    ///     Ok(())
480    /// }
481    /// ```
482    pub fn get_iam_policy(&self) -> super::builder::folders::GetIamPolicy {
483        super::builder::folders::GetIamPolicy::new(self.inner.clone())
484    }
485
486    /// Sets the access control policy on a folder, replacing any existing policy.
487    /// The `resource` field should be the folder's resource name, for example:
488    /// "folders/1234".
489    /// The caller must have `resourcemanager.folders.setIamPolicy` permission
490    /// on the identified folder.
491    ///
492    /// # Example
493    /// ```
494    /// # use google_cloud_resourcemanager_v3::client::Folders;
495    /// use google_cloud_resourcemanager_v3::Result;
496    /// async fn sample(
497    ///    client: &Folders
498    /// ) -> Result<()> {
499    ///     let response = client.set_iam_policy()
500    ///         /* set fields */
501    ///         .send().await?;
502    ///     println!("response {:?}", response);
503    ///     Ok(())
504    /// }
505    /// ```
506    pub fn set_iam_policy(&self) -> super::builder::folders::SetIamPolicy {
507        super::builder::folders::SetIamPolicy::new(self.inner.clone())
508    }
509
510    /// Returns permissions that a caller has on the specified folder.
511    /// The `resource` field should be the folder's resource name,
512    /// for example: "folders/1234".
513    ///
514    /// There are no permissions required for making this API call.
515    ///
516    /// # Example
517    /// ```
518    /// # use google_cloud_resourcemanager_v3::client::Folders;
519    /// use google_cloud_resourcemanager_v3::Result;
520    /// async fn sample(
521    ///    client: &Folders
522    /// ) -> Result<()> {
523    ///     let response = client.test_iam_permissions()
524    ///         /* set fields */
525    ///         .send().await?;
526    ///     println!("response {:?}", response);
527    ///     Ok(())
528    /// }
529    /// ```
530    pub fn test_iam_permissions(&self) -> super::builder::folders::TestIamPermissions {
531        super::builder::folders::TestIamPermissions::new(self.inner.clone())
532    }
533
534    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
535    ///
536    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
537    ///
538    /// # Example
539    /// ```
540    /// # use google_cloud_resourcemanager_v3::client::Folders;
541    /// use google_cloud_resourcemanager_v3::Result;
542    /// async fn sample(
543    ///    client: &Folders
544    /// ) -> Result<()> {
545    ///     let response = client.get_operation()
546    ///         /* set fields */
547    ///         .send().await?;
548    ///     println!("response {:?}", response);
549    ///     Ok(())
550    /// }
551    /// ```
552    pub fn get_operation(&self) -> super::builder::folders::GetOperation {
553        super::builder::folders::GetOperation::new(self.inner.clone())
554    }
555}
556
557/// Implements a client for the Cloud Resource Manager API.
558///
559/// # Example
560/// ```
561/// # use google_cloud_resourcemanager_v3::client::Organizations;
562/// async fn sample(
563///    organization_id: &str,
564/// ) -> anyhow::Result<()> {
565///     let client = Organizations::builder().build().await?;
566///     let response = client.get_organization()
567///         .set_name(format!("organizations/{organization_id}"))
568///         .send().await?;
569///     println!("response {:?}", response);
570///     Ok(())
571/// }
572/// ```
573///
574/// # Service Description
575///
576/// Allows users to manage their organization resources.
577///
578/// # Configuration
579///
580/// To configure `Organizations` use the `with_*` methods in the type returned
581/// by [builder()][Organizations::builder]. The default configuration should
582/// work for most applications. Common configuration changes include
583///
584/// * [with_endpoint()]: by default this client uses the global default endpoint
585///   (`https://cloudresourcemanager.googleapis.com`). Applications using regional
586///   endpoints or running in restricted networks (e.g. a network configured
587///   with [Private Google Access with VPC Service Controls]) may want to
588///   override this default.
589/// * [with_credentials()]: by default this client uses
590///   [Application Default Credentials]. Applications using custom
591///   authentication may need to override this default.
592///
593/// [with_endpoint()]: super::builder::organizations::ClientBuilder::with_endpoint
594/// [with_credentials()]: super::builder::organizations::ClientBuilder::with_credentials
595/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
596/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
597///
598/// # Pooling and Cloning
599///
600/// `Organizations` holds a connection pool internally, it is advised to
601/// create one and reuse it. You do not need to wrap `Organizations` in
602/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
603/// already uses an `Arc` internally.
604#[derive(Clone, Debug)]
605pub struct Organizations {
606    inner: std::sync::Arc<dyn super::stub::dynamic::Organizations>,
607}
608
609impl Organizations {
610    /// Returns a builder for [Organizations].
611    ///
612    /// ```
613    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
614    /// # use google_cloud_resourcemanager_v3::client::Organizations;
615    /// let client = Organizations::builder().build().await?;
616    /// # Ok(()) }
617    /// ```
618    pub fn builder() -> super::builder::organizations::ClientBuilder {
619        crate::new_client_builder(super::builder::organizations::client::Factory)
620    }
621
622    /// Creates a new client from the provided stub.
623    ///
624    /// The most common case for calling this function is in tests mocking the
625    /// client's behavior.
626    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
627    where
628        T: super::stub::Organizations + 'static,
629    {
630        Self { inner: stub.into() }
631    }
632
633    pub(crate) async fn new(
634        config: gaxi::options::ClientConfig,
635    ) -> crate::ClientBuilderResult<Self> {
636        let inner = Self::build_inner(config).await?;
637        Ok(Self { inner })
638    }
639
640    async fn build_inner(
641        conf: gaxi::options::ClientConfig,
642    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Organizations>> {
643        if gaxi::options::tracing_enabled(&conf) {
644            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
645        }
646        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
647    }
648
649    async fn build_transport(
650        conf: gaxi::options::ClientConfig,
651    ) -> crate::ClientBuilderResult<impl super::stub::Organizations> {
652        super::transport::Organizations::new(conf).await
653    }
654
655    async fn build_with_tracing(
656        conf: gaxi::options::ClientConfig,
657    ) -> crate::ClientBuilderResult<impl super::stub::Organizations> {
658        Self::build_transport(conf)
659            .await
660            .map(super::tracing::Organizations::new)
661    }
662
663    /// Fetches an organization resource identified by the specified resource name.
664    ///
665    /// # Example
666    /// ```
667    /// # use google_cloud_resourcemanager_v3::client::Organizations;
668    /// use google_cloud_resourcemanager_v3::Result;
669    /// async fn sample(
670    ///    client: &Organizations, organization_id: &str
671    /// ) -> Result<()> {
672    ///     let response = client.get_organization()
673    ///         .set_name(format!("organizations/{organization_id}"))
674    ///         .send().await?;
675    ///     println!("response {:?}", response);
676    ///     Ok(())
677    /// }
678    /// ```
679    pub fn get_organization(&self) -> super::builder::organizations::GetOrganization {
680        super::builder::organizations::GetOrganization::new(self.inner.clone())
681    }
682
683    /// Searches organization resources that are visible to the user and satisfy
684    /// the specified filter. This method returns organizations in an unspecified
685    /// order. New organizations do not necessarily appear at the end of the
686    /// results, and may take a small amount of time to appear.
687    ///
688    /// Search will only return organizations on which the user has the permission
689    /// `resourcemanager.organizations.get`
690    ///
691    /// # Example
692    /// ```
693    /// # use google_cloud_resourcemanager_v3::client::Organizations;
694    /// use google_cloud_gax::paginator::ItemPaginator as _;
695    /// use google_cloud_resourcemanager_v3::Result;
696    /// async fn sample(
697    ///    client: &Organizations
698    /// ) -> Result<()> {
699    ///     let mut list = client.search_organizations()
700    ///         /* set fields */
701    ///         .by_item();
702    ///     while let Some(item) = list.next().await.transpose()? {
703    ///         println!("{:?}", item);
704    ///     }
705    ///     Ok(())
706    /// }
707    /// ```
708    pub fn search_organizations(&self) -> super::builder::organizations::SearchOrganizations {
709        super::builder::organizations::SearchOrganizations::new(self.inner.clone())
710    }
711
712    /// Gets the access control policy for an organization resource. The policy may
713    /// be empty if no such policy or resource exists. The `resource` field should
714    /// be the organization's resource name, for example: "organizations/123".
715    ///
716    /// Authorization requires the IAM permission
717    /// `resourcemanager.organizations.getIamPolicy` on the specified organization.
718    ///
719    /// # Example
720    /// ```
721    /// # use google_cloud_resourcemanager_v3::client::Organizations;
722    /// use google_cloud_resourcemanager_v3::Result;
723    /// async fn sample(
724    ///    client: &Organizations
725    /// ) -> Result<()> {
726    ///     let response = client.get_iam_policy()
727    ///         /* set fields */
728    ///         .send().await?;
729    ///     println!("response {:?}", response);
730    ///     Ok(())
731    /// }
732    /// ```
733    pub fn get_iam_policy(&self) -> super::builder::organizations::GetIamPolicy {
734        super::builder::organizations::GetIamPolicy::new(self.inner.clone())
735    }
736
737    /// Sets the access control policy on an organization resource. Replaces any
738    /// existing policy. The `resource` field should be the organization's resource
739    /// name, for example: "organizations/123".
740    ///
741    /// Authorization requires the IAM permission
742    /// `resourcemanager.organizations.setIamPolicy` on the specified organization.
743    ///
744    /// # Example
745    /// ```
746    /// # use google_cloud_resourcemanager_v3::client::Organizations;
747    /// use google_cloud_resourcemanager_v3::Result;
748    /// async fn sample(
749    ///    client: &Organizations
750    /// ) -> Result<()> {
751    ///     let response = client.set_iam_policy()
752    ///         /* set fields */
753    ///         .send().await?;
754    ///     println!("response {:?}", response);
755    ///     Ok(())
756    /// }
757    /// ```
758    pub fn set_iam_policy(&self) -> super::builder::organizations::SetIamPolicy {
759        super::builder::organizations::SetIamPolicy::new(self.inner.clone())
760    }
761
762    /// Returns the permissions that a caller has on the specified organization.
763    /// The `resource` field should be the organization's resource name,
764    /// for example: "organizations/123".
765    ///
766    /// There are no permissions required for making this API call.
767    ///
768    /// # Example
769    /// ```
770    /// # use google_cloud_resourcemanager_v3::client::Organizations;
771    /// use google_cloud_resourcemanager_v3::Result;
772    /// async fn sample(
773    ///    client: &Organizations
774    /// ) -> Result<()> {
775    ///     let response = client.test_iam_permissions()
776    ///         /* set fields */
777    ///         .send().await?;
778    ///     println!("response {:?}", response);
779    ///     Ok(())
780    /// }
781    /// ```
782    pub fn test_iam_permissions(&self) -> super::builder::organizations::TestIamPermissions {
783        super::builder::organizations::TestIamPermissions::new(self.inner.clone())
784    }
785
786    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
787    ///
788    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
789    ///
790    /// # Example
791    /// ```
792    /// # use google_cloud_resourcemanager_v3::client::Organizations;
793    /// use google_cloud_resourcemanager_v3::Result;
794    /// async fn sample(
795    ///    client: &Organizations
796    /// ) -> Result<()> {
797    ///     let response = client.get_operation()
798    ///         /* set fields */
799    ///         .send().await?;
800    ///     println!("response {:?}", response);
801    ///     Ok(())
802    /// }
803    /// ```
804    pub fn get_operation(&self) -> super::builder::organizations::GetOperation {
805        super::builder::organizations::GetOperation::new(self.inner.clone())
806    }
807}
808
809/// Implements a client for the Cloud Resource Manager API.
810///
811/// # Example
812/// ```
813/// # use google_cloud_resourcemanager_v3::client::Projects;
814/// use google_cloud_gax::paginator::ItemPaginator as _;
815/// async fn sample(
816///    parent: &str,
817/// ) -> anyhow::Result<()> {
818///     let client = Projects::builder().build().await?;
819///     let mut list = client.list_projects()
820///         .set_parent(parent)
821///         .by_item();
822///     while let Some(item) = list.next().await.transpose()? {
823///         println!("{:?}", item);
824///     }
825///     Ok(())
826/// }
827/// ```
828///
829/// # Service Description
830///
831/// Manages Google Cloud Projects.
832///
833/// # Configuration
834///
835/// To configure `Projects` use the `with_*` methods in the type returned
836/// by [builder()][Projects::builder]. The default configuration should
837/// work for most applications. Common configuration changes include
838///
839/// * [with_endpoint()]: by default this client uses the global default endpoint
840///   (`https://cloudresourcemanager.googleapis.com`). Applications using regional
841///   endpoints or running in restricted networks (e.g. a network configured
842///   with [Private Google Access with VPC Service Controls]) may want to
843///   override this default.
844/// * [with_credentials()]: by default this client uses
845///   [Application Default Credentials]. Applications using custom
846///   authentication may need to override this default.
847///
848/// [with_endpoint()]: super::builder::projects::ClientBuilder::with_endpoint
849/// [with_credentials()]: super::builder::projects::ClientBuilder::with_credentials
850/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
851/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
852///
853/// # Pooling and Cloning
854///
855/// `Projects` holds a connection pool internally, it is advised to
856/// create one and reuse it. You do not need to wrap `Projects` in
857/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
858/// already uses an `Arc` internally.
859#[derive(Clone, Debug)]
860pub struct Projects {
861    inner: std::sync::Arc<dyn super::stub::dynamic::Projects>,
862}
863
864impl Projects {
865    /// Returns a builder for [Projects].
866    ///
867    /// ```
868    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
869    /// # use google_cloud_resourcemanager_v3::client::Projects;
870    /// let client = Projects::builder().build().await?;
871    /// # Ok(()) }
872    /// ```
873    pub fn builder() -> super::builder::projects::ClientBuilder {
874        crate::new_client_builder(super::builder::projects::client::Factory)
875    }
876
877    /// Creates a new client from the provided stub.
878    ///
879    /// The most common case for calling this function is in tests mocking the
880    /// client's behavior.
881    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
882    where
883        T: super::stub::Projects + 'static,
884    {
885        Self { inner: stub.into() }
886    }
887
888    pub(crate) async fn new(
889        config: gaxi::options::ClientConfig,
890    ) -> crate::ClientBuilderResult<Self> {
891        let inner = Self::build_inner(config).await?;
892        Ok(Self { inner })
893    }
894
895    async fn build_inner(
896        conf: gaxi::options::ClientConfig,
897    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Projects>> {
898        if gaxi::options::tracing_enabled(&conf) {
899            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
900        }
901        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
902    }
903
904    async fn build_transport(
905        conf: gaxi::options::ClientConfig,
906    ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
907        super::transport::Projects::new(conf).await
908    }
909
910    async fn build_with_tracing(
911        conf: gaxi::options::ClientConfig,
912    ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
913        Self::build_transport(conf)
914            .await
915            .map(super::tracing::Projects::new)
916    }
917
918    /// Retrieves the project identified by the specified `name` (for example,
919    /// `projects/415104041262`).
920    ///
921    /// The caller must have `resourcemanager.projects.get` permission
922    /// for this project.
923    ///
924    /// # Example
925    /// ```
926    /// # use google_cloud_resourcemanager_v3::client::Projects;
927    /// use google_cloud_resourcemanager_v3::Result;
928    /// async fn sample(
929    ///    client: &Projects, project_id: &str
930    /// ) -> Result<()> {
931    ///     let response = client.get_project()
932    ///         .set_name(format!("projects/{project_id}"))
933    ///         .send().await?;
934    ///     println!("response {:?}", response);
935    ///     Ok(())
936    /// }
937    /// ```
938    pub fn get_project(&self) -> super::builder::projects::GetProject {
939        super::builder::projects::GetProject::new(self.inner.clone())
940    }
941
942    /// Lists projects that are direct children of the specified folder or
943    /// organization resource. `list()` provides a strongly consistent view of the
944    /// projects underneath the specified parent resource. `list()` returns
945    /// projects sorted based upon the (ascending) lexical ordering of their
946    /// `display_name`. The caller must have `resourcemanager.projects.list`
947    /// permission on the identified parent.
948    ///
949    /// # Example
950    /// ```
951    /// # use google_cloud_resourcemanager_v3::client::Projects;
952    /// use google_cloud_gax::paginator::ItemPaginator as _;
953    /// use google_cloud_resourcemanager_v3::Result;
954    /// async fn sample(
955    ///    client: &Projects, parent: &str
956    /// ) -> Result<()> {
957    ///     let mut list = client.list_projects()
958    ///         .set_parent(parent)
959    ///         .by_item();
960    ///     while let Some(item) = list.next().await.transpose()? {
961    ///         println!("{:?}", item);
962    ///     }
963    ///     Ok(())
964    /// }
965    /// ```
966    pub fn list_projects(&self) -> super::builder::projects::ListProjects {
967        super::builder::projects::ListProjects::new(self.inner.clone())
968    }
969
970    /// Search for projects that the caller has both `resourcemanager.projects.get`
971    /// permission on, and also satisfy the specified query.
972    ///
973    /// This method returns projects in an unspecified order.
974    ///
975    /// This method is eventually consistent with project mutations; this means
976    /// that a newly created project may not appear in the results or recent
977    /// updates to an existing project may not be reflected in the results. To
978    /// retrieve the latest state of a project, use the
979    /// [GetProject][google.cloud.resourcemanager.v3.Projects.GetProject] method.
980    ///
981    /// [google.cloud.resourcemanager.v3.Projects.GetProject]: crate::client::Projects::get_project
982    ///
983    /// # Example
984    /// ```
985    /// # use google_cloud_resourcemanager_v3::client::Projects;
986    /// use google_cloud_gax::paginator::ItemPaginator as _;
987    /// use google_cloud_resourcemanager_v3::Result;
988    /// async fn sample(
989    ///    client: &Projects
990    /// ) -> Result<()> {
991    ///     let mut list = client.search_projects()
992    ///         /* set fields */
993    ///         .by_item();
994    ///     while let Some(item) = list.next().await.transpose()? {
995    ///         println!("{:?}", item);
996    ///     }
997    ///     Ok(())
998    /// }
999    /// ```
1000    pub fn search_projects(&self) -> super::builder::projects::SearchProjects {
1001        super::builder::projects::SearchProjects::new(self.inner.clone())
1002    }
1003
1004    /// Request that a new project be created. The result is an `Operation` which
1005    /// can be used to track the creation process. This process usually takes a few
1006    /// seconds, but can sometimes take much longer. The tracking `Operation` is
1007    /// automatically deleted after a few hours, so there is no need to call
1008    /// `DeleteOperation`.
1009    ///
1010    /// # Long running operations
1011    ///
1012    /// This method is used to start, and/or poll a [long-running Operation].
1013    /// The [Working with long-running operations] chapter in the [user guide]
1014    /// covers these operations in detail.
1015    ///
1016    /// [long-running operation]: https://google.aip.dev/151
1017    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1018    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1019    ///
1020    /// # Example
1021    /// ```
1022    /// # use google_cloud_resourcemanager_v3::client::Projects;
1023    /// use google_cloud_lro::Poller;
1024    /// use google_cloud_resourcemanager_v3::Result;
1025    /// async fn sample(
1026    ///    client: &Projects
1027    /// ) -> Result<()> {
1028    ///     let response = client.create_project()
1029    ///         /* set fields */
1030    ///         .poller().until_done().await?;
1031    ///     println!("response {:?}", response);
1032    ///     Ok(())
1033    /// }
1034    /// ```
1035    pub fn create_project(&self) -> super::builder::projects::CreateProject {
1036        super::builder::projects::CreateProject::new(self.inner.clone())
1037    }
1038
1039    /// Updates the `display_name` and labels of the project identified by the
1040    /// specified `name` (for example, `projects/415104041262`). Deleting all
1041    /// labels requires an update mask for labels field.
1042    ///
1043    /// The caller must have `resourcemanager.projects.update` permission for this
1044    /// project.
1045    ///
1046    /// # Long running operations
1047    ///
1048    /// This method is used to start, and/or poll a [long-running Operation].
1049    /// The [Working with long-running operations] chapter in the [user guide]
1050    /// covers these operations in detail.
1051    ///
1052    /// [long-running operation]: https://google.aip.dev/151
1053    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1054    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1055    ///
1056    /// # Example
1057    /// ```
1058    /// # use google_cloud_resourcemanager_v3::client::Projects;
1059    /// use google_cloud_lro::Poller;
1060    /// # extern crate wkt as google_cloud_wkt;
1061    /// use google_cloud_wkt::FieldMask;
1062    /// use google_cloud_resourcemanager_v3::model::Project;
1063    /// use google_cloud_resourcemanager_v3::Result;
1064    /// async fn sample(
1065    ///    client: &Projects, project_id: &str
1066    /// ) -> Result<()> {
1067    ///     let response = client.update_project()
1068    ///         .set_project(
1069    ///             Project::new().set_name(format!("projects/{project_id}"))/* set fields */
1070    ///         )
1071    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1072    ///         .poller().until_done().await?;
1073    ///     println!("response {:?}", response);
1074    ///     Ok(())
1075    /// }
1076    /// ```
1077    pub fn update_project(&self) -> super::builder::projects::UpdateProject {
1078        super::builder::projects::UpdateProject::new(self.inner.clone())
1079    }
1080
1081    /// Move a project to another place in your resource hierarchy, under a new
1082    /// resource parent.
1083    ///
1084    /// Returns an operation which can be used to track the process of the project
1085    /// move workflow.
1086    /// Upon success, the `Operation.response` field will be populated with the
1087    /// moved project.
1088    ///
1089    /// The caller must have `resourcemanager.projects.move` permission on the
1090    /// project, on the project's current and proposed new parent.
1091    ///
1092    /// If project has no current parent, or it currently does not have an
1093    /// associated organization resource, you will also need the
1094    /// `resourcemanager.projects.setIamPolicy` permission in the project.
1095    ///
1096    /// # Long running operations
1097    ///
1098    /// This method is used to start, and/or poll a [long-running Operation].
1099    /// The [Working with long-running operations] chapter in the [user guide]
1100    /// covers these operations in detail.
1101    ///
1102    /// [long-running operation]: https://google.aip.dev/151
1103    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1104    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1105    ///
1106    /// # Example
1107    /// ```
1108    /// # use google_cloud_resourcemanager_v3::client::Projects;
1109    /// use google_cloud_lro::Poller;
1110    /// use google_cloud_resourcemanager_v3::Result;
1111    /// async fn sample(
1112    ///    client: &Projects
1113    /// ) -> Result<()> {
1114    ///     let response = client.move_project()
1115    ///         /* set fields */
1116    ///         .poller().until_done().await?;
1117    ///     println!("response {:?}", response);
1118    ///     Ok(())
1119    /// }
1120    /// ```
1121    pub fn move_project(&self) -> super::builder::projects::MoveProject {
1122        super::builder::projects::MoveProject::new(self.inner.clone())
1123    }
1124
1125    /// Marks the project identified by the specified
1126    /// `name` (for example, `projects/415104041262`) for deletion.
1127    ///
1128    /// This method will only affect the project if it has a lifecycle state of
1129    /// [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE].
1130    ///
1131    /// This method changes the Project's lifecycle state from
1132    /// [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE]
1133    /// to
1134    /// [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED].
1135    /// The deletion starts at an unspecified time,
1136    /// at which point the Project is no longer accessible.
1137    ///
1138    /// Until the deletion completes, you can check the lifecycle state
1139    /// checked by retrieving the project with [GetProject]
1140    /// [google.cloud.resourcemanager.v3.Projects.GetProject],
1141    /// and the project remains visible to [ListProjects]
1142    /// [google.cloud.resourcemanager.v3.Projects.ListProjects].
1143    /// However, you cannot update the project.
1144    ///
1145    /// After the deletion completes, the project is not retrievable by
1146    /// the  [GetProject]
1147    /// [google.cloud.resourcemanager.v3.Projects.GetProject],
1148    /// [ListProjects]
1149    /// [google.cloud.resourcemanager.v3.Projects.ListProjects], and
1150    /// [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
1151    /// methods.
1152    ///
1153    /// This method behaves idempotently, such that deleting a `DELETE_REQUESTED`
1154    /// project will not cause an error, but also won't do anything.
1155    ///
1156    /// The caller must have `resourcemanager.projects.delete` permissions for this
1157    /// project.
1158    ///
1159    /// [google.cloud.resourcemanager.v3.Project.State.ACTIVE]: crate::model::project::State::Active
1160    /// [google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED]: crate::model::project::State::DeleteRequested
1161    /// [google.cloud.resourcemanager.v3.Projects.SearchProjects]: crate::client::Projects::search_projects
1162    ///
1163    /// # Long running operations
1164    ///
1165    /// This method is used to start, and/or poll a [long-running Operation].
1166    /// The [Working with long-running operations] chapter in the [user guide]
1167    /// covers these operations in detail.
1168    ///
1169    /// [long-running operation]: https://google.aip.dev/151
1170    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1171    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1172    ///
1173    /// # Example
1174    /// ```
1175    /// # use google_cloud_resourcemanager_v3::client::Projects;
1176    /// use google_cloud_lro::Poller;
1177    /// use google_cloud_resourcemanager_v3::Result;
1178    /// async fn sample(
1179    ///    client: &Projects, project_id: &str
1180    /// ) -> Result<()> {
1181    ///     let response = client.delete_project()
1182    ///         .set_name(format!("projects/{project_id}"))
1183    ///         .poller().until_done().await?;
1184    ///     println!("response {:?}", response);
1185    ///     Ok(())
1186    /// }
1187    /// ```
1188    pub fn delete_project(&self) -> super::builder::projects::DeleteProject {
1189        super::builder::projects::DeleteProject::new(self.inner.clone())
1190    }
1191
1192    /// Restores the project identified by the specified
1193    /// `name` (for example, `projects/415104041262`).
1194    /// You can only use this method for a project that has a lifecycle state of
1195    /// [DELETE_REQUESTED]
1196    /// [Projects.State.DELETE_REQUESTED].
1197    /// After deletion starts, the project cannot be restored.
1198    ///
1199    /// The caller must have `resourcemanager.projects.undelete` permission for
1200    /// this project.
1201    ///
1202    /// # Long running operations
1203    ///
1204    /// This method is used to start, and/or poll a [long-running Operation].
1205    /// The [Working with long-running operations] chapter in the [user guide]
1206    /// covers these operations in detail.
1207    ///
1208    /// [long-running operation]: https://google.aip.dev/151
1209    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1210    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1211    ///
1212    /// # Example
1213    /// ```
1214    /// # use google_cloud_resourcemanager_v3::client::Projects;
1215    /// use google_cloud_lro::Poller;
1216    /// use google_cloud_resourcemanager_v3::Result;
1217    /// async fn sample(
1218    ///    client: &Projects, project_id: &str
1219    /// ) -> Result<()> {
1220    ///     let response = client.undelete_project()
1221    ///         .set_name(format!("projects/{project_id}"))
1222    ///         .poller().until_done().await?;
1223    ///     println!("response {:?}", response);
1224    ///     Ok(())
1225    /// }
1226    /// ```
1227    pub fn undelete_project(&self) -> super::builder::projects::UndeleteProject {
1228        super::builder::projects::UndeleteProject::new(self.inner.clone())
1229    }
1230
1231    /// Returns the IAM access control policy for the specified project, in the
1232    /// format `projects/{ProjectIdOrNumber}` e.g. projects/123.
1233    /// Permission is denied if the policy or the resource do not exist.
1234    ///
1235    /// # Example
1236    /// ```
1237    /// # use google_cloud_resourcemanager_v3::client::Projects;
1238    /// use google_cloud_resourcemanager_v3::Result;
1239    /// async fn sample(
1240    ///    client: &Projects
1241    /// ) -> Result<()> {
1242    ///     let response = client.get_iam_policy()
1243    ///         /* set fields */
1244    ///         .send().await?;
1245    ///     println!("response {:?}", response);
1246    ///     Ok(())
1247    /// }
1248    /// ```
1249    pub fn get_iam_policy(&self) -> super::builder::projects::GetIamPolicy {
1250        super::builder::projects::GetIamPolicy::new(self.inner.clone())
1251    }
1252
1253    /// Sets the IAM access control policy for the specified project, in the
1254    /// format `projects/{ProjectIdOrNumber}` e.g. projects/123.
1255    ///
1256    /// CAUTION: This method will replace the existing policy, and cannot be used
1257    /// to append additional IAM settings.
1258    ///
1259    /// Note: Removing service accounts from policies or changing their roles can
1260    /// render services completely inoperable. It is important to understand how
1261    /// the service account is being used before removing or updating its roles.
1262    ///
1263    /// The following constraints apply when using `setIamPolicy()`:
1264    ///
1265    /// + Project does not support `allUsers` and `allAuthenticatedUsers` as
1266    ///   `members` in a `Binding` of a `Policy`.
1267    ///
1268    /// + The owner role can be granted to a `user`, `serviceAccount`, or a group
1269    ///   that is part of an organization. For example,
1270    ///   group@myownpersonaldomain.com could be added as an owner to a project in
1271    ///   the myownpersonaldomain.com organization, but not the examplepetstore.com
1272    ///   organization.
1273    ///
1274    /// + Service accounts can be made owners of a project directly
1275    ///   without any restrictions. However, to be added as an owner, a user must be
1276    ///   invited using the Cloud Platform console and must accept the invitation.
1277    ///
1278    /// + A user cannot be granted the owner role using `setIamPolicy()`. The user
1279    ///   must be granted the owner role using the Cloud Platform Console and must
1280    ///   explicitly accept the invitation.
1281    ///
1282    /// + Invitations to grant the owner role cannot be sent using
1283    ///   `setIamPolicy()`;
1284    ///   they must be sent only using the Cloud Platform Console.
1285    ///
1286    /// + If the project is not part of an organization, there must be at least
1287    ///   one owner who has accepted the Terms of Service (ToS) agreement in the
1288    ///   policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner
1289    ///   from the policy will fail. This restriction also applies to legacy
1290    ///   projects that no longer have owners who have accepted the ToS. Edits to
1291    ///   IAM policies will be rejected until the lack of a ToS-accepting owner is
1292    ///   rectified. If the project is part of an organization, you can remove all
1293    ///   owners, potentially making the organization inaccessible.
1294    ///
1295    ///
1296    /// # Example
1297    /// ```
1298    /// # use google_cloud_resourcemanager_v3::client::Projects;
1299    /// use google_cloud_resourcemanager_v3::Result;
1300    /// async fn sample(
1301    ///    client: &Projects
1302    /// ) -> Result<()> {
1303    ///     let response = client.set_iam_policy()
1304    ///         /* set fields */
1305    ///         .send().await?;
1306    ///     println!("response {:?}", response);
1307    ///     Ok(())
1308    /// }
1309    /// ```
1310    pub fn set_iam_policy(&self) -> super::builder::projects::SetIamPolicy {
1311        super::builder::projects::SetIamPolicy::new(self.inner.clone())
1312    }
1313
1314    /// Returns permissions that a caller has on the specified project, in the
1315    /// format `projects/{ProjectIdOrNumber}` e.g. projects/123..
1316    ///
1317    /// # Example
1318    /// ```
1319    /// # use google_cloud_resourcemanager_v3::client::Projects;
1320    /// use google_cloud_resourcemanager_v3::Result;
1321    /// async fn sample(
1322    ///    client: &Projects
1323    /// ) -> Result<()> {
1324    ///     let response = client.test_iam_permissions()
1325    ///         /* set fields */
1326    ///         .send().await?;
1327    ///     println!("response {:?}", response);
1328    ///     Ok(())
1329    /// }
1330    /// ```
1331    pub fn test_iam_permissions(&self) -> super::builder::projects::TestIamPermissions {
1332        super::builder::projects::TestIamPermissions::new(self.inner.clone())
1333    }
1334
1335    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1336    ///
1337    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1338    ///
1339    /// # Example
1340    /// ```
1341    /// # use google_cloud_resourcemanager_v3::client::Projects;
1342    /// use google_cloud_resourcemanager_v3::Result;
1343    /// async fn sample(
1344    ///    client: &Projects
1345    /// ) -> Result<()> {
1346    ///     let response = client.get_operation()
1347    ///         /* set fields */
1348    ///         .send().await?;
1349    ///     println!("response {:?}", response);
1350    ///     Ok(())
1351    /// }
1352    /// ```
1353    pub fn get_operation(&self) -> super::builder::projects::GetOperation {
1354        super::builder::projects::GetOperation::new(self.inner.clone())
1355    }
1356}
1357
1358/// Implements a client for the Cloud Resource Manager API.
1359///
1360/// # Example
1361/// ```
1362/// # use google_cloud_resourcemanager_v3::client::TagBindings;
1363/// use google_cloud_gax::paginator::ItemPaginator as _;
1364/// async fn sample(
1365///    parent: &str,
1366/// ) -> anyhow::Result<()> {
1367///     let client = TagBindings::builder().build().await?;
1368///     let mut list = client.list_tag_bindings()
1369///         .set_parent(parent)
1370///         .by_item();
1371///     while let Some(item) = list.next().await.transpose()? {
1372///         println!("{:?}", item);
1373///     }
1374///     Ok(())
1375/// }
1376/// ```
1377///
1378/// # Service Description
1379///
1380/// Allow users to create and manage TagBindings between TagValues and
1381/// different Google Cloud resources throughout the GCP resource hierarchy.
1382///
1383/// # Configuration
1384///
1385/// To configure `TagBindings` use the `with_*` methods in the type returned
1386/// by [builder()][TagBindings::builder]. The default configuration should
1387/// work for most applications. Common configuration changes include
1388///
1389/// * [with_endpoint()]: by default this client uses the global default endpoint
1390///   (`https://cloudresourcemanager.googleapis.com`). Applications using regional
1391///   endpoints or running in restricted networks (e.g. a network configured
1392///   with [Private Google Access with VPC Service Controls]) may want to
1393///   override this default.
1394/// * [with_credentials()]: by default this client uses
1395///   [Application Default Credentials]. Applications using custom
1396///   authentication may need to override this default.
1397///
1398/// [with_endpoint()]: super::builder::tag_bindings::ClientBuilder::with_endpoint
1399/// [with_credentials()]: super::builder::tag_bindings::ClientBuilder::with_credentials
1400/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1401/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1402///
1403/// # Pooling and Cloning
1404///
1405/// `TagBindings` holds a connection pool internally, it is advised to
1406/// create one and reuse it. You do not need to wrap `TagBindings` in
1407/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1408/// already uses an `Arc` internally.
1409#[derive(Clone, Debug)]
1410pub struct TagBindings {
1411    inner: std::sync::Arc<dyn super::stub::dynamic::TagBindings>,
1412}
1413
1414impl TagBindings {
1415    /// Returns a builder for [TagBindings].
1416    ///
1417    /// ```
1418    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1419    /// # use google_cloud_resourcemanager_v3::client::TagBindings;
1420    /// let client = TagBindings::builder().build().await?;
1421    /// # Ok(()) }
1422    /// ```
1423    pub fn builder() -> super::builder::tag_bindings::ClientBuilder {
1424        crate::new_client_builder(super::builder::tag_bindings::client::Factory)
1425    }
1426
1427    /// Creates a new client from the provided stub.
1428    ///
1429    /// The most common case for calling this function is in tests mocking the
1430    /// client's behavior.
1431    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1432    where
1433        T: super::stub::TagBindings + 'static,
1434    {
1435        Self { inner: stub.into() }
1436    }
1437
1438    pub(crate) async fn new(
1439        config: gaxi::options::ClientConfig,
1440    ) -> crate::ClientBuilderResult<Self> {
1441        let inner = Self::build_inner(config).await?;
1442        Ok(Self { inner })
1443    }
1444
1445    async fn build_inner(
1446        conf: gaxi::options::ClientConfig,
1447    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TagBindings>> {
1448        if gaxi::options::tracing_enabled(&conf) {
1449            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1450        }
1451        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1452    }
1453
1454    async fn build_transport(
1455        conf: gaxi::options::ClientConfig,
1456    ) -> crate::ClientBuilderResult<impl super::stub::TagBindings> {
1457        super::transport::TagBindings::new(conf).await
1458    }
1459
1460    async fn build_with_tracing(
1461        conf: gaxi::options::ClientConfig,
1462    ) -> crate::ClientBuilderResult<impl super::stub::TagBindings> {
1463        Self::build_transport(conf)
1464            .await
1465            .map(super::tracing::TagBindings::new)
1466    }
1467
1468    /// Lists the TagBindings for the given Google Cloud resource, as specified
1469    /// with `parent`.
1470    ///
1471    /// NOTE: The `parent` field is expected to be a full resource name:
1472    /// <https://cloud.google.com/apis/design/resource_names#full_resource_name>
1473    ///
1474    /// # Example
1475    /// ```
1476    /// # use google_cloud_resourcemanager_v3::client::TagBindings;
1477    /// use google_cloud_gax::paginator::ItemPaginator as _;
1478    /// use google_cloud_resourcemanager_v3::Result;
1479    /// async fn sample(
1480    ///    client: &TagBindings, parent: &str
1481    /// ) -> Result<()> {
1482    ///     let mut list = client.list_tag_bindings()
1483    ///         .set_parent(parent)
1484    ///         .by_item();
1485    ///     while let Some(item) = list.next().await.transpose()? {
1486    ///         println!("{:?}", item);
1487    ///     }
1488    ///     Ok(())
1489    /// }
1490    /// ```
1491    pub fn list_tag_bindings(&self) -> super::builder::tag_bindings::ListTagBindings {
1492        super::builder::tag_bindings::ListTagBindings::new(self.inner.clone())
1493    }
1494
1495    /// Creates a TagBinding between a TagValue and a Google Cloud resource.
1496    ///
1497    /// # Long running operations
1498    ///
1499    /// This method is used to start, and/or poll a [long-running Operation].
1500    /// The [Working with long-running operations] chapter in the [user guide]
1501    /// covers these operations in detail.
1502    ///
1503    /// [long-running operation]: https://google.aip.dev/151
1504    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1505    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1506    ///
1507    /// # Example
1508    /// ```
1509    /// # use google_cloud_resourcemanager_v3::client::TagBindings;
1510    /// use google_cloud_lro::Poller;
1511    /// use google_cloud_resourcemanager_v3::Result;
1512    /// async fn sample(
1513    ///    client: &TagBindings
1514    /// ) -> Result<()> {
1515    ///     let response = client.create_tag_binding()
1516    ///         /* set fields */
1517    ///         .poller().until_done().await?;
1518    ///     println!("response {:?}", response);
1519    ///     Ok(())
1520    /// }
1521    /// ```
1522    pub fn create_tag_binding(&self) -> super::builder::tag_bindings::CreateTagBinding {
1523        super::builder::tag_bindings::CreateTagBinding::new(self.inner.clone())
1524    }
1525
1526    /// Deletes a TagBinding.
1527    ///
1528    /// # Long running operations
1529    ///
1530    /// This method is used to start, and/or poll a [long-running Operation].
1531    /// The [Working with long-running operations] chapter in the [user guide]
1532    /// covers these operations in detail.
1533    ///
1534    /// [long-running operation]: https://google.aip.dev/151
1535    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1536    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1537    ///
1538    /// # Example
1539    /// ```
1540    /// # use google_cloud_resourcemanager_v3::client::TagBindings;
1541    /// use google_cloud_lro::Poller;
1542    /// use google_cloud_resourcemanager_v3::Result;
1543    /// async fn sample(
1544    ///    client: &TagBindings, tag_binding_id: &str
1545    /// ) -> Result<()> {
1546    ///     client.delete_tag_binding()
1547    ///         .set_name(format!("tagBindings/{tag_binding_id}"))
1548    ///         .poller().until_done().await?;
1549    ///     Ok(())
1550    /// }
1551    /// ```
1552    pub fn delete_tag_binding(&self) -> super::builder::tag_bindings::DeleteTagBinding {
1553        super::builder::tag_bindings::DeleteTagBinding::new(self.inner.clone())
1554    }
1555
1556    /// Return a list of effective tags for the given Google Cloud resource, as
1557    /// specified in `parent`.
1558    ///
1559    /// # Example
1560    /// ```
1561    /// # use google_cloud_resourcemanager_v3::client::TagBindings;
1562    /// use google_cloud_gax::paginator::ItemPaginator as _;
1563    /// use google_cloud_resourcemanager_v3::Result;
1564    /// async fn sample(
1565    ///    client: &TagBindings
1566    /// ) -> Result<()> {
1567    ///     let mut list = client.list_effective_tags()
1568    ///         /* set fields */
1569    ///         .by_item();
1570    ///     while let Some(item) = list.next().await.transpose()? {
1571    ///         println!("{:?}", item);
1572    ///     }
1573    ///     Ok(())
1574    /// }
1575    /// ```
1576    pub fn list_effective_tags(&self) -> super::builder::tag_bindings::ListEffectiveTags {
1577        super::builder::tag_bindings::ListEffectiveTags::new(self.inner.clone())
1578    }
1579
1580    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1581    ///
1582    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1583    ///
1584    /// # Example
1585    /// ```
1586    /// # use google_cloud_resourcemanager_v3::client::TagBindings;
1587    /// use google_cloud_resourcemanager_v3::Result;
1588    /// async fn sample(
1589    ///    client: &TagBindings
1590    /// ) -> Result<()> {
1591    ///     let response = client.get_operation()
1592    ///         /* set fields */
1593    ///         .send().await?;
1594    ///     println!("response {:?}", response);
1595    ///     Ok(())
1596    /// }
1597    /// ```
1598    pub fn get_operation(&self) -> super::builder::tag_bindings::GetOperation {
1599        super::builder::tag_bindings::GetOperation::new(self.inner.clone())
1600    }
1601}
1602
1603/// Implements a client for the Cloud Resource Manager API.
1604///
1605/// # Example
1606/// ```
1607/// # use google_cloud_resourcemanager_v3::client::TagHolds;
1608/// use google_cloud_gax::paginator::ItemPaginator as _;
1609/// async fn sample(
1610///    tag_value_id: &str,
1611/// ) -> anyhow::Result<()> {
1612///     let client = TagHolds::builder().build().await?;
1613///     let mut list = client.list_tag_holds()
1614///         .set_parent(format!("tagValues/{tag_value_id}"))
1615///         .by_item();
1616///     while let Some(item) = list.next().await.transpose()? {
1617///         println!("{:?}", item);
1618///     }
1619///     Ok(())
1620/// }
1621/// ```
1622///
1623/// # Service Description
1624///
1625/// Allow users to create and manage TagHolds for TagValues. TagHolds represent
1626/// the use of a Tag Value that is not captured by TagBindings but
1627/// should still block TagValue deletion (such as a reference in a policy
1628/// condition). This service provides isolated failure domains by cloud location
1629/// so that TagHolds can be managed in the same location as their usage.
1630///
1631/// # Configuration
1632///
1633/// To configure `TagHolds` use the `with_*` methods in the type returned
1634/// by [builder()][TagHolds::builder]. The default configuration should
1635/// work for most applications. Common configuration changes include
1636///
1637/// * [with_endpoint()]: by default this client uses the global default endpoint
1638///   (`https://cloudresourcemanager.googleapis.com`). Applications using regional
1639///   endpoints or running in restricted networks (e.g. a network configured
1640///   with [Private Google Access with VPC Service Controls]) may want to
1641///   override this default.
1642/// * [with_credentials()]: by default this client uses
1643///   [Application Default Credentials]. Applications using custom
1644///   authentication may need to override this default.
1645///
1646/// [with_endpoint()]: super::builder::tag_holds::ClientBuilder::with_endpoint
1647/// [with_credentials()]: super::builder::tag_holds::ClientBuilder::with_credentials
1648/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1649/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1650///
1651/// # Pooling and Cloning
1652///
1653/// `TagHolds` holds a connection pool internally, it is advised to
1654/// create one and reuse it. You do not need to wrap `TagHolds` in
1655/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1656/// already uses an `Arc` internally.
1657#[derive(Clone, Debug)]
1658pub struct TagHolds {
1659    inner: std::sync::Arc<dyn super::stub::dynamic::TagHolds>,
1660}
1661
1662impl TagHolds {
1663    /// Returns a builder for [TagHolds].
1664    ///
1665    /// ```
1666    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1667    /// # use google_cloud_resourcemanager_v3::client::TagHolds;
1668    /// let client = TagHolds::builder().build().await?;
1669    /// # Ok(()) }
1670    /// ```
1671    pub fn builder() -> super::builder::tag_holds::ClientBuilder {
1672        crate::new_client_builder(super::builder::tag_holds::client::Factory)
1673    }
1674
1675    /// Creates a new client from the provided stub.
1676    ///
1677    /// The most common case for calling this function is in tests mocking the
1678    /// client's behavior.
1679    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1680    where
1681        T: super::stub::TagHolds + 'static,
1682    {
1683        Self { inner: stub.into() }
1684    }
1685
1686    pub(crate) async fn new(
1687        config: gaxi::options::ClientConfig,
1688    ) -> crate::ClientBuilderResult<Self> {
1689        let inner = Self::build_inner(config).await?;
1690        Ok(Self { inner })
1691    }
1692
1693    async fn build_inner(
1694        conf: gaxi::options::ClientConfig,
1695    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TagHolds>> {
1696        if gaxi::options::tracing_enabled(&conf) {
1697            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1698        }
1699        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1700    }
1701
1702    async fn build_transport(
1703        conf: gaxi::options::ClientConfig,
1704    ) -> crate::ClientBuilderResult<impl super::stub::TagHolds> {
1705        super::transport::TagHolds::new(conf).await
1706    }
1707
1708    async fn build_with_tracing(
1709        conf: gaxi::options::ClientConfig,
1710    ) -> crate::ClientBuilderResult<impl super::stub::TagHolds> {
1711        Self::build_transport(conf)
1712            .await
1713            .map(super::tracing::TagHolds::new)
1714    }
1715
1716    /// Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same
1717    /// resource and origin exists under the same TagValue.
1718    ///
1719    /// # Long running operations
1720    ///
1721    /// This method is used to start, and/or poll a [long-running Operation].
1722    /// The [Working with long-running operations] chapter in the [user guide]
1723    /// covers these operations in detail.
1724    ///
1725    /// [long-running operation]: https://google.aip.dev/151
1726    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1727    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1728    ///
1729    /// # Example
1730    /// ```
1731    /// # use google_cloud_resourcemanager_v3::client::TagHolds;
1732    /// use google_cloud_lro::Poller;
1733    /// use google_cloud_resourcemanager_v3::model::TagHold;
1734    /// use google_cloud_resourcemanager_v3::Result;
1735    /// async fn sample(
1736    ///    client: &TagHolds, tag_value_id: &str
1737    /// ) -> Result<()> {
1738    ///     let response = client.create_tag_hold()
1739    ///         .set_parent(format!("tagValues/{tag_value_id}"))
1740    ///         .set_tag_hold(
1741    ///             TagHold::new()/* set fields */
1742    ///         )
1743    ///         .poller().until_done().await?;
1744    ///     println!("response {:?}", response);
1745    ///     Ok(())
1746    /// }
1747    /// ```
1748    pub fn create_tag_hold(&self) -> super::builder::tag_holds::CreateTagHold {
1749        super::builder::tag_holds::CreateTagHold::new(self.inner.clone())
1750    }
1751
1752    /// Deletes a TagHold.
1753    ///
1754    /// # Long running operations
1755    ///
1756    /// This method is used to start, and/or poll a [long-running Operation].
1757    /// The [Working with long-running operations] chapter in the [user guide]
1758    /// covers these operations in detail.
1759    ///
1760    /// [long-running operation]: https://google.aip.dev/151
1761    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1762    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1763    ///
1764    /// # Example
1765    /// ```
1766    /// # use google_cloud_resourcemanager_v3::client::TagHolds;
1767    /// use google_cloud_lro::Poller;
1768    /// use google_cloud_resourcemanager_v3::Result;
1769    /// async fn sample(
1770    ///    client: &TagHolds, tag_value_id: &str, tag_hold_id: &str
1771    /// ) -> Result<()> {
1772    ///     client.delete_tag_hold()
1773    ///         .set_name(format!("tagValues/{tag_value_id}/tagHolds/{tag_hold_id}"))
1774    ///         .poller().until_done().await?;
1775    ///     Ok(())
1776    /// }
1777    /// ```
1778    pub fn delete_tag_hold(&self) -> super::builder::tag_holds::DeleteTagHold {
1779        super::builder::tag_holds::DeleteTagHold::new(self.inner.clone())
1780    }
1781
1782    /// Lists TagHolds under a TagValue.
1783    ///
1784    /// # Example
1785    /// ```
1786    /// # use google_cloud_resourcemanager_v3::client::TagHolds;
1787    /// use google_cloud_gax::paginator::ItemPaginator as _;
1788    /// use google_cloud_resourcemanager_v3::Result;
1789    /// async fn sample(
1790    ///    client: &TagHolds, tag_value_id: &str
1791    /// ) -> Result<()> {
1792    ///     let mut list = client.list_tag_holds()
1793    ///         .set_parent(format!("tagValues/{tag_value_id}"))
1794    ///         .by_item();
1795    ///     while let Some(item) = list.next().await.transpose()? {
1796    ///         println!("{:?}", item);
1797    ///     }
1798    ///     Ok(())
1799    /// }
1800    /// ```
1801    pub fn list_tag_holds(&self) -> super::builder::tag_holds::ListTagHolds {
1802        super::builder::tag_holds::ListTagHolds::new(self.inner.clone())
1803    }
1804
1805    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1806    ///
1807    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1808    ///
1809    /// # Example
1810    /// ```
1811    /// # use google_cloud_resourcemanager_v3::client::TagHolds;
1812    /// use google_cloud_resourcemanager_v3::Result;
1813    /// async fn sample(
1814    ///    client: &TagHolds
1815    /// ) -> Result<()> {
1816    ///     let response = client.get_operation()
1817    ///         /* set fields */
1818    ///         .send().await?;
1819    ///     println!("response {:?}", response);
1820    ///     Ok(())
1821    /// }
1822    /// ```
1823    pub fn get_operation(&self) -> super::builder::tag_holds::GetOperation {
1824        super::builder::tag_holds::GetOperation::new(self.inner.clone())
1825    }
1826}
1827
1828/// Implements a client for the Cloud Resource Manager API.
1829///
1830/// # Example
1831/// ```
1832/// # use google_cloud_resourcemanager_v3::client::TagKeys;
1833/// use google_cloud_gax::paginator::ItemPaginator as _;
1834/// async fn sample(
1835///    parent: &str,
1836/// ) -> anyhow::Result<()> {
1837///     let client = TagKeys::builder().build().await?;
1838///     let mut list = client.list_tag_keys()
1839///         .set_parent(parent)
1840///         .by_item();
1841///     while let Some(item) = list.next().await.transpose()? {
1842///         println!("{:?}", item);
1843///     }
1844///     Ok(())
1845/// }
1846/// ```
1847///
1848/// # Service Description
1849///
1850/// Allow users to create and manage tag keys.
1851///
1852/// # Configuration
1853///
1854/// To configure `TagKeys` use the `with_*` methods in the type returned
1855/// by [builder()][TagKeys::builder]. The default configuration should
1856/// work for most applications. Common configuration changes include
1857///
1858/// * [with_endpoint()]: by default this client uses the global default endpoint
1859///   (`https://cloudresourcemanager.googleapis.com`). Applications using regional
1860///   endpoints or running in restricted networks (e.g. a network configured
1861///   with [Private Google Access with VPC Service Controls]) may want to
1862///   override this default.
1863/// * [with_credentials()]: by default this client uses
1864///   [Application Default Credentials]. Applications using custom
1865///   authentication may need to override this default.
1866///
1867/// [with_endpoint()]: super::builder::tag_keys::ClientBuilder::with_endpoint
1868/// [with_credentials()]: super::builder::tag_keys::ClientBuilder::with_credentials
1869/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1870/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1871///
1872/// # Pooling and Cloning
1873///
1874/// `TagKeys` holds a connection pool internally, it is advised to
1875/// create one and reuse it. You do not need to wrap `TagKeys` in
1876/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1877/// already uses an `Arc` internally.
1878#[derive(Clone, Debug)]
1879pub struct TagKeys {
1880    inner: std::sync::Arc<dyn super::stub::dynamic::TagKeys>,
1881}
1882
1883impl TagKeys {
1884    /// Returns a builder for [TagKeys].
1885    ///
1886    /// ```
1887    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1888    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
1889    /// let client = TagKeys::builder().build().await?;
1890    /// # Ok(()) }
1891    /// ```
1892    pub fn builder() -> super::builder::tag_keys::ClientBuilder {
1893        crate::new_client_builder(super::builder::tag_keys::client::Factory)
1894    }
1895
1896    /// Creates a new client from the provided stub.
1897    ///
1898    /// The most common case for calling this function is in tests mocking the
1899    /// client's behavior.
1900    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1901    where
1902        T: super::stub::TagKeys + 'static,
1903    {
1904        Self { inner: stub.into() }
1905    }
1906
1907    pub(crate) async fn new(
1908        config: gaxi::options::ClientConfig,
1909    ) -> crate::ClientBuilderResult<Self> {
1910        let inner = Self::build_inner(config).await?;
1911        Ok(Self { inner })
1912    }
1913
1914    async fn build_inner(
1915        conf: gaxi::options::ClientConfig,
1916    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TagKeys>> {
1917        if gaxi::options::tracing_enabled(&conf) {
1918            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1919        }
1920        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1921    }
1922
1923    async fn build_transport(
1924        conf: gaxi::options::ClientConfig,
1925    ) -> crate::ClientBuilderResult<impl super::stub::TagKeys> {
1926        super::transport::TagKeys::new(conf).await
1927    }
1928
1929    async fn build_with_tracing(
1930        conf: gaxi::options::ClientConfig,
1931    ) -> crate::ClientBuilderResult<impl super::stub::TagKeys> {
1932        Self::build_transport(conf)
1933            .await
1934            .map(super::tracing::TagKeys::new)
1935    }
1936
1937    /// Lists all TagKeys for a parent resource.
1938    ///
1939    /// # Example
1940    /// ```
1941    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
1942    /// use google_cloud_gax::paginator::ItemPaginator as _;
1943    /// use google_cloud_resourcemanager_v3::Result;
1944    /// async fn sample(
1945    ///    client: &TagKeys, parent: &str
1946    /// ) -> Result<()> {
1947    ///     let mut list = client.list_tag_keys()
1948    ///         .set_parent(parent)
1949    ///         .by_item();
1950    ///     while let Some(item) = list.next().await.transpose()? {
1951    ///         println!("{:?}", item);
1952    ///     }
1953    ///     Ok(())
1954    /// }
1955    /// ```
1956    pub fn list_tag_keys(&self) -> super::builder::tag_keys::ListTagKeys {
1957        super::builder::tag_keys::ListTagKeys::new(self.inner.clone())
1958    }
1959
1960    /// Retrieves a TagKey. This method will return `PERMISSION_DENIED` if the
1961    /// key does not exist or the user does not have permission to view it.
1962    ///
1963    /// # Example
1964    /// ```
1965    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
1966    /// use google_cloud_resourcemanager_v3::Result;
1967    /// async fn sample(
1968    ///    client: &TagKeys, tag_key_id: &str
1969    /// ) -> Result<()> {
1970    ///     let response = client.get_tag_key()
1971    ///         .set_name(format!("tagKeys/{tag_key_id}"))
1972    ///         .send().await?;
1973    ///     println!("response {:?}", response);
1974    ///     Ok(())
1975    /// }
1976    /// ```
1977    pub fn get_tag_key(&self) -> super::builder::tag_keys::GetTagKey {
1978        super::builder::tag_keys::GetTagKey::new(self.inner.clone())
1979    }
1980
1981    /// Retrieves a TagKey by its namespaced name.
1982    /// This method will return `PERMISSION_DENIED` if the key does not exist
1983    /// or the user does not have permission to view it.
1984    ///
1985    /// # Example
1986    /// ```
1987    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
1988    /// use google_cloud_resourcemanager_v3::Result;
1989    /// async fn sample(
1990    ///    client: &TagKeys, tag_key_id: &str
1991    /// ) -> Result<()> {
1992    ///     let response = client.get_namespaced_tag_key()
1993    ///         .set_name(format!("tagKeys/{tag_key_id}"))
1994    ///         .send().await?;
1995    ///     println!("response {:?}", response);
1996    ///     Ok(())
1997    /// }
1998    /// ```
1999    pub fn get_namespaced_tag_key(&self) -> super::builder::tag_keys::GetNamespacedTagKey {
2000        super::builder::tag_keys::GetNamespacedTagKey::new(self.inner.clone())
2001    }
2002
2003    /// Creates a new TagKey. If another request with the same parameters is
2004    /// sent while the original request is in process, the second request
2005    /// will receive an error. A maximum of 1000 TagKeys can exist under a parent
2006    /// at any given time.
2007    ///
2008    /// # Long running operations
2009    ///
2010    /// This method is used to start, and/or poll a [long-running Operation].
2011    /// The [Working with long-running operations] chapter in the [user guide]
2012    /// covers these operations in detail.
2013    ///
2014    /// [long-running operation]: https://google.aip.dev/151
2015    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2016    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2017    ///
2018    /// # Example
2019    /// ```
2020    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
2021    /// use google_cloud_lro::Poller;
2022    /// use google_cloud_resourcemanager_v3::Result;
2023    /// async fn sample(
2024    ///    client: &TagKeys
2025    /// ) -> Result<()> {
2026    ///     let response = client.create_tag_key()
2027    ///         /* set fields */
2028    ///         .poller().until_done().await?;
2029    ///     println!("response {:?}", response);
2030    ///     Ok(())
2031    /// }
2032    /// ```
2033    pub fn create_tag_key(&self) -> super::builder::tag_keys::CreateTagKey {
2034        super::builder::tag_keys::CreateTagKey::new(self.inner.clone())
2035    }
2036
2037    /// Updates the attributes of the TagKey resource.
2038    ///
2039    /// # Long running operations
2040    ///
2041    /// This method is used to start, and/or poll a [long-running Operation].
2042    /// The [Working with long-running operations] chapter in the [user guide]
2043    /// covers these operations in detail.
2044    ///
2045    /// [long-running operation]: https://google.aip.dev/151
2046    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2047    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2048    ///
2049    /// # Example
2050    /// ```
2051    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
2052    /// use google_cloud_lro::Poller;
2053    /// # extern crate wkt as google_cloud_wkt;
2054    /// use google_cloud_wkt::FieldMask;
2055    /// use google_cloud_resourcemanager_v3::model::TagKey;
2056    /// use google_cloud_resourcemanager_v3::Result;
2057    /// async fn sample(
2058    ///    client: &TagKeys, tag_key_id: &str
2059    /// ) -> Result<()> {
2060    ///     let response = client.update_tag_key()
2061    ///         .set_tag_key(
2062    ///             TagKey::new().set_name(format!("tagKeys/{tag_key_id}"))/* set fields */
2063    ///         )
2064    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2065    ///         .poller().until_done().await?;
2066    ///     println!("response {:?}", response);
2067    ///     Ok(())
2068    /// }
2069    /// ```
2070    pub fn update_tag_key(&self) -> super::builder::tag_keys::UpdateTagKey {
2071        super::builder::tag_keys::UpdateTagKey::new(self.inner.clone())
2072    }
2073
2074    /// Deletes a TagKey. The TagKey cannot be deleted if it has any child
2075    /// TagValues.
2076    ///
2077    /// # Long running operations
2078    ///
2079    /// This method is used to start, and/or poll a [long-running Operation].
2080    /// The [Working with long-running operations] chapter in the [user guide]
2081    /// covers these operations in detail.
2082    ///
2083    /// [long-running operation]: https://google.aip.dev/151
2084    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2085    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2086    ///
2087    /// # Example
2088    /// ```
2089    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
2090    /// use google_cloud_lro::Poller;
2091    /// use google_cloud_resourcemanager_v3::Result;
2092    /// async fn sample(
2093    ///    client: &TagKeys, tag_key_id: &str
2094    /// ) -> Result<()> {
2095    ///     let response = client.delete_tag_key()
2096    ///         .set_name(format!("tagKeys/{tag_key_id}"))
2097    ///         .poller().until_done().await?;
2098    ///     println!("response {:?}", response);
2099    ///     Ok(())
2100    /// }
2101    /// ```
2102    pub fn delete_tag_key(&self) -> super::builder::tag_keys::DeleteTagKey {
2103        super::builder::tag_keys::DeleteTagKey::new(self.inner.clone())
2104    }
2105
2106    /// Gets the access control policy for a TagKey. The returned policy may be
2107    /// empty if no such policy or resource exists. The `resource` field should
2108    /// be the TagKey's resource name. For example, "tagKeys/1234".
2109    /// The caller must have
2110    /// `cloudresourcemanager.googleapis.com/tagKeys.getIamPolicy` permission on
2111    /// the specified TagKey.
2112    ///
2113    /// # Example
2114    /// ```
2115    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
2116    /// use google_cloud_resourcemanager_v3::Result;
2117    /// async fn sample(
2118    ///    client: &TagKeys
2119    /// ) -> Result<()> {
2120    ///     let response = client.get_iam_policy()
2121    ///         /* set fields */
2122    ///         .send().await?;
2123    ///     println!("response {:?}", response);
2124    ///     Ok(())
2125    /// }
2126    /// ```
2127    pub fn get_iam_policy(&self) -> super::builder::tag_keys::GetIamPolicy {
2128        super::builder::tag_keys::GetIamPolicy::new(self.inner.clone())
2129    }
2130
2131    /// Sets the access control policy on a TagKey, replacing any existing
2132    /// policy. The `resource` field should be the TagKey's resource name.
2133    /// For example, "tagKeys/1234".
2134    /// The caller must have `resourcemanager.tagKeys.setIamPolicy` permission
2135    /// on the identified tagValue.
2136    ///
2137    /// # Example
2138    /// ```
2139    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
2140    /// use google_cloud_resourcemanager_v3::Result;
2141    /// async fn sample(
2142    ///    client: &TagKeys
2143    /// ) -> Result<()> {
2144    ///     let response = client.set_iam_policy()
2145    ///         /* set fields */
2146    ///         .send().await?;
2147    ///     println!("response {:?}", response);
2148    ///     Ok(())
2149    /// }
2150    /// ```
2151    pub fn set_iam_policy(&self) -> super::builder::tag_keys::SetIamPolicy {
2152        super::builder::tag_keys::SetIamPolicy::new(self.inner.clone())
2153    }
2154
2155    /// Returns permissions that a caller has on the specified TagKey.
2156    /// The `resource` field should be the TagKey's resource name.
2157    /// For example, "tagKeys/1234".
2158    ///
2159    /// There are no permissions required for making this API call.
2160    ///
2161    /// # Example
2162    /// ```
2163    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
2164    /// use google_cloud_resourcemanager_v3::Result;
2165    /// async fn sample(
2166    ///    client: &TagKeys
2167    /// ) -> Result<()> {
2168    ///     let response = client.test_iam_permissions()
2169    ///         /* set fields */
2170    ///         .send().await?;
2171    ///     println!("response {:?}", response);
2172    ///     Ok(())
2173    /// }
2174    /// ```
2175    pub fn test_iam_permissions(&self) -> super::builder::tag_keys::TestIamPermissions {
2176        super::builder::tag_keys::TestIamPermissions::new(self.inner.clone())
2177    }
2178
2179    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2180    ///
2181    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2182    ///
2183    /// # Example
2184    /// ```
2185    /// # use google_cloud_resourcemanager_v3::client::TagKeys;
2186    /// use google_cloud_resourcemanager_v3::Result;
2187    /// async fn sample(
2188    ///    client: &TagKeys
2189    /// ) -> Result<()> {
2190    ///     let response = client.get_operation()
2191    ///         /* set fields */
2192    ///         .send().await?;
2193    ///     println!("response {:?}", response);
2194    ///     Ok(())
2195    /// }
2196    /// ```
2197    pub fn get_operation(&self) -> super::builder::tag_keys::GetOperation {
2198        super::builder::tag_keys::GetOperation::new(self.inner.clone())
2199    }
2200}
2201
2202/// Implements a client for the Cloud Resource Manager API.
2203///
2204/// # Example
2205/// ```
2206/// # use google_cloud_resourcemanager_v3::client::TagValues;
2207/// use google_cloud_gax::paginator::ItemPaginator as _;
2208/// async fn sample(
2209///    parent: &str,
2210/// ) -> anyhow::Result<()> {
2211///     let client = TagValues::builder().build().await?;
2212///     let mut list = client.list_tag_values()
2213///         .set_parent(parent)
2214///         .by_item();
2215///     while let Some(item) = list.next().await.transpose()? {
2216///         println!("{:?}", item);
2217///     }
2218///     Ok(())
2219/// }
2220/// ```
2221///
2222/// # Service Description
2223///
2224/// Allow users to create and manage tag values.
2225///
2226/// # Configuration
2227///
2228/// To configure `TagValues` use the `with_*` methods in the type returned
2229/// by [builder()][TagValues::builder]. The default configuration should
2230/// work for most applications. Common configuration changes include
2231///
2232/// * [with_endpoint()]: by default this client uses the global default endpoint
2233///   (`https://cloudresourcemanager.googleapis.com`). Applications using regional
2234///   endpoints or running in restricted networks (e.g. a network configured
2235///   with [Private Google Access with VPC Service Controls]) may want to
2236///   override this default.
2237/// * [with_credentials()]: by default this client uses
2238///   [Application Default Credentials]. Applications using custom
2239///   authentication may need to override this default.
2240///
2241/// [with_endpoint()]: super::builder::tag_values::ClientBuilder::with_endpoint
2242/// [with_credentials()]: super::builder::tag_values::ClientBuilder::with_credentials
2243/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2244/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2245///
2246/// # Pooling and Cloning
2247///
2248/// `TagValues` holds a connection pool internally, it is advised to
2249/// create one and reuse it. You do not need to wrap `TagValues` in
2250/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2251/// already uses an `Arc` internally.
2252#[derive(Clone, Debug)]
2253pub struct TagValues {
2254    inner: std::sync::Arc<dyn super::stub::dynamic::TagValues>,
2255}
2256
2257impl TagValues {
2258    /// Returns a builder for [TagValues].
2259    ///
2260    /// ```
2261    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2262    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2263    /// let client = TagValues::builder().build().await?;
2264    /// # Ok(()) }
2265    /// ```
2266    pub fn builder() -> super::builder::tag_values::ClientBuilder {
2267        crate::new_client_builder(super::builder::tag_values::client::Factory)
2268    }
2269
2270    /// Creates a new client from the provided stub.
2271    ///
2272    /// The most common case for calling this function is in tests mocking the
2273    /// client's behavior.
2274    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2275    where
2276        T: super::stub::TagValues + 'static,
2277    {
2278        Self { inner: stub.into() }
2279    }
2280
2281    pub(crate) async fn new(
2282        config: gaxi::options::ClientConfig,
2283    ) -> crate::ClientBuilderResult<Self> {
2284        let inner = Self::build_inner(config).await?;
2285        Ok(Self { inner })
2286    }
2287
2288    async fn build_inner(
2289        conf: gaxi::options::ClientConfig,
2290    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TagValues>> {
2291        if gaxi::options::tracing_enabled(&conf) {
2292            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2293        }
2294        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2295    }
2296
2297    async fn build_transport(
2298        conf: gaxi::options::ClientConfig,
2299    ) -> crate::ClientBuilderResult<impl super::stub::TagValues> {
2300        super::transport::TagValues::new(conf).await
2301    }
2302
2303    async fn build_with_tracing(
2304        conf: gaxi::options::ClientConfig,
2305    ) -> crate::ClientBuilderResult<impl super::stub::TagValues> {
2306        Self::build_transport(conf)
2307            .await
2308            .map(super::tracing::TagValues::new)
2309    }
2310
2311    /// Lists all TagValues for a specific TagKey.
2312    ///
2313    /// # Example
2314    /// ```
2315    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2316    /// use google_cloud_gax::paginator::ItemPaginator as _;
2317    /// use google_cloud_resourcemanager_v3::Result;
2318    /// async fn sample(
2319    ///    client: &TagValues, parent: &str
2320    /// ) -> Result<()> {
2321    ///     let mut list = client.list_tag_values()
2322    ///         .set_parent(parent)
2323    ///         .by_item();
2324    ///     while let Some(item) = list.next().await.transpose()? {
2325    ///         println!("{:?}", item);
2326    ///     }
2327    ///     Ok(())
2328    /// }
2329    /// ```
2330    pub fn list_tag_values(&self) -> super::builder::tag_values::ListTagValues {
2331        super::builder::tag_values::ListTagValues::new(self.inner.clone())
2332    }
2333
2334    /// Retrieves a TagValue. This method will return `PERMISSION_DENIED` if the
2335    /// value does not exist or the user does not have permission to view it.
2336    ///
2337    /// # Example
2338    /// ```
2339    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2340    /// use google_cloud_resourcemanager_v3::Result;
2341    /// async fn sample(
2342    ///    client: &TagValues, tag_value_id: &str
2343    /// ) -> Result<()> {
2344    ///     let response = client.get_tag_value()
2345    ///         .set_name(format!("tagValues/{tag_value_id}"))
2346    ///         .send().await?;
2347    ///     println!("response {:?}", response);
2348    ///     Ok(())
2349    /// }
2350    /// ```
2351    pub fn get_tag_value(&self) -> super::builder::tag_values::GetTagValue {
2352        super::builder::tag_values::GetTagValue::new(self.inner.clone())
2353    }
2354
2355    /// Retrieves a TagValue by its namespaced name.
2356    /// This method will return `PERMISSION_DENIED` if the value does not exist
2357    /// or the user does not have permission to view it.
2358    ///
2359    /// # Example
2360    /// ```
2361    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2362    /// use google_cloud_resourcemanager_v3::Result;
2363    /// async fn sample(
2364    ///    client: &TagValues, tag_value_id: &str
2365    /// ) -> Result<()> {
2366    ///     let response = client.get_namespaced_tag_value()
2367    ///         .set_name(format!("tagValues/{tag_value_id}"))
2368    ///         .send().await?;
2369    ///     println!("response {:?}", response);
2370    ///     Ok(())
2371    /// }
2372    /// ```
2373    pub fn get_namespaced_tag_value(&self) -> super::builder::tag_values::GetNamespacedTagValue {
2374        super::builder::tag_values::GetNamespacedTagValue::new(self.inner.clone())
2375    }
2376
2377    /// Creates a TagValue as a child of the specified TagKey. If a another
2378    /// request with the same parameters is sent while the original request is in
2379    /// process the second request will receive an error. A maximum of 1000
2380    /// TagValues can exist under a TagKey at any given time.
2381    ///
2382    /// # Long running operations
2383    ///
2384    /// This method is used to start, and/or poll a [long-running Operation].
2385    /// The [Working with long-running operations] chapter in the [user guide]
2386    /// covers these operations in detail.
2387    ///
2388    /// [long-running operation]: https://google.aip.dev/151
2389    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2390    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2391    ///
2392    /// # Example
2393    /// ```
2394    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2395    /// use google_cloud_lro::Poller;
2396    /// use google_cloud_resourcemanager_v3::Result;
2397    /// async fn sample(
2398    ///    client: &TagValues
2399    /// ) -> Result<()> {
2400    ///     let response = client.create_tag_value()
2401    ///         /* set fields */
2402    ///         .poller().until_done().await?;
2403    ///     println!("response {:?}", response);
2404    ///     Ok(())
2405    /// }
2406    /// ```
2407    pub fn create_tag_value(&self) -> super::builder::tag_values::CreateTagValue {
2408        super::builder::tag_values::CreateTagValue::new(self.inner.clone())
2409    }
2410
2411    /// Updates the attributes of the TagValue resource.
2412    ///
2413    /// # Long running operations
2414    ///
2415    /// This method is used to start, and/or poll a [long-running Operation].
2416    /// The [Working with long-running operations] chapter in the [user guide]
2417    /// covers these operations in detail.
2418    ///
2419    /// [long-running operation]: https://google.aip.dev/151
2420    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2421    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2422    ///
2423    /// # Example
2424    /// ```
2425    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2426    /// use google_cloud_lro::Poller;
2427    /// # extern crate wkt as google_cloud_wkt;
2428    /// use google_cloud_wkt::FieldMask;
2429    /// use google_cloud_resourcemanager_v3::model::TagValue;
2430    /// use google_cloud_resourcemanager_v3::Result;
2431    /// async fn sample(
2432    ///    client: &TagValues, tag_value_id: &str
2433    /// ) -> Result<()> {
2434    ///     let response = client.update_tag_value()
2435    ///         .set_tag_value(
2436    ///             TagValue::new().set_name(format!("tagValues/{tag_value_id}"))/* set fields */
2437    ///         )
2438    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2439    ///         .poller().until_done().await?;
2440    ///     println!("response {:?}", response);
2441    ///     Ok(())
2442    /// }
2443    /// ```
2444    pub fn update_tag_value(&self) -> super::builder::tag_values::UpdateTagValue {
2445        super::builder::tag_values::UpdateTagValue::new(self.inner.clone())
2446    }
2447
2448    /// Deletes a TagValue. The TagValue cannot have any bindings when it is
2449    /// deleted.
2450    ///
2451    /// # Long running operations
2452    ///
2453    /// This method is used to start, and/or poll a [long-running Operation].
2454    /// The [Working with long-running operations] chapter in the [user guide]
2455    /// covers these operations in detail.
2456    ///
2457    /// [long-running operation]: https://google.aip.dev/151
2458    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2459    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2460    ///
2461    /// # Example
2462    /// ```
2463    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2464    /// use google_cloud_lro::Poller;
2465    /// use google_cloud_resourcemanager_v3::Result;
2466    /// async fn sample(
2467    ///    client: &TagValues, tag_value_id: &str
2468    /// ) -> Result<()> {
2469    ///     let response = client.delete_tag_value()
2470    ///         .set_name(format!("tagValues/{tag_value_id}"))
2471    ///         .poller().until_done().await?;
2472    ///     println!("response {:?}", response);
2473    ///     Ok(())
2474    /// }
2475    /// ```
2476    pub fn delete_tag_value(&self) -> super::builder::tag_values::DeleteTagValue {
2477        super::builder::tag_values::DeleteTagValue::new(self.inner.clone())
2478    }
2479
2480    /// Gets the access control policy for a TagValue. The returned policy may be
2481    /// empty if no such policy or resource exists. The `resource` field should
2482    /// be the TagValue's resource name. For example: `tagValues/1234`.
2483    /// The caller must have the
2484    /// `cloudresourcemanager.googleapis.com/tagValues.getIamPolicy` permission on
2485    /// the identified TagValue to get the access control policy.
2486    ///
2487    /// # Example
2488    /// ```
2489    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2490    /// use google_cloud_resourcemanager_v3::Result;
2491    /// async fn sample(
2492    ///    client: &TagValues
2493    /// ) -> Result<()> {
2494    ///     let response = client.get_iam_policy()
2495    ///         /* set fields */
2496    ///         .send().await?;
2497    ///     println!("response {:?}", response);
2498    ///     Ok(())
2499    /// }
2500    /// ```
2501    pub fn get_iam_policy(&self) -> super::builder::tag_values::GetIamPolicy {
2502        super::builder::tag_values::GetIamPolicy::new(self.inner.clone())
2503    }
2504
2505    /// Sets the access control policy on a TagValue, replacing any existing
2506    /// policy. The `resource` field should be the TagValue's resource name.
2507    /// For example: `tagValues/1234`.
2508    /// The caller must have `resourcemanager.tagValues.setIamPolicy` permission
2509    /// on the identified tagValue.
2510    ///
2511    /// # Example
2512    /// ```
2513    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2514    /// use google_cloud_resourcemanager_v3::Result;
2515    /// async fn sample(
2516    ///    client: &TagValues
2517    /// ) -> Result<()> {
2518    ///     let response = client.set_iam_policy()
2519    ///         /* set fields */
2520    ///         .send().await?;
2521    ///     println!("response {:?}", response);
2522    ///     Ok(())
2523    /// }
2524    /// ```
2525    pub fn set_iam_policy(&self) -> super::builder::tag_values::SetIamPolicy {
2526        super::builder::tag_values::SetIamPolicy::new(self.inner.clone())
2527    }
2528
2529    /// Returns permissions that a caller has on the specified TagValue.
2530    /// The `resource` field should be the TagValue's resource name. For example:
2531    /// `tagValues/1234`.
2532    ///
2533    /// There are no permissions required for making this API call.
2534    ///
2535    /// # Example
2536    /// ```
2537    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2538    /// use google_cloud_resourcemanager_v3::Result;
2539    /// async fn sample(
2540    ///    client: &TagValues
2541    /// ) -> Result<()> {
2542    ///     let response = client.test_iam_permissions()
2543    ///         /* set fields */
2544    ///         .send().await?;
2545    ///     println!("response {:?}", response);
2546    ///     Ok(())
2547    /// }
2548    /// ```
2549    pub fn test_iam_permissions(&self) -> super::builder::tag_values::TestIamPermissions {
2550        super::builder::tag_values::TestIamPermissions::new(self.inner.clone())
2551    }
2552
2553    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2554    ///
2555    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2556    ///
2557    /// # Example
2558    /// ```
2559    /// # use google_cloud_resourcemanager_v3::client::TagValues;
2560    /// use google_cloud_resourcemanager_v3::Result;
2561    /// async fn sample(
2562    ///    client: &TagValues
2563    /// ) -> Result<()> {
2564    ///     let response = client.get_operation()
2565    ///         /* set fields */
2566    ///         .send().await?;
2567    ///     println!("response {:?}", response);
2568    ///     Ok(())
2569    /// }
2570    /// ```
2571    pub fn get_operation(&self) -> super::builder::tag_values::GetOperation {
2572        super::builder::tag_values::GetOperation::new(self.inner.clone())
2573    }
2574}