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