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