google_cloud_resourcemanager_v3/
builder.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
17pub mod folders {
18    use crate::Result;
19
20    /// A builder for [Folders][crate::client::Folders].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_resourcemanager_v3::*;
25    /// # use builder::folders::ClientBuilder;
26    /// # use client::Folders;
27    /// let builder : ClientBuilder = Folders::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://cloudresourcemanager.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::Folders;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = Folders;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::Folders] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
64            Self {
65                stub,
66                request: R::default(),
67                options: gax::options::RequestOptions::default(),
68            }
69        }
70    }
71
72    /// The request builder for [Folders::get_folder][crate::client::Folders::get_folder] calls.
73    ///
74    /// # Example
75    /// ```
76    /// # use google_cloud_resourcemanager_v3::builder::folders::GetFolder;
77    /// # async fn sample() -> gax::Result<()> {
78    ///
79    /// let builder = prepare_request_builder();
80    /// let response = builder.send().await?;
81    /// # Ok(()) }
82    ///
83    /// fn prepare_request_builder() -> GetFolder {
84    ///   # panic!();
85    ///   // ... details omitted ...
86    /// }
87    /// ```
88    #[derive(Clone, Debug)]
89    pub struct GetFolder(RequestBuilder<crate::model::GetFolderRequest>);
90
91    impl GetFolder {
92        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
93            Self(RequestBuilder::new(stub))
94        }
95
96        /// Sets the full request, replacing any prior values.
97        pub fn with_request<V: Into<crate::model::GetFolderRequest>>(mut self, v: V) -> Self {
98            self.0.request = v.into();
99            self
100        }
101
102        /// Sets all the options, replacing any prior values.
103        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
104            self.0.options = v.into();
105            self
106        }
107
108        /// Sends the request.
109        pub async fn send(self) -> Result<crate::model::Folder> {
110            (*self.0.stub)
111                .get_folder(self.0.request, self.0.options)
112                .await
113                .map(gax::response::Response::into_body)
114        }
115
116        /// Sets the value of [name][crate::model::GetFolderRequest::name].
117        ///
118        /// This is a **required** field for requests.
119        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
120            self.0.request.name = v.into();
121            self
122        }
123    }
124
125    #[doc(hidden)]
126    impl gax::options::internal::RequestBuilder for GetFolder {
127        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
128            &mut self.0.options
129        }
130    }
131
132    /// The request builder for [Folders::list_folders][crate::client::Folders::list_folders] calls.
133    ///
134    /// # Example
135    /// ```
136    /// # use google_cloud_resourcemanager_v3::builder::folders::ListFolders;
137    /// # async fn sample() -> gax::Result<()> {
138    /// use gax::paginator::ItemPaginator;
139    ///
140    /// let builder = prepare_request_builder();
141    /// let mut items = builder.by_item();
142    /// while let Some(result) = items.next().await {
143    ///   let item = result?;
144    /// }
145    /// # Ok(()) }
146    ///
147    /// fn prepare_request_builder() -> ListFolders {
148    ///   # panic!();
149    ///   // ... details omitted ...
150    /// }
151    /// ```
152    #[derive(Clone, Debug)]
153    pub struct ListFolders(RequestBuilder<crate::model::ListFoldersRequest>);
154
155    impl ListFolders {
156        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
157            Self(RequestBuilder::new(stub))
158        }
159
160        /// Sets the full request, replacing any prior values.
161        pub fn with_request<V: Into<crate::model::ListFoldersRequest>>(mut self, v: V) -> Self {
162            self.0.request = v.into();
163            self
164        }
165
166        /// Sets all the options, replacing any prior values.
167        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
168            self.0.options = v.into();
169            self
170        }
171
172        /// Sends the request.
173        pub async fn send(self) -> Result<crate::model::ListFoldersResponse> {
174            (*self.0.stub)
175                .list_folders(self.0.request, self.0.options)
176                .await
177                .map(gax::response::Response::into_body)
178        }
179
180        /// Streams each page in the collection.
181        pub fn by_page(
182            self,
183        ) -> impl gax::paginator::Paginator<crate::model::ListFoldersResponse, gax::error::Error>
184        {
185            use std::clone::Clone;
186            let token = self.0.request.page_token.clone();
187            let execute = move |token: String| {
188                let mut builder = self.clone();
189                builder.0.request = builder.0.request.set_page_token(token);
190                builder.send()
191            };
192            gax::paginator::internal::new_paginator(token, execute)
193        }
194
195        /// Streams each item in the collection.
196        pub fn by_item(
197            self,
198        ) -> impl gax::paginator::ItemPaginator<crate::model::ListFoldersResponse, gax::error::Error>
199        {
200            use gax::paginator::Paginator;
201            self.by_page().items()
202        }
203
204        /// Sets the value of [parent][crate::model::ListFoldersRequest::parent].
205        ///
206        /// This is a **required** field for requests.
207        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
208            self.0.request.parent = v.into();
209            self
210        }
211
212        /// Sets the value of [page_size][crate::model::ListFoldersRequest::page_size].
213        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
214            self.0.request.page_size = v.into();
215            self
216        }
217
218        /// Sets the value of [page_token][crate::model::ListFoldersRequest::page_token].
219        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
220            self.0.request.page_token = v.into();
221            self
222        }
223
224        /// Sets the value of [show_deleted][crate::model::ListFoldersRequest::show_deleted].
225        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
226            self.0.request.show_deleted = v.into();
227            self
228        }
229    }
230
231    #[doc(hidden)]
232    impl gax::options::internal::RequestBuilder for ListFolders {
233        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
234            &mut self.0.options
235        }
236    }
237
238    /// The request builder for [Folders::search_folders][crate::client::Folders::search_folders] calls.
239    ///
240    /// # Example
241    /// ```
242    /// # use google_cloud_resourcemanager_v3::builder::folders::SearchFolders;
243    /// # async fn sample() -> gax::Result<()> {
244    /// use gax::paginator::ItemPaginator;
245    ///
246    /// let builder = prepare_request_builder();
247    /// let mut items = builder.by_item();
248    /// while let Some(result) = items.next().await {
249    ///   let item = result?;
250    /// }
251    /// # Ok(()) }
252    ///
253    /// fn prepare_request_builder() -> SearchFolders {
254    ///   # panic!();
255    ///   // ... details omitted ...
256    /// }
257    /// ```
258    #[derive(Clone, Debug)]
259    pub struct SearchFolders(RequestBuilder<crate::model::SearchFoldersRequest>);
260
261    impl SearchFolders {
262        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
263            Self(RequestBuilder::new(stub))
264        }
265
266        /// Sets the full request, replacing any prior values.
267        pub fn with_request<V: Into<crate::model::SearchFoldersRequest>>(mut self, v: V) -> Self {
268            self.0.request = v.into();
269            self
270        }
271
272        /// Sets all the options, replacing any prior values.
273        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
274            self.0.options = v.into();
275            self
276        }
277
278        /// Sends the request.
279        pub async fn send(self) -> Result<crate::model::SearchFoldersResponse> {
280            (*self.0.stub)
281                .search_folders(self.0.request, self.0.options)
282                .await
283                .map(gax::response::Response::into_body)
284        }
285
286        /// Streams each page in the collection.
287        pub fn by_page(
288            self,
289        ) -> impl gax::paginator::Paginator<crate::model::SearchFoldersResponse, gax::error::Error>
290        {
291            use std::clone::Clone;
292            let token = self.0.request.page_token.clone();
293            let execute = move |token: String| {
294                let mut builder = self.clone();
295                builder.0.request = builder.0.request.set_page_token(token);
296                builder.send()
297            };
298            gax::paginator::internal::new_paginator(token, execute)
299        }
300
301        /// Streams each item in the collection.
302        pub fn by_item(
303            self,
304        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchFoldersResponse, gax::error::Error>
305        {
306            use gax::paginator::Paginator;
307            self.by_page().items()
308        }
309
310        /// Sets the value of [page_size][crate::model::SearchFoldersRequest::page_size].
311        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
312            self.0.request.page_size = v.into();
313            self
314        }
315
316        /// Sets the value of [page_token][crate::model::SearchFoldersRequest::page_token].
317        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
318            self.0.request.page_token = v.into();
319            self
320        }
321
322        /// Sets the value of [query][crate::model::SearchFoldersRequest::query].
323        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
324            self.0.request.query = v.into();
325            self
326        }
327    }
328
329    #[doc(hidden)]
330    impl gax::options::internal::RequestBuilder for SearchFolders {
331        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
332            &mut self.0.options
333        }
334    }
335
336    /// The request builder for [Folders::create_folder][crate::client::Folders::create_folder] calls.
337    ///
338    /// # Example
339    /// ```
340    /// # use google_cloud_resourcemanager_v3::builder::folders::CreateFolder;
341    /// # async fn sample() -> gax::Result<()> {
342    /// use lro::Poller;
343    ///
344    /// let builder = prepare_request_builder();
345    /// let response = builder.poller().until_done().await?;
346    /// # Ok(()) }
347    ///
348    /// fn prepare_request_builder() -> CreateFolder {
349    ///   # panic!();
350    ///   // ... details omitted ...
351    /// }
352    /// ```
353    #[derive(Clone, Debug)]
354    pub struct CreateFolder(RequestBuilder<crate::model::CreateFolderRequest>);
355
356    impl CreateFolder {
357        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
358            Self(RequestBuilder::new(stub))
359        }
360
361        /// Sets the full request, replacing any prior values.
362        pub fn with_request<V: Into<crate::model::CreateFolderRequest>>(mut self, v: V) -> Self {
363            self.0.request = v.into();
364            self
365        }
366
367        /// Sets all the options, replacing any prior values.
368        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
369            self.0.options = v.into();
370            self
371        }
372
373        /// Sends the request.
374        ///
375        /// # Long running operations
376        ///
377        /// This starts, but does not poll, a longrunning operation. More information
378        /// on [create_folder][crate::client::Folders::create_folder].
379        pub async fn send(self) -> Result<longrunning::model::Operation> {
380            (*self.0.stub)
381                .create_folder(self.0.request, self.0.options)
382                .await
383                .map(gax::response::Response::into_body)
384        }
385
386        /// Creates a [Poller][lro::Poller] to work with `create_folder`.
387        pub fn poller(
388            self,
389        ) -> impl lro::Poller<crate::model::Folder, crate::model::CreateFolderMetadata> {
390            type Operation =
391                lro::internal::Operation<crate::model::Folder, crate::model::CreateFolderMetadata>;
392            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
393            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
394
395            let stub = self.0.stub.clone();
396            let mut options = self.0.options.clone();
397            options.set_retry_policy(gax::retry_policy::NeverRetry);
398            let query = move |name| {
399                let stub = stub.clone();
400                let options = options.clone();
401                async {
402                    let op = GetOperation::new(stub)
403                        .set_name(name)
404                        .with_options(options)
405                        .send()
406                        .await?;
407                    Ok(Operation::new(op))
408                }
409            };
410
411            let start = move || async {
412                let op = self.send().await?;
413                Ok(Operation::new(op))
414            };
415
416            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
417        }
418
419        /// Sets the value of [folder][crate::model::CreateFolderRequest::folder].
420        ///
421        /// This is a **required** field for requests.
422        pub fn set_folder<T>(mut self, v: T) -> Self
423        where
424            T: std::convert::Into<crate::model::Folder>,
425        {
426            self.0.request.folder = std::option::Option::Some(v.into());
427            self
428        }
429
430        /// Sets or clears the value of [folder][crate::model::CreateFolderRequest::folder].
431        ///
432        /// This is a **required** field for requests.
433        pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
434        where
435            T: std::convert::Into<crate::model::Folder>,
436        {
437            self.0.request.folder = v.map(|x| x.into());
438            self
439        }
440    }
441
442    #[doc(hidden)]
443    impl gax::options::internal::RequestBuilder for CreateFolder {
444        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
445            &mut self.0.options
446        }
447    }
448
449    /// The request builder for [Folders::update_folder][crate::client::Folders::update_folder] calls.
450    ///
451    /// # Example
452    /// ```
453    /// # use google_cloud_resourcemanager_v3::builder::folders::UpdateFolder;
454    /// # async fn sample() -> gax::Result<()> {
455    /// use lro::Poller;
456    ///
457    /// let builder = prepare_request_builder();
458    /// let response = builder.poller().until_done().await?;
459    /// # Ok(()) }
460    ///
461    /// fn prepare_request_builder() -> UpdateFolder {
462    ///   # panic!();
463    ///   // ... details omitted ...
464    /// }
465    /// ```
466    #[derive(Clone, Debug)]
467    pub struct UpdateFolder(RequestBuilder<crate::model::UpdateFolderRequest>);
468
469    impl UpdateFolder {
470        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
471            Self(RequestBuilder::new(stub))
472        }
473
474        /// Sets the full request, replacing any prior values.
475        pub fn with_request<V: Into<crate::model::UpdateFolderRequest>>(mut self, v: V) -> Self {
476            self.0.request = v.into();
477            self
478        }
479
480        /// Sets all the options, replacing any prior values.
481        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
482            self.0.options = v.into();
483            self
484        }
485
486        /// Sends the request.
487        ///
488        /// # Long running operations
489        ///
490        /// This starts, but does not poll, a longrunning operation. More information
491        /// on [update_folder][crate::client::Folders::update_folder].
492        pub async fn send(self) -> Result<longrunning::model::Operation> {
493            (*self.0.stub)
494                .update_folder(self.0.request, self.0.options)
495                .await
496                .map(gax::response::Response::into_body)
497        }
498
499        /// Creates a [Poller][lro::Poller] to work with `update_folder`.
500        pub fn poller(
501            self,
502        ) -> impl lro::Poller<crate::model::Folder, crate::model::UpdateFolderMetadata> {
503            type Operation =
504                lro::internal::Operation<crate::model::Folder, crate::model::UpdateFolderMetadata>;
505            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
506            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
507
508            let stub = self.0.stub.clone();
509            let mut options = self.0.options.clone();
510            options.set_retry_policy(gax::retry_policy::NeverRetry);
511            let query = move |name| {
512                let stub = stub.clone();
513                let options = options.clone();
514                async {
515                    let op = GetOperation::new(stub)
516                        .set_name(name)
517                        .with_options(options)
518                        .send()
519                        .await?;
520                    Ok(Operation::new(op))
521                }
522            };
523
524            let start = move || async {
525                let op = self.send().await?;
526                Ok(Operation::new(op))
527            };
528
529            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
530        }
531
532        /// Sets the value of [folder][crate::model::UpdateFolderRequest::folder].
533        ///
534        /// This is a **required** field for requests.
535        pub fn set_folder<T>(mut self, v: T) -> Self
536        where
537            T: std::convert::Into<crate::model::Folder>,
538        {
539            self.0.request.folder = std::option::Option::Some(v.into());
540            self
541        }
542
543        /// Sets or clears the value of [folder][crate::model::UpdateFolderRequest::folder].
544        ///
545        /// This is a **required** field for requests.
546        pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
547        where
548            T: std::convert::Into<crate::model::Folder>,
549        {
550            self.0.request.folder = v.map(|x| x.into());
551            self
552        }
553
554        /// Sets the value of [update_mask][crate::model::UpdateFolderRequest::update_mask].
555        ///
556        /// This is a **required** field for requests.
557        pub fn set_update_mask<T>(mut self, v: T) -> Self
558        where
559            T: std::convert::Into<wkt::FieldMask>,
560        {
561            self.0.request.update_mask = std::option::Option::Some(v.into());
562            self
563        }
564
565        /// Sets or clears the value of [update_mask][crate::model::UpdateFolderRequest::update_mask].
566        ///
567        /// This is a **required** field for requests.
568        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
569        where
570            T: std::convert::Into<wkt::FieldMask>,
571        {
572            self.0.request.update_mask = v.map(|x| x.into());
573            self
574        }
575    }
576
577    #[doc(hidden)]
578    impl gax::options::internal::RequestBuilder for UpdateFolder {
579        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
580            &mut self.0.options
581        }
582    }
583
584    /// The request builder for [Folders::move_folder][crate::client::Folders::move_folder] calls.
585    ///
586    /// # Example
587    /// ```
588    /// # use google_cloud_resourcemanager_v3::builder::folders::MoveFolder;
589    /// # async fn sample() -> gax::Result<()> {
590    /// use lro::Poller;
591    ///
592    /// let builder = prepare_request_builder();
593    /// let response = builder.poller().until_done().await?;
594    /// # Ok(()) }
595    ///
596    /// fn prepare_request_builder() -> MoveFolder {
597    ///   # panic!();
598    ///   // ... details omitted ...
599    /// }
600    /// ```
601    #[derive(Clone, Debug)]
602    pub struct MoveFolder(RequestBuilder<crate::model::MoveFolderRequest>);
603
604    impl MoveFolder {
605        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
606            Self(RequestBuilder::new(stub))
607        }
608
609        /// Sets the full request, replacing any prior values.
610        pub fn with_request<V: Into<crate::model::MoveFolderRequest>>(mut self, v: V) -> Self {
611            self.0.request = v.into();
612            self
613        }
614
615        /// Sets all the options, replacing any prior values.
616        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
617            self.0.options = v.into();
618            self
619        }
620
621        /// Sends the request.
622        ///
623        /// # Long running operations
624        ///
625        /// This starts, but does not poll, a longrunning operation. More information
626        /// on [move_folder][crate::client::Folders::move_folder].
627        pub async fn send(self) -> Result<longrunning::model::Operation> {
628            (*self.0.stub)
629                .move_folder(self.0.request, self.0.options)
630                .await
631                .map(gax::response::Response::into_body)
632        }
633
634        /// Creates a [Poller][lro::Poller] to work with `move_folder`.
635        pub fn poller(
636            self,
637        ) -> impl lro::Poller<crate::model::Folder, crate::model::MoveFolderMetadata> {
638            type Operation =
639                lro::internal::Operation<crate::model::Folder, crate::model::MoveFolderMetadata>;
640            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
641            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
642
643            let stub = self.0.stub.clone();
644            let mut options = self.0.options.clone();
645            options.set_retry_policy(gax::retry_policy::NeverRetry);
646            let query = move |name| {
647                let stub = stub.clone();
648                let options = options.clone();
649                async {
650                    let op = GetOperation::new(stub)
651                        .set_name(name)
652                        .with_options(options)
653                        .send()
654                        .await?;
655                    Ok(Operation::new(op))
656                }
657            };
658
659            let start = move || async {
660                let op = self.send().await?;
661                Ok(Operation::new(op))
662            };
663
664            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
665        }
666
667        /// Sets the value of [name][crate::model::MoveFolderRequest::name].
668        ///
669        /// This is a **required** field for requests.
670        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
671            self.0.request.name = v.into();
672            self
673        }
674
675        /// Sets the value of [destination_parent][crate::model::MoveFolderRequest::destination_parent].
676        ///
677        /// This is a **required** field for requests.
678        pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
679            self.0.request.destination_parent = v.into();
680            self
681        }
682    }
683
684    #[doc(hidden)]
685    impl gax::options::internal::RequestBuilder for MoveFolder {
686        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
687            &mut self.0.options
688        }
689    }
690
691    /// The request builder for [Folders::delete_folder][crate::client::Folders::delete_folder] calls.
692    ///
693    /// # Example
694    /// ```
695    /// # use google_cloud_resourcemanager_v3::builder::folders::DeleteFolder;
696    /// # async fn sample() -> gax::Result<()> {
697    /// use lro::Poller;
698    ///
699    /// let builder = prepare_request_builder();
700    /// let response = builder.poller().until_done().await?;
701    /// # Ok(()) }
702    ///
703    /// fn prepare_request_builder() -> DeleteFolder {
704    ///   # panic!();
705    ///   // ... details omitted ...
706    /// }
707    /// ```
708    #[derive(Clone, Debug)]
709    pub struct DeleteFolder(RequestBuilder<crate::model::DeleteFolderRequest>);
710
711    impl DeleteFolder {
712        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
713            Self(RequestBuilder::new(stub))
714        }
715
716        /// Sets the full request, replacing any prior values.
717        pub fn with_request<V: Into<crate::model::DeleteFolderRequest>>(mut self, v: V) -> Self {
718            self.0.request = v.into();
719            self
720        }
721
722        /// Sets all the options, replacing any prior values.
723        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
724            self.0.options = v.into();
725            self
726        }
727
728        /// Sends the request.
729        ///
730        /// # Long running operations
731        ///
732        /// This starts, but does not poll, a longrunning operation. More information
733        /// on [delete_folder][crate::client::Folders::delete_folder].
734        pub async fn send(self) -> Result<longrunning::model::Operation> {
735            (*self.0.stub)
736                .delete_folder(self.0.request, self.0.options)
737                .await
738                .map(gax::response::Response::into_body)
739        }
740
741        /// Creates a [Poller][lro::Poller] to work with `delete_folder`.
742        pub fn poller(
743            self,
744        ) -> impl lro::Poller<crate::model::Folder, crate::model::DeleteFolderMetadata> {
745            type Operation =
746                lro::internal::Operation<crate::model::Folder, crate::model::DeleteFolderMetadata>;
747            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
748            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
749
750            let stub = self.0.stub.clone();
751            let mut options = self.0.options.clone();
752            options.set_retry_policy(gax::retry_policy::NeverRetry);
753            let query = move |name| {
754                let stub = stub.clone();
755                let options = options.clone();
756                async {
757                    let op = GetOperation::new(stub)
758                        .set_name(name)
759                        .with_options(options)
760                        .send()
761                        .await?;
762                    Ok(Operation::new(op))
763                }
764            };
765
766            let start = move || async {
767                let op = self.send().await?;
768                Ok(Operation::new(op))
769            };
770
771            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
772        }
773
774        /// Sets the value of [name][crate::model::DeleteFolderRequest::name].
775        ///
776        /// This is a **required** field for requests.
777        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
778            self.0.request.name = v.into();
779            self
780        }
781    }
782
783    #[doc(hidden)]
784    impl gax::options::internal::RequestBuilder for DeleteFolder {
785        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
786            &mut self.0.options
787        }
788    }
789
790    /// The request builder for [Folders::undelete_folder][crate::client::Folders::undelete_folder] calls.
791    ///
792    /// # Example
793    /// ```
794    /// # use google_cloud_resourcemanager_v3::builder::folders::UndeleteFolder;
795    /// # async fn sample() -> gax::Result<()> {
796    /// use lro::Poller;
797    ///
798    /// let builder = prepare_request_builder();
799    /// let response = builder.poller().until_done().await?;
800    /// # Ok(()) }
801    ///
802    /// fn prepare_request_builder() -> UndeleteFolder {
803    ///   # panic!();
804    ///   // ... details omitted ...
805    /// }
806    /// ```
807    #[derive(Clone, Debug)]
808    pub struct UndeleteFolder(RequestBuilder<crate::model::UndeleteFolderRequest>);
809
810    impl UndeleteFolder {
811        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
812            Self(RequestBuilder::new(stub))
813        }
814
815        /// Sets the full request, replacing any prior values.
816        pub fn with_request<V: Into<crate::model::UndeleteFolderRequest>>(mut self, v: V) -> Self {
817            self.0.request = v.into();
818            self
819        }
820
821        /// Sets all the options, replacing any prior values.
822        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
823            self.0.options = v.into();
824            self
825        }
826
827        /// Sends the request.
828        ///
829        /// # Long running operations
830        ///
831        /// This starts, but does not poll, a longrunning operation. More information
832        /// on [undelete_folder][crate::client::Folders::undelete_folder].
833        pub async fn send(self) -> Result<longrunning::model::Operation> {
834            (*self.0.stub)
835                .undelete_folder(self.0.request, self.0.options)
836                .await
837                .map(gax::response::Response::into_body)
838        }
839
840        /// Creates a [Poller][lro::Poller] to work with `undelete_folder`.
841        pub fn poller(
842            self,
843        ) -> impl lro::Poller<crate::model::Folder, crate::model::UndeleteFolderMetadata> {
844            type Operation = lro::internal::Operation<
845                crate::model::Folder,
846                crate::model::UndeleteFolderMetadata,
847            >;
848            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
849            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
850
851            let stub = self.0.stub.clone();
852            let mut options = self.0.options.clone();
853            options.set_retry_policy(gax::retry_policy::NeverRetry);
854            let query = move |name| {
855                let stub = stub.clone();
856                let options = options.clone();
857                async {
858                    let op = GetOperation::new(stub)
859                        .set_name(name)
860                        .with_options(options)
861                        .send()
862                        .await?;
863                    Ok(Operation::new(op))
864                }
865            };
866
867            let start = move || async {
868                let op = self.send().await?;
869                Ok(Operation::new(op))
870            };
871
872            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
873        }
874
875        /// Sets the value of [name][crate::model::UndeleteFolderRequest::name].
876        ///
877        /// This is a **required** field for requests.
878        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
879            self.0.request.name = v.into();
880            self
881        }
882    }
883
884    #[doc(hidden)]
885    impl gax::options::internal::RequestBuilder for UndeleteFolder {
886        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
887            &mut self.0.options
888        }
889    }
890
891    /// The request builder for [Folders::get_iam_policy][crate::client::Folders::get_iam_policy] calls.
892    ///
893    /// # Example
894    /// ```
895    /// # use google_cloud_resourcemanager_v3::builder::folders::GetIamPolicy;
896    /// # async fn sample() -> gax::Result<()> {
897    ///
898    /// let builder = prepare_request_builder();
899    /// let response = builder.send().await?;
900    /// # Ok(()) }
901    ///
902    /// fn prepare_request_builder() -> GetIamPolicy {
903    ///   # panic!();
904    ///   // ... details omitted ...
905    /// }
906    /// ```
907    #[derive(Clone, Debug)]
908    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
909
910    impl GetIamPolicy {
911        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
912            Self(RequestBuilder::new(stub))
913        }
914
915        /// Sets the full request, replacing any prior values.
916        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
917            self.0.request = v.into();
918            self
919        }
920
921        /// Sets all the options, replacing any prior values.
922        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
923            self.0.options = v.into();
924            self
925        }
926
927        /// Sends the request.
928        pub async fn send(self) -> Result<iam_v1::model::Policy> {
929            (*self.0.stub)
930                .get_iam_policy(self.0.request, self.0.options)
931                .await
932                .map(gax::response::Response::into_body)
933        }
934
935        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
936        ///
937        /// This is a **required** field for requests.
938        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
939            self.0.request.resource = v.into();
940            self
941        }
942
943        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
944        pub fn set_options<T>(mut self, v: T) -> Self
945        where
946            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
947        {
948            self.0.request.options = std::option::Option::Some(v.into());
949            self
950        }
951
952        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
953        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
954        where
955            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
956        {
957            self.0.request.options = v.map(|x| x.into());
958            self
959        }
960    }
961
962    #[doc(hidden)]
963    impl gax::options::internal::RequestBuilder for GetIamPolicy {
964        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
965            &mut self.0.options
966        }
967    }
968
969    /// The request builder for [Folders::set_iam_policy][crate::client::Folders::set_iam_policy] calls.
970    ///
971    /// # Example
972    /// ```
973    /// # use google_cloud_resourcemanager_v3::builder::folders::SetIamPolicy;
974    /// # async fn sample() -> gax::Result<()> {
975    ///
976    /// let builder = prepare_request_builder();
977    /// let response = builder.send().await?;
978    /// # Ok(()) }
979    ///
980    /// fn prepare_request_builder() -> SetIamPolicy {
981    ///   # panic!();
982    ///   // ... details omitted ...
983    /// }
984    /// ```
985    #[derive(Clone, Debug)]
986    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
987
988    impl SetIamPolicy {
989        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
990            Self(RequestBuilder::new(stub))
991        }
992
993        /// Sets the full request, replacing any prior values.
994        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
995            self.0.request = v.into();
996            self
997        }
998
999        /// Sets all the options, replacing any prior values.
1000        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1001            self.0.options = v.into();
1002            self
1003        }
1004
1005        /// Sends the request.
1006        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1007            (*self.0.stub)
1008                .set_iam_policy(self.0.request, self.0.options)
1009                .await
1010                .map(gax::response::Response::into_body)
1011        }
1012
1013        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1014        ///
1015        /// This is a **required** field for requests.
1016        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1017            self.0.request.resource = v.into();
1018            self
1019        }
1020
1021        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1022        ///
1023        /// This is a **required** field for requests.
1024        pub fn set_policy<T>(mut self, v: T) -> Self
1025        where
1026            T: std::convert::Into<iam_v1::model::Policy>,
1027        {
1028            self.0.request.policy = std::option::Option::Some(v.into());
1029            self
1030        }
1031
1032        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1033        ///
1034        /// This is a **required** field for requests.
1035        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1036        where
1037            T: std::convert::Into<iam_v1::model::Policy>,
1038        {
1039            self.0.request.policy = v.map(|x| x.into());
1040            self
1041        }
1042
1043        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1044        pub fn set_update_mask<T>(mut self, v: T) -> Self
1045        where
1046            T: std::convert::Into<wkt::FieldMask>,
1047        {
1048            self.0.request.update_mask = std::option::Option::Some(v.into());
1049            self
1050        }
1051
1052        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1053        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1054        where
1055            T: std::convert::Into<wkt::FieldMask>,
1056        {
1057            self.0.request.update_mask = v.map(|x| x.into());
1058            self
1059        }
1060    }
1061
1062    #[doc(hidden)]
1063    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1064        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1065            &mut self.0.options
1066        }
1067    }
1068
1069    /// The request builder for [Folders::test_iam_permissions][crate::client::Folders::test_iam_permissions] calls.
1070    ///
1071    /// # Example
1072    /// ```
1073    /// # use google_cloud_resourcemanager_v3::builder::folders::TestIamPermissions;
1074    /// # async fn sample() -> gax::Result<()> {
1075    ///
1076    /// let builder = prepare_request_builder();
1077    /// let response = builder.send().await?;
1078    /// # Ok(()) }
1079    ///
1080    /// fn prepare_request_builder() -> TestIamPermissions {
1081    ///   # panic!();
1082    ///   // ... details omitted ...
1083    /// }
1084    /// ```
1085    #[derive(Clone, Debug)]
1086    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1087
1088    impl TestIamPermissions {
1089        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1090            Self(RequestBuilder::new(stub))
1091        }
1092
1093        /// Sets the full request, replacing any prior values.
1094        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1095            mut self,
1096            v: V,
1097        ) -> Self {
1098            self.0.request = v.into();
1099            self
1100        }
1101
1102        /// Sets all the options, replacing any prior values.
1103        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1104            self.0.options = v.into();
1105            self
1106        }
1107
1108        /// Sends the request.
1109        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1110            (*self.0.stub)
1111                .test_iam_permissions(self.0.request, self.0.options)
1112                .await
1113                .map(gax::response::Response::into_body)
1114        }
1115
1116        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1117        ///
1118        /// This is a **required** field for requests.
1119        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1120            self.0.request.resource = v.into();
1121            self
1122        }
1123
1124        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1125        ///
1126        /// This is a **required** field for requests.
1127        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1128        where
1129            T: std::iter::IntoIterator<Item = V>,
1130            V: std::convert::Into<std::string::String>,
1131        {
1132            use std::iter::Iterator;
1133            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1134            self
1135        }
1136    }
1137
1138    #[doc(hidden)]
1139    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1140        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1141            &mut self.0.options
1142        }
1143    }
1144
1145    /// The request builder for [Folders::get_operation][crate::client::Folders::get_operation] calls.
1146    ///
1147    /// # Example
1148    /// ```
1149    /// # use google_cloud_resourcemanager_v3::builder::folders::GetOperation;
1150    /// # async fn sample() -> gax::Result<()> {
1151    ///
1152    /// let builder = prepare_request_builder();
1153    /// let response = builder.send().await?;
1154    /// # Ok(()) }
1155    ///
1156    /// fn prepare_request_builder() -> GetOperation {
1157    ///   # panic!();
1158    ///   // ... details omitted ...
1159    /// }
1160    /// ```
1161    #[derive(Clone, Debug)]
1162    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1163
1164    impl GetOperation {
1165        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1166            Self(RequestBuilder::new(stub))
1167        }
1168
1169        /// Sets the full request, replacing any prior values.
1170        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1171            mut self,
1172            v: V,
1173        ) -> Self {
1174            self.0.request = v.into();
1175            self
1176        }
1177
1178        /// Sets all the options, replacing any prior values.
1179        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1180            self.0.options = v.into();
1181            self
1182        }
1183
1184        /// Sends the request.
1185        pub async fn send(self) -> Result<longrunning::model::Operation> {
1186            (*self.0.stub)
1187                .get_operation(self.0.request, self.0.options)
1188                .await
1189                .map(gax::response::Response::into_body)
1190        }
1191
1192        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1193        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1194            self.0.request.name = v.into();
1195            self
1196        }
1197    }
1198
1199    #[doc(hidden)]
1200    impl gax::options::internal::RequestBuilder for GetOperation {
1201        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1202            &mut self.0.options
1203        }
1204    }
1205}
1206
1207pub mod organizations {
1208    use crate::Result;
1209
1210    /// A builder for [Organizations][crate::client::Organizations].
1211    ///
1212    /// ```
1213    /// # async fn sample() -> gax::client_builder::Result<()> {
1214    /// # use google_cloud_resourcemanager_v3::*;
1215    /// # use builder::organizations::ClientBuilder;
1216    /// # use client::Organizations;
1217    /// let builder : ClientBuilder = Organizations::builder();
1218    /// let client = builder
1219    ///     .with_endpoint("https://cloudresourcemanager.googleapis.com")
1220    ///     .build().await?;
1221    /// # Ok(()) }
1222    /// ```
1223    pub type ClientBuilder =
1224        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1225
1226    pub(crate) mod client {
1227        use super::super::super::client::Organizations;
1228        pub struct Factory;
1229        impl gax::client_builder::internal::ClientFactory for Factory {
1230            type Client = Organizations;
1231            type Credentials = gaxi::options::Credentials;
1232            async fn build(
1233                self,
1234                config: gaxi::options::ClientConfig,
1235            ) -> gax::client_builder::Result<Self::Client> {
1236                Self::Client::new(config).await
1237            }
1238        }
1239    }
1240
1241    /// Common implementation for [crate::client::Organizations] request builders.
1242    #[derive(Clone, Debug)]
1243    pub(crate) struct RequestBuilder<R: std::default::Default> {
1244        stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1245        request: R,
1246        options: gax::options::RequestOptions,
1247    }
1248
1249    impl<R> RequestBuilder<R>
1250    where
1251        R: std::default::Default,
1252    {
1253        pub(crate) fn new(
1254            stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1255        ) -> Self {
1256            Self {
1257                stub,
1258                request: R::default(),
1259                options: gax::options::RequestOptions::default(),
1260            }
1261        }
1262    }
1263
1264    /// The request builder for [Organizations::get_organization][crate::client::Organizations::get_organization] calls.
1265    ///
1266    /// # Example
1267    /// ```
1268    /// # use google_cloud_resourcemanager_v3::builder::organizations::GetOrganization;
1269    /// # async fn sample() -> gax::Result<()> {
1270    ///
1271    /// let builder = prepare_request_builder();
1272    /// let response = builder.send().await?;
1273    /// # Ok(()) }
1274    ///
1275    /// fn prepare_request_builder() -> GetOrganization {
1276    ///   # panic!();
1277    ///   // ... details omitted ...
1278    /// }
1279    /// ```
1280    #[derive(Clone, Debug)]
1281    pub struct GetOrganization(RequestBuilder<crate::model::GetOrganizationRequest>);
1282
1283    impl GetOrganization {
1284        pub(crate) fn new(
1285            stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1286        ) -> Self {
1287            Self(RequestBuilder::new(stub))
1288        }
1289
1290        /// Sets the full request, replacing any prior values.
1291        pub fn with_request<V: Into<crate::model::GetOrganizationRequest>>(mut self, v: V) -> Self {
1292            self.0.request = v.into();
1293            self
1294        }
1295
1296        /// Sets all the options, replacing any prior values.
1297        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1298            self.0.options = v.into();
1299            self
1300        }
1301
1302        /// Sends the request.
1303        pub async fn send(self) -> Result<crate::model::Organization> {
1304            (*self.0.stub)
1305                .get_organization(self.0.request, self.0.options)
1306                .await
1307                .map(gax::response::Response::into_body)
1308        }
1309
1310        /// Sets the value of [name][crate::model::GetOrganizationRequest::name].
1311        ///
1312        /// This is a **required** field for requests.
1313        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1314            self.0.request.name = v.into();
1315            self
1316        }
1317    }
1318
1319    #[doc(hidden)]
1320    impl gax::options::internal::RequestBuilder for GetOrganization {
1321        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1322            &mut self.0.options
1323        }
1324    }
1325
1326    /// The request builder for [Organizations::search_organizations][crate::client::Organizations::search_organizations] calls.
1327    ///
1328    /// # Example
1329    /// ```
1330    /// # use google_cloud_resourcemanager_v3::builder::organizations::SearchOrganizations;
1331    /// # async fn sample() -> gax::Result<()> {
1332    /// use gax::paginator::ItemPaginator;
1333    ///
1334    /// let builder = prepare_request_builder();
1335    /// let mut items = builder.by_item();
1336    /// while let Some(result) = items.next().await {
1337    ///   let item = result?;
1338    /// }
1339    /// # Ok(()) }
1340    ///
1341    /// fn prepare_request_builder() -> SearchOrganizations {
1342    ///   # panic!();
1343    ///   // ... details omitted ...
1344    /// }
1345    /// ```
1346    #[derive(Clone, Debug)]
1347    pub struct SearchOrganizations(RequestBuilder<crate::model::SearchOrganizationsRequest>);
1348
1349    impl SearchOrganizations {
1350        pub(crate) fn new(
1351            stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1352        ) -> Self {
1353            Self(RequestBuilder::new(stub))
1354        }
1355
1356        /// Sets the full request, replacing any prior values.
1357        pub fn with_request<V: Into<crate::model::SearchOrganizationsRequest>>(
1358            mut self,
1359            v: V,
1360        ) -> Self {
1361            self.0.request = v.into();
1362            self
1363        }
1364
1365        /// Sets all the options, replacing any prior values.
1366        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1367            self.0.options = v.into();
1368            self
1369        }
1370
1371        /// Sends the request.
1372        pub async fn send(self) -> Result<crate::model::SearchOrganizationsResponse> {
1373            (*self.0.stub)
1374                .search_organizations(self.0.request, self.0.options)
1375                .await
1376                .map(gax::response::Response::into_body)
1377        }
1378
1379        /// Streams each page in the collection.
1380        pub fn by_page(
1381            self,
1382        ) -> impl gax::paginator::Paginator<crate::model::SearchOrganizationsResponse, gax::error::Error>
1383        {
1384            use std::clone::Clone;
1385            let token = self.0.request.page_token.clone();
1386            let execute = move |token: String| {
1387                let mut builder = self.clone();
1388                builder.0.request = builder.0.request.set_page_token(token);
1389                builder.send()
1390            };
1391            gax::paginator::internal::new_paginator(token, execute)
1392        }
1393
1394        /// Streams each item in the collection.
1395        pub fn by_item(
1396            self,
1397        ) -> impl gax::paginator::ItemPaginator<
1398            crate::model::SearchOrganizationsResponse,
1399            gax::error::Error,
1400        > {
1401            use gax::paginator::Paginator;
1402            self.by_page().items()
1403        }
1404
1405        /// Sets the value of [page_size][crate::model::SearchOrganizationsRequest::page_size].
1406        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1407            self.0.request.page_size = v.into();
1408            self
1409        }
1410
1411        /// Sets the value of [page_token][crate::model::SearchOrganizationsRequest::page_token].
1412        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1413            self.0.request.page_token = v.into();
1414            self
1415        }
1416
1417        /// Sets the value of [query][crate::model::SearchOrganizationsRequest::query].
1418        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419            self.0.request.query = v.into();
1420            self
1421        }
1422    }
1423
1424    #[doc(hidden)]
1425    impl gax::options::internal::RequestBuilder for SearchOrganizations {
1426        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1427            &mut self.0.options
1428        }
1429    }
1430
1431    /// The request builder for [Organizations::get_iam_policy][crate::client::Organizations::get_iam_policy] calls.
1432    ///
1433    /// # Example
1434    /// ```
1435    /// # use google_cloud_resourcemanager_v3::builder::organizations::GetIamPolicy;
1436    /// # async fn sample() -> gax::Result<()> {
1437    ///
1438    /// let builder = prepare_request_builder();
1439    /// let response = builder.send().await?;
1440    /// # Ok(()) }
1441    ///
1442    /// fn prepare_request_builder() -> GetIamPolicy {
1443    ///   # panic!();
1444    ///   // ... details omitted ...
1445    /// }
1446    /// ```
1447    #[derive(Clone, Debug)]
1448    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1449
1450    impl GetIamPolicy {
1451        pub(crate) fn new(
1452            stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1453        ) -> Self {
1454            Self(RequestBuilder::new(stub))
1455        }
1456
1457        /// Sets the full request, replacing any prior values.
1458        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1459            self.0.request = v.into();
1460            self
1461        }
1462
1463        /// Sets all the options, replacing any prior values.
1464        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1465            self.0.options = v.into();
1466            self
1467        }
1468
1469        /// Sends the request.
1470        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1471            (*self.0.stub)
1472                .get_iam_policy(self.0.request, self.0.options)
1473                .await
1474                .map(gax::response::Response::into_body)
1475        }
1476
1477        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1478        ///
1479        /// This is a **required** field for requests.
1480        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1481            self.0.request.resource = v.into();
1482            self
1483        }
1484
1485        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1486        pub fn set_options<T>(mut self, v: T) -> Self
1487        where
1488            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1489        {
1490            self.0.request.options = std::option::Option::Some(v.into());
1491            self
1492        }
1493
1494        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1495        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1496        where
1497            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1498        {
1499            self.0.request.options = v.map(|x| x.into());
1500            self
1501        }
1502    }
1503
1504    #[doc(hidden)]
1505    impl gax::options::internal::RequestBuilder for GetIamPolicy {
1506        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1507            &mut self.0.options
1508        }
1509    }
1510
1511    /// The request builder for [Organizations::set_iam_policy][crate::client::Organizations::set_iam_policy] calls.
1512    ///
1513    /// # Example
1514    /// ```
1515    /// # use google_cloud_resourcemanager_v3::builder::organizations::SetIamPolicy;
1516    /// # async fn sample() -> gax::Result<()> {
1517    ///
1518    /// let builder = prepare_request_builder();
1519    /// let response = builder.send().await?;
1520    /// # Ok(()) }
1521    ///
1522    /// fn prepare_request_builder() -> SetIamPolicy {
1523    ///   # panic!();
1524    ///   // ... details omitted ...
1525    /// }
1526    /// ```
1527    #[derive(Clone, Debug)]
1528    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1529
1530    impl SetIamPolicy {
1531        pub(crate) fn new(
1532            stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1533        ) -> Self {
1534            Self(RequestBuilder::new(stub))
1535        }
1536
1537        /// Sets the full request, replacing any prior values.
1538        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1539            self.0.request = v.into();
1540            self
1541        }
1542
1543        /// Sets all the options, replacing any prior values.
1544        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1545            self.0.options = v.into();
1546            self
1547        }
1548
1549        /// Sends the request.
1550        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1551            (*self.0.stub)
1552                .set_iam_policy(self.0.request, self.0.options)
1553                .await
1554                .map(gax::response::Response::into_body)
1555        }
1556
1557        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1558        ///
1559        /// This is a **required** field for requests.
1560        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1561            self.0.request.resource = v.into();
1562            self
1563        }
1564
1565        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1566        ///
1567        /// This is a **required** field for requests.
1568        pub fn set_policy<T>(mut self, v: T) -> Self
1569        where
1570            T: std::convert::Into<iam_v1::model::Policy>,
1571        {
1572            self.0.request.policy = std::option::Option::Some(v.into());
1573            self
1574        }
1575
1576        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1577        ///
1578        /// This is a **required** field for requests.
1579        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1580        where
1581            T: std::convert::Into<iam_v1::model::Policy>,
1582        {
1583            self.0.request.policy = v.map(|x| x.into());
1584            self
1585        }
1586
1587        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1588        pub fn set_update_mask<T>(mut self, v: T) -> Self
1589        where
1590            T: std::convert::Into<wkt::FieldMask>,
1591        {
1592            self.0.request.update_mask = std::option::Option::Some(v.into());
1593            self
1594        }
1595
1596        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1597        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1598        where
1599            T: std::convert::Into<wkt::FieldMask>,
1600        {
1601            self.0.request.update_mask = v.map(|x| x.into());
1602            self
1603        }
1604    }
1605
1606    #[doc(hidden)]
1607    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1608        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1609            &mut self.0.options
1610        }
1611    }
1612
1613    /// The request builder for [Organizations::test_iam_permissions][crate::client::Organizations::test_iam_permissions] calls.
1614    ///
1615    /// # Example
1616    /// ```
1617    /// # use google_cloud_resourcemanager_v3::builder::organizations::TestIamPermissions;
1618    /// # async fn sample() -> gax::Result<()> {
1619    ///
1620    /// let builder = prepare_request_builder();
1621    /// let response = builder.send().await?;
1622    /// # Ok(()) }
1623    ///
1624    /// fn prepare_request_builder() -> TestIamPermissions {
1625    ///   # panic!();
1626    ///   // ... details omitted ...
1627    /// }
1628    /// ```
1629    #[derive(Clone, Debug)]
1630    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1631
1632    impl TestIamPermissions {
1633        pub(crate) fn new(
1634            stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1635        ) -> Self {
1636            Self(RequestBuilder::new(stub))
1637        }
1638
1639        /// Sets the full request, replacing any prior values.
1640        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1641            mut self,
1642            v: V,
1643        ) -> Self {
1644            self.0.request = v.into();
1645            self
1646        }
1647
1648        /// Sets all the options, replacing any prior values.
1649        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1650            self.0.options = v.into();
1651            self
1652        }
1653
1654        /// Sends the request.
1655        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1656            (*self.0.stub)
1657                .test_iam_permissions(self.0.request, self.0.options)
1658                .await
1659                .map(gax::response::Response::into_body)
1660        }
1661
1662        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1663        ///
1664        /// This is a **required** field for requests.
1665        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1666            self.0.request.resource = v.into();
1667            self
1668        }
1669
1670        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1671        ///
1672        /// This is a **required** field for requests.
1673        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1674        where
1675            T: std::iter::IntoIterator<Item = V>,
1676            V: std::convert::Into<std::string::String>,
1677        {
1678            use std::iter::Iterator;
1679            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1680            self
1681        }
1682    }
1683
1684    #[doc(hidden)]
1685    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1686        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1687            &mut self.0.options
1688        }
1689    }
1690
1691    /// The request builder for [Organizations::get_operation][crate::client::Organizations::get_operation] calls.
1692    ///
1693    /// # Example
1694    /// ```
1695    /// # use google_cloud_resourcemanager_v3::builder::organizations::GetOperation;
1696    /// # async fn sample() -> gax::Result<()> {
1697    ///
1698    /// let builder = prepare_request_builder();
1699    /// let response = builder.send().await?;
1700    /// # Ok(()) }
1701    ///
1702    /// fn prepare_request_builder() -> GetOperation {
1703    ///   # panic!();
1704    ///   // ... details omitted ...
1705    /// }
1706    /// ```
1707    #[derive(Clone, Debug)]
1708    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1709
1710    impl GetOperation {
1711        pub(crate) fn new(
1712            stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1713        ) -> Self {
1714            Self(RequestBuilder::new(stub))
1715        }
1716
1717        /// Sets the full request, replacing any prior values.
1718        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1719            mut self,
1720            v: V,
1721        ) -> Self {
1722            self.0.request = v.into();
1723            self
1724        }
1725
1726        /// Sets all the options, replacing any prior values.
1727        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1728            self.0.options = v.into();
1729            self
1730        }
1731
1732        /// Sends the request.
1733        pub async fn send(self) -> Result<longrunning::model::Operation> {
1734            (*self.0.stub)
1735                .get_operation(self.0.request, self.0.options)
1736                .await
1737                .map(gax::response::Response::into_body)
1738        }
1739
1740        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1741        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1742            self.0.request.name = v.into();
1743            self
1744        }
1745    }
1746
1747    #[doc(hidden)]
1748    impl gax::options::internal::RequestBuilder for GetOperation {
1749        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1750            &mut self.0.options
1751        }
1752    }
1753}
1754
1755pub mod projects {
1756    use crate::Result;
1757
1758    /// A builder for [Projects][crate::client::Projects].
1759    ///
1760    /// ```
1761    /// # async fn sample() -> gax::client_builder::Result<()> {
1762    /// # use google_cloud_resourcemanager_v3::*;
1763    /// # use builder::projects::ClientBuilder;
1764    /// # use client::Projects;
1765    /// let builder : ClientBuilder = Projects::builder();
1766    /// let client = builder
1767    ///     .with_endpoint("https://cloudresourcemanager.googleapis.com")
1768    ///     .build().await?;
1769    /// # Ok(()) }
1770    /// ```
1771    pub type ClientBuilder =
1772        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1773
1774    pub(crate) mod client {
1775        use super::super::super::client::Projects;
1776        pub struct Factory;
1777        impl gax::client_builder::internal::ClientFactory for Factory {
1778            type Client = Projects;
1779            type Credentials = gaxi::options::Credentials;
1780            async fn build(
1781                self,
1782                config: gaxi::options::ClientConfig,
1783            ) -> gax::client_builder::Result<Self::Client> {
1784                Self::Client::new(config).await
1785            }
1786        }
1787    }
1788
1789    /// Common implementation for [crate::client::Projects] request builders.
1790    #[derive(Clone, Debug)]
1791    pub(crate) struct RequestBuilder<R: std::default::Default> {
1792        stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>,
1793        request: R,
1794        options: gax::options::RequestOptions,
1795    }
1796
1797    impl<R> RequestBuilder<R>
1798    where
1799        R: std::default::Default,
1800    {
1801        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1802            Self {
1803                stub,
1804                request: R::default(),
1805                options: gax::options::RequestOptions::default(),
1806            }
1807        }
1808    }
1809
1810    /// The request builder for [Projects::get_project][crate::client::Projects::get_project] calls.
1811    ///
1812    /// # Example
1813    /// ```
1814    /// # use google_cloud_resourcemanager_v3::builder::projects::GetProject;
1815    /// # async fn sample() -> gax::Result<()> {
1816    ///
1817    /// let builder = prepare_request_builder();
1818    /// let response = builder.send().await?;
1819    /// # Ok(()) }
1820    ///
1821    /// fn prepare_request_builder() -> GetProject {
1822    ///   # panic!();
1823    ///   // ... details omitted ...
1824    /// }
1825    /// ```
1826    #[derive(Clone, Debug)]
1827    pub struct GetProject(RequestBuilder<crate::model::GetProjectRequest>);
1828
1829    impl GetProject {
1830        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1831            Self(RequestBuilder::new(stub))
1832        }
1833
1834        /// Sets the full request, replacing any prior values.
1835        pub fn with_request<V: Into<crate::model::GetProjectRequest>>(mut self, v: V) -> Self {
1836            self.0.request = v.into();
1837            self
1838        }
1839
1840        /// Sets all the options, replacing any prior values.
1841        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1842            self.0.options = v.into();
1843            self
1844        }
1845
1846        /// Sends the request.
1847        pub async fn send(self) -> Result<crate::model::Project> {
1848            (*self.0.stub)
1849                .get_project(self.0.request, self.0.options)
1850                .await
1851                .map(gax::response::Response::into_body)
1852        }
1853
1854        /// Sets the value of [name][crate::model::GetProjectRequest::name].
1855        ///
1856        /// This is a **required** field for requests.
1857        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1858            self.0.request.name = v.into();
1859            self
1860        }
1861    }
1862
1863    #[doc(hidden)]
1864    impl gax::options::internal::RequestBuilder for GetProject {
1865        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1866            &mut self.0.options
1867        }
1868    }
1869
1870    /// The request builder for [Projects::list_projects][crate::client::Projects::list_projects] calls.
1871    ///
1872    /// # Example
1873    /// ```
1874    /// # use google_cloud_resourcemanager_v3::builder::projects::ListProjects;
1875    /// # async fn sample() -> gax::Result<()> {
1876    /// use gax::paginator::ItemPaginator;
1877    ///
1878    /// let builder = prepare_request_builder();
1879    /// let mut items = builder.by_item();
1880    /// while let Some(result) = items.next().await {
1881    ///   let item = result?;
1882    /// }
1883    /// # Ok(()) }
1884    ///
1885    /// fn prepare_request_builder() -> ListProjects {
1886    ///   # panic!();
1887    ///   // ... details omitted ...
1888    /// }
1889    /// ```
1890    #[derive(Clone, Debug)]
1891    pub struct ListProjects(RequestBuilder<crate::model::ListProjectsRequest>);
1892
1893    impl ListProjects {
1894        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1895            Self(RequestBuilder::new(stub))
1896        }
1897
1898        /// Sets the full request, replacing any prior values.
1899        pub fn with_request<V: Into<crate::model::ListProjectsRequest>>(mut self, v: V) -> Self {
1900            self.0.request = v.into();
1901            self
1902        }
1903
1904        /// Sets all the options, replacing any prior values.
1905        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1906            self.0.options = v.into();
1907            self
1908        }
1909
1910        /// Sends the request.
1911        pub async fn send(self) -> Result<crate::model::ListProjectsResponse> {
1912            (*self.0.stub)
1913                .list_projects(self.0.request, self.0.options)
1914                .await
1915                .map(gax::response::Response::into_body)
1916        }
1917
1918        /// Streams each page in the collection.
1919        pub fn by_page(
1920            self,
1921        ) -> impl gax::paginator::Paginator<crate::model::ListProjectsResponse, gax::error::Error>
1922        {
1923            use std::clone::Clone;
1924            let token = self.0.request.page_token.clone();
1925            let execute = move |token: String| {
1926                let mut builder = self.clone();
1927                builder.0.request = builder.0.request.set_page_token(token);
1928                builder.send()
1929            };
1930            gax::paginator::internal::new_paginator(token, execute)
1931        }
1932
1933        /// Streams each item in the collection.
1934        pub fn by_item(
1935            self,
1936        ) -> impl gax::paginator::ItemPaginator<crate::model::ListProjectsResponse, gax::error::Error>
1937        {
1938            use gax::paginator::Paginator;
1939            self.by_page().items()
1940        }
1941
1942        /// Sets the value of [parent][crate::model::ListProjectsRequest::parent].
1943        ///
1944        /// This is a **required** field for requests.
1945        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1946            self.0.request.parent = v.into();
1947            self
1948        }
1949
1950        /// Sets the value of [page_token][crate::model::ListProjectsRequest::page_token].
1951        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1952            self.0.request.page_token = v.into();
1953            self
1954        }
1955
1956        /// Sets the value of [page_size][crate::model::ListProjectsRequest::page_size].
1957        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1958            self.0.request.page_size = v.into();
1959            self
1960        }
1961
1962        /// Sets the value of [show_deleted][crate::model::ListProjectsRequest::show_deleted].
1963        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1964            self.0.request.show_deleted = v.into();
1965            self
1966        }
1967    }
1968
1969    #[doc(hidden)]
1970    impl gax::options::internal::RequestBuilder for ListProjects {
1971        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1972            &mut self.0.options
1973        }
1974    }
1975
1976    /// The request builder for [Projects::search_projects][crate::client::Projects::search_projects] calls.
1977    ///
1978    /// # Example
1979    /// ```
1980    /// # use google_cloud_resourcemanager_v3::builder::projects::SearchProjects;
1981    /// # async fn sample() -> gax::Result<()> {
1982    /// use gax::paginator::ItemPaginator;
1983    ///
1984    /// let builder = prepare_request_builder();
1985    /// let mut items = builder.by_item();
1986    /// while let Some(result) = items.next().await {
1987    ///   let item = result?;
1988    /// }
1989    /// # Ok(()) }
1990    ///
1991    /// fn prepare_request_builder() -> SearchProjects {
1992    ///   # panic!();
1993    ///   // ... details omitted ...
1994    /// }
1995    /// ```
1996    #[derive(Clone, Debug)]
1997    pub struct SearchProjects(RequestBuilder<crate::model::SearchProjectsRequest>);
1998
1999    impl SearchProjects {
2000        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2001            Self(RequestBuilder::new(stub))
2002        }
2003
2004        /// Sets the full request, replacing any prior values.
2005        pub fn with_request<V: Into<crate::model::SearchProjectsRequest>>(mut self, v: V) -> Self {
2006            self.0.request = v.into();
2007            self
2008        }
2009
2010        /// Sets all the options, replacing any prior values.
2011        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2012            self.0.options = v.into();
2013            self
2014        }
2015
2016        /// Sends the request.
2017        pub async fn send(self) -> Result<crate::model::SearchProjectsResponse> {
2018            (*self.0.stub)
2019                .search_projects(self.0.request, self.0.options)
2020                .await
2021                .map(gax::response::Response::into_body)
2022        }
2023
2024        /// Streams each page in the collection.
2025        pub fn by_page(
2026            self,
2027        ) -> impl gax::paginator::Paginator<crate::model::SearchProjectsResponse, gax::error::Error>
2028        {
2029            use std::clone::Clone;
2030            let token = self.0.request.page_token.clone();
2031            let execute = move |token: String| {
2032                let mut builder = self.clone();
2033                builder.0.request = builder.0.request.set_page_token(token);
2034                builder.send()
2035            };
2036            gax::paginator::internal::new_paginator(token, execute)
2037        }
2038
2039        /// Streams each item in the collection.
2040        pub fn by_item(
2041            self,
2042        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchProjectsResponse, gax::error::Error>
2043        {
2044            use gax::paginator::Paginator;
2045            self.by_page().items()
2046        }
2047
2048        /// Sets the value of [query][crate::model::SearchProjectsRequest::query].
2049        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
2050            self.0.request.query = v.into();
2051            self
2052        }
2053
2054        /// Sets the value of [page_token][crate::model::SearchProjectsRequest::page_token].
2055        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2056            self.0.request.page_token = v.into();
2057            self
2058        }
2059
2060        /// Sets the value of [page_size][crate::model::SearchProjectsRequest::page_size].
2061        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2062            self.0.request.page_size = v.into();
2063            self
2064        }
2065    }
2066
2067    #[doc(hidden)]
2068    impl gax::options::internal::RequestBuilder for SearchProjects {
2069        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2070            &mut self.0.options
2071        }
2072    }
2073
2074    /// The request builder for [Projects::create_project][crate::client::Projects::create_project] calls.
2075    ///
2076    /// # Example
2077    /// ```
2078    /// # use google_cloud_resourcemanager_v3::builder::projects::CreateProject;
2079    /// # async fn sample() -> gax::Result<()> {
2080    /// use lro::Poller;
2081    ///
2082    /// let builder = prepare_request_builder();
2083    /// let response = builder.poller().until_done().await?;
2084    /// # Ok(()) }
2085    ///
2086    /// fn prepare_request_builder() -> CreateProject {
2087    ///   # panic!();
2088    ///   // ... details omitted ...
2089    /// }
2090    /// ```
2091    #[derive(Clone, Debug)]
2092    pub struct CreateProject(RequestBuilder<crate::model::CreateProjectRequest>);
2093
2094    impl CreateProject {
2095        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2096            Self(RequestBuilder::new(stub))
2097        }
2098
2099        /// Sets the full request, replacing any prior values.
2100        pub fn with_request<V: Into<crate::model::CreateProjectRequest>>(mut self, v: V) -> Self {
2101            self.0.request = v.into();
2102            self
2103        }
2104
2105        /// Sets all the options, replacing any prior values.
2106        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2107            self.0.options = v.into();
2108            self
2109        }
2110
2111        /// Sends the request.
2112        ///
2113        /// # Long running operations
2114        ///
2115        /// This starts, but does not poll, a longrunning operation. More information
2116        /// on [create_project][crate::client::Projects::create_project].
2117        pub async fn send(self) -> Result<longrunning::model::Operation> {
2118            (*self.0.stub)
2119                .create_project(self.0.request, self.0.options)
2120                .await
2121                .map(gax::response::Response::into_body)
2122        }
2123
2124        /// Creates a [Poller][lro::Poller] to work with `create_project`.
2125        pub fn poller(
2126            self,
2127        ) -> impl lro::Poller<crate::model::Project, crate::model::CreateProjectMetadata> {
2128            type Operation = lro::internal::Operation<
2129                crate::model::Project,
2130                crate::model::CreateProjectMetadata,
2131            >;
2132            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2133            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2134
2135            let stub = self.0.stub.clone();
2136            let mut options = self.0.options.clone();
2137            options.set_retry_policy(gax::retry_policy::NeverRetry);
2138            let query = move |name| {
2139                let stub = stub.clone();
2140                let options = options.clone();
2141                async {
2142                    let op = GetOperation::new(stub)
2143                        .set_name(name)
2144                        .with_options(options)
2145                        .send()
2146                        .await?;
2147                    Ok(Operation::new(op))
2148                }
2149            };
2150
2151            let start = move || async {
2152                let op = self.send().await?;
2153                Ok(Operation::new(op))
2154            };
2155
2156            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2157        }
2158
2159        /// Sets the value of [project][crate::model::CreateProjectRequest::project].
2160        ///
2161        /// This is a **required** field for requests.
2162        pub fn set_project<T>(mut self, v: T) -> Self
2163        where
2164            T: std::convert::Into<crate::model::Project>,
2165        {
2166            self.0.request.project = std::option::Option::Some(v.into());
2167            self
2168        }
2169
2170        /// Sets or clears the value of [project][crate::model::CreateProjectRequest::project].
2171        ///
2172        /// This is a **required** field for requests.
2173        pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
2174        where
2175            T: std::convert::Into<crate::model::Project>,
2176        {
2177            self.0.request.project = v.map(|x| x.into());
2178            self
2179        }
2180    }
2181
2182    #[doc(hidden)]
2183    impl gax::options::internal::RequestBuilder for CreateProject {
2184        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2185            &mut self.0.options
2186        }
2187    }
2188
2189    /// The request builder for [Projects::update_project][crate::client::Projects::update_project] calls.
2190    ///
2191    /// # Example
2192    /// ```
2193    /// # use google_cloud_resourcemanager_v3::builder::projects::UpdateProject;
2194    /// # async fn sample() -> gax::Result<()> {
2195    /// use lro::Poller;
2196    ///
2197    /// let builder = prepare_request_builder();
2198    /// let response = builder.poller().until_done().await?;
2199    /// # Ok(()) }
2200    ///
2201    /// fn prepare_request_builder() -> UpdateProject {
2202    ///   # panic!();
2203    ///   // ... details omitted ...
2204    /// }
2205    /// ```
2206    #[derive(Clone, Debug)]
2207    pub struct UpdateProject(RequestBuilder<crate::model::UpdateProjectRequest>);
2208
2209    impl UpdateProject {
2210        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2211            Self(RequestBuilder::new(stub))
2212        }
2213
2214        /// Sets the full request, replacing any prior values.
2215        pub fn with_request<V: Into<crate::model::UpdateProjectRequest>>(mut self, v: V) -> Self {
2216            self.0.request = v.into();
2217            self
2218        }
2219
2220        /// Sets all the options, replacing any prior values.
2221        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2222            self.0.options = v.into();
2223            self
2224        }
2225
2226        /// Sends the request.
2227        ///
2228        /// # Long running operations
2229        ///
2230        /// This starts, but does not poll, a longrunning operation. More information
2231        /// on [update_project][crate::client::Projects::update_project].
2232        pub async fn send(self) -> Result<longrunning::model::Operation> {
2233            (*self.0.stub)
2234                .update_project(self.0.request, self.0.options)
2235                .await
2236                .map(gax::response::Response::into_body)
2237        }
2238
2239        /// Creates a [Poller][lro::Poller] to work with `update_project`.
2240        pub fn poller(
2241            self,
2242        ) -> impl lro::Poller<crate::model::Project, crate::model::UpdateProjectMetadata> {
2243            type Operation = lro::internal::Operation<
2244                crate::model::Project,
2245                crate::model::UpdateProjectMetadata,
2246            >;
2247            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2248            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2249
2250            let stub = self.0.stub.clone();
2251            let mut options = self.0.options.clone();
2252            options.set_retry_policy(gax::retry_policy::NeverRetry);
2253            let query = move |name| {
2254                let stub = stub.clone();
2255                let options = options.clone();
2256                async {
2257                    let op = GetOperation::new(stub)
2258                        .set_name(name)
2259                        .with_options(options)
2260                        .send()
2261                        .await?;
2262                    Ok(Operation::new(op))
2263                }
2264            };
2265
2266            let start = move || async {
2267                let op = self.send().await?;
2268                Ok(Operation::new(op))
2269            };
2270
2271            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2272        }
2273
2274        /// Sets the value of [project][crate::model::UpdateProjectRequest::project].
2275        ///
2276        /// This is a **required** field for requests.
2277        pub fn set_project<T>(mut self, v: T) -> Self
2278        where
2279            T: std::convert::Into<crate::model::Project>,
2280        {
2281            self.0.request.project = std::option::Option::Some(v.into());
2282            self
2283        }
2284
2285        /// Sets or clears the value of [project][crate::model::UpdateProjectRequest::project].
2286        ///
2287        /// This is a **required** field for requests.
2288        pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
2289        where
2290            T: std::convert::Into<crate::model::Project>,
2291        {
2292            self.0.request.project = v.map(|x| x.into());
2293            self
2294        }
2295
2296        /// Sets the value of [update_mask][crate::model::UpdateProjectRequest::update_mask].
2297        pub fn set_update_mask<T>(mut self, v: T) -> Self
2298        where
2299            T: std::convert::Into<wkt::FieldMask>,
2300        {
2301            self.0.request.update_mask = std::option::Option::Some(v.into());
2302            self
2303        }
2304
2305        /// Sets or clears the value of [update_mask][crate::model::UpdateProjectRequest::update_mask].
2306        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2307        where
2308            T: std::convert::Into<wkt::FieldMask>,
2309        {
2310            self.0.request.update_mask = v.map(|x| x.into());
2311            self
2312        }
2313    }
2314
2315    #[doc(hidden)]
2316    impl gax::options::internal::RequestBuilder for UpdateProject {
2317        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2318            &mut self.0.options
2319        }
2320    }
2321
2322    /// The request builder for [Projects::move_project][crate::client::Projects::move_project] calls.
2323    ///
2324    /// # Example
2325    /// ```
2326    /// # use google_cloud_resourcemanager_v3::builder::projects::MoveProject;
2327    /// # async fn sample() -> gax::Result<()> {
2328    /// use lro::Poller;
2329    ///
2330    /// let builder = prepare_request_builder();
2331    /// let response = builder.poller().until_done().await?;
2332    /// # Ok(()) }
2333    ///
2334    /// fn prepare_request_builder() -> MoveProject {
2335    ///   # panic!();
2336    ///   // ... details omitted ...
2337    /// }
2338    /// ```
2339    #[derive(Clone, Debug)]
2340    pub struct MoveProject(RequestBuilder<crate::model::MoveProjectRequest>);
2341
2342    impl MoveProject {
2343        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2344            Self(RequestBuilder::new(stub))
2345        }
2346
2347        /// Sets the full request, replacing any prior values.
2348        pub fn with_request<V: Into<crate::model::MoveProjectRequest>>(mut self, v: V) -> Self {
2349            self.0.request = v.into();
2350            self
2351        }
2352
2353        /// Sets all the options, replacing any prior values.
2354        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2355            self.0.options = v.into();
2356            self
2357        }
2358
2359        /// Sends the request.
2360        ///
2361        /// # Long running operations
2362        ///
2363        /// This starts, but does not poll, a longrunning operation. More information
2364        /// on [move_project][crate::client::Projects::move_project].
2365        pub async fn send(self) -> Result<longrunning::model::Operation> {
2366            (*self.0.stub)
2367                .move_project(self.0.request, self.0.options)
2368                .await
2369                .map(gax::response::Response::into_body)
2370        }
2371
2372        /// Creates a [Poller][lro::Poller] to work with `move_project`.
2373        pub fn poller(
2374            self,
2375        ) -> impl lro::Poller<crate::model::Project, crate::model::MoveProjectMetadata> {
2376            type Operation =
2377                lro::internal::Operation<crate::model::Project, crate::model::MoveProjectMetadata>;
2378            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2379            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2380
2381            let stub = self.0.stub.clone();
2382            let mut options = self.0.options.clone();
2383            options.set_retry_policy(gax::retry_policy::NeverRetry);
2384            let query = move |name| {
2385                let stub = stub.clone();
2386                let options = options.clone();
2387                async {
2388                    let op = GetOperation::new(stub)
2389                        .set_name(name)
2390                        .with_options(options)
2391                        .send()
2392                        .await?;
2393                    Ok(Operation::new(op))
2394                }
2395            };
2396
2397            let start = move || async {
2398                let op = self.send().await?;
2399                Ok(Operation::new(op))
2400            };
2401
2402            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2403        }
2404
2405        /// Sets the value of [name][crate::model::MoveProjectRequest::name].
2406        ///
2407        /// This is a **required** field for requests.
2408        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2409            self.0.request.name = v.into();
2410            self
2411        }
2412
2413        /// Sets the value of [destination_parent][crate::model::MoveProjectRequest::destination_parent].
2414        ///
2415        /// This is a **required** field for requests.
2416        pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2417            self.0.request.destination_parent = v.into();
2418            self
2419        }
2420    }
2421
2422    #[doc(hidden)]
2423    impl gax::options::internal::RequestBuilder for MoveProject {
2424        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2425            &mut self.0.options
2426        }
2427    }
2428
2429    /// The request builder for [Projects::delete_project][crate::client::Projects::delete_project] calls.
2430    ///
2431    /// # Example
2432    /// ```
2433    /// # use google_cloud_resourcemanager_v3::builder::projects::DeleteProject;
2434    /// # async fn sample() -> gax::Result<()> {
2435    /// use lro::Poller;
2436    ///
2437    /// let builder = prepare_request_builder();
2438    /// let response = builder.poller().until_done().await?;
2439    /// # Ok(()) }
2440    ///
2441    /// fn prepare_request_builder() -> DeleteProject {
2442    ///   # panic!();
2443    ///   // ... details omitted ...
2444    /// }
2445    /// ```
2446    #[derive(Clone, Debug)]
2447    pub struct DeleteProject(RequestBuilder<crate::model::DeleteProjectRequest>);
2448
2449    impl DeleteProject {
2450        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2451            Self(RequestBuilder::new(stub))
2452        }
2453
2454        /// Sets the full request, replacing any prior values.
2455        pub fn with_request<V: Into<crate::model::DeleteProjectRequest>>(mut self, v: V) -> Self {
2456            self.0.request = v.into();
2457            self
2458        }
2459
2460        /// Sets all the options, replacing any prior values.
2461        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2462            self.0.options = v.into();
2463            self
2464        }
2465
2466        /// Sends the request.
2467        ///
2468        /// # Long running operations
2469        ///
2470        /// This starts, but does not poll, a longrunning operation. More information
2471        /// on [delete_project][crate::client::Projects::delete_project].
2472        pub async fn send(self) -> Result<longrunning::model::Operation> {
2473            (*self.0.stub)
2474                .delete_project(self.0.request, self.0.options)
2475                .await
2476                .map(gax::response::Response::into_body)
2477        }
2478
2479        /// Creates a [Poller][lro::Poller] to work with `delete_project`.
2480        pub fn poller(
2481            self,
2482        ) -> impl lro::Poller<crate::model::Project, crate::model::DeleteProjectMetadata> {
2483            type Operation = lro::internal::Operation<
2484                crate::model::Project,
2485                crate::model::DeleteProjectMetadata,
2486            >;
2487            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2488            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2489
2490            let stub = self.0.stub.clone();
2491            let mut options = self.0.options.clone();
2492            options.set_retry_policy(gax::retry_policy::NeverRetry);
2493            let query = move |name| {
2494                let stub = stub.clone();
2495                let options = options.clone();
2496                async {
2497                    let op = GetOperation::new(stub)
2498                        .set_name(name)
2499                        .with_options(options)
2500                        .send()
2501                        .await?;
2502                    Ok(Operation::new(op))
2503                }
2504            };
2505
2506            let start = move || async {
2507                let op = self.send().await?;
2508                Ok(Operation::new(op))
2509            };
2510
2511            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2512        }
2513
2514        /// Sets the value of [name][crate::model::DeleteProjectRequest::name].
2515        ///
2516        /// This is a **required** field for requests.
2517        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2518            self.0.request.name = v.into();
2519            self
2520        }
2521    }
2522
2523    #[doc(hidden)]
2524    impl gax::options::internal::RequestBuilder for DeleteProject {
2525        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2526            &mut self.0.options
2527        }
2528    }
2529
2530    /// The request builder for [Projects::undelete_project][crate::client::Projects::undelete_project] calls.
2531    ///
2532    /// # Example
2533    /// ```
2534    /// # use google_cloud_resourcemanager_v3::builder::projects::UndeleteProject;
2535    /// # async fn sample() -> gax::Result<()> {
2536    /// use lro::Poller;
2537    ///
2538    /// let builder = prepare_request_builder();
2539    /// let response = builder.poller().until_done().await?;
2540    /// # Ok(()) }
2541    ///
2542    /// fn prepare_request_builder() -> UndeleteProject {
2543    ///   # panic!();
2544    ///   // ... details omitted ...
2545    /// }
2546    /// ```
2547    #[derive(Clone, Debug)]
2548    pub struct UndeleteProject(RequestBuilder<crate::model::UndeleteProjectRequest>);
2549
2550    impl UndeleteProject {
2551        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2552            Self(RequestBuilder::new(stub))
2553        }
2554
2555        /// Sets the full request, replacing any prior values.
2556        pub fn with_request<V: Into<crate::model::UndeleteProjectRequest>>(mut self, v: V) -> Self {
2557            self.0.request = v.into();
2558            self
2559        }
2560
2561        /// Sets all the options, replacing any prior values.
2562        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2563            self.0.options = v.into();
2564            self
2565        }
2566
2567        /// Sends the request.
2568        ///
2569        /// # Long running operations
2570        ///
2571        /// This starts, but does not poll, a longrunning operation. More information
2572        /// on [undelete_project][crate::client::Projects::undelete_project].
2573        pub async fn send(self) -> Result<longrunning::model::Operation> {
2574            (*self.0.stub)
2575                .undelete_project(self.0.request, self.0.options)
2576                .await
2577                .map(gax::response::Response::into_body)
2578        }
2579
2580        /// Creates a [Poller][lro::Poller] to work with `undelete_project`.
2581        pub fn poller(
2582            self,
2583        ) -> impl lro::Poller<crate::model::Project, crate::model::UndeleteProjectMetadata>
2584        {
2585            type Operation = lro::internal::Operation<
2586                crate::model::Project,
2587                crate::model::UndeleteProjectMetadata,
2588            >;
2589            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2590            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2591
2592            let stub = self.0.stub.clone();
2593            let mut options = self.0.options.clone();
2594            options.set_retry_policy(gax::retry_policy::NeverRetry);
2595            let query = move |name| {
2596                let stub = stub.clone();
2597                let options = options.clone();
2598                async {
2599                    let op = GetOperation::new(stub)
2600                        .set_name(name)
2601                        .with_options(options)
2602                        .send()
2603                        .await?;
2604                    Ok(Operation::new(op))
2605                }
2606            };
2607
2608            let start = move || async {
2609                let op = self.send().await?;
2610                Ok(Operation::new(op))
2611            };
2612
2613            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2614        }
2615
2616        /// Sets the value of [name][crate::model::UndeleteProjectRequest::name].
2617        ///
2618        /// This is a **required** field for requests.
2619        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2620            self.0.request.name = v.into();
2621            self
2622        }
2623    }
2624
2625    #[doc(hidden)]
2626    impl gax::options::internal::RequestBuilder for UndeleteProject {
2627        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2628            &mut self.0.options
2629        }
2630    }
2631
2632    /// The request builder for [Projects::get_iam_policy][crate::client::Projects::get_iam_policy] calls.
2633    ///
2634    /// # Example
2635    /// ```
2636    /// # use google_cloud_resourcemanager_v3::builder::projects::GetIamPolicy;
2637    /// # async fn sample() -> gax::Result<()> {
2638    ///
2639    /// let builder = prepare_request_builder();
2640    /// let response = builder.send().await?;
2641    /// # Ok(()) }
2642    ///
2643    /// fn prepare_request_builder() -> GetIamPolicy {
2644    ///   # panic!();
2645    ///   // ... details omitted ...
2646    /// }
2647    /// ```
2648    #[derive(Clone, Debug)]
2649    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2650
2651    impl GetIamPolicy {
2652        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2653            Self(RequestBuilder::new(stub))
2654        }
2655
2656        /// Sets the full request, replacing any prior values.
2657        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2658            self.0.request = v.into();
2659            self
2660        }
2661
2662        /// Sets all the options, replacing any prior values.
2663        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2664            self.0.options = v.into();
2665            self
2666        }
2667
2668        /// Sends the request.
2669        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2670            (*self.0.stub)
2671                .get_iam_policy(self.0.request, self.0.options)
2672                .await
2673                .map(gax::response::Response::into_body)
2674        }
2675
2676        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
2677        ///
2678        /// This is a **required** field for requests.
2679        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2680            self.0.request.resource = v.into();
2681            self
2682        }
2683
2684        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
2685        pub fn set_options<T>(mut self, v: T) -> Self
2686        where
2687            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2688        {
2689            self.0.request.options = std::option::Option::Some(v.into());
2690            self
2691        }
2692
2693        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
2694        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2695        where
2696            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2697        {
2698            self.0.request.options = v.map(|x| x.into());
2699            self
2700        }
2701    }
2702
2703    #[doc(hidden)]
2704    impl gax::options::internal::RequestBuilder for GetIamPolicy {
2705        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2706            &mut self.0.options
2707        }
2708    }
2709
2710    /// The request builder for [Projects::set_iam_policy][crate::client::Projects::set_iam_policy] calls.
2711    ///
2712    /// # Example
2713    /// ```
2714    /// # use google_cloud_resourcemanager_v3::builder::projects::SetIamPolicy;
2715    /// # async fn sample() -> gax::Result<()> {
2716    ///
2717    /// let builder = prepare_request_builder();
2718    /// let response = builder.send().await?;
2719    /// # Ok(()) }
2720    ///
2721    /// fn prepare_request_builder() -> SetIamPolicy {
2722    ///   # panic!();
2723    ///   // ... details omitted ...
2724    /// }
2725    /// ```
2726    #[derive(Clone, Debug)]
2727    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2728
2729    impl SetIamPolicy {
2730        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2731            Self(RequestBuilder::new(stub))
2732        }
2733
2734        /// Sets the full request, replacing any prior values.
2735        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2736            self.0.request = v.into();
2737            self
2738        }
2739
2740        /// Sets all the options, replacing any prior values.
2741        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2742            self.0.options = v.into();
2743            self
2744        }
2745
2746        /// Sends the request.
2747        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2748            (*self.0.stub)
2749                .set_iam_policy(self.0.request, self.0.options)
2750                .await
2751                .map(gax::response::Response::into_body)
2752        }
2753
2754        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
2755        ///
2756        /// This is a **required** field for requests.
2757        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2758            self.0.request.resource = v.into();
2759            self
2760        }
2761
2762        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2763        ///
2764        /// This is a **required** field for requests.
2765        pub fn set_policy<T>(mut self, v: T) -> Self
2766        where
2767            T: std::convert::Into<iam_v1::model::Policy>,
2768        {
2769            self.0.request.policy = std::option::Option::Some(v.into());
2770            self
2771        }
2772
2773        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2774        ///
2775        /// This is a **required** field for requests.
2776        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2777        where
2778            T: std::convert::Into<iam_v1::model::Policy>,
2779        {
2780            self.0.request.policy = v.map(|x| x.into());
2781            self
2782        }
2783
2784        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2785        pub fn set_update_mask<T>(mut self, v: T) -> Self
2786        where
2787            T: std::convert::Into<wkt::FieldMask>,
2788        {
2789            self.0.request.update_mask = std::option::Option::Some(v.into());
2790            self
2791        }
2792
2793        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2794        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2795        where
2796            T: std::convert::Into<wkt::FieldMask>,
2797        {
2798            self.0.request.update_mask = v.map(|x| x.into());
2799            self
2800        }
2801    }
2802
2803    #[doc(hidden)]
2804    impl gax::options::internal::RequestBuilder for SetIamPolicy {
2805        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2806            &mut self.0.options
2807        }
2808    }
2809
2810    /// The request builder for [Projects::test_iam_permissions][crate::client::Projects::test_iam_permissions] calls.
2811    ///
2812    /// # Example
2813    /// ```
2814    /// # use google_cloud_resourcemanager_v3::builder::projects::TestIamPermissions;
2815    /// # async fn sample() -> gax::Result<()> {
2816    ///
2817    /// let builder = prepare_request_builder();
2818    /// let response = builder.send().await?;
2819    /// # Ok(()) }
2820    ///
2821    /// fn prepare_request_builder() -> TestIamPermissions {
2822    ///   # panic!();
2823    ///   // ... details omitted ...
2824    /// }
2825    /// ```
2826    #[derive(Clone, Debug)]
2827    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2828
2829    impl TestIamPermissions {
2830        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2831            Self(RequestBuilder::new(stub))
2832        }
2833
2834        /// Sets the full request, replacing any prior values.
2835        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2836            mut self,
2837            v: V,
2838        ) -> Self {
2839            self.0.request = v.into();
2840            self
2841        }
2842
2843        /// Sets all the options, replacing any prior values.
2844        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2845            self.0.options = v.into();
2846            self
2847        }
2848
2849        /// Sends the request.
2850        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2851            (*self.0.stub)
2852                .test_iam_permissions(self.0.request, self.0.options)
2853                .await
2854                .map(gax::response::Response::into_body)
2855        }
2856
2857        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
2858        ///
2859        /// This is a **required** field for requests.
2860        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2861            self.0.request.resource = v.into();
2862            self
2863        }
2864
2865        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
2866        ///
2867        /// This is a **required** field for requests.
2868        pub fn set_permissions<T, V>(mut self, v: T) -> Self
2869        where
2870            T: std::iter::IntoIterator<Item = V>,
2871            V: std::convert::Into<std::string::String>,
2872        {
2873            use std::iter::Iterator;
2874            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2875            self
2876        }
2877    }
2878
2879    #[doc(hidden)]
2880    impl gax::options::internal::RequestBuilder for TestIamPermissions {
2881        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2882            &mut self.0.options
2883        }
2884    }
2885
2886    /// The request builder for [Projects::get_operation][crate::client::Projects::get_operation] calls.
2887    ///
2888    /// # Example
2889    /// ```
2890    /// # use google_cloud_resourcemanager_v3::builder::projects::GetOperation;
2891    /// # async fn sample() -> gax::Result<()> {
2892    ///
2893    /// let builder = prepare_request_builder();
2894    /// let response = builder.send().await?;
2895    /// # Ok(()) }
2896    ///
2897    /// fn prepare_request_builder() -> GetOperation {
2898    ///   # panic!();
2899    ///   // ... details omitted ...
2900    /// }
2901    /// ```
2902    #[derive(Clone, Debug)]
2903    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2904
2905    impl GetOperation {
2906        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2907            Self(RequestBuilder::new(stub))
2908        }
2909
2910        /// Sets the full request, replacing any prior values.
2911        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2912            mut self,
2913            v: V,
2914        ) -> Self {
2915            self.0.request = v.into();
2916            self
2917        }
2918
2919        /// Sets all the options, replacing any prior values.
2920        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2921            self.0.options = v.into();
2922            self
2923        }
2924
2925        /// Sends the request.
2926        pub async fn send(self) -> Result<longrunning::model::Operation> {
2927            (*self.0.stub)
2928                .get_operation(self.0.request, self.0.options)
2929                .await
2930                .map(gax::response::Response::into_body)
2931        }
2932
2933        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2934        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2935            self.0.request.name = v.into();
2936            self
2937        }
2938    }
2939
2940    #[doc(hidden)]
2941    impl gax::options::internal::RequestBuilder for GetOperation {
2942        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2943            &mut self.0.options
2944        }
2945    }
2946}
2947
2948pub mod tag_bindings {
2949    use crate::Result;
2950
2951    /// A builder for [TagBindings][crate::client::TagBindings].
2952    ///
2953    /// ```
2954    /// # async fn sample() -> gax::client_builder::Result<()> {
2955    /// # use google_cloud_resourcemanager_v3::*;
2956    /// # use builder::tag_bindings::ClientBuilder;
2957    /// # use client::TagBindings;
2958    /// let builder : ClientBuilder = TagBindings::builder();
2959    /// let client = builder
2960    ///     .with_endpoint("https://cloudresourcemanager.googleapis.com")
2961    ///     .build().await?;
2962    /// # Ok(()) }
2963    /// ```
2964    pub type ClientBuilder =
2965        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2966
2967    pub(crate) mod client {
2968        use super::super::super::client::TagBindings;
2969        pub struct Factory;
2970        impl gax::client_builder::internal::ClientFactory for Factory {
2971            type Client = TagBindings;
2972            type Credentials = gaxi::options::Credentials;
2973            async fn build(
2974                self,
2975                config: gaxi::options::ClientConfig,
2976            ) -> gax::client_builder::Result<Self::Client> {
2977                Self::Client::new(config).await
2978            }
2979        }
2980    }
2981
2982    /// Common implementation for [crate::client::TagBindings] request builders.
2983    #[derive(Clone, Debug)]
2984    pub(crate) struct RequestBuilder<R: std::default::Default> {
2985        stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
2986        request: R,
2987        options: gax::options::RequestOptions,
2988    }
2989
2990    impl<R> RequestBuilder<R>
2991    where
2992        R: std::default::Default,
2993    {
2994        pub(crate) fn new(
2995            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
2996        ) -> Self {
2997            Self {
2998                stub,
2999                request: R::default(),
3000                options: gax::options::RequestOptions::default(),
3001            }
3002        }
3003    }
3004
3005    /// The request builder for [TagBindings::list_tag_bindings][crate::client::TagBindings::list_tag_bindings] calls.
3006    ///
3007    /// # Example
3008    /// ```
3009    /// # use google_cloud_resourcemanager_v3::builder::tag_bindings::ListTagBindings;
3010    /// # async fn sample() -> gax::Result<()> {
3011    /// use gax::paginator::ItemPaginator;
3012    ///
3013    /// let builder = prepare_request_builder();
3014    /// let mut items = builder.by_item();
3015    /// while let Some(result) = items.next().await {
3016    ///   let item = result?;
3017    /// }
3018    /// # Ok(()) }
3019    ///
3020    /// fn prepare_request_builder() -> ListTagBindings {
3021    ///   # panic!();
3022    ///   // ... details omitted ...
3023    /// }
3024    /// ```
3025    #[derive(Clone, Debug)]
3026    pub struct ListTagBindings(RequestBuilder<crate::model::ListTagBindingsRequest>);
3027
3028    impl ListTagBindings {
3029        pub(crate) fn new(
3030            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3031        ) -> Self {
3032            Self(RequestBuilder::new(stub))
3033        }
3034
3035        /// Sets the full request, replacing any prior values.
3036        pub fn with_request<V: Into<crate::model::ListTagBindingsRequest>>(mut self, v: V) -> Self {
3037            self.0.request = v.into();
3038            self
3039        }
3040
3041        /// Sets all the options, replacing any prior values.
3042        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3043            self.0.options = v.into();
3044            self
3045        }
3046
3047        /// Sends the request.
3048        pub async fn send(self) -> Result<crate::model::ListTagBindingsResponse> {
3049            (*self.0.stub)
3050                .list_tag_bindings(self.0.request, self.0.options)
3051                .await
3052                .map(gax::response::Response::into_body)
3053        }
3054
3055        /// Streams each page in the collection.
3056        pub fn by_page(
3057            self,
3058        ) -> impl gax::paginator::Paginator<crate::model::ListTagBindingsResponse, gax::error::Error>
3059        {
3060            use std::clone::Clone;
3061            let token = self.0.request.page_token.clone();
3062            let execute = move |token: String| {
3063                let mut builder = self.clone();
3064                builder.0.request = builder.0.request.set_page_token(token);
3065                builder.send()
3066            };
3067            gax::paginator::internal::new_paginator(token, execute)
3068        }
3069
3070        /// Streams each item in the collection.
3071        pub fn by_item(
3072            self,
3073        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTagBindingsResponse, gax::error::Error>
3074        {
3075            use gax::paginator::Paginator;
3076            self.by_page().items()
3077        }
3078
3079        /// Sets the value of [parent][crate::model::ListTagBindingsRequest::parent].
3080        ///
3081        /// This is a **required** field for requests.
3082        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3083            self.0.request.parent = v.into();
3084            self
3085        }
3086
3087        /// Sets the value of [page_size][crate::model::ListTagBindingsRequest::page_size].
3088        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3089            self.0.request.page_size = v.into();
3090            self
3091        }
3092
3093        /// Sets the value of [page_token][crate::model::ListTagBindingsRequest::page_token].
3094        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3095            self.0.request.page_token = v.into();
3096            self
3097        }
3098    }
3099
3100    #[doc(hidden)]
3101    impl gax::options::internal::RequestBuilder for ListTagBindings {
3102        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3103            &mut self.0.options
3104        }
3105    }
3106
3107    /// The request builder for [TagBindings::create_tag_binding][crate::client::TagBindings::create_tag_binding] calls.
3108    ///
3109    /// # Example
3110    /// ```
3111    /// # use google_cloud_resourcemanager_v3::builder::tag_bindings::CreateTagBinding;
3112    /// # async fn sample() -> gax::Result<()> {
3113    /// use lro::Poller;
3114    ///
3115    /// let builder = prepare_request_builder();
3116    /// let response = builder.poller().until_done().await?;
3117    /// # Ok(()) }
3118    ///
3119    /// fn prepare_request_builder() -> CreateTagBinding {
3120    ///   # panic!();
3121    ///   // ... details omitted ...
3122    /// }
3123    /// ```
3124    #[derive(Clone, Debug)]
3125    pub struct CreateTagBinding(RequestBuilder<crate::model::CreateTagBindingRequest>);
3126
3127    impl CreateTagBinding {
3128        pub(crate) fn new(
3129            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3130        ) -> Self {
3131            Self(RequestBuilder::new(stub))
3132        }
3133
3134        /// Sets the full request, replacing any prior values.
3135        pub fn with_request<V: Into<crate::model::CreateTagBindingRequest>>(
3136            mut self,
3137            v: V,
3138        ) -> Self {
3139            self.0.request = v.into();
3140            self
3141        }
3142
3143        /// Sets all the options, replacing any prior values.
3144        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3145            self.0.options = v.into();
3146            self
3147        }
3148
3149        /// Sends the request.
3150        ///
3151        /// # Long running operations
3152        ///
3153        /// This starts, but does not poll, a longrunning operation. More information
3154        /// on [create_tag_binding][crate::client::TagBindings::create_tag_binding].
3155        pub async fn send(self) -> Result<longrunning::model::Operation> {
3156            (*self.0.stub)
3157                .create_tag_binding(self.0.request, self.0.options)
3158                .await
3159                .map(gax::response::Response::into_body)
3160        }
3161
3162        /// Creates a [Poller][lro::Poller] to work with `create_tag_binding`.
3163        pub fn poller(
3164            self,
3165        ) -> impl lro::Poller<crate::model::TagBinding, crate::model::CreateTagBindingMetadata>
3166        {
3167            type Operation = lro::internal::Operation<
3168                crate::model::TagBinding,
3169                crate::model::CreateTagBindingMetadata,
3170            >;
3171            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3172            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3173
3174            let stub = self.0.stub.clone();
3175            let mut options = self.0.options.clone();
3176            options.set_retry_policy(gax::retry_policy::NeverRetry);
3177            let query = move |name| {
3178                let stub = stub.clone();
3179                let options = options.clone();
3180                async {
3181                    let op = GetOperation::new(stub)
3182                        .set_name(name)
3183                        .with_options(options)
3184                        .send()
3185                        .await?;
3186                    Ok(Operation::new(op))
3187                }
3188            };
3189
3190            let start = move || async {
3191                let op = self.send().await?;
3192                Ok(Operation::new(op))
3193            };
3194
3195            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3196        }
3197
3198        /// Sets the value of [tag_binding][crate::model::CreateTagBindingRequest::tag_binding].
3199        ///
3200        /// This is a **required** field for requests.
3201        pub fn set_tag_binding<T>(mut self, v: T) -> Self
3202        where
3203            T: std::convert::Into<crate::model::TagBinding>,
3204        {
3205            self.0.request.tag_binding = std::option::Option::Some(v.into());
3206            self
3207        }
3208
3209        /// Sets or clears the value of [tag_binding][crate::model::CreateTagBindingRequest::tag_binding].
3210        ///
3211        /// This is a **required** field for requests.
3212        pub fn set_or_clear_tag_binding<T>(mut self, v: std::option::Option<T>) -> Self
3213        where
3214            T: std::convert::Into<crate::model::TagBinding>,
3215        {
3216            self.0.request.tag_binding = v.map(|x| x.into());
3217            self
3218        }
3219
3220        /// Sets the value of [validate_only][crate::model::CreateTagBindingRequest::validate_only].
3221        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3222            self.0.request.validate_only = v.into();
3223            self
3224        }
3225    }
3226
3227    #[doc(hidden)]
3228    impl gax::options::internal::RequestBuilder for CreateTagBinding {
3229        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3230            &mut self.0.options
3231        }
3232    }
3233
3234    /// The request builder for [TagBindings::delete_tag_binding][crate::client::TagBindings::delete_tag_binding] calls.
3235    ///
3236    /// # Example
3237    /// ```
3238    /// # use google_cloud_resourcemanager_v3::builder::tag_bindings::DeleteTagBinding;
3239    /// # async fn sample() -> gax::Result<()> {
3240    /// use lro::Poller;
3241    ///
3242    /// let builder = prepare_request_builder();
3243    /// let response = builder.poller().until_done().await?;
3244    /// # Ok(()) }
3245    ///
3246    /// fn prepare_request_builder() -> DeleteTagBinding {
3247    ///   # panic!();
3248    ///   // ... details omitted ...
3249    /// }
3250    /// ```
3251    #[derive(Clone, Debug)]
3252    pub struct DeleteTagBinding(RequestBuilder<crate::model::DeleteTagBindingRequest>);
3253
3254    impl DeleteTagBinding {
3255        pub(crate) fn new(
3256            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3257        ) -> Self {
3258            Self(RequestBuilder::new(stub))
3259        }
3260
3261        /// Sets the full request, replacing any prior values.
3262        pub fn with_request<V: Into<crate::model::DeleteTagBindingRequest>>(
3263            mut self,
3264            v: V,
3265        ) -> Self {
3266            self.0.request = v.into();
3267            self
3268        }
3269
3270        /// Sets all the options, replacing any prior values.
3271        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3272            self.0.options = v.into();
3273            self
3274        }
3275
3276        /// Sends the request.
3277        ///
3278        /// # Long running operations
3279        ///
3280        /// This starts, but does not poll, a longrunning operation. More information
3281        /// on [delete_tag_binding][crate::client::TagBindings::delete_tag_binding].
3282        pub async fn send(self) -> Result<longrunning::model::Operation> {
3283            (*self.0.stub)
3284                .delete_tag_binding(self.0.request, self.0.options)
3285                .await
3286                .map(gax::response::Response::into_body)
3287        }
3288
3289        /// Creates a [Poller][lro::Poller] to work with `delete_tag_binding`.
3290        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTagBindingMetadata> {
3291            type Operation =
3292                lro::internal::Operation<wkt::Empty, crate::model::DeleteTagBindingMetadata>;
3293            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3294            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3295
3296            let stub = self.0.stub.clone();
3297            let mut options = self.0.options.clone();
3298            options.set_retry_policy(gax::retry_policy::NeverRetry);
3299            let query = move |name| {
3300                let stub = stub.clone();
3301                let options = options.clone();
3302                async {
3303                    let op = GetOperation::new(stub)
3304                        .set_name(name)
3305                        .with_options(options)
3306                        .send()
3307                        .await?;
3308                    Ok(Operation::new(op))
3309                }
3310            };
3311
3312            let start = move || async {
3313                let op = self.send().await?;
3314                Ok(Operation::new(op))
3315            };
3316
3317            lro::internal::new_unit_response_poller(
3318                polling_error_policy,
3319                polling_backoff_policy,
3320                start,
3321                query,
3322            )
3323        }
3324
3325        /// Sets the value of [name][crate::model::DeleteTagBindingRequest::name].
3326        ///
3327        /// This is a **required** field for requests.
3328        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3329            self.0.request.name = v.into();
3330            self
3331        }
3332    }
3333
3334    #[doc(hidden)]
3335    impl gax::options::internal::RequestBuilder for DeleteTagBinding {
3336        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3337            &mut self.0.options
3338        }
3339    }
3340
3341    /// The request builder for [TagBindings::list_effective_tags][crate::client::TagBindings::list_effective_tags] calls.
3342    ///
3343    /// # Example
3344    /// ```
3345    /// # use google_cloud_resourcemanager_v3::builder::tag_bindings::ListEffectiveTags;
3346    /// # async fn sample() -> gax::Result<()> {
3347    /// use gax::paginator::ItemPaginator;
3348    ///
3349    /// let builder = prepare_request_builder();
3350    /// let mut items = builder.by_item();
3351    /// while let Some(result) = items.next().await {
3352    ///   let item = result?;
3353    /// }
3354    /// # Ok(()) }
3355    ///
3356    /// fn prepare_request_builder() -> ListEffectiveTags {
3357    ///   # panic!();
3358    ///   // ... details omitted ...
3359    /// }
3360    /// ```
3361    #[derive(Clone, Debug)]
3362    pub struct ListEffectiveTags(RequestBuilder<crate::model::ListEffectiveTagsRequest>);
3363
3364    impl ListEffectiveTags {
3365        pub(crate) fn new(
3366            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3367        ) -> Self {
3368            Self(RequestBuilder::new(stub))
3369        }
3370
3371        /// Sets the full request, replacing any prior values.
3372        pub fn with_request<V: Into<crate::model::ListEffectiveTagsRequest>>(
3373            mut self,
3374            v: V,
3375        ) -> Self {
3376            self.0.request = v.into();
3377            self
3378        }
3379
3380        /// Sets all the options, replacing any prior values.
3381        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3382            self.0.options = v.into();
3383            self
3384        }
3385
3386        /// Sends the request.
3387        pub async fn send(self) -> Result<crate::model::ListEffectiveTagsResponse> {
3388            (*self.0.stub)
3389                .list_effective_tags(self.0.request, self.0.options)
3390                .await
3391                .map(gax::response::Response::into_body)
3392        }
3393
3394        /// Streams each page in the collection.
3395        pub fn by_page(
3396            self,
3397        ) -> impl gax::paginator::Paginator<crate::model::ListEffectiveTagsResponse, gax::error::Error>
3398        {
3399            use std::clone::Clone;
3400            let token = self.0.request.page_token.clone();
3401            let execute = move |token: String| {
3402                let mut builder = self.clone();
3403                builder.0.request = builder.0.request.set_page_token(token);
3404                builder.send()
3405            };
3406            gax::paginator::internal::new_paginator(token, execute)
3407        }
3408
3409        /// Streams each item in the collection.
3410        pub fn by_item(
3411            self,
3412        ) -> impl gax::paginator::ItemPaginator<crate::model::ListEffectiveTagsResponse, gax::error::Error>
3413        {
3414            use gax::paginator::Paginator;
3415            self.by_page().items()
3416        }
3417
3418        /// Sets the value of [parent][crate::model::ListEffectiveTagsRequest::parent].
3419        ///
3420        /// This is a **required** field for requests.
3421        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3422            self.0.request.parent = v.into();
3423            self
3424        }
3425
3426        /// Sets the value of [page_size][crate::model::ListEffectiveTagsRequest::page_size].
3427        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3428            self.0.request.page_size = v.into();
3429            self
3430        }
3431
3432        /// Sets the value of [page_token][crate::model::ListEffectiveTagsRequest::page_token].
3433        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3434            self.0.request.page_token = v.into();
3435            self
3436        }
3437    }
3438
3439    #[doc(hidden)]
3440    impl gax::options::internal::RequestBuilder for ListEffectiveTags {
3441        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3442            &mut self.0.options
3443        }
3444    }
3445
3446    /// The request builder for [TagBindings::get_operation][crate::client::TagBindings::get_operation] calls.
3447    ///
3448    /// # Example
3449    /// ```
3450    /// # use google_cloud_resourcemanager_v3::builder::tag_bindings::GetOperation;
3451    /// # async fn sample() -> gax::Result<()> {
3452    ///
3453    /// let builder = prepare_request_builder();
3454    /// let response = builder.send().await?;
3455    /// # Ok(()) }
3456    ///
3457    /// fn prepare_request_builder() -> GetOperation {
3458    ///   # panic!();
3459    ///   // ... details omitted ...
3460    /// }
3461    /// ```
3462    #[derive(Clone, Debug)]
3463    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3464
3465    impl GetOperation {
3466        pub(crate) fn new(
3467            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3468        ) -> Self {
3469            Self(RequestBuilder::new(stub))
3470        }
3471
3472        /// Sets the full request, replacing any prior values.
3473        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3474            mut self,
3475            v: V,
3476        ) -> Self {
3477            self.0.request = v.into();
3478            self
3479        }
3480
3481        /// Sets all the options, replacing any prior values.
3482        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3483            self.0.options = v.into();
3484            self
3485        }
3486
3487        /// Sends the request.
3488        pub async fn send(self) -> Result<longrunning::model::Operation> {
3489            (*self.0.stub)
3490                .get_operation(self.0.request, self.0.options)
3491                .await
3492                .map(gax::response::Response::into_body)
3493        }
3494
3495        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3496        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3497            self.0.request.name = v.into();
3498            self
3499        }
3500    }
3501
3502    #[doc(hidden)]
3503    impl gax::options::internal::RequestBuilder for GetOperation {
3504        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3505            &mut self.0.options
3506        }
3507    }
3508}
3509
3510pub mod tag_holds {
3511    use crate::Result;
3512
3513    /// A builder for [TagHolds][crate::client::TagHolds].
3514    ///
3515    /// ```
3516    /// # async fn sample() -> gax::client_builder::Result<()> {
3517    /// # use google_cloud_resourcemanager_v3::*;
3518    /// # use builder::tag_holds::ClientBuilder;
3519    /// # use client::TagHolds;
3520    /// let builder : ClientBuilder = TagHolds::builder();
3521    /// let client = builder
3522    ///     .with_endpoint("https://cloudresourcemanager.googleapis.com")
3523    ///     .build().await?;
3524    /// # Ok(()) }
3525    /// ```
3526    pub type ClientBuilder =
3527        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3528
3529    pub(crate) mod client {
3530        use super::super::super::client::TagHolds;
3531        pub struct Factory;
3532        impl gax::client_builder::internal::ClientFactory for Factory {
3533            type Client = TagHolds;
3534            type Credentials = gaxi::options::Credentials;
3535            async fn build(
3536                self,
3537                config: gaxi::options::ClientConfig,
3538            ) -> gax::client_builder::Result<Self::Client> {
3539                Self::Client::new(config).await
3540            }
3541        }
3542    }
3543
3544    /// Common implementation for [crate::client::TagHolds] request builders.
3545    #[derive(Clone, Debug)]
3546    pub(crate) struct RequestBuilder<R: std::default::Default> {
3547        stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>,
3548        request: R,
3549        options: gax::options::RequestOptions,
3550    }
3551
3552    impl<R> RequestBuilder<R>
3553    where
3554        R: std::default::Default,
3555    {
3556        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3557            Self {
3558                stub,
3559                request: R::default(),
3560                options: gax::options::RequestOptions::default(),
3561            }
3562        }
3563    }
3564
3565    /// The request builder for [TagHolds::create_tag_hold][crate::client::TagHolds::create_tag_hold] calls.
3566    ///
3567    /// # Example
3568    /// ```
3569    /// # use google_cloud_resourcemanager_v3::builder::tag_holds::CreateTagHold;
3570    /// # async fn sample() -> gax::Result<()> {
3571    /// use lro::Poller;
3572    ///
3573    /// let builder = prepare_request_builder();
3574    /// let response = builder.poller().until_done().await?;
3575    /// # Ok(()) }
3576    ///
3577    /// fn prepare_request_builder() -> CreateTagHold {
3578    ///   # panic!();
3579    ///   // ... details omitted ...
3580    /// }
3581    /// ```
3582    #[derive(Clone, Debug)]
3583    pub struct CreateTagHold(RequestBuilder<crate::model::CreateTagHoldRequest>);
3584
3585    impl CreateTagHold {
3586        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3587            Self(RequestBuilder::new(stub))
3588        }
3589
3590        /// Sets the full request, replacing any prior values.
3591        pub fn with_request<V: Into<crate::model::CreateTagHoldRequest>>(mut self, v: V) -> Self {
3592            self.0.request = v.into();
3593            self
3594        }
3595
3596        /// Sets all the options, replacing any prior values.
3597        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3598            self.0.options = v.into();
3599            self
3600        }
3601
3602        /// Sends the request.
3603        ///
3604        /// # Long running operations
3605        ///
3606        /// This starts, but does not poll, a longrunning operation. More information
3607        /// on [create_tag_hold][crate::client::TagHolds::create_tag_hold].
3608        pub async fn send(self) -> Result<longrunning::model::Operation> {
3609            (*self.0.stub)
3610                .create_tag_hold(self.0.request, self.0.options)
3611                .await
3612                .map(gax::response::Response::into_body)
3613        }
3614
3615        /// Creates a [Poller][lro::Poller] to work with `create_tag_hold`.
3616        pub fn poller(
3617            self,
3618        ) -> impl lro::Poller<crate::model::TagHold, crate::model::CreateTagHoldMetadata> {
3619            type Operation = lro::internal::Operation<
3620                crate::model::TagHold,
3621                crate::model::CreateTagHoldMetadata,
3622            >;
3623            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3624            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3625
3626            let stub = self.0.stub.clone();
3627            let mut options = self.0.options.clone();
3628            options.set_retry_policy(gax::retry_policy::NeverRetry);
3629            let query = move |name| {
3630                let stub = stub.clone();
3631                let options = options.clone();
3632                async {
3633                    let op = GetOperation::new(stub)
3634                        .set_name(name)
3635                        .with_options(options)
3636                        .send()
3637                        .await?;
3638                    Ok(Operation::new(op))
3639                }
3640            };
3641
3642            let start = move || async {
3643                let op = self.send().await?;
3644                Ok(Operation::new(op))
3645            };
3646
3647            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3648        }
3649
3650        /// Sets the value of [parent][crate::model::CreateTagHoldRequest::parent].
3651        ///
3652        /// This is a **required** field for requests.
3653        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3654            self.0.request.parent = v.into();
3655            self
3656        }
3657
3658        /// Sets the value of [tag_hold][crate::model::CreateTagHoldRequest::tag_hold].
3659        ///
3660        /// This is a **required** field for requests.
3661        pub fn set_tag_hold<T>(mut self, v: T) -> Self
3662        where
3663            T: std::convert::Into<crate::model::TagHold>,
3664        {
3665            self.0.request.tag_hold = std::option::Option::Some(v.into());
3666            self
3667        }
3668
3669        /// Sets or clears the value of [tag_hold][crate::model::CreateTagHoldRequest::tag_hold].
3670        ///
3671        /// This is a **required** field for requests.
3672        pub fn set_or_clear_tag_hold<T>(mut self, v: std::option::Option<T>) -> Self
3673        where
3674            T: std::convert::Into<crate::model::TagHold>,
3675        {
3676            self.0.request.tag_hold = v.map(|x| x.into());
3677            self
3678        }
3679
3680        /// Sets the value of [validate_only][crate::model::CreateTagHoldRequest::validate_only].
3681        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3682            self.0.request.validate_only = v.into();
3683            self
3684        }
3685    }
3686
3687    #[doc(hidden)]
3688    impl gax::options::internal::RequestBuilder for CreateTagHold {
3689        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3690            &mut self.0.options
3691        }
3692    }
3693
3694    /// The request builder for [TagHolds::delete_tag_hold][crate::client::TagHolds::delete_tag_hold] calls.
3695    ///
3696    /// # Example
3697    /// ```
3698    /// # use google_cloud_resourcemanager_v3::builder::tag_holds::DeleteTagHold;
3699    /// # async fn sample() -> gax::Result<()> {
3700    /// use lro::Poller;
3701    ///
3702    /// let builder = prepare_request_builder();
3703    /// let response = builder.poller().until_done().await?;
3704    /// # Ok(()) }
3705    ///
3706    /// fn prepare_request_builder() -> DeleteTagHold {
3707    ///   # panic!();
3708    ///   // ... details omitted ...
3709    /// }
3710    /// ```
3711    #[derive(Clone, Debug)]
3712    pub struct DeleteTagHold(RequestBuilder<crate::model::DeleteTagHoldRequest>);
3713
3714    impl DeleteTagHold {
3715        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3716            Self(RequestBuilder::new(stub))
3717        }
3718
3719        /// Sets the full request, replacing any prior values.
3720        pub fn with_request<V: Into<crate::model::DeleteTagHoldRequest>>(mut self, v: V) -> Self {
3721            self.0.request = v.into();
3722            self
3723        }
3724
3725        /// Sets all the options, replacing any prior values.
3726        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3727            self.0.options = v.into();
3728            self
3729        }
3730
3731        /// Sends the request.
3732        ///
3733        /// # Long running operations
3734        ///
3735        /// This starts, but does not poll, a longrunning operation. More information
3736        /// on [delete_tag_hold][crate::client::TagHolds::delete_tag_hold].
3737        pub async fn send(self) -> Result<longrunning::model::Operation> {
3738            (*self.0.stub)
3739                .delete_tag_hold(self.0.request, self.0.options)
3740                .await
3741                .map(gax::response::Response::into_body)
3742        }
3743
3744        /// Creates a [Poller][lro::Poller] to work with `delete_tag_hold`.
3745        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTagHoldMetadata> {
3746            type Operation =
3747                lro::internal::Operation<wkt::Empty, crate::model::DeleteTagHoldMetadata>;
3748            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3749            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3750
3751            let stub = self.0.stub.clone();
3752            let mut options = self.0.options.clone();
3753            options.set_retry_policy(gax::retry_policy::NeverRetry);
3754            let query = move |name| {
3755                let stub = stub.clone();
3756                let options = options.clone();
3757                async {
3758                    let op = GetOperation::new(stub)
3759                        .set_name(name)
3760                        .with_options(options)
3761                        .send()
3762                        .await?;
3763                    Ok(Operation::new(op))
3764                }
3765            };
3766
3767            let start = move || async {
3768                let op = self.send().await?;
3769                Ok(Operation::new(op))
3770            };
3771
3772            lro::internal::new_unit_response_poller(
3773                polling_error_policy,
3774                polling_backoff_policy,
3775                start,
3776                query,
3777            )
3778        }
3779
3780        /// Sets the value of [name][crate::model::DeleteTagHoldRequest::name].
3781        ///
3782        /// This is a **required** field for requests.
3783        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3784            self.0.request.name = v.into();
3785            self
3786        }
3787
3788        /// Sets the value of [validate_only][crate::model::DeleteTagHoldRequest::validate_only].
3789        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3790            self.0.request.validate_only = v.into();
3791            self
3792        }
3793    }
3794
3795    #[doc(hidden)]
3796    impl gax::options::internal::RequestBuilder for DeleteTagHold {
3797        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3798            &mut self.0.options
3799        }
3800    }
3801
3802    /// The request builder for [TagHolds::list_tag_holds][crate::client::TagHolds::list_tag_holds] calls.
3803    ///
3804    /// # Example
3805    /// ```
3806    /// # use google_cloud_resourcemanager_v3::builder::tag_holds::ListTagHolds;
3807    /// # async fn sample() -> gax::Result<()> {
3808    /// use gax::paginator::ItemPaginator;
3809    ///
3810    /// let builder = prepare_request_builder();
3811    /// let mut items = builder.by_item();
3812    /// while let Some(result) = items.next().await {
3813    ///   let item = result?;
3814    /// }
3815    /// # Ok(()) }
3816    ///
3817    /// fn prepare_request_builder() -> ListTagHolds {
3818    ///   # panic!();
3819    ///   // ... details omitted ...
3820    /// }
3821    /// ```
3822    #[derive(Clone, Debug)]
3823    pub struct ListTagHolds(RequestBuilder<crate::model::ListTagHoldsRequest>);
3824
3825    impl ListTagHolds {
3826        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3827            Self(RequestBuilder::new(stub))
3828        }
3829
3830        /// Sets the full request, replacing any prior values.
3831        pub fn with_request<V: Into<crate::model::ListTagHoldsRequest>>(mut self, v: V) -> Self {
3832            self.0.request = v.into();
3833            self
3834        }
3835
3836        /// Sets all the options, replacing any prior values.
3837        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3838            self.0.options = v.into();
3839            self
3840        }
3841
3842        /// Sends the request.
3843        pub async fn send(self) -> Result<crate::model::ListTagHoldsResponse> {
3844            (*self.0.stub)
3845                .list_tag_holds(self.0.request, self.0.options)
3846                .await
3847                .map(gax::response::Response::into_body)
3848        }
3849
3850        /// Streams each page in the collection.
3851        pub fn by_page(
3852            self,
3853        ) -> impl gax::paginator::Paginator<crate::model::ListTagHoldsResponse, gax::error::Error>
3854        {
3855            use std::clone::Clone;
3856            let token = self.0.request.page_token.clone();
3857            let execute = move |token: String| {
3858                let mut builder = self.clone();
3859                builder.0.request = builder.0.request.set_page_token(token);
3860                builder.send()
3861            };
3862            gax::paginator::internal::new_paginator(token, execute)
3863        }
3864
3865        /// Streams each item in the collection.
3866        pub fn by_item(
3867            self,
3868        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTagHoldsResponse, gax::error::Error>
3869        {
3870            use gax::paginator::Paginator;
3871            self.by_page().items()
3872        }
3873
3874        /// Sets the value of [parent][crate::model::ListTagHoldsRequest::parent].
3875        ///
3876        /// This is a **required** field for requests.
3877        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3878            self.0.request.parent = v.into();
3879            self
3880        }
3881
3882        /// Sets the value of [page_size][crate::model::ListTagHoldsRequest::page_size].
3883        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3884            self.0.request.page_size = v.into();
3885            self
3886        }
3887
3888        /// Sets the value of [page_token][crate::model::ListTagHoldsRequest::page_token].
3889        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3890            self.0.request.page_token = v.into();
3891            self
3892        }
3893
3894        /// Sets the value of [filter][crate::model::ListTagHoldsRequest::filter].
3895        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3896            self.0.request.filter = v.into();
3897            self
3898        }
3899    }
3900
3901    #[doc(hidden)]
3902    impl gax::options::internal::RequestBuilder for ListTagHolds {
3903        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3904            &mut self.0.options
3905        }
3906    }
3907
3908    /// The request builder for [TagHolds::get_operation][crate::client::TagHolds::get_operation] calls.
3909    ///
3910    /// # Example
3911    /// ```
3912    /// # use google_cloud_resourcemanager_v3::builder::tag_holds::GetOperation;
3913    /// # async fn sample() -> gax::Result<()> {
3914    ///
3915    /// let builder = prepare_request_builder();
3916    /// let response = builder.send().await?;
3917    /// # Ok(()) }
3918    ///
3919    /// fn prepare_request_builder() -> GetOperation {
3920    ///   # panic!();
3921    ///   // ... details omitted ...
3922    /// }
3923    /// ```
3924    #[derive(Clone, Debug)]
3925    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3926
3927    impl GetOperation {
3928        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3929            Self(RequestBuilder::new(stub))
3930        }
3931
3932        /// Sets the full request, replacing any prior values.
3933        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3934            mut self,
3935            v: V,
3936        ) -> Self {
3937            self.0.request = v.into();
3938            self
3939        }
3940
3941        /// Sets all the options, replacing any prior values.
3942        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3943            self.0.options = v.into();
3944            self
3945        }
3946
3947        /// Sends the request.
3948        pub async fn send(self) -> Result<longrunning::model::Operation> {
3949            (*self.0.stub)
3950                .get_operation(self.0.request, self.0.options)
3951                .await
3952                .map(gax::response::Response::into_body)
3953        }
3954
3955        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3956        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3957            self.0.request.name = v.into();
3958            self
3959        }
3960    }
3961
3962    #[doc(hidden)]
3963    impl gax::options::internal::RequestBuilder for GetOperation {
3964        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3965            &mut self.0.options
3966        }
3967    }
3968}
3969
3970pub mod tag_keys {
3971    use crate::Result;
3972
3973    /// A builder for [TagKeys][crate::client::TagKeys].
3974    ///
3975    /// ```
3976    /// # async fn sample() -> gax::client_builder::Result<()> {
3977    /// # use google_cloud_resourcemanager_v3::*;
3978    /// # use builder::tag_keys::ClientBuilder;
3979    /// # use client::TagKeys;
3980    /// let builder : ClientBuilder = TagKeys::builder();
3981    /// let client = builder
3982    ///     .with_endpoint("https://cloudresourcemanager.googleapis.com")
3983    ///     .build().await?;
3984    /// # Ok(()) }
3985    /// ```
3986    pub type ClientBuilder =
3987        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3988
3989    pub(crate) mod client {
3990        use super::super::super::client::TagKeys;
3991        pub struct Factory;
3992        impl gax::client_builder::internal::ClientFactory for Factory {
3993            type Client = TagKeys;
3994            type Credentials = gaxi::options::Credentials;
3995            async fn build(
3996                self,
3997                config: gaxi::options::ClientConfig,
3998            ) -> gax::client_builder::Result<Self::Client> {
3999                Self::Client::new(config).await
4000            }
4001        }
4002    }
4003
4004    /// Common implementation for [crate::client::TagKeys] request builders.
4005    #[derive(Clone, Debug)]
4006    pub(crate) struct RequestBuilder<R: std::default::Default> {
4007        stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>,
4008        request: R,
4009        options: gax::options::RequestOptions,
4010    }
4011
4012    impl<R> RequestBuilder<R>
4013    where
4014        R: std::default::Default,
4015    {
4016        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4017            Self {
4018                stub,
4019                request: R::default(),
4020                options: gax::options::RequestOptions::default(),
4021            }
4022        }
4023    }
4024
4025    /// The request builder for [TagKeys::list_tag_keys][crate::client::TagKeys::list_tag_keys] calls.
4026    ///
4027    /// # Example
4028    /// ```
4029    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::ListTagKeys;
4030    /// # async fn sample() -> gax::Result<()> {
4031    /// use gax::paginator::ItemPaginator;
4032    ///
4033    /// let builder = prepare_request_builder();
4034    /// let mut items = builder.by_item();
4035    /// while let Some(result) = items.next().await {
4036    ///   let item = result?;
4037    /// }
4038    /// # Ok(()) }
4039    ///
4040    /// fn prepare_request_builder() -> ListTagKeys {
4041    ///   # panic!();
4042    ///   // ... details omitted ...
4043    /// }
4044    /// ```
4045    #[derive(Clone, Debug)]
4046    pub struct ListTagKeys(RequestBuilder<crate::model::ListTagKeysRequest>);
4047
4048    impl ListTagKeys {
4049        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4050            Self(RequestBuilder::new(stub))
4051        }
4052
4053        /// Sets the full request, replacing any prior values.
4054        pub fn with_request<V: Into<crate::model::ListTagKeysRequest>>(mut self, v: V) -> Self {
4055            self.0.request = v.into();
4056            self
4057        }
4058
4059        /// Sets all the options, replacing any prior values.
4060        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4061            self.0.options = v.into();
4062            self
4063        }
4064
4065        /// Sends the request.
4066        pub async fn send(self) -> Result<crate::model::ListTagKeysResponse> {
4067            (*self.0.stub)
4068                .list_tag_keys(self.0.request, self.0.options)
4069                .await
4070                .map(gax::response::Response::into_body)
4071        }
4072
4073        /// Streams each page in the collection.
4074        pub fn by_page(
4075            self,
4076        ) -> impl gax::paginator::Paginator<crate::model::ListTagKeysResponse, gax::error::Error>
4077        {
4078            use std::clone::Clone;
4079            let token = self.0.request.page_token.clone();
4080            let execute = move |token: String| {
4081                let mut builder = self.clone();
4082                builder.0.request = builder.0.request.set_page_token(token);
4083                builder.send()
4084            };
4085            gax::paginator::internal::new_paginator(token, execute)
4086        }
4087
4088        /// Streams each item in the collection.
4089        pub fn by_item(
4090            self,
4091        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTagKeysResponse, gax::error::Error>
4092        {
4093            use gax::paginator::Paginator;
4094            self.by_page().items()
4095        }
4096
4097        /// Sets the value of [parent][crate::model::ListTagKeysRequest::parent].
4098        ///
4099        /// This is a **required** field for requests.
4100        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4101            self.0.request.parent = v.into();
4102            self
4103        }
4104
4105        /// Sets the value of [page_size][crate::model::ListTagKeysRequest::page_size].
4106        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4107            self.0.request.page_size = v.into();
4108            self
4109        }
4110
4111        /// Sets the value of [page_token][crate::model::ListTagKeysRequest::page_token].
4112        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4113            self.0.request.page_token = v.into();
4114            self
4115        }
4116    }
4117
4118    #[doc(hidden)]
4119    impl gax::options::internal::RequestBuilder for ListTagKeys {
4120        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4121            &mut self.0.options
4122        }
4123    }
4124
4125    /// The request builder for [TagKeys::get_tag_key][crate::client::TagKeys::get_tag_key] calls.
4126    ///
4127    /// # Example
4128    /// ```
4129    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::GetTagKey;
4130    /// # async fn sample() -> gax::Result<()> {
4131    ///
4132    /// let builder = prepare_request_builder();
4133    /// let response = builder.send().await?;
4134    /// # Ok(()) }
4135    ///
4136    /// fn prepare_request_builder() -> GetTagKey {
4137    ///   # panic!();
4138    ///   // ... details omitted ...
4139    /// }
4140    /// ```
4141    #[derive(Clone, Debug)]
4142    pub struct GetTagKey(RequestBuilder<crate::model::GetTagKeyRequest>);
4143
4144    impl GetTagKey {
4145        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4146            Self(RequestBuilder::new(stub))
4147        }
4148
4149        /// Sets the full request, replacing any prior values.
4150        pub fn with_request<V: Into<crate::model::GetTagKeyRequest>>(mut self, v: V) -> Self {
4151            self.0.request = v.into();
4152            self
4153        }
4154
4155        /// Sets all the options, replacing any prior values.
4156        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4157            self.0.options = v.into();
4158            self
4159        }
4160
4161        /// Sends the request.
4162        pub async fn send(self) -> Result<crate::model::TagKey> {
4163            (*self.0.stub)
4164                .get_tag_key(self.0.request, self.0.options)
4165                .await
4166                .map(gax::response::Response::into_body)
4167        }
4168
4169        /// Sets the value of [name][crate::model::GetTagKeyRequest::name].
4170        ///
4171        /// This is a **required** field for requests.
4172        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4173            self.0.request.name = v.into();
4174            self
4175        }
4176    }
4177
4178    #[doc(hidden)]
4179    impl gax::options::internal::RequestBuilder for GetTagKey {
4180        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4181            &mut self.0.options
4182        }
4183    }
4184
4185    /// The request builder for [TagKeys::get_namespaced_tag_key][crate::client::TagKeys::get_namespaced_tag_key] calls.
4186    ///
4187    /// # Example
4188    /// ```
4189    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::GetNamespacedTagKey;
4190    /// # async fn sample() -> gax::Result<()> {
4191    ///
4192    /// let builder = prepare_request_builder();
4193    /// let response = builder.send().await?;
4194    /// # Ok(()) }
4195    ///
4196    /// fn prepare_request_builder() -> GetNamespacedTagKey {
4197    ///   # panic!();
4198    ///   // ... details omitted ...
4199    /// }
4200    /// ```
4201    #[derive(Clone, Debug)]
4202    pub struct GetNamespacedTagKey(RequestBuilder<crate::model::GetNamespacedTagKeyRequest>);
4203
4204    impl GetNamespacedTagKey {
4205        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4206            Self(RequestBuilder::new(stub))
4207        }
4208
4209        /// Sets the full request, replacing any prior values.
4210        pub fn with_request<V: Into<crate::model::GetNamespacedTagKeyRequest>>(
4211            mut self,
4212            v: V,
4213        ) -> Self {
4214            self.0.request = v.into();
4215            self
4216        }
4217
4218        /// Sets all the options, replacing any prior values.
4219        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4220            self.0.options = v.into();
4221            self
4222        }
4223
4224        /// Sends the request.
4225        pub async fn send(self) -> Result<crate::model::TagKey> {
4226            (*self.0.stub)
4227                .get_namespaced_tag_key(self.0.request, self.0.options)
4228                .await
4229                .map(gax::response::Response::into_body)
4230        }
4231
4232        /// Sets the value of [name][crate::model::GetNamespacedTagKeyRequest::name].
4233        ///
4234        /// This is a **required** field for requests.
4235        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4236            self.0.request.name = v.into();
4237            self
4238        }
4239    }
4240
4241    #[doc(hidden)]
4242    impl gax::options::internal::RequestBuilder for GetNamespacedTagKey {
4243        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4244            &mut self.0.options
4245        }
4246    }
4247
4248    /// The request builder for [TagKeys::create_tag_key][crate::client::TagKeys::create_tag_key] calls.
4249    ///
4250    /// # Example
4251    /// ```
4252    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::CreateTagKey;
4253    /// # async fn sample() -> gax::Result<()> {
4254    /// use lro::Poller;
4255    ///
4256    /// let builder = prepare_request_builder();
4257    /// let response = builder.poller().until_done().await?;
4258    /// # Ok(()) }
4259    ///
4260    /// fn prepare_request_builder() -> CreateTagKey {
4261    ///   # panic!();
4262    ///   // ... details omitted ...
4263    /// }
4264    /// ```
4265    #[derive(Clone, Debug)]
4266    pub struct CreateTagKey(RequestBuilder<crate::model::CreateTagKeyRequest>);
4267
4268    impl CreateTagKey {
4269        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4270            Self(RequestBuilder::new(stub))
4271        }
4272
4273        /// Sets the full request, replacing any prior values.
4274        pub fn with_request<V: Into<crate::model::CreateTagKeyRequest>>(mut self, v: V) -> Self {
4275            self.0.request = v.into();
4276            self
4277        }
4278
4279        /// Sets all the options, replacing any prior values.
4280        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4281            self.0.options = v.into();
4282            self
4283        }
4284
4285        /// Sends the request.
4286        ///
4287        /// # Long running operations
4288        ///
4289        /// This starts, but does not poll, a longrunning operation. More information
4290        /// on [create_tag_key][crate::client::TagKeys::create_tag_key].
4291        pub async fn send(self) -> Result<longrunning::model::Operation> {
4292            (*self.0.stub)
4293                .create_tag_key(self.0.request, self.0.options)
4294                .await
4295                .map(gax::response::Response::into_body)
4296        }
4297
4298        /// Creates a [Poller][lro::Poller] to work with `create_tag_key`.
4299        pub fn poller(
4300            self,
4301        ) -> impl lro::Poller<crate::model::TagKey, crate::model::CreateTagKeyMetadata> {
4302            type Operation =
4303                lro::internal::Operation<crate::model::TagKey, crate::model::CreateTagKeyMetadata>;
4304            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4305            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4306
4307            let stub = self.0.stub.clone();
4308            let mut options = self.0.options.clone();
4309            options.set_retry_policy(gax::retry_policy::NeverRetry);
4310            let query = move |name| {
4311                let stub = stub.clone();
4312                let options = options.clone();
4313                async {
4314                    let op = GetOperation::new(stub)
4315                        .set_name(name)
4316                        .with_options(options)
4317                        .send()
4318                        .await?;
4319                    Ok(Operation::new(op))
4320                }
4321            };
4322
4323            let start = move || async {
4324                let op = self.send().await?;
4325                Ok(Operation::new(op))
4326            };
4327
4328            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4329        }
4330
4331        /// Sets the value of [tag_key][crate::model::CreateTagKeyRequest::tag_key].
4332        ///
4333        /// This is a **required** field for requests.
4334        pub fn set_tag_key<T>(mut self, v: T) -> Self
4335        where
4336            T: std::convert::Into<crate::model::TagKey>,
4337        {
4338            self.0.request.tag_key = std::option::Option::Some(v.into());
4339            self
4340        }
4341
4342        /// Sets or clears the value of [tag_key][crate::model::CreateTagKeyRequest::tag_key].
4343        ///
4344        /// This is a **required** field for requests.
4345        pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
4346        where
4347            T: std::convert::Into<crate::model::TagKey>,
4348        {
4349            self.0.request.tag_key = v.map(|x| x.into());
4350            self
4351        }
4352
4353        /// Sets the value of [validate_only][crate::model::CreateTagKeyRequest::validate_only].
4354        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4355            self.0.request.validate_only = v.into();
4356            self
4357        }
4358    }
4359
4360    #[doc(hidden)]
4361    impl gax::options::internal::RequestBuilder for CreateTagKey {
4362        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4363            &mut self.0.options
4364        }
4365    }
4366
4367    /// The request builder for [TagKeys::update_tag_key][crate::client::TagKeys::update_tag_key] calls.
4368    ///
4369    /// # Example
4370    /// ```
4371    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::UpdateTagKey;
4372    /// # async fn sample() -> gax::Result<()> {
4373    /// use lro::Poller;
4374    ///
4375    /// let builder = prepare_request_builder();
4376    /// let response = builder.poller().until_done().await?;
4377    /// # Ok(()) }
4378    ///
4379    /// fn prepare_request_builder() -> UpdateTagKey {
4380    ///   # panic!();
4381    ///   // ... details omitted ...
4382    /// }
4383    /// ```
4384    #[derive(Clone, Debug)]
4385    pub struct UpdateTagKey(RequestBuilder<crate::model::UpdateTagKeyRequest>);
4386
4387    impl UpdateTagKey {
4388        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4389            Self(RequestBuilder::new(stub))
4390        }
4391
4392        /// Sets the full request, replacing any prior values.
4393        pub fn with_request<V: Into<crate::model::UpdateTagKeyRequest>>(mut self, v: V) -> Self {
4394            self.0.request = v.into();
4395            self
4396        }
4397
4398        /// Sets all the options, replacing any prior values.
4399        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4400            self.0.options = v.into();
4401            self
4402        }
4403
4404        /// Sends the request.
4405        ///
4406        /// # Long running operations
4407        ///
4408        /// This starts, but does not poll, a longrunning operation. More information
4409        /// on [update_tag_key][crate::client::TagKeys::update_tag_key].
4410        pub async fn send(self) -> Result<longrunning::model::Operation> {
4411            (*self.0.stub)
4412                .update_tag_key(self.0.request, self.0.options)
4413                .await
4414                .map(gax::response::Response::into_body)
4415        }
4416
4417        /// Creates a [Poller][lro::Poller] to work with `update_tag_key`.
4418        pub fn poller(
4419            self,
4420        ) -> impl lro::Poller<crate::model::TagKey, crate::model::UpdateTagKeyMetadata> {
4421            type Operation =
4422                lro::internal::Operation<crate::model::TagKey, crate::model::UpdateTagKeyMetadata>;
4423            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4424            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4425
4426            let stub = self.0.stub.clone();
4427            let mut options = self.0.options.clone();
4428            options.set_retry_policy(gax::retry_policy::NeverRetry);
4429            let query = move |name| {
4430                let stub = stub.clone();
4431                let options = options.clone();
4432                async {
4433                    let op = GetOperation::new(stub)
4434                        .set_name(name)
4435                        .with_options(options)
4436                        .send()
4437                        .await?;
4438                    Ok(Operation::new(op))
4439                }
4440            };
4441
4442            let start = move || async {
4443                let op = self.send().await?;
4444                Ok(Operation::new(op))
4445            };
4446
4447            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4448        }
4449
4450        /// Sets the value of [tag_key][crate::model::UpdateTagKeyRequest::tag_key].
4451        ///
4452        /// This is a **required** field for requests.
4453        pub fn set_tag_key<T>(mut self, v: T) -> Self
4454        where
4455            T: std::convert::Into<crate::model::TagKey>,
4456        {
4457            self.0.request.tag_key = std::option::Option::Some(v.into());
4458            self
4459        }
4460
4461        /// Sets or clears the value of [tag_key][crate::model::UpdateTagKeyRequest::tag_key].
4462        ///
4463        /// This is a **required** field for requests.
4464        pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
4465        where
4466            T: std::convert::Into<crate::model::TagKey>,
4467        {
4468            self.0.request.tag_key = v.map(|x| x.into());
4469            self
4470        }
4471
4472        /// Sets the value of [update_mask][crate::model::UpdateTagKeyRequest::update_mask].
4473        pub fn set_update_mask<T>(mut self, v: T) -> Self
4474        where
4475            T: std::convert::Into<wkt::FieldMask>,
4476        {
4477            self.0.request.update_mask = std::option::Option::Some(v.into());
4478            self
4479        }
4480
4481        /// Sets or clears the value of [update_mask][crate::model::UpdateTagKeyRequest::update_mask].
4482        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4483        where
4484            T: std::convert::Into<wkt::FieldMask>,
4485        {
4486            self.0.request.update_mask = v.map(|x| x.into());
4487            self
4488        }
4489
4490        /// Sets the value of [validate_only][crate::model::UpdateTagKeyRequest::validate_only].
4491        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4492            self.0.request.validate_only = v.into();
4493            self
4494        }
4495    }
4496
4497    #[doc(hidden)]
4498    impl gax::options::internal::RequestBuilder for UpdateTagKey {
4499        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4500            &mut self.0.options
4501        }
4502    }
4503
4504    /// The request builder for [TagKeys::delete_tag_key][crate::client::TagKeys::delete_tag_key] calls.
4505    ///
4506    /// # Example
4507    /// ```
4508    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::DeleteTagKey;
4509    /// # async fn sample() -> gax::Result<()> {
4510    /// use lro::Poller;
4511    ///
4512    /// let builder = prepare_request_builder();
4513    /// let response = builder.poller().until_done().await?;
4514    /// # Ok(()) }
4515    ///
4516    /// fn prepare_request_builder() -> DeleteTagKey {
4517    ///   # panic!();
4518    ///   // ... details omitted ...
4519    /// }
4520    /// ```
4521    #[derive(Clone, Debug)]
4522    pub struct DeleteTagKey(RequestBuilder<crate::model::DeleteTagKeyRequest>);
4523
4524    impl DeleteTagKey {
4525        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4526            Self(RequestBuilder::new(stub))
4527        }
4528
4529        /// Sets the full request, replacing any prior values.
4530        pub fn with_request<V: Into<crate::model::DeleteTagKeyRequest>>(mut self, v: V) -> Self {
4531            self.0.request = v.into();
4532            self
4533        }
4534
4535        /// Sets all the options, replacing any prior values.
4536        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4537            self.0.options = v.into();
4538            self
4539        }
4540
4541        /// Sends the request.
4542        ///
4543        /// # Long running operations
4544        ///
4545        /// This starts, but does not poll, a longrunning operation. More information
4546        /// on [delete_tag_key][crate::client::TagKeys::delete_tag_key].
4547        pub async fn send(self) -> Result<longrunning::model::Operation> {
4548            (*self.0.stub)
4549                .delete_tag_key(self.0.request, self.0.options)
4550                .await
4551                .map(gax::response::Response::into_body)
4552        }
4553
4554        /// Creates a [Poller][lro::Poller] to work with `delete_tag_key`.
4555        pub fn poller(
4556            self,
4557        ) -> impl lro::Poller<crate::model::TagKey, crate::model::DeleteTagKeyMetadata> {
4558            type Operation =
4559                lro::internal::Operation<crate::model::TagKey, crate::model::DeleteTagKeyMetadata>;
4560            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4561            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4562
4563            let stub = self.0.stub.clone();
4564            let mut options = self.0.options.clone();
4565            options.set_retry_policy(gax::retry_policy::NeverRetry);
4566            let query = move |name| {
4567                let stub = stub.clone();
4568                let options = options.clone();
4569                async {
4570                    let op = GetOperation::new(stub)
4571                        .set_name(name)
4572                        .with_options(options)
4573                        .send()
4574                        .await?;
4575                    Ok(Operation::new(op))
4576                }
4577            };
4578
4579            let start = move || async {
4580                let op = self.send().await?;
4581                Ok(Operation::new(op))
4582            };
4583
4584            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4585        }
4586
4587        /// Sets the value of [name][crate::model::DeleteTagKeyRequest::name].
4588        ///
4589        /// This is a **required** field for requests.
4590        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4591            self.0.request.name = v.into();
4592            self
4593        }
4594
4595        /// Sets the value of [validate_only][crate::model::DeleteTagKeyRequest::validate_only].
4596        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4597            self.0.request.validate_only = v.into();
4598            self
4599        }
4600
4601        /// Sets the value of [etag][crate::model::DeleteTagKeyRequest::etag].
4602        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4603            self.0.request.etag = v.into();
4604            self
4605        }
4606    }
4607
4608    #[doc(hidden)]
4609    impl gax::options::internal::RequestBuilder for DeleteTagKey {
4610        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4611            &mut self.0.options
4612        }
4613    }
4614
4615    /// The request builder for [TagKeys::get_iam_policy][crate::client::TagKeys::get_iam_policy] calls.
4616    ///
4617    /// # Example
4618    /// ```
4619    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::GetIamPolicy;
4620    /// # async fn sample() -> gax::Result<()> {
4621    ///
4622    /// let builder = prepare_request_builder();
4623    /// let response = builder.send().await?;
4624    /// # Ok(()) }
4625    ///
4626    /// fn prepare_request_builder() -> GetIamPolicy {
4627    ///   # panic!();
4628    ///   // ... details omitted ...
4629    /// }
4630    /// ```
4631    #[derive(Clone, Debug)]
4632    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4633
4634    impl GetIamPolicy {
4635        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4636            Self(RequestBuilder::new(stub))
4637        }
4638
4639        /// Sets the full request, replacing any prior values.
4640        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4641            self.0.request = v.into();
4642            self
4643        }
4644
4645        /// Sets all the options, replacing any prior values.
4646        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4647            self.0.options = v.into();
4648            self
4649        }
4650
4651        /// Sends the request.
4652        pub async fn send(self) -> Result<iam_v1::model::Policy> {
4653            (*self.0.stub)
4654                .get_iam_policy(self.0.request, self.0.options)
4655                .await
4656                .map(gax::response::Response::into_body)
4657        }
4658
4659        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
4660        ///
4661        /// This is a **required** field for requests.
4662        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4663            self.0.request.resource = v.into();
4664            self
4665        }
4666
4667        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
4668        pub fn set_options<T>(mut self, v: T) -> Self
4669        where
4670            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4671        {
4672            self.0.request.options = std::option::Option::Some(v.into());
4673            self
4674        }
4675
4676        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
4677        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4678        where
4679            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4680        {
4681            self.0.request.options = v.map(|x| x.into());
4682            self
4683        }
4684    }
4685
4686    #[doc(hidden)]
4687    impl gax::options::internal::RequestBuilder for GetIamPolicy {
4688        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4689            &mut self.0.options
4690        }
4691    }
4692
4693    /// The request builder for [TagKeys::set_iam_policy][crate::client::TagKeys::set_iam_policy] calls.
4694    ///
4695    /// # Example
4696    /// ```
4697    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::SetIamPolicy;
4698    /// # async fn sample() -> gax::Result<()> {
4699    ///
4700    /// let builder = prepare_request_builder();
4701    /// let response = builder.send().await?;
4702    /// # Ok(()) }
4703    ///
4704    /// fn prepare_request_builder() -> SetIamPolicy {
4705    ///   # panic!();
4706    ///   // ... details omitted ...
4707    /// }
4708    /// ```
4709    #[derive(Clone, Debug)]
4710    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
4711
4712    impl SetIamPolicy {
4713        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4714            Self(RequestBuilder::new(stub))
4715        }
4716
4717        /// Sets the full request, replacing any prior values.
4718        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
4719            self.0.request = v.into();
4720            self
4721        }
4722
4723        /// Sets all the options, replacing any prior values.
4724        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4725            self.0.options = v.into();
4726            self
4727        }
4728
4729        /// Sends the request.
4730        pub async fn send(self) -> Result<iam_v1::model::Policy> {
4731            (*self.0.stub)
4732                .set_iam_policy(self.0.request, self.0.options)
4733                .await
4734                .map(gax::response::Response::into_body)
4735        }
4736
4737        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
4738        ///
4739        /// This is a **required** field for requests.
4740        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4741            self.0.request.resource = v.into();
4742            self
4743        }
4744
4745        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
4746        ///
4747        /// This is a **required** field for requests.
4748        pub fn set_policy<T>(mut self, v: T) -> Self
4749        where
4750            T: std::convert::Into<iam_v1::model::Policy>,
4751        {
4752            self.0.request.policy = std::option::Option::Some(v.into());
4753            self
4754        }
4755
4756        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
4757        ///
4758        /// This is a **required** field for requests.
4759        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4760        where
4761            T: std::convert::Into<iam_v1::model::Policy>,
4762        {
4763            self.0.request.policy = v.map(|x| x.into());
4764            self
4765        }
4766
4767        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
4768        pub fn set_update_mask<T>(mut self, v: T) -> Self
4769        where
4770            T: std::convert::Into<wkt::FieldMask>,
4771        {
4772            self.0.request.update_mask = std::option::Option::Some(v.into());
4773            self
4774        }
4775
4776        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
4777        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4778        where
4779            T: std::convert::Into<wkt::FieldMask>,
4780        {
4781            self.0.request.update_mask = v.map(|x| x.into());
4782            self
4783        }
4784    }
4785
4786    #[doc(hidden)]
4787    impl gax::options::internal::RequestBuilder for SetIamPolicy {
4788        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4789            &mut self.0.options
4790        }
4791    }
4792
4793    /// The request builder for [TagKeys::test_iam_permissions][crate::client::TagKeys::test_iam_permissions] calls.
4794    ///
4795    /// # Example
4796    /// ```
4797    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::TestIamPermissions;
4798    /// # async fn sample() -> gax::Result<()> {
4799    ///
4800    /// let builder = prepare_request_builder();
4801    /// let response = builder.send().await?;
4802    /// # Ok(()) }
4803    ///
4804    /// fn prepare_request_builder() -> TestIamPermissions {
4805    ///   # panic!();
4806    ///   // ... details omitted ...
4807    /// }
4808    /// ```
4809    #[derive(Clone, Debug)]
4810    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4811
4812    impl TestIamPermissions {
4813        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4814            Self(RequestBuilder::new(stub))
4815        }
4816
4817        /// Sets the full request, replacing any prior values.
4818        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4819            mut self,
4820            v: V,
4821        ) -> Self {
4822            self.0.request = v.into();
4823            self
4824        }
4825
4826        /// Sets all the options, replacing any prior values.
4827        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4828            self.0.options = v.into();
4829            self
4830        }
4831
4832        /// Sends the request.
4833        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4834            (*self.0.stub)
4835                .test_iam_permissions(self.0.request, self.0.options)
4836                .await
4837                .map(gax::response::Response::into_body)
4838        }
4839
4840        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
4841        ///
4842        /// This is a **required** field for requests.
4843        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4844            self.0.request.resource = v.into();
4845            self
4846        }
4847
4848        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
4849        ///
4850        /// This is a **required** field for requests.
4851        pub fn set_permissions<T, V>(mut self, v: T) -> Self
4852        where
4853            T: std::iter::IntoIterator<Item = V>,
4854            V: std::convert::Into<std::string::String>,
4855        {
4856            use std::iter::Iterator;
4857            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4858            self
4859        }
4860    }
4861
4862    #[doc(hidden)]
4863    impl gax::options::internal::RequestBuilder for TestIamPermissions {
4864        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4865            &mut self.0.options
4866        }
4867    }
4868
4869    /// The request builder for [TagKeys::get_operation][crate::client::TagKeys::get_operation] calls.
4870    ///
4871    /// # Example
4872    /// ```
4873    /// # use google_cloud_resourcemanager_v3::builder::tag_keys::GetOperation;
4874    /// # async fn sample() -> gax::Result<()> {
4875    ///
4876    /// let builder = prepare_request_builder();
4877    /// let response = builder.send().await?;
4878    /// # Ok(()) }
4879    ///
4880    /// fn prepare_request_builder() -> GetOperation {
4881    ///   # panic!();
4882    ///   // ... details omitted ...
4883    /// }
4884    /// ```
4885    #[derive(Clone, Debug)]
4886    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4887
4888    impl GetOperation {
4889        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4890            Self(RequestBuilder::new(stub))
4891        }
4892
4893        /// Sets the full request, replacing any prior values.
4894        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4895            mut self,
4896            v: V,
4897        ) -> Self {
4898            self.0.request = v.into();
4899            self
4900        }
4901
4902        /// Sets all the options, replacing any prior values.
4903        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4904            self.0.options = v.into();
4905            self
4906        }
4907
4908        /// Sends the request.
4909        pub async fn send(self) -> Result<longrunning::model::Operation> {
4910            (*self.0.stub)
4911                .get_operation(self.0.request, self.0.options)
4912                .await
4913                .map(gax::response::Response::into_body)
4914        }
4915
4916        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4917        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4918            self.0.request.name = v.into();
4919            self
4920        }
4921    }
4922
4923    #[doc(hidden)]
4924    impl gax::options::internal::RequestBuilder for GetOperation {
4925        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4926            &mut self.0.options
4927        }
4928    }
4929}
4930
4931pub mod tag_values {
4932    use crate::Result;
4933
4934    /// A builder for [TagValues][crate::client::TagValues].
4935    ///
4936    /// ```
4937    /// # async fn sample() -> gax::client_builder::Result<()> {
4938    /// # use google_cloud_resourcemanager_v3::*;
4939    /// # use builder::tag_values::ClientBuilder;
4940    /// # use client::TagValues;
4941    /// let builder : ClientBuilder = TagValues::builder();
4942    /// let client = builder
4943    ///     .with_endpoint("https://cloudresourcemanager.googleapis.com")
4944    ///     .build().await?;
4945    /// # Ok(()) }
4946    /// ```
4947    pub type ClientBuilder =
4948        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4949
4950    pub(crate) mod client {
4951        use super::super::super::client::TagValues;
4952        pub struct Factory;
4953        impl gax::client_builder::internal::ClientFactory for Factory {
4954            type Client = TagValues;
4955            type Credentials = gaxi::options::Credentials;
4956            async fn build(
4957                self,
4958                config: gaxi::options::ClientConfig,
4959            ) -> gax::client_builder::Result<Self::Client> {
4960                Self::Client::new(config).await
4961            }
4962        }
4963    }
4964
4965    /// Common implementation for [crate::client::TagValues] request builders.
4966    #[derive(Clone, Debug)]
4967    pub(crate) struct RequestBuilder<R: std::default::Default> {
4968        stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
4969        request: R,
4970        options: gax::options::RequestOptions,
4971    }
4972
4973    impl<R> RequestBuilder<R>
4974    where
4975        R: std::default::Default,
4976    {
4977        pub(crate) fn new(
4978            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
4979        ) -> Self {
4980            Self {
4981                stub,
4982                request: R::default(),
4983                options: gax::options::RequestOptions::default(),
4984            }
4985        }
4986    }
4987
4988    /// The request builder for [TagValues::list_tag_values][crate::client::TagValues::list_tag_values] calls.
4989    ///
4990    /// # Example
4991    /// ```
4992    /// # use google_cloud_resourcemanager_v3::builder::tag_values::ListTagValues;
4993    /// # async fn sample() -> gax::Result<()> {
4994    /// use gax::paginator::ItemPaginator;
4995    ///
4996    /// let builder = prepare_request_builder();
4997    /// let mut items = builder.by_item();
4998    /// while let Some(result) = items.next().await {
4999    ///   let item = result?;
5000    /// }
5001    /// # Ok(()) }
5002    ///
5003    /// fn prepare_request_builder() -> ListTagValues {
5004    ///   # panic!();
5005    ///   // ... details omitted ...
5006    /// }
5007    /// ```
5008    #[derive(Clone, Debug)]
5009    pub struct ListTagValues(RequestBuilder<crate::model::ListTagValuesRequest>);
5010
5011    impl ListTagValues {
5012        pub(crate) fn new(
5013            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5014        ) -> Self {
5015            Self(RequestBuilder::new(stub))
5016        }
5017
5018        /// Sets the full request, replacing any prior values.
5019        pub fn with_request<V: Into<crate::model::ListTagValuesRequest>>(mut self, v: V) -> Self {
5020            self.0.request = v.into();
5021            self
5022        }
5023
5024        /// Sets all the options, replacing any prior values.
5025        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5026            self.0.options = v.into();
5027            self
5028        }
5029
5030        /// Sends the request.
5031        pub async fn send(self) -> Result<crate::model::ListTagValuesResponse> {
5032            (*self.0.stub)
5033                .list_tag_values(self.0.request, self.0.options)
5034                .await
5035                .map(gax::response::Response::into_body)
5036        }
5037
5038        /// Streams each page in the collection.
5039        pub fn by_page(
5040            self,
5041        ) -> impl gax::paginator::Paginator<crate::model::ListTagValuesResponse, gax::error::Error>
5042        {
5043            use std::clone::Clone;
5044            let token = self.0.request.page_token.clone();
5045            let execute = move |token: String| {
5046                let mut builder = self.clone();
5047                builder.0.request = builder.0.request.set_page_token(token);
5048                builder.send()
5049            };
5050            gax::paginator::internal::new_paginator(token, execute)
5051        }
5052
5053        /// Streams each item in the collection.
5054        pub fn by_item(
5055            self,
5056        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTagValuesResponse, gax::error::Error>
5057        {
5058            use gax::paginator::Paginator;
5059            self.by_page().items()
5060        }
5061
5062        /// Sets the value of [parent][crate::model::ListTagValuesRequest::parent].
5063        ///
5064        /// This is a **required** field for requests.
5065        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5066            self.0.request.parent = v.into();
5067            self
5068        }
5069
5070        /// Sets the value of [page_size][crate::model::ListTagValuesRequest::page_size].
5071        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5072            self.0.request.page_size = v.into();
5073            self
5074        }
5075
5076        /// Sets the value of [page_token][crate::model::ListTagValuesRequest::page_token].
5077        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5078            self.0.request.page_token = v.into();
5079            self
5080        }
5081    }
5082
5083    #[doc(hidden)]
5084    impl gax::options::internal::RequestBuilder for ListTagValues {
5085        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5086            &mut self.0.options
5087        }
5088    }
5089
5090    /// The request builder for [TagValues::get_tag_value][crate::client::TagValues::get_tag_value] calls.
5091    ///
5092    /// # Example
5093    /// ```
5094    /// # use google_cloud_resourcemanager_v3::builder::tag_values::GetTagValue;
5095    /// # async fn sample() -> gax::Result<()> {
5096    ///
5097    /// let builder = prepare_request_builder();
5098    /// let response = builder.send().await?;
5099    /// # Ok(()) }
5100    ///
5101    /// fn prepare_request_builder() -> GetTagValue {
5102    ///   # panic!();
5103    ///   // ... details omitted ...
5104    /// }
5105    /// ```
5106    #[derive(Clone, Debug)]
5107    pub struct GetTagValue(RequestBuilder<crate::model::GetTagValueRequest>);
5108
5109    impl GetTagValue {
5110        pub(crate) fn new(
5111            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5112        ) -> Self {
5113            Self(RequestBuilder::new(stub))
5114        }
5115
5116        /// Sets the full request, replacing any prior values.
5117        pub fn with_request<V: Into<crate::model::GetTagValueRequest>>(mut self, v: V) -> Self {
5118            self.0.request = v.into();
5119            self
5120        }
5121
5122        /// Sets all the options, replacing any prior values.
5123        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5124            self.0.options = v.into();
5125            self
5126        }
5127
5128        /// Sends the request.
5129        pub async fn send(self) -> Result<crate::model::TagValue> {
5130            (*self.0.stub)
5131                .get_tag_value(self.0.request, self.0.options)
5132                .await
5133                .map(gax::response::Response::into_body)
5134        }
5135
5136        /// Sets the value of [name][crate::model::GetTagValueRequest::name].
5137        ///
5138        /// This is a **required** field for requests.
5139        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5140            self.0.request.name = v.into();
5141            self
5142        }
5143    }
5144
5145    #[doc(hidden)]
5146    impl gax::options::internal::RequestBuilder for GetTagValue {
5147        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5148            &mut self.0.options
5149        }
5150    }
5151
5152    /// The request builder for [TagValues::get_namespaced_tag_value][crate::client::TagValues::get_namespaced_tag_value] calls.
5153    ///
5154    /// # Example
5155    /// ```
5156    /// # use google_cloud_resourcemanager_v3::builder::tag_values::GetNamespacedTagValue;
5157    /// # async fn sample() -> gax::Result<()> {
5158    ///
5159    /// let builder = prepare_request_builder();
5160    /// let response = builder.send().await?;
5161    /// # Ok(()) }
5162    ///
5163    /// fn prepare_request_builder() -> GetNamespacedTagValue {
5164    ///   # panic!();
5165    ///   // ... details omitted ...
5166    /// }
5167    /// ```
5168    #[derive(Clone, Debug)]
5169    pub struct GetNamespacedTagValue(RequestBuilder<crate::model::GetNamespacedTagValueRequest>);
5170
5171    impl GetNamespacedTagValue {
5172        pub(crate) fn new(
5173            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5174        ) -> Self {
5175            Self(RequestBuilder::new(stub))
5176        }
5177
5178        /// Sets the full request, replacing any prior values.
5179        pub fn with_request<V: Into<crate::model::GetNamespacedTagValueRequest>>(
5180            mut self,
5181            v: V,
5182        ) -> Self {
5183            self.0.request = v.into();
5184            self
5185        }
5186
5187        /// Sets all the options, replacing any prior values.
5188        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5189            self.0.options = v.into();
5190            self
5191        }
5192
5193        /// Sends the request.
5194        pub async fn send(self) -> Result<crate::model::TagValue> {
5195            (*self.0.stub)
5196                .get_namespaced_tag_value(self.0.request, self.0.options)
5197                .await
5198                .map(gax::response::Response::into_body)
5199        }
5200
5201        /// Sets the value of [name][crate::model::GetNamespacedTagValueRequest::name].
5202        ///
5203        /// This is a **required** field for requests.
5204        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5205            self.0.request.name = v.into();
5206            self
5207        }
5208    }
5209
5210    #[doc(hidden)]
5211    impl gax::options::internal::RequestBuilder for GetNamespacedTagValue {
5212        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5213            &mut self.0.options
5214        }
5215    }
5216
5217    /// The request builder for [TagValues::create_tag_value][crate::client::TagValues::create_tag_value] calls.
5218    ///
5219    /// # Example
5220    /// ```
5221    /// # use google_cloud_resourcemanager_v3::builder::tag_values::CreateTagValue;
5222    /// # async fn sample() -> gax::Result<()> {
5223    /// use lro::Poller;
5224    ///
5225    /// let builder = prepare_request_builder();
5226    /// let response = builder.poller().until_done().await?;
5227    /// # Ok(()) }
5228    ///
5229    /// fn prepare_request_builder() -> CreateTagValue {
5230    ///   # panic!();
5231    ///   // ... details omitted ...
5232    /// }
5233    /// ```
5234    #[derive(Clone, Debug)]
5235    pub struct CreateTagValue(RequestBuilder<crate::model::CreateTagValueRequest>);
5236
5237    impl CreateTagValue {
5238        pub(crate) fn new(
5239            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5240        ) -> Self {
5241            Self(RequestBuilder::new(stub))
5242        }
5243
5244        /// Sets the full request, replacing any prior values.
5245        pub fn with_request<V: Into<crate::model::CreateTagValueRequest>>(mut self, v: V) -> Self {
5246            self.0.request = v.into();
5247            self
5248        }
5249
5250        /// Sets all the options, replacing any prior values.
5251        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5252            self.0.options = v.into();
5253            self
5254        }
5255
5256        /// Sends the request.
5257        ///
5258        /// # Long running operations
5259        ///
5260        /// This starts, but does not poll, a longrunning operation. More information
5261        /// on [create_tag_value][crate::client::TagValues::create_tag_value].
5262        pub async fn send(self) -> Result<longrunning::model::Operation> {
5263            (*self.0.stub)
5264                .create_tag_value(self.0.request, self.0.options)
5265                .await
5266                .map(gax::response::Response::into_body)
5267        }
5268
5269        /// Creates a [Poller][lro::Poller] to work with `create_tag_value`.
5270        pub fn poller(
5271            self,
5272        ) -> impl lro::Poller<crate::model::TagValue, crate::model::CreateTagValueMetadata>
5273        {
5274            type Operation = lro::internal::Operation<
5275                crate::model::TagValue,
5276                crate::model::CreateTagValueMetadata,
5277            >;
5278            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5279            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5280
5281            let stub = self.0.stub.clone();
5282            let mut options = self.0.options.clone();
5283            options.set_retry_policy(gax::retry_policy::NeverRetry);
5284            let query = move |name| {
5285                let stub = stub.clone();
5286                let options = options.clone();
5287                async {
5288                    let op = GetOperation::new(stub)
5289                        .set_name(name)
5290                        .with_options(options)
5291                        .send()
5292                        .await?;
5293                    Ok(Operation::new(op))
5294                }
5295            };
5296
5297            let start = move || async {
5298                let op = self.send().await?;
5299                Ok(Operation::new(op))
5300            };
5301
5302            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5303        }
5304
5305        /// Sets the value of [tag_value][crate::model::CreateTagValueRequest::tag_value].
5306        ///
5307        /// This is a **required** field for requests.
5308        pub fn set_tag_value<T>(mut self, v: T) -> Self
5309        where
5310            T: std::convert::Into<crate::model::TagValue>,
5311        {
5312            self.0.request.tag_value = std::option::Option::Some(v.into());
5313            self
5314        }
5315
5316        /// Sets or clears the value of [tag_value][crate::model::CreateTagValueRequest::tag_value].
5317        ///
5318        /// This is a **required** field for requests.
5319        pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
5320        where
5321            T: std::convert::Into<crate::model::TagValue>,
5322        {
5323            self.0.request.tag_value = v.map(|x| x.into());
5324            self
5325        }
5326
5327        /// Sets the value of [validate_only][crate::model::CreateTagValueRequest::validate_only].
5328        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5329            self.0.request.validate_only = v.into();
5330            self
5331        }
5332    }
5333
5334    #[doc(hidden)]
5335    impl gax::options::internal::RequestBuilder for CreateTagValue {
5336        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5337            &mut self.0.options
5338        }
5339    }
5340
5341    /// The request builder for [TagValues::update_tag_value][crate::client::TagValues::update_tag_value] calls.
5342    ///
5343    /// # Example
5344    /// ```
5345    /// # use google_cloud_resourcemanager_v3::builder::tag_values::UpdateTagValue;
5346    /// # async fn sample() -> gax::Result<()> {
5347    /// use lro::Poller;
5348    ///
5349    /// let builder = prepare_request_builder();
5350    /// let response = builder.poller().until_done().await?;
5351    /// # Ok(()) }
5352    ///
5353    /// fn prepare_request_builder() -> UpdateTagValue {
5354    ///   # panic!();
5355    ///   // ... details omitted ...
5356    /// }
5357    /// ```
5358    #[derive(Clone, Debug)]
5359    pub struct UpdateTagValue(RequestBuilder<crate::model::UpdateTagValueRequest>);
5360
5361    impl UpdateTagValue {
5362        pub(crate) fn new(
5363            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5364        ) -> Self {
5365            Self(RequestBuilder::new(stub))
5366        }
5367
5368        /// Sets the full request, replacing any prior values.
5369        pub fn with_request<V: Into<crate::model::UpdateTagValueRequest>>(mut self, v: V) -> Self {
5370            self.0.request = v.into();
5371            self
5372        }
5373
5374        /// Sets all the options, replacing any prior values.
5375        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5376            self.0.options = v.into();
5377            self
5378        }
5379
5380        /// Sends the request.
5381        ///
5382        /// # Long running operations
5383        ///
5384        /// This starts, but does not poll, a longrunning operation. More information
5385        /// on [update_tag_value][crate::client::TagValues::update_tag_value].
5386        pub async fn send(self) -> Result<longrunning::model::Operation> {
5387            (*self.0.stub)
5388                .update_tag_value(self.0.request, self.0.options)
5389                .await
5390                .map(gax::response::Response::into_body)
5391        }
5392
5393        /// Creates a [Poller][lro::Poller] to work with `update_tag_value`.
5394        pub fn poller(
5395            self,
5396        ) -> impl lro::Poller<crate::model::TagValue, crate::model::UpdateTagValueMetadata>
5397        {
5398            type Operation = lro::internal::Operation<
5399                crate::model::TagValue,
5400                crate::model::UpdateTagValueMetadata,
5401            >;
5402            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5403            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5404
5405            let stub = self.0.stub.clone();
5406            let mut options = self.0.options.clone();
5407            options.set_retry_policy(gax::retry_policy::NeverRetry);
5408            let query = move |name| {
5409                let stub = stub.clone();
5410                let options = options.clone();
5411                async {
5412                    let op = GetOperation::new(stub)
5413                        .set_name(name)
5414                        .with_options(options)
5415                        .send()
5416                        .await?;
5417                    Ok(Operation::new(op))
5418                }
5419            };
5420
5421            let start = move || async {
5422                let op = self.send().await?;
5423                Ok(Operation::new(op))
5424            };
5425
5426            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5427        }
5428
5429        /// Sets the value of [tag_value][crate::model::UpdateTagValueRequest::tag_value].
5430        ///
5431        /// This is a **required** field for requests.
5432        pub fn set_tag_value<T>(mut self, v: T) -> Self
5433        where
5434            T: std::convert::Into<crate::model::TagValue>,
5435        {
5436            self.0.request.tag_value = std::option::Option::Some(v.into());
5437            self
5438        }
5439
5440        /// Sets or clears the value of [tag_value][crate::model::UpdateTagValueRequest::tag_value].
5441        ///
5442        /// This is a **required** field for requests.
5443        pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
5444        where
5445            T: std::convert::Into<crate::model::TagValue>,
5446        {
5447            self.0.request.tag_value = v.map(|x| x.into());
5448            self
5449        }
5450
5451        /// Sets the value of [update_mask][crate::model::UpdateTagValueRequest::update_mask].
5452        pub fn set_update_mask<T>(mut self, v: T) -> Self
5453        where
5454            T: std::convert::Into<wkt::FieldMask>,
5455        {
5456            self.0.request.update_mask = std::option::Option::Some(v.into());
5457            self
5458        }
5459
5460        /// Sets or clears the value of [update_mask][crate::model::UpdateTagValueRequest::update_mask].
5461        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5462        where
5463            T: std::convert::Into<wkt::FieldMask>,
5464        {
5465            self.0.request.update_mask = v.map(|x| x.into());
5466            self
5467        }
5468
5469        /// Sets the value of [validate_only][crate::model::UpdateTagValueRequest::validate_only].
5470        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5471            self.0.request.validate_only = v.into();
5472            self
5473        }
5474    }
5475
5476    #[doc(hidden)]
5477    impl gax::options::internal::RequestBuilder for UpdateTagValue {
5478        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5479            &mut self.0.options
5480        }
5481    }
5482
5483    /// The request builder for [TagValues::delete_tag_value][crate::client::TagValues::delete_tag_value] calls.
5484    ///
5485    /// # Example
5486    /// ```
5487    /// # use google_cloud_resourcemanager_v3::builder::tag_values::DeleteTagValue;
5488    /// # async fn sample() -> gax::Result<()> {
5489    /// use lro::Poller;
5490    ///
5491    /// let builder = prepare_request_builder();
5492    /// let response = builder.poller().until_done().await?;
5493    /// # Ok(()) }
5494    ///
5495    /// fn prepare_request_builder() -> DeleteTagValue {
5496    ///   # panic!();
5497    ///   // ... details omitted ...
5498    /// }
5499    /// ```
5500    #[derive(Clone, Debug)]
5501    pub struct DeleteTagValue(RequestBuilder<crate::model::DeleteTagValueRequest>);
5502
5503    impl DeleteTagValue {
5504        pub(crate) fn new(
5505            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5506        ) -> Self {
5507            Self(RequestBuilder::new(stub))
5508        }
5509
5510        /// Sets the full request, replacing any prior values.
5511        pub fn with_request<V: Into<crate::model::DeleteTagValueRequest>>(mut self, v: V) -> Self {
5512            self.0.request = v.into();
5513            self
5514        }
5515
5516        /// Sets all the options, replacing any prior values.
5517        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5518            self.0.options = v.into();
5519            self
5520        }
5521
5522        /// Sends the request.
5523        ///
5524        /// # Long running operations
5525        ///
5526        /// This starts, but does not poll, a longrunning operation. More information
5527        /// on [delete_tag_value][crate::client::TagValues::delete_tag_value].
5528        pub async fn send(self) -> Result<longrunning::model::Operation> {
5529            (*self.0.stub)
5530                .delete_tag_value(self.0.request, self.0.options)
5531                .await
5532                .map(gax::response::Response::into_body)
5533        }
5534
5535        /// Creates a [Poller][lro::Poller] to work with `delete_tag_value`.
5536        pub fn poller(
5537            self,
5538        ) -> impl lro::Poller<crate::model::TagValue, crate::model::DeleteTagValueMetadata>
5539        {
5540            type Operation = lro::internal::Operation<
5541                crate::model::TagValue,
5542                crate::model::DeleteTagValueMetadata,
5543            >;
5544            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5545            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5546
5547            let stub = self.0.stub.clone();
5548            let mut options = self.0.options.clone();
5549            options.set_retry_policy(gax::retry_policy::NeverRetry);
5550            let query = move |name| {
5551                let stub = stub.clone();
5552                let options = options.clone();
5553                async {
5554                    let op = GetOperation::new(stub)
5555                        .set_name(name)
5556                        .with_options(options)
5557                        .send()
5558                        .await?;
5559                    Ok(Operation::new(op))
5560                }
5561            };
5562
5563            let start = move || async {
5564                let op = self.send().await?;
5565                Ok(Operation::new(op))
5566            };
5567
5568            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5569        }
5570
5571        /// Sets the value of [name][crate::model::DeleteTagValueRequest::name].
5572        ///
5573        /// This is a **required** field for requests.
5574        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5575            self.0.request.name = v.into();
5576            self
5577        }
5578
5579        /// Sets the value of [validate_only][crate::model::DeleteTagValueRequest::validate_only].
5580        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5581            self.0.request.validate_only = v.into();
5582            self
5583        }
5584
5585        /// Sets the value of [etag][crate::model::DeleteTagValueRequest::etag].
5586        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5587            self.0.request.etag = v.into();
5588            self
5589        }
5590    }
5591
5592    #[doc(hidden)]
5593    impl gax::options::internal::RequestBuilder for DeleteTagValue {
5594        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5595            &mut self.0.options
5596        }
5597    }
5598
5599    /// The request builder for [TagValues::get_iam_policy][crate::client::TagValues::get_iam_policy] calls.
5600    ///
5601    /// # Example
5602    /// ```
5603    /// # use google_cloud_resourcemanager_v3::builder::tag_values::GetIamPolicy;
5604    /// # async fn sample() -> gax::Result<()> {
5605    ///
5606    /// let builder = prepare_request_builder();
5607    /// let response = builder.send().await?;
5608    /// # Ok(()) }
5609    ///
5610    /// fn prepare_request_builder() -> GetIamPolicy {
5611    ///   # panic!();
5612    ///   // ... details omitted ...
5613    /// }
5614    /// ```
5615    #[derive(Clone, Debug)]
5616    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5617
5618    impl GetIamPolicy {
5619        pub(crate) fn new(
5620            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5621        ) -> Self {
5622            Self(RequestBuilder::new(stub))
5623        }
5624
5625        /// Sets the full request, replacing any prior values.
5626        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5627            self.0.request = v.into();
5628            self
5629        }
5630
5631        /// Sets all the options, replacing any prior values.
5632        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5633            self.0.options = v.into();
5634            self
5635        }
5636
5637        /// Sends the request.
5638        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5639            (*self.0.stub)
5640                .get_iam_policy(self.0.request, self.0.options)
5641                .await
5642                .map(gax::response::Response::into_body)
5643        }
5644
5645        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
5646        ///
5647        /// This is a **required** field for requests.
5648        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5649            self.0.request.resource = v.into();
5650            self
5651        }
5652
5653        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5654        pub fn set_options<T>(mut self, v: T) -> Self
5655        where
5656            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5657        {
5658            self.0.request.options = std::option::Option::Some(v.into());
5659            self
5660        }
5661
5662        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5663        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5664        where
5665            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5666        {
5667            self.0.request.options = v.map(|x| x.into());
5668            self
5669        }
5670    }
5671
5672    #[doc(hidden)]
5673    impl gax::options::internal::RequestBuilder for GetIamPolicy {
5674        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5675            &mut self.0.options
5676        }
5677    }
5678
5679    /// The request builder for [TagValues::set_iam_policy][crate::client::TagValues::set_iam_policy] calls.
5680    ///
5681    /// # Example
5682    /// ```
5683    /// # use google_cloud_resourcemanager_v3::builder::tag_values::SetIamPolicy;
5684    /// # async fn sample() -> gax::Result<()> {
5685    ///
5686    /// let builder = prepare_request_builder();
5687    /// let response = builder.send().await?;
5688    /// # Ok(()) }
5689    ///
5690    /// fn prepare_request_builder() -> SetIamPolicy {
5691    ///   # panic!();
5692    ///   // ... details omitted ...
5693    /// }
5694    /// ```
5695    #[derive(Clone, Debug)]
5696    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5697
5698    impl SetIamPolicy {
5699        pub(crate) fn new(
5700            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5701        ) -> Self {
5702            Self(RequestBuilder::new(stub))
5703        }
5704
5705        /// Sets the full request, replacing any prior values.
5706        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5707            self.0.request = v.into();
5708            self
5709        }
5710
5711        /// Sets all the options, replacing any prior values.
5712        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5713            self.0.options = v.into();
5714            self
5715        }
5716
5717        /// Sends the request.
5718        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5719            (*self.0.stub)
5720                .set_iam_policy(self.0.request, self.0.options)
5721                .await
5722                .map(gax::response::Response::into_body)
5723        }
5724
5725        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
5726        ///
5727        /// This is a **required** field for requests.
5728        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5729            self.0.request.resource = v.into();
5730            self
5731        }
5732
5733        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5734        ///
5735        /// This is a **required** field for requests.
5736        pub fn set_policy<T>(mut self, v: T) -> Self
5737        where
5738            T: std::convert::Into<iam_v1::model::Policy>,
5739        {
5740            self.0.request.policy = std::option::Option::Some(v.into());
5741            self
5742        }
5743
5744        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5745        ///
5746        /// This is a **required** field for requests.
5747        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5748        where
5749            T: std::convert::Into<iam_v1::model::Policy>,
5750        {
5751            self.0.request.policy = v.map(|x| x.into());
5752            self
5753        }
5754
5755        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5756        pub fn set_update_mask<T>(mut self, v: T) -> Self
5757        where
5758            T: std::convert::Into<wkt::FieldMask>,
5759        {
5760            self.0.request.update_mask = std::option::Option::Some(v.into());
5761            self
5762        }
5763
5764        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5765        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5766        where
5767            T: std::convert::Into<wkt::FieldMask>,
5768        {
5769            self.0.request.update_mask = v.map(|x| x.into());
5770            self
5771        }
5772    }
5773
5774    #[doc(hidden)]
5775    impl gax::options::internal::RequestBuilder for SetIamPolicy {
5776        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5777            &mut self.0.options
5778        }
5779    }
5780
5781    /// The request builder for [TagValues::test_iam_permissions][crate::client::TagValues::test_iam_permissions] calls.
5782    ///
5783    /// # Example
5784    /// ```
5785    /// # use google_cloud_resourcemanager_v3::builder::tag_values::TestIamPermissions;
5786    /// # async fn sample() -> gax::Result<()> {
5787    ///
5788    /// let builder = prepare_request_builder();
5789    /// let response = builder.send().await?;
5790    /// # Ok(()) }
5791    ///
5792    /// fn prepare_request_builder() -> TestIamPermissions {
5793    ///   # panic!();
5794    ///   // ... details omitted ...
5795    /// }
5796    /// ```
5797    #[derive(Clone, Debug)]
5798    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5799
5800    impl TestIamPermissions {
5801        pub(crate) fn new(
5802            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5803        ) -> Self {
5804            Self(RequestBuilder::new(stub))
5805        }
5806
5807        /// Sets the full request, replacing any prior values.
5808        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5809            mut self,
5810            v: V,
5811        ) -> Self {
5812            self.0.request = v.into();
5813            self
5814        }
5815
5816        /// Sets all the options, replacing any prior values.
5817        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5818            self.0.options = v.into();
5819            self
5820        }
5821
5822        /// Sends the request.
5823        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5824            (*self.0.stub)
5825                .test_iam_permissions(self.0.request, self.0.options)
5826                .await
5827                .map(gax::response::Response::into_body)
5828        }
5829
5830        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
5831        ///
5832        /// This is a **required** field for requests.
5833        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5834            self.0.request.resource = v.into();
5835            self
5836        }
5837
5838        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
5839        ///
5840        /// This is a **required** field for requests.
5841        pub fn set_permissions<T, V>(mut self, v: T) -> Self
5842        where
5843            T: std::iter::IntoIterator<Item = V>,
5844            V: std::convert::Into<std::string::String>,
5845        {
5846            use std::iter::Iterator;
5847            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5848            self
5849        }
5850    }
5851
5852    #[doc(hidden)]
5853    impl gax::options::internal::RequestBuilder for TestIamPermissions {
5854        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5855            &mut self.0.options
5856        }
5857    }
5858
5859    /// The request builder for [TagValues::get_operation][crate::client::TagValues::get_operation] calls.
5860    ///
5861    /// # Example
5862    /// ```
5863    /// # use google_cloud_resourcemanager_v3::builder::tag_values::GetOperation;
5864    /// # async fn sample() -> gax::Result<()> {
5865    ///
5866    /// let builder = prepare_request_builder();
5867    /// let response = builder.send().await?;
5868    /// # Ok(()) }
5869    ///
5870    /// fn prepare_request_builder() -> GetOperation {
5871    ///   # panic!();
5872    ///   // ... details omitted ...
5873    /// }
5874    /// ```
5875    #[derive(Clone, Debug)]
5876    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5877
5878    impl GetOperation {
5879        pub(crate) fn new(
5880            stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5881        ) -> Self {
5882            Self(RequestBuilder::new(stub))
5883        }
5884
5885        /// Sets the full request, replacing any prior values.
5886        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5887            mut self,
5888            v: V,
5889        ) -> Self {
5890            self.0.request = v.into();
5891            self
5892        }
5893
5894        /// Sets all the options, replacing any prior values.
5895        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5896            self.0.options = v.into();
5897            self
5898        }
5899
5900        /// Sends the request.
5901        pub async fn send(self) -> Result<longrunning::model::Operation> {
5902            (*self.0.stub)
5903                .get_operation(self.0.request, self.0.options)
5904                .await
5905                .map(gax::response::Response::into_body)
5906        }
5907
5908        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
5909        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5910            self.0.request.name = v.into();
5911            self
5912        }
5913    }
5914
5915    #[doc(hidden)]
5916    impl gax::options::internal::RequestBuilder for GetOperation {
5917        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5918            &mut self.0.options
5919        }
5920    }
5921}