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
5657    #[doc(hidden)]
5658    impl crate::RequestBuilder for CreateCryptoKey {
5659        fn request_options(&mut self) -> &mut crate::RequestOptions {
5660            &mut self.0.options
5661        }
5662    }
5663
5664    /// The request builder for [KeyManagementService::create_crypto_key_version][crate::client::KeyManagementService::create_crypto_key_version] calls.
5665    ///
5666    /// # Example
5667    /// ```
5668    /// # use google_cloud_kms_v1::builder::key_management_service::CreateCryptoKeyVersion;
5669    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5670    ///
5671    /// let builder = prepare_request_builder();
5672    /// let response = builder.send().await?;
5673    /// # Ok(()) }
5674    ///
5675    /// fn prepare_request_builder() -> CreateCryptoKeyVersion {
5676    ///   # panic!();
5677    ///   // ... details omitted ...
5678    /// }
5679    /// ```
5680    #[derive(Clone, Debug)]
5681    pub struct CreateCryptoKeyVersion(RequestBuilder<crate::model::CreateCryptoKeyVersionRequest>);
5682
5683    impl CreateCryptoKeyVersion {
5684        pub(crate) fn new(
5685            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5686        ) -> Self {
5687            Self(RequestBuilder::new(stub))
5688        }
5689
5690        /// Sets the full request, replacing any prior values.
5691        pub fn with_request<V: Into<crate::model::CreateCryptoKeyVersionRequest>>(
5692            mut self,
5693            v: V,
5694        ) -> Self {
5695            self.0.request = v.into();
5696            self
5697        }
5698
5699        /// Sets all the options, replacing any prior values.
5700        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5701            self.0.options = v.into();
5702            self
5703        }
5704
5705        /// Sends the request.
5706        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
5707            (*self.0.stub)
5708                .create_crypto_key_version(self.0.request, self.0.options)
5709                .await
5710                .map(crate::Response::into_body)
5711        }
5712
5713        /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
5714        ///
5715        /// This is a **required** field for requests.
5716        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5717            self.0.request.parent = v.into();
5718            self
5719        }
5720
5721        /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
5722        ///
5723        /// This is a **required** field for requests.
5724        pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
5725        where
5726            T: std::convert::Into<crate::model::CryptoKeyVersion>,
5727        {
5728            self.0.request.crypto_key_version = std::option::Option::Some(v.into());
5729            self
5730        }
5731
5732        /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
5733        ///
5734        /// This is a **required** field for requests.
5735        pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
5736        where
5737            T: std::convert::Into<crate::model::CryptoKeyVersion>,
5738        {
5739            self.0.request.crypto_key_version = v.map(|x| x.into());
5740            self
5741        }
5742    }
5743
5744    #[doc(hidden)]
5745    impl crate::RequestBuilder for CreateCryptoKeyVersion {
5746        fn request_options(&mut self) -> &mut crate::RequestOptions {
5747            &mut self.0.options
5748        }
5749    }
5750
5751    /// The request builder for [KeyManagementService::delete_crypto_key][crate::client::KeyManagementService::delete_crypto_key] calls.
5752    ///
5753    /// # Example
5754    /// ```
5755    /// # use google_cloud_kms_v1::builder::key_management_service::DeleteCryptoKey;
5756    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5757    /// use google_cloud_lro::Poller;
5758    ///
5759    /// let builder = prepare_request_builder();
5760    /// let response = builder.poller().until_done().await?;
5761    /// # Ok(()) }
5762    ///
5763    /// fn prepare_request_builder() -> DeleteCryptoKey {
5764    ///   # panic!();
5765    ///   // ... details omitted ...
5766    /// }
5767    /// ```
5768    #[derive(Clone, Debug)]
5769    pub struct DeleteCryptoKey(RequestBuilder<crate::model::DeleteCryptoKeyRequest>);
5770
5771    impl DeleteCryptoKey {
5772        pub(crate) fn new(
5773            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5774        ) -> Self {
5775            Self(RequestBuilder::new(stub))
5776        }
5777
5778        /// Sets the full request, replacing any prior values.
5779        pub fn with_request<V: Into<crate::model::DeleteCryptoKeyRequest>>(mut self, v: V) -> Self {
5780            self.0.request = v.into();
5781            self
5782        }
5783
5784        /// Sets all the options, replacing any prior values.
5785        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5786            self.0.options = v.into();
5787            self
5788        }
5789
5790        /// Sends the request.
5791        ///
5792        /// # Long running operations
5793        ///
5794        /// This starts, but does not poll, a longrunning operation. More information
5795        /// on [delete_crypto_key][crate::client::KeyManagementService::delete_crypto_key].
5796        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5797            (*self.0.stub)
5798                .delete_crypto_key(self.0.request, self.0.options)
5799                .await
5800                .map(crate::Response::into_body)
5801        }
5802
5803        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_crypto_key`.
5804        pub fn poller(
5805            self,
5806        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCryptoKeyMetadata> {
5807            type Operation = google_cloud_lro::internal::Operation<
5808                wkt::Empty,
5809                crate::model::DeleteCryptoKeyMetadata,
5810            >;
5811            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5812            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5813            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5814            if let Some(ref mut details) = poller_options.tracing {
5815                details.method_name = "google_cloud_kms_v1::client::KeyManagementService::delete_crypto_key::until_done";
5816            }
5817
5818            let stub = self.0.stub.clone();
5819            let mut options = self.0.options.clone();
5820            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5821            let query = move |name| {
5822                let stub = stub.clone();
5823                let options = options.clone();
5824                async {
5825                    let op = GetOperation::new(stub)
5826                        .set_name(name)
5827                        .with_options(options)
5828                        .send()
5829                        .await?;
5830                    Ok(Operation::new(op))
5831                }
5832            };
5833
5834            let start = move || async {
5835                let op = self.send().await?;
5836                Ok(Operation::new(op))
5837            };
5838
5839            use google_cloud_lro::internal::PollerExt;
5840            {
5841                google_cloud_lro::internal::new_unit_response_poller(
5842                    polling_error_policy,
5843                    polling_backoff_policy,
5844                    start,
5845                    query,
5846                )
5847            }
5848            .with_options(poller_options)
5849        }
5850
5851        /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
5852        ///
5853        /// This is a **required** field for requests.
5854        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5855            self.0.request.name = v.into();
5856            self
5857        }
5858    }
5859
5860    #[doc(hidden)]
5861    impl crate::RequestBuilder for DeleteCryptoKey {
5862        fn request_options(&mut self) -> &mut crate::RequestOptions {
5863            &mut self.0.options
5864        }
5865    }
5866
5867    /// The request builder for [KeyManagementService::delete_crypto_key_version][crate::client::KeyManagementService::delete_crypto_key_version] calls.
5868    ///
5869    /// # Example
5870    /// ```
5871    /// # use google_cloud_kms_v1::builder::key_management_service::DeleteCryptoKeyVersion;
5872    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5873    /// use google_cloud_lro::Poller;
5874    ///
5875    /// let builder = prepare_request_builder();
5876    /// let response = builder.poller().until_done().await?;
5877    /// # Ok(()) }
5878    ///
5879    /// fn prepare_request_builder() -> DeleteCryptoKeyVersion {
5880    ///   # panic!();
5881    ///   // ... details omitted ...
5882    /// }
5883    /// ```
5884    #[derive(Clone, Debug)]
5885    pub struct DeleteCryptoKeyVersion(RequestBuilder<crate::model::DeleteCryptoKeyVersionRequest>);
5886
5887    impl DeleteCryptoKeyVersion {
5888        pub(crate) fn new(
5889            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5890        ) -> Self {
5891            Self(RequestBuilder::new(stub))
5892        }
5893
5894        /// Sets the full request, replacing any prior values.
5895        pub fn with_request<V: Into<crate::model::DeleteCryptoKeyVersionRequest>>(
5896            mut self,
5897            v: V,
5898        ) -> Self {
5899            self.0.request = v.into();
5900            self
5901        }
5902
5903        /// Sets all the options, replacing any prior values.
5904        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5905            self.0.options = v.into();
5906            self
5907        }
5908
5909        /// Sends the request.
5910        ///
5911        /// # Long running operations
5912        ///
5913        /// This starts, but does not poll, a longrunning operation. More information
5914        /// on [delete_crypto_key_version][crate::client::KeyManagementService::delete_crypto_key_version].
5915        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5916            (*self.0.stub)
5917                .delete_crypto_key_version(self.0.request, self.0.options)
5918                .await
5919                .map(crate::Response::into_body)
5920        }
5921
5922        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_crypto_key_version`.
5923        pub fn poller(
5924            self,
5925        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCryptoKeyVersionMetadata>
5926        {
5927            type Operation = google_cloud_lro::internal::Operation<
5928                wkt::Empty,
5929                crate::model::DeleteCryptoKeyVersionMetadata,
5930            >;
5931            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5932            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5933            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5934            if let Some(ref mut details) = poller_options.tracing {
5935                details.method_name = "google_cloud_kms_v1::client::KeyManagementService::delete_crypto_key_version::until_done";
5936            }
5937
5938            let stub = self.0.stub.clone();
5939            let mut options = self.0.options.clone();
5940            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5941            let query = move |name| {
5942                let stub = stub.clone();
5943                let options = options.clone();
5944                async {
5945                    let op = GetOperation::new(stub)
5946                        .set_name(name)
5947                        .with_options(options)
5948                        .send()
5949                        .await?;
5950                    Ok(Operation::new(op))
5951                }
5952            };
5953
5954            let start = move || async {
5955                let op = self.send().await?;
5956                Ok(Operation::new(op))
5957            };
5958
5959            use google_cloud_lro::internal::PollerExt;
5960            {
5961                google_cloud_lro::internal::new_unit_response_poller(
5962                    polling_error_policy,
5963                    polling_backoff_policy,
5964                    start,
5965                    query,
5966                )
5967            }
5968            .with_options(poller_options)
5969        }
5970
5971        /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
5972        ///
5973        /// This is a **required** field for requests.
5974        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5975            self.0.request.name = v.into();
5976            self
5977        }
5978    }
5979
5980    #[doc(hidden)]
5981    impl crate::RequestBuilder for DeleteCryptoKeyVersion {
5982        fn request_options(&mut self) -> &mut crate::RequestOptions {
5983            &mut self.0.options
5984        }
5985    }
5986
5987    /// The request builder for [KeyManagementService::import_crypto_key_version][crate::client::KeyManagementService::import_crypto_key_version] calls.
5988    ///
5989    /// # Example
5990    /// ```
5991    /// # use google_cloud_kms_v1::builder::key_management_service::ImportCryptoKeyVersion;
5992    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
5993    ///
5994    /// let builder = prepare_request_builder();
5995    /// let response = builder.send().await?;
5996    /// # Ok(()) }
5997    ///
5998    /// fn prepare_request_builder() -> ImportCryptoKeyVersion {
5999    ///   # panic!();
6000    ///   // ... details omitted ...
6001    /// }
6002    /// ```
6003    #[derive(Clone, Debug)]
6004    pub struct ImportCryptoKeyVersion(RequestBuilder<crate::model::ImportCryptoKeyVersionRequest>);
6005
6006    impl ImportCryptoKeyVersion {
6007        pub(crate) fn new(
6008            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6009        ) -> Self {
6010            Self(RequestBuilder::new(stub))
6011        }
6012
6013        /// Sets the full request, replacing any prior values.
6014        pub fn with_request<V: Into<crate::model::ImportCryptoKeyVersionRequest>>(
6015            mut self,
6016            v: V,
6017        ) -> Self {
6018            self.0.request = v.into();
6019            self
6020        }
6021
6022        /// Sets all the options, replacing any prior values.
6023        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6024            self.0.options = v.into();
6025            self
6026        }
6027
6028        /// Sends the request.
6029        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6030            (*self.0.stub)
6031                .import_crypto_key_version(self.0.request, self.0.options)
6032                .await
6033                .map(crate::Response::into_body)
6034        }
6035
6036        /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
6037        ///
6038        /// This is a **required** field for requests.
6039        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6040            self.0.request.parent = v.into();
6041            self
6042        }
6043
6044        /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
6045        pub fn set_crypto_key_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
6046            self.0.request.crypto_key_version = v.into();
6047            self
6048        }
6049
6050        /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
6051        ///
6052        /// This is a **required** field for requests.
6053        pub fn set_algorithm<
6054            T: Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
6055        >(
6056            mut self,
6057            v: T,
6058        ) -> Self {
6059            self.0.request.algorithm = v.into();
6060            self
6061        }
6062
6063        /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
6064        ///
6065        /// This is a **required** field for requests.
6066        pub fn set_import_job<T: Into<std::string::String>>(mut self, v: T) -> Self {
6067            self.0.request.import_job = v.into();
6068            self
6069        }
6070
6071        /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
6072        pub fn set_wrapped_key<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6073            self.0.request.wrapped_key = v.into();
6074            self
6075        }
6076
6077        /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
6078        ///
6079        /// Note that all the setters affecting `wrapped_key_material` are
6080        /// mutually exclusive.
6081        pub fn set_wrapped_key_material<
6082            T: Into<Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>>,
6083        >(
6084            mut self,
6085            v: T,
6086        ) -> Self {
6087            self.0.request.wrapped_key_material = v.into();
6088            self
6089        }
6090
6091        /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
6092        /// to hold a `RsaAesWrappedKey`.
6093        ///
6094        /// Note that all the setters affecting `wrapped_key_material` are
6095        /// mutually exclusive.
6096        pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(
6097            mut self,
6098            v: T,
6099        ) -> Self {
6100            self.0.request = self.0.request.set_rsa_aes_wrapped_key(v);
6101            self
6102        }
6103    }
6104
6105    #[doc(hidden)]
6106    impl crate::RequestBuilder for ImportCryptoKeyVersion {
6107        fn request_options(&mut self) -> &mut crate::RequestOptions {
6108            &mut self.0.options
6109        }
6110    }
6111
6112    /// The request builder for [KeyManagementService::create_import_job][crate::client::KeyManagementService::create_import_job] calls.
6113    ///
6114    /// # Example
6115    /// ```
6116    /// # use google_cloud_kms_v1::builder::key_management_service::CreateImportJob;
6117    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6118    ///
6119    /// let builder = prepare_request_builder();
6120    /// let response = builder.send().await?;
6121    /// # Ok(()) }
6122    ///
6123    /// fn prepare_request_builder() -> CreateImportJob {
6124    ///   # panic!();
6125    ///   // ... details omitted ...
6126    /// }
6127    /// ```
6128    #[derive(Clone, Debug)]
6129    pub struct CreateImportJob(RequestBuilder<crate::model::CreateImportJobRequest>);
6130
6131    impl CreateImportJob {
6132        pub(crate) fn new(
6133            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6134        ) -> Self {
6135            Self(RequestBuilder::new(stub))
6136        }
6137
6138        /// Sets the full request, replacing any prior values.
6139        pub fn with_request<V: Into<crate::model::CreateImportJobRequest>>(mut self, v: V) -> Self {
6140            self.0.request = v.into();
6141            self
6142        }
6143
6144        /// Sets all the options, replacing any prior values.
6145        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6146            self.0.options = v.into();
6147            self
6148        }
6149
6150        /// Sends the request.
6151        pub async fn send(self) -> Result<crate::model::ImportJob> {
6152            (*self.0.stub)
6153                .create_import_job(self.0.request, self.0.options)
6154                .await
6155                .map(crate::Response::into_body)
6156        }
6157
6158        /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
6159        ///
6160        /// This is a **required** field for requests.
6161        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6162            self.0.request.parent = v.into();
6163            self
6164        }
6165
6166        /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
6167        ///
6168        /// This is a **required** field for requests.
6169        pub fn set_import_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6170            self.0.request.import_job_id = v.into();
6171            self
6172        }
6173
6174        /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
6175        ///
6176        /// This is a **required** field for requests.
6177        pub fn set_import_job<T>(mut self, v: T) -> Self
6178        where
6179            T: std::convert::Into<crate::model::ImportJob>,
6180        {
6181            self.0.request.import_job = std::option::Option::Some(v.into());
6182            self
6183        }
6184
6185        /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
6186        ///
6187        /// This is a **required** field for requests.
6188        pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
6189        where
6190            T: std::convert::Into<crate::model::ImportJob>,
6191        {
6192            self.0.request.import_job = v.map(|x| x.into());
6193            self
6194        }
6195    }
6196
6197    #[doc(hidden)]
6198    impl crate::RequestBuilder for CreateImportJob {
6199        fn request_options(&mut self) -> &mut crate::RequestOptions {
6200            &mut self.0.options
6201        }
6202    }
6203
6204    /// The request builder for [KeyManagementService::update_crypto_key][crate::client::KeyManagementService::update_crypto_key] calls.
6205    ///
6206    /// # Example
6207    /// ```
6208    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKey;
6209    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6210    ///
6211    /// let builder = prepare_request_builder();
6212    /// let response = builder.send().await?;
6213    /// # Ok(()) }
6214    ///
6215    /// fn prepare_request_builder() -> UpdateCryptoKey {
6216    ///   # panic!();
6217    ///   // ... details omitted ...
6218    /// }
6219    /// ```
6220    #[derive(Clone, Debug)]
6221    pub struct UpdateCryptoKey(RequestBuilder<crate::model::UpdateCryptoKeyRequest>);
6222
6223    impl UpdateCryptoKey {
6224        pub(crate) fn new(
6225            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6226        ) -> Self {
6227            Self(RequestBuilder::new(stub))
6228        }
6229
6230        /// Sets the full request, replacing any prior values.
6231        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyRequest>>(mut self, v: V) -> Self {
6232            self.0.request = v.into();
6233            self
6234        }
6235
6236        /// Sets all the options, replacing any prior values.
6237        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6238            self.0.options = v.into();
6239            self
6240        }
6241
6242        /// Sends the request.
6243        pub async fn send(self) -> Result<crate::model::CryptoKey> {
6244            (*self.0.stub)
6245                .update_crypto_key(self.0.request, self.0.options)
6246                .await
6247                .map(crate::Response::into_body)
6248        }
6249
6250        /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
6251        ///
6252        /// This is a **required** field for requests.
6253        pub fn set_crypto_key<T>(mut self, v: T) -> Self
6254        where
6255            T: std::convert::Into<crate::model::CryptoKey>,
6256        {
6257            self.0.request.crypto_key = std::option::Option::Some(v.into());
6258            self
6259        }
6260
6261        /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
6262        ///
6263        /// This is a **required** field for requests.
6264        pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
6265        where
6266            T: std::convert::Into<crate::model::CryptoKey>,
6267        {
6268            self.0.request.crypto_key = v.map(|x| x.into());
6269            self
6270        }
6271
6272        /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
6273        ///
6274        /// This is a **required** field for requests.
6275        pub fn set_update_mask<T>(mut self, v: T) -> Self
6276        where
6277            T: std::convert::Into<wkt::FieldMask>,
6278        {
6279            self.0.request.update_mask = std::option::Option::Some(v.into());
6280            self
6281        }
6282
6283        /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
6284        ///
6285        /// This is a **required** field for requests.
6286        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6287        where
6288            T: std::convert::Into<wkt::FieldMask>,
6289        {
6290            self.0.request.update_mask = v.map(|x| x.into());
6291            self
6292        }
6293    }
6294
6295    #[doc(hidden)]
6296    impl crate::RequestBuilder for UpdateCryptoKey {
6297        fn request_options(&mut self) -> &mut crate::RequestOptions {
6298            &mut self.0.options
6299        }
6300    }
6301
6302    /// The request builder for [KeyManagementService::update_crypto_key_version][crate::client::KeyManagementService::update_crypto_key_version] calls.
6303    ///
6304    /// # Example
6305    /// ```
6306    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKeyVersion;
6307    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6308    ///
6309    /// let builder = prepare_request_builder();
6310    /// let response = builder.send().await?;
6311    /// # Ok(()) }
6312    ///
6313    /// fn prepare_request_builder() -> UpdateCryptoKeyVersion {
6314    ///   # panic!();
6315    ///   // ... details omitted ...
6316    /// }
6317    /// ```
6318    #[derive(Clone, Debug)]
6319    pub struct UpdateCryptoKeyVersion(RequestBuilder<crate::model::UpdateCryptoKeyVersionRequest>);
6320
6321    impl UpdateCryptoKeyVersion {
6322        pub(crate) fn new(
6323            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6324        ) -> Self {
6325            Self(RequestBuilder::new(stub))
6326        }
6327
6328        /// Sets the full request, replacing any prior values.
6329        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyVersionRequest>>(
6330            mut self,
6331            v: V,
6332        ) -> Self {
6333            self.0.request = v.into();
6334            self
6335        }
6336
6337        /// Sets all the options, replacing any prior values.
6338        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6339            self.0.options = v.into();
6340            self
6341        }
6342
6343        /// Sends the request.
6344        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6345            (*self.0.stub)
6346                .update_crypto_key_version(self.0.request, self.0.options)
6347                .await
6348                .map(crate::Response::into_body)
6349        }
6350
6351        /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
6352        ///
6353        /// This is a **required** field for requests.
6354        pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
6355        where
6356            T: std::convert::Into<crate::model::CryptoKeyVersion>,
6357        {
6358            self.0.request.crypto_key_version = std::option::Option::Some(v.into());
6359            self
6360        }
6361
6362        /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
6363        ///
6364        /// This is a **required** field for requests.
6365        pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
6366        where
6367            T: std::convert::Into<crate::model::CryptoKeyVersion>,
6368        {
6369            self.0.request.crypto_key_version = v.map(|x| x.into());
6370            self
6371        }
6372
6373        /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
6374        ///
6375        /// This is a **required** field for requests.
6376        pub fn set_update_mask<T>(mut self, v: T) -> Self
6377        where
6378            T: std::convert::Into<wkt::FieldMask>,
6379        {
6380            self.0.request.update_mask = std::option::Option::Some(v.into());
6381            self
6382        }
6383
6384        /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
6385        ///
6386        /// This is a **required** field for requests.
6387        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6388        where
6389            T: std::convert::Into<wkt::FieldMask>,
6390        {
6391            self.0.request.update_mask = v.map(|x| x.into());
6392            self
6393        }
6394    }
6395
6396    #[doc(hidden)]
6397    impl crate::RequestBuilder for UpdateCryptoKeyVersion {
6398        fn request_options(&mut self) -> &mut crate::RequestOptions {
6399            &mut self.0.options
6400        }
6401    }
6402
6403    /// The request builder for [KeyManagementService::update_crypto_key_primary_version][crate::client::KeyManagementService::update_crypto_key_primary_version] calls.
6404    ///
6405    /// # Example
6406    /// ```
6407    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKeyPrimaryVersion;
6408    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6409    ///
6410    /// let builder = prepare_request_builder();
6411    /// let response = builder.send().await?;
6412    /// # Ok(()) }
6413    ///
6414    /// fn prepare_request_builder() -> UpdateCryptoKeyPrimaryVersion {
6415    ///   # panic!();
6416    ///   // ... details omitted ...
6417    /// }
6418    /// ```
6419    #[derive(Clone, Debug)]
6420    pub struct UpdateCryptoKeyPrimaryVersion(
6421        RequestBuilder<crate::model::UpdateCryptoKeyPrimaryVersionRequest>,
6422    );
6423
6424    impl UpdateCryptoKeyPrimaryVersion {
6425        pub(crate) fn new(
6426            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6427        ) -> Self {
6428            Self(RequestBuilder::new(stub))
6429        }
6430
6431        /// Sets the full request, replacing any prior values.
6432        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyPrimaryVersionRequest>>(
6433            mut self,
6434            v: V,
6435        ) -> Self {
6436            self.0.request = v.into();
6437            self
6438        }
6439
6440        /// Sets all the options, replacing any prior values.
6441        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6442            self.0.options = v.into();
6443            self
6444        }
6445
6446        /// Sends the request.
6447        pub async fn send(self) -> Result<crate::model::CryptoKey> {
6448            (*self.0.stub)
6449                .update_crypto_key_primary_version(self.0.request, self.0.options)
6450                .await
6451                .map(crate::Response::into_body)
6452        }
6453
6454        /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
6455        ///
6456        /// This is a **required** field for requests.
6457        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6458            self.0.request.name = v.into();
6459            self
6460        }
6461
6462        /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
6463        ///
6464        /// This is a **required** field for requests.
6465        pub fn set_crypto_key_version_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6466            self.0.request.crypto_key_version_id = v.into();
6467            self
6468        }
6469    }
6470
6471    #[doc(hidden)]
6472    impl crate::RequestBuilder for UpdateCryptoKeyPrimaryVersion {
6473        fn request_options(&mut self) -> &mut crate::RequestOptions {
6474            &mut self.0.options
6475        }
6476    }
6477
6478    /// The request builder for [KeyManagementService::destroy_crypto_key_version][crate::client::KeyManagementService::destroy_crypto_key_version] calls.
6479    ///
6480    /// # Example
6481    /// ```
6482    /// # use google_cloud_kms_v1::builder::key_management_service::DestroyCryptoKeyVersion;
6483    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6484    ///
6485    /// let builder = prepare_request_builder();
6486    /// let response = builder.send().await?;
6487    /// # Ok(()) }
6488    ///
6489    /// fn prepare_request_builder() -> DestroyCryptoKeyVersion {
6490    ///   # panic!();
6491    ///   // ... details omitted ...
6492    /// }
6493    /// ```
6494    #[derive(Clone, Debug)]
6495    pub struct DestroyCryptoKeyVersion(
6496        RequestBuilder<crate::model::DestroyCryptoKeyVersionRequest>,
6497    );
6498
6499    impl DestroyCryptoKeyVersion {
6500        pub(crate) fn new(
6501            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6502        ) -> Self {
6503            Self(RequestBuilder::new(stub))
6504        }
6505
6506        /// Sets the full request, replacing any prior values.
6507        pub fn with_request<V: Into<crate::model::DestroyCryptoKeyVersionRequest>>(
6508            mut self,
6509            v: V,
6510        ) -> Self {
6511            self.0.request = v.into();
6512            self
6513        }
6514
6515        /// Sets all the options, replacing any prior values.
6516        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6517            self.0.options = v.into();
6518            self
6519        }
6520
6521        /// Sends the request.
6522        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6523            (*self.0.stub)
6524                .destroy_crypto_key_version(self.0.request, self.0.options)
6525                .await
6526                .map(crate::Response::into_body)
6527        }
6528
6529        /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
6530        ///
6531        /// This is a **required** field for requests.
6532        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6533            self.0.request.name = v.into();
6534            self
6535        }
6536    }
6537
6538    #[doc(hidden)]
6539    impl crate::RequestBuilder for DestroyCryptoKeyVersion {
6540        fn request_options(&mut self) -> &mut crate::RequestOptions {
6541            &mut self.0.options
6542        }
6543    }
6544
6545    /// The request builder for [KeyManagementService::restore_crypto_key_version][crate::client::KeyManagementService::restore_crypto_key_version] calls.
6546    ///
6547    /// # Example
6548    /// ```
6549    /// # use google_cloud_kms_v1::builder::key_management_service::RestoreCryptoKeyVersion;
6550    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6551    ///
6552    /// let builder = prepare_request_builder();
6553    /// let response = builder.send().await?;
6554    /// # Ok(()) }
6555    ///
6556    /// fn prepare_request_builder() -> RestoreCryptoKeyVersion {
6557    ///   # panic!();
6558    ///   // ... details omitted ...
6559    /// }
6560    /// ```
6561    #[derive(Clone, Debug)]
6562    pub struct RestoreCryptoKeyVersion(
6563        RequestBuilder<crate::model::RestoreCryptoKeyVersionRequest>,
6564    );
6565
6566    impl RestoreCryptoKeyVersion {
6567        pub(crate) fn new(
6568            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6569        ) -> Self {
6570            Self(RequestBuilder::new(stub))
6571        }
6572
6573        /// Sets the full request, replacing any prior values.
6574        pub fn with_request<V: Into<crate::model::RestoreCryptoKeyVersionRequest>>(
6575            mut self,
6576            v: V,
6577        ) -> Self {
6578            self.0.request = v.into();
6579            self
6580        }
6581
6582        /// Sets all the options, replacing any prior values.
6583        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6584            self.0.options = v.into();
6585            self
6586        }
6587
6588        /// Sends the request.
6589        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
6590            (*self.0.stub)
6591                .restore_crypto_key_version(self.0.request, self.0.options)
6592                .await
6593                .map(crate::Response::into_body)
6594        }
6595
6596        /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
6597        ///
6598        /// This is a **required** field for requests.
6599        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6600            self.0.request.name = v.into();
6601            self
6602        }
6603    }
6604
6605    #[doc(hidden)]
6606    impl crate::RequestBuilder for RestoreCryptoKeyVersion {
6607        fn request_options(&mut self) -> &mut crate::RequestOptions {
6608            &mut self.0.options
6609        }
6610    }
6611
6612    /// The request builder for [KeyManagementService::encrypt][crate::client::KeyManagementService::encrypt] calls.
6613    ///
6614    /// # Example
6615    /// ```
6616    /// # use google_cloud_kms_v1::builder::key_management_service::Encrypt;
6617    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6618    ///
6619    /// let builder = prepare_request_builder();
6620    /// let response = builder.send().await?;
6621    /// # Ok(()) }
6622    ///
6623    /// fn prepare_request_builder() -> Encrypt {
6624    ///   # panic!();
6625    ///   // ... details omitted ...
6626    /// }
6627    /// ```
6628    #[derive(Clone, Debug)]
6629    pub struct Encrypt(RequestBuilder<crate::model::EncryptRequest>);
6630
6631    impl Encrypt {
6632        pub(crate) fn new(
6633            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6634        ) -> Self {
6635            Self(RequestBuilder::new(stub))
6636        }
6637
6638        /// Sets the full request, replacing any prior values.
6639        pub fn with_request<V: Into<crate::model::EncryptRequest>>(mut self, v: V) -> Self {
6640            self.0.request = v.into();
6641            self
6642        }
6643
6644        /// Sets all the options, replacing any prior values.
6645        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6646            self.0.options = v.into();
6647            self
6648        }
6649
6650        /// Sends the request.
6651        pub async fn send(self) -> Result<crate::model::EncryptResponse> {
6652            (*self.0.stub)
6653                .encrypt(self.0.request, self.0.options)
6654                .await
6655                .map(crate::Response::into_body)
6656        }
6657
6658        /// Sets the value of [name][crate::model::EncryptRequest::name].
6659        ///
6660        /// This is a **required** field for requests.
6661        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6662            self.0.request.name = v.into();
6663            self
6664        }
6665
6666        /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
6667        ///
6668        /// This is a **required** field for requests.
6669        pub fn set_plaintext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6670            self.0.request.plaintext = v.into();
6671            self
6672        }
6673
6674        /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
6675        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6676            self.0.request.additional_authenticated_data = v.into();
6677            self
6678        }
6679
6680        /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
6681        pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
6682        where
6683            T: std::convert::Into<wkt::Int64Value>,
6684        {
6685            self.0.request.plaintext_crc32c = std::option::Option::Some(v.into());
6686            self
6687        }
6688
6689        /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
6690        pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
6691        where
6692            T: std::convert::Into<wkt::Int64Value>,
6693        {
6694            self.0.request.plaintext_crc32c = v.map(|x| x.into());
6695            self
6696        }
6697
6698        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
6699        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
6700        where
6701            T: std::convert::Into<wkt::Int64Value>,
6702        {
6703            self.0.request.additional_authenticated_data_crc32c =
6704                std::option::Option::Some(v.into());
6705            self
6706        }
6707
6708        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
6709        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
6710            mut self,
6711            v: std::option::Option<T>,
6712        ) -> Self
6713        where
6714            T: std::convert::Into<wkt::Int64Value>,
6715        {
6716            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
6717            self
6718        }
6719    }
6720
6721    #[doc(hidden)]
6722    impl crate::RequestBuilder for Encrypt {
6723        fn request_options(&mut self) -> &mut crate::RequestOptions {
6724            &mut self.0.options
6725        }
6726    }
6727
6728    /// The request builder for [KeyManagementService::decrypt][crate::client::KeyManagementService::decrypt] calls.
6729    ///
6730    /// # Example
6731    /// ```
6732    /// # use google_cloud_kms_v1::builder::key_management_service::Decrypt;
6733    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6734    ///
6735    /// let builder = prepare_request_builder();
6736    /// let response = builder.send().await?;
6737    /// # Ok(()) }
6738    ///
6739    /// fn prepare_request_builder() -> Decrypt {
6740    ///   # panic!();
6741    ///   // ... details omitted ...
6742    /// }
6743    /// ```
6744    #[derive(Clone, Debug)]
6745    pub struct Decrypt(RequestBuilder<crate::model::DecryptRequest>);
6746
6747    impl Decrypt {
6748        pub(crate) fn new(
6749            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6750        ) -> Self {
6751            Self(RequestBuilder::new(stub))
6752        }
6753
6754        /// Sets the full request, replacing any prior values.
6755        pub fn with_request<V: Into<crate::model::DecryptRequest>>(mut self, v: V) -> Self {
6756            self.0.request = v.into();
6757            self
6758        }
6759
6760        /// Sets all the options, replacing any prior values.
6761        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6762            self.0.options = v.into();
6763            self
6764        }
6765
6766        /// Sends the request.
6767        pub async fn send(self) -> Result<crate::model::DecryptResponse> {
6768            (*self.0.stub)
6769                .decrypt(self.0.request, self.0.options)
6770                .await
6771                .map(crate::Response::into_body)
6772        }
6773
6774        /// Sets the value of [name][crate::model::DecryptRequest::name].
6775        ///
6776        /// This is a **required** field for requests.
6777        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6778            self.0.request.name = v.into();
6779            self
6780        }
6781
6782        /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
6783        ///
6784        /// This is a **required** field for requests.
6785        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6786            self.0.request.ciphertext = v.into();
6787            self
6788        }
6789
6790        /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
6791        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6792            self.0.request.additional_authenticated_data = v.into();
6793            self
6794        }
6795
6796        /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
6797        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
6798        where
6799            T: std::convert::Into<wkt::Int64Value>,
6800        {
6801            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
6802            self
6803        }
6804
6805        /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
6806        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
6807        where
6808            T: std::convert::Into<wkt::Int64Value>,
6809        {
6810            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
6811            self
6812        }
6813
6814        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
6815        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
6816        where
6817            T: std::convert::Into<wkt::Int64Value>,
6818        {
6819            self.0.request.additional_authenticated_data_crc32c =
6820                std::option::Option::Some(v.into());
6821            self
6822        }
6823
6824        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
6825        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
6826            mut self,
6827            v: std::option::Option<T>,
6828        ) -> Self
6829        where
6830            T: std::convert::Into<wkt::Int64Value>,
6831        {
6832            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
6833            self
6834        }
6835    }
6836
6837    #[doc(hidden)]
6838    impl crate::RequestBuilder for Decrypt {
6839        fn request_options(&mut self) -> &mut crate::RequestOptions {
6840            &mut self.0.options
6841        }
6842    }
6843
6844    /// The request builder for [KeyManagementService::raw_encrypt][crate::client::KeyManagementService::raw_encrypt] calls.
6845    ///
6846    /// # Example
6847    /// ```
6848    /// # use google_cloud_kms_v1::builder::key_management_service::RawEncrypt;
6849    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6850    ///
6851    /// let builder = prepare_request_builder();
6852    /// let response = builder.send().await?;
6853    /// # Ok(()) }
6854    ///
6855    /// fn prepare_request_builder() -> RawEncrypt {
6856    ///   # panic!();
6857    ///   // ... details omitted ...
6858    /// }
6859    /// ```
6860    #[derive(Clone, Debug)]
6861    pub struct RawEncrypt(RequestBuilder<crate::model::RawEncryptRequest>);
6862
6863    impl RawEncrypt {
6864        pub(crate) fn new(
6865            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6866        ) -> Self {
6867            Self(RequestBuilder::new(stub))
6868        }
6869
6870        /// Sets the full request, replacing any prior values.
6871        pub fn with_request<V: Into<crate::model::RawEncryptRequest>>(mut self, v: V) -> Self {
6872            self.0.request = v.into();
6873            self
6874        }
6875
6876        /// Sets all the options, replacing any prior values.
6877        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6878            self.0.options = v.into();
6879            self
6880        }
6881
6882        /// Sends the request.
6883        pub async fn send(self) -> Result<crate::model::RawEncryptResponse> {
6884            (*self.0.stub)
6885                .raw_encrypt(self.0.request, self.0.options)
6886                .await
6887                .map(crate::Response::into_body)
6888        }
6889
6890        /// Sets the value of [name][crate::model::RawEncryptRequest::name].
6891        ///
6892        /// This is a **required** field for requests.
6893        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6894            self.0.request.name = v.into();
6895            self
6896        }
6897
6898        /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
6899        ///
6900        /// This is a **required** field for requests.
6901        pub fn set_plaintext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6902            self.0.request.plaintext = v.into();
6903            self
6904        }
6905
6906        /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
6907        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6908            self.0.request.additional_authenticated_data = v.into();
6909            self
6910        }
6911
6912        /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
6913        pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
6914        where
6915            T: std::convert::Into<wkt::Int64Value>,
6916        {
6917            self.0.request.plaintext_crc32c = std::option::Option::Some(v.into());
6918            self
6919        }
6920
6921        /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
6922        pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
6923        where
6924            T: std::convert::Into<wkt::Int64Value>,
6925        {
6926            self.0.request.plaintext_crc32c = v.map(|x| x.into());
6927            self
6928        }
6929
6930        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
6931        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
6932        where
6933            T: std::convert::Into<wkt::Int64Value>,
6934        {
6935            self.0.request.additional_authenticated_data_crc32c =
6936                std::option::Option::Some(v.into());
6937            self
6938        }
6939
6940        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
6941        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
6942            mut self,
6943            v: std::option::Option<T>,
6944        ) -> Self
6945        where
6946            T: std::convert::Into<wkt::Int64Value>,
6947        {
6948            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
6949            self
6950        }
6951
6952        /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
6953        pub fn set_initialization_vector<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6954            self.0.request.initialization_vector = v.into();
6955            self
6956        }
6957
6958        /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
6959        pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
6960        where
6961            T: std::convert::Into<wkt::Int64Value>,
6962        {
6963            self.0.request.initialization_vector_crc32c = std::option::Option::Some(v.into());
6964            self
6965        }
6966
6967        /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
6968        pub fn set_or_clear_initialization_vector_crc32c<T>(
6969            mut self,
6970            v: std::option::Option<T>,
6971        ) -> Self
6972        where
6973            T: std::convert::Into<wkt::Int64Value>,
6974        {
6975            self.0.request.initialization_vector_crc32c = v.map(|x| x.into());
6976            self
6977        }
6978    }
6979
6980    #[doc(hidden)]
6981    impl crate::RequestBuilder for RawEncrypt {
6982        fn request_options(&mut self) -> &mut crate::RequestOptions {
6983            &mut self.0.options
6984        }
6985    }
6986
6987    /// The request builder for [KeyManagementService::raw_decrypt][crate::client::KeyManagementService::raw_decrypt] calls.
6988    ///
6989    /// # Example
6990    /// ```
6991    /// # use google_cloud_kms_v1::builder::key_management_service::RawDecrypt;
6992    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
6993    ///
6994    /// let builder = prepare_request_builder();
6995    /// let response = builder.send().await?;
6996    /// # Ok(()) }
6997    ///
6998    /// fn prepare_request_builder() -> RawDecrypt {
6999    ///   # panic!();
7000    ///   // ... details omitted ...
7001    /// }
7002    /// ```
7003    #[derive(Clone, Debug)]
7004    pub struct RawDecrypt(RequestBuilder<crate::model::RawDecryptRequest>);
7005
7006    impl RawDecrypt {
7007        pub(crate) fn new(
7008            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7009        ) -> Self {
7010            Self(RequestBuilder::new(stub))
7011        }
7012
7013        /// Sets the full request, replacing any prior values.
7014        pub fn with_request<V: Into<crate::model::RawDecryptRequest>>(mut self, v: V) -> Self {
7015            self.0.request = v.into();
7016            self
7017        }
7018
7019        /// Sets all the options, replacing any prior values.
7020        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7021            self.0.options = v.into();
7022            self
7023        }
7024
7025        /// Sends the request.
7026        pub async fn send(self) -> Result<crate::model::RawDecryptResponse> {
7027            (*self.0.stub)
7028                .raw_decrypt(self.0.request, self.0.options)
7029                .await
7030                .map(crate::Response::into_body)
7031        }
7032
7033        /// Sets the value of [name][crate::model::RawDecryptRequest::name].
7034        ///
7035        /// This is a **required** field for requests.
7036        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7037            self.0.request.name = v.into();
7038            self
7039        }
7040
7041        /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
7042        ///
7043        /// This is a **required** field for requests.
7044        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7045            self.0.request.ciphertext = v.into();
7046            self
7047        }
7048
7049        /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
7050        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7051            self.0.request.additional_authenticated_data = v.into();
7052            self
7053        }
7054
7055        /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
7056        ///
7057        /// This is a **required** field for requests.
7058        pub fn set_initialization_vector<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7059            self.0.request.initialization_vector = v.into();
7060            self
7061        }
7062
7063        /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
7064        pub fn set_tag_length<T: Into<i32>>(mut self, v: T) -> Self {
7065            self.0.request.tag_length = v.into();
7066            self
7067        }
7068
7069        /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
7070        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7071        where
7072            T: std::convert::Into<wkt::Int64Value>,
7073        {
7074            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
7075            self
7076        }
7077
7078        /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
7079        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7080        where
7081            T: std::convert::Into<wkt::Int64Value>,
7082        {
7083            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
7084            self
7085        }
7086
7087        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
7088        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7089        where
7090            T: std::convert::Into<wkt::Int64Value>,
7091        {
7092            self.0.request.additional_authenticated_data_crc32c =
7093                std::option::Option::Some(v.into());
7094            self
7095        }
7096
7097        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
7098        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7099            mut self,
7100            v: std::option::Option<T>,
7101        ) -> Self
7102        where
7103            T: std::convert::Into<wkt::Int64Value>,
7104        {
7105            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
7106            self
7107        }
7108
7109        /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
7110        pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
7111        where
7112            T: std::convert::Into<wkt::Int64Value>,
7113        {
7114            self.0.request.initialization_vector_crc32c = std::option::Option::Some(v.into());
7115            self
7116        }
7117
7118        /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
7119        pub fn set_or_clear_initialization_vector_crc32c<T>(
7120            mut self,
7121            v: std::option::Option<T>,
7122        ) -> Self
7123        where
7124            T: std::convert::Into<wkt::Int64Value>,
7125        {
7126            self.0.request.initialization_vector_crc32c = v.map(|x| x.into());
7127            self
7128        }
7129    }
7130
7131    #[doc(hidden)]
7132    impl crate::RequestBuilder for RawDecrypt {
7133        fn request_options(&mut self) -> &mut crate::RequestOptions {
7134            &mut self.0.options
7135        }
7136    }
7137
7138    /// The request builder for [KeyManagementService::asymmetric_sign][crate::client::KeyManagementService::asymmetric_sign] calls.
7139    ///
7140    /// # Example
7141    /// ```
7142    /// # use google_cloud_kms_v1::builder::key_management_service::AsymmetricSign;
7143    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7144    ///
7145    /// let builder = prepare_request_builder();
7146    /// let response = builder.send().await?;
7147    /// # Ok(()) }
7148    ///
7149    /// fn prepare_request_builder() -> AsymmetricSign {
7150    ///   # panic!();
7151    ///   // ... details omitted ...
7152    /// }
7153    /// ```
7154    #[derive(Clone, Debug)]
7155    pub struct AsymmetricSign(RequestBuilder<crate::model::AsymmetricSignRequest>);
7156
7157    impl AsymmetricSign {
7158        pub(crate) fn new(
7159            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7160        ) -> Self {
7161            Self(RequestBuilder::new(stub))
7162        }
7163
7164        /// Sets the full request, replacing any prior values.
7165        pub fn with_request<V: Into<crate::model::AsymmetricSignRequest>>(mut self, v: V) -> Self {
7166            self.0.request = v.into();
7167            self
7168        }
7169
7170        /// Sets all the options, replacing any prior values.
7171        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7172            self.0.options = v.into();
7173            self
7174        }
7175
7176        /// Sends the request.
7177        pub async fn send(self) -> Result<crate::model::AsymmetricSignResponse> {
7178            (*self.0.stub)
7179                .asymmetric_sign(self.0.request, self.0.options)
7180                .await
7181                .map(crate::Response::into_body)
7182        }
7183
7184        /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
7185        ///
7186        /// This is a **required** field for requests.
7187        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7188            self.0.request.name = v.into();
7189            self
7190        }
7191
7192        /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
7193        pub fn set_digest<T>(mut self, v: T) -> Self
7194        where
7195            T: std::convert::Into<crate::model::Digest>,
7196        {
7197            self.0.request.digest = std::option::Option::Some(v.into());
7198            self
7199        }
7200
7201        /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
7202        pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
7203        where
7204            T: std::convert::Into<crate::model::Digest>,
7205        {
7206            self.0.request.digest = v.map(|x| x.into());
7207            self
7208        }
7209
7210        /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
7211        pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
7212        where
7213            T: std::convert::Into<wkt::Int64Value>,
7214        {
7215            self.0.request.digest_crc32c = std::option::Option::Some(v.into());
7216            self
7217        }
7218
7219        /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
7220        pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7221        where
7222            T: std::convert::Into<wkt::Int64Value>,
7223        {
7224            self.0.request.digest_crc32c = v.map(|x| x.into());
7225            self
7226        }
7227
7228        /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
7229        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7230            self.0.request.data = v.into();
7231            self
7232        }
7233
7234        /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
7235        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
7236        where
7237            T: std::convert::Into<wkt::Int64Value>,
7238        {
7239            self.0.request.data_crc32c = std::option::Option::Some(v.into());
7240            self
7241        }
7242
7243        /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
7244        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7245        where
7246            T: std::convert::Into<wkt::Int64Value>,
7247        {
7248            self.0.request.data_crc32c = v.map(|x| x.into());
7249            self
7250        }
7251    }
7252
7253    #[doc(hidden)]
7254    impl crate::RequestBuilder for AsymmetricSign {
7255        fn request_options(&mut self) -> &mut crate::RequestOptions {
7256            &mut self.0.options
7257        }
7258    }
7259
7260    /// The request builder for [KeyManagementService::asymmetric_decrypt][crate::client::KeyManagementService::asymmetric_decrypt] calls.
7261    ///
7262    /// # Example
7263    /// ```
7264    /// # use google_cloud_kms_v1::builder::key_management_service::AsymmetricDecrypt;
7265    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7266    ///
7267    /// let builder = prepare_request_builder();
7268    /// let response = builder.send().await?;
7269    /// # Ok(()) }
7270    ///
7271    /// fn prepare_request_builder() -> AsymmetricDecrypt {
7272    ///   # panic!();
7273    ///   // ... details omitted ...
7274    /// }
7275    /// ```
7276    #[derive(Clone, Debug)]
7277    pub struct AsymmetricDecrypt(RequestBuilder<crate::model::AsymmetricDecryptRequest>);
7278
7279    impl AsymmetricDecrypt {
7280        pub(crate) fn new(
7281            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7282        ) -> Self {
7283            Self(RequestBuilder::new(stub))
7284        }
7285
7286        /// Sets the full request, replacing any prior values.
7287        pub fn with_request<V: Into<crate::model::AsymmetricDecryptRequest>>(
7288            mut self,
7289            v: V,
7290        ) -> Self {
7291            self.0.request = v.into();
7292            self
7293        }
7294
7295        /// Sets all the options, replacing any prior values.
7296        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7297            self.0.options = v.into();
7298            self
7299        }
7300
7301        /// Sends the request.
7302        pub async fn send(self) -> Result<crate::model::AsymmetricDecryptResponse> {
7303            (*self.0.stub)
7304                .asymmetric_decrypt(self.0.request, self.0.options)
7305                .await
7306                .map(crate::Response::into_body)
7307        }
7308
7309        /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
7310        ///
7311        /// This is a **required** field for requests.
7312        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7313            self.0.request.name = v.into();
7314            self
7315        }
7316
7317        /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
7318        ///
7319        /// This is a **required** field for requests.
7320        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7321            self.0.request.ciphertext = v.into();
7322            self
7323        }
7324
7325        /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
7326        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7327        where
7328            T: std::convert::Into<wkt::Int64Value>,
7329        {
7330            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
7331            self
7332        }
7333
7334        /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
7335        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7336        where
7337            T: std::convert::Into<wkt::Int64Value>,
7338        {
7339            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
7340            self
7341        }
7342    }
7343
7344    #[doc(hidden)]
7345    impl crate::RequestBuilder for AsymmetricDecrypt {
7346        fn request_options(&mut self) -> &mut crate::RequestOptions {
7347            &mut self.0.options
7348        }
7349    }
7350
7351    /// The request builder for [KeyManagementService::mac_sign][crate::client::KeyManagementService::mac_sign] calls.
7352    ///
7353    /// # Example
7354    /// ```
7355    /// # use google_cloud_kms_v1::builder::key_management_service::MacSign;
7356    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7357    ///
7358    /// let builder = prepare_request_builder();
7359    /// let response = builder.send().await?;
7360    /// # Ok(()) }
7361    ///
7362    /// fn prepare_request_builder() -> MacSign {
7363    ///   # panic!();
7364    ///   // ... details omitted ...
7365    /// }
7366    /// ```
7367    #[derive(Clone, Debug)]
7368    pub struct MacSign(RequestBuilder<crate::model::MacSignRequest>);
7369
7370    impl MacSign {
7371        pub(crate) fn new(
7372            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7373        ) -> Self {
7374            Self(RequestBuilder::new(stub))
7375        }
7376
7377        /// Sets the full request, replacing any prior values.
7378        pub fn with_request<V: Into<crate::model::MacSignRequest>>(mut self, v: V) -> Self {
7379            self.0.request = v.into();
7380            self
7381        }
7382
7383        /// Sets all the options, replacing any prior values.
7384        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7385            self.0.options = v.into();
7386            self
7387        }
7388
7389        /// Sends the request.
7390        pub async fn send(self) -> Result<crate::model::MacSignResponse> {
7391            (*self.0.stub)
7392                .mac_sign(self.0.request, self.0.options)
7393                .await
7394                .map(crate::Response::into_body)
7395        }
7396
7397        /// Sets the value of [name][crate::model::MacSignRequest::name].
7398        ///
7399        /// This is a **required** field for requests.
7400        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7401            self.0.request.name = v.into();
7402            self
7403        }
7404
7405        /// Sets the value of [data][crate::model::MacSignRequest::data].
7406        ///
7407        /// This is a **required** field for requests.
7408        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7409            self.0.request.data = v.into();
7410            self
7411        }
7412
7413        /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
7414        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
7415        where
7416            T: std::convert::Into<wkt::Int64Value>,
7417        {
7418            self.0.request.data_crc32c = std::option::Option::Some(v.into());
7419            self
7420        }
7421
7422        /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
7423        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7424        where
7425            T: std::convert::Into<wkt::Int64Value>,
7426        {
7427            self.0.request.data_crc32c = v.map(|x| x.into());
7428            self
7429        }
7430    }
7431
7432    #[doc(hidden)]
7433    impl crate::RequestBuilder for MacSign {
7434        fn request_options(&mut self) -> &mut crate::RequestOptions {
7435            &mut self.0.options
7436        }
7437    }
7438
7439    /// The request builder for [KeyManagementService::mac_verify][crate::client::KeyManagementService::mac_verify] calls.
7440    ///
7441    /// # Example
7442    /// ```
7443    /// # use google_cloud_kms_v1::builder::key_management_service::MacVerify;
7444    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7445    ///
7446    /// let builder = prepare_request_builder();
7447    /// let response = builder.send().await?;
7448    /// # Ok(()) }
7449    ///
7450    /// fn prepare_request_builder() -> MacVerify {
7451    ///   # panic!();
7452    ///   // ... details omitted ...
7453    /// }
7454    /// ```
7455    #[derive(Clone, Debug)]
7456    pub struct MacVerify(RequestBuilder<crate::model::MacVerifyRequest>);
7457
7458    impl MacVerify {
7459        pub(crate) fn new(
7460            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7461        ) -> Self {
7462            Self(RequestBuilder::new(stub))
7463        }
7464
7465        /// Sets the full request, replacing any prior values.
7466        pub fn with_request<V: Into<crate::model::MacVerifyRequest>>(mut self, v: V) -> Self {
7467            self.0.request = v.into();
7468            self
7469        }
7470
7471        /// Sets all the options, replacing any prior values.
7472        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7473            self.0.options = v.into();
7474            self
7475        }
7476
7477        /// Sends the request.
7478        pub async fn send(self) -> Result<crate::model::MacVerifyResponse> {
7479            (*self.0.stub)
7480                .mac_verify(self.0.request, self.0.options)
7481                .await
7482                .map(crate::Response::into_body)
7483        }
7484
7485        /// Sets the value of [name][crate::model::MacVerifyRequest::name].
7486        ///
7487        /// This is a **required** field for requests.
7488        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7489            self.0.request.name = v.into();
7490            self
7491        }
7492
7493        /// Sets the value of [data][crate::model::MacVerifyRequest::data].
7494        ///
7495        /// This is a **required** field for requests.
7496        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7497            self.0.request.data = v.into();
7498            self
7499        }
7500
7501        /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
7502        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
7503        where
7504            T: std::convert::Into<wkt::Int64Value>,
7505        {
7506            self.0.request.data_crc32c = std::option::Option::Some(v.into());
7507            self
7508        }
7509
7510        /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
7511        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7512        where
7513            T: std::convert::Into<wkt::Int64Value>,
7514        {
7515            self.0.request.data_crc32c = v.map(|x| x.into());
7516            self
7517        }
7518
7519        /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
7520        ///
7521        /// This is a **required** field for requests.
7522        pub fn set_mac<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7523            self.0.request.mac = v.into();
7524            self
7525        }
7526
7527        /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
7528        pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
7529        where
7530            T: std::convert::Into<wkt::Int64Value>,
7531        {
7532            self.0.request.mac_crc32c = std::option::Option::Some(v.into());
7533            self
7534        }
7535
7536        /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
7537        pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7538        where
7539            T: std::convert::Into<wkt::Int64Value>,
7540        {
7541            self.0.request.mac_crc32c = v.map(|x| x.into());
7542            self
7543        }
7544    }
7545
7546    #[doc(hidden)]
7547    impl crate::RequestBuilder for MacVerify {
7548        fn request_options(&mut self) -> &mut crate::RequestOptions {
7549            &mut self.0.options
7550        }
7551    }
7552
7553    /// The request builder for [KeyManagementService::decapsulate][crate::client::KeyManagementService::decapsulate] calls.
7554    ///
7555    /// # Example
7556    /// ```
7557    /// # use google_cloud_kms_v1::builder::key_management_service::Decapsulate;
7558    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7559    ///
7560    /// let builder = prepare_request_builder();
7561    /// let response = builder.send().await?;
7562    /// # Ok(()) }
7563    ///
7564    /// fn prepare_request_builder() -> Decapsulate {
7565    ///   # panic!();
7566    ///   // ... details omitted ...
7567    /// }
7568    /// ```
7569    #[derive(Clone, Debug)]
7570    pub struct Decapsulate(RequestBuilder<crate::model::DecapsulateRequest>);
7571
7572    impl Decapsulate {
7573        pub(crate) fn new(
7574            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7575        ) -> Self {
7576            Self(RequestBuilder::new(stub))
7577        }
7578
7579        /// Sets the full request, replacing any prior values.
7580        pub fn with_request<V: Into<crate::model::DecapsulateRequest>>(mut self, v: V) -> Self {
7581            self.0.request = v.into();
7582            self
7583        }
7584
7585        /// Sets all the options, replacing any prior values.
7586        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7587            self.0.options = v.into();
7588            self
7589        }
7590
7591        /// Sends the request.
7592        pub async fn send(self) -> Result<crate::model::DecapsulateResponse> {
7593            (*self.0.stub)
7594                .decapsulate(self.0.request, self.0.options)
7595                .await
7596                .map(crate::Response::into_body)
7597        }
7598
7599        /// Sets the value of [name][crate::model::DecapsulateRequest::name].
7600        ///
7601        /// This is a **required** field for requests.
7602        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7603            self.0.request.name = v.into();
7604            self
7605        }
7606
7607        /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
7608        ///
7609        /// This is a **required** field for requests.
7610        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7611            self.0.request.ciphertext = v.into();
7612            self
7613        }
7614
7615        /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
7616        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7617        where
7618            T: std::convert::Into<wkt::Int64Value>,
7619        {
7620            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
7621            self
7622        }
7623
7624        /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
7625        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7626        where
7627            T: std::convert::Into<wkt::Int64Value>,
7628        {
7629            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
7630            self
7631        }
7632    }
7633
7634    #[doc(hidden)]
7635    impl crate::RequestBuilder for Decapsulate {
7636        fn request_options(&mut self) -> &mut crate::RequestOptions {
7637            &mut self.0.options
7638        }
7639    }
7640
7641    /// The request builder for [KeyManagementService::generate_random_bytes][crate::client::KeyManagementService::generate_random_bytes] calls.
7642    ///
7643    /// # Example
7644    /// ```
7645    /// # use google_cloud_kms_v1::builder::key_management_service::GenerateRandomBytes;
7646    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7647    ///
7648    /// let builder = prepare_request_builder();
7649    /// let response = builder.send().await?;
7650    /// # Ok(()) }
7651    ///
7652    /// fn prepare_request_builder() -> GenerateRandomBytes {
7653    ///   # panic!();
7654    ///   // ... details omitted ...
7655    /// }
7656    /// ```
7657    #[derive(Clone, Debug)]
7658    pub struct GenerateRandomBytes(RequestBuilder<crate::model::GenerateRandomBytesRequest>);
7659
7660    impl GenerateRandomBytes {
7661        pub(crate) fn new(
7662            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7663        ) -> Self {
7664            Self(RequestBuilder::new(stub))
7665        }
7666
7667        /// Sets the full request, replacing any prior values.
7668        pub fn with_request<V: Into<crate::model::GenerateRandomBytesRequest>>(
7669            mut self,
7670            v: V,
7671        ) -> Self {
7672            self.0.request = v.into();
7673            self
7674        }
7675
7676        /// Sets all the options, replacing any prior values.
7677        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7678            self.0.options = v.into();
7679            self
7680        }
7681
7682        /// Sends the request.
7683        pub async fn send(self) -> Result<crate::model::GenerateRandomBytesResponse> {
7684            (*self.0.stub)
7685                .generate_random_bytes(self.0.request, self.0.options)
7686                .await
7687                .map(crate::Response::into_body)
7688        }
7689
7690        /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
7691        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7692            self.0.request.location = v.into();
7693            self
7694        }
7695
7696        /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
7697        pub fn set_length_bytes<T: Into<i32>>(mut self, v: T) -> Self {
7698            self.0.request.length_bytes = v.into();
7699            self
7700        }
7701
7702        /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
7703        pub fn set_protection_level<T: Into<crate::model::ProtectionLevel>>(
7704            mut self,
7705            v: T,
7706        ) -> Self {
7707            self.0.request.protection_level = v.into();
7708            self
7709        }
7710    }
7711
7712    #[doc(hidden)]
7713    impl crate::RequestBuilder for GenerateRandomBytes {
7714        fn request_options(&mut self) -> &mut crate::RequestOptions {
7715            &mut self.0.options
7716        }
7717    }
7718
7719    /// The request builder for [KeyManagementService::list_locations][crate::client::KeyManagementService::list_locations] calls.
7720    ///
7721    /// # Example
7722    /// ```
7723    /// # use google_cloud_kms_v1::builder::key_management_service::ListLocations;
7724    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7725    /// use google_cloud_gax::paginator::ItemPaginator;
7726    ///
7727    /// let builder = prepare_request_builder();
7728    /// let mut items = builder.by_item();
7729    /// while let Some(result) = items.next().await {
7730    ///   let item = result?;
7731    /// }
7732    /// # Ok(()) }
7733    ///
7734    /// fn prepare_request_builder() -> ListLocations {
7735    ///   # panic!();
7736    ///   // ... details omitted ...
7737    /// }
7738    /// ```
7739    #[derive(Clone, Debug)]
7740    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
7741
7742    impl ListLocations {
7743        pub(crate) fn new(
7744            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7745        ) -> Self {
7746            Self(RequestBuilder::new(stub))
7747        }
7748
7749        /// Sets the full request, replacing any prior values.
7750        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
7751            mut self,
7752            v: V,
7753        ) -> Self {
7754            self.0.request = v.into();
7755            self
7756        }
7757
7758        /// Sets all the options, replacing any prior values.
7759        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7760            self.0.options = v.into();
7761            self
7762        }
7763
7764        /// Sends the request.
7765        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
7766            (*self.0.stub)
7767                .list_locations(self.0.request, self.0.options)
7768                .await
7769                .map(crate::Response::into_body)
7770        }
7771
7772        /// Streams each page in the collection.
7773        pub fn by_page(
7774            self,
7775        ) -> impl google_cloud_gax::paginator::Paginator<
7776            google_cloud_location::model::ListLocationsResponse,
7777            crate::Error,
7778        > {
7779            use std::clone::Clone;
7780            let token = self.0.request.page_token.clone();
7781            let execute = move |token: String| {
7782                let mut builder = self.clone();
7783                builder.0.request = builder.0.request.set_page_token(token);
7784                builder.send()
7785            };
7786            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7787        }
7788
7789        /// Streams each item in the collection.
7790        pub fn by_item(
7791            self,
7792        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7793            google_cloud_location::model::ListLocationsResponse,
7794            crate::Error,
7795        > {
7796            use google_cloud_gax::paginator::Paginator;
7797            self.by_page().items()
7798        }
7799
7800        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
7801        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7802            self.0.request.name = v.into();
7803            self
7804        }
7805
7806        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
7807        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7808            self.0.request.filter = v.into();
7809            self
7810        }
7811
7812        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
7813        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7814            self.0.request.page_size = v.into();
7815            self
7816        }
7817
7818        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
7819        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7820            self.0.request.page_token = v.into();
7821            self
7822        }
7823    }
7824
7825    #[doc(hidden)]
7826    impl crate::RequestBuilder for ListLocations {
7827        fn request_options(&mut self) -> &mut crate::RequestOptions {
7828            &mut self.0.options
7829        }
7830    }
7831
7832    /// The request builder for [KeyManagementService::get_location][crate::client::KeyManagementService::get_location] calls.
7833    ///
7834    /// # Example
7835    /// ```
7836    /// # use google_cloud_kms_v1::builder::key_management_service::GetLocation;
7837    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7838    ///
7839    /// let builder = prepare_request_builder();
7840    /// let response = builder.send().await?;
7841    /// # Ok(()) }
7842    ///
7843    /// fn prepare_request_builder() -> GetLocation {
7844    ///   # panic!();
7845    ///   // ... details omitted ...
7846    /// }
7847    /// ```
7848    #[derive(Clone, Debug)]
7849    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
7850
7851    impl GetLocation {
7852        pub(crate) fn new(
7853            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7854        ) -> Self {
7855            Self(RequestBuilder::new(stub))
7856        }
7857
7858        /// Sets the full request, replacing any prior values.
7859        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
7860            mut self,
7861            v: V,
7862        ) -> Self {
7863            self.0.request = v.into();
7864            self
7865        }
7866
7867        /// Sets all the options, replacing any prior values.
7868        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7869            self.0.options = v.into();
7870            self
7871        }
7872
7873        /// Sends the request.
7874        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
7875            (*self.0.stub)
7876                .get_location(self.0.request, self.0.options)
7877                .await
7878                .map(crate::Response::into_body)
7879        }
7880
7881        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
7882        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7883            self.0.request.name = v.into();
7884            self
7885        }
7886    }
7887
7888    #[doc(hidden)]
7889    impl crate::RequestBuilder for GetLocation {
7890        fn request_options(&mut self) -> &mut crate::RequestOptions {
7891            &mut self.0.options
7892        }
7893    }
7894
7895    /// The request builder for [KeyManagementService::set_iam_policy][crate::client::KeyManagementService::set_iam_policy] calls.
7896    ///
7897    /// # Example
7898    /// ```
7899    /// # use google_cloud_kms_v1::builder::key_management_service::SetIamPolicy;
7900    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
7901    ///
7902    /// let builder = prepare_request_builder();
7903    /// let response = builder.send().await?;
7904    /// # Ok(()) }
7905    ///
7906    /// fn prepare_request_builder() -> SetIamPolicy {
7907    ///   # panic!();
7908    ///   // ... details omitted ...
7909    /// }
7910    /// ```
7911    #[derive(Clone, Debug)]
7912    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
7913
7914    impl SetIamPolicy {
7915        pub(crate) fn new(
7916            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
7917        ) -> Self {
7918            Self(RequestBuilder::new(stub))
7919        }
7920
7921        /// Sets the full request, replacing any prior values.
7922        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
7923            mut self,
7924            v: V,
7925        ) -> Self {
7926            self.0.request = v.into();
7927            self
7928        }
7929
7930        /// Sets all the options, replacing any prior values.
7931        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7932            self.0.options = v.into();
7933            self
7934        }
7935
7936        /// Sends the request.
7937        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
7938            (*self.0.stub)
7939                .set_iam_policy(self.0.request, self.0.options)
7940                .await
7941                .map(crate::Response::into_body)
7942        }
7943
7944        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
7945        ///
7946        /// This is a **required** field for requests.
7947        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7948            self.0.request.resource = v.into();
7949            self
7950        }
7951
7952        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
7953        ///
7954        /// This is a **required** field for requests.
7955        pub fn set_policy<T>(mut self, v: T) -> Self
7956        where
7957            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7958        {
7959            self.0.request.policy = std::option::Option::Some(v.into());
7960            self
7961        }
7962
7963        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
7964        ///
7965        /// This is a **required** field for requests.
7966        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7967        where
7968            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7969        {
7970            self.0.request.policy = v.map(|x| x.into());
7971            self
7972        }
7973
7974        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
7975        pub fn set_update_mask<T>(mut self, v: T) -> Self
7976        where
7977            T: std::convert::Into<wkt::FieldMask>,
7978        {
7979            self.0.request.update_mask = std::option::Option::Some(v.into());
7980            self
7981        }
7982
7983        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
7984        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7985        where
7986            T: std::convert::Into<wkt::FieldMask>,
7987        {
7988            self.0.request.update_mask = v.map(|x| x.into());
7989            self
7990        }
7991    }
7992
7993    #[doc(hidden)]
7994    impl crate::RequestBuilder for SetIamPolicy {
7995        fn request_options(&mut self) -> &mut crate::RequestOptions {
7996            &mut self.0.options
7997        }
7998    }
7999
8000    /// The request builder for [KeyManagementService::get_iam_policy][crate::client::KeyManagementService::get_iam_policy] calls.
8001    ///
8002    /// # Example
8003    /// ```
8004    /// # use google_cloud_kms_v1::builder::key_management_service::GetIamPolicy;
8005    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8006    ///
8007    /// let builder = prepare_request_builder();
8008    /// let response = builder.send().await?;
8009    /// # Ok(()) }
8010    ///
8011    /// fn prepare_request_builder() -> GetIamPolicy {
8012    ///   # panic!();
8013    ///   // ... details omitted ...
8014    /// }
8015    /// ```
8016    #[derive(Clone, Debug)]
8017    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
8018
8019    impl GetIamPolicy {
8020        pub(crate) fn new(
8021            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8022        ) -> Self {
8023            Self(RequestBuilder::new(stub))
8024        }
8025
8026        /// Sets the full request, replacing any prior values.
8027        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
8028            mut self,
8029            v: V,
8030        ) -> Self {
8031            self.0.request = v.into();
8032            self
8033        }
8034
8035        /// Sets all the options, replacing any prior values.
8036        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8037            self.0.options = v.into();
8038            self
8039        }
8040
8041        /// Sends the request.
8042        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
8043            (*self.0.stub)
8044                .get_iam_policy(self.0.request, self.0.options)
8045                .await
8046                .map(crate::Response::into_body)
8047        }
8048
8049        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
8050        ///
8051        /// This is a **required** field for requests.
8052        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8053            self.0.request.resource = v.into();
8054            self
8055        }
8056
8057        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
8058        pub fn set_options<T>(mut self, v: T) -> Self
8059        where
8060            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8061        {
8062            self.0.request.options = std::option::Option::Some(v.into());
8063            self
8064        }
8065
8066        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
8067        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
8068        where
8069            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8070        {
8071            self.0.request.options = v.map(|x| x.into());
8072            self
8073        }
8074    }
8075
8076    #[doc(hidden)]
8077    impl crate::RequestBuilder for GetIamPolicy {
8078        fn request_options(&mut self) -> &mut crate::RequestOptions {
8079            &mut self.0.options
8080        }
8081    }
8082
8083    /// The request builder for [KeyManagementService::test_iam_permissions][crate::client::KeyManagementService::test_iam_permissions] calls.
8084    ///
8085    /// # Example
8086    /// ```
8087    /// # use google_cloud_kms_v1::builder::key_management_service::TestIamPermissions;
8088    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8089    ///
8090    /// let builder = prepare_request_builder();
8091    /// let response = builder.send().await?;
8092    /// # Ok(()) }
8093    ///
8094    /// fn prepare_request_builder() -> TestIamPermissions {
8095    ///   # panic!();
8096    ///   // ... details omitted ...
8097    /// }
8098    /// ```
8099    #[derive(Clone, Debug)]
8100    pub struct TestIamPermissions(
8101        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
8102    );
8103
8104    impl TestIamPermissions {
8105        pub(crate) fn new(
8106            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8107        ) -> Self {
8108            Self(RequestBuilder::new(stub))
8109        }
8110
8111        /// Sets the full request, replacing any prior values.
8112        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
8113            mut self,
8114            v: V,
8115        ) -> Self {
8116            self.0.request = v.into();
8117            self
8118        }
8119
8120        /// Sets all the options, replacing any prior values.
8121        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8122            self.0.options = v.into();
8123            self
8124        }
8125
8126        /// Sends the request.
8127        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
8128            (*self.0.stub)
8129                .test_iam_permissions(self.0.request, self.0.options)
8130                .await
8131                .map(crate::Response::into_body)
8132        }
8133
8134        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
8135        ///
8136        /// This is a **required** field for requests.
8137        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8138            self.0.request.resource = v.into();
8139            self
8140        }
8141
8142        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
8143        ///
8144        /// This is a **required** field for requests.
8145        pub fn set_permissions<T, V>(mut self, v: T) -> Self
8146        where
8147            T: std::iter::IntoIterator<Item = V>,
8148            V: std::convert::Into<std::string::String>,
8149        {
8150            use std::iter::Iterator;
8151            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
8152            self
8153        }
8154    }
8155
8156    #[doc(hidden)]
8157    impl crate::RequestBuilder for TestIamPermissions {
8158        fn request_options(&mut self) -> &mut crate::RequestOptions {
8159            &mut self.0.options
8160        }
8161    }
8162
8163    /// The request builder for [KeyManagementService::get_operation][crate::client::KeyManagementService::get_operation] calls.
8164    ///
8165    /// # Example
8166    /// ```
8167    /// # use google_cloud_kms_v1::builder::key_management_service::GetOperation;
8168    /// # async fn sample() -> google_cloud_kms_v1::Result<()> {
8169    ///
8170    /// let builder = prepare_request_builder();
8171    /// let response = builder.send().await?;
8172    /// # Ok(()) }
8173    ///
8174    /// fn prepare_request_builder() -> GetOperation {
8175    ///   # panic!();
8176    ///   // ... details omitted ...
8177    /// }
8178    /// ```
8179    #[derive(Clone, Debug)]
8180    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8181
8182    impl GetOperation {
8183        pub(crate) fn new(
8184            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
8185        ) -> Self {
8186            Self(RequestBuilder::new(stub))
8187        }
8188
8189        /// Sets the full request, replacing any prior values.
8190        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8191            mut self,
8192            v: V,
8193        ) -> Self {
8194            self.0.request = v.into();
8195            self
8196        }
8197
8198        /// Sets all the options, replacing any prior values.
8199        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8200            self.0.options = v.into();
8201            self
8202        }
8203
8204        /// Sends the request.
8205        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8206            (*self.0.stub)
8207                .get_operation(self.0.request, self.0.options)
8208                .await
8209                .map(crate::Response::into_body)
8210        }
8211
8212        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
8213        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8214            self.0.request.name = v.into();
8215            self
8216        }
8217    }
8218
8219    #[doc(hidden)]
8220    impl crate::RequestBuilder for GetOperation {
8221        fn request_options(&mut self) -> &mut crate::RequestOptions {
8222            &mut self.0.options
8223        }
8224    }
8225}