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