Skip to main content

google_cloud_kms_v1/
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
17/// Request and client builders for [Autokey][crate::client::Autokey].
18pub mod autokey {
19    use crate::Result;
20
21    /// A builder for [Autokey][crate::client::Autokey].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_kms_v1::*;
26    /// # use builder::autokey::ClientBuilder;
27    /// # use client::Autokey;
28    /// let builder : ClientBuilder = Autokey::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://cloudkms.googleapis.com")
31    ///     .build().await?;
32    /// # Ok(()) }
33    /// ```
34    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::Autokey;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = Autokey;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> crate::ClientBuilderResult<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::Autokey] 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::Autokey>,
55        request: R,
56        options: crate::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::Autokey>) -> Self {
64            Self {
65                stub,
66                request: R::default(),
67                options: crate::RequestOptions::default(),
68            }
69        }
70    }
71
72    /// The request builder for [Autokey::create_key_handle][crate::client::Autokey::create_key_handle] calls.
73    ///
74    /// # Example
75    /// ```
76    /// # use google_cloud_kms_v1::builder::autokey::CreateKeyHandle;
77    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
78    /// use google_cloud_lro::Poller;
79    ///
80    /// let builder = prepare_request_builder();
81    /// let response = builder.poller().until_done().await?;
82    /// # Ok(()) }
83    ///
84    /// fn prepare_request_builder() -> CreateKeyHandle {
85    ///   # panic!();
86    ///   // ... details omitted ...
87    /// }
88    /// ```
89    #[derive(Clone, Debug)]
90    pub struct CreateKeyHandle(RequestBuilder<crate::model::CreateKeyHandleRequest>);
91
92    impl CreateKeyHandle {
93        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
94            Self(RequestBuilder::new(stub))
95        }
96
97        /// Sets the full request, replacing any prior values.
98        pub fn with_request<V: Into<crate::model::CreateKeyHandleRequest>>(mut self, v: V) -> Self {
99            self.0.request = v.into();
100            self
101        }
102
103        /// Sets all the options, replacing any prior values.
104        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
105            self.0.options = v.into();
106            self
107        }
108
109        /// Sends the request.
110        ///
111        /// # Long running operations
112        ///
113        /// This starts, but does not poll, a longrunning operation. More information
114        /// on [create_key_handle][crate::client::Autokey::create_key_handle].
115        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
116            (*self.0.stub)
117                .create_key_handle(self.0.request, self.0.options)
118                .await
119                .map(crate::Response::into_body)
120        }
121
122        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_key_handle`.
123        pub fn poller(
124            self,
125        ) -> impl google_cloud_lro::Poller<crate::model::KeyHandle, crate::model::CreateKeyHandleMetadata>
126        {
127            type Operation = google_cloud_lro::internal::Operation<
128                crate::model::KeyHandle,
129                crate::model::CreateKeyHandleMetadata,
130            >;
131            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
132            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
133            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
134            if let Some(ref mut details) = poller_options.tracing {
135                details.method_name =
136                    "google_cloud_kms_v1::client::Autokey::create_key_handle::until_done";
137            }
138
139            let stub = self.0.stub.clone();
140            let mut options = self.0.options.clone();
141            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
142            let query = move |name| {
143                let stub = stub.clone();
144                let options = options.clone();
145                async {
146                    let op = GetOperation::new(stub)
147                        .set_name(name)
148                        .with_options(options)
149                        .send()
150                        .await?;
151                    Ok(Operation::new(op))
152                }
153            };
154
155            let start = move || async {
156                let op = self.send().await?;
157                Ok(Operation::new(op))
158            };
159
160            use google_cloud_lro::internal::PollerExt;
161            {
162                google_cloud_lro::internal::new_poller(
163                    polling_error_policy,
164                    polling_backoff_policy,
165                    start,
166                    query,
167                )
168            }
169            .with_options(poller_options)
170        }
171
172        /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
173        ///
174        /// This is a **required** field for requests.
175        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
176            self.0.request.parent = v.into();
177            self
178        }
179
180        /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
181        pub fn set_key_handle_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
182            self.0.request.key_handle_id = v.into();
183            self
184        }
185
186        /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
187        ///
188        /// This is a **required** field for requests.
189        pub fn set_key_handle<T>(mut self, v: T) -> Self
190        where
191            T: std::convert::Into<crate::model::KeyHandle>,
192        {
193            self.0.request.key_handle = std::option::Option::Some(v.into());
194            self
195        }
196
197        /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
198        ///
199        /// This is a **required** field for requests.
200        pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
201        where
202            T: std::convert::Into<crate::model::KeyHandle>,
203        {
204            self.0.request.key_handle = v.map(|x| x.into());
205            self
206        }
207    }
208
209    #[doc(hidden)]
210    impl crate::RequestBuilder for CreateKeyHandle {
211        fn request_options(&mut self) -> &mut crate::RequestOptions {
212            &mut self.0.options
213        }
214    }
215
216    /// The request builder for [Autokey::get_key_handle][crate::client::Autokey::get_key_handle] calls.
217    ///
218    /// # Example
219    /// ```
220    /// # use google_cloud_kms_v1::builder::autokey::GetKeyHandle;
221    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
222    ///
223    /// let builder = prepare_request_builder();
224    /// let response = builder.send().await?;
225    /// # Ok(()) }
226    ///
227    /// fn prepare_request_builder() -> GetKeyHandle {
228    ///   # panic!();
229    ///   // ... details omitted ...
230    /// }
231    /// ```
232    #[derive(Clone, Debug)]
233    pub struct GetKeyHandle(RequestBuilder<crate::model::GetKeyHandleRequest>);
234
235    impl GetKeyHandle {
236        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
237            Self(RequestBuilder::new(stub))
238        }
239
240        /// Sets the full request, replacing any prior values.
241        pub fn with_request<V: Into<crate::model::GetKeyHandleRequest>>(mut self, v: V) -> Self {
242            self.0.request = v.into();
243            self
244        }
245
246        /// Sets all the options, replacing any prior values.
247        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
248            self.0.options = v.into();
249            self
250        }
251
252        /// Sends the request.
253        pub async fn send(self) -> Result<crate::model::KeyHandle> {
254            (*self.0.stub)
255                .get_key_handle(self.0.request, self.0.options)
256                .await
257                .map(crate::Response::into_body)
258        }
259
260        /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
261        ///
262        /// This is a **required** field for requests.
263        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
264            self.0.request.name = v.into();
265            self
266        }
267    }
268
269    #[doc(hidden)]
270    impl crate::RequestBuilder for GetKeyHandle {
271        fn request_options(&mut self) -> &mut crate::RequestOptions {
272            &mut self.0.options
273        }
274    }
275
276    /// The request builder for [Autokey::list_key_handles][crate::client::Autokey::list_key_handles] calls.
277    ///
278    /// # Example
279    /// ```
280    /// # use google_cloud_kms_v1::builder::autokey::ListKeyHandles;
281    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
282    /// use google_cloud_gax::paginator::ItemPaginator;
283    ///
284    /// let builder = prepare_request_builder();
285    /// let mut items = builder.by_item();
286    /// while let Some(result) = items.next().await {
287    ///   let item = result?;
288    /// }
289    /// # Ok(()) }
290    ///
291    /// fn prepare_request_builder() -> ListKeyHandles {
292    ///   # panic!();
293    ///   // ... details omitted ...
294    /// }
295    /// ```
296    #[derive(Clone, Debug)]
297    pub struct ListKeyHandles(RequestBuilder<crate::model::ListKeyHandlesRequest>);
298
299    impl ListKeyHandles {
300        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
301            Self(RequestBuilder::new(stub))
302        }
303
304        /// Sets the full request, replacing any prior values.
305        pub fn with_request<V: Into<crate::model::ListKeyHandlesRequest>>(mut self, v: V) -> Self {
306            self.0.request = v.into();
307            self
308        }
309
310        /// Sets all the options, replacing any prior values.
311        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
312            self.0.options = v.into();
313            self
314        }
315
316        /// Sends the request.
317        pub async fn send(self) -> Result<crate::model::ListKeyHandlesResponse> {
318            (*self.0.stub)
319                .list_key_handles(self.0.request, self.0.options)
320                .await
321                .map(crate::Response::into_body)
322        }
323
324        /// Streams each page in the collection.
325        pub fn by_page(
326            self,
327        ) -> impl google_cloud_gax::paginator::Paginator<
328            crate::model::ListKeyHandlesResponse,
329            crate::Error,
330        > {
331            use std::clone::Clone;
332            let token = self.0.request.page_token.clone();
333            let execute = move |token: String| {
334                let mut builder = self.clone();
335                builder.0.request = builder.0.request.set_page_token(token);
336                builder.send()
337            };
338            google_cloud_gax::paginator::internal::new_paginator(token, execute)
339        }
340
341        /// Streams each item in the collection.
342        pub fn by_item(
343            self,
344        ) -> impl google_cloud_gax::paginator::ItemPaginator<
345            crate::model::ListKeyHandlesResponse,
346            crate::Error,
347        > {
348            use google_cloud_gax::paginator::Paginator;
349            self.by_page().items()
350        }
351
352        /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
353        ///
354        /// This is a **required** field for requests.
355        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
356            self.0.request.parent = v.into();
357            self
358        }
359
360        /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
361        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
362            self.0.request.page_size = v.into();
363            self
364        }
365
366        /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
367        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
368            self.0.request.page_token = v.into();
369            self
370        }
371
372        /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
373        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
374            self.0.request.filter = v.into();
375            self
376        }
377    }
378
379    #[doc(hidden)]
380    impl crate::RequestBuilder for ListKeyHandles {
381        fn request_options(&mut self) -> &mut crate::RequestOptions {
382            &mut self.0.options
383        }
384    }
385
386    /// The request builder for [Autokey::list_locations][crate::client::Autokey::list_locations] calls.
387    ///
388    /// # Example
389    /// ```
390    /// # use google_cloud_kms_v1::builder::autokey::ListLocations;
391    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
392    /// use google_cloud_gax::paginator::ItemPaginator;
393    ///
394    /// let builder = prepare_request_builder();
395    /// let mut items = builder.by_item();
396    /// while let Some(result) = items.next().await {
397    ///   let item = result?;
398    /// }
399    /// # Ok(()) }
400    ///
401    /// fn prepare_request_builder() -> ListLocations {
402    ///   # panic!();
403    ///   // ... details omitted ...
404    /// }
405    /// ```
406    #[derive(Clone, Debug)]
407    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
408
409    impl ListLocations {
410        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
411            Self(RequestBuilder::new(stub))
412        }
413
414        /// Sets the full request, replacing any prior values.
415        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
416            mut self,
417            v: V,
418        ) -> Self {
419            self.0.request = v.into();
420            self
421        }
422
423        /// Sets all the options, replacing any prior values.
424        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
425            self.0.options = v.into();
426            self
427        }
428
429        /// Sends the request.
430        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
431            (*self.0.stub)
432                .list_locations(self.0.request, self.0.options)
433                .await
434                .map(crate::Response::into_body)
435        }
436
437        /// Streams each page in the collection.
438        pub fn by_page(
439            self,
440        ) -> impl google_cloud_gax::paginator::Paginator<
441            google_cloud_location::model::ListLocationsResponse,
442            crate::Error,
443        > {
444            use std::clone::Clone;
445            let token = self.0.request.page_token.clone();
446            let execute = move |token: String| {
447                let mut builder = self.clone();
448                builder.0.request = builder.0.request.set_page_token(token);
449                builder.send()
450            };
451            google_cloud_gax::paginator::internal::new_paginator(token, execute)
452        }
453
454        /// Streams each item in the collection.
455        pub fn by_item(
456            self,
457        ) -> impl google_cloud_gax::paginator::ItemPaginator<
458            google_cloud_location::model::ListLocationsResponse,
459            crate::Error,
460        > {
461            use google_cloud_gax::paginator::Paginator;
462            self.by_page().items()
463        }
464
465        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
466        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
467            self.0.request.name = v.into();
468            self
469        }
470
471        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
472        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
473            self.0.request.filter = v.into();
474            self
475        }
476
477        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
478        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
479            self.0.request.page_size = v.into();
480            self
481        }
482
483        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
484        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
485            self.0.request.page_token = v.into();
486            self
487        }
488    }
489
490    #[doc(hidden)]
491    impl crate::RequestBuilder for ListLocations {
492        fn request_options(&mut self) -> &mut crate::RequestOptions {
493            &mut self.0.options
494        }
495    }
496
497    /// The request builder for [Autokey::get_location][crate::client::Autokey::get_location] calls.
498    ///
499    /// # Example
500    /// ```
501    /// # use google_cloud_kms_v1::builder::autokey::GetLocation;
502    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
503    ///
504    /// let builder = prepare_request_builder();
505    /// let response = builder.send().await?;
506    /// # Ok(()) }
507    ///
508    /// fn prepare_request_builder() -> GetLocation {
509    ///   # panic!();
510    ///   // ... details omitted ...
511    /// }
512    /// ```
513    #[derive(Clone, Debug)]
514    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
515
516    impl GetLocation {
517        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
518            Self(RequestBuilder::new(stub))
519        }
520
521        /// Sets the full request, replacing any prior values.
522        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
523            mut self,
524            v: V,
525        ) -> Self {
526            self.0.request = v.into();
527            self
528        }
529
530        /// Sets all the options, replacing any prior values.
531        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
532            self.0.options = v.into();
533            self
534        }
535
536        /// Sends the request.
537        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
538            (*self.0.stub)
539                .get_location(self.0.request, self.0.options)
540                .await
541                .map(crate::Response::into_body)
542        }
543
544        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
545        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
546            self.0.request.name = v.into();
547            self
548        }
549    }
550
551    #[doc(hidden)]
552    impl crate::RequestBuilder for GetLocation {
553        fn request_options(&mut self) -> &mut crate::RequestOptions {
554            &mut self.0.options
555        }
556    }
557
558    /// The request builder for [Autokey::set_iam_policy][crate::client::Autokey::set_iam_policy] calls.
559    ///
560    /// # Example
561    /// ```
562    /// # use google_cloud_kms_v1::builder::autokey::SetIamPolicy;
563    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
564    ///
565    /// let builder = prepare_request_builder();
566    /// let response = builder.send().await?;
567    /// # Ok(()) }
568    ///
569    /// fn prepare_request_builder() -> SetIamPolicy {
570    ///   # panic!();
571    ///   // ... details omitted ...
572    /// }
573    /// ```
574    #[derive(Clone, Debug)]
575    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
576
577    impl SetIamPolicy {
578        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
579            Self(RequestBuilder::new(stub))
580        }
581
582        /// Sets the full request, replacing any prior values.
583        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
584            mut self,
585            v: V,
586        ) -> Self {
587            self.0.request = v.into();
588            self
589        }
590
591        /// Sets all the options, replacing any prior values.
592        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
593            self.0.options = v.into();
594            self
595        }
596
597        /// Sends the request.
598        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
599            (*self.0.stub)
600                .set_iam_policy(self.0.request, self.0.options)
601                .await
602                .map(crate::Response::into_body)
603        }
604
605        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
606        ///
607        /// This is a **required** field for requests.
608        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
609            self.0.request.resource = v.into();
610            self
611        }
612
613        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
614        ///
615        /// This is a **required** field for requests.
616        pub fn set_policy<T>(mut self, v: T) -> Self
617        where
618            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
619        {
620            self.0.request.policy = std::option::Option::Some(v.into());
621            self
622        }
623
624        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
625        ///
626        /// This is a **required** field for requests.
627        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
628        where
629            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
630        {
631            self.0.request.policy = v.map(|x| x.into());
632            self
633        }
634
635        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
636        pub fn set_update_mask<T>(mut self, v: T) -> Self
637        where
638            T: std::convert::Into<wkt::FieldMask>,
639        {
640            self.0.request.update_mask = std::option::Option::Some(v.into());
641            self
642        }
643
644        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
645        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
646        where
647            T: std::convert::Into<wkt::FieldMask>,
648        {
649            self.0.request.update_mask = v.map(|x| x.into());
650            self
651        }
652    }
653
654    #[doc(hidden)]
655    impl crate::RequestBuilder for SetIamPolicy {
656        fn request_options(&mut self) -> &mut crate::RequestOptions {
657            &mut self.0.options
658        }
659    }
660
661    /// The request builder for [Autokey::get_iam_policy][crate::client::Autokey::get_iam_policy] calls.
662    ///
663    /// # Example
664    /// ```
665    /// # use google_cloud_kms_v1::builder::autokey::GetIamPolicy;
666    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
667    ///
668    /// let builder = prepare_request_builder();
669    /// let response = builder.send().await?;
670    /// # Ok(()) }
671    ///
672    /// fn prepare_request_builder() -> GetIamPolicy {
673    ///   # panic!();
674    ///   // ... details omitted ...
675    /// }
676    /// ```
677    #[derive(Clone, Debug)]
678    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
679
680    impl GetIamPolicy {
681        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
682            Self(RequestBuilder::new(stub))
683        }
684
685        /// Sets the full request, replacing any prior values.
686        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
687            mut self,
688            v: V,
689        ) -> Self {
690            self.0.request = v.into();
691            self
692        }
693
694        /// Sets all the options, replacing any prior values.
695        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
696            self.0.options = v.into();
697            self
698        }
699
700        /// Sends the request.
701        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
702            (*self.0.stub)
703                .get_iam_policy(self.0.request, self.0.options)
704                .await
705                .map(crate::Response::into_body)
706        }
707
708        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
709        ///
710        /// This is a **required** field for requests.
711        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
712            self.0.request.resource = v.into();
713            self
714        }
715
716        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
717        pub fn set_options<T>(mut self, v: T) -> Self
718        where
719            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
720        {
721            self.0.request.options = std::option::Option::Some(v.into());
722            self
723        }
724
725        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
726        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
727        where
728            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
729        {
730            self.0.request.options = v.map(|x| x.into());
731            self
732        }
733    }
734
735    #[doc(hidden)]
736    impl crate::RequestBuilder for GetIamPolicy {
737        fn request_options(&mut self) -> &mut crate::RequestOptions {
738            &mut self.0.options
739        }
740    }
741
742    /// The request builder for [Autokey::test_iam_permissions][crate::client::Autokey::test_iam_permissions] calls.
743    ///
744    /// # Example
745    /// ```
746    /// # use google_cloud_kms_v1::builder::autokey::TestIamPermissions;
747    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
748    ///
749    /// let builder = prepare_request_builder();
750    /// let response = builder.send().await?;
751    /// # Ok(()) }
752    ///
753    /// fn prepare_request_builder() -> TestIamPermissions {
754    ///   # panic!();
755    ///   // ... details omitted ...
756    /// }
757    /// ```
758    #[derive(Clone, Debug)]
759    pub struct TestIamPermissions(
760        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
761    );
762
763    impl TestIamPermissions {
764        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
765            Self(RequestBuilder::new(stub))
766        }
767
768        /// Sets the full request, replacing any prior values.
769        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
770            mut self,
771            v: V,
772        ) -> Self {
773            self.0.request = v.into();
774            self
775        }
776
777        /// Sets all the options, replacing any prior values.
778        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
779            self.0.options = v.into();
780            self
781        }
782
783        /// Sends the request.
784        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
785            (*self.0.stub)
786                .test_iam_permissions(self.0.request, self.0.options)
787                .await
788                .map(crate::Response::into_body)
789        }
790
791        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
792        ///
793        /// This is a **required** field for requests.
794        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
795            self.0.request.resource = v.into();
796            self
797        }
798
799        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
800        ///
801        /// This is a **required** field for requests.
802        pub fn set_permissions<T, V>(mut self, v: T) -> Self
803        where
804            T: std::iter::IntoIterator<Item = V>,
805            V: std::convert::Into<std::string::String>,
806        {
807            use std::iter::Iterator;
808            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
809            self
810        }
811    }
812
813    #[doc(hidden)]
814    impl crate::RequestBuilder for TestIamPermissions {
815        fn request_options(&mut self) -> &mut crate::RequestOptions {
816            &mut self.0.options
817        }
818    }
819
820    /// The request builder for [Autokey::get_operation][crate::client::Autokey::get_operation] calls.
821    ///
822    /// # Example
823    /// ```
824    /// # use google_cloud_kms_v1::builder::autokey::GetOperation;
825    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
826    ///
827    /// let builder = prepare_request_builder();
828    /// let response = builder.send().await?;
829    /// # Ok(()) }
830    ///
831    /// fn prepare_request_builder() -> GetOperation {
832    ///   # panic!();
833    ///   // ... details omitted ...
834    /// }
835    /// ```
836    #[derive(Clone, Debug)]
837    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
838
839    impl GetOperation {
840        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Autokey>) -> Self {
841            Self(RequestBuilder::new(stub))
842        }
843
844        /// Sets the full request, replacing any prior values.
845        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
846            mut self,
847            v: V,
848        ) -> Self {
849            self.0.request = v.into();
850            self
851        }
852
853        /// Sets all the options, replacing any prior values.
854        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
855            self.0.options = v.into();
856            self
857        }
858
859        /// Sends the request.
860        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
861            (*self.0.stub)
862                .get_operation(self.0.request, self.0.options)
863                .await
864                .map(crate::Response::into_body)
865        }
866
867        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
868        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
869            self.0.request.name = v.into();
870            self
871        }
872    }
873
874    #[doc(hidden)]
875    impl crate::RequestBuilder for GetOperation {
876        fn request_options(&mut self) -> &mut crate::RequestOptions {
877            &mut self.0.options
878        }
879    }
880}
881
882/// Request and client builders for [AutokeyAdmin][crate::client::AutokeyAdmin].
883pub mod autokey_admin {
884    use crate::Result;
885
886    /// A builder for [AutokeyAdmin][crate::client::AutokeyAdmin].
887    ///
888    /// ```
889    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
890    /// # use google_cloud_kms_v1::*;
891    /// # use builder::autokey_admin::ClientBuilder;
892    /// # use client::AutokeyAdmin;
893    /// let builder : ClientBuilder = AutokeyAdmin::builder();
894    /// let client = builder
895    ///     .with_endpoint("https://cloudkms.googleapis.com")
896    ///     .build().await?;
897    /// # Ok(()) }
898    /// ```
899    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
900
901    pub(crate) mod client {
902        use super::super::super::client::AutokeyAdmin;
903        pub struct Factory;
904        impl crate::ClientFactory for Factory {
905            type Client = AutokeyAdmin;
906            type Credentials = gaxi::options::Credentials;
907            async fn build(
908                self,
909                config: gaxi::options::ClientConfig,
910            ) -> crate::ClientBuilderResult<Self::Client> {
911                Self::Client::new(config).await
912            }
913        }
914    }
915
916    /// Common implementation for [crate::client::AutokeyAdmin] request builders.
917    #[derive(Clone, Debug)]
918    pub(crate) struct RequestBuilder<R: std::default::Default> {
919        stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
920        request: R,
921        options: crate::RequestOptions,
922    }
923
924    impl<R> RequestBuilder<R>
925    where
926        R: std::default::Default,
927    {
928        pub(crate) fn new(
929            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
930        ) -> Self {
931            Self {
932                stub,
933                request: R::default(),
934                options: crate::RequestOptions::default(),
935            }
936        }
937    }
938
939    /// The request builder for [AutokeyAdmin::update_autokey_config][crate::client::AutokeyAdmin::update_autokey_config] calls.
940    ///
941    /// # Example
942    /// ```
943    /// # use google_cloud_kms_v1::builder::autokey_admin::UpdateAutokeyConfig;
944    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
945    ///
946    /// let builder = prepare_request_builder();
947    /// let response = builder.send().await?;
948    /// # Ok(()) }
949    ///
950    /// fn prepare_request_builder() -> UpdateAutokeyConfig {
951    ///   # panic!();
952    ///   // ... details omitted ...
953    /// }
954    /// ```
955    #[derive(Clone, Debug)]
956    pub struct UpdateAutokeyConfig(RequestBuilder<crate::model::UpdateAutokeyConfigRequest>);
957
958    impl UpdateAutokeyConfig {
959        pub(crate) fn new(
960            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
961        ) -> Self {
962            Self(RequestBuilder::new(stub))
963        }
964
965        /// Sets the full request, replacing any prior values.
966        pub fn with_request<V: Into<crate::model::UpdateAutokeyConfigRequest>>(
967            mut self,
968            v: V,
969        ) -> Self {
970            self.0.request = v.into();
971            self
972        }
973
974        /// Sets all the options, replacing any prior values.
975        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
976            self.0.options = v.into();
977            self
978        }
979
980        /// Sends the request.
981        pub async fn send(self) -> Result<crate::model::AutokeyConfig> {
982            (*self.0.stub)
983                .update_autokey_config(self.0.request, self.0.options)
984                .await
985                .map(crate::Response::into_body)
986        }
987
988        /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
989        ///
990        /// This is a **required** field for requests.
991        pub fn set_autokey_config<T>(mut self, v: T) -> Self
992        where
993            T: std::convert::Into<crate::model::AutokeyConfig>,
994        {
995            self.0.request.autokey_config = std::option::Option::Some(v.into());
996            self
997        }
998
999        /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
1000        ///
1001        /// This is a **required** field for requests.
1002        pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
1003        where
1004            T: std::convert::Into<crate::model::AutokeyConfig>,
1005        {
1006            self.0.request.autokey_config = v.map(|x| x.into());
1007            self
1008        }
1009
1010        /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
1011        ///
1012        /// This is a **required** field for requests.
1013        pub fn set_update_mask<T>(mut self, v: T) -> Self
1014        where
1015            T: std::convert::Into<wkt::FieldMask>,
1016        {
1017            self.0.request.update_mask = std::option::Option::Some(v.into());
1018            self
1019        }
1020
1021        /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
1022        ///
1023        /// This is a **required** field for requests.
1024        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1025        where
1026            T: std::convert::Into<wkt::FieldMask>,
1027        {
1028            self.0.request.update_mask = v.map(|x| x.into());
1029            self
1030        }
1031    }
1032
1033    #[doc(hidden)]
1034    impl crate::RequestBuilder for UpdateAutokeyConfig {
1035        fn request_options(&mut self) -> &mut crate::RequestOptions {
1036            &mut self.0.options
1037        }
1038    }
1039
1040    /// The request builder for [AutokeyAdmin::get_autokey_config][crate::client::AutokeyAdmin::get_autokey_config] calls.
1041    ///
1042    /// # Example
1043    /// ```
1044    /// # use google_cloud_kms_v1::builder::autokey_admin::GetAutokeyConfig;
1045    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1046    ///
1047    /// let builder = prepare_request_builder();
1048    /// let response = builder.send().await?;
1049    /// # Ok(()) }
1050    ///
1051    /// fn prepare_request_builder() -> GetAutokeyConfig {
1052    ///   # panic!();
1053    ///   // ... details omitted ...
1054    /// }
1055    /// ```
1056    #[derive(Clone, Debug)]
1057    pub struct GetAutokeyConfig(RequestBuilder<crate::model::GetAutokeyConfigRequest>);
1058
1059    impl GetAutokeyConfig {
1060        pub(crate) fn new(
1061            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1062        ) -> Self {
1063            Self(RequestBuilder::new(stub))
1064        }
1065
1066        /// Sets the full request, replacing any prior values.
1067        pub fn with_request<V: Into<crate::model::GetAutokeyConfigRequest>>(
1068            mut self,
1069            v: V,
1070        ) -> Self {
1071            self.0.request = v.into();
1072            self
1073        }
1074
1075        /// Sets all the options, replacing any prior values.
1076        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1077            self.0.options = v.into();
1078            self
1079        }
1080
1081        /// Sends the request.
1082        pub async fn send(self) -> Result<crate::model::AutokeyConfig> {
1083            (*self.0.stub)
1084                .get_autokey_config(self.0.request, self.0.options)
1085                .await
1086                .map(crate::Response::into_body)
1087        }
1088
1089        /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
1090        ///
1091        /// This is a **required** field for requests.
1092        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1093            self.0.request.name = v.into();
1094            self
1095        }
1096    }
1097
1098    #[doc(hidden)]
1099    impl crate::RequestBuilder for GetAutokeyConfig {
1100        fn request_options(&mut self) -> &mut crate::RequestOptions {
1101            &mut self.0.options
1102        }
1103    }
1104
1105    /// The request builder for [AutokeyAdmin::show_effective_autokey_config][crate::client::AutokeyAdmin::show_effective_autokey_config] calls.
1106    ///
1107    /// # Example
1108    /// ```
1109    /// # use google_cloud_kms_v1::builder::autokey_admin::ShowEffectiveAutokeyConfig;
1110    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1111    ///
1112    /// let builder = prepare_request_builder();
1113    /// let response = builder.send().await?;
1114    /// # Ok(()) }
1115    ///
1116    /// fn prepare_request_builder() -> ShowEffectiveAutokeyConfig {
1117    ///   # panic!();
1118    ///   // ... details omitted ...
1119    /// }
1120    /// ```
1121    #[derive(Clone, Debug)]
1122    pub struct ShowEffectiveAutokeyConfig(
1123        RequestBuilder<crate::model::ShowEffectiveAutokeyConfigRequest>,
1124    );
1125
1126    impl ShowEffectiveAutokeyConfig {
1127        pub(crate) fn new(
1128            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1129        ) -> Self {
1130            Self(RequestBuilder::new(stub))
1131        }
1132
1133        /// Sets the full request, replacing any prior values.
1134        pub fn with_request<V: Into<crate::model::ShowEffectiveAutokeyConfigRequest>>(
1135            mut self,
1136            v: V,
1137        ) -> Self {
1138            self.0.request = v.into();
1139            self
1140        }
1141
1142        /// Sets all the options, replacing any prior values.
1143        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1144            self.0.options = v.into();
1145            self
1146        }
1147
1148        /// Sends the request.
1149        pub async fn send(self) -> Result<crate::model::ShowEffectiveAutokeyConfigResponse> {
1150            (*self.0.stub)
1151                .show_effective_autokey_config(self.0.request, self.0.options)
1152                .await
1153                .map(crate::Response::into_body)
1154        }
1155
1156        /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
1157        ///
1158        /// This is a **required** field for requests.
1159        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1160            self.0.request.parent = v.into();
1161            self
1162        }
1163    }
1164
1165    #[doc(hidden)]
1166    impl crate::RequestBuilder for ShowEffectiveAutokeyConfig {
1167        fn request_options(&mut self) -> &mut crate::RequestOptions {
1168            &mut self.0.options
1169        }
1170    }
1171
1172    /// The request builder for [AutokeyAdmin::list_locations][crate::client::AutokeyAdmin::list_locations] calls.
1173    ///
1174    /// # Example
1175    /// ```
1176    /// # use google_cloud_kms_v1::builder::autokey_admin::ListLocations;
1177    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1178    /// use google_cloud_gax::paginator::ItemPaginator;
1179    ///
1180    /// let builder = prepare_request_builder();
1181    /// let mut items = builder.by_item();
1182    /// while let Some(result) = items.next().await {
1183    ///   let item = result?;
1184    /// }
1185    /// # Ok(()) }
1186    ///
1187    /// fn prepare_request_builder() -> ListLocations {
1188    ///   # panic!();
1189    ///   // ... details omitted ...
1190    /// }
1191    /// ```
1192    #[derive(Clone, Debug)]
1193    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1194
1195    impl ListLocations {
1196        pub(crate) fn new(
1197            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1198        ) -> Self {
1199            Self(RequestBuilder::new(stub))
1200        }
1201
1202        /// Sets the full request, replacing any prior values.
1203        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1204            mut self,
1205            v: V,
1206        ) -> Self {
1207            self.0.request = v.into();
1208            self
1209        }
1210
1211        /// Sets all the options, replacing any prior values.
1212        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1213            self.0.options = v.into();
1214            self
1215        }
1216
1217        /// Sends the request.
1218        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1219            (*self.0.stub)
1220                .list_locations(self.0.request, self.0.options)
1221                .await
1222                .map(crate::Response::into_body)
1223        }
1224
1225        /// Streams each page in the collection.
1226        pub fn by_page(
1227            self,
1228        ) -> impl google_cloud_gax::paginator::Paginator<
1229            google_cloud_location::model::ListLocationsResponse,
1230            crate::Error,
1231        > {
1232            use std::clone::Clone;
1233            let token = self.0.request.page_token.clone();
1234            let execute = move |token: String| {
1235                let mut builder = self.clone();
1236                builder.0.request = builder.0.request.set_page_token(token);
1237                builder.send()
1238            };
1239            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1240        }
1241
1242        /// Streams each item in the collection.
1243        pub fn by_item(
1244            self,
1245        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1246            google_cloud_location::model::ListLocationsResponse,
1247            crate::Error,
1248        > {
1249            use google_cloud_gax::paginator::Paginator;
1250            self.by_page().items()
1251        }
1252
1253        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
1254        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1255            self.0.request.name = v.into();
1256            self
1257        }
1258
1259        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
1260        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1261            self.0.request.filter = v.into();
1262            self
1263        }
1264
1265        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
1266        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1267            self.0.request.page_size = v.into();
1268            self
1269        }
1270
1271        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
1272        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1273            self.0.request.page_token = v.into();
1274            self
1275        }
1276    }
1277
1278    #[doc(hidden)]
1279    impl crate::RequestBuilder for ListLocations {
1280        fn request_options(&mut self) -> &mut crate::RequestOptions {
1281            &mut self.0.options
1282        }
1283    }
1284
1285    /// The request builder for [AutokeyAdmin::get_location][crate::client::AutokeyAdmin::get_location] calls.
1286    ///
1287    /// # Example
1288    /// ```
1289    /// # use google_cloud_kms_v1::builder::autokey_admin::GetLocation;
1290    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1291    ///
1292    /// let builder = prepare_request_builder();
1293    /// let response = builder.send().await?;
1294    /// # Ok(()) }
1295    ///
1296    /// fn prepare_request_builder() -> GetLocation {
1297    ///   # panic!();
1298    ///   // ... details omitted ...
1299    /// }
1300    /// ```
1301    #[derive(Clone, Debug)]
1302    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1303
1304    impl GetLocation {
1305        pub(crate) fn new(
1306            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1307        ) -> Self {
1308            Self(RequestBuilder::new(stub))
1309        }
1310
1311        /// Sets the full request, replacing any prior values.
1312        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1313            mut self,
1314            v: V,
1315        ) -> Self {
1316            self.0.request = v.into();
1317            self
1318        }
1319
1320        /// Sets all the options, replacing any prior values.
1321        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1322            self.0.options = v.into();
1323            self
1324        }
1325
1326        /// Sends the request.
1327        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1328            (*self.0.stub)
1329                .get_location(self.0.request, self.0.options)
1330                .await
1331                .map(crate::Response::into_body)
1332        }
1333
1334        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
1335        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1336            self.0.request.name = v.into();
1337            self
1338        }
1339    }
1340
1341    #[doc(hidden)]
1342    impl crate::RequestBuilder for GetLocation {
1343        fn request_options(&mut self) -> &mut crate::RequestOptions {
1344            &mut self.0.options
1345        }
1346    }
1347
1348    /// The request builder for [AutokeyAdmin::set_iam_policy][crate::client::AutokeyAdmin::set_iam_policy] calls.
1349    ///
1350    /// # Example
1351    /// ```
1352    /// # use google_cloud_kms_v1::builder::autokey_admin::SetIamPolicy;
1353    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1354    ///
1355    /// let builder = prepare_request_builder();
1356    /// let response = builder.send().await?;
1357    /// # Ok(()) }
1358    ///
1359    /// fn prepare_request_builder() -> SetIamPolicy {
1360    ///   # panic!();
1361    ///   // ... details omitted ...
1362    /// }
1363    /// ```
1364    #[derive(Clone, Debug)]
1365    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1366
1367    impl SetIamPolicy {
1368        pub(crate) fn new(
1369            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1370        ) -> Self {
1371            Self(RequestBuilder::new(stub))
1372        }
1373
1374        /// Sets the full request, replacing any prior values.
1375        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1376            mut self,
1377            v: V,
1378        ) -> Self {
1379            self.0.request = v.into();
1380            self
1381        }
1382
1383        /// Sets all the options, replacing any prior values.
1384        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1385            self.0.options = v.into();
1386            self
1387        }
1388
1389        /// Sends the request.
1390        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1391            (*self.0.stub)
1392                .set_iam_policy(self.0.request, self.0.options)
1393                .await
1394                .map(crate::Response::into_body)
1395        }
1396
1397        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
1398        ///
1399        /// This is a **required** field for requests.
1400        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1401            self.0.request.resource = v.into();
1402            self
1403        }
1404
1405        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
1406        ///
1407        /// This is a **required** field for requests.
1408        pub fn set_policy<T>(mut self, v: T) -> Self
1409        where
1410            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1411        {
1412            self.0.request.policy = std::option::Option::Some(v.into());
1413            self
1414        }
1415
1416        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
1417        ///
1418        /// This is a **required** field for requests.
1419        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1420        where
1421            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1422        {
1423            self.0.request.policy = v.map(|x| x.into());
1424            self
1425        }
1426
1427        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
1428        pub fn set_update_mask<T>(mut self, v: T) -> Self
1429        where
1430            T: std::convert::Into<wkt::FieldMask>,
1431        {
1432            self.0.request.update_mask = std::option::Option::Some(v.into());
1433            self
1434        }
1435
1436        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
1437        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1438        where
1439            T: std::convert::Into<wkt::FieldMask>,
1440        {
1441            self.0.request.update_mask = v.map(|x| x.into());
1442            self
1443        }
1444    }
1445
1446    #[doc(hidden)]
1447    impl crate::RequestBuilder for SetIamPolicy {
1448        fn request_options(&mut self) -> &mut crate::RequestOptions {
1449            &mut self.0.options
1450        }
1451    }
1452
1453    /// The request builder for [AutokeyAdmin::get_iam_policy][crate::client::AutokeyAdmin::get_iam_policy] calls.
1454    ///
1455    /// # Example
1456    /// ```
1457    /// # use google_cloud_kms_v1::builder::autokey_admin::GetIamPolicy;
1458    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1459    ///
1460    /// let builder = prepare_request_builder();
1461    /// let response = builder.send().await?;
1462    /// # Ok(()) }
1463    ///
1464    /// fn prepare_request_builder() -> GetIamPolicy {
1465    ///   # panic!();
1466    ///   // ... details omitted ...
1467    /// }
1468    /// ```
1469    #[derive(Clone, Debug)]
1470    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1471
1472    impl GetIamPolicy {
1473        pub(crate) fn new(
1474            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1475        ) -> Self {
1476            Self(RequestBuilder::new(stub))
1477        }
1478
1479        /// Sets the full request, replacing any prior values.
1480        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1481            mut self,
1482            v: V,
1483        ) -> Self {
1484            self.0.request = v.into();
1485            self
1486        }
1487
1488        /// Sets all the options, replacing any prior values.
1489        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1490            self.0.options = v.into();
1491            self
1492        }
1493
1494        /// Sends the request.
1495        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1496            (*self.0.stub)
1497                .get_iam_policy(self.0.request, self.0.options)
1498                .await
1499                .map(crate::Response::into_body)
1500        }
1501
1502        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
1503        ///
1504        /// This is a **required** field for requests.
1505        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1506            self.0.request.resource = v.into();
1507            self
1508        }
1509
1510        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1511        pub fn set_options<T>(mut self, v: T) -> Self
1512        where
1513            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1514        {
1515            self.0.request.options = std::option::Option::Some(v.into());
1516            self
1517        }
1518
1519        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
1520        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1521        where
1522            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1523        {
1524            self.0.request.options = v.map(|x| x.into());
1525            self
1526        }
1527    }
1528
1529    #[doc(hidden)]
1530    impl crate::RequestBuilder for GetIamPolicy {
1531        fn request_options(&mut self) -> &mut crate::RequestOptions {
1532            &mut self.0.options
1533        }
1534    }
1535
1536    /// The request builder for [AutokeyAdmin::test_iam_permissions][crate::client::AutokeyAdmin::test_iam_permissions] calls.
1537    ///
1538    /// # Example
1539    /// ```
1540    /// # use google_cloud_kms_v1::builder::autokey_admin::TestIamPermissions;
1541    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1542    ///
1543    /// let builder = prepare_request_builder();
1544    /// let response = builder.send().await?;
1545    /// # Ok(()) }
1546    ///
1547    /// fn prepare_request_builder() -> TestIamPermissions {
1548    ///   # panic!();
1549    ///   // ... details omitted ...
1550    /// }
1551    /// ```
1552    #[derive(Clone, Debug)]
1553    pub struct TestIamPermissions(
1554        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1555    );
1556
1557    impl TestIamPermissions {
1558        pub(crate) fn new(
1559            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1560        ) -> Self {
1561            Self(RequestBuilder::new(stub))
1562        }
1563
1564        /// Sets the full request, replacing any prior values.
1565        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1566            mut self,
1567            v: V,
1568        ) -> Self {
1569            self.0.request = v.into();
1570            self
1571        }
1572
1573        /// Sets all the options, replacing any prior values.
1574        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1575            self.0.options = v.into();
1576            self
1577        }
1578
1579        /// Sends the request.
1580        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1581            (*self.0.stub)
1582                .test_iam_permissions(self.0.request, self.0.options)
1583                .await
1584                .map(crate::Response::into_body)
1585        }
1586
1587        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
1588        ///
1589        /// This is a **required** field for requests.
1590        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1591            self.0.request.resource = v.into();
1592            self
1593        }
1594
1595        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
1596        ///
1597        /// This is a **required** field for requests.
1598        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1599        where
1600            T: std::iter::IntoIterator<Item = V>,
1601            V: std::convert::Into<std::string::String>,
1602        {
1603            use std::iter::Iterator;
1604            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1605            self
1606        }
1607    }
1608
1609    #[doc(hidden)]
1610    impl crate::RequestBuilder for TestIamPermissions {
1611        fn request_options(&mut self) -> &mut crate::RequestOptions {
1612            &mut self.0.options
1613        }
1614    }
1615
1616    /// The request builder for [AutokeyAdmin::get_operation][crate::client::AutokeyAdmin::get_operation] calls.
1617    ///
1618    /// # Example
1619    /// ```
1620    /// # use google_cloud_kms_v1::builder::autokey_admin::GetOperation;
1621    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1622    ///
1623    /// let builder = prepare_request_builder();
1624    /// let response = builder.send().await?;
1625    /// # Ok(()) }
1626    ///
1627    /// fn prepare_request_builder() -> GetOperation {
1628    ///   # panic!();
1629    ///   // ... details omitted ...
1630    /// }
1631    /// ```
1632    #[derive(Clone, Debug)]
1633    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1634
1635    impl GetOperation {
1636        pub(crate) fn new(
1637            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutokeyAdmin>,
1638        ) -> Self {
1639            Self(RequestBuilder::new(stub))
1640        }
1641
1642        /// Sets the full request, replacing any prior values.
1643        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1644            mut self,
1645            v: V,
1646        ) -> Self {
1647            self.0.request = v.into();
1648            self
1649        }
1650
1651        /// Sets all the options, replacing any prior values.
1652        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1653            self.0.options = v.into();
1654            self
1655        }
1656
1657        /// Sends the request.
1658        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1659            (*self.0.stub)
1660                .get_operation(self.0.request, self.0.options)
1661                .await
1662                .map(crate::Response::into_body)
1663        }
1664
1665        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1666        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1667            self.0.request.name = v.into();
1668            self
1669        }
1670    }
1671
1672    #[doc(hidden)]
1673    impl crate::RequestBuilder for GetOperation {
1674        fn request_options(&mut self) -> &mut crate::RequestOptions {
1675            &mut self.0.options
1676        }
1677    }
1678}
1679
1680/// Request and client builders for [EkmService][crate::client::EkmService].
1681pub mod ekm_service {
1682    use crate::Result;
1683
1684    /// A builder for [EkmService][crate::client::EkmService].
1685    ///
1686    /// ```
1687    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1688    /// # use google_cloud_kms_v1::*;
1689    /// # use builder::ekm_service::ClientBuilder;
1690    /// # use client::EkmService;
1691    /// let builder : ClientBuilder = EkmService::builder();
1692    /// let client = builder
1693    ///     .with_endpoint("https://cloudkms.googleapis.com")
1694    ///     .build().await?;
1695    /// # Ok(()) }
1696    /// ```
1697    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1698
1699    pub(crate) mod client {
1700        use super::super::super::client::EkmService;
1701        pub struct Factory;
1702        impl crate::ClientFactory for Factory {
1703            type Client = EkmService;
1704            type Credentials = gaxi::options::Credentials;
1705            async fn build(
1706                self,
1707                config: gaxi::options::ClientConfig,
1708            ) -> crate::ClientBuilderResult<Self::Client> {
1709                Self::Client::new(config).await
1710            }
1711        }
1712    }
1713
1714    /// Common implementation for [crate::client::EkmService] request builders.
1715    #[derive(Clone, Debug)]
1716    pub(crate) struct RequestBuilder<R: std::default::Default> {
1717        stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
1718        request: R,
1719        options: crate::RequestOptions,
1720    }
1721
1722    impl<R> RequestBuilder<R>
1723    where
1724        R: std::default::Default,
1725    {
1726        pub(crate) fn new(
1727            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
1728        ) -> Self {
1729            Self {
1730                stub,
1731                request: R::default(),
1732                options: crate::RequestOptions::default(),
1733            }
1734        }
1735    }
1736
1737    /// The request builder for [EkmService::list_ekm_connections][crate::client::EkmService::list_ekm_connections] calls.
1738    ///
1739    /// # Example
1740    /// ```
1741    /// # use google_cloud_kms_v1::builder::ekm_service::ListEkmConnections;
1742    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1743    /// use google_cloud_gax::paginator::ItemPaginator;
1744    ///
1745    /// let builder = prepare_request_builder();
1746    /// let mut items = builder.by_item();
1747    /// while let Some(result) = items.next().await {
1748    ///   let item = result?;
1749    /// }
1750    /// # Ok(()) }
1751    ///
1752    /// fn prepare_request_builder() -> ListEkmConnections {
1753    ///   # panic!();
1754    ///   // ... details omitted ...
1755    /// }
1756    /// ```
1757    #[derive(Clone, Debug)]
1758    pub struct ListEkmConnections(RequestBuilder<crate::model::ListEkmConnectionsRequest>);
1759
1760    impl ListEkmConnections {
1761        pub(crate) fn new(
1762            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
1763        ) -> Self {
1764            Self(RequestBuilder::new(stub))
1765        }
1766
1767        /// Sets the full request, replacing any prior values.
1768        pub fn with_request<V: Into<crate::model::ListEkmConnectionsRequest>>(
1769            mut self,
1770            v: V,
1771        ) -> Self {
1772            self.0.request = v.into();
1773            self
1774        }
1775
1776        /// Sets all the options, replacing any prior values.
1777        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1778            self.0.options = v.into();
1779            self
1780        }
1781
1782        /// Sends the request.
1783        pub async fn send(self) -> Result<crate::model::ListEkmConnectionsResponse> {
1784            (*self.0.stub)
1785                .list_ekm_connections(self.0.request, self.0.options)
1786                .await
1787                .map(crate::Response::into_body)
1788        }
1789
1790        /// Streams each page in the collection.
1791        pub fn by_page(
1792            self,
1793        ) -> impl google_cloud_gax::paginator::Paginator<
1794            crate::model::ListEkmConnectionsResponse,
1795            crate::Error,
1796        > {
1797            use std::clone::Clone;
1798            let token = self.0.request.page_token.clone();
1799            let execute = move |token: String| {
1800                let mut builder = self.clone();
1801                builder.0.request = builder.0.request.set_page_token(token);
1802                builder.send()
1803            };
1804            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1805        }
1806
1807        /// Streams each item in the collection.
1808        pub fn by_item(
1809            self,
1810        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1811            crate::model::ListEkmConnectionsResponse,
1812            crate::Error,
1813        > {
1814            use google_cloud_gax::paginator::Paginator;
1815            self.by_page().items()
1816        }
1817
1818        /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1819        ///
1820        /// This is a **required** field for requests.
1821        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1822            self.0.request.parent = v.into();
1823            self
1824        }
1825
1826        /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1827        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1828            self.0.request.page_size = v.into();
1829            self
1830        }
1831
1832        /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1833        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1834            self.0.request.page_token = v.into();
1835            self
1836        }
1837
1838        /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1839        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1840            self.0.request.filter = v.into();
1841            self
1842        }
1843
1844        /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1845        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1846            self.0.request.order_by = v.into();
1847            self
1848        }
1849    }
1850
1851    #[doc(hidden)]
1852    impl crate::RequestBuilder for ListEkmConnections {
1853        fn request_options(&mut self) -> &mut crate::RequestOptions {
1854            &mut self.0.options
1855        }
1856    }
1857
1858    /// The request builder for [EkmService::get_ekm_connection][crate::client::EkmService::get_ekm_connection] calls.
1859    ///
1860    /// # Example
1861    /// ```
1862    /// # use google_cloud_kms_v1::builder::ekm_service::GetEkmConnection;
1863    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1864    ///
1865    /// let builder = prepare_request_builder();
1866    /// let response = builder.send().await?;
1867    /// # Ok(()) }
1868    ///
1869    /// fn prepare_request_builder() -> GetEkmConnection {
1870    ///   # panic!();
1871    ///   // ... details omitted ...
1872    /// }
1873    /// ```
1874    #[derive(Clone, Debug)]
1875    pub struct GetEkmConnection(RequestBuilder<crate::model::GetEkmConnectionRequest>);
1876
1877    impl GetEkmConnection {
1878        pub(crate) fn new(
1879            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
1880        ) -> Self {
1881            Self(RequestBuilder::new(stub))
1882        }
1883
1884        /// Sets the full request, replacing any prior values.
1885        pub fn with_request<V: Into<crate::model::GetEkmConnectionRequest>>(
1886            mut self,
1887            v: V,
1888        ) -> Self {
1889            self.0.request = v.into();
1890            self
1891        }
1892
1893        /// Sets all the options, replacing any prior values.
1894        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1895            self.0.options = v.into();
1896            self
1897        }
1898
1899        /// Sends the request.
1900        pub async fn send(self) -> Result<crate::model::EkmConnection> {
1901            (*self.0.stub)
1902                .get_ekm_connection(self.0.request, self.0.options)
1903                .await
1904                .map(crate::Response::into_body)
1905        }
1906
1907        /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1908        ///
1909        /// This is a **required** field for requests.
1910        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1911            self.0.request.name = v.into();
1912            self
1913        }
1914    }
1915
1916    #[doc(hidden)]
1917    impl crate::RequestBuilder for GetEkmConnection {
1918        fn request_options(&mut self) -> &mut crate::RequestOptions {
1919            &mut self.0.options
1920        }
1921    }
1922
1923    /// The request builder for [EkmService::create_ekm_connection][crate::client::EkmService::create_ekm_connection] calls.
1924    ///
1925    /// # Example
1926    /// ```
1927    /// # use google_cloud_kms_v1::builder::ekm_service::CreateEkmConnection;
1928    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
1929    ///
1930    /// let builder = prepare_request_builder();
1931    /// let response = builder.send().await?;
1932    /// # Ok(()) }
1933    ///
1934    /// fn prepare_request_builder() -> CreateEkmConnection {
1935    ///   # panic!();
1936    ///   // ... details omitted ...
1937    /// }
1938    /// ```
1939    #[derive(Clone, Debug)]
1940    pub struct CreateEkmConnection(RequestBuilder<crate::model::CreateEkmConnectionRequest>);
1941
1942    impl CreateEkmConnection {
1943        pub(crate) fn new(
1944            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
1945        ) -> Self {
1946            Self(RequestBuilder::new(stub))
1947        }
1948
1949        /// Sets the full request, replacing any prior values.
1950        pub fn with_request<V: Into<crate::model::CreateEkmConnectionRequest>>(
1951            mut self,
1952            v: V,
1953        ) -> Self {
1954            self.0.request = v.into();
1955            self
1956        }
1957
1958        /// Sets all the options, replacing any prior values.
1959        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1960            self.0.options = v.into();
1961            self
1962        }
1963
1964        /// Sends the request.
1965        pub async fn send(self) -> Result<crate::model::EkmConnection> {
1966            (*self.0.stub)
1967                .create_ekm_connection(self.0.request, self.0.options)
1968                .await
1969                .map(crate::Response::into_body)
1970        }
1971
1972        /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1973        ///
1974        /// This is a **required** field for requests.
1975        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1976            self.0.request.parent = v.into();
1977            self
1978        }
1979
1980        /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1981        ///
1982        /// This is a **required** field for requests.
1983        pub fn set_ekm_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1984            self.0.request.ekm_connection_id = v.into();
1985            self
1986        }
1987
1988        /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1989        ///
1990        /// This is a **required** field for requests.
1991        pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1992        where
1993            T: std::convert::Into<crate::model::EkmConnection>,
1994        {
1995            self.0.request.ekm_connection = std::option::Option::Some(v.into());
1996            self
1997        }
1998
1999        /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
2000        ///
2001        /// This is a **required** field for requests.
2002        pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
2003        where
2004            T: std::convert::Into<crate::model::EkmConnection>,
2005        {
2006            self.0.request.ekm_connection = v.map(|x| x.into());
2007            self
2008        }
2009    }
2010
2011    #[doc(hidden)]
2012    impl crate::RequestBuilder for CreateEkmConnection {
2013        fn request_options(&mut self) -> &mut crate::RequestOptions {
2014            &mut self.0.options
2015        }
2016    }
2017
2018    /// The request builder for [EkmService::update_ekm_connection][crate::client::EkmService::update_ekm_connection] calls.
2019    ///
2020    /// # Example
2021    /// ```
2022    /// # use google_cloud_kms_v1::builder::ekm_service::UpdateEkmConnection;
2023    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2024    ///
2025    /// let builder = prepare_request_builder();
2026    /// let response = builder.send().await?;
2027    /// # Ok(()) }
2028    ///
2029    /// fn prepare_request_builder() -> UpdateEkmConnection {
2030    ///   # panic!();
2031    ///   // ... details omitted ...
2032    /// }
2033    /// ```
2034    #[derive(Clone, Debug)]
2035    pub struct UpdateEkmConnection(RequestBuilder<crate::model::UpdateEkmConnectionRequest>);
2036
2037    impl UpdateEkmConnection {
2038        pub(crate) fn new(
2039            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2040        ) -> Self {
2041            Self(RequestBuilder::new(stub))
2042        }
2043
2044        /// Sets the full request, replacing any prior values.
2045        pub fn with_request<V: Into<crate::model::UpdateEkmConnectionRequest>>(
2046            mut self,
2047            v: V,
2048        ) -> Self {
2049            self.0.request = v.into();
2050            self
2051        }
2052
2053        /// Sets all the options, replacing any prior values.
2054        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2055            self.0.options = v.into();
2056            self
2057        }
2058
2059        /// Sends the request.
2060        pub async fn send(self) -> Result<crate::model::EkmConnection> {
2061            (*self.0.stub)
2062                .update_ekm_connection(self.0.request, self.0.options)
2063                .await
2064                .map(crate::Response::into_body)
2065        }
2066
2067        /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
2068        ///
2069        /// This is a **required** field for requests.
2070        pub fn set_ekm_connection<T>(mut self, v: T) -> Self
2071        where
2072            T: std::convert::Into<crate::model::EkmConnection>,
2073        {
2074            self.0.request.ekm_connection = std::option::Option::Some(v.into());
2075            self
2076        }
2077
2078        /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
2079        ///
2080        /// This is a **required** field for requests.
2081        pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
2082        where
2083            T: std::convert::Into<crate::model::EkmConnection>,
2084        {
2085            self.0.request.ekm_connection = v.map(|x| x.into());
2086            self
2087        }
2088
2089        /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
2090        ///
2091        /// This is a **required** field for requests.
2092        pub fn set_update_mask<T>(mut self, v: T) -> Self
2093        where
2094            T: std::convert::Into<wkt::FieldMask>,
2095        {
2096            self.0.request.update_mask = std::option::Option::Some(v.into());
2097            self
2098        }
2099
2100        /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
2101        ///
2102        /// This is a **required** field for requests.
2103        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2104        where
2105            T: std::convert::Into<wkt::FieldMask>,
2106        {
2107            self.0.request.update_mask = v.map(|x| x.into());
2108            self
2109        }
2110    }
2111
2112    #[doc(hidden)]
2113    impl crate::RequestBuilder for UpdateEkmConnection {
2114        fn request_options(&mut self) -> &mut crate::RequestOptions {
2115            &mut self.0.options
2116        }
2117    }
2118
2119    /// The request builder for [EkmService::get_ekm_config][crate::client::EkmService::get_ekm_config] calls.
2120    ///
2121    /// # Example
2122    /// ```
2123    /// # use google_cloud_kms_v1::builder::ekm_service::GetEkmConfig;
2124    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2125    ///
2126    /// let builder = prepare_request_builder();
2127    /// let response = builder.send().await?;
2128    /// # Ok(()) }
2129    ///
2130    /// fn prepare_request_builder() -> GetEkmConfig {
2131    ///   # panic!();
2132    ///   // ... details omitted ...
2133    /// }
2134    /// ```
2135    #[derive(Clone, Debug)]
2136    pub struct GetEkmConfig(RequestBuilder<crate::model::GetEkmConfigRequest>);
2137
2138    impl GetEkmConfig {
2139        pub(crate) fn new(
2140            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2141        ) -> Self {
2142            Self(RequestBuilder::new(stub))
2143        }
2144
2145        /// Sets the full request, replacing any prior values.
2146        pub fn with_request<V: Into<crate::model::GetEkmConfigRequest>>(mut self, v: V) -> Self {
2147            self.0.request = v.into();
2148            self
2149        }
2150
2151        /// Sets all the options, replacing any prior values.
2152        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2153            self.0.options = v.into();
2154            self
2155        }
2156
2157        /// Sends the request.
2158        pub async fn send(self) -> Result<crate::model::EkmConfig> {
2159            (*self.0.stub)
2160                .get_ekm_config(self.0.request, self.0.options)
2161                .await
2162                .map(crate::Response::into_body)
2163        }
2164
2165        /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
2166        ///
2167        /// This is a **required** field for requests.
2168        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2169            self.0.request.name = v.into();
2170            self
2171        }
2172    }
2173
2174    #[doc(hidden)]
2175    impl crate::RequestBuilder for GetEkmConfig {
2176        fn request_options(&mut self) -> &mut crate::RequestOptions {
2177            &mut self.0.options
2178        }
2179    }
2180
2181    /// The request builder for [EkmService::update_ekm_config][crate::client::EkmService::update_ekm_config] calls.
2182    ///
2183    /// # Example
2184    /// ```
2185    /// # use google_cloud_kms_v1::builder::ekm_service::UpdateEkmConfig;
2186    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2187    ///
2188    /// let builder = prepare_request_builder();
2189    /// let response = builder.send().await?;
2190    /// # Ok(()) }
2191    ///
2192    /// fn prepare_request_builder() -> UpdateEkmConfig {
2193    ///   # panic!();
2194    ///   // ... details omitted ...
2195    /// }
2196    /// ```
2197    #[derive(Clone, Debug)]
2198    pub struct UpdateEkmConfig(RequestBuilder<crate::model::UpdateEkmConfigRequest>);
2199
2200    impl UpdateEkmConfig {
2201        pub(crate) fn new(
2202            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2203        ) -> Self {
2204            Self(RequestBuilder::new(stub))
2205        }
2206
2207        /// Sets the full request, replacing any prior values.
2208        pub fn with_request<V: Into<crate::model::UpdateEkmConfigRequest>>(mut self, v: V) -> Self {
2209            self.0.request = v.into();
2210            self
2211        }
2212
2213        /// Sets all the options, replacing any prior values.
2214        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2215            self.0.options = v.into();
2216            self
2217        }
2218
2219        /// Sends the request.
2220        pub async fn send(self) -> Result<crate::model::EkmConfig> {
2221            (*self.0.stub)
2222                .update_ekm_config(self.0.request, self.0.options)
2223                .await
2224                .map(crate::Response::into_body)
2225        }
2226
2227        /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
2228        ///
2229        /// This is a **required** field for requests.
2230        pub fn set_ekm_config<T>(mut self, v: T) -> Self
2231        where
2232            T: std::convert::Into<crate::model::EkmConfig>,
2233        {
2234            self.0.request.ekm_config = std::option::Option::Some(v.into());
2235            self
2236        }
2237
2238        /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
2239        ///
2240        /// This is a **required** field for requests.
2241        pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
2242        where
2243            T: std::convert::Into<crate::model::EkmConfig>,
2244        {
2245            self.0.request.ekm_config = v.map(|x| x.into());
2246            self
2247        }
2248
2249        /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
2250        ///
2251        /// This is a **required** field for requests.
2252        pub fn set_update_mask<T>(mut self, v: T) -> Self
2253        where
2254            T: std::convert::Into<wkt::FieldMask>,
2255        {
2256            self.0.request.update_mask = std::option::Option::Some(v.into());
2257            self
2258        }
2259
2260        /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
2261        ///
2262        /// This is a **required** field for requests.
2263        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2264        where
2265            T: std::convert::Into<wkt::FieldMask>,
2266        {
2267            self.0.request.update_mask = v.map(|x| x.into());
2268            self
2269        }
2270    }
2271
2272    #[doc(hidden)]
2273    impl crate::RequestBuilder for UpdateEkmConfig {
2274        fn request_options(&mut self) -> &mut crate::RequestOptions {
2275            &mut self.0.options
2276        }
2277    }
2278
2279    /// The request builder for [EkmService::verify_connectivity][crate::client::EkmService::verify_connectivity] calls.
2280    ///
2281    /// # Example
2282    /// ```
2283    /// # use google_cloud_kms_v1::builder::ekm_service::VerifyConnectivity;
2284    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2285    ///
2286    /// let builder = prepare_request_builder();
2287    /// let response = builder.send().await?;
2288    /// # Ok(()) }
2289    ///
2290    /// fn prepare_request_builder() -> VerifyConnectivity {
2291    ///   # panic!();
2292    ///   // ... details omitted ...
2293    /// }
2294    /// ```
2295    #[derive(Clone, Debug)]
2296    pub struct VerifyConnectivity(RequestBuilder<crate::model::VerifyConnectivityRequest>);
2297
2298    impl VerifyConnectivity {
2299        pub(crate) fn new(
2300            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2301        ) -> Self {
2302            Self(RequestBuilder::new(stub))
2303        }
2304
2305        /// Sets the full request, replacing any prior values.
2306        pub fn with_request<V: Into<crate::model::VerifyConnectivityRequest>>(
2307            mut self,
2308            v: V,
2309        ) -> Self {
2310            self.0.request = v.into();
2311            self
2312        }
2313
2314        /// Sets all the options, replacing any prior values.
2315        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2316            self.0.options = v.into();
2317            self
2318        }
2319
2320        /// Sends the request.
2321        pub async fn send(self) -> Result<crate::model::VerifyConnectivityResponse> {
2322            (*self.0.stub)
2323                .verify_connectivity(self.0.request, self.0.options)
2324                .await
2325                .map(crate::Response::into_body)
2326        }
2327
2328        /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2329        ///
2330        /// This is a **required** field for requests.
2331        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2332            self.0.request.name = v.into();
2333            self
2334        }
2335    }
2336
2337    #[doc(hidden)]
2338    impl crate::RequestBuilder for VerifyConnectivity {
2339        fn request_options(&mut self) -> &mut crate::RequestOptions {
2340            &mut self.0.options
2341        }
2342    }
2343
2344    /// The request builder for [EkmService::list_locations][crate::client::EkmService::list_locations] calls.
2345    ///
2346    /// # Example
2347    /// ```
2348    /// # use google_cloud_kms_v1::builder::ekm_service::ListLocations;
2349    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2350    /// use google_cloud_gax::paginator::ItemPaginator;
2351    ///
2352    /// let builder = prepare_request_builder();
2353    /// let mut items = builder.by_item();
2354    /// while let Some(result) = items.next().await {
2355    ///   let item = result?;
2356    /// }
2357    /// # Ok(()) }
2358    ///
2359    /// fn prepare_request_builder() -> ListLocations {
2360    ///   # panic!();
2361    ///   // ... details omitted ...
2362    /// }
2363    /// ```
2364    #[derive(Clone, Debug)]
2365    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
2366
2367    impl ListLocations {
2368        pub(crate) fn new(
2369            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2370        ) -> Self {
2371            Self(RequestBuilder::new(stub))
2372        }
2373
2374        /// Sets the full request, replacing any prior values.
2375        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
2376            mut self,
2377            v: V,
2378        ) -> Self {
2379            self.0.request = v.into();
2380            self
2381        }
2382
2383        /// Sets all the options, replacing any prior values.
2384        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2385            self.0.options = v.into();
2386            self
2387        }
2388
2389        /// Sends the request.
2390        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
2391            (*self.0.stub)
2392                .list_locations(self.0.request, self.0.options)
2393                .await
2394                .map(crate::Response::into_body)
2395        }
2396
2397        /// Streams each page in the collection.
2398        pub fn by_page(
2399            self,
2400        ) -> impl google_cloud_gax::paginator::Paginator<
2401            google_cloud_location::model::ListLocationsResponse,
2402            crate::Error,
2403        > {
2404            use std::clone::Clone;
2405            let token = self.0.request.page_token.clone();
2406            let execute = move |token: String| {
2407                let mut builder = self.clone();
2408                builder.0.request = builder.0.request.set_page_token(token);
2409                builder.send()
2410            };
2411            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2412        }
2413
2414        /// Streams each item in the collection.
2415        pub fn by_item(
2416            self,
2417        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2418            google_cloud_location::model::ListLocationsResponse,
2419            crate::Error,
2420        > {
2421            use google_cloud_gax::paginator::Paginator;
2422            self.by_page().items()
2423        }
2424
2425        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
2426        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2427            self.0.request.name = v.into();
2428            self
2429        }
2430
2431        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
2432        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2433            self.0.request.filter = v.into();
2434            self
2435        }
2436
2437        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
2438        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2439            self.0.request.page_size = v.into();
2440            self
2441        }
2442
2443        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
2444        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2445            self.0.request.page_token = v.into();
2446            self
2447        }
2448    }
2449
2450    #[doc(hidden)]
2451    impl crate::RequestBuilder for ListLocations {
2452        fn request_options(&mut self) -> &mut crate::RequestOptions {
2453            &mut self.0.options
2454        }
2455    }
2456
2457    /// The request builder for [EkmService::get_location][crate::client::EkmService::get_location] calls.
2458    ///
2459    /// # Example
2460    /// ```
2461    /// # use google_cloud_kms_v1::builder::ekm_service::GetLocation;
2462    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2463    ///
2464    /// let builder = prepare_request_builder();
2465    /// let response = builder.send().await?;
2466    /// # Ok(()) }
2467    ///
2468    /// fn prepare_request_builder() -> GetLocation {
2469    ///   # panic!();
2470    ///   // ... details omitted ...
2471    /// }
2472    /// ```
2473    #[derive(Clone, Debug)]
2474    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2475
2476    impl GetLocation {
2477        pub(crate) fn new(
2478            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2479        ) -> Self {
2480            Self(RequestBuilder::new(stub))
2481        }
2482
2483        /// Sets the full request, replacing any prior values.
2484        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2485            mut self,
2486            v: V,
2487        ) -> Self {
2488            self.0.request = v.into();
2489            self
2490        }
2491
2492        /// Sets all the options, replacing any prior values.
2493        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2494            self.0.options = v.into();
2495            self
2496        }
2497
2498        /// Sends the request.
2499        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2500            (*self.0.stub)
2501                .get_location(self.0.request, self.0.options)
2502                .await
2503                .map(crate::Response::into_body)
2504        }
2505
2506        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
2507        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2508            self.0.request.name = v.into();
2509            self
2510        }
2511    }
2512
2513    #[doc(hidden)]
2514    impl crate::RequestBuilder for GetLocation {
2515        fn request_options(&mut self) -> &mut crate::RequestOptions {
2516            &mut self.0.options
2517        }
2518    }
2519
2520    /// The request builder for [EkmService::set_iam_policy][crate::client::EkmService::set_iam_policy] calls.
2521    ///
2522    /// # Example
2523    /// ```
2524    /// # use google_cloud_kms_v1::builder::ekm_service::SetIamPolicy;
2525    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2526    ///
2527    /// let builder = prepare_request_builder();
2528    /// let response = builder.send().await?;
2529    /// # Ok(()) }
2530    ///
2531    /// fn prepare_request_builder() -> SetIamPolicy {
2532    ///   # panic!();
2533    ///   // ... details omitted ...
2534    /// }
2535    /// ```
2536    #[derive(Clone, Debug)]
2537    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
2538
2539    impl SetIamPolicy {
2540        pub(crate) fn new(
2541            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2542        ) -> Self {
2543            Self(RequestBuilder::new(stub))
2544        }
2545
2546        /// Sets the full request, replacing any prior values.
2547        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
2548            mut self,
2549            v: V,
2550        ) -> Self {
2551            self.0.request = v.into();
2552            self
2553        }
2554
2555        /// Sets all the options, replacing any prior values.
2556        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2557            self.0.options = v.into();
2558            self
2559        }
2560
2561        /// Sends the request.
2562        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2563            (*self.0.stub)
2564                .set_iam_policy(self.0.request, self.0.options)
2565                .await
2566                .map(crate::Response::into_body)
2567        }
2568
2569        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
2570        ///
2571        /// This is a **required** field for requests.
2572        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2573            self.0.request.resource = v.into();
2574            self
2575        }
2576
2577        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2578        ///
2579        /// This is a **required** field for requests.
2580        pub fn set_policy<T>(mut self, v: T) -> Self
2581        where
2582            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2583        {
2584            self.0.request.policy = std::option::Option::Some(v.into());
2585            self
2586        }
2587
2588        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2589        ///
2590        /// This is a **required** field for requests.
2591        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2592        where
2593            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2594        {
2595            self.0.request.policy = v.map(|x| x.into());
2596            self
2597        }
2598
2599        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2600        pub fn set_update_mask<T>(mut self, v: T) -> Self
2601        where
2602            T: std::convert::Into<wkt::FieldMask>,
2603        {
2604            self.0.request.update_mask = std::option::Option::Some(v.into());
2605            self
2606        }
2607
2608        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2609        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2610        where
2611            T: std::convert::Into<wkt::FieldMask>,
2612        {
2613            self.0.request.update_mask = v.map(|x| x.into());
2614            self
2615        }
2616    }
2617
2618    #[doc(hidden)]
2619    impl crate::RequestBuilder for SetIamPolicy {
2620        fn request_options(&mut self) -> &mut crate::RequestOptions {
2621            &mut self.0.options
2622        }
2623    }
2624
2625    /// The request builder for [EkmService::get_iam_policy][crate::client::EkmService::get_iam_policy] calls.
2626    ///
2627    /// # Example
2628    /// ```
2629    /// # use google_cloud_kms_v1::builder::ekm_service::GetIamPolicy;
2630    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2631    ///
2632    /// let builder = prepare_request_builder();
2633    /// let response = builder.send().await?;
2634    /// # Ok(()) }
2635    ///
2636    /// fn prepare_request_builder() -> GetIamPolicy {
2637    ///   # panic!();
2638    ///   // ... details omitted ...
2639    /// }
2640    /// ```
2641    #[derive(Clone, Debug)]
2642    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
2643
2644    impl GetIamPolicy {
2645        pub(crate) fn new(
2646            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2647        ) -> Self {
2648            Self(RequestBuilder::new(stub))
2649        }
2650
2651        /// Sets the full request, replacing any prior values.
2652        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
2653            mut self,
2654            v: V,
2655        ) -> Self {
2656            self.0.request = v.into();
2657            self
2658        }
2659
2660        /// Sets all the options, replacing any prior values.
2661        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2662            self.0.options = v.into();
2663            self
2664        }
2665
2666        /// Sends the request.
2667        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2668            (*self.0.stub)
2669                .get_iam_policy(self.0.request, self.0.options)
2670                .await
2671                .map(crate::Response::into_body)
2672        }
2673
2674        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
2675        ///
2676        /// This is a **required** field for requests.
2677        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2678            self.0.request.resource = v.into();
2679            self
2680        }
2681
2682        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
2683        pub fn set_options<T>(mut self, v: T) -> Self
2684        where
2685            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2686        {
2687            self.0.request.options = std::option::Option::Some(v.into());
2688            self
2689        }
2690
2691        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
2692        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2693        where
2694            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2695        {
2696            self.0.request.options = v.map(|x| x.into());
2697            self
2698        }
2699    }
2700
2701    #[doc(hidden)]
2702    impl crate::RequestBuilder for GetIamPolicy {
2703        fn request_options(&mut self) -> &mut crate::RequestOptions {
2704            &mut self.0.options
2705        }
2706    }
2707
2708    /// The request builder for [EkmService::test_iam_permissions][crate::client::EkmService::test_iam_permissions] calls.
2709    ///
2710    /// # Example
2711    /// ```
2712    /// # use google_cloud_kms_v1::builder::ekm_service::TestIamPermissions;
2713    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2714    ///
2715    /// let builder = prepare_request_builder();
2716    /// let response = builder.send().await?;
2717    /// # Ok(()) }
2718    ///
2719    /// fn prepare_request_builder() -> TestIamPermissions {
2720    ///   # panic!();
2721    ///   // ... details omitted ...
2722    /// }
2723    /// ```
2724    #[derive(Clone, Debug)]
2725    pub struct TestIamPermissions(
2726        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
2727    );
2728
2729    impl TestIamPermissions {
2730        pub(crate) fn new(
2731            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2732        ) -> Self {
2733            Self(RequestBuilder::new(stub))
2734        }
2735
2736        /// Sets the full request, replacing any prior values.
2737        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
2738            mut self,
2739            v: V,
2740        ) -> Self {
2741            self.0.request = v.into();
2742            self
2743        }
2744
2745        /// Sets all the options, replacing any prior values.
2746        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2747            self.0.options = v.into();
2748            self
2749        }
2750
2751        /// Sends the request.
2752        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
2753            (*self.0.stub)
2754                .test_iam_permissions(self.0.request, self.0.options)
2755                .await
2756                .map(crate::Response::into_body)
2757        }
2758
2759        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
2760        ///
2761        /// This is a **required** field for requests.
2762        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2763            self.0.request.resource = v.into();
2764            self
2765        }
2766
2767        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
2768        ///
2769        /// This is a **required** field for requests.
2770        pub fn set_permissions<T, V>(mut self, v: T) -> Self
2771        where
2772            T: std::iter::IntoIterator<Item = V>,
2773            V: std::convert::Into<std::string::String>,
2774        {
2775            use std::iter::Iterator;
2776            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2777            self
2778        }
2779    }
2780
2781    #[doc(hidden)]
2782    impl crate::RequestBuilder for TestIamPermissions {
2783        fn request_options(&mut self) -> &mut crate::RequestOptions {
2784            &mut self.0.options
2785        }
2786    }
2787
2788    /// The request builder for [EkmService::get_operation][crate::client::EkmService::get_operation] calls.
2789    ///
2790    /// # Example
2791    /// ```
2792    /// # use google_cloud_kms_v1::builder::ekm_service::GetOperation;
2793    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2794    ///
2795    /// let builder = prepare_request_builder();
2796    /// let response = builder.send().await?;
2797    /// # Ok(()) }
2798    ///
2799    /// fn prepare_request_builder() -> GetOperation {
2800    ///   # panic!();
2801    ///   // ... details omitted ...
2802    /// }
2803    /// ```
2804    #[derive(Clone, Debug)]
2805    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2806
2807    impl GetOperation {
2808        pub(crate) fn new(
2809            stub: std::sync::Arc<dyn super::super::stub::dynamic::EkmService>,
2810        ) -> Self {
2811            Self(RequestBuilder::new(stub))
2812        }
2813
2814        /// Sets the full request, replacing any prior values.
2815        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2816            mut self,
2817            v: V,
2818        ) -> Self {
2819            self.0.request = v.into();
2820            self
2821        }
2822
2823        /// Sets all the options, replacing any prior values.
2824        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2825            self.0.options = v.into();
2826            self
2827        }
2828
2829        /// Sends the request.
2830        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2831            (*self.0.stub)
2832                .get_operation(self.0.request, self.0.options)
2833                .await
2834                .map(crate::Response::into_body)
2835        }
2836
2837        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2838        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2839            self.0.request.name = v.into();
2840            self
2841        }
2842    }
2843
2844    #[doc(hidden)]
2845    impl crate::RequestBuilder for GetOperation {
2846        fn request_options(&mut self) -> &mut crate::RequestOptions {
2847            &mut self.0.options
2848        }
2849    }
2850}
2851
2852/// Request and client builders for [HsmManagement][crate::client::HsmManagement].
2853pub mod hsm_management {
2854    use crate::Result;
2855
2856    /// A builder for [HsmManagement][crate::client::HsmManagement].
2857    ///
2858    /// ```
2859    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2860    /// # use google_cloud_kms_v1::*;
2861    /// # use builder::hsm_management::ClientBuilder;
2862    /// # use client::HsmManagement;
2863    /// let builder : ClientBuilder = HsmManagement::builder();
2864    /// let client = builder
2865    ///     .with_endpoint("https://cloudkms.googleapis.com")
2866    ///     .build().await?;
2867    /// # Ok(()) }
2868    /// ```
2869    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2870
2871    pub(crate) mod client {
2872        use super::super::super::client::HsmManagement;
2873        pub struct Factory;
2874        impl crate::ClientFactory for Factory {
2875            type Client = HsmManagement;
2876            type Credentials = gaxi::options::Credentials;
2877            async fn build(
2878                self,
2879                config: gaxi::options::ClientConfig,
2880            ) -> crate::ClientBuilderResult<Self::Client> {
2881                Self::Client::new(config).await
2882            }
2883        }
2884    }
2885
2886    /// Common implementation for [crate::client::HsmManagement] request builders.
2887    #[derive(Clone, Debug)]
2888    pub(crate) struct RequestBuilder<R: std::default::Default> {
2889        stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
2890        request: R,
2891        options: crate::RequestOptions,
2892    }
2893
2894    impl<R> RequestBuilder<R>
2895    where
2896        R: std::default::Default,
2897    {
2898        pub(crate) fn new(
2899            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
2900        ) -> Self {
2901            Self {
2902                stub,
2903                request: R::default(),
2904                options: crate::RequestOptions::default(),
2905            }
2906        }
2907    }
2908
2909    /// The request builder for [HsmManagement::list_single_tenant_hsm_instances][crate::client::HsmManagement::list_single_tenant_hsm_instances] calls.
2910    ///
2911    /// # Example
2912    /// ```
2913    /// # use google_cloud_kms_v1::builder::hsm_management::ListSingleTenantHsmInstances;
2914    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
2915    /// use google_cloud_gax::paginator::ItemPaginator;
2916    ///
2917    /// let builder = prepare_request_builder();
2918    /// let mut items = builder.by_item();
2919    /// while let Some(result) = items.next().await {
2920    ///   let item = result?;
2921    /// }
2922    /// # Ok(()) }
2923    ///
2924    /// fn prepare_request_builder() -> ListSingleTenantHsmInstances {
2925    ///   # panic!();
2926    ///   // ... details omitted ...
2927    /// }
2928    /// ```
2929    #[derive(Clone, Debug)]
2930    pub struct ListSingleTenantHsmInstances(
2931        RequestBuilder<crate::model::ListSingleTenantHsmInstancesRequest>,
2932    );
2933
2934    impl ListSingleTenantHsmInstances {
2935        pub(crate) fn new(
2936            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
2937        ) -> Self {
2938            Self(RequestBuilder::new(stub))
2939        }
2940
2941        /// Sets the full request, replacing any prior values.
2942        pub fn with_request<V: Into<crate::model::ListSingleTenantHsmInstancesRequest>>(
2943            mut self,
2944            v: V,
2945        ) -> Self {
2946            self.0.request = v.into();
2947            self
2948        }
2949
2950        /// Sets all the options, replacing any prior values.
2951        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2952            self.0.options = v.into();
2953            self
2954        }
2955
2956        /// Sends the request.
2957        pub async fn send(self) -> Result<crate::model::ListSingleTenantHsmInstancesResponse> {
2958            (*self.0.stub)
2959                .list_single_tenant_hsm_instances(self.0.request, self.0.options)
2960                .await
2961                .map(crate::Response::into_body)
2962        }
2963
2964        /// Streams each page in the collection.
2965        pub fn by_page(
2966            self,
2967        ) -> impl google_cloud_gax::paginator::Paginator<
2968            crate::model::ListSingleTenantHsmInstancesResponse,
2969            crate::Error,
2970        > {
2971            use std::clone::Clone;
2972            let token = self.0.request.page_token.clone();
2973            let execute = move |token: String| {
2974                let mut builder = self.clone();
2975                builder.0.request = builder.0.request.set_page_token(token);
2976                builder.send()
2977            };
2978            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2979        }
2980
2981        /// Streams each item in the collection.
2982        pub fn by_item(
2983            self,
2984        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2985            crate::model::ListSingleTenantHsmInstancesResponse,
2986            crate::Error,
2987        > {
2988            use google_cloud_gax::paginator::Paginator;
2989            self.by_page().items()
2990        }
2991
2992        /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
2993        ///
2994        /// This is a **required** field for requests.
2995        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2996            self.0.request.parent = v.into();
2997            self
2998        }
2999
3000        /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
3001        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3002            self.0.request.page_size = v.into();
3003            self
3004        }
3005
3006        /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
3007        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3008            self.0.request.page_token = v.into();
3009            self
3010        }
3011
3012        /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
3013        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3014            self.0.request.filter = v.into();
3015            self
3016        }
3017
3018        /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
3019        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3020            self.0.request.order_by = v.into();
3021            self
3022        }
3023
3024        /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
3025        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3026            self.0.request.show_deleted = v.into();
3027            self
3028        }
3029    }
3030
3031    #[doc(hidden)]
3032    impl crate::RequestBuilder for ListSingleTenantHsmInstances {
3033        fn request_options(&mut self) -> &mut crate::RequestOptions {
3034            &mut self.0.options
3035        }
3036    }
3037
3038    /// The request builder for [HsmManagement::get_single_tenant_hsm_instance][crate::client::HsmManagement::get_single_tenant_hsm_instance] calls.
3039    ///
3040    /// # Example
3041    /// ```
3042    /// # use google_cloud_kms_v1::builder::hsm_management::GetSingleTenantHsmInstance;
3043    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3044    ///
3045    /// let builder = prepare_request_builder();
3046    /// let response = builder.send().await?;
3047    /// # Ok(()) }
3048    ///
3049    /// fn prepare_request_builder() -> GetSingleTenantHsmInstance {
3050    ///   # panic!();
3051    ///   // ... details omitted ...
3052    /// }
3053    /// ```
3054    #[derive(Clone, Debug)]
3055    pub struct GetSingleTenantHsmInstance(
3056        RequestBuilder<crate::model::GetSingleTenantHsmInstanceRequest>,
3057    );
3058
3059    impl GetSingleTenantHsmInstance {
3060        pub(crate) fn new(
3061            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3062        ) -> Self {
3063            Self(RequestBuilder::new(stub))
3064        }
3065
3066        /// Sets the full request, replacing any prior values.
3067        pub fn with_request<V: Into<crate::model::GetSingleTenantHsmInstanceRequest>>(
3068            mut self,
3069            v: V,
3070        ) -> Self {
3071            self.0.request = v.into();
3072            self
3073        }
3074
3075        /// Sets all the options, replacing any prior values.
3076        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3077            self.0.options = v.into();
3078            self
3079        }
3080
3081        /// Sends the request.
3082        pub async fn send(self) -> Result<crate::model::SingleTenantHsmInstance> {
3083            (*self.0.stub)
3084                .get_single_tenant_hsm_instance(self.0.request, self.0.options)
3085                .await
3086                .map(crate::Response::into_body)
3087        }
3088
3089        /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
3090        ///
3091        /// This is a **required** field for requests.
3092        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3093            self.0.request.name = v.into();
3094            self
3095        }
3096    }
3097
3098    #[doc(hidden)]
3099    impl crate::RequestBuilder for GetSingleTenantHsmInstance {
3100        fn request_options(&mut self) -> &mut crate::RequestOptions {
3101            &mut self.0.options
3102        }
3103    }
3104
3105    /// The request builder for [HsmManagement::create_single_tenant_hsm_instance][crate::client::HsmManagement::create_single_tenant_hsm_instance] calls.
3106    ///
3107    /// # Example
3108    /// ```
3109    /// # use google_cloud_kms_v1::builder::hsm_management::CreateSingleTenantHsmInstance;
3110    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3111    /// use google_cloud_lro::Poller;
3112    ///
3113    /// let builder = prepare_request_builder();
3114    /// let response = builder.poller().until_done().await?;
3115    /// # Ok(()) }
3116    ///
3117    /// fn prepare_request_builder() -> CreateSingleTenantHsmInstance {
3118    ///   # panic!();
3119    ///   // ... details omitted ...
3120    /// }
3121    /// ```
3122    #[derive(Clone, Debug)]
3123    pub struct CreateSingleTenantHsmInstance(
3124        RequestBuilder<crate::model::CreateSingleTenantHsmInstanceRequest>,
3125    );
3126
3127    impl CreateSingleTenantHsmInstance {
3128        pub(crate) fn new(
3129            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
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::CreateSingleTenantHsmInstanceRequest>>(
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<crate::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_single_tenant_hsm_instance][crate::client::HsmManagement::create_single_tenant_hsm_instance].
3155        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3156            (*self.0.stub)
3157                .create_single_tenant_hsm_instance(self.0.request, self.0.options)
3158                .await
3159                .map(crate::Response::into_body)
3160        }
3161
3162        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_single_tenant_hsm_instance`.
3163        pub fn poller(
3164            self,
3165        ) -> impl google_cloud_lro::Poller<
3166            crate::model::SingleTenantHsmInstance,
3167            crate::model::CreateSingleTenantHsmInstanceMetadata,
3168        > {
3169            type Operation = google_cloud_lro::internal::Operation<
3170                crate::model::SingleTenantHsmInstance,
3171                crate::model::CreateSingleTenantHsmInstanceMetadata,
3172            >;
3173            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3174            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3175            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
3176            if let Some(ref mut details) = poller_options.tracing {
3177                details.method_name = "google_cloud_kms_v1::client::HsmManagement::create_single_tenant_hsm_instance::until_done";
3178            }
3179
3180            let stub = self.0.stub.clone();
3181            let mut options = self.0.options.clone();
3182            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3183            let query = move |name| {
3184                let stub = stub.clone();
3185                let options = options.clone();
3186                async {
3187                    let op = GetOperation::new(stub)
3188                        .set_name(name)
3189                        .with_options(options)
3190                        .send()
3191                        .await?;
3192                    Ok(Operation::new(op))
3193                }
3194            };
3195
3196            let start = move || async {
3197                let op = self.send().await?;
3198                Ok(Operation::new(op))
3199            };
3200
3201            use google_cloud_lro::internal::PollerExt;
3202            {
3203                google_cloud_lro::internal::new_poller(
3204                    polling_error_policy,
3205                    polling_backoff_policy,
3206                    start,
3207                    query,
3208                )
3209            }
3210            .with_options(poller_options)
3211        }
3212
3213        /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
3214        ///
3215        /// This is a **required** field for requests.
3216        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3217            self.0.request.parent = v.into();
3218            self
3219        }
3220
3221        /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
3222        pub fn set_single_tenant_hsm_instance_id<T: Into<std::string::String>>(
3223            mut self,
3224            v: T,
3225        ) -> Self {
3226            self.0.request.single_tenant_hsm_instance_id = v.into();
3227            self
3228        }
3229
3230        /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
3231        ///
3232        /// This is a **required** field for requests.
3233        pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
3234        where
3235            T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
3236        {
3237            self.0.request.single_tenant_hsm_instance = std::option::Option::Some(v.into());
3238            self
3239        }
3240
3241        /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
3242        ///
3243        /// This is a **required** field for requests.
3244        pub fn set_or_clear_single_tenant_hsm_instance<T>(
3245            mut self,
3246            v: std::option::Option<T>,
3247        ) -> Self
3248        where
3249            T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
3250        {
3251            self.0.request.single_tenant_hsm_instance = v.map(|x| x.into());
3252            self
3253        }
3254    }
3255
3256    #[doc(hidden)]
3257    impl crate::RequestBuilder for CreateSingleTenantHsmInstance {
3258        fn request_options(&mut self) -> &mut crate::RequestOptions {
3259            &mut self.0.options
3260        }
3261    }
3262
3263    /// The request builder for [HsmManagement::create_single_tenant_hsm_instance_proposal][crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal] calls.
3264    ///
3265    /// # Example
3266    /// ```
3267    /// # use google_cloud_kms_v1::builder::hsm_management::CreateSingleTenantHsmInstanceProposal;
3268    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3269    /// use google_cloud_lro::Poller;
3270    ///
3271    /// let builder = prepare_request_builder();
3272    /// let response = builder.poller().until_done().await?;
3273    /// # Ok(()) }
3274    ///
3275    /// fn prepare_request_builder() -> CreateSingleTenantHsmInstanceProposal {
3276    ///   # panic!();
3277    ///   // ... details omitted ...
3278    /// }
3279    /// ```
3280    #[derive(Clone, Debug)]
3281    pub struct CreateSingleTenantHsmInstanceProposal(
3282        RequestBuilder<crate::model::CreateSingleTenantHsmInstanceProposalRequest>,
3283    );
3284
3285    impl CreateSingleTenantHsmInstanceProposal {
3286        pub(crate) fn new(
3287            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3288        ) -> Self {
3289            Self(RequestBuilder::new(stub))
3290        }
3291
3292        /// Sets the full request, replacing any prior values.
3293        pub fn with_request<V: Into<crate::model::CreateSingleTenantHsmInstanceProposalRequest>>(
3294            mut self,
3295            v: V,
3296        ) -> Self {
3297            self.0.request = v.into();
3298            self
3299        }
3300
3301        /// Sets all the options, replacing any prior values.
3302        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3303            self.0.options = v.into();
3304            self
3305        }
3306
3307        /// Sends the request.
3308        ///
3309        /// # Long running operations
3310        ///
3311        /// This starts, but does not poll, a longrunning operation. More information
3312        /// on [create_single_tenant_hsm_instance_proposal][crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal].
3313        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3314            (*self.0.stub)
3315                .create_single_tenant_hsm_instance_proposal(self.0.request, self.0.options)
3316                .await
3317                .map(crate::Response::into_body)
3318        }
3319
3320        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_single_tenant_hsm_instance_proposal`.
3321        pub fn poller(
3322            self,
3323        ) -> impl google_cloud_lro::Poller<
3324            crate::model::SingleTenantHsmInstanceProposal,
3325            crate::model::CreateSingleTenantHsmInstanceProposalMetadata,
3326        > {
3327            type Operation = google_cloud_lro::internal::Operation<
3328                crate::model::SingleTenantHsmInstanceProposal,
3329                crate::model::CreateSingleTenantHsmInstanceProposalMetadata,
3330            >;
3331            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3332            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3333            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
3334            if let Some(ref mut details) = poller_options.tracing {
3335                details.method_name = "google_cloud_kms_v1::client::HsmManagement::create_single_tenant_hsm_instance_proposal::until_done";
3336            }
3337
3338            let stub = self.0.stub.clone();
3339            let mut options = self.0.options.clone();
3340            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3341            let query = move |name| {
3342                let stub = stub.clone();
3343                let options = options.clone();
3344                async {
3345                    let op = GetOperation::new(stub)
3346                        .set_name(name)
3347                        .with_options(options)
3348                        .send()
3349                        .await?;
3350                    Ok(Operation::new(op))
3351                }
3352            };
3353
3354            let start = move || async {
3355                let op = self.send().await?;
3356                Ok(Operation::new(op))
3357            };
3358
3359            use google_cloud_lro::internal::PollerExt;
3360            {
3361                google_cloud_lro::internal::new_poller(
3362                    polling_error_policy,
3363                    polling_backoff_policy,
3364                    start,
3365                    query,
3366                )
3367            }
3368            .with_options(poller_options)
3369        }
3370
3371        /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
3372        ///
3373        /// This is a **required** field for requests.
3374        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3375            self.0.request.parent = v.into();
3376            self
3377        }
3378
3379        /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
3380        pub fn set_single_tenant_hsm_instance_proposal_id<T: Into<std::string::String>>(
3381            mut self,
3382            v: T,
3383        ) -> Self {
3384            self.0.request.single_tenant_hsm_instance_proposal_id = v.into();
3385            self
3386        }
3387
3388        /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
3389        ///
3390        /// This is a **required** field for requests.
3391        pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
3392        where
3393            T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
3394        {
3395            self.0.request.single_tenant_hsm_instance_proposal =
3396                std::option::Option::Some(v.into());
3397            self
3398        }
3399
3400        /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
3401        ///
3402        /// This is a **required** field for requests.
3403        pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
3404            mut self,
3405            v: std::option::Option<T>,
3406        ) -> Self
3407        where
3408            T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
3409        {
3410            self.0.request.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
3411            self
3412        }
3413    }
3414
3415    #[doc(hidden)]
3416    impl crate::RequestBuilder for CreateSingleTenantHsmInstanceProposal {
3417        fn request_options(&mut self) -> &mut crate::RequestOptions {
3418            &mut self.0.options
3419        }
3420    }
3421
3422    /// The request builder for [HsmManagement::approve_single_tenant_hsm_instance_proposal][crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal] calls.
3423    ///
3424    /// # Example
3425    /// ```
3426    /// # use google_cloud_kms_v1::builder::hsm_management::ApproveSingleTenantHsmInstanceProposal;
3427    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3428    ///
3429    /// let builder = prepare_request_builder();
3430    /// let response = builder.send().await?;
3431    /// # Ok(()) }
3432    ///
3433    /// fn prepare_request_builder() -> ApproveSingleTenantHsmInstanceProposal {
3434    ///   # panic!();
3435    ///   // ... details omitted ...
3436    /// }
3437    /// ```
3438    #[derive(Clone, Debug)]
3439    pub struct ApproveSingleTenantHsmInstanceProposal(
3440        RequestBuilder<crate::model::ApproveSingleTenantHsmInstanceProposalRequest>,
3441    );
3442
3443    impl ApproveSingleTenantHsmInstanceProposal {
3444        pub(crate) fn new(
3445            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3446        ) -> Self {
3447            Self(RequestBuilder::new(stub))
3448        }
3449
3450        /// Sets the full request, replacing any prior values.
3451        pub fn with_request<
3452            V: Into<crate::model::ApproveSingleTenantHsmInstanceProposalRequest>,
3453        >(
3454            mut self,
3455            v: V,
3456        ) -> Self {
3457            self.0.request = v.into();
3458            self
3459        }
3460
3461        /// Sets all the options, replacing any prior values.
3462        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3463            self.0.options = v.into();
3464            self
3465        }
3466
3467        /// Sends the request.
3468        pub async fn send(
3469            self,
3470        ) -> Result<crate::model::ApproveSingleTenantHsmInstanceProposalResponse> {
3471            (*self.0.stub)
3472                .approve_single_tenant_hsm_instance_proposal(self.0.request, self.0.options)
3473                .await
3474                .map(crate::Response::into_body)
3475        }
3476
3477        /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
3478        ///
3479        /// This is a **required** field for requests.
3480        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3481            self.0.request.name = v.into();
3482            self
3483        }
3484
3485        /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
3486        ///
3487        /// Note that all the setters affecting `approval_payload` are
3488        /// mutually exclusive.
3489        pub fn set_approval_payload<T: Into<Option<crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload>>>(mut self, v: T) ->Self{
3490            self.0.request.approval_payload = v.into();
3491            self
3492        }
3493
3494        /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
3495        /// to hold a `QuorumReply`.
3496        ///
3497        /// Note that all the setters affecting `approval_payload` are
3498        /// mutually exclusive.
3499        pub fn set_quorum_reply<T: std::convert::Into<std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>>>(mut self, v: T) -> Self{
3500            self.0.request = self.0.request.set_quorum_reply(v);
3501            self
3502        }
3503
3504        /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
3505        /// to hold a `RequiredActionQuorumReply`.
3506        ///
3507        /// Note that all the setters affecting `approval_payload` are
3508        /// mutually exclusive.
3509        pub fn set_required_action_quorum_reply<T: std::convert::Into<std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>>(mut self, v: T) -> Self{
3510            self.0.request = self.0.request.set_required_action_quorum_reply(v);
3511            self
3512        }
3513    }
3514
3515    #[doc(hidden)]
3516    impl crate::RequestBuilder for ApproveSingleTenantHsmInstanceProposal {
3517        fn request_options(&mut self) -> &mut crate::RequestOptions {
3518            &mut self.0.options
3519        }
3520    }
3521
3522    /// The request builder for [HsmManagement::execute_single_tenant_hsm_instance_proposal][crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal] calls.
3523    ///
3524    /// # Example
3525    /// ```
3526    /// # use google_cloud_kms_v1::builder::hsm_management::ExecuteSingleTenantHsmInstanceProposal;
3527    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3528    /// use google_cloud_lro::Poller;
3529    ///
3530    /// let builder = prepare_request_builder();
3531    /// let response = builder.poller().until_done().await?;
3532    /// # Ok(()) }
3533    ///
3534    /// fn prepare_request_builder() -> ExecuteSingleTenantHsmInstanceProposal {
3535    ///   # panic!();
3536    ///   // ... details omitted ...
3537    /// }
3538    /// ```
3539    #[derive(Clone, Debug)]
3540    pub struct ExecuteSingleTenantHsmInstanceProposal(
3541        RequestBuilder<crate::model::ExecuteSingleTenantHsmInstanceProposalRequest>,
3542    );
3543
3544    impl ExecuteSingleTenantHsmInstanceProposal {
3545        pub(crate) fn new(
3546            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3547        ) -> Self {
3548            Self(RequestBuilder::new(stub))
3549        }
3550
3551        /// Sets the full request, replacing any prior values.
3552        pub fn with_request<
3553            V: Into<crate::model::ExecuteSingleTenantHsmInstanceProposalRequest>,
3554        >(
3555            mut self,
3556            v: V,
3557        ) -> Self {
3558            self.0.request = v.into();
3559            self
3560        }
3561
3562        /// Sets all the options, replacing any prior values.
3563        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3564            self.0.options = v.into();
3565            self
3566        }
3567
3568        /// Sends the request.
3569        ///
3570        /// # Long running operations
3571        ///
3572        /// This starts, but does not poll, a longrunning operation. More information
3573        /// on [execute_single_tenant_hsm_instance_proposal][crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal].
3574        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3575            (*self.0.stub)
3576                .execute_single_tenant_hsm_instance_proposal(self.0.request, self.0.options)
3577                .await
3578                .map(crate::Response::into_body)
3579        }
3580
3581        /// Creates a [Poller][google_cloud_lro::Poller] to work with `execute_single_tenant_hsm_instance_proposal`.
3582        pub fn poller(
3583            self,
3584        ) -> impl google_cloud_lro::Poller<
3585            crate::model::ExecuteSingleTenantHsmInstanceProposalResponse,
3586            crate::model::ExecuteSingleTenantHsmInstanceProposalMetadata,
3587        > {
3588            type Operation = google_cloud_lro::internal::Operation<
3589                crate::model::ExecuteSingleTenantHsmInstanceProposalResponse,
3590                crate::model::ExecuteSingleTenantHsmInstanceProposalMetadata,
3591            >;
3592            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3593            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3594            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
3595            if let Some(ref mut details) = poller_options.tracing {
3596                details.method_name = "google_cloud_kms_v1::client::HsmManagement::execute_single_tenant_hsm_instance_proposal::until_done";
3597            }
3598
3599            let stub = self.0.stub.clone();
3600            let mut options = self.0.options.clone();
3601            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3602            let query = move |name| {
3603                let stub = stub.clone();
3604                let options = options.clone();
3605                async {
3606                    let op = GetOperation::new(stub)
3607                        .set_name(name)
3608                        .with_options(options)
3609                        .send()
3610                        .await?;
3611                    Ok(Operation::new(op))
3612                }
3613            };
3614
3615            let start = move || async {
3616                let op = self.send().await?;
3617                Ok(Operation::new(op))
3618            };
3619
3620            use google_cloud_lro::internal::PollerExt;
3621            {
3622                google_cloud_lro::internal::new_poller(
3623                    polling_error_policy,
3624                    polling_backoff_policy,
3625                    start,
3626                    query,
3627                )
3628            }
3629            .with_options(poller_options)
3630        }
3631
3632        /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
3633        ///
3634        /// This is a **required** field for requests.
3635        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3636            self.0.request.name = v.into();
3637            self
3638        }
3639    }
3640
3641    #[doc(hidden)]
3642    impl crate::RequestBuilder for ExecuteSingleTenantHsmInstanceProposal {
3643        fn request_options(&mut self) -> &mut crate::RequestOptions {
3644            &mut self.0.options
3645        }
3646    }
3647
3648    /// The request builder for [HsmManagement::get_single_tenant_hsm_instance_proposal][crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal] calls.
3649    ///
3650    /// # Example
3651    /// ```
3652    /// # use google_cloud_kms_v1::builder::hsm_management::GetSingleTenantHsmInstanceProposal;
3653    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3654    ///
3655    /// let builder = prepare_request_builder();
3656    /// let response = builder.send().await?;
3657    /// # Ok(()) }
3658    ///
3659    /// fn prepare_request_builder() -> GetSingleTenantHsmInstanceProposal {
3660    ///   # panic!();
3661    ///   // ... details omitted ...
3662    /// }
3663    /// ```
3664    #[derive(Clone, Debug)]
3665    pub struct GetSingleTenantHsmInstanceProposal(
3666        RequestBuilder<crate::model::GetSingleTenantHsmInstanceProposalRequest>,
3667    );
3668
3669    impl GetSingleTenantHsmInstanceProposal {
3670        pub(crate) fn new(
3671            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3672        ) -> Self {
3673            Self(RequestBuilder::new(stub))
3674        }
3675
3676        /// Sets the full request, replacing any prior values.
3677        pub fn with_request<V: Into<crate::model::GetSingleTenantHsmInstanceProposalRequest>>(
3678            mut self,
3679            v: V,
3680        ) -> Self {
3681            self.0.request = v.into();
3682            self
3683        }
3684
3685        /// Sets all the options, replacing any prior values.
3686        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3687            self.0.options = v.into();
3688            self
3689        }
3690
3691        /// Sends the request.
3692        pub async fn send(self) -> Result<crate::model::SingleTenantHsmInstanceProposal> {
3693            (*self.0.stub)
3694                .get_single_tenant_hsm_instance_proposal(self.0.request, self.0.options)
3695                .await
3696                .map(crate::Response::into_body)
3697        }
3698
3699        /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
3700        ///
3701        /// This is a **required** field for requests.
3702        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3703            self.0.request.name = v.into();
3704            self
3705        }
3706    }
3707
3708    #[doc(hidden)]
3709    impl crate::RequestBuilder for GetSingleTenantHsmInstanceProposal {
3710        fn request_options(&mut self) -> &mut crate::RequestOptions {
3711            &mut self.0.options
3712        }
3713    }
3714
3715    /// The request builder for [HsmManagement::list_single_tenant_hsm_instance_proposals][crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals] calls.
3716    ///
3717    /// # Example
3718    /// ```
3719    /// # use google_cloud_kms_v1::builder::hsm_management::ListSingleTenantHsmInstanceProposals;
3720    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3721    /// use google_cloud_gax::paginator::ItemPaginator;
3722    ///
3723    /// let builder = prepare_request_builder();
3724    /// let mut items = builder.by_item();
3725    /// while let Some(result) = items.next().await {
3726    ///   let item = result?;
3727    /// }
3728    /// # Ok(()) }
3729    ///
3730    /// fn prepare_request_builder() -> ListSingleTenantHsmInstanceProposals {
3731    ///   # panic!();
3732    ///   // ... details omitted ...
3733    /// }
3734    /// ```
3735    #[derive(Clone, Debug)]
3736    pub struct ListSingleTenantHsmInstanceProposals(
3737        RequestBuilder<crate::model::ListSingleTenantHsmInstanceProposalsRequest>,
3738    );
3739
3740    impl ListSingleTenantHsmInstanceProposals {
3741        pub(crate) fn new(
3742            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3743        ) -> Self {
3744            Self(RequestBuilder::new(stub))
3745        }
3746
3747        /// Sets the full request, replacing any prior values.
3748        pub fn with_request<V: Into<crate::model::ListSingleTenantHsmInstanceProposalsRequest>>(
3749            mut self,
3750            v: V,
3751        ) -> Self {
3752            self.0.request = v.into();
3753            self
3754        }
3755
3756        /// Sets all the options, replacing any prior values.
3757        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3758            self.0.options = v.into();
3759            self
3760        }
3761
3762        /// Sends the request.
3763        pub async fn send(
3764            self,
3765        ) -> Result<crate::model::ListSingleTenantHsmInstanceProposalsResponse> {
3766            (*self.0.stub)
3767                .list_single_tenant_hsm_instance_proposals(self.0.request, self.0.options)
3768                .await
3769                .map(crate::Response::into_body)
3770        }
3771
3772        /// Streams each page in the collection.
3773        pub fn by_page(
3774            self,
3775        ) -> impl google_cloud_gax::paginator::Paginator<
3776            crate::model::ListSingleTenantHsmInstanceProposalsResponse,
3777            crate::Error,
3778        > {
3779            use std::clone::Clone;
3780            let token = self.0.request.page_token.clone();
3781            let execute = move |token: String| {
3782                let mut builder = self.clone();
3783                builder.0.request = builder.0.request.set_page_token(token);
3784                builder.send()
3785            };
3786            google_cloud_gax::paginator::internal::new_paginator(token, execute)
3787        }
3788
3789        /// Streams each item in the collection.
3790        pub fn by_item(
3791            self,
3792        ) -> impl google_cloud_gax::paginator::ItemPaginator<
3793            crate::model::ListSingleTenantHsmInstanceProposalsResponse,
3794            crate::Error,
3795        > {
3796            use google_cloud_gax::paginator::Paginator;
3797            self.by_page().items()
3798        }
3799
3800        /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
3801        ///
3802        /// This is a **required** field for requests.
3803        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3804            self.0.request.parent = v.into();
3805            self
3806        }
3807
3808        /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
3809        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3810            self.0.request.page_size = v.into();
3811            self
3812        }
3813
3814        /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
3815        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3816            self.0.request.page_token = v.into();
3817            self
3818        }
3819
3820        /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
3821        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3822            self.0.request.filter = v.into();
3823            self
3824        }
3825
3826        /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
3827        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3828            self.0.request.order_by = v.into();
3829            self
3830        }
3831
3832        /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
3833        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3834            self.0.request.show_deleted = v.into();
3835            self
3836        }
3837    }
3838
3839    #[doc(hidden)]
3840    impl crate::RequestBuilder for ListSingleTenantHsmInstanceProposals {
3841        fn request_options(&mut self) -> &mut crate::RequestOptions {
3842            &mut self.0.options
3843        }
3844    }
3845
3846    /// The request builder for [HsmManagement::delete_single_tenant_hsm_instance_proposal][crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal] calls.
3847    ///
3848    /// # Example
3849    /// ```
3850    /// # use google_cloud_kms_v1::builder::hsm_management::DeleteSingleTenantHsmInstanceProposal;
3851    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3852    ///
3853    /// let builder = prepare_request_builder();
3854    /// let response = builder.send().await?;
3855    /// # Ok(()) }
3856    ///
3857    /// fn prepare_request_builder() -> DeleteSingleTenantHsmInstanceProposal {
3858    ///   # panic!();
3859    ///   // ... details omitted ...
3860    /// }
3861    /// ```
3862    #[derive(Clone, Debug)]
3863    pub struct DeleteSingleTenantHsmInstanceProposal(
3864        RequestBuilder<crate::model::DeleteSingleTenantHsmInstanceProposalRequest>,
3865    );
3866
3867    impl DeleteSingleTenantHsmInstanceProposal {
3868        pub(crate) fn new(
3869            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3870        ) -> Self {
3871            Self(RequestBuilder::new(stub))
3872        }
3873
3874        /// Sets the full request, replacing any prior values.
3875        pub fn with_request<V: Into<crate::model::DeleteSingleTenantHsmInstanceProposalRequest>>(
3876            mut self,
3877            v: V,
3878        ) -> Self {
3879            self.0.request = v.into();
3880            self
3881        }
3882
3883        /// Sets all the options, replacing any prior values.
3884        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3885            self.0.options = v.into();
3886            self
3887        }
3888
3889        /// Sends the request.
3890        pub async fn send(self) -> Result<()> {
3891            (*self.0.stub)
3892                .delete_single_tenant_hsm_instance_proposal(self.0.request, self.0.options)
3893                .await
3894                .map(crate::Response::into_body)
3895        }
3896
3897        /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
3898        ///
3899        /// This is a **required** field for requests.
3900        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3901            self.0.request.name = v.into();
3902            self
3903        }
3904    }
3905
3906    #[doc(hidden)]
3907    impl crate::RequestBuilder for DeleteSingleTenantHsmInstanceProposal {
3908        fn request_options(&mut self) -> &mut crate::RequestOptions {
3909            &mut self.0.options
3910        }
3911    }
3912
3913    /// The request builder for [HsmManagement::list_locations][crate::client::HsmManagement::list_locations] calls.
3914    ///
3915    /// # Example
3916    /// ```
3917    /// # use google_cloud_kms_v1::builder::hsm_management::ListLocations;
3918    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
3919    /// use google_cloud_gax::paginator::ItemPaginator;
3920    ///
3921    /// let builder = prepare_request_builder();
3922    /// let mut items = builder.by_item();
3923    /// while let Some(result) = items.next().await {
3924    ///   let item = result?;
3925    /// }
3926    /// # Ok(()) }
3927    ///
3928    /// fn prepare_request_builder() -> ListLocations {
3929    ///   # panic!();
3930    ///   // ... details omitted ...
3931    /// }
3932    /// ```
3933    #[derive(Clone, Debug)]
3934    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
3935
3936    impl ListLocations {
3937        pub(crate) fn new(
3938            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
3939        ) -> Self {
3940            Self(RequestBuilder::new(stub))
3941        }
3942
3943        /// Sets the full request, replacing any prior values.
3944        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
3945            mut self,
3946            v: V,
3947        ) -> Self {
3948            self.0.request = v.into();
3949            self
3950        }
3951
3952        /// Sets all the options, replacing any prior values.
3953        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3954            self.0.options = v.into();
3955            self
3956        }
3957
3958        /// Sends the request.
3959        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
3960            (*self.0.stub)
3961                .list_locations(self.0.request, self.0.options)
3962                .await
3963                .map(crate::Response::into_body)
3964        }
3965
3966        /// Streams each page in the collection.
3967        pub fn by_page(
3968            self,
3969        ) -> impl google_cloud_gax::paginator::Paginator<
3970            google_cloud_location::model::ListLocationsResponse,
3971            crate::Error,
3972        > {
3973            use std::clone::Clone;
3974            let token = self.0.request.page_token.clone();
3975            let execute = move |token: String| {
3976                let mut builder = self.clone();
3977                builder.0.request = builder.0.request.set_page_token(token);
3978                builder.send()
3979            };
3980            google_cloud_gax::paginator::internal::new_paginator(token, execute)
3981        }
3982
3983        /// Streams each item in the collection.
3984        pub fn by_item(
3985            self,
3986        ) -> impl google_cloud_gax::paginator::ItemPaginator<
3987            google_cloud_location::model::ListLocationsResponse,
3988            crate::Error,
3989        > {
3990            use google_cloud_gax::paginator::Paginator;
3991            self.by_page().items()
3992        }
3993
3994        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
3995        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3996            self.0.request.name = v.into();
3997            self
3998        }
3999
4000        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
4001        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4002            self.0.request.filter = v.into();
4003            self
4004        }
4005
4006        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
4007        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4008            self.0.request.page_size = v.into();
4009            self
4010        }
4011
4012        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
4013        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4014            self.0.request.page_token = v.into();
4015            self
4016        }
4017    }
4018
4019    #[doc(hidden)]
4020    impl crate::RequestBuilder for ListLocations {
4021        fn request_options(&mut self) -> &mut crate::RequestOptions {
4022            &mut self.0.options
4023        }
4024    }
4025
4026    /// The request builder for [HsmManagement::get_location][crate::client::HsmManagement::get_location] calls.
4027    ///
4028    /// # Example
4029    /// ```
4030    /// # use google_cloud_kms_v1::builder::hsm_management::GetLocation;
4031    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4032    ///
4033    /// let builder = prepare_request_builder();
4034    /// let response = builder.send().await?;
4035    /// # Ok(()) }
4036    ///
4037    /// fn prepare_request_builder() -> GetLocation {
4038    ///   # panic!();
4039    ///   // ... details omitted ...
4040    /// }
4041    /// ```
4042    #[derive(Clone, Debug)]
4043    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
4044
4045    impl GetLocation {
4046        pub(crate) fn new(
4047            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
4048        ) -> Self {
4049            Self(RequestBuilder::new(stub))
4050        }
4051
4052        /// Sets the full request, replacing any prior values.
4053        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
4054            mut self,
4055            v: V,
4056        ) -> Self {
4057            self.0.request = v.into();
4058            self
4059        }
4060
4061        /// Sets all the options, replacing any prior values.
4062        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4063            self.0.options = v.into();
4064            self
4065        }
4066
4067        /// Sends the request.
4068        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
4069            (*self.0.stub)
4070                .get_location(self.0.request, self.0.options)
4071                .await
4072                .map(crate::Response::into_body)
4073        }
4074
4075        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
4076        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4077            self.0.request.name = v.into();
4078            self
4079        }
4080    }
4081
4082    #[doc(hidden)]
4083    impl crate::RequestBuilder for GetLocation {
4084        fn request_options(&mut self) -> &mut crate::RequestOptions {
4085            &mut self.0.options
4086        }
4087    }
4088
4089    /// The request builder for [HsmManagement::set_iam_policy][crate::client::HsmManagement::set_iam_policy] calls.
4090    ///
4091    /// # Example
4092    /// ```
4093    /// # use google_cloud_kms_v1::builder::hsm_management::SetIamPolicy;
4094    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4095    ///
4096    /// let builder = prepare_request_builder();
4097    /// let response = builder.send().await?;
4098    /// # Ok(()) }
4099    ///
4100    /// fn prepare_request_builder() -> SetIamPolicy {
4101    ///   # panic!();
4102    ///   // ... details omitted ...
4103    /// }
4104    /// ```
4105    #[derive(Clone, Debug)]
4106    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
4107
4108    impl SetIamPolicy {
4109        pub(crate) fn new(
4110            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
4111        ) -> Self {
4112            Self(RequestBuilder::new(stub))
4113        }
4114
4115        /// Sets the full request, replacing any prior values.
4116        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
4117            mut self,
4118            v: V,
4119        ) -> Self {
4120            self.0.request = v.into();
4121            self
4122        }
4123
4124        /// Sets all the options, replacing any prior values.
4125        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4126            self.0.options = v.into();
4127            self
4128        }
4129
4130        /// Sends the request.
4131        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4132            (*self.0.stub)
4133                .set_iam_policy(self.0.request, self.0.options)
4134                .await
4135                .map(crate::Response::into_body)
4136        }
4137
4138        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
4139        ///
4140        /// This is a **required** field for requests.
4141        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4142            self.0.request.resource = v.into();
4143            self
4144        }
4145
4146        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
4147        ///
4148        /// This is a **required** field for requests.
4149        pub fn set_policy<T>(mut self, v: T) -> Self
4150        where
4151            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4152        {
4153            self.0.request.policy = std::option::Option::Some(v.into());
4154            self
4155        }
4156
4157        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
4158        ///
4159        /// This is a **required** field for requests.
4160        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4161        where
4162            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4163        {
4164            self.0.request.policy = v.map(|x| x.into());
4165            self
4166        }
4167
4168        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
4169        pub fn set_update_mask<T>(mut self, v: T) -> Self
4170        where
4171            T: std::convert::Into<wkt::FieldMask>,
4172        {
4173            self.0.request.update_mask = std::option::Option::Some(v.into());
4174            self
4175        }
4176
4177        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
4178        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4179        where
4180            T: std::convert::Into<wkt::FieldMask>,
4181        {
4182            self.0.request.update_mask = v.map(|x| x.into());
4183            self
4184        }
4185    }
4186
4187    #[doc(hidden)]
4188    impl crate::RequestBuilder for SetIamPolicy {
4189        fn request_options(&mut self) -> &mut crate::RequestOptions {
4190            &mut self.0.options
4191        }
4192    }
4193
4194    /// The request builder for [HsmManagement::get_iam_policy][crate::client::HsmManagement::get_iam_policy] calls.
4195    ///
4196    /// # Example
4197    /// ```
4198    /// # use google_cloud_kms_v1::builder::hsm_management::GetIamPolicy;
4199    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4200    ///
4201    /// let builder = prepare_request_builder();
4202    /// let response = builder.send().await?;
4203    /// # Ok(()) }
4204    ///
4205    /// fn prepare_request_builder() -> GetIamPolicy {
4206    ///   # panic!();
4207    ///   // ... details omitted ...
4208    /// }
4209    /// ```
4210    #[derive(Clone, Debug)]
4211    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
4212
4213    impl GetIamPolicy {
4214        pub(crate) fn new(
4215            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
4216        ) -> Self {
4217            Self(RequestBuilder::new(stub))
4218        }
4219
4220        /// Sets the full request, replacing any prior values.
4221        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
4222            mut self,
4223            v: V,
4224        ) -> Self {
4225            self.0.request = v.into();
4226            self
4227        }
4228
4229        /// Sets all the options, replacing any prior values.
4230        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4231            self.0.options = v.into();
4232            self
4233        }
4234
4235        /// Sends the request.
4236        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4237            (*self.0.stub)
4238                .get_iam_policy(self.0.request, self.0.options)
4239                .await
4240                .map(crate::Response::into_body)
4241        }
4242
4243        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
4244        ///
4245        /// This is a **required** field for requests.
4246        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4247            self.0.request.resource = v.into();
4248            self
4249        }
4250
4251        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
4252        pub fn set_options<T>(mut self, v: T) -> Self
4253        where
4254            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4255        {
4256            self.0.request.options = std::option::Option::Some(v.into());
4257            self
4258        }
4259
4260        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
4261        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4262        where
4263            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4264        {
4265            self.0.request.options = v.map(|x| x.into());
4266            self
4267        }
4268    }
4269
4270    #[doc(hidden)]
4271    impl crate::RequestBuilder for GetIamPolicy {
4272        fn request_options(&mut self) -> &mut crate::RequestOptions {
4273            &mut self.0.options
4274        }
4275    }
4276
4277    /// The request builder for [HsmManagement::test_iam_permissions][crate::client::HsmManagement::test_iam_permissions] calls.
4278    ///
4279    /// # Example
4280    /// ```
4281    /// # use google_cloud_kms_v1::builder::hsm_management::TestIamPermissions;
4282    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4283    ///
4284    /// let builder = prepare_request_builder();
4285    /// let response = builder.send().await?;
4286    /// # Ok(()) }
4287    ///
4288    /// fn prepare_request_builder() -> TestIamPermissions {
4289    ///   # panic!();
4290    ///   // ... details omitted ...
4291    /// }
4292    /// ```
4293    #[derive(Clone, Debug)]
4294    pub struct TestIamPermissions(
4295        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
4296    );
4297
4298    impl TestIamPermissions {
4299        pub(crate) fn new(
4300            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
4301        ) -> Self {
4302            Self(RequestBuilder::new(stub))
4303        }
4304
4305        /// Sets the full request, replacing any prior values.
4306        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
4307            mut self,
4308            v: V,
4309        ) -> Self {
4310            self.0.request = v.into();
4311            self
4312        }
4313
4314        /// Sets all the options, replacing any prior values.
4315        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4316            self.0.options = v.into();
4317            self
4318        }
4319
4320        /// Sends the request.
4321        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
4322            (*self.0.stub)
4323                .test_iam_permissions(self.0.request, self.0.options)
4324                .await
4325                .map(crate::Response::into_body)
4326        }
4327
4328        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
4329        ///
4330        /// This is a **required** field for requests.
4331        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4332            self.0.request.resource = v.into();
4333            self
4334        }
4335
4336        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
4337        ///
4338        /// This is a **required** field for requests.
4339        pub fn set_permissions<T, V>(mut self, v: T) -> Self
4340        where
4341            T: std::iter::IntoIterator<Item = V>,
4342            V: std::convert::Into<std::string::String>,
4343        {
4344            use std::iter::Iterator;
4345            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4346            self
4347        }
4348    }
4349
4350    #[doc(hidden)]
4351    impl crate::RequestBuilder for TestIamPermissions {
4352        fn request_options(&mut self) -> &mut crate::RequestOptions {
4353            &mut self.0.options
4354        }
4355    }
4356
4357    /// The request builder for [HsmManagement::get_operation][crate::client::HsmManagement::get_operation] calls.
4358    ///
4359    /// # Example
4360    /// ```
4361    /// # use google_cloud_kms_v1::builder::hsm_management::GetOperation;
4362    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4363    ///
4364    /// let builder = prepare_request_builder();
4365    /// let response = builder.send().await?;
4366    /// # Ok(()) }
4367    ///
4368    /// fn prepare_request_builder() -> GetOperation {
4369    ///   # panic!();
4370    ///   // ... details omitted ...
4371    /// }
4372    /// ```
4373    #[derive(Clone, Debug)]
4374    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4375
4376    impl GetOperation {
4377        pub(crate) fn new(
4378            stub: std::sync::Arc<dyn super::super::stub::dynamic::HsmManagement>,
4379        ) -> Self {
4380            Self(RequestBuilder::new(stub))
4381        }
4382
4383        /// Sets the full request, replacing any prior values.
4384        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4385            mut self,
4386            v: V,
4387        ) -> Self {
4388            self.0.request = v.into();
4389            self
4390        }
4391
4392        /// Sets all the options, replacing any prior values.
4393        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4394            self.0.options = v.into();
4395            self
4396        }
4397
4398        /// Sends the request.
4399        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4400            (*self.0.stub)
4401                .get_operation(self.0.request, self.0.options)
4402                .await
4403                .map(crate::Response::into_body)
4404        }
4405
4406        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
4407        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4408            self.0.request.name = v.into();
4409            self
4410        }
4411    }
4412
4413    #[doc(hidden)]
4414    impl crate::RequestBuilder for GetOperation {
4415        fn request_options(&mut self) -> &mut crate::RequestOptions {
4416            &mut self.0.options
4417        }
4418    }
4419}
4420
4421/// Request and client builders for [KeyManagementService][crate::client::KeyManagementService].
4422pub mod key_management_service {
4423    use crate::Result;
4424
4425    /// A builder for [KeyManagementService][crate::client::KeyManagementService].
4426    ///
4427    /// ```
4428    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4429    /// # use google_cloud_kms_v1::*;
4430    /// # use builder::key_management_service::ClientBuilder;
4431    /// # use client::KeyManagementService;
4432    /// let builder : ClientBuilder = KeyManagementService::builder();
4433    /// let client = builder
4434    ///     .with_endpoint("https://cloudkms.googleapis.com")
4435    ///     .build().await?;
4436    /// # Ok(()) }
4437    /// ```
4438    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4439
4440    pub(crate) mod client {
4441        use super::super::super::client::KeyManagementService;
4442        pub struct Factory;
4443        impl crate::ClientFactory for Factory {
4444            type Client = KeyManagementService;
4445            type Credentials = gaxi::options::Credentials;
4446            async fn build(
4447                self,
4448                config: gaxi::options::ClientConfig,
4449            ) -> crate::ClientBuilderResult<Self::Client> {
4450                Self::Client::new(config).await
4451            }
4452        }
4453    }
4454
4455    /// Common implementation for [crate::client::KeyManagementService] request builders.
4456    #[derive(Clone, Debug)]
4457    pub(crate) struct RequestBuilder<R: std::default::Default> {
4458        stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4459        request: R,
4460        options: crate::RequestOptions,
4461    }
4462
4463    impl<R> RequestBuilder<R>
4464    where
4465        R: std::default::Default,
4466    {
4467        pub(crate) fn new(
4468            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4469        ) -> Self {
4470            Self {
4471                stub,
4472                request: R::default(),
4473                options: crate::RequestOptions::default(),
4474            }
4475        }
4476    }
4477
4478    /// The request builder for [KeyManagementService::list_key_rings][crate::client::KeyManagementService::list_key_rings] calls.
4479    ///
4480    /// # Example
4481    /// ```
4482    /// # use google_cloud_kms_v1::builder::key_management_service::ListKeyRings;
4483    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4484    /// use google_cloud_gax::paginator::ItemPaginator;
4485    ///
4486    /// let builder = prepare_request_builder();
4487    /// let mut items = builder.by_item();
4488    /// while let Some(result) = items.next().await {
4489    ///   let item = result?;
4490    /// }
4491    /// # Ok(()) }
4492    ///
4493    /// fn prepare_request_builder() -> ListKeyRings {
4494    ///   # panic!();
4495    ///   // ... details omitted ...
4496    /// }
4497    /// ```
4498    #[derive(Clone, Debug)]
4499    pub struct ListKeyRings(RequestBuilder<crate::model::ListKeyRingsRequest>);
4500
4501    impl ListKeyRings {
4502        pub(crate) fn new(
4503            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4504        ) -> Self {
4505            Self(RequestBuilder::new(stub))
4506        }
4507
4508        /// Sets the full request, replacing any prior values.
4509        pub fn with_request<V: Into<crate::model::ListKeyRingsRequest>>(mut self, v: V) -> Self {
4510            self.0.request = v.into();
4511            self
4512        }
4513
4514        /// Sets all the options, replacing any prior values.
4515        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4516            self.0.options = v.into();
4517            self
4518        }
4519
4520        /// Sends the request.
4521        pub async fn send(self) -> Result<crate::model::ListKeyRingsResponse> {
4522            (*self.0.stub)
4523                .list_key_rings(self.0.request, self.0.options)
4524                .await
4525                .map(crate::Response::into_body)
4526        }
4527
4528        /// Streams each page in the collection.
4529        pub fn by_page(
4530            self,
4531        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListKeyRingsResponse, crate::Error>
4532        {
4533            use std::clone::Clone;
4534            let token = self.0.request.page_token.clone();
4535            let execute = move |token: String| {
4536                let mut builder = self.clone();
4537                builder.0.request = builder.0.request.set_page_token(token);
4538                builder.send()
4539            };
4540            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4541        }
4542
4543        /// Streams each item in the collection.
4544        pub fn by_item(
4545            self,
4546        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4547            crate::model::ListKeyRingsResponse,
4548            crate::Error,
4549        > {
4550            use google_cloud_gax::paginator::Paginator;
4551            self.by_page().items()
4552        }
4553
4554        /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
4555        ///
4556        /// This is a **required** field for requests.
4557        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4558            self.0.request.parent = v.into();
4559            self
4560        }
4561
4562        /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
4563        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4564            self.0.request.page_size = v.into();
4565            self
4566        }
4567
4568        /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
4569        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4570            self.0.request.page_token = v.into();
4571            self
4572        }
4573
4574        /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
4575        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4576            self.0.request.filter = v.into();
4577            self
4578        }
4579
4580        /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
4581        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4582            self.0.request.order_by = v.into();
4583            self
4584        }
4585    }
4586
4587    #[doc(hidden)]
4588    impl crate::RequestBuilder for ListKeyRings {
4589        fn request_options(&mut self) -> &mut crate::RequestOptions {
4590            &mut self.0.options
4591        }
4592    }
4593
4594    /// The request builder for [KeyManagementService::list_crypto_keys][crate::client::KeyManagementService::list_crypto_keys] calls.
4595    ///
4596    /// # Example
4597    /// ```
4598    /// # use google_cloud_kms_v1::builder::key_management_service::ListCryptoKeys;
4599    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4600    /// use google_cloud_gax::paginator::ItemPaginator;
4601    ///
4602    /// let builder = prepare_request_builder();
4603    /// let mut items = builder.by_item();
4604    /// while let Some(result) = items.next().await {
4605    ///   let item = result?;
4606    /// }
4607    /// # Ok(()) }
4608    ///
4609    /// fn prepare_request_builder() -> ListCryptoKeys {
4610    ///   # panic!();
4611    ///   // ... details omitted ...
4612    /// }
4613    /// ```
4614    #[derive(Clone, Debug)]
4615    pub struct ListCryptoKeys(RequestBuilder<crate::model::ListCryptoKeysRequest>);
4616
4617    impl ListCryptoKeys {
4618        pub(crate) fn new(
4619            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4620        ) -> Self {
4621            Self(RequestBuilder::new(stub))
4622        }
4623
4624        /// Sets the full request, replacing any prior values.
4625        pub fn with_request<V: Into<crate::model::ListCryptoKeysRequest>>(mut self, v: V) -> Self {
4626            self.0.request = v.into();
4627            self
4628        }
4629
4630        /// Sets all the options, replacing any prior values.
4631        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4632            self.0.options = v.into();
4633            self
4634        }
4635
4636        /// Sends the request.
4637        pub async fn send(self) -> Result<crate::model::ListCryptoKeysResponse> {
4638            (*self.0.stub)
4639                .list_crypto_keys(self.0.request, self.0.options)
4640                .await
4641                .map(crate::Response::into_body)
4642        }
4643
4644        /// Streams each page in the collection.
4645        pub fn by_page(
4646            self,
4647        ) -> impl google_cloud_gax::paginator::Paginator<
4648            crate::model::ListCryptoKeysResponse,
4649            crate::Error,
4650        > {
4651            use std::clone::Clone;
4652            let token = self.0.request.page_token.clone();
4653            let execute = move |token: String| {
4654                let mut builder = self.clone();
4655                builder.0.request = builder.0.request.set_page_token(token);
4656                builder.send()
4657            };
4658            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4659        }
4660
4661        /// Streams each item in the collection.
4662        pub fn by_item(
4663            self,
4664        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4665            crate::model::ListCryptoKeysResponse,
4666            crate::Error,
4667        > {
4668            use google_cloud_gax::paginator::Paginator;
4669            self.by_page().items()
4670        }
4671
4672        /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
4673        ///
4674        /// This is a **required** field for requests.
4675        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4676            self.0.request.parent = v.into();
4677            self
4678        }
4679
4680        /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
4681        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4682            self.0.request.page_size = v.into();
4683            self
4684        }
4685
4686        /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
4687        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4688            self.0.request.page_token = v.into();
4689            self
4690        }
4691
4692        /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
4693        pub fn set_version_view<T: Into<crate::model::crypto_key_version::CryptoKeyVersionView>>(
4694            mut self,
4695            v: T,
4696        ) -> Self {
4697            self.0.request.version_view = v.into();
4698            self
4699        }
4700
4701        /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
4702        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4703            self.0.request.filter = v.into();
4704            self
4705        }
4706
4707        /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
4708        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4709            self.0.request.order_by = v.into();
4710            self
4711        }
4712    }
4713
4714    #[doc(hidden)]
4715    impl crate::RequestBuilder for ListCryptoKeys {
4716        fn request_options(&mut self) -> &mut crate::RequestOptions {
4717            &mut self.0.options
4718        }
4719    }
4720
4721    /// The request builder for [KeyManagementService::list_crypto_key_versions][crate::client::KeyManagementService::list_crypto_key_versions] calls.
4722    ///
4723    /// # Example
4724    /// ```
4725    /// # use google_cloud_kms_v1::builder::key_management_service::ListCryptoKeyVersions;
4726    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4727    /// use google_cloud_gax::paginator::ItemPaginator;
4728    ///
4729    /// let builder = prepare_request_builder();
4730    /// let mut items = builder.by_item();
4731    /// while let Some(result) = items.next().await {
4732    ///   let item = result?;
4733    /// }
4734    /// # Ok(()) }
4735    ///
4736    /// fn prepare_request_builder() -> ListCryptoKeyVersions {
4737    ///   # panic!();
4738    ///   // ... details omitted ...
4739    /// }
4740    /// ```
4741    #[derive(Clone, Debug)]
4742    pub struct ListCryptoKeyVersions(RequestBuilder<crate::model::ListCryptoKeyVersionsRequest>);
4743
4744    impl ListCryptoKeyVersions {
4745        pub(crate) fn new(
4746            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4747        ) -> Self {
4748            Self(RequestBuilder::new(stub))
4749        }
4750
4751        /// Sets the full request, replacing any prior values.
4752        pub fn with_request<V: Into<crate::model::ListCryptoKeyVersionsRequest>>(
4753            mut self,
4754            v: V,
4755        ) -> Self {
4756            self.0.request = v.into();
4757            self
4758        }
4759
4760        /// Sets all the options, replacing any prior values.
4761        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4762            self.0.options = v.into();
4763            self
4764        }
4765
4766        /// Sends the request.
4767        pub async fn send(self) -> Result<crate::model::ListCryptoKeyVersionsResponse> {
4768            (*self.0.stub)
4769                .list_crypto_key_versions(self.0.request, self.0.options)
4770                .await
4771                .map(crate::Response::into_body)
4772        }
4773
4774        /// Streams each page in the collection.
4775        pub fn by_page(
4776            self,
4777        ) -> impl google_cloud_gax::paginator::Paginator<
4778            crate::model::ListCryptoKeyVersionsResponse,
4779            crate::Error,
4780        > {
4781            use std::clone::Clone;
4782            let token = self.0.request.page_token.clone();
4783            let execute = move |token: String| {
4784                let mut builder = self.clone();
4785                builder.0.request = builder.0.request.set_page_token(token);
4786                builder.send()
4787            };
4788            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4789        }
4790
4791        /// Streams each item in the collection.
4792        pub fn by_item(
4793            self,
4794        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4795            crate::model::ListCryptoKeyVersionsResponse,
4796            crate::Error,
4797        > {
4798            use google_cloud_gax::paginator::Paginator;
4799            self.by_page().items()
4800        }
4801
4802        /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
4803        ///
4804        /// This is a **required** field for requests.
4805        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4806            self.0.request.parent = v.into();
4807            self
4808        }
4809
4810        /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
4811        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4812            self.0.request.page_size = v.into();
4813            self
4814        }
4815
4816        /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
4817        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4818            self.0.request.page_token = v.into();
4819            self
4820        }
4821
4822        /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
4823        pub fn set_view<T: Into<crate::model::crypto_key_version::CryptoKeyVersionView>>(
4824            mut self,
4825            v: T,
4826        ) -> Self {
4827            self.0.request.view = v.into();
4828            self
4829        }
4830
4831        /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
4832        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4833            self.0.request.filter = v.into();
4834            self
4835        }
4836
4837        /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
4838        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4839            self.0.request.order_by = v.into();
4840            self
4841        }
4842    }
4843
4844    #[doc(hidden)]
4845    impl crate::RequestBuilder for ListCryptoKeyVersions {
4846        fn request_options(&mut self) -> &mut crate::RequestOptions {
4847            &mut self.0.options
4848        }
4849    }
4850
4851    /// The request builder for [KeyManagementService::list_import_jobs][crate::client::KeyManagementService::list_import_jobs] calls.
4852    ///
4853    /// # Example
4854    /// ```
4855    /// # use google_cloud_kms_v1::builder::key_management_service::ListImportJobs;
4856    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4857    /// use google_cloud_gax::paginator::ItemPaginator;
4858    ///
4859    /// let builder = prepare_request_builder();
4860    /// let mut items = builder.by_item();
4861    /// while let Some(result) = items.next().await {
4862    ///   let item = result?;
4863    /// }
4864    /// # Ok(()) }
4865    ///
4866    /// fn prepare_request_builder() -> ListImportJobs {
4867    ///   # panic!();
4868    ///   // ... details omitted ...
4869    /// }
4870    /// ```
4871    #[derive(Clone, Debug)]
4872    pub struct ListImportJobs(RequestBuilder<crate::model::ListImportJobsRequest>);
4873
4874    impl ListImportJobs {
4875        pub(crate) fn new(
4876            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4877        ) -> Self {
4878            Self(RequestBuilder::new(stub))
4879        }
4880
4881        /// Sets the full request, replacing any prior values.
4882        pub fn with_request<V: Into<crate::model::ListImportJobsRequest>>(mut self, v: V) -> Self {
4883            self.0.request = v.into();
4884            self
4885        }
4886
4887        /// Sets all the options, replacing any prior values.
4888        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4889            self.0.options = v.into();
4890            self
4891        }
4892
4893        /// Sends the request.
4894        pub async fn send(self) -> Result<crate::model::ListImportJobsResponse> {
4895            (*self.0.stub)
4896                .list_import_jobs(self.0.request, self.0.options)
4897                .await
4898                .map(crate::Response::into_body)
4899        }
4900
4901        /// Streams each page in the collection.
4902        pub fn by_page(
4903            self,
4904        ) -> impl google_cloud_gax::paginator::Paginator<
4905            crate::model::ListImportJobsResponse,
4906            crate::Error,
4907        > {
4908            use std::clone::Clone;
4909            let token = self.0.request.page_token.clone();
4910            let execute = move |token: String| {
4911                let mut builder = self.clone();
4912                builder.0.request = builder.0.request.set_page_token(token);
4913                builder.send()
4914            };
4915            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4916        }
4917
4918        /// Streams each item in the collection.
4919        pub fn by_item(
4920            self,
4921        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4922            crate::model::ListImportJobsResponse,
4923            crate::Error,
4924        > {
4925            use google_cloud_gax::paginator::Paginator;
4926            self.by_page().items()
4927        }
4928
4929        /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
4930        ///
4931        /// This is a **required** field for requests.
4932        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4933            self.0.request.parent = v.into();
4934            self
4935        }
4936
4937        /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
4938        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4939            self.0.request.page_size = v.into();
4940            self
4941        }
4942
4943        /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
4944        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4945            self.0.request.page_token = v.into();
4946            self
4947        }
4948
4949        /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
4950        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4951            self.0.request.filter = v.into();
4952            self
4953        }
4954
4955        /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
4956        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4957            self.0.request.order_by = v.into();
4958            self
4959        }
4960    }
4961
4962    #[doc(hidden)]
4963    impl crate::RequestBuilder for ListImportJobs {
4964        fn request_options(&mut self) -> &mut crate::RequestOptions {
4965            &mut self.0.options
4966        }
4967    }
4968
4969    /// The request builder for [KeyManagementService::list_retired_resources][crate::client::KeyManagementService::list_retired_resources] calls.
4970    ///
4971    /// # Example
4972    /// ```
4973    /// # use google_cloud_kms_v1::builder::key_management_service::ListRetiredResources;
4974    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
4975    /// use google_cloud_gax::paginator::ItemPaginator;
4976    ///
4977    /// let builder = prepare_request_builder();
4978    /// let mut items = builder.by_item();
4979    /// while let Some(result) = items.next().await {
4980    ///   let item = result?;
4981    /// }
4982    /// # Ok(()) }
4983    ///
4984    /// fn prepare_request_builder() -> ListRetiredResources {
4985    ///   # panic!();
4986    ///   // ... details omitted ...
4987    /// }
4988    /// ```
4989    #[derive(Clone, Debug)]
4990    pub struct ListRetiredResources(RequestBuilder<crate::model::ListRetiredResourcesRequest>);
4991
4992    impl ListRetiredResources {
4993        pub(crate) fn new(
4994            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4995        ) -> Self {
4996            Self(RequestBuilder::new(stub))
4997        }
4998
4999        /// Sets the full request, replacing any prior values.
5000        pub fn with_request<V: Into<crate::model::ListRetiredResourcesRequest>>(
5001            mut self,
5002            v: V,
5003        ) -> Self {
5004            self.0.request = v.into();
5005            self
5006        }
5007
5008        /// Sets all the options, replacing any prior values.
5009        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5010            self.0.options = v.into();
5011            self
5012        }
5013
5014        /// Sends the request.
5015        pub async fn send(self) -> Result<crate::model::ListRetiredResourcesResponse> {
5016            (*self.0.stub)
5017                .list_retired_resources(self.0.request, self.0.options)
5018                .await
5019                .map(crate::Response::into_body)
5020        }
5021
5022        /// Streams each page in the collection.
5023        pub fn by_page(
5024            self,
5025        ) -> impl google_cloud_gax::paginator::Paginator<
5026            crate::model::ListRetiredResourcesResponse,
5027            crate::Error,
5028        > {
5029            use std::clone::Clone;
5030            let token = self.0.request.page_token.clone();
5031            let execute = move |token: String| {
5032                let mut builder = self.clone();
5033                builder.0.request = builder.0.request.set_page_token(token);
5034                builder.send()
5035            };
5036            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5037        }
5038
5039        /// Streams each item in the collection.
5040        pub fn by_item(
5041            self,
5042        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5043            crate::model::ListRetiredResourcesResponse,
5044            crate::Error,
5045        > {
5046            use google_cloud_gax::paginator::Paginator;
5047            self.by_page().items()
5048        }
5049
5050        /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
5051        ///
5052        /// This is a **required** field for requests.
5053        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5054            self.0.request.parent = v.into();
5055            self
5056        }
5057
5058        /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
5059        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5060            self.0.request.page_size = v.into();
5061            self
5062        }
5063
5064        /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
5065        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5066            self.0.request.page_token = v.into();
5067            self
5068        }
5069    }
5070
5071    #[doc(hidden)]
5072    impl crate::RequestBuilder for ListRetiredResources {
5073        fn request_options(&mut self) -> &mut crate::RequestOptions {
5074            &mut self.0.options
5075        }
5076    }
5077
5078    /// The request builder for [KeyManagementService::get_key_ring][crate::client::KeyManagementService::get_key_ring] calls.
5079    ///
5080    /// # Example
5081    /// ```
5082    /// # use google_cloud_kms_v1::builder::key_management_service::GetKeyRing;
5083    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5084    ///
5085    /// let builder = prepare_request_builder();
5086    /// let response = builder.send().await?;
5087    /// # Ok(()) }
5088    ///
5089    /// fn prepare_request_builder() -> GetKeyRing {
5090    ///   # panic!();
5091    ///   // ... details omitted ...
5092    /// }
5093    /// ```
5094    #[derive(Clone, Debug)]
5095    pub struct GetKeyRing(RequestBuilder<crate::model::GetKeyRingRequest>);
5096
5097    impl GetKeyRing {
5098        pub(crate) fn new(
5099            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5100        ) -> Self {
5101            Self(RequestBuilder::new(stub))
5102        }
5103
5104        /// Sets the full request, replacing any prior values.
5105        pub fn with_request<V: Into<crate::model::GetKeyRingRequest>>(mut self, v: V) -> Self {
5106            self.0.request = v.into();
5107            self
5108        }
5109
5110        /// Sets all the options, replacing any prior values.
5111        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5112            self.0.options = v.into();
5113            self
5114        }
5115
5116        /// Sends the request.
5117        pub async fn send(self) -> Result<crate::model::KeyRing> {
5118            (*self.0.stub)
5119                .get_key_ring(self.0.request, self.0.options)
5120                .await
5121                .map(crate::Response::into_body)
5122        }
5123
5124        /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
5125        ///
5126        /// This is a **required** field for requests.
5127        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5128            self.0.request.name = v.into();
5129            self
5130        }
5131    }
5132
5133    #[doc(hidden)]
5134    impl crate::RequestBuilder for GetKeyRing {
5135        fn request_options(&mut self) -> &mut crate::RequestOptions {
5136            &mut self.0.options
5137        }
5138    }
5139
5140    /// The request builder for [KeyManagementService::get_crypto_key][crate::client::KeyManagementService::get_crypto_key] calls.
5141    ///
5142    /// # Example
5143    /// ```
5144    /// # use google_cloud_kms_v1::builder::key_management_service::GetCryptoKey;
5145    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5146    ///
5147    /// let builder = prepare_request_builder();
5148    /// let response = builder.send().await?;
5149    /// # Ok(()) }
5150    ///
5151    /// fn prepare_request_builder() -> GetCryptoKey {
5152    ///   # panic!();
5153    ///   // ... details omitted ...
5154    /// }
5155    /// ```
5156    #[derive(Clone, Debug)]
5157    pub struct GetCryptoKey(RequestBuilder<crate::model::GetCryptoKeyRequest>);
5158
5159    impl GetCryptoKey {
5160        pub(crate) fn new(
5161            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5162        ) -> Self {
5163            Self(RequestBuilder::new(stub))
5164        }
5165
5166        /// Sets the full request, replacing any prior values.
5167        pub fn with_request<V: Into<crate::model::GetCryptoKeyRequest>>(mut self, v: V) -> Self {
5168            self.0.request = v.into();
5169            self
5170        }
5171
5172        /// Sets all the options, replacing any prior values.
5173        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5174            self.0.options = v.into();
5175            self
5176        }
5177
5178        /// Sends the request.
5179        pub async fn send(self) -> Result<crate::model::CryptoKey> {
5180            (*self.0.stub)
5181                .get_crypto_key(self.0.request, self.0.options)
5182                .await
5183                .map(crate::Response::into_body)
5184        }
5185
5186        /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
5187        ///
5188        /// This is a **required** field for requests.
5189        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5190            self.0.request.name = v.into();
5191            self
5192        }
5193    }
5194
5195    #[doc(hidden)]
5196    impl crate::RequestBuilder for GetCryptoKey {
5197        fn request_options(&mut self) -> &mut crate::RequestOptions {
5198            &mut self.0.options
5199        }
5200    }
5201
5202    /// The request builder for [KeyManagementService::get_crypto_key_version][crate::client::KeyManagementService::get_crypto_key_version] calls.
5203    ///
5204    /// # Example
5205    /// ```
5206    /// # use google_cloud_kms_v1::builder::key_management_service::GetCryptoKeyVersion;
5207    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5208    ///
5209    /// let builder = prepare_request_builder();
5210    /// let response = builder.send().await?;
5211    /// # Ok(()) }
5212    ///
5213    /// fn prepare_request_builder() -> GetCryptoKeyVersion {
5214    ///   # panic!();
5215    ///   // ... details omitted ...
5216    /// }
5217    /// ```
5218    #[derive(Clone, Debug)]
5219    pub struct GetCryptoKeyVersion(RequestBuilder<crate::model::GetCryptoKeyVersionRequest>);
5220
5221    impl GetCryptoKeyVersion {
5222        pub(crate) fn new(
5223            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5224        ) -> Self {
5225            Self(RequestBuilder::new(stub))
5226        }
5227
5228        /// Sets the full request, replacing any prior values.
5229        pub fn with_request<V: Into<crate::model::GetCryptoKeyVersionRequest>>(
5230            mut self,
5231            v: V,
5232        ) -> Self {
5233            self.0.request = v.into();
5234            self
5235        }
5236
5237        /// Sets all the options, replacing any prior values.
5238        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5239            self.0.options = v.into();
5240            self
5241        }
5242
5243        /// Sends the request.
5244        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
5245            (*self.0.stub)
5246                .get_crypto_key_version(self.0.request, self.0.options)
5247                .await
5248                .map(crate::Response::into_body)
5249        }
5250
5251        /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
5252        ///
5253        /// This is a **required** field for requests.
5254        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5255            self.0.request.name = v.into();
5256            self
5257        }
5258    }
5259
5260    #[doc(hidden)]
5261    impl crate::RequestBuilder for GetCryptoKeyVersion {
5262        fn request_options(&mut self) -> &mut crate::RequestOptions {
5263            &mut self.0.options
5264        }
5265    }
5266
5267    /// The request builder for [KeyManagementService::get_public_key][crate::client::KeyManagementService::get_public_key] calls.
5268    ///
5269    /// # Example
5270    /// ```
5271    /// # use google_cloud_kms_v1::builder::key_management_service::GetPublicKey;
5272    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5273    ///
5274    /// let builder = prepare_request_builder();
5275    /// let response = builder.send().await?;
5276    /// # Ok(()) }
5277    ///
5278    /// fn prepare_request_builder() -> GetPublicKey {
5279    ///   # panic!();
5280    ///   // ... details omitted ...
5281    /// }
5282    /// ```
5283    #[derive(Clone, Debug)]
5284    pub struct GetPublicKey(RequestBuilder<crate::model::GetPublicKeyRequest>);
5285
5286    impl GetPublicKey {
5287        pub(crate) fn new(
5288            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5289        ) -> Self {
5290            Self(RequestBuilder::new(stub))
5291        }
5292
5293        /// Sets the full request, replacing any prior values.
5294        pub fn with_request<V: Into<crate::model::GetPublicKeyRequest>>(mut self, v: V) -> Self {
5295            self.0.request = v.into();
5296            self
5297        }
5298
5299        /// Sets all the options, replacing any prior values.
5300        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5301            self.0.options = v.into();
5302            self
5303        }
5304
5305        /// Sends the request.
5306        pub async fn send(self) -> Result<crate::model::PublicKey> {
5307            (*self.0.stub)
5308                .get_public_key(self.0.request, self.0.options)
5309                .await
5310                .map(crate::Response::into_body)
5311        }
5312
5313        /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
5314        ///
5315        /// This is a **required** field for requests.
5316        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5317            self.0.request.name = v.into();
5318            self
5319        }
5320
5321        /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
5322        pub fn set_public_key_format<T: Into<crate::model::public_key::PublicKeyFormat>>(
5323            mut self,
5324            v: T,
5325        ) -> Self {
5326            self.0.request.public_key_format = v.into();
5327            self
5328        }
5329    }
5330
5331    #[doc(hidden)]
5332    impl crate::RequestBuilder for GetPublicKey {
5333        fn request_options(&mut self) -> &mut crate::RequestOptions {
5334            &mut self.0.options
5335        }
5336    }
5337
5338    /// The request builder for [KeyManagementService::get_import_job][crate::client::KeyManagementService::get_import_job] calls.
5339    ///
5340    /// # Example
5341    /// ```
5342    /// # use google_cloud_kms_v1::builder::key_management_service::GetImportJob;
5343    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5344    ///
5345    /// let builder = prepare_request_builder();
5346    /// let response = builder.send().await?;
5347    /// # Ok(()) }
5348    ///
5349    /// fn prepare_request_builder() -> GetImportJob {
5350    ///   # panic!();
5351    ///   // ... details omitted ...
5352    /// }
5353    /// ```
5354    #[derive(Clone, Debug)]
5355    pub struct GetImportJob(RequestBuilder<crate::model::GetImportJobRequest>);
5356
5357    impl GetImportJob {
5358        pub(crate) fn new(
5359            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5360        ) -> Self {
5361            Self(RequestBuilder::new(stub))
5362        }
5363
5364        /// Sets the full request, replacing any prior values.
5365        pub fn with_request<V: Into<crate::model::GetImportJobRequest>>(mut self, v: V) -> Self {
5366            self.0.request = v.into();
5367            self
5368        }
5369
5370        /// Sets all the options, replacing any prior values.
5371        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5372            self.0.options = v.into();
5373            self
5374        }
5375
5376        /// Sends the request.
5377        pub async fn send(self) -> Result<crate::model::ImportJob> {
5378            (*self.0.stub)
5379                .get_import_job(self.0.request, self.0.options)
5380                .await
5381                .map(crate::Response::into_body)
5382        }
5383
5384        /// Sets the value of [name][crate::model::GetImportJobRequest::name].
5385        ///
5386        /// This is a **required** field for requests.
5387        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5388            self.0.request.name = v.into();
5389            self
5390        }
5391
5392        /// Sets the value of [public_key_format][crate::model::GetImportJobRequest::public_key_format].
5393        pub fn set_public_key_format<T: Into<crate::model::public_key::PublicKeyFormat>>(
5394            mut self,
5395            v: T,
5396        ) -> Self {
5397            self.0.request.public_key_format = v.into();
5398            self
5399        }
5400    }
5401
5402    #[doc(hidden)]
5403    impl crate::RequestBuilder for GetImportJob {
5404        fn request_options(&mut self) -> &mut crate::RequestOptions {
5405            &mut self.0.options
5406        }
5407    }
5408
5409    /// The request builder for [KeyManagementService::get_retired_resource][crate::client::KeyManagementService::get_retired_resource] calls.
5410    ///
5411    /// # Example
5412    /// ```
5413    /// # use google_cloud_kms_v1::builder::key_management_service::GetRetiredResource;
5414    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5415    ///
5416    /// let builder = prepare_request_builder();
5417    /// let response = builder.send().await?;
5418    /// # Ok(()) }
5419    ///
5420    /// fn prepare_request_builder() -> GetRetiredResource {
5421    ///   # panic!();
5422    ///   // ... details omitted ...
5423    /// }
5424    /// ```
5425    #[derive(Clone, Debug)]
5426    pub struct GetRetiredResource(RequestBuilder<crate::model::GetRetiredResourceRequest>);
5427
5428    impl GetRetiredResource {
5429        pub(crate) fn new(
5430            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5431        ) -> Self {
5432            Self(RequestBuilder::new(stub))
5433        }
5434
5435        /// Sets the full request, replacing any prior values.
5436        pub fn with_request<V: Into<crate::model::GetRetiredResourceRequest>>(
5437            mut self,
5438            v: V,
5439        ) -> Self {
5440            self.0.request = v.into();
5441            self
5442        }
5443
5444        /// Sets all the options, replacing any prior values.
5445        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5446            self.0.options = v.into();
5447            self
5448        }
5449
5450        /// Sends the request.
5451        pub async fn send(self) -> Result<crate::model::RetiredResource> {
5452            (*self.0.stub)
5453                .get_retired_resource(self.0.request, self.0.options)
5454                .await
5455                .map(crate::Response::into_body)
5456        }
5457
5458        /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
5459        ///
5460        /// This is a **required** field for requests.
5461        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5462            self.0.request.name = v.into();
5463            self
5464        }
5465    }
5466
5467    #[doc(hidden)]
5468    impl crate::RequestBuilder for GetRetiredResource {
5469        fn request_options(&mut self) -> &mut crate::RequestOptions {
5470            &mut self.0.options
5471        }
5472    }
5473
5474    /// The request builder for [KeyManagementService::create_key_ring][crate::client::KeyManagementService::create_key_ring] calls.
5475    ///
5476    /// # Example
5477    /// ```
5478    /// # use google_cloud_kms_v1::builder::key_management_service::CreateKeyRing;
5479    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5480    ///
5481    /// let builder = prepare_request_builder();
5482    /// let response = builder.send().await?;
5483    /// # Ok(()) }
5484    ///
5485    /// fn prepare_request_builder() -> CreateKeyRing {
5486    ///   # panic!();
5487    ///   // ... details omitted ...
5488    /// }
5489    /// ```
5490    #[derive(Clone, Debug)]
5491    pub struct CreateKeyRing(RequestBuilder<crate::model::CreateKeyRingRequest>);
5492
5493    impl CreateKeyRing {
5494        pub(crate) fn new(
5495            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5496        ) -> Self {
5497            Self(RequestBuilder::new(stub))
5498        }
5499
5500        /// Sets the full request, replacing any prior values.
5501        pub fn with_request<V: Into<crate::model::CreateKeyRingRequest>>(mut self, v: V) -> Self {
5502            self.0.request = v.into();
5503            self
5504        }
5505
5506        /// Sets all the options, replacing any prior values.
5507        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5508            self.0.options = v.into();
5509            self
5510        }
5511
5512        /// Sends the request.
5513        pub async fn send(self) -> Result<crate::model::KeyRing> {
5514            (*self.0.stub)
5515                .create_key_ring(self.0.request, self.0.options)
5516                .await
5517                .map(crate::Response::into_body)
5518        }
5519
5520        /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
5521        ///
5522        /// This is a **required** field for requests.
5523        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5524            self.0.request.parent = v.into();
5525            self
5526        }
5527
5528        /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
5529        ///
5530        /// This is a **required** field for requests.
5531        pub fn set_key_ring_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5532            self.0.request.key_ring_id = v.into();
5533            self
5534        }
5535
5536        /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
5537        ///
5538        /// This is a **required** field for requests.
5539        pub fn set_key_ring<T>(mut self, v: T) -> Self
5540        where
5541            T: std::convert::Into<crate::model::KeyRing>,
5542        {
5543            self.0.request.key_ring = std::option::Option::Some(v.into());
5544            self
5545        }
5546
5547        /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
5548        ///
5549        /// This is a **required** field for requests.
5550        pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
5551        where
5552            T: std::convert::Into<crate::model::KeyRing>,
5553        {
5554            self.0.request.key_ring = v.map(|x| x.into());
5555            self
5556        }
5557    }
5558
5559    #[doc(hidden)]
5560    impl crate::RequestBuilder for CreateKeyRing {
5561        fn request_options(&mut self) -> &mut crate::RequestOptions {
5562            &mut self.0.options
5563        }
5564    }
5565
5566    /// The request builder for [KeyManagementService::create_crypto_key][crate::client::KeyManagementService::create_crypto_key] calls.
5567    ///
5568    /// # Example
5569    /// ```
5570    /// # use google_cloud_kms_v1::builder::key_management_service::CreateCryptoKey;
5571    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5572    ///
5573    /// let builder = prepare_request_builder();
5574    /// let response = builder.send().await?;
5575    /// # Ok(()) }
5576    ///
5577    /// fn prepare_request_builder() -> CreateCryptoKey {
5578    ///   # panic!();
5579    ///   // ... details omitted ...
5580    /// }
5581    /// ```
5582    #[derive(Clone, Debug)]
5583    pub struct CreateCryptoKey(RequestBuilder<crate::model::CreateCryptoKeyRequest>);
5584
5585    impl CreateCryptoKey {
5586        pub(crate) fn new(
5587            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5588        ) -> Self {
5589            Self(RequestBuilder::new(stub))
5590        }
5591
5592        /// Sets the full request, replacing any prior values.
5593        pub fn with_request<V: Into<crate::model::CreateCryptoKeyRequest>>(mut self, v: V) -> Self {
5594            self.0.request = v.into();
5595            self
5596        }
5597
5598        /// Sets all the options, replacing any prior values.
5599        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5600            self.0.options = v.into();
5601            self
5602        }
5603
5604        /// Sends the request.
5605        pub async fn send(self) -> Result<crate::model::CryptoKey> {
5606            (*self.0.stub)
5607                .create_crypto_key(self.0.request, self.0.options)
5608                .await
5609                .map(crate::Response::into_body)
5610        }
5611
5612        /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
5613        ///
5614        /// This is a **required** field for requests.
5615        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5616            self.0.request.parent = v.into();
5617            self
5618        }
5619
5620        /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
5621        ///
5622        /// This is a **required** field for requests.
5623        pub fn set_crypto_key_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5624            self.0.request.crypto_key_id = v.into();
5625            self
5626        }
5627
5628        /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
5629        ///
5630        /// This is a **required** field for requests.
5631        pub fn set_crypto_key<T>(mut self, v: T) -> Self
5632        where
5633            T: std::convert::Into<crate::model::CryptoKey>,
5634        {
5635            self.0.request.crypto_key = std::option::Option::Some(v.into());
5636            self
5637        }
5638
5639        /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
5640        ///
5641        /// This is a **required** field for requests.
5642        pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
5643        where
5644            T: std::convert::Into<crate::model::CryptoKey>,
5645        {
5646            self.0.request.crypto_key = v.map(|x| x.into());
5647            self
5648        }
5649
5650        /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
5651        pub fn set_skip_initial_version_creation<T: Into<bool>>(mut self, v: T) -> Self {
5652            self.0.request.skip_initial_version_creation = v.into();
5653            self
5654        }
5655
5656        /// Sets the value of [trusted_wrapping_enabled][crate::model::CreateCryptoKeyRequest::trusted_wrapping_enabled].
5657        pub fn set_trusted_wrapping_enabled<T: Into<bool>>(mut self, v: T) -> Self {
5658            self.0.request.trusted_wrapping_enabled = v.into();
5659            self
5660        }
5661    }
5662
5663    #[doc(hidden)]
5664    impl crate::RequestBuilder for CreateCryptoKey {
5665        fn request_options(&mut self) -> &mut crate::RequestOptions {
5666            &mut self.0.options
5667        }
5668    }
5669
5670    /// The request builder for [KeyManagementService::create_crypto_key_version][crate::client::KeyManagementService::create_crypto_key_version] calls.
5671    ///
5672    /// # Example
5673    /// ```
5674    /// # use google_cloud_kms_v1::builder::key_management_service::CreateCryptoKeyVersion;
5675    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5676    ///
5677    /// let builder = prepare_request_builder();
5678    /// let response = builder.send().await?;
5679    /// # Ok(()) }
5680    ///
5681    /// fn prepare_request_builder() -> CreateCryptoKeyVersion {
5682    ///   # panic!();
5683    ///   // ... details omitted ...
5684    /// }
5685    /// ```
5686    #[derive(Clone, Debug)]
5687    pub struct CreateCryptoKeyVersion(RequestBuilder<crate::model::CreateCryptoKeyVersionRequest>);
5688
5689    impl CreateCryptoKeyVersion {
5690        pub(crate) fn new(
5691            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5692        ) -> Self {
5693            Self(RequestBuilder::new(stub))
5694        }
5695
5696        /// Sets the full request, replacing any prior values.
5697        pub fn with_request<V: Into<crate::model::CreateCryptoKeyVersionRequest>>(
5698            mut self,
5699            v: V,
5700        ) -> Self {
5701            self.0.request = v.into();
5702            self
5703        }
5704
5705        /// Sets all the options, replacing any prior values.
5706        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5707            self.0.options = v.into();
5708            self
5709        }
5710
5711        /// Sends the request.
5712        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
5713            (*self.0.stub)
5714                .create_crypto_key_version(self.0.request, self.0.options)
5715                .await
5716                .map(crate::Response::into_body)
5717        }
5718
5719        /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
5720        ///
5721        /// This is a **required** field for requests.
5722        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5723            self.0.request.parent = v.into();
5724            self
5725        }
5726
5727        /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
5728        ///
5729        /// This is a **required** field for requests.
5730        pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
5731        where
5732            T: std::convert::Into<crate::model::CryptoKeyVersion>,
5733        {
5734            self.0.request.crypto_key_version = std::option::Option::Some(v.into());
5735            self
5736        }
5737
5738        /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
5739        ///
5740        /// This is a **required** field for requests.
5741        pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
5742        where
5743            T: std::convert::Into<crate::model::CryptoKeyVersion>,
5744        {
5745            self.0.request.crypto_key_version = v.map(|x| x.into());
5746            self
5747        }
5748    }
5749
5750    #[doc(hidden)]
5751    impl crate::RequestBuilder for CreateCryptoKeyVersion {
5752        fn request_options(&mut self) -> &mut crate::RequestOptions {
5753            &mut self.0.options
5754        }
5755    }
5756
5757    /// The request builder for [KeyManagementService::delete_crypto_key][crate::client::KeyManagementService::delete_crypto_key] calls.
5758    ///
5759    /// # Example
5760    /// ```
5761    /// # use google_cloud_kms_v1::builder::key_management_service::DeleteCryptoKey;
5762    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5763    /// use google_cloud_lro::Poller;
5764    ///
5765    /// let builder = prepare_request_builder();
5766    /// let response = builder.poller().until_done().await?;
5767    /// # Ok(()) }
5768    ///
5769    /// fn prepare_request_builder() -> DeleteCryptoKey {
5770    ///   # panic!();
5771    ///   // ... details omitted ...
5772    /// }
5773    /// ```
5774    #[derive(Clone, Debug)]
5775    pub struct DeleteCryptoKey(RequestBuilder<crate::model::DeleteCryptoKeyRequest>);
5776
5777    impl DeleteCryptoKey {
5778        pub(crate) fn new(
5779            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5780        ) -> Self {
5781            Self(RequestBuilder::new(stub))
5782        }
5783
5784        /// Sets the full request, replacing any prior values.
5785        pub fn with_request<V: Into<crate::model::DeleteCryptoKeyRequest>>(mut self, v: V) -> Self {
5786            self.0.request = v.into();
5787            self
5788        }
5789
5790        /// Sets all the options, replacing any prior values.
5791        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5792            self.0.options = v.into();
5793            self
5794        }
5795
5796        /// Sends the request.
5797        ///
5798        /// # Long running operations
5799        ///
5800        /// This starts, but does not poll, a longrunning operation. More information
5801        /// on [delete_crypto_key][crate::client::KeyManagementService::delete_crypto_key].
5802        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5803            (*self.0.stub)
5804                .delete_crypto_key(self.0.request, self.0.options)
5805                .await
5806                .map(crate::Response::into_body)
5807        }
5808
5809        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_crypto_key`.
5810        pub fn poller(
5811            self,
5812        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCryptoKeyMetadata> {
5813            type Operation = google_cloud_lro::internal::Operation<
5814                wkt::Empty,
5815                crate::model::DeleteCryptoKeyMetadata,
5816            >;
5817            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5818            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5819            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5820            if let Some(ref mut details) = poller_options.tracing {
5821                details.method_name = "google_cloud_kms_v1::client::KeyManagementService::delete_crypto_key::until_done";
5822            }
5823
5824            let stub = self.0.stub.clone();
5825            let mut options = self.0.options.clone();
5826            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5827            let query = move |name| {
5828                let stub = stub.clone();
5829                let options = options.clone();
5830                async {
5831                    let op = GetOperation::new(stub)
5832                        .set_name(name)
5833                        .with_options(options)
5834                        .send()
5835                        .await?;
5836                    Ok(Operation::new(op))
5837                }
5838            };
5839
5840            let start = move || async {
5841                let op = self.send().await?;
5842                Ok(Operation::new(op))
5843            };
5844
5845            use google_cloud_lro::internal::PollerExt;
5846            {
5847                google_cloud_lro::internal::new_unit_response_poller(
5848                    polling_error_policy,
5849                    polling_backoff_policy,
5850                    start,
5851                    query,
5852                )
5853            }
5854            .with_options(poller_options)
5855        }
5856
5857        /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
5858        ///
5859        /// This is a **required** field for requests.
5860        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5861            self.0.request.name = v.into();
5862            self
5863        }
5864    }
5865
5866    #[doc(hidden)]
5867    impl crate::RequestBuilder for DeleteCryptoKey {
5868        fn request_options(&mut self) -> &mut crate::RequestOptions {
5869            &mut self.0.options
5870        }
5871    }
5872
5873    /// The request builder for [KeyManagementService::delete_crypto_key_version][crate::client::KeyManagementService::delete_crypto_key_version] calls.
5874    ///
5875    /// # Example
5876    /// ```
5877    /// # use google_cloud_kms_v1::builder::key_management_service::DeleteCryptoKeyVersion;
5878    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5879    /// use google_cloud_lro::Poller;
5880    ///
5881    /// let builder = prepare_request_builder();
5882    /// let response = builder.poller().until_done().await?;
5883    /// # Ok(()) }
5884    ///
5885    /// fn prepare_request_builder() -> DeleteCryptoKeyVersion {
5886    ///   # panic!();
5887    ///   // ... details omitted ...
5888    /// }
5889    /// ```
5890    #[derive(Clone, Debug)]
5891    pub struct DeleteCryptoKeyVersion(RequestBuilder<crate::model::DeleteCryptoKeyVersionRequest>);
5892
5893    impl DeleteCryptoKeyVersion {
5894        pub(crate) fn new(
5895            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5896        ) -> Self {
5897            Self(RequestBuilder::new(stub))
5898        }
5899
5900        /// Sets the full request, replacing any prior values.
5901        pub fn with_request<V: Into<crate::model::DeleteCryptoKeyVersionRequest>>(
5902            mut self,
5903            v: V,
5904        ) -> Self {
5905            self.0.request = v.into();
5906            self
5907        }
5908
5909        /// Sets all the options, replacing any prior values.
5910        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5911            self.0.options = v.into();
5912            self
5913        }
5914
5915        /// Sends the request.
5916        ///
5917        /// # Long running operations
5918        ///
5919        /// This starts, but does not poll, a longrunning operation. More information
5920        /// on [delete_crypto_key_version][crate::client::KeyManagementService::delete_crypto_key_version].
5921        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5922            (*self.0.stub)
5923                .delete_crypto_key_version(self.0.request, self.0.options)
5924                .await
5925                .map(crate::Response::into_body)
5926        }
5927
5928        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_crypto_key_version`.
5929        pub fn poller(
5930            self,
5931        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCryptoKeyVersionMetadata>
5932        {
5933            type Operation = google_cloud_lro::internal::Operation<
5934                wkt::Empty,
5935                crate::model::DeleteCryptoKeyVersionMetadata,
5936            >;
5937            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5938            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5939            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5940            if let Some(ref mut details) = poller_options.tracing {
5941                details.method_name = "google_cloud_kms_v1::client::KeyManagementService::delete_crypto_key_version::until_done";
5942            }
5943
5944            let stub = self.0.stub.clone();
5945            let mut options = self.0.options.clone();
5946            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5947            let query = move |name| {
5948                let stub = stub.clone();
5949                let options = options.clone();
5950                async {
5951                    let op = GetOperation::new(stub)
5952                        .set_name(name)
5953                        .with_options(options)
5954                        .send()
5955                        .await?;
5956                    Ok(Operation::new(op))
5957                }
5958            };
5959
5960            let start = move || async {
5961                let op = self.send().await?;
5962                Ok(Operation::new(op))
5963            };
5964
5965            use google_cloud_lro::internal::PollerExt;
5966            {
5967                google_cloud_lro::internal::new_unit_response_poller(
5968                    polling_error_policy,
5969                    polling_backoff_policy,
5970                    start,
5971                    query,
5972                )
5973            }
5974            .with_options(poller_options)
5975        }
5976
5977        /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
5978        ///
5979        /// This is a **required** field for requests.
5980        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5981            self.0.request.name = v.into();
5982            self
5983        }
5984    }
5985
5986    #[doc(hidden)]
5987    impl crate::RequestBuilder for DeleteCryptoKeyVersion {
5988        fn request_options(&mut self) -> &mut crate::RequestOptions {
5989            &mut self.0.options
5990        }
5991    }
5992
5993    /// The request builder for [KeyManagementService::import_crypto_key_version][crate::client::KeyManagementService::import_crypto_key_version] calls.
5994    ///
5995    /// # Example
5996    /// ```
5997    /// # use google_cloud_kms_v1::builder::key_management_service::ImportCryptoKeyVersion;
5998    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5999    ///
6000    /// let builder = prepare_request_builder();
6001    /// let response = builder.send().await?;
6002    /// # Ok(()) }
6003    ///
6004    /// fn prepare_request_builder() -> ImportCryptoKeyVersion {
6005    ///   # panic!();
6006    ///   // ... details omitted ...
6007    /// }
6008    /// ```
6009    #[derive(Clone, Debug)]
6010    pub struct ImportCryptoKeyVersion(RequestBuilder<crate::model::ImportCryptoKeyVersionRequest>);
6011
6012    impl ImportCryptoKeyVersion {
6013        pub(crate) fn new(
6014            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6015        ) -> Self {
6016            Self(RequestBuilder::new(stub))
6017        }
6018
6019        /// Sets the full request, replacing any prior values.
6020        pub fn with_request<V: Into<crate::model::ImportCryptoKeyVersionRequest>>(
6021            mut self,
6022            v: V,
6023        ) -> Self {
6024            self.0.request = v.into();
6025            self
6026        }
6027
6028        /// Sets all the options, replacing any prior values.
6029        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6030            self.0.options = v.into();
6031            self
6032        }
6033
6034        /// Sends the request.
6035        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6036            (*self.0.stub)
6037                .import_crypto_key_version(self.0.request, self.0.options)
6038                .await
6039                .map(crate::Response::into_body)
6040        }
6041
6042        /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
6043        ///
6044        /// This is a **required** field for requests.
6045        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6046            self.0.request.parent = v.into();
6047            self
6048        }
6049
6050        /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
6051        pub fn set_crypto_key_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
6052            self.0.request.crypto_key_version = v.into();
6053            self
6054        }
6055
6056        /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
6057        ///
6058        /// This is a **required** field for requests.
6059        pub fn set_algorithm<
6060            T: Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
6061        >(
6062            mut self,
6063            v: T,
6064        ) -> Self {
6065            self.0.request.algorithm = v.into();
6066            self
6067        }
6068
6069        /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
6070        ///
6071        /// This is a **required** field for requests.
6072        pub fn set_import_job<T: Into<std::string::String>>(mut self, v: T) -> Self {
6073            self.0.request.import_job = v.into();
6074            self
6075        }
6076
6077        /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
6078        pub fn set_wrapped_key<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6079            self.0.request.wrapped_key = v.into();
6080            self
6081        }
6082
6083        /// Sets the value of [trusted_wrapping_enabled][crate::model::ImportCryptoKeyVersionRequest::trusted_wrapping_enabled].
6084        pub fn set_trusted_wrapping_enabled<T: Into<bool>>(mut self, v: T) -> Self {
6085            self.0.request.trusted_wrapping_enabled = v.into();
6086            self
6087        }
6088
6089        /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
6090        ///
6091        /// Note that all the setters affecting `wrapped_key_material` are
6092        /// mutually exclusive.
6093        pub fn set_wrapped_key_material<
6094            T: Into<Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>>,
6095        >(
6096            mut self,
6097            v: T,
6098        ) -> Self {
6099            self.0.request.wrapped_key_material = v.into();
6100            self
6101        }
6102
6103        /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
6104        /// to hold a `RsaAesWrappedKey`.
6105        ///
6106        /// Note that all the setters affecting `wrapped_key_material` are
6107        /// mutually exclusive.
6108        pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(
6109            mut self,
6110            v: T,
6111        ) -> Self {
6112            self.0.request = self.0.request.set_rsa_aes_wrapped_key(v);
6113            self
6114        }
6115    }
6116
6117    #[doc(hidden)]
6118    impl crate::RequestBuilder for ImportCryptoKeyVersion {
6119        fn request_options(&mut self) -> &mut crate::RequestOptions {
6120            &mut self.0.options
6121        }
6122    }
6123
6124    /// The request builder for [KeyManagementService::import_trusted_key_wrapped_crypto_key_version][crate::client::KeyManagementService::import_trusted_key_wrapped_crypto_key_version] calls.
6125    ///
6126    /// # Example
6127    /// ```
6128    /// # use google_cloud_kms_v1::builder::key_management_service::ImportTrustedKeyWrappedCryptoKeyVersion;
6129    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6130    ///
6131    /// let builder = prepare_request_builder();
6132    /// let response = builder.send().await?;
6133    /// # Ok(()) }
6134    ///
6135    /// fn prepare_request_builder() -> ImportTrustedKeyWrappedCryptoKeyVersion {
6136    ///   # panic!();
6137    ///   // ... details omitted ...
6138    /// }
6139    /// ```
6140    #[derive(Clone, Debug)]
6141    pub struct ImportTrustedKeyWrappedCryptoKeyVersion(
6142        RequestBuilder<crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest>,
6143    );
6144
6145    impl ImportTrustedKeyWrappedCryptoKeyVersion {
6146        pub(crate) fn new(
6147            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6148        ) -> Self {
6149            Self(RequestBuilder::new(stub))
6150        }
6151
6152        /// Sets the full request, replacing any prior values.
6153        pub fn with_request<
6154            V: Into<crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest>,
6155        >(
6156            mut self,
6157            v: V,
6158        ) -> Self {
6159            self.0.request = v.into();
6160            self
6161        }
6162
6163        /// Sets all the options, replacing any prior values.
6164        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6165            self.0.options = v.into();
6166            self
6167        }
6168
6169        /// Sends the request.
6170        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6171            (*self.0.stub)
6172                .import_trusted_key_wrapped_crypto_key_version(self.0.request, self.0.options)
6173                .await
6174                .map(crate::Response::into_body)
6175        }
6176
6177        /// Sets the value of [parent][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::parent].
6178        ///
6179        /// This is a **required** field for requests.
6180        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6181            self.0.request.parent = v.into();
6182            self
6183        }
6184
6185        /// Sets the value of [importing_key][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::importing_key].
6186        ///
6187        /// This is a **required** field for requests.
6188        pub fn set_importing_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
6189            self.0.request.importing_key = v.into();
6190            self
6191        }
6192
6193        /// Sets the value of [crypto_key_version][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::crypto_key_version].
6194        pub fn set_crypto_key_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
6195            self.0.request.crypto_key_version = v.into();
6196            self
6197        }
6198
6199        /// Sets the value of [wrapped_key][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::wrapped_key].
6200        ///
6201        /// This is a **required** field for requests.
6202        pub fn set_wrapped_key<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6203            self.0.request.wrapped_key = v.into();
6204            self
6205        }
6206
6207        /// Sets the value of [algorithm][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::algorithm].
6208        ///
6209        /// This is a **required** field for requests.
6210        pub fn set_algorithm<
6211            T: Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
6212        >(
6213            mut self,
6214            v: T,
6215        ) -> Self {
6216            self.0.request.algorithm = v.into();
6217            self
6218        }
6219    }
6220
6221    #[doc(hidden)]
6222    impl crate::RequestBuilder for ImportTrustedKeyWrappedCryptoKeyVersion {
6223        fn request_options(&mut self) -> &mut crate::RequestOptions {
6224            &mut self.0.options
6225        }
6226    }
6227
6228    /// The request builder for [KeyManagementService::export_trusted_key_wrapped_crypto_key_version][crate::client::KeyManagementService::export_trusted_key_wrapped_crypto_key_version] calls.
6229    ///
6230    /// # Example
6231    /// ```
6232    /// # use google_cloud_kms_v1::builder::key_management_service::ExportTrustedKeyWrappedCryptoKeyVersion;
6233    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6234    ///
6235    /// let builder = prepare_request_builder();
6236    /// let response = builder.send().await?;
6237    /// # Ok(()) }
6238    ///
6239    /// fn prepare_request_builder() -> ExportTrustedKeyWrappedCryptoKeyVersion {
6240    ///   # panic!();
6241    ///   // ... details omitted ...
6242    /// }
6243    /// ```
6244    #[derive(Clone, Debug)]
6245    pub struct ExportTrustedKeyWrappedCryptoKeyVersion(
6246        RequestBuilder<crate::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest>,
6247    );
6248
6249    impl ExportTrustedKeyWrappedCryptoKeyVersion {
6250        pub(crate) fn new(
6251            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6252        ) -> Self {
6253            Self(RequestBuilder::new(stub))
6254        }
6255
6256        /// Sets the full request, replacing any prior values.
6257        pub fn with_request<
6258            V: Into<crate::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest>,
6259        >(
6260            mut self,
6261            v: V,
6262        ) -> Self {
6263            self.0.request = v.into();
6264            self
6265        }
6266
6267        /// Sets all the options, replacing any prior values.
6268        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6269            self.0.options = v.into();
6270            self
6271        }
6272
6273        /// Sends the request.
6274        pub async fn send(
6275            self,
6276        ) -> Result<crate::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse> {
6277            (*self.0.stub)
6278                .export_trusted_key_wrapped_crypto_key_version(self.0.request, self.0.options)
6279                .await
6280                .map(crate::Response::into_body)
6281        }
6282
6283        /// Sets the value of [name][crate::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest::name].
6284        ///
6285        /// This is a **required** field for requests.
6286        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6287            self.0.request.name = v.into();
6288            self
6289        }
6290
6291        /// Sets the value of [wrapping_key][crate::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest::wrapping_key].
6292        ///
6293        /// This is a **required** field for requests.
6294        pub fn set_wrapping_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
6295            self.0.request.wrapping_key = v.into();
6296            self
6297        }
6298    }
6299
6300    #[doc(hidden)]
6301    impl crate::RequestBuilder for ExportTrustedKeyWrappedCryptoKeyVersion {
6302        fn request_options(&mut self) -> &mut crate::RequestOptions {
6303            &mut self.0.options
6304        }
6305    }
6306
6307    /// The request builder for [KeyManagementService::create_import_job][crate::client::KeyManagementService::create_import_job] calls.
6308    ///
6309    /// # Example
6310    /// ```
6311    /// # use google_cloud_kms_v1::builder::key_management_service::CreateImportJob;
6312    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6313    ///
6314    /// let builder = prepare_request_builder();
6315    /// let response = builder.send().await?;
6316    /// # Ok(()) }
6317    ///
6318    /// fn prepare_request_builder() -> CreateImportJob {
6319    ///   # panic!();
6320    ///   // ... details omitted ...
6321    /// }
6322    /// ```
6323    #[derive(Clone, Debug)]
6324    pub struct CreateImportJob(RequestBuilder<crate::model::CreateImportJobRequest>);
6325
6326    impl CreateImportJob {
6327        pub(crate) fn new(
6328            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6329        ) -> Self {
6330            Self(RequestBuilder::new(stub))
6331        }
6332
6333        /// Sets the full request, replacing any prior values.
6334        pub fn with_request<V: Into<crate::model::CreateImportJobRequest>>(mut self, v: V) -> Self {
6335            self.0.request = v.into();
6336            self
6337        }
6338
6339        /// Sets all the options, replacing any prior values.
6340        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6341            self.0.options = v.into();
6342            self
6343        }
6344
6345        /// Sends the request.
6346        pub async fn send(self) -> Result<crate::model::ImportJob> {
6347            (*self.0.stub)
6348                .create_import_job(self.0.request, self.0.options)
6349                .await
6350                .map(crate::Response::into_body)
6351        }
6352
6353        /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
6354        ///
6355        /// This is a **required** field for requests.
6356        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6357            self.0.request.parent = v.into();
6358            self
6359        }
6360
6361        /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
6362        ///
6363        /// This is a **required** field for requests.
6364        pub fn set_import_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6365            self.0.request.import_job_id = v.into();
6366            self
6367        }
6368
6369        /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
6370        ///
6371        /// This is a **required** field for requests.
6372        pub fn set_import_job<T>(mut self, v: T) -> Self
6373        where
6374            T: std::convert::Into<crate::model::ImportJob>,
6375        {
6376            self.0.request.import_job = std::option::Option::Some(v.into());
6377            self
6378        }
6379
6380        /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
6381        ///
6382        /// This is a **required** field for requests.
6383        pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
6384        where
6385            T: std::convert::Into<crate::model::ImportJob>,
6386        {
6387            self.0.request.import_job = v.map(|x| x.into());
6388            self
6389        }
6390    }
6391
6392    #[doc(hidden)]
6393    impl crate::RequestBuilder for CreateImportJob {
6394        fn request_options(&mut self) -> &mut crate::RequestOptions {
6395            &mut self.0.options
6396        }
6397    }
6398
6399    /// The request builder for [KeyManagementService::update_crypto_key][crate::client::KeyManagementService::update_crypto_key] calls.
6400    ///
6401    /// # Example
6402    /// ```
6403    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKey;
6404    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6405    ///
6406    /// let builder = prepare_request_builder();
6407    /// let response = builder.send().await?;
6408    /// # Ok(()) }
6409    ///
6410    /// fn prepare_request_builder() -> UpdateCryptoKey {
6411    ///   # panic!();
6412    ///   // ... details omitted ...
6413    /// }
6414    /// ```
6415    #[derive(Clone, Debug)]
6416    pub struct UpdateCryptoKey(RequestBuilder<crate::model::UpdateCryptoKeyRequest>);
6417
6418    impl UpdateCryptoKey {
6419        pub(crate) fn new(
6420            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6421        ) -> Self {
6422            Self(RequestBuilder::new(stub))
6423        }
6424
6425        /// Sets the full request, replacing any prior values.
6426        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyRequest>>(mut self, v: V) -> Self {
6427            self.0.request = v.into();
6428            self
6429        }
6430
6431        /// Sets all the options, replacing any prior values.
6432        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6433            self.0.options = v.into();
6434            self
6435        }
6436
6437        /// Sends the request.
6438        pub async fn send(self) -> Result<crate::model::CryptoKey> {
6439            (*self.0.stub)
6440                .update_crypto_key(self.0.request, self.0.options)
6441                .await
6442                .map(crate::Response::into_body)
6443        }
6444
6445        /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
6446        ///
6447        /// This is a **required** field for requests.
6448        pub fn set_crypto_key<T>(mut self, v: T) -> Self
6449        where
6450            T: std::convert::Into<crate::model::CryptoKey>,
6451        {
6452            self.0.request.crypto_key = std::option::Option::Some(v.into());
6453            self
6454        }
6455
6456        /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
6457        ///
6458        /// This is a **required** field for requests.
6459        pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
6460        where
6461            T: std::convert::Into<crate::model::CryptoKey>,
6462        {
6463            self.0.request.crypto_key = v.map(|x| x.into());
6464            self
6465        }
6466
6467        /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
6468        ///
6469        /// This is a **required** field for requests.
6470        pub fn set_update_mask<T>(mut self, v: T) -> Self
6471        where
6472            T: std::convert::Into<wkt::FieldMask>,
6473        {
6474            self.0.request.update_mask = std::option::Option::Some(v.into());
6475            self
6476        }
6477
6478        /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
6479        ///
6480        /// This is a **required** field for requests.
6481        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6482        where
6483            T: std::convert::Into<wkt::FieldMask>,
6484        {
6485            self.0.request.update_mask = v.map(|x| x.into());
6486            self
6487        }
6488    }
6489
6490    #[doc(hidden)]
6491    impl crate::RequestBuilder for UpdateCryptoKey {
6492        fn request_options(&mut self) -> &mut crate::RequestOptions {
6493            &mut self.0.options
6494        }
6495    }
6496
6497    /// The request builder for [KeyManagementService::update_crypto_key_version][crate::client::KeyManagementService::update_crypto_key_version] calls.
6498    ///
6499    /// # Example
6500    /// ```
6501    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKeyVersion;
6502    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6503    ///
6504    /// let builder = prepare_request_builder();
6505    /// let response = builder.send().await?;
6506    /// # Ok(()) }
6507    ///
6508    /// fn prepare_request_builder() -> UpdateCryptoKeyVersion {
6509    ///   # panic!();
6510    ///   // ... details omitted ...
6511    /// }
6512    /// ```
6513    #[derive(Clone, Debug)]
6514    pub struct UpdateCryptoKeyVersion(RequestBuilder<crate::model::UpdateCryptoKeyVersionRequest>);
6515
6516    impl UpdateCryptoKeyVersion {
6517        pub(crate) fn new(
6518            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6519        ) -> Self {
6520            Self(RequestBuilder::new(stub))
6521        }
6522
6523        /// Sets the full request, replacing any prior values.
6524        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyVersionRequest>>(
6525            mut self,
6526            v: V,
6527        ) -> Self {
6528            self.0.request = v.into();
6529            self
6530        }
6531
6532        /// Sets all the options, replacing any prior values.
6533        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6534            self.0.options = v.into();
6535            self
6536        }
6537
6538        /// Sends the request.
6539        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6540            (*self.0.stub)
6541                .update_crypto_key_version(self.0.request, self.0.options)
6542                .await
6543                .map(crate::Response::into_body)
6544        }
6545
6546        /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
6547        ///
6548        /// This is a **required** field for requests.
6549        pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
6550        where
6551            T: std::convert::Into<crate::model::CryptoKeyVersion>,
6552        {
6553            self.0.request.crypto_key_version = std::option::Option::Some(v.into());
6554            self
6555        }
6556
6557        /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
6558        ///
6559        /// This is a **required** field for requests.
6560        pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
6561        where
6562            T: std::convert::Into<crate::model::CryptoKeyVersion>,
6563        {
6564            self.0.request.crypto_key_version = v.map(|x| x.into());
6565            self
6566        }
6567
6568        /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
6569        ///
6570        /// This is a **required** field for requests.
6571        pub fn set_update_mask<T>(mut self, v: T) -> Self
6572        where
6573            T: std::convert::Into<wkt::FieldMask>,
6574        {
6575            self.0.request.update_mask = std::option::Option::Some(v.into());
6576            self
6577        }
6578
6579        /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
6580        ///
6581        /// This is a **required** field for requests.
6582        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6583        where
6584            T: std::convert::Into<wkt::FieldMask>,
6585        {
6586            self.0.request.update_mask = v.map(|x| x.into());
6587            self
6588        }
6589    }
6590
6591    #[doc(hidden)]
6592    impl crate::RequestBuilder for UpdateCryptoKeyVersion {
6593        fn request_options(&mut self) -> &mut crate::RequestOptions {
6594            &mut self.0.options
6595        }
6596    }
6597
6598    /// The request builder for [KeyManagementService::update_crypto_key_primary_version][crate::client::KeyManagementService::update_crypto_key_primary_version] calls.
6599    ///
6600    /// # Example
6601    /// ```
6602    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKeyPrimaryVersion;
6603    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6604    ///
6605    /// let builder = prepare_request_builder();
6606    /// let response = builder.send().await?;
6607    /// # Ok(()) }
6608    ///
6609    /// fn prepare_request_builder() -> UpdateCryptoKeyPrimaryVersion {
6610    ///   # panic!();
6611    ///   // ... details omitted ...
6612    /// }
6613    /// ```
6614    #[derive(Clone, Debug)]
6615    pub struct UpdateCryptoKeyPrimaryVersion(
6616        RequestBuilder<crate::model::UpdateCryptoKeyPrimaryVersionRequest>,
6617    );
6618
6619    impl UpdateCryptoKeyPrimaryVersion {
6620        pub(crate) fn new(
6621            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6622        ) -> Self {
6623            Self(RequestBuilder::new(stub))
6624        }
6625
6626        /// Sets the full request, replacing any prior values.
6627        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyPrimaryVersionRequest>>(
6628            mut self,
6629            v: V,
6630        ) -> Self {
6631            self.0.request = v.into();
6632            self
6633        }
6634
6635        /// Sets all the options, replacing any prior values.
6636        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6637            self.0.options = v.into();
6638            self
6639        }
6640
6641        /// Sends the request.
6642        pub async fn send(self) -> Result<crate::model::CryptoKey> {
6643            (*self.0.stub)
6644                .update_crypto_key_primary_version(self.0.request, self.0.options)
6645                .await
6646                .map(crate::Response::into_body)
6647        }
6648
6649        /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
6650        ///
6651        /// This is a **required** field for requests.
6652        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6653            self.0.request.name = v.into();
6654            self
6655        }
6656
6657        /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
6658        ///
6659        /// This is a **required** field for requests.
6660        pub fn set_crypto_key_version_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6661            self.0.request.crypto_key_version_id = v.into();
6662            self
6663        }
6664    }
6665
6666    #[doc(hidden)]
6667    impl crate::RequestBuilder for UpdateCryptoKeyPrimaryVersion {
6668        fn request_options(&mut self) -> &mut crate::RequestOptions {
6669            &mut self.0.options
6670        }
6671    }
6672
6673    /// The request builder for [KeyManagementService::destroy_crypto_key_version][crate::client::KeyManagementService::destroy_crypto_key_version] calls.
6674    ///
6675    /// # Example
6676    /// ```
6677    /// # use google_cloud_kms_v1::builder::key_management_service::DestroyCryptoKeyVersion;
6678    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6679    ///
6680    /// let builder = prepare_request_builder();
6681    /// let response = builder.send().await?;
6682    /// # Ok(()) }
6683    ///
6684    /// fn prepare_request_builder() -> DestroyCryptoKeyVersion {
6685    ///   # panic!();
6686    ///   // ... details omitted ...
6687    /// }
6688    /// ```
6689    #[derive(Clone, Debug)]
6690    pub struct DestroyCryptoKeyVersion(
6691        RequestBuilder<crate::model::DestroyCryptoKeyVersionRequest>,
6692    );
6693
6694    impl DestroyCryptoKeyVersion {
6695        pub(crate) fn new(
6696            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6697        ) -> Self {
6698            Self(RequestBuilder::new(stub))
6699        }
6700
6701        /// Sets the full request, replacing any prior values.
6702        pub fn with_request<V: Into<crate::model::DestroyCryptoKeyVersionRequest>>(
6703            mut self,
6704            v: V,
6705        ) -> Self {
6706            self.0.request = v.into();
6707            self
6708        }
6709
6710        /// Sets all the options, replacing any prior values.
6711        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6712            self.0.options = v.into();
6713            self
6714        }
6715
6716        /// Sends the request.
6717        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6718            (*self.0.stub)
6719                .destroy_crypto_key_version(self.0.request, self.0.options)
6720                .await
6721                .map(crate::Response::into_body)
6722        }
6723
6724        /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
6725        ///
6726        /// This is a **required** field for requests.
6727        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6728            self.0.request.name = v.into();
6729            self
6730        }
6731    }
6732
6733    #[doc(hidden)]
6734    impl crate::RequestBuilder for DestroyCryptoKeyVersion {
6735        fn request_options(&mut self) -> &mut crate::RequestOptions {
6736            &mut self.0.options
6737        }
6738    }
6739
6740    /// The request builder for [KeyManagementService::restore_crypto_key_version][crate::client::KeyManagementService::restore_crypto_key_version] calls.
6741    ///
6742    /// # Example
6743    /// ```
6744    /// # use google_cloud_kms_v1::builder::key_management_service::RestoreCryptoKeyVersion;
6745    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6746    ///
6747    /// let builder = prepare_request_builder();
6748    /// let response = builder.send().await?;
6749    /// # Ok(()) }
6750    ///
6751    /// fn prepare_request_builder() -> RestoreCryptoKeyVersion {
6752    ///   # panic!();
6753    ///   // ... details omitted ...
6754    /// }
6755    /// ```
6756    #[derive(Clone, Debug)]
6757    pub struct RestoreCryptoKeyVersion(
6758        RequestBuilder<crate::model::RestoreCryptoKeyVersionRequest>,
6759    );
6760
6761    impl RestoreCryptoKeyVersion {
6762        pub(crate) fn new(
6763            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6764        ) -> Self {
6765            Self(RequestBuilder::new(stub))
6766        }
6767
6768        /// Sets the full request, replacing any prior values.
6769        pub fn with_request<V: Into<crate::model::RestoreCryptoKeyVersionRequest>>(
6770            mut self,
6771            v: V,
6772        ) -> Self {
6773            self.0.request = v.into();
6774            self
6775        }
6776
6777        /// Sets all the options, replacing any prior values.
6778        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6779            self.0.options = v.into();
6780            self
6781        }
6782
6783        /// Sends the request.
6784        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6785            (*self.0.stub)
6786                .restore_crypto_key_version(self.0.request, self.0.options)
6787                .await
6788                .map(crate::Response::into_body)
6789        }
6790
6791        /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
6792        ///
6793        /// This is a **required** field for requests.
6794        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6795            self.0.request.name = v.into();
6796            self
6797        }
6798    }
6799
6800    #[doc(hidden)]
6801    impl crate::RequestBuilder for RestoreCryptoKeyVersion {
6802        fn request_options(&mut self) -> &mut crate::RequestOptions {
6803            &mut self.0.options
6804        }
6805    }
6806
6807    /// The request builder for [KeyManagementService::encrypt][crate::client::KeyManagementService::encrypt] calls.
6808    ///
6809    /// # Example
6810    /// ```
6811    /// # use google_cloud_kms_v1::builder::key_management_service::Encrypt;
6812    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6813    ///
6814    /// let builder = prepare_request_builder();
6815    /// let response = builder.send().await?;
6816    /// # Ok(()) }
6817    ///
6818    /// fn prepare_request_builder() -> Encrypt {
6819    ///   # panic!();
6820    ///   // ... details omitted ...
6821    /// }
6822    /// ```
6823    #[derive(Clone, Debug)]
6824    pub struct Encrypt(RequestBuilder<crate::model::EncryptRequest>);
6825
6826    impl Encrypt {
6827        pub(crate) fn new(
6828            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6829        ) -> Self {
6830            Self(RequestBuilder::new(stub))
6831        }
6832
6833        /// Sets the full request, replacing any prior values.
6834        pub fn with_request<V: Into<crate::model::EncryptRequest>>(mut self, v: V) -> Self {
6835            self.0.request = v.into();
6836            self
6837        }
6838
6839        /// Sets all the options, replacing any prior values.
6840        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6841            self.0.options = v.into();
6842            self
6843        }
6844
6845        /// Sends the request.
6846        pub async fn send(self) -> Result<crate::model::EncryptResponse> {
6847            (*self.0.stub)
6848                .encrypt(self.0.request, self.0.options)
6849                .await
6850                .map(crate::Response::into_body)
6851        }
6852
6853        /// Sets the value of [name][crate::model::EncryptRequest::name].
6854        ///
6855        /// This is a **required** field for requests.
6856        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6857            self.0.request.name = v.into();
6858            self
6859        }
6860
6861        /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
6862        ///
6863        /// This is a **required** field for requests.
6864        pub fn set_plaintext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6865            self.0.request.plaintext = v.into();
6866            self
6867        }
6868
6869        /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
6870        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6871            self.0.request.additional_authenticated_data = v.into();
6872            self
6873        }
6874
6875        /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
6876        pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
6877        where
6878            T: std::convert::Into<wkt::Int64Value>,
6879        {
6880            self.0.request.plaintext_crc32c = std::option::Option::Some(v.into());
6881            self
6882        }
6883
6884        /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
6885        pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
6886        where
6887            T: std::convert::Into<wkt::Int64Value>,
6888        {
6889            self.0.request.plaintext_crc32c = v.map(|x| x.into());
6890            self
6891        }
6892
6893        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
6894        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
6895        where
6896            T: std::convert::Into<wkt::Int64Value>,
6897        {
6898            self.0.request.additional_authenticated_data_crc32c =
6899                std::option::Option::Some(v.into());
6900            self
6901        }
6902
6903        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
6904        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
6905            mut self,
6906            v: std::option::Option<T>,
6907        ) -> Self
6908        where
6909            T: std::convert::Into<wkt::Int64Value>,
6910        {
6911            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
6912            self
6913        }
6914    }
6915
6916    #[doc(hidden)]
6917    impl crate::RequestBuilder for Encrypt {
6918        fn request_options(&mut self) -> &mut crate::RequestOptions {
6919            &mut self.0.options
6920        }
6921    }
6922
6923    /// The request builder for [KeyManagementService::decrypt][crate::client::KeyManagementService::decrypt] calls.
6924    ///
6925    /// # Example
6926    /// ```
6927    /// # use google_cloud_kms_v1::builder::key_management_service::Decrypt;
6928    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6929    ///
6930    /// let builder = prepare_request_builder();
6931    /// let response = builder.send().await?;
6932    /// # Ok(()) }
6933    ///
6934    /// fn prepare_request_builder() -> Decrypt {
6935    ///   # panic!();
6936    ///   // ... details omitted ...
6937    /// }
6938    /// ```
6939    #[derive(Clone, Debug)]
6940    pub struct Decrypt(RequestBuilder<crate::model::DecryptRequest>);
6941
6942    impl Decrypt {
6943        pub(crate) fn new(
6944            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6945        ) -> Self {
6946            Self(RequestBuilder::new(stub))
6947        }
6948
6949        /// Sets the full request, replacing any prior values.
6950        pub fn with_request<V: Into<crate::model::DecryptRequest>>(mut self, v: V) -> Self {
6951            self.0.request = v.into();
6952            self
6953        }
6954
6955        /// Sets all the options, replacing any prior values.
6956        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6957            self.0.options = v.into();
6958            self
6959        }
6960
6961        /// Sends the request.
6962        pub async fn send(self) -> Result<crate::model::DecryptResponse> {
6963            (*self.0.stub)
6964                .decrypt(self.0.request, self.0.options)
6965                .await
6966                .map(crate::Response::into_body)
6967        }
6968
6969        /// Sets the value of [name][crate::model::DecryptRequest::name].
6970        ///
6971        /// This is a **required** field for requests.
6972        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6973            self.0.request.name = v.into();
6974            self
6975        }
6976
6977        /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
6978        ///
6979        /// This is a **required** field for requests.
6980        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6981            self.0.request.ciphertext = v.into();
6982            self
6983        }
6984
6985        /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
6986        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6987            self.0.request.additional_authenticated_data = v.into();
6988            self
6989        }
6990
6991        /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
6992        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
6993        where
6994            T: std::convert::Into<wkt::Int64Value>,
6995        {
6996            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
6997            self
6998        }
6999
7000        /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
7001        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7002        where
7003            T: std::convert::Into<wkt::Int64Value>,
7004        {
7005            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
7006            self
7007        }
7008
7009        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
7010        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7011        where
7012            T: std::convert::Into<wkt::Int64Value>,
7013        {
7014            self.0.request.additional_authenticated_data_crc32c =
7015                std::option::Option::Some(v.into());
7016            self
7017        }
7018
7019        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
7020        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7021            mut self,
7022            v: std::option::Option<T>,
7023        ) -> Self
7024        where
7025            T: std::convert::Into<wkt::Int64Value>,
7026        {
7027            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
7028            self
7029        }
7030    }
7031
7032    #[doc(hidden)]
7033    impl crate::RequestBuilder for Decrypt {
7034        fn request_options(&mut self) -> &mut crate::RequestOptions {
7035            &mut self.0.options
7036        }
7037    }
7038
7039    /// The request builder for [KeyManagementService::raw_encrypt][crate::client::KeyManagementService::raw_encrypt] calls.
7040    ///
7041    /// # Example
7042    /// ```
7043    /// # use google_cloud_kms_v1::builder::key_management_service::RawEncrypt;
7044    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7045    ///
7046    /// let builder = prepare_request_builder();
7047    /// let response = builder.send().await?;
7048    /// # Ok(()) }
7049    ///
7050    /// fn prepare_request_builder() -> RawEncrypt {
7051    ///   # panic!();
7052    ///   // ... details omitted ...
7053    /// }
7054    /// ```
7055    #[derive(Clone, Debug)]
7056    pub struct RawEncrypt(RequestBuilder<crate::model::RawEncryptRequest>);
7057
7058    impl RawEncrypt {
7059        pub(crate) fn new(
7060            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7061        ) -> Self {
7062            Self(RequestBuilder::new(stub))
7063        }
7064
7065        /// Sets the full request, replacing any prior values.
7066        pub fn with_request<V: Into<crate::model::RawEncryptRequest>>(mut self, v: V) -> Self {
7067            self.0.request = v.into();
7068            self
7069        }
7070
7071        /// Sets all the options, replacing any prior values.
7072        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7073            self.0.options = v.into();
7074            self
7075        }
7076
7077        /// Sends the request.
7078        pub async fn send(self) -> Result<crate::model::RawEncryptResponse> {
7079            (*self.0.stub)
7080                .raw_encrypt(self.0.request, self.0.options)
7081                .await
7082                .map(crate::Response::into_body)
7083        }
7084
7085        /// Sets the value of [name][crate::model::RawEncryptRequest::name].
7086        ///
7087        /// This is a **required** field for requests.
7088        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7089            self.0.request.name = v.into();
7090            self
7091        }
7092
7093        /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
7094        ///
7095        /// This is a **required** field for requests.
7096        pub fn set_plaintext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7097            self.0.request.plaintext = v.into();
7098            self
7099        }
7100
7101        /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
7102        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7103            self.0.request.additional_authenticated_data = v.into();
7104            self
7105        }
7106
7107        /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
7108        pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
7109        where
7110            T: std::convert::Into<wkt::Int64Value>,
7111        {
7112            self.0.request.plaintext_crc32c = std::option::Option::Some(v.into());
7113            self
7114        }
7115
7116        /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
7117        pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7118        where
7119            T: std::convert::Into<wkt::Int64Value>,
7120        {
7121            self.0.request.plaintext_crc32c = v.map(|x| x.into());
7122            self
7123        }
7124
7125        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
7126        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7127        where
7128            T: std::convert::Into<wkt::Int64Value>,
7129        {
7130            self.0.request.additional_authenticated_data_crc32c =
7131                std::option::Option::Some(v.into());
7132            self
7133        }
7134
7135        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
7136        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7137            mut self,
7138            v: std::option::Option<T>,
7139        ) -> Self
7140        where
7141            T: std::convert::Into<wkt::Int64Value>,
7142        {
7143            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
7144            self
7145        }
7146
7147        /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
7148        pub fn set_initialization_vector<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7149            self.0.request.initialization_vector = v.into();
7150            self
7151        }
7152
7153        /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
7154        pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
7155        where
7156            T: std::convert::Into<wkt::Int64Value>,
7157        {
7158            self.0.request.initialization_vector_crc32c = std::option::Option::Some(v.into());
7159            self
7160        }
7161
7162        /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
7163        pub fn set_or_clear_initialization_vector_crc32c<T>(
7164            mut self,
7165            v: std::option::Option<T>,
7166        ) -> Self
7167        where
7168            T: std::convert::Into<wkt::Int64Value>,
7169        {
7170            self.0.request.initialization_vector_crc32c = v.map(|x| x.into());
7171            self
7172        }
7173    }
7174
7175    #[doc(hidden)]
7176    impl crate::RequestBuilder for RawEncrypt {
7177        fn request_options(&mut self) -> &mut crate::RequestOptions {
7178            &mut self.0.options
7179        }
7180    }
7181
7182    /// The request builder for [KeyManagementService::raw_decrypt][crate::client::KeyManagementService::raw_decrypt] calls.
7183    ///
7184    /// # Example
7185    /// ```
7186    /// # use google_cloud_kms_v1::builder::key_management_service::RawDecrypt;
7187    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7188    ///
7189    /// let builder = prepare_request_builder();
7190    /// let response = builder.send().await?;
7191    /// # Ok(()) }
7192    ///
7193    /// fn prepare_request_builder() -> RawDecrypt {
7194    ///   # panic!();
7195    ///   // ... details omitted ...
7196    /// }
7197    /// ```
7198    #[derive(Clone, Debug)]
7199    pub struct RawDecrypt(RequestBuilder<crate::model::RawDecryptRequest>);
7200
7201    impl RawDecrypt {
7202        pub(crate) fn new(
7203            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7204        ) -> Self {
7205            Self(RequestBuilder::new(stub))
7206        }
7207
7208        /// Sets the full request, replacing any prior values.
7209        pub fn with_request<V: Into<crate::model::RawDecryptRequest>>(mut self, v: V) -> Self {
7210            self.0.request = v.into();
7211            self
7212        }
7213
7214        /// Sets all the options, replacing any prior values.
7215        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7216            self.0.options = v.into();
7217            self
7218        }
7219
7220        /// Sends the request.
7221        pub async fn send(self) -> Result<crate::model::RawDecryptResponse> {
7222            (*self.0.stub)
7223                .raw_decrypt(self.0.request, self.0.options)
7224                .await
7225                .map(crate::Response::into_body)
7226        }
7227
7228        /// Sets the value of [name][crate::model::RawDecryptRequest::name].
7229        ///
7230        /// This is a **required** field for requests.
7231        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7232            self.0.request.name = v.into();
7233            self
7234        }
7235
7236        /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
7237        ///
7238        /// This is a **required** field for requests.
7239        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7240            self.0.request.ciphertext = v.into();
7241            self
7242        }
7243
7244        /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
7245        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7246            self.0.request.additional_authenticated_data = v.into();
7247            self
7248        }
7249
7250        /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
7251        ///
7252        /// This is a **required** field for requests.
7253        pub fn set_initialization_vector<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7254            self.0.request.initialization_vector = v.into();
7255            self
7256        }
7257
7258        /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
7259        pub fn set_tag_length<T: Into<i32>>(mut self, v: T) -> Self {
7260            self.0.request.tag_length = v.into();
7261            self
7262        }
7263
7264        /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
7265        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7266        where
7267            T: std::convert::Into<wkt::Int64Value>,
7268        {
7269            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
7270            self
7271        }
7272
7273        /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
7274        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7275        where
7276            T: std::convert::Into<wkt::Int64Value>,
7277        {
7278            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
7279            self
7280        }
7281
7282        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
7283        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7284        where
7285            T: std::convert::Into<wkt::Int64Value>,
7286        {
7287            self.0.request.additional_authenticated_data_crc32c =
7288                std::option::Option::Some(v.into());
7289            self
7290        }
7291
7292        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
7293        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7294            mut self,
7295            v: std::option::Option<T>,
7296        ) -> Self
7297        where
7298            T: std::convert::Into<wkt::Int64Value>,
7299        {
7300            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
7301            self
7302        }
7303
7304        /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
7305        pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
7306        where
7307            T: std::convert::Into<wkt::Int64Value>,
7308        {
7309            self.0.request.initialization_vector_crc32c = std::option::Option::Some(v.into());
7310            self
7311        }
7312
7313        /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
7314        pub fn set_or_clear_initialization_vector_crc32c<T>(
7315            mut self,
7316            v: std::option::Option<T>,
7317        ) -> Self
7318        where
7319            T: std::convert::Into<wkt::Int64Value>,
7320        {
7321            self.0.request.initialization_vector_crc32c = v.map(|x| x.into());
7322            self
7323        }
7324    }
7325
7326    #[doc(hidden)]
7327    impl crate::RequestBuilder for RawDecrypt {
7328        fn request_options(&mut self) -> &mut crate::RequestOptions {
7329            &mut self.0.options
7330        }
7331    }
7332
7333    /// The request builder for [KeyManagementService::asymmetric_sign][crate::client::KeyManagementService::asymmetric_sign] calls.
7334    ///
7335    /// # Example
7336    /// ```
7337    /// # use google_cloud_kms_v1::builder::key_management_service::AsymmetricSign;
7338    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7339    ///
7340    /// let builder = prepare_request_builder();
7341    /// let response = builder.send().await?;
7342    /// # Ok(()) }
7343    ///
7344    /// fn prepare_request_builder() -> AsymmetricSign {
7345    ///   # panic!();
7346    ///   // ... details omitted ...
7347    /// }
7348    /// ```
7349    #[derive(Clone, Debug)]
7350    pub struct AsymmetricSign(RequestBuilder<crate::model::AsymmetricSignRequest>);
7351
7352    impl AsymmetricSign {
7353        pub(crate) fn new(
7354            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7355        ) -> Self {
7356            Self(RequestBuilder::new(stub))
7357        }
7358
7359        /// Sets the full request, replacing any prior values.
7360        pub fn with_request<V: Into<crate::model::AsymmetricSignRequest>>(mut self, v: V) -> Self {
7361            self.0.request = v.into();
7362            self
7363        }
7364
7365        /// Sets all the options, replacing any prior values.
7366        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7367            self.0.options = v.into();
7368            self
7369        }
7370
7371        /// Sends the request.
7372        pub async fn send(self) -> Result<crate::model::AsymmetricSignResponse> {
7373            (*self.0.stub)
7374                .asymmetric_sign(self.0.request, self.0.options)
7375                .await
7376                .map(crate::Response::into_body)
7377        }
7378
7379        /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
7380        ///
7381        /// This is a **required** field for requests.
7382        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7383            self.0.request.name = v.into();
7384            self
7385        }
7386
7387        /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
7388        pub fn set_digest<T>(mut self, v: T) -> Self
7389        where
7390            T: std::convert::Into<crate::model::Digest>,
7391        {
7392            self.0.request.digest = std::option::Option::Some(v.into());
7393            self
7394        }
7395
7396        /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
7397        pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
7398        where
7399            T: std::convert::Into<crate::model::Digest>,
7400        {
7401            self.0.request.digest = v.map(|x| x.into());
7402            self
7403        }
7404
7405        /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
7406        pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
7407        where
7408            T: std::convert::Into<wkt::Int64Value>,
7409        {
7410            self.0.request.digest_crc32c = std::option::Option::Some(v.into());
7411            self
7412        }
7413
7414        /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
7415        pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7416        where
7417            T: std::convert::Into<wkt::Int64Value>,
7418        {
7419            self.0.request.digest_crc32c = v.map(|x| x.into());
7420            self
7421        }
7422
7423        /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
7424        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7425            self.0.request.data = v.into();
7426            self
7427        }
7428
7429        /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
7430        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
7431        where
7432            T: std::convert::Into<wkt::Int64Value>,
7433        {
7434            self.0.request.data_crc32c = std::option::Option::Some(v.into());
7435            self
7436        }
7437
7438        /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
7439        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7440        where
7441            T: std::convert::Into<wkt::Int64Value>,
7442        {
7443            self.0.request.data_crc32c = v.map(|x| x.into());
7444            self
7445        }
7446    }
7447
7448    #[doc(hidden)]
7449    impl crate::RequestBuilder for AsymmetricSign {
7450        fn request_options(&mut self) -> &mut crate::RequestOptions {
7451            &mut self.0.options
7452        }
7453    }
7454
7455    /// The request builder for [KeyManagementService::asymmetric_decrypt][crate::client::KeyManagementService::asymmetric_decrypt] calls.
7456    ///
7457    /// # Example
7458    /// ```
7459    /// # use google_cloud_kms_v1::builder::key_management_service::AsymmetricDecrypt;
7460    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7461    ///
7462    /// let builder = prepare_request_builder();
7463    /// let response = builder.send().await?;
7464    /// # Ok(()) }
7465    ///
7466    /// fn prepare_request_builder() -> AsymmetricDecrypt {
7467    ///   # panic!();
7468    ///   // ... details omitted ...
7469    /// }
7470    /// ```
7471    #[derive(Clone, Debug)]
7472    pub struct AsymmetricDecrypt(RequestBuilder<crate::model::AsymmetricDecryptRequest>);
7473
7474    impl AsymmetricDecrypt {
7475        pub(crate) fn new(
7476            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7477        ) -> Self {
7478            Self(RequestBuilder::new(stub))
7479        }
7480
7481        /// Sets the full request, replacing any prior values.
7482        pub fn with_request<V: Into<crate::model::AsymmetricDecryptRequest>>(
7483            mut self,
7484            v: V,
7485        ) -> Self {
7486            self.0.request = v.into();
7487            self
7488        }
7489
7490        /// Sets all the options, replacing any prior values.
7491        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7492            self.0.options = v.into();
7493            self
7494        }
7495
7496        /// Sends the request.
7497        pub async fn send(self) -> Result<crate::model::AsymmetricDecryptResponse> {
7498            (*self.0.stub)
7499                .asymmetric_decrypt(self.0.request, self.0.options)
7500                .await
7501                .map(crate::Response::into_body)
7502        }
7503
7504        /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
7505        ///
7506        /// This is a **required** field for requests.
7507        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7508            self.0.request.name = v.into();
7509            self
7510        }
7511
7512        /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
7513        ///
7514        /// This is a **required** field for requests.
7515        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7516            self.0.request.ciphertext = v.into();
7517            self
7518        }
7519
7520        /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
7521        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7522        where
7523            T: std::convert::Into<wkt::Int64Value>,
7524        {
7525            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
7526            self
7527        }
7528
7529        /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
7530        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7531        where
7532            T: std::convert::Into<wkt::Int64Value>,
7533        {
7534            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
7535            self
7536        }
7537    }
7538
7539    #[doc(hidden)]
7540    impl crate::RequestBuilder for AsymmetricDecrypt {
7541        fn request_options(&mut self) -> &mut crate::RequestOptions {
7542            &mut self.0.options
7543        }
7544    }
7545
7546    /// The request builder for [KeyManagementService::mac_sign][crate::client::KeyManagementService::mac_sign] calls.
7547    ///
7548    /// # Example
7549    /// ```
7550    /// # use google_cloud_kms_v1::builder::key_management_service::MacSign;
7551    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7552    ///
7553    /// let builder = prepare_request_builder();
7554    /// let response = builder.send().await?;
7555    /// # Ok(()) }
7556    ///
7557    /// fn prepare_request_builder() -> MacSign {
7558    ///   # panic!();
7559    ///   // ... details omitted ...
7560    /// }
7561    /// ```
7562    #[derive(Clone, Debug)]
7563    pub struct MacSign(RequestBuilder<crate::model::MacSignRequest>);
7564
7565    impl MacSign {
7566        pub(crate) fn new(
7567            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7568        ) -> Self {
7569            Self(RequestBuilder::new(stub))
7570        }
7571
7572        /// Sets the full request, replacing any prior values.
7573        pub fn with_request<V: Into<crate::model::MacSignRequest>>(mut self, v: V) -> Self {
7574            self.0.request = v.into();
7575            self
7576        }
7577
7578        /// Sets all the options, replacing any prior values.
7579        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7580            self.0.options = v.into();
7581            self
7582        }
7583
7584        /// Sends the request.
7585        pub async fn send(self) -> Result<crate::model::MacSignResponse> {
7586            (*self.0.stub)
7587                .mac_sign(self.0.request, self.0.options)
7588                .await
7589                .map(crate::Response::into_body)
7590        }
7591
7592        /// Sets the value of [name][crate::model::MacSignRequest::name].
7593        ///
7594        /// This is a **required** field for requests.
7595        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7596            self.0.request.name = v.into();
7597            self
7598        }
7599
7600        /// Sets the value of [data][crate::model::MacSignRequest::data].
7601        ///
7602        /// This is a **required** field for requests.
7603        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7604            self.0.request.data = v.into();
7605            self
7606        }
7607
7608        /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
7609        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
7610        where
7611            T: std::convert::Into<wkt::Int64Value>,
7612        {
7613            self.0.request.data_crc32c = std::option::Option::Some(v.into());
7614            self
7615        }
7616
7617        /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
7618        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7619        where
7620            T: std::convert::Into<wkt::Int64Value>,
7621        {
7622            self.0.request.data_crc32c = v.map(|x| x.into());
7623            self
7624        }
7625    }
7626
7627    #[doc(hidden)]
7628    impl crate::RequestBuilder for MacSign {
7629        fn request_options(&mut self) -> &mut crate::RequestOptions {
7630            &mut self.0.options
7631        }
7632    }
7633
7634    /// The request builder for [KeyManagementService::mac_verify][crate::client::KeyManagementService::mac_verify] calls.
7635    ///
7636    /// # Example
7637    /// ```
7638    /// # use google_cloud_kms_v1::builder::key_management_service::MacVerify;
7639    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7640    ///
7641    /// let builder = prepare_request_builder();
7642    /// let response = builder.send().await?;
7643    /// # Ok(()) }
7644    ///
7645    /// fn prepare_request_builder() -> MacVerify {
7646    ///   # panic!();
7647    ///   // ... details omitted ...
7648    /// }
7649    /// ```
7650    #[derive(Clone, Debug)]
7651    pub struct MacVerify(RequestBuilder<crate::model::MacVerifyRequest>);
7652
7653    impl MacVerify {
7654        pub(crate) fn new(
7655            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7656        ) -> Self {
7657            Self(RequestBuilder::new(stub))
7658        }
7659
7660        /// Sets the full request, replacing any prior values.
7661        pub fn with_request<V: Into<crate::model::MacVerifyRequest>>(mut self, v: V) -> Self {
7662            self.0.request = v.into();
7663            self
7664        }
7665
7666        /// Sets all the options, replacing any prior values.
7667        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7668            self.0.options = v.into();
7669            self
7670        }
7671
7672        /// Sends the request.
7673        pub async fn send(self) -> Result<crate::model::MacVerifyResponse> {
7674            (*self.0.stub)
7675                .mac_verify(self.0.request, self.0.options)
7676                .await
7677                .map(crate::Response::into_body)
7678        }
7679
7680        /// Sets the value of [name][crate::model::MacVerifyRequest::name].
7681        ///
7682        /// This is a **required** field for requests.
7683        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7684            self.0.request.name = v.into();
7685            self
7686        }
7687
7688        /// Sets the value of [data][crate::model::MacVerifyRequest::data].
7689        ///
7690        /// This is a **required** field for requests.
7691        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7692            self.0.request.data = v.into();
7693            self
7694        }
7695
7696        /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
7697        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
7698        where
7699            T: std::convert::Into<wkt::Int64Value>,
7700        {
7701            self.0.request.data_crc32c = std::option::Option::Some(v.into());
7702            self
7703        }
7704
7705        /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
7706        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7707        where
7708            T: std::convert::Into<wkt::Int64Value>,
7709        {
7710            self.0.request.data_crc32c = v.map(|x| x.into());
7711            self
7712        }
7713
7714        /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
7715        ///
7716        /// This is a **required** field for requests.
7717        pub fn set_mac<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7718            self.0.request.mac = v.into();
7719            self
7720        }
7721
7722        /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
7723        pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
7724        where
7725            T: std::convert::Into<wkt::Int64Value>,
7726        {
7727            self.0.request.mac_crc32c = std::option::Option::Some(v.into());
7728            self
7729        }
7730
7731        /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
7732        pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7733        where
7734            T: std::convert::Into<wkt::Int64Value>,
7735        {
7736            self.0.request.mac_crc32c = v.map(|x| x.into());
7737            self
7738        }
7739    }
7740
7741    #[doc(hidden)]
7742    impl crate::RequestBuilder for MacVerify {
7743        fn request_options(&mut self) -> &mut crate::RequestOptions {
7744            &mut self.0.options
7745        }
7746    }
7747
7748    /// The request builder for [KeyManagementService::decapsulate][crate::client::KeyManagementService::decapsulate] calls.
7749    ///
7750    /// # Example
7751    /// ```
7752    /// # use google_cloud_kms_v1::builder::key_management_service::Decapsulate;
7753    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7754    ///
7755    /// let builder = prepare_request_builder();
7756    /// let response = builder.send().await?;
7757    /// # Ok(()) }
7758    ///
7759    /// fn prepare_request_builder() -> Decapsulate {
7760    ///   # panic!();
7761    ///   // ... details omitted ...
7762    /// }
7763    /// ```
7764    #[derive(Clone, Debug)]
7765    pub struct Decapsulate(RequestBuilder<crate::model::DecapsulateRequest>);
7766
7767    impl Decapsulate {
7768        pub(crate) fn new(
7769            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7770        ) -> Self {
7771            Self(RequestBuilder::new(stub))
7772        }
7773
7774        /// Sets the full request, replacing any prior values.
7775        pub fn with_request<V: Into<crate::model::DecapsulateRequest>>(mut self, v: V) -> Self {
7776            self.0.request = v.into();
7777            self
7778        }
7779
7780        /// Sets all the options, replacing any prior values.
7781        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7782            self.0.options = v.into();
7783            self
7784        }
7785
7786        /// Sends the request.
7787        pub async fn send(self) -> Result<crate::model::DecapsulateResponse> {
7788            (*self.0.stub)
7789                .decapsulate(self.0.request, self.0.options)
7790                .await
7791                .map(crate::Response::into_body)
7792        }
7793
7794        /// Sets the value of [name][crate::model::DecapsulateRequest::name].
7795        ///
7796        /// This is a **required** field for requests.
7797        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7798            self.0.request.name = v.into();
7799            self
7800        }
7801
7802        /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
7803        ///
7804        /// This is a **required** field for requests.
7805        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7806            self.0.request.ciphertext = v.into();
7807            self
7808        }
7809
7810        /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
7811        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7812        where
7813            T: std::convert::Into<wkt::Int64Value>,
7814        {
7815            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
7816            self
7817        }
7818
7819        /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
7820        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7821        where
7822            T: std::convert::Into<wkt::Int64Value>,
7823        {
7824            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
7825            self
7826        }
7827    }
7828
7829    #[doc(hidden)]
7830    impl crate::RequestBuilder for Decapsulate {
7831        fn request_options(&mut self) -> &mut crate::RequestOptions {
7832            &mut self.0.options
7833        }
7834    }
7835
7836    /// The request builder for [KeyManagementService::generate_random_bytes][crate::client::KeyManagementService::generate_random_bytes] calls.
7837    ///
7838    /// # Example
7839    /// ```
7840    /// # use google_cloud_kms_v1::builder::key_management_service::GenerateRandomBytes;
7841    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7842    ///
7843    /// let builder = prepare_request_builder();
7844    /// let response = builder.send().await?;
7845    /// # Ok(()) }
7846    ///
7847    /// fn prepare_request_builder() -> GenerateRandomBytes {
7848    ///   # panic!();
7849    ///   // ... details omitted ...
7850    /// }
7851    /// ```
7852    #[derive(Clone, Debug)]
7853    pub struct GenerateRandomBytes(RequestBuilder<crate::model::GenerateRandomBytesRequest>);
7854
7855    impl GenerateRandomBytes {
7856        pub(crate) fn new(
7857            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7858        ) -> Self {
7859            Self(RequestBuilder::new(stub))
7860        }
7861
7862        /// Sets the full request, replacing any prior values.
7863        pub fn with_request<V: Into<crate::model::GenerateRandomBytesRequest>>(
7864            mut self,
7865            v: V,
7866        ) -> Self {
7867            self.0.request = v.into();
7868            self
7869        }
7870
7871        /// Sets all the options, replacing any prior values.
7872        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7873            self.0.options = v.into();
7874            self
7875        }
7876
7877        /// Sends the request.
7878        pub async fn send(self) -> Result<crate::model::GenerateRandomBytesResponse> {
7879            (*self.0.stub)
7880                .generate_random_bytes(self.0.request, self.0.options)
7881                .await
7882                .map(crate::Response::into_body)
7883        }
7884
7885        /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
7886        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7887            self.0.request.location = v.into();
7888            self
7889        }
7890
7891        /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
7892        pub fn set_length_bytes<T: Into<i32>>(mut self, v: T) -> Self {
7893            self.0.request.length_bytes = v.into();
7894            self
7895        }
7896
7897        /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
7898        pub fn set_protection_level<T: Into<crate::model::ProtectionLevel>>(
7899            mut self,
7900            v: T,
7901        ) -> Self {
7902            self.0.request.protection_level = v.into();
7903            self
7904        }
7905    }
7906
7907    #[doc(hidden)]
7908    impl crate::RequestBuilder for GenerateRandomBytes {
7909        fn request_options(&mut self) -> &mut crate::RequestOptions {
7910            &mut self.0.options
7911        }
7912    }
7913
7914    /// The request builder for [KeyManagementService::list_locations][crate::client::KeyManagementService::list_locations] calls.
7915    ///
7916    /// # Example
7917    /// ```
7918    /// # use google_cloud_kms_v1::builder::key_management_service::ListLocations;
7919    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7920    /// use google_cloud_gax::paginator::ItemPaginator;
7921    ///
7922    /// let builder = prepare_request_builder();
7923    /// let mut items = builder.by_item();
7924    /// while let Some(result) = items.next().await {
7925    ///   let item = result?;
7926    /// }
7927    /// # Ok(()) }
7928    ///
7929    /// fn prepare_request_builder() -> ListLocations {
7930    ///   # panic!();
7931    ///   // ... details omitted ...
7932    /// }
7933    /// ```
7934    #[derive(Clone, Debug)]
7935    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
7936
7937    impl ListLocations {
7938        pub(crate) fn new(
7939            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7940        ) -> Self {
7941            Self(RequestBuilder::new(stub))
7942        }
7943
7944        /// Sets the full request, replacing any prior values.
7945        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
7946            mut self,
7947            v: V,
7948        ) -> Self {
7949            self.0.request = v.into();
7950            self
7951        }
7952
7953        /// Sets all the options, replacing any prior values.
7954        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7955            self.0.options = v.into();
7956            self
7957        }
7958
7959        /// Sends the request.
7960        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
7961            (*self.0.stub)
7962                .list_locations(self.0.request, self.0.options)
7963                .await
7964                .map(crate::Response::into_body)
7965        }
7966
7967        /// Streams each page in the collection.
7968        pub fn by_page(
7969            self,
7970        ) -> impl google_cloud_gax::paginator::Paginator<
7971            google_cloud_location::model::ListLocationsResponse,
7972            crate::Error,
7973        > {
7974            use std::clone::Clone;
7975            let token = self.0.request.page_token.clone();
7976            let execute = move |token: String| {
7977                let mut builder = self.clone();
7978                builder.0.request = builder.0.request.set_page_token(token);
7979                builder.send()
7980            };
7981            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7982        }
7983
7984        /// Streams each item in the collection.
7985        pub fn by_item(
7986            self,
7987        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7988            google_cloud_location::model::ListLocationsResponse,
7989            crate::Error,
7990        > {
7991            use google_cloud_gax::paginator::Paginator;
7992            self.by_page().items()
7993        }
7994
7995        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
7996        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7997            self.0.request.name = v.into();
7998            self
7999        }
8000
8001        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
8002        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8003            self.0.request.filter = v.into();
8004            self
8005        }
8006
8007        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
8008        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8009            self.0.request.page_size = v.into();
8010            self
8011        }
8012
8013        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
8014        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8015            self.0.request.page_token = v.into();
8016            self
8017        }
8018    }
8019
8020    #[doc(hidden)]
8021    impl crate::RequestBuilder for ListLocations {
8022        fn request_options(&mut self) -> &mut crate::RequestOptions {
8023            &mut self.0.options
8024        }
8025    }
8026
8027    /// The request builder for [KeyManagementService::get_location][crate::client::KeyManagementService::get_location] calls.
8028    ///
8029    /// # Example
8030    /// ```
8031    /// # use google_cloud_kms_v1::builder::key_management_service::GetLocation;
8032    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8033    ///
8034    /// let builder = prepare_request_builder();
8035    /// let response = builder.send().await?;
8036    /// # Ok(()) }
8037    ///
8038    /// fn prepare_request_builder() -> GetLocation {
8039    ///   # panic!();
8040    ///   // ... details omitted ...
8041    /// }
8042    /// ```
8043    #[derive(Clone, Debug)]
8044    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
8045
8046    impl GetLocation {
8047        pub(crate) fn new(
8048            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8049        ) -> Self {
8050            Self(RequestBuilder::new(stub))
8051        }
8052
8053        /// Sets the full request, replacing any prior values.
8054        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
8055            mut self,
8056            v: V,
8057        ) -> Self {
8058            self.0.request = v.into();
8059            self
8060        }
8061
8062        /// Sets all the options, replacing any prior values.
8063        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8064            self.0.options = v.into();
8065            self
8066        }
8067
8068        /// Sends the request.
8069        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
8070            (*self.0.stub)
8071                .get_location(self.0.request, self.0.options)
8072                .await
8073                .map(crate::Response::into_body)
8074        }
8075
8076        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
8077        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8078            self.0.request.name = v.into();
8079            self
8080        }
8081    }
8082
8083    #[doc(hidden)]
8084    impl crate::RequestBuilder for GetLocation {
8085        fn request_options(&mut self) -> &mut crate::RequestOptions {
8086            &mut self.0.options
8087        }
8088    }
8089
8090    /// The request builder for [KeyManagementService::set_iam_policy][crate::client::KeyManagementService::set_iam_policy] calls.
8091    ///
8092    /// # Example
8093    /// ```
8094    /// # use google_cloud_kms_v1::builder::key_management_service::SetIamPolicy;
8095    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8096    ///
8097    /// let builder = prepare_request_builder();
8098    /// let response = builder.send().await?;
8099    /// # Ok(()) }
8100    ///
8101    /// fn prepare_request_builder() -> SetIamPolicy {
8102    ///   # panic!();
8103    ///   // ... details omitted ...
8104    /// }
8105    /// ```
8106    #[derive(Clone, Debug)]
8107    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
8108
8109    impl SetIamPolicy {
8110        pub(crate) fn new(
8111            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8112        ) -> Self {
8113            Self(RequestBuilder::new(stub))
8114        }
8115
8116        /// Sets the full request, replacing any prior values.
8117        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
8118            mut self,
8119            v: V,
8120        ) -> Self {
8121            self.0.request = v.into();
8122            self
8123        }
8124
8125        /// Sets all the options, replacing any prior values.
8126        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8127            self.0.options = v.into();
8128            self
8129        }
8130
8131        /// Sends the request.
8132        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
8133            (*self.0.stub)
8134                .set_iam_policy(self.0.request, self.0.options)
8135                .await
8136                .map(crate::Response::into_body)
8137        }
8138
8139        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
8140        ///
8141        /// This is a **required** field for requests.
8142        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8143            self.0.request.resource = v.into();
8144            self
8145        }
8146
8147        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
8148        ///
8149        /// This is a **required** field for requests.
8150        pub fn set_policy<T>(mut self, v: T) -> Self
8151        where
8152            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
8153        {
8154            self.0.request.policy = std::option::Option::Some(v.into());
8155            self
8156        }
8157
8158        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
8159        ///
8160        /// This is a **required** field for requests.
8161        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
8162        where
8163            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
8164        {
8165            self.0.request.policy = v.map(|x| x.into());
8166            self
8167        }
8168
8169        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
8170        pub fn set_update_mask<T>(mut self, v: T) -> Self
8171        where
8172            T: std::convert::Into<wkt::FieldMask>,
8173        {
8174            self.0.request.update_mask = std::option::Option::Some(v.into());
8175            self
8176        }
8177
8178        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
8179        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8180        where
8181            T: std::convert::Into<wkt::FieldMask>,
8182        {
8183            self.0.request.update_mask = v.map(|x| x.into());
8184            self
8185        }
8186    }
8187
8188    #[doc(hidden)]
8189    impl crate::RequestBuilder for SetIamPolicy {
8190        fn request_options(&mut self) -> &mut crate::RequestOptions {
8191            &mut self.0.options
8192        }
8193    }
8194
8195    /// The request builder for [KeyManagementService::get_iam_policy][crate::client::KeyManagementService::get_iam_policy] calls.
8196    ///
8197    /// # Example
8198    /// ```
8199    /// # use google_cloud_kms_v1::builder::key_management_service::GetIamPolicy;
8200    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8201    ///
8202    /// let builder = prepare_request_builder();
8203    /// let response = builder.send().await?;
8204    /// # Ok(()) }
8205    ///
8206    /// fn prepare_request_builder() -> GetIamPolicy {
8207    ///   # panic!();
8208    ///   // ... details omitted ...
8209    /// }
8210    /// ```
8211    #[derive(Clone, Debug)]
8212    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
8213
8214    impl GetIamPolicy {
8215        pub(crate) fn new(
8216            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8217        ) -> Self {
8218            Self(RequestBuilder::new(stub))
8219        }
8220
8221        /// Sets the full request, replacing any prior values.
8222        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
8223            mut self,
8224            v: V,
8225        ) -> Self {
8226            self.0.request = v.into();
8227            self
8228        }
8229
8230        /// Sets all the options, replacing any prior values.
8231        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8232            self.0.options = v.into();
8233            self
8234        }
8235
8236        /// Sends the request.
8237        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
8238            (*self.0.stub)
8239                .get_iam_policy(self.0.request, self.0.options)
8240                .await
8241                .map(crate::Response::into_body)
8242        }
8243
8244        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
8245        ///
8246        /// This is a **required** field for requests.
8247        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8248            self.0.request.resource = v.into();
8249            self
8250        }
8251
8252        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
8253        pub fn set_options<T>(mut self, v: T) -> Self
8254        where
8255            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8256        {
8257            self.0.request.options = std::option::Option::Some(v.into());
8258            self
8259        }
8260
8261        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
8262        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
8263        where
8264            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8265        {
8266            self.0.request.options = v.map(|x| x.into());
8267            self
8268        }
8269    }
8270
8271    #[doc(hidden)]
8272    impl crate::RequestBuilder for GetIamPolicy {
8273        fn request_options(&mut self) -> &mut crate::RequestOptions {
8274            &mut self.0.options
8275        }
8276    }
8277
8278    /// The request builder for [KeyManagementService::test_iam_permissions][crate::client::KeyManagementService::test_iam_permissions] calls.
8279    ///
8280    /// # Example
8281    /// ```
8282    /// # use google_cloud_kms_v1::builder::key_management_service::TestIamPermissions;
8283    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8284    ///
8285    /// let builder = prepare_request_builder();
8286    /// let response = builder.send().await?;
8287    /// # Ok(()) }
8288    ///
8289    /// fn prepare_request_builder() -> TestIamPermissions {
8290    ///   # panic!();
8291    ///   // ... details omitted ...
8292    /// }
8293    /// ```
8294    #[derive(Clone, Debug)]
8295    pub struct TestIamPermissions(
8296        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
8297    );
8298
8299    impl TestIamPermissions {
8300        pub(crate) fn new(
8301            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8302        ) -> Self {
8303            Self(RequestBuilder::new(stub))
8304        }
8305
8306        /// Sets the full request, replacing any prior values.
8307        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
8308            mut self,
8309            v: V,
8310        ) -> Self {
8311            self.0.request = v.into();
8312            self
8313        }
8314
8315        /// Sets all the options, replacing any prior values.
8316        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8317            self.0.options = v.into();
8318            self
8319        }
8320
8321        /// Sends the request.
8322        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
8323            (*self.0.stub)
8324                .test_iam_permissions(self.0.request, self.0.options)
8325                .await
8326                .map(crate::Response::into_body)
8327        }
8328
8329        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
8330        ///
8331        /// This is a **required** field for requests.
8332        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8333            self.0.request.resource = v.into();
8334            self
8335        }
8336
8337        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
8338        ///
8339        /// This is a **required** field for requests.
8340        pub fn set_permissions<T, V>(mut self, v: T) -> Self
8341        where
8342            T: std::iter::IntoIterator<Item = V>,
8343            V: std::convert::Into<std::string::String>,
8344        {
8345            use std::iter::Iterator;
8346            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
8347            self
8348        }
8349    }
8350
8351    #[doc(hidden)]
8352    impl crate::RequestBuilder for TestIamPermissions {
8353        fn request_options(&mut self) -> &mut crate::RequestOptions {
8354            &mut self.0.options
8355        }
8356    }
8357
8358    /// The request builder for [KeyManagementService::get_operation][crate::client::KeyManagementService::get_operation] calls.
8359    ///
8360    /// # Example
8361    /// ```
8362    /// # use google_cloud_kms_v1::builder::key_management_service::GetOperation;
8363    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8364    ///
8365    /// let builder = prepare_request_builder();
8366    /// let response = builder.send().await?;
8367    /// # Ok(()) }
8368    ///
8369    /// fn prepare_request_builder() -> GetOperation {
8370    ///   # panic!();
8371    ///   // ... details omitted ...
8372    /// }
8373    /// ```
8374    #[derive(Clone, Debug)]
8375    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8376
8377    impl GetOperation {
8378        pub(crate) fn new(
8379            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8380        ) -> Self {
8381            Self(RequestBuilder::new(stub))
8382        }
8383
8384        /// Sets the full request, replacing any prior values.
8385        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8386            mut self,
8387            v: V,
8388        ) -> Self {
8389            self.0.request = v.into();
8390            self
8391        }
8392
8393        /// Sets all the options, replacing any prior values.
8394        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8395            self.0.options = v.into();
8396            self
8397        }
8398
8399        /// Sends the request.
8400        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8401            (*self.0.stub)
8402                .get_operation(self.0.request, self.0.options)
8403                .await
8404                .map(crate::Response::into_body)
8405        }
8406
8407        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
8408        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8409            self.0.request.name = v.into();
8410            self
8411        }
8412    }
8413
8414    #[doc(hidden)]
8415    impl crate::RequestBuilder for GetOperation {
8416        fn request_options(&mut self) -> &mut crate::RequestOptions {
8417            &mut self.0.options
8418        }
8419    }
8420}