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 key_management_service {
2788    use crate::Result;
2789
2790    /// A builder for [KeyManagementService][crate::client::KeyManagementService].
2791    ///
2792    /// ```
2793    /// # async fn sample() -> gax::client_builder::Result<()> {
2794    /// # use google_cloud_kms_v1::*;
2795    /// # use builder::key_management_service::ClientBuilder;
2796    /// # use client::KeyManagementService;
2797    /// let builder : ClientBuilder = KeyManagementService::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::KeyManagementService;
2808        pub struct Factory;
2809        impl gax::client_builder::internal::ClientFactory for Factory {
2810            type Client = KeyManagementService;
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::KeyManagementService] 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::KeyManagementService>,
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::KeyManagementService>,
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 [KeyManagementService::list_key_rings][crate::client::KeyManagementService::list_key_rings] calls.
2845    ///
2846    /// # Example
2847    /// ```
2848    /// # use google_cloud_kms_v1::builder::key_management_service::ListKeyRings;
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() -> ListKeyRings {
2860    ///   # panic!();
2861    ///   // ... details omitted ...
2862    /// }
2863    /// ```
2864    #[derive(Clone, Debug)]
2865    pub struct ListKeyRings(RequestBuilder<crate::model::ListKeyRingsRequest>);
2866
2867    impl ListKeyRings {
2868        pub(crate) fn new(
2869            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
2870        ) -> Self {
2871            Self(RequestBuilder::new(stub))
2872        }
2873
2874        /// Sets the full request, replacing any prior values.
2875        pub fn with_request<V: Into<crate::model::ListKeyRingsRequest>>(mut self, v: V) -> Self {
2876            self.0.request = v.into();
2877            self
2878        }
2879
2880        /// Sets all the options, replacing any prior values.
2881        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2882            self.0.options = v.into();
2883            self
2884        }
2885
2886        /// Sends the request.
2887        pub async fn send(self) -> Result<crate::model::ListKeyRingsResponse> {
2888            (*self.0.stub)
2889                .list_key_rings(self.0.request, self.0.options)
2890                .await
2891                .map(gax::response::Response::into_body)
2892        }
2893
2894        /// Streams each page in the collection.
2895        pub fn by_page(
2896            self,
2897        ) -> impl gax::paginator::Paginator<crate::model::ListKeyRingsResponse, gax::error::Error>
2898        {
2899            use std::clone::Clone;
2900            let token = self.0.request.page_token.clone();
2901            let execute = move |token: String| {
2902                let mut builder = self.clone();
2903                builder.0.request = builder.0.request.set_page_token(token);
2904                builder.send()
2905            };
2906            gax::paginator::internal::new_paginator(token, execute)
2907        }
2908
2909        /// Streams each item in the collection.
2910        pub fn by_item(
2911            self,
2912        ) -> impl gax::paginator::ItemPaginator<crate::model::ListKeyRingsResponse, gax::error::Error>
2913        {
2914            use gax::paginator::Paginator;
2915            self.by_page().items()
2916        }
2917
2918        /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
2919        ///
2920        /// This is a **required** field for requests.
2921        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2922            self.0.request.parent = v.into();
2923            self
2924        }
2925
2926        /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
2927        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2928            self.0.request.page_size = v.into();
2929            self
2930        }
2931
2932        /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
2933        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2934            self.0.request.page_token = v.into();
2935            self
2936        }
2937
2938        /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
2939        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2940            self.0.request.filter = v.into();
2941            self
2942        }
2943
2944        /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
2945        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2946            self.0.request.order_by = v.into();
2947            self
2948        }
2949    }
2950
2951    #[doc(hidden)]
2952    impl gax::options::internal::RequestBuilder for ListKeyRings {
2953        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2954            &mut self.0.options
2955        }
2956    }
2957
2958    /// The request builder for [KeyManagementService::list_crypto_keys][crate::client::KeyManagementService::list_crypto_keys] calls.
2959    ///
2960    /// # Example
2961    /// ```
2962    /// # use google_cloud_kms_v1::builder::key_management_service::ListCryptoKeys;
2963    /// # async fn sample() -> gax::Result<()> {
2964    /// use gax::paginator::ItemPaginator;
2965    ///
2966    /// let builder = prepare_request_builder();
2967    /// let mut items = builder.by_item();
2968    /// while let Some(result) = items.next().await {
2969    ///   let item = result?;
2970    /// }
2971    /// # Ok(()) }
2972    ///
2973    /// fn prepare_request_builder() -> ListCryptoKeys {
2974    ///   # panic!();
2975    ///   // ... details omitted ...
2976    /// }
2977    /// ```
2978    #[derive(Clone, Debug)]
2979    pub struct ListCryptoKeys(RequestBuilder<crate::model::ListCryptoKeysRequest>);
2980
2981    impl ListCryptoKeys {
2982        pub(crate) fn new(
2983            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
2984        ) -> Self {
2985            Self(RequestBuilder::new(stub))
2986        }
2987
2988        /// Sets the full request, replacing any prior values.
2989        pub fn with_request<V: Into<crate::model::ListCryptoKeysRequest>>(mut self, v: V) -> Self {
2990            self.0.request = v.into();
2991            self
2992        }
2993
2994        /// Sets all the options, replacing any prior values.
2995        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2996            self.0.options = v.into();
2997            self
2998        }
2999
3000        /// Sends the request.
3001        pub async fn send(self) -> Result<crate::model::ListCryptoKeysResponse> {
3002            (*self.0.stub)
3003                .list_crypto_keys(self.0.request, self.0.options)
3004                .await
3005                .map(gax::response::Response::into_body)
3006        }
3007
3008        /// Streams each page in the collection.
3009        pub fn by_page(
3010            self,
3011        ) -> impl gax::paginator::Paginator<crate::model::ListCryptoKeysResponse, gax::error::Error>
3012        {
3013            use std::clone::Clone;
3014            let token = self.0.request.page_token.clone();
3015            let execute = move |token: String| {
3016                let mut builder = self.clone();
3017                builder.0.request = builder.0.request.set_page_token(token);
3018                builder.send()
3019            };
3020            gax::paginator::internal::new_paginator(token, execute)
3021        }
3022
3023        /// Streams each item in the collection.
3024        pub fn by_item(
3025            self,
3026        ) -> impl gax::paginator::ItemPaginator<crate::model::ListCryptoKeysResponse, gax::error::Error>
3027        {
3028            use gax::paginator::Paginator;
3029            self.by_page().items()
3030        }
3031
3032        /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
3033        ///
3034        /// This is a **required** field for requests.
3035        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3036            self.0.request.parent = v.into();
3037            self
3038        }
3039
3040        /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
3041        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3042            self.0.request.page_size = v.into();
3043            self
3044        }
3045
3046        /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
3047        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3048            self.0.request.page_token = v.into();
3049            self
3050        }
3051
3052        /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
3053        pub fn set_version_view<T: Into<crate::model::crypto_key_version::CryptoKeyVersionView>>(
3054            mut self,
3055            v: T,
3056        ) -> Self {
3057            self.0.request.version_view = v.into();
3058            self
3059        }
3060
3061        /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
3062        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3063            self.0.request.filter = v.into();
3064            self
3065        }
3066
3067        /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
3068        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3069            self.0.request.order_by = v.into();
3070            self
3071        }
3072    }
3073
3074    #[doc(hidden)]
3075    impl gax::options::internal::RequestBuilder for ListCryptoKeys {
3076        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3077            &mut self.0.options
3078        }
3079    }
3080
3081    /// The request builder for [KeyManagementService::list_crypto_key_versions][crate::client::KeyManagementService::list_crypto_key_versions] calls.
3082    ///
3083    /// # Example
3084    /// ```
3085    /// # use google_cloud_kms_v1::builder::key_management_service::ListCryptoKeyVersions;
3086    /// # async fn sample() -> gax::Result<()> {
3087    /// use gax::paginator::ItemPaginator;
3088    ///
3089    /// let builder = prepare_request_builder();
3090    /// let mut items = builder.by_item();
3091    /// while let Some(result) = items.next().await {
3092    ///   let item = result?;
3093    /// }
3094    /// # Ok(()) }
3095    ///
3096    /// fn prepare_request_builder() -> ListCryptoKeyVersions {
3097    ///   # panic!();
3098    ///   // ... details omitted ...
3099    /// }
3100    /// ```
3101    #[derive(Clone, Debug)]
3102    pub struct ListCryptoKeyVersions(RequestBuilder<crate::model::ListCryptoKeyVersionsRequest>);
3103
3104    impl ListCryptoKeyVersions {
3105        pub(crate) fn new(
3106            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3107        ) -> Self {
3108            Self(RequestBuilder::new(stub))
3109        }
3110
3111        /// Sets the full request, replacing any prior values.
3112        pub fn with_request<V: Into<crate::model::ListCryptoKeyVersionsRequest>>(
3113            mut self,
3114            v: V,
3115        ) -> Self {
3116            self.0.request = v.into();
3117            self
3118        }
3119
3120        /// Sets all the options, replacing any prior values.
3121        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3122            self.0.options = v.into();
3123            self
3124        }
3125
3126        /// Sends the request.
3127        pub async fn send(self) -> Result<crate::model::ListCryptoKeyVersionsResponse> {
3128            (*self.0.stub)
3129                .list_crypto_key_versions(self.0.request, self.0.options)
3130                .await
3131                .map(gax::response::Response::into_body)
3132        }
3133
3134        /// Streams each page in the collection.
3135        pub fn by_page(
3136            self,
3137        ) -> impl gax::paginator::Paginator<crate::model::ListCryptoKeyVersionsResponse, gax::error::Error>
3138        {
3139            use std::clone::Clone;
3140            let token = self.0.request.page_token.clone();
3141            let execute = move |token: String| {
3142                let mut builder = self.clone();
3143                builder.0.request = builder.0.request.set_page_token(token);
3144                builder.send()
3145            };
3146            gax::paginator::internal::new_paginator(token, execute)
3147        }
3148
3149        /// Streams each item in the collection.
3150        pub fn by_item(
3151            self,
3152        ) -> impl gax::paginator::ItemPaginator<
3153            crate::model::ListCryptoKeyVersionsResponse,
3154            gax::error::Error,
3155        > {
3156            use gax::paginator::Paginator;
3157            self.by_page().items()
3158        }
3159
3160        /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
3161        ///
3162        /// This is a **required** field for requests.
3163        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3164            self.0.request.parent = v.into();
3165            self
3166        }
3167
3168        /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
3169        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3170            self.0.request.page_size = v.into();
3171            self
3172        }
3173
3174        /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
3175        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3176            self.0.request.page_token = v.into();
3177            self
3178        }
3179
3180        /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
3181        pub fn set_view<T: Into<crate::model::crypto_key_version::CryptoKeyVersionView>>(
3182            mut self,
3183            v: T,
3184        ) -> Self {
3185            self.0.request.view = v.into();
3186            self
3187        }
3188
3189        /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
3190        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3191            self.0.request.filter = v.into();
3192            self
3193        }
3194
3195        /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
3196        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3197            self.0.request.order_by = v.into();
3198            self
3199        }
3200    }
3201
3202    #[doc(hidden)]
3203    impl gax::options::internal::RequestBuilder for ListCryptoKeyVersions {
3204        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3205            &mut self.0.options
3206        }
3207    }
3208
3209    /// The request builder for [KeyManagementService::list_import_jobs][crate::client::KeyManagementService::list_import_jobs] calls.
3210    ///
3211    /// # Example
3212    /// ```
3213    /// # use google_cloud_kms_v1::builder::key_management_service::ListImportJobs;
3214    /// # async fn sample() -> gax::Result<()> {
3215    /// use gax::paginator::ItemPaginator;
3216    ///
3217    /// let builder = prepare_request_builder();
3218    /// let mut items = builder.by_item();
3219    /// while let Some(result) = items.next().await {
3220    ///   let item = result?;
3221    /// }
3222    /// # Ok(()) }
3223    ///
3224    /// fn prepare_request_builder() -> ListImportJobs {
3225    ///   # panic!();
3226    ///   // ... details omitted ...
3227    /// }
3228    /// ```
3229    #[derive(Clone, Debug)]
3230    pub struct ListImportJobs(RequestBuilder<crate::model::ListImportJobsRequest>);
3231
3232    impl ListImportJobs {
3233        pub(crate) fn new(
3234            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3235        ) -> Self {
3236            Self(RequestBuilder::new(stub))
3237        }
3238
3239        /// Sets the full request, replacing any prior values.
3240        pub fn with_request<V: Into<crate::model::ListImportJobsRequest>>(mut self, v: V) -> Self {
3241            self.0.request = v.into();
3242            self
3243        }
3244
3245        /// Sets all the options, replacing any prior values.
3246        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3247            self.0.options = v.into();
3248            self
3249        }
3250
3251        /// Sends the request.
3252        pub async fn send(self) -> Result<crate::model::ListImportJobsResponse> {
3253            (*self.0.stub)
3254                .list_import_jobs(self.0.request, self.0.options)
3255                .await
3256                .map(gax::response::Response::into_body)
3257        }
3258
3259        /// Streams each page in the collection.
3260        pub fn by_page(
3261            self,
3262        ) -> impl gax::paginator::Paginator<crate::model::ListImportJobsResponse, gax::error::Error>
3263        {
3264            use std::clone::Clone;
3265            let token = self.0.request.page_token.clone();
3266            let execute = move |token: String| {
3267                let mut builder = self.clone();
3268                builder.0.request = builder.0.request.set_page_token(token);
3269                builder.send()
3270            };
3271            gax::paginator::internal::new_paginator(token, execute)
3272        }
3273
3274        /// Streams each item in the collection.
3275        pub fn by_item(
3276            self,
3277        ) -> impl gax::paginator::ItemPaginator<crate::model::ListImportJobsResponse, gax::error::Error>
3278        {
3279            use gax::paginator::Paginator;
3280            self.by_page().items()
3281        }
3282
3283        /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
3284        ///
3285        /// This is a **required** field for requests.
3286        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3287            self.0.request.parent = v.into();
3288            self
3289        }
3290
3291        /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
3292        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3293            self.0.request.page_size = v.into();
3294            self
3295        }
3296
3297        /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
3298        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3299            self.0.request.page_token = v.into();
3300            self
3301        }
3302
3303        /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
3304        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3305            self.0.request.filter = v.into();
3306            self
3307        }
3308
3309        /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
3310        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3311            self.0.request.order_by = v.into();
3312            self
3313        }
3314    }
3315
3316    #[doc(hidden)]
3317    impl gax::options::internal::RequestBuilder for ListImportJobs {
3318        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3319            &mut self.0.options
3320        }
3321    }
3322
3323    /// The request builder for [KeyManagementService::get_key_ring][crate::client::KeyManagementService::get_key_ring] calls.
3324    ///
3325    /// # Example
3326    /// ```
3327    /// # use google_cloud_kms_v1::builder::key_management_service::GetKeyRing;
3328    /// # async fn sample() -> gax::Result<()> {
3329    ///
3330    /// let builder = prepare_request_builder();
3331    /// let response = builder.send().await?;
3332    /// # Ok(()) }
3333    ///
3334    /// fn prepare_request_builder() -> GetKeyRing {
3335    ///   # panic!();
3336    ///   // ... details omitted ...
3337    /// }
3338    /// ```
3339    #[derive(Clone, Debug)]
3340    pub struct GetKeyRing(RequestBuilder<crate::model::GetKeyRingRequest>);
3341
3342    impl GetKeyRing {
3343        pub(crate) fn new(
3344            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3345        ) -> Self {
3346            Self(RequestBuilder::new(stub))
3347        }
3348
3349        /// Sets the full request, replacing any prior values.
3350        pub fn with_request<V: Into<crate::model::GetKeyRingRequest>>(mut self, v: V) -> Self {
3351            self.0.request = v.into();
3352            self
3353        }
3354
3355        /// Sets all the options, replacing any prior values.
3356        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3357            self.0.options = v.into();
3358            self
3359        }
3360
3361        /// Sends the request.
3362        pub async fn send(self) -> Result<crate::model::KeyRing> {
3363            (*self.0.stub)
3364                .get_key_ring(self.0.request, self.0.options)
3365                .await
3366                .map(gax::response::Response::into_body)
3367        }
3368
3369        /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
3370        ///
3371        /// This is a **required** field for requests.
3372        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3373            self.0.request.name = v.into();
3374            self
3375        }
3376    }
3377
3378    #[doc(hidden)]
3379    impl gax::options::internal::RequestBuilder for GetKeyRing {
3380        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3381            &mut self.0.options
3382        }
3383    }
3384
3385    /// The request builder for [KeyManagementService::get_crypto_key][crate::client::KeyManagementService::get_crypto_key] calls.
3386    ///
3387    /// # Example
3388    /// ```
3389    /// # use google_cloud_kms_v1::builder::key_management_service::GetCryptoKey;
3390    /// # async fn sample() -> gax::Result<()> {
3391    ///
3392    /// let builder = prepare_request_builder();
3393    /// let response = builder.send().await?;
3394    /// # Ok(()) }
3395    ///
3396    /// fn prepare_request_builder() -> GetCryptoKey {
3397    ///   # panic!();
3398    ///   // ... details omitted ...
3399    /// }
3400    /// ```
3401    #[derive(Clone, Debug)]
3402    pub struct GetCryptoKey(RequestBuilder<crate::model::GetCryptoKeyRequest>);
3403
3404    impl GetCryptoKey {
3405        pub(crate) fn new(
3406            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3407        ) -> Self {
3408            Self(RequestBuilder::new(stub))
3409        }
3410
3411        /// Sets the full request, replacing any prior values.
3412        pub fn with_request<V: Into<crate::model::GetCryptoKeyRequest>>(mut self, v: V) -> Self {
3413            self.0.request = v.into();
3414            self
3415        }
3416
3417        /// Sets all the options, replacing any prior values.
3418        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3419            self.0.options = v.into();
3420            self
3421        }
3422
3423        /// Sends the request.
3424        pub async fn send(self) -> Result<crate::model::CryptoKey> {
3425            (*self.0.stub)
3426                .get_crypto_key(self.0.request, self.0.options)
3427                .await
3428                .map(gax::response::Response::into_body)
3429        }
3430
3431        /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
3432        ///
3433        /// This is a **required** field for requests.
3434        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3435            self.0.request.name = v.into();
3436            self
3437        }
3438    }
3439
3440    #[doc(hidden)]
3441    impl gax::options::internal::RequestBuilder for GetCryptoKey {
3442        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3443            &mut self.0.options
3444        }
3445    }
3446
3447    /// The request builder for [KeyManagementService::get_crypto_key_version][crate::client::KeyManagementService::get_crypto_key_version] calls.
3448    ///
3449    /// # Example
3450    /// ```
3451    /// # use google_cloud_kms_v1::builder::key_management_service::GetCryptoKeyVersion;
3452    /// # async fn sample() -> gax::Result<()> {
3453    ///
3454    /// let builder = prepare_request_builder();
3455    /// let response = builder.send().await?;
3456    /// # Ok(()) }
3457    ///
3458    /// fn prepare_request_builder() -> GetCryptoKeyVersion {
3459    ///   # panic!();
3460    ///   // ... details omitted ...
3461    /// }
3462    /// ```
3463    #[derive(Clone, Debug)]
3464    pub struct GetCryptoKeyVersion(RequestBuilder<crate::model::GetCryptoKeyVersionRequest>);
3465
3466    impl GetCryptoKeyVersion {
3467        pub(crate) fn new(
3468            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3469        ) -> Self {
3470            Self(RequestBuilder::new(stub))
3471        }
3472
3473        /// Sets the full request, replacing any prior values.
3474        pub fn with_request<V: Into<crate::model::GetCryptoKeyVersionRequest>>(
3475            mut self,
3476            v: V,
3477        ) -> Self {
3478            self.0.request = v.into();
3479            self
3480        }
3481
3482        /// Sets all the options, replacing any prior values.
3483        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3484            self.0.options = v.into();
3485            self
3486        }
3487
3488        /// Sends the request.
3489        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
3490            (*self.0.stub)
3491                .get_crypto_key_version(self.0.request, self.0.options)
3492                .await
3493                .map(gax::response::Response::into_body)
3494        }
3495
3496        /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
3497        ///
3498        /// This is a **required** field for requests.
3499        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3500            self.0.request.name = v.into();
3501            self
3502        }
3503    }
3504
3505    #[doc(hidden)]
3506    impl gax::options::internal::RequestBuilder for GetCryptoKeyVersion {
3507        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3508            &mut self.0.options
3509        }
3510    }
3511
3512    /// The request builder for [KeyManagementService::get_public_key][crate::client::KeyManagementService::get_public_key] calls.
3513    ///
3514    /// # Example
3515    /// ```
3516    /// # use google_cloud_kms_v1::builder::key_management_service::GetPublicKey;
3517    /// # async fn sample() -> gax::Result<()> {
3518    ///
3519    /// let builder = prepare_request_builder();
3520    /// let response = builder.send().await?;
3521    /// # Ok(()) }
3522    ///
3523    /// fn prepare_request_builder() -> GetPublicKey {
3524    ///   # panic!();
3525    ///   // ... details omitted ...
3526    /// }
3527    /// ```
3528    #[derive(Clone, Debug)]
3529    pub struct GetPublicKey(RequestBuilder<crate::model::GetPublicKeyRequest>);
3530
3531    impl GetPublicKey {
3532        pub(crate) fn new(
3533            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3534        ) -> Self {
3535            Self(RequestBuilder::new(stub))
3536        }
3537
3538        /// Sets the full request, replacing any prior values.
3539        pub fn with_request<V: Into<crate::model::GetPublicKeyRequest>>(mut self, v: V) -> Self {
3540            self.0.request = v.into();
3541            self
3542        }
3543
3544        /// Sets all the options, replacing any prior values.
3545        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3546            self.0.options = v.into();
3547            self
3548        }
3549
3550        /// Sends the request.
3551        pub async fn send(self) -> Result<crate::model::PublicKey> {
3552            (*self.0.stub)
3553                .get_public_key(self.0.request, self.0.options)
3554                .await
3555                .map(gax::response::Response::into_body)
3556        }
3557
3558        /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
3559        ///
3560        /// This is a **required** field for requests.
3561        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3562            self.0.request.name = v.into();
3563            self
3564        }
3565
3566        /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
3567        pub fn set_public_key_format<T: Into<crate::model::public_key::PublicKeyFormat>>(
3568            mut self,
3569            v: T,
3570        ) -> Self {
3571            self.0.request.public_key_format = v.into();
3572            self
3573        }
3574    }
3575
3576    #[doc(hidden)]
3577    impl gax::options::internal::RequestBuilder for GetPublicKey {
3578        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3579            &mut self.0.options
3580        }
3581    }
3582
3583    /// The request builder for [KeyManagementService::get_import_job][crate::client::KeyManagementService::get_import_job] calls.
3584    ///
3585    /// # Example
3586    /// ```
3587    /// # use google_cloud_kms_v1::builder::key_management_service::GetImportJob;
3588    /// # async fn sample() -> gax::Result<()> {
3589    ///
3590    /// let builder = prepare_request_builder();
3591    /// let response = builder.send().await?;
3592    /// # Ok(()) }
3593    ///
3594    /// fn prepare_request_builder() -> GetImportJob {
3595    ///   # panic!();
3596    ///   // ... details omitted ...
3597    /// }
3598    /// ```
3599    #[derive(Clone, Debug)]
3600    pub struct GetImportJob(RequestBuilder<crate::model::GetImportJobRequest>);
3601
3602    impl GetImportJob {
3603        pub(crate) fn new(
3604            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3605        ) -> Self {
3606            Self(RequestBuilder::new(stub))
3607        }
3608
3609        /// Sets the full request, replacing any prior values.
3610        pub fn with_request<V: Into<crate::model::GetImportJobRequest>>(mut self, v: V) -> Self {
3611            self.0.request = v.into();
3612            self
3613        }
3614
3615        /// Sets all the options, replacing any prior values.
3616        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3617            self.0.options = v.into();
3618            self
3619        }
3620
3621        /// Sends the request.
3622        pub async fn send(self) -> Result<crate::model::ImportJob> {
3623            (*self.0.stub)
3624                .get_import_job(self.0.request, self.0.options)
3625                .await
3626                .map(gax::response::Response::into_body)
3627        }
3628
3629        /// Sets the value of [name][crate::model::GetImportJobRequest::name].
3630        ///
3631        /// This is a **required** field for requests.
3632        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3633            self.0.request.name = v.into();
3634            self
3635        }
3636    }
3637
3638    #[doc(hidden)]
3639    impl gax::options::internal::RequestBuilder for GetImportJob {
3640        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3641            &mut self.0.options
3642        }
3643    }
3644
3645    /// The request builder for [KeyManagementService::create_key_ring][crate::client::KeyManagementService::create_key_ring] calls.
3646    ///
3647    /// # Example
3648    /// ```
3649    /// # use google_cloud_kms_v1::builder::key_management_service::CreateKeyRing;
3650    /// # async fn sample() -> gax::Result<()> {
3651    ///
3652    /// let builder = prepare_request_builder();
3653    /// let response = builder.send().await?;
3654    /// # Ok(()) }
3655    ///
3656    /// fn prepare_request_builder() -> CreateKeyRing {
3657    ///   # panic!();
3658    ///   // ... details omitted ...
3659    /// }
3660    /// ```
3661    #[derive(Clone, Debug)]
3662    pub struct CreateKeyRing(RequestBuilder<crate::model::CreateKeyRingRequest>);
3663
3664    impl CreateKeyRing {
3665        pub(crate) fn new(
3666            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3667        ) -> Self {
3668            Self(RequestBuilder::new(stub))
3669        }
3670
3671        /// Sets the full request, replacing any prior values.
3672        pub fn with_request<V: Into<crate::model::CreateKeyRingRequest>>(mut self, v: V) -> Self {
3673            self.0.request = v.into();
3674            self
3675        }
3676
3677        /// Sets all the options, replacing any prior values.
3678        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3679            self.0.options = v.into();
3680            self
3681        }
3682
3683        /// Sends the request.
3684        pub async fn send(self) -> Result<crate::model::KeyRing> {
3685            (*self.0.stub)
3686                .create_key_ring(self.0.request, self.0.options)
3687                .await
3688                .map(gax::response::Response::into_body)
3689        }
3690
3691        /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
3692        ///
3693        /// This is a **required** field for requests.
3694        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3695            self.0.request.parent = v.into();
3696            self
3697        }
3698
3699        /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
3700        ///
3701        /// This is a **required** field for requests.
3702        pub fn set_key_ring_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3703            self.0.request.key_ring_id = v.into();
3704            self
3705        }
3706
3707        /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
3708        ///
3709        /// This is a **required** field for requests.
3710        pub fn set_key_ring<T>(mut self, v: T) -> Self
3711        where
3712            T: std::convert::Into<crate::model::KeyRing>,
3713        {
3714            self.0.request.key_ring = std::option::Option::Some(v.into());
3715            self
3716        }
3717
3718        /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
3719        ///
3720        /// This is a **required** field for requests.
3721        pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
3722        where
3723            T: std::convert::Into<crate::model::KeyRing>,
3724        {
3725            self.0.request.key_ring = v.map(|x| x.into());
3726            self
3727        }
3728    }
3729
3730    #[doc(hidden)]
3731    impl gax::options::internal::RequestBuilder for CreateKeyRing {
3732        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3733            &mut self.0.options
3734        }
3735    }
3736
3737    /// The request builder for [KeyManagementService::create_crypto_key][crate::client::KeyManagementService::create_crypto_key] calls.
3738    ///
3739    /// # Example
3740    /// ```
3741    /// # use google_cloud_kms_v1::builder::key_management_service::CreateCryptoKey;
3742    /// # async fn sample() -> gax::Result<()> {
3743    ///
3744    /// let builder = prepare_request_builder();
3745    /// let response = builder.send().await?;
3746    /// # Ok(()) }
3747    ///
3748    /// fn prepare_request_builder() -> CreateCryptoKey {
3749    ///   # panic!();
3750    ///   // ... details omitted ...
3751    /// }
3752    /// ```
3753    #[derive(Clone, Debug)]
3754    pub struct CreateCryptoKey(RequestBuilder<crate::model::CreateCryptoKeyRequest>);
3755
3756    impl CreateCryptoKey {
3757        pub(crate) fn new(
3758            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3759        ) -> Self {
3760            Self(RequestBuilder::new(stub))
3761        }
3762
3763        /// Sets the full request, replacing any prior values.
3764        pub fn with_request<V: Into<crate::model::CreateCryptoKeyRequest>>(mut self, v: V) -> Self {
3765            self.0.request = v.into();
3766            self
3767        }
3768
3769        /// Sets all the options, replacing any prior values.
3770        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3771            self.0.options = v.into();
3772            self
3773        }
3774
3775        /// Sends the request.
3776        pub async fn send(self) -> Result<crate::model::CryptoKey> {
3777            (*self.0.stub)
3778                .create_crypto_key(self.0.request, self.0.options)
3779                .await
3780                .map(gax::response::Response::into_body)
3781        }
3782
3783        /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
3784        ///
3785        /// This is a **required** field for requests.
3786        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3787            self.0.request.parent = v.into();
3788            self
3789        }
3790
3791        /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
3792        ///
3793        /// This is a **required** field for requests.
3794        pub fn set_crypto_key_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3795            self.0.request.crypto_key_id = v.into();
3796            self
3797        }
3798
3799        /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
3800        ///
3801        /// This is a **required** field for requests.
3802        pub fn set_crypto_key<T>(mut self, v: T) -> Self
3803        where
3804            T: std::convert::Into<crate::model::CryptoKey>,
3805        {
3806            self.0.request.crypto_key = std::option::Option::Some(v.into());
3807            self
3808        }
3809
3810        /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
3811        ///
3812        /// This is a **required** field for requests.
3813        pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
3814        where
3815            T: std::convert::Into<crate::model::CryptoKey>,
3816        {
3817            self.0.request.crypto_key = v.map(|x| x.into());
3818            self
3819        }
3820
3821        /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
3822        pub fn set_skip_initial_version_creation<T: Into<bool>>(mut self, v: T) -> Self {
3823            self.0.request.skip_initial_version_creation = v.into();
3824            self
3825        }
3826    }
3827
3828    #[doc(hidden)]
3829    impl gax::options::internal::RequestBuilder for CreateCryptoKey {
3830        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3831            &mut self.0.options
3832        }
3833    }
3834
3835    /// The request builder for [KeyManagementService::create_crypto_key_version][crate::client::KeyManagementService::create_crypto_key_version] calls.
3836    ///
3837    /// # Example
3838    /// ```
3839    /// # use google_cloud_kms_v1::builder::key_management_service::CreateCryptoKeyVersion;
3840    /// # async fn sample() -> gax::Result<()> {
3841    ///
3842    /// let builder = prepare_request_builder();
3843    /// let response = builder.send().await?;
3844    /// # Ok(()) }
3845    ///
3846    /// fn prepare_request_builder() -> CreateCryptoKeyVersion {
3847    ///   # panic!();
3848    ///   // ... details omitted ...
3849    /// }
3850    /// ```
3851    #[derive(Clone, Debug)]
3852    pub struct CreateCryptoKeyVersion(RequestBuilder<crate::model::CreateCryptoKeyVersionRequest>);
3853
3854    impl CreateCryptoKeyVersion {
3855        pub(crate) fn new(
3856            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3857        ) -> Self {
3858            Self(RequestBuilder::new(stub))
3859        }
3860
3861        /// Sets the full request, replacing any prior values.
3862        pub fn with_request<V: Into<crate::model::CreateCryptoKeyVersionRequest>>(
3863            mut self,
3864            v: V,
3865        ) -> Self {
3866            self.0.request = v.into();
3867            self
3868        }
3869
3870        /// Sets all the options, replacing any prior values.
3871        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3872            self.0.options = v.into();
3873            self
3874        }
3875
3876        /// Sends the request.
3877        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
3878            (*self.0.stub)
3879                .create_crypto_key_version(self.0.request, self.0.options)
3880                .await
3881                .map(gax::response::Response::into_body)
3882        }
3883
3884        /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
3885        ///
3886        /// This is a **required** field for requests.
3887        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3888            self.0.request.parent = v.into();
3889            self
3890        }
3891
3892        /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
3893        ///
3894        /// This is a **required** field for requests.
3895        pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
3896        where
3897            T: std::convert::Into<crate::model::CryptoKeyVersion>,
3898        {
3899            self.0.request.crypto_key_version = std::option::Option::Some(v.into());
3900            self
3901        }
3902
3903        /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
3904        ///
3905        /// This is a **required** field for requests.
3906        pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
3907        where
3908            T: std::convert::Into<crate::model::CryptoKeyVersion>,
3909        {
3910            self.0.request.crypto_key_version = v.map(|x| x.into());
3911            self
3912        }
3913    }
3914
3915    #[doc(hidden)]
3916    impl gax::options::internal::RequestBuilder for CreateCryptoKeyVersion {
3917        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3918            &mut self.0.options
3919        }
3920    }
3921
3922    /// The request builder for [KeyManagementService::import_crypto_key_version][crate::client::KeyManagementService::import_crypto_key_version] calls.
3923    ///
3924    /// # Example
3925    /// ```
3926    /// # use google_cloud_kms_v1::builder::key_management_service::ImportCryptoKeyVersion;
3927    /// # async fn sample() -> gax::Result<()> {
3928    ///
3929    /// let builder = prepare_request_builder();
3930    /// let response = builder.send().await?;
3931    /// # Ok(()) }
3932    ///
3933    /// fn prepare_request_builder() -> ImportCryptoKeyVersion {
3934    ///   # panic!();
3935    ///   // ... details omitted ...
3936    /// }
3937    /// ```
3938    #[derive(Clone, Debug)]
3939    pub struct ImportCryptoKeyVersion(RequestBuilder<crate::model::ImportCryptoKeyVersionRequest>);
3940
3941    impl ImportCryptoKeyVersion {
3942        pub(crate) fn new(
3943            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
3944        ) -> Self {
3945            Self(RequestBuilder::new(stub))
3946        }
3947
3948        /// Sets the full request, replacing any prior values.
3949        pub fn with_request<V: Into<crate::model::ImportCryptoKeyVersionRequest>>(
3950            mut self,
3951            v: V,
3952        ) -> Self {
3953            self.0.request = v.into();
3954            self
3955        }
3956
3957        /// Sets all the options, replacing any prior values.
3958        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3959            self.0.options = v.into();
3960            self
3961        }
3962
3963        /// Sends the request.
3964        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
3965            (*self.0.stub)
3966                .import_crypto_key_version(self.0.request, self.0.options)
3967                .await
3968                .map(gax::response::Response::into_body)
3969        }
3970
3971        /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
3972        ///
3973        /// This is a **required** field for requests.
3974        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3975            self.0.request.parent = v.into();
3976            self
3977        }
3978
3979        /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
3980        pub fn set_crypto_key_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
3981            self.0.request.crypto_key_version = v.into();
3982            self
3983        }
3984
3985        /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
3986        ///
3987        /// This is a **required** field for requests.
3988        pub fn set_algorithm<
3989            T: Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
3990        >(
3991            mut self,
3992            v: T,
3993        ) -> Self {
3994            self.0.request.algorithm = v.into();
3995            self
3996        }
3997
3998        /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
3999        ///
4000        /// This is a **required** field for requests.
4001        pub fn set_import_job<T: Into<std::string::String>>(mut self, v: T) -> Self {
4002            self.0.request.import_job = v.into();
4003            self
4004        }
4005
4006        /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
4007        pub fn set_wrapped_key<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4008            self.0.request.wrapped_key = v.into();
4009            self
4010        }
4011
4012        /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
4013        ///
4014        /// Note that all the setters affecting `wrapped_key_material` are
4015        /// mutually exclusive.
4016        pub fn set_wrapped_key_material<
4017            T: Into<Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>>,
4018        >(
4019            mut self,
4020            v: T,
4021        ) -> Self {
4022            self.0.request.wrapped_key_material = v.into();
4023            self
4024        }
4025
4026        /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
4027        /// to hold a `RsaAesWrappedKey`.
4028        ///
4029        /// Note that all the setters affecting `wrapped_key_material` are
4030        /// mutually exclusive.
4031        pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(
4032            mut self,
4033            v: T,
4034        ) -> Self {
4035            self.0.request = self.0.request.set_rsa_aes_wrapped_key(v);
4036            self
4037        }
4038    }
4039
4040    #[doc(hidden)]
4041    impl gax::options::internal::RequestBuilder for ImportCryptoKeyVersion {
4042        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4043            &mut self.0.options
4044        }
4045    }
4046
4047    /// The request builder for [KeyManagementService::create_import_job][crate::client::KeyManagementService::create_import_job] calls.
4048    ///
4049    /// # Example
4050    /// ```
4051    /// # use google_cloud_kms_v1::builder::key_management_service::CreateImportJob;
4052    /// # async fn sample() -> gax::Result<()> {
4053    ///
4054    /// let builder = prepare_request_builder();
4055    /// let response = builder.send().await?;
4056    /// # Ok(()) }
4057    ///
4058    /// fn prepare_request_builder() -> CreateImportJob {
4059    ///   # panic!();
4060    ///   // ... details omitted ...
4061    /// }
4062    /// ```
4063    #[derive(Clone, Debug)]
4064    pub struct CreateImportJob(RequestBuilder<crate::model::CreateImportJobRequest>);
4065
4066    impl CreateImportJob {
4067        pub(crate) fn new(
4068            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4069        ) -> Self {
4070            Self(RequestBuilder::new(stub))
4071        }
4072
4073        /// Sets the full request, replacing any prior values.
4074        pub fn with_request<V: Into<crate::model::CreateImportJobRequest>>(mut self, v: V) -> Self {
4075            self.0.request = v.into();
4076            self
4077        }
4078
4079        /// Sets all the options, replacing any prior values.
4080        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4081            self.0.options = v.into();
4082            self
4083        }
4084
4085        /// Sends the request.
4086        pub async fn send(self) -> Result<crate::model::ImportJob> {
4087            (*self.0.stub)
4088                .create_import_job(self.0.request, self.0.options)
4089                .await
4090                .map(gax::response::Response::into_body)
4091        }
4092
4093        /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
4094        ///
4095        /// This is a **required** field for requests.
4096        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4097            self.0.request.parent = v.into();
4098            self
4099        }
4100
4101        /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
4102        ///
4103        /// This is a **required** field for requests.
4104        pub fn set_import_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4105            self.0.request.import_job_id = v.into();
4106            self
4107        }
4108
4109        /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
4110        ///
4111        /// This is a **required** field for requests.
4112        pub fn set_import_job<T>(mut self, v: T) -> Self
4113        where
4114            T: std::convert::Into<crate::model::ImportJob>,
4115        {
4116            self.0.request.import_job = std::option::Option::Some(v.into());
4117            self
4118        }
4119
4120        /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
4121        ///
4122        /// This is a **required** field for requests.
4123        pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
4124        where
4125            T: std::convert::Into<crate::model::ImportJob>,
4126        {
4127            self.0.request.import_job = v.map(|x| x.into());
4128            self
4129        }
4130    }
4131
4132    #[doc(hidden)]
4133    impl gax::options::internal::RequestBuilder for CreateImportJob {
4134        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4135            &mut self.0.options
4136        }
4137    }
4138
4139    /// The request builder for [KeyManagementService::update_crypto_key][crate::client::KeyManagementService::update_crypto_key] calls.
4140    ///
4141    /// # Example
4142    /// ```
4143    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKey;
4144    /// # async fn sample() -> gax::Result<()> {
4145    ///
4146    /// let builder = prepare_request_builder();
4147    /// let response = builder.send().await?;
4148    /// # Ok(()) }
4149    ///
4150    /// fn prepare_request_builder() -> UpdateCryptoKey {
4151    ///   # panic!();
4152    ///   // ... details omitted ...
4153    /// }
4154    /// ```
4155    #[derive(Clone, Debug)]
4156    pub struct UpdateCryptoKey(RequestBuilder<crate::model::UpdateCryptoKeyRequest>);
4157
4158    impl UpdateCryptoKey {
4159        pub(crate) fn new(
4160            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4161        ) -> Self {
4162            Self(RequestBuilder::new(stub))
4163        }
4164
4165        /// Sets the full request, replacing any prior values.
4166        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyRequest>>(mut self, v: V) -> Self {
4167            self.0.request = v.into();
4168            self
4169        }
4170
4171        /// Sets all the options, replacing any prior values.
4172        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4173            self.0.options = v.into();
4174            self
4175        }
4176
4177        /// Sends the request.
4178        pub async fn send(self) -> Result<crate::model::CryptoKey> {
4179            (*self.0.stub)
4180                .update_crypto_key(self.0.request, self.0.options)
4181                .await
4182                .map(gax::response::Response::into_body)
4183        }
4184
4185        /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
4186        ///
4187        /// This is a **required** field for requests.
4188        pub fn set_crypto_key<T>(mut self, v: T) -> Self
4189        where
4190            T: std::convert::Into<crate::model::CryptoKey>,
4191        {
4192            self.0.request.crypto_key = std::option::Option::Some(v.into());
4193            self
4194        }
4195
4196        /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
4197        ///
4198        /// This is a **required** field for requests.
4199        pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
4200        where
4201            T: std::convert::Into<crate::model::CryptoKey>,
4202        {
4203            self.0.request.crypto_key = v.map(|x| x.into());
4204            self
4205        }
4206
4207        /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
4208        ///
4209        /// This is a **required** field for requests.
4210        pub fn set_update_mask<T>(mut self, v: T) -> Self
4211        where
4212            T: std::convert::Into<wkt::FieldMask>,
4213        {
4214            self.0.request.update_mask = std::option::Option::Some(v.into());
4215            self
4216        }
4217
4218        /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
4219        ///
4220        /// This is a **required** field for requests.
4221        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4222        where
4223            T: std::convert::Into<wkt::FieldMask>,
4224        {
4225            self.0.request.update_mask = v.map(|x| x.into());
4226            self
4227        }
4228    }
4229
4230    #[doc(hidden)]
4231    impl gax::options::internal::RequestBuilder for UpdateCryptoKey {
4232        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4233            &mut self.0.options
4234        }
4235    }
4236
4237    /// The request builder for [KeyManagementService::update_crypto_key_version][crate::client::KeyManagementService::update_crypto_key_version] calls.
4238    ///
4239    /// # Example
4240    /// ```
4241    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKeyVersion;
4242    /// # async fn sample() -> gax::Result<()> {
4243    ///
4244    /// let builder = prepare_request_builder();
4245    /// let response = builder.send().await?;
4246    /// # Ok(()) }
4247    ///
4248    /// fn prepare_request_builder() -> UpdateCryptoKeyVersion {
4249    ///   # panic!();
4250    ///   // ... details omitted ...
4251    /// }
4252    /// ```
4253    #[derive(Clone, Debug)]
4254    pub struct UpdateCryptoKeyVersion(RequestBuilder<crate::model::UpdateCryptoKeyVersionRequest>);
4255
4256    impl UpdateCryptoKeyVersion {
4257        pub(crate) fn new(
4258            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4259        ) -> Self {
4260            Self(RequestBuilder::new(stub))
4261        }
4262
4263        /// Sets the full request, replacing any prior values.
4264        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyVersionRequest>>(
4265            mut self,
4266            v: V,
4267        ) -> Self {
4268            self.0.request = v.into();
4269            self
4270        }
4271
4272        /// Sets all the options, replacing any prior values.
4273        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4274            self.0.options = v.into();
4275            self
4276        }
4277
4278        /// Sends the request.
4279        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
4280            (*self.0.stub)
4281                .update_crypto_key_version(self.0.request, self.0.options)
4282                .await
4283                .map(gax::response::Response::into_body)
4284        }
4285
4286        /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
4287        ///
4288        /// This is a **required** field for requests.
4289        pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
4290        where
4291            T: std::convert::Into<crate::model::CryptoKeyVersion>,
4292        {
4293            self.0.request.crypto_key_version = std::option::Option::Some(v.into());
4294            self
4295        }
4296
4297        /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
4298        ///
4299        /// This is a **required** field for requests.
4300        pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
4301        where
4302            T: std::convert::Into<crate::model::CryptoKeyVersion>,
4303        {
4304            self.0.request.crypto_key_version = v.map(|x| x.into());
4305            self
4306        }
4307
4308        /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
4309        ///
4310        /// This is a **required** field for requests.
4311        pub fn set_update_mask<T>(mut self, v: T) -> Self
4312        where
4313            T: std::convert::Into<wkt::FieldMask>,
4314        {
4315            self.0.request.update_mask = std::option::Option::Some(v.into());
4316            self
4317        }
4318
4319        /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
4320        ///
4321        /// This is a **required** field for requests.
4322        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4323        where
4324            T: std::convert::Into<wkt::FieldMask>,
4325        {
4326            self.0.request.update_mask = v.map(|x| x.into());
4327            self
4328        }
4329    }
4330
4331    #[doc(hidden)]
4332    impl gax::options::internal::RequestBuilder for UpdateCryptoKeyVersion {
4333        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4334            &mut self.0.options
4335        }
4336    }
4337
4338    /// The request builder for [KeyManagementService::update_crypto_key_primary_version][crate::client::KeyManagementService::update_crypto_key_primary_version] calls.
4339    ///
4340    /// # Example
4341    /// ```
4342    /// # use google_cloud_kms_v1::builder::key_management_service::UpdateCryptoKeyPrimaryVersion;
4343    /// # async fn sample() -> gax::Result<()> {
4344    ///
4345    /// let builder = prepare_request_builder();
4346    /// let response = builder.send().await?;
4347    /// # Ok(()) }
4348    ///
4349    /// fn prepare_request_builder() -> UpdateCryptoKeyPrimaryVersion {
4350    ///   # panic!();
4351    ///   // ... details omitted ...
4352    /// }
4353    /// ```
4354    #[derive(Clone, Debug)]
4355    pub struct UpdateCryptoKeyPrimaryVersion(
4356        RequestBuilder<crate::model::UpdateCryptoKeyPrimaryVersionRequest>,
4357    );
4358
4359    impl UpdateCryptoKeyPrimaryVersion {
4360        pub(crate) fn new(
4361            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4362        ) -> Self {
4363            Self(RequestBuilder::new(stub))
4364        }
4365
4366        /// Sets the full request, replacing any prior values.
4367        pub fn with_request<V: Into<crate::model::UpdateCryptoKeyPrimaryVersionRequest>>(
4368            mut self,
4369            v: V,
4370        ) -> Self {
4371            self.0.request = v.into();
4372            self
4373        }
4374
4375        /// Sets all the options, replacing any prior values.
4376        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4377            self.0.options = v.into();
4378            self
4379        }
4380
4381        /// Sends the request.
4382        pub async fn send(self) -> Result<crate::model::CryptoKey> {
4383            (*self.0.stub)
4384                .update_crypto_key_primary_version(self.0.request, self.0.options)
4385                .await
4386                .map(gax::response::Response::into_body)
4387        }
4388
4389        /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
4390        ///
4391        /// This is a **required** field for requests.
4392        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4393            self.0.request.name = v.into();
4394            self
4395        }
4396
4397        /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
4398        ///
4399        /// This is a **required** field for requests.
4400        pub fn set_crypto_key_version_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4401            self.0.request.crypto_key_version_id = v.into();
4402            self
4403        }
4404    }
4405
4406    #[doc(hidden)]
4407    impl gax::options::internal::RequestBuilder for UpdateCryptoKeyPrimaryVersion {
4408        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4409            &mut self.0.options
4410        }
4411    }
4412
4413    /// The request builder for [KeyManagementService::destroy_crypto_key_version][crate::client::KeyManagementService::destroy_crypto_key_version] calls.
4414    ///
4415    /// # Example
4416    /// ```
4417    /// # use google_cloud_kms_v1::builder::key_management_service::DestroyCryptoKeyVersion;
4418    /// # async fn sample() -> gax::Result<()> {
4419    ///
4420    /// let builder = prepare_request_builder();
4421    /// let response = builder.send().await?;
4422    /// # Ok(()) }
4423    ///
4424    /// fn prepare_request_builder() -> DestroyCryptoKeyVersion {
4425    ///   # panic!();
4426    ///   // ... details omitted ...
4427    /// }
4428    /// ```
4429    #[derive(Clone, Debug)]
4430    pub struct DestroyCryptoKeyVersion(
4431        RequestBuilder<crate::model::DestroyCryptoKeyVersionRequest>,
4432    );
4433
4434    impl DestroyCryptoKeyVersion {
4435        pub(crate) fn new(
4436            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4437        ) -> Self {
4438            Self(RequestBuilder::new(stub))
4439        }
4440
4441        /// Sets the full request, replacing any prior values.
4442        pub fn with_request<V: Into<crate::model::DestroyCryptoKeyVersionRequest>>(
4443            mut self,
4444            v: V,
4445        ) -> Self {
4446            self.0.request = v.into();
4447            self
4448        }
4449
4450        /// Sets all the options, replacing any prior values.
4451        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4452            self.0.options = v.into();
4453            self
4454        }
4455
4456        /// Sends the request.
4457        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
4458            (*self.0.stub)
4459                .destroy_crypto_key_version(self.0.request, self.0.options)
4460                .await
4461                .map(gax::response::Response::into_body)
4462        }
4463
4464        /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
4465        ///
4466        /// This is a **required** field for requests.
4467        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4468            self.0.request.name = v.into();
4469            self
4470        }
4471    }
4472
4473    #[doc(hidden)]
4474    impl gax::options::internal::RequestBuilder for DestroyCryptoKeyVersion {
4475        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4476            &mut self.0.options
4477        }
4478    }
4479
4480    /// The request builder for [KeyManagementService::restore_crypto_key_version][crate::client::KeyManagementService::restore_crypto_key_version] calls.
4481    ///
4482    /// # Example
4483    /// ```
4484    /// # use google_cloud_kms_v1::builder::key_management_service::RestoreCryptoKeyVersion;
4485    /// # async fn sample() -> gax::Result<()> {
4486    ///
4487    /// let builder = prepare_request_builder();
4488    /// let response = builder.send().await?;
4489    /// # Ok(()) }
4490    ///
4491    /// fn prepare_request_builder() -> RestoreCryptoKeyVersion {
4492    ///   # panic!();
4493    ///   // ... details omitted ...
4494    /// }
4495    /// ```
4496    #[derive(Clone, Debug)]
4497    pub struct RestoreCryptoKeyVersion(
4498        RequestBuilder<crate::model::RestoreCryptoKeyVersionRequest>,
4499    );
4500
4501    impl RestoreCryptoKeyVersion {
4502        pub(crate) fn new(
4503            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4504        ) -> Self {
4505            Self(RequestBuilder::new(stub))
4506        }
4507
4508        /// Sets the full request, replacing any prior values.
4509        pub fn with_request<V: Into<crate::model::RestoreCryptoKeyVersionRequest>>(
4510            mut self,
4511            v: V,
4512        ) -> Self {
4513            self.0.request = v.into();
4514            self
4515        }
4516
4517        /// Sets all the options, replacing any prior values.
4518        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4519            self.0.options = v.into();
4520            self
4521        }
4522
4523        /// Sends the request.
4524        pub async fn send(self) -> Result<crate::model::CryptoKeyVersion> {
4525            (*self.0.stub)
4526                .restore_crypto_key_version(self.0.request, self.0.options)
4527                .await
4528                .map(gax::response::Response::into_body)
4529        }
4530
4531        /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
4532        ///
4533        /// This is a **required** field for requests.
4534        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4535            self.0.request.name = v.into();
4536            self
4537        }
4538    }
4539
4540    #[doc(hidden)]
4541    impl gax::options::internal::RequestBuilder for RestoreCryptoKeyVersion {
4542        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4543            &mut self.0.options
4544        }
4545    }
4546
4547    /// The request builder for [KeyManagementService::encrypt][crate::client::KeyManagementService::encrypt] calls.
4548    ///
4549    /// # Example
4550    /// ```
4551    /// # use google_cloud_kms_v1::builder::key_management_service::Encrypt;
4552    /// # async fn sample() -> gax::Result<()> {
4553    ///
4554    /// let builder = prepare_request_builder();
4555    /// let response = builder.send().await?;
4556    /// # Ok(()) }
4557    ///
4558    /// fn prepare_request_builder() -> Encrypt {
4559    ///   # panic!();
4560    ///   // ... details omitted ...
4561    /// }
4562    /// ```
4563    #[derive(Clone, Debug)]
4564    pub struct Encrypt(RequestBuilder<crate::model::EncryptRequest>);
4565
4566    impl Encrypt {
4567        pub(crate) fn new(
4568            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4569        ) -> Self {
4570            Self(RequestBuilder::new(stub))
4571        }
4572
4573        /// Sets the full request, replacing any prior values.
4574        pub fn with_request<V: Into<crate::model::EncryptRequest>>(mut self, v: V) -> Self {
4575            self.0.request = v.into();
4576            self
4577        }
4578
4579        /// Sets all the options, replacing any prior values.
4580        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4581            self.0.options = v.into();
4582            self
4583        }
4584
4585        /// Sends the request.
4586        pub async fn send(self) -> Result<crate::model::EncryptResponse> {
4587            (*self.0.stub)
4588                .encrypt(self.0.request, self.0.options)
4589                .await
4590                .map(gax::response::Response::into_body)
4591        }
4592
4593        /// Sets the value of [name][crate::model::EncryptRequest::name].
4594        ///
4595        /// This is a **required** field for requests.
4596        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4597            self.0.request.name = v.into();
4598            self
4599        }
4600
4601        /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
4602        ///
4603        /// This is a **required** field for requests.
4604        pub fn set_plaintext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4605            self.0.request.plaintext = v.into();
4606            self
4607        }
4608
4609        /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
4610        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4611            self.0.request.additional_authenticated_data = v.into();
4612            self
4613        }
4614
4615        /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
4616        pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
4617        where
4618            T: std::convert::Into<wkt::Int64Value>,
4619        {
4620            self.0.request.plaintext_crc32c = std::option::Option::Some(v.into());
4621            self
4622        }
4623
4624        /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
4625        pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
4626        where
4627            T: std::convert::Into<wkt::Int64Value>,
4628        {
4629            self.0.request.plaintext_crc32c = v.map(|x| x.into());
4630            self
4631        }
4632
4633        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
4634        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
4635        where
4636            T: std::convert::Into<wkt::Int64Value>,
4637        {
4638            self.0.request.additional_authenticated_data_crc32c =
4639                std::option::Option::Some(v.into());
4640            self
4641        }
4642
4643        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
4644        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
4645            mut self,
4646            v: std::option::Option<T>,
4647        ) -> Self
4648        where
4649            T: std::convert::Into<wkt::Int64Value>,
4650        {
4651            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
4652            self
4653        }
4654    }
4655
4656    #[doc(hidden)]
4657    impl gax::options::internal::RequestBuilder for Encrypt {
4658        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4659            &mut self.0.options
4660        }
4661    }
4662
4663    /// The request builder for [KeyManagementService::decrypt][crate::client::KeyManagementService::decrypt] calls.
4664    ///
4665    /// # Example
4666    /// ```
4667    /// # use google_cloud_kms_v1::builder::key_management_service::Decrypt;
4668    /// # async fn sample() -> gax::Result<()> {
4669    ///
4670    /// let builder = prepare_request_builder();
4671    /// let response = builder.send().await?;
4672    /// # Ok(()) }
4673    ///
4674    /// fn prepare_request_builder() -> Decrypt {
4675    ///   # panic!();
4676    ///   // ... details omitted ...
4677    /// }
4678    /// ```
4679    #[derive(Clone, Debug)]
4680    pub struct Decrypt(RequestBuilder<crate::model::DecryptRequest>);
4681
4682    impl Decrypt {
4683        pub(crate) fn new(
4684            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4685        ) -> Self {
4686            Self(RequestBuilder::new(stub))
4687        }
4688
4689        /// Sets the full request, replacing any prior values.
4690        pub fn with_request<V: Into<crate::model::DecryptRequest>>(mut self, v: V) -> Self {
4691            self.0.request = v.into();
4692            self
4693        }
4694
4695        /// Sets all the options, replacing any prior values.
4696        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4697            self.0.options = v.into();
4698            self
4699        }
4700
4701        /// Sends the request.
4702        pub async fn send(self) -> Result<crate::model::DecryptResponse> {
4703            (*self.0.stub)
4704                .decrypt(self.0.request, self.0.options)
4705                .await
4706                .map(gax::response::Response::into_body)
4707        }
4708
4709        /// Sets the value of [name][crate::model::DecryptRequest::name].
4710        ///
4711        /// This is a **required** field for requests.
4712        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4713            self.0.request.name = v.into();
4714            self
4715        }
4716
4717        /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
4718        ///
4719        /// This is a **required** field for requests.
4720        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4721            self.0.request.ciphertext = v.into();
4722            self
4723        }
4724
4725        /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
4726        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4727            self.0.request.additional_authenticated_data = v.into();
4728            self
4729        }
4730
4731        /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
4732        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
4733        where
4734            T: std::convert::Into<wkt::Int64Value>,
4735        {
4736            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
4737            self
4738        }
4739
4740        /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
4741        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
4742        where
4743            T: std::convert::Into<wkt::Int64Value>,
4744        {
4745            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
4746            self
4747        }
4748
4749        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
4750        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
4751        where
4752            T: std::convert::Into<wkt::Int64Value>,
4753        {
4754            self.0.request.additional_authenticated_data_crc32c =
4755                std::option::Option::Some(v.into());
4756            self
4757        }
4758
4759        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
4760        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
4761            mut self,
4762            v: std::option::Option<T>,
4763        ) -> Self
4764        where
4765            T: std::convert::Into<wkt::Int64Value>,
4766        {
4767            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
4768            self
4769        }
4770    }
4771
4772    #[doc(hidden)]
4773    impl gax::options::internal::RequestBuilder for Decrypt {
4774        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4775            &mut self.0.options
4776        }
4777    }
4778
4779    /// The request builder for [KeyManagementService::raw_encrypt][crate::client::KeyManagementService::raw_encrypt] calls.
4780    ///
4781    /// # Example
4782    /// ```
4783    /// # use google_cloud_kms_v1::builder::key_management_service::RawEncrypt;
4784    /// # async fn sample() -> gax::Result<()> {
4785    ///
4786    /// let builder = prepare_request_builder();
4787    /// let response = builder.send().await?;
4788    /// # Ok(()) }
4789    ///
4790    /// fn prepare_request_builder() -> RawEncrypt {
4791    ///   # panic!();
4792    ///   // ... details omitted ...
4793    /// }
4794    /// ```
4795    #[derive(Clone, Debug)]
4796    pub struct RawEncrypt(RequestBuilder<crate::model::RawEncryptRequest>);
4797
4798    impl RawEncrypt {
4799        pub(crate) fn new(
4800            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4801        ) -> Self {
4802            Self(RequestBuilder::new(stub))
4803        }
4804
4805        /// Sets the full request, replacing any prior values.
4806        pub fn with_request<V: Into<crate::model::RawEncryptRequest>>(mut self, v: V) -> Self {
4807            self.0.request = v.into();
4808            self
4809        }
4810
4811        /// Sets all the options, replacing any prior values.
4812        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4813            self.0.options = v.into();
4814            self
4815        }
4816
4817        /// Sends the request.
4818        pub async fn send(self) -> Result<crate::model::RawEncryptResponse> {
4819            (*self.0.stub)
4820                .raw_encrypt(self.0.request, self.0.options)
4821                .await
4822                .map(gax::response::Response::into_body)
4823        }
4824
4825        /// Sets the value of [name][crate::model::RawEncryptRequest::name].
4826        ///
4827        /// This is a **required** field for requests.
4828        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4829            self.0.request.name = v.into();
4830            self
4831        }
4832
4833        /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
4834        ///
4835        /// This is a **required** field for requests.
4836        pub fn set_plaintext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4837            self.0.request.plaintext = v.into();
4838            self
4839        }
4840
4841        /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
4842        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4843            self.0.request.additional_authenticated_data = v.into();
4844            self
4845        }
4846
4847        /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
4848        pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
4849        where
4850            T: std::convert::Into<wkt::Int64Value>,
4851        {
4852            self.0.request.plaintext_crc32c = std::option::Option::Some(v.into());
4853            self
4854        }
4855
4856        /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
4857        pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
4858        where
4859            T: std::convert::Into<wkt::Int64Value>,
4860        {
4861            self.0.request.plaintext_crc32c = v.map(|x| x.into());
4862            self
4863        }
4864
4865        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
4866        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
4867        where
4868            T: std::convert::Into<wkt::Int64Value>,
4869        {
4870            self.0.request.additional_authenticated_data_crc32c =
4871                std::option::Option::Some(v.into());
4872            self
4873        }
4874
4875        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
4876        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
4877            mut self,
4878            v: std::option::Option<T>,
4879        ) -> Self
4880        where
4881            T: std::convert::Into<wkt::Int64Value>,
4882        {
4883            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
4884            self
4885        }
4886
4887        /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
4888        pub fn set_initialization_vector<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4889            self.0.request.initialization_vector = v.into();
4890            self
4891        }
4892
4893        /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
4894        pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
4895        where
4896            T: std::convert::Into<wkt::Int64Value>,
4897        {
4898            self.0.request.initialization_vector_crc32c = std::option::Option::Some(v.into());
4899            self
4900        }
4901
4902        /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
4903        pub fn set_or_clear_initialization_vector_crc32c<T>(
4904            mut self,
4905            v: std::option::Option<T>,
4906        ) -> Self
4907        where
4908            T: std::convert::Into<wkt::Int64Value>,
4909        {
4910            self.0.request.initialization_vector_crc32c = v.map(|x| x.into());
4911            self
4912        }
4913    }
4914
4915    #[doc(hidden)]
4916    impl gax::options::internal::RequestBuilder for RawEncrypt {
4917        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4918            &mut self.0.options
4919        }
4920    }
4921
4922    /// The request builder for [KeyManagementService::raw_decrypt][crate::client::KeyManagementService::raw_decrypt] calls.
4923    ///
4924    /// # Example
4925    /// ```
4926    /// # use google_cloud_kms_v1::builder::key_management_service::RawDecrypt;
4927    /// # async fn sample() -> gax::Result<()> {
4928    ///
4929    /// let builder = prepare_request_builder();
4930    /// let response = builder.send().await?;
4931    /// # Ok(()) }
4932    ///
4933    /// fn prepare_request_builder() -> RawDecrypt {
4934    ///   # panic!();
4935    ///   // ... details omitted ...
4936    /// }
4937    /// ```
4938    #[derive(Clone, Debug)]
4939    pub struct RawDecrypt(RequestBuilder<crate::model::RawDecryptRequest>);
4940
4941    impl RawDecrypt {
4942        pub(crate) fn new(
4943            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
4944        ) -> Self {
4945            Self(RequestBuilder::new(stub))
4946        }
4947
4948        /// Sets the full request, replacing any prior values.
4949        pub fn with_request<V: Into<crate::model::RawDecryptRequest>>(mut self, v: V) -> Self {
4950            self.0.request = v.into();
4951            self
4952        }
4953
4954        /// Sets all the options, replacing any prior values.
4955        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4956            self.0.options = v.into();
4957            self
4958        }
4959
4960        /// Sends the request.
4961        pub async fn send(self) -> Result<crate::model::RawDecryptResponse> {
4962            (*self.0.stub)
4963                .raw_decrypt(self.0.request, self.0.options)
4964                .await
4965                .map(gax::response::Response::into_body)
4966        }
4967
4968        /// Sets the value of [name][crate::model::RawDecryptRequest::name].
4969        ///
4970        /// This is a **required** field for requests.
4971        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4972            self.0.request.name = v.into();
4973            self
4974        }
4975
4976        /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
4977        ///
4978        /// This is a **required** field for requests.
4979        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4980            self.0.request.ciphertext = v.into();
4981            self
4982        }
4983
4984        /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
4985        pub fn set_additional_authenticated_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4986            self.0.request.additional_authenticated_data = v.into();
4987            self
4988        }
4989
4990        /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
4991        ///
4992        /// This is a **required** field for requests.
4993        pub fn set_initialization_vector<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4994            self.0.request.initialization_vector = v.into();
4995            self
4996        }
4997
4998        /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
4999        pub fn set_tag_length<T: Into<i32>>(mut self, v: T) -> Self {
5000            self.0.request.tag_length = v.into();
5001            self
5002        }
5003
5004        /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
5005        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
5006        where
5007            T: std::convert::Into<wkt::Int64Value>,
5008        {
5009            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
5010            self
5011        }
5012
5013        /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
5014        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5015        where
5016            T: std::convert::Into<wkt::Int64Value>,
5017        {
5018            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
5019            self
5020        }
5021
5022        /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
5023        pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
5024        where
5025            T: std::convert::Into<wkt::Int64Value>,
5026        {
5027            self.0.request.additional_authenticated_data_crc32c =
5028                std::option::Option::Some(v.into());
5029            self
5030        }
5031
5032        /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
5033        pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
5034            mut self,
5035            v: std::option::Option<T>,
5036        ) -> Self
5037        where
5038            T: std::convert::Into<wkt::Int64Value>,
5039        {
5040            self.0.request.additional_authenticated_data_crc32c = v.map(|x| x.into());
5041            self
5042        }
5043
5044        /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
5045        pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
5046        where
5047            T: std::convert::Into<wkt::Int64Value>,
5048        {
5049            self.0.request.initialization_vector_crc32c = std::option::Option::Some(v.into());
5050            self
5051        }
5052
5053        /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
5054        pub fn set_or_clear_initialization_vector_crc32c<T>(
5055            mut self,
5056            v: std::option::Option<T>,
5057        ) -> Self
5058        where
5059            T: std::convert::Into<wkt::Int64Value>,
5060        {
5061            self.0.request.initialization_vector_crc32c = v.map(|x| x.into());
5062            self
5063        }
5064    }
5065
5066    #[doc(hidden)]
5067    impl gax::options::internal::RequestBuilder for RawDecrypt {
5068        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5069            &mut self.0.options
5070        }
5071    }
5072
5073    /// The request builder for [KeyManagementService::asymmetric_sign][crate::client::KeyManagementService::asymmetric_sign] calls.
5074    ///
5075    /// # Example
5076    /// ```
5077    /// # use google_cloud_kms_v1::builder::key_management_service::AsymmetricSign;
5078    /// # async fn sample() -> gax::Result<()> {
5079    ///
5080    /// let builder = prepare_request_builder();
5081    /// let response = builder.send().await?;
5082    /// # Ok(()) }
5083    ///
5084    /// fn prepare_request_builder() -> AsymmetricSign {
5085    ///   # panic!();
5086    ///   // ... details omitted ...
5087    /// }
5088    /// ```
5089    #[derive(Clone, Debug)]
5090    pub struct AsymmetricSign(RequestBuilder<crate::model::AsymmetricSignRequest>);
5091
5092    impl AsymmetricSign {
5093        pub(crate) fn new(
5094            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5095        ) -> Self {
5096            Self(RequestBuilder::new(stub))
5097        }
5098
5099        /// Sets the full request, replacing any prior values.
5100        pub fn with_request<V: Into<crate::model::AsymmetricSignRequest>>(mut self, v: V) -> Self {
5101            self.0.request = v.into();
5102            self
5103        }
5104
5105        /// Sets all the options, replacing any prior values.
5106        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5107            self.0.options = v.into();
5108            self
5109        }
5110
5111        /// Sends the request.
5112        pub async fn send(self) -> Result<crate::model::AsymmetricSignResponse> {
5113            (*self.0.stub)
5114                .asymmetric_sign(self.0.request, self.0.options)
5115                .await
5116                .map(gax::response::Response::into_body)
5117        }
5118
5119        /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
5120        ///
5121        /// This is a **required** field for requests.
5122        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5123            self.0.request.name = v.into();
5124            self
5125        }
5126
5127        /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
5128        pub fn set_digest<T>(mut self, v: T) -> Self
5129        where
5130            T: std::convert::Into<crate::model::Digest>,
5131        {
5132            self.0.request.digest = std::option::Option::Some(v.into());
5133            self
5134        }
5135
5136        /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
5137        pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
5138        where
5139            T: std::convert::Into<crate::model::Digest>,
5140        {
5141            self.0.request.digest = v.map(|x| x.into());
5142            self
5143        }
5144
5145        /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
5146        pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
5147        where
5148            T: std::convert::Into<wkt::Int64Value>,
5149        {
5150            self.0.request.digest_crc32c = std::option::Option::Some(v.into());
5151            self
5152        }
5153
5154        /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
5155        pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5156        where
5157            T: std::convert::Into<wkt::Int64Value>,
5158        {
5159            self.0.request.digest_crc32c = v.map(|x| x.into());
5160            self
5161        }
5162
5163        /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
5164        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5165            self.0.request.data = v.into();
5166            self
5167        }
5168
5169        /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
5170        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
5171        where
5172            T: std::convert::Into<wkt::Int64Value>,
5173        {
5174            self.0.request.data_crc32c = std::option::Option::Some(v.into());
5175            self
5176        }
5177
5178        /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
5179        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5180        where
5181            T: std::convert::Into<wkt::Int64Value>,
5182        {
5183            self.0.request.data_crc32c = v.map(|x| x.into());
5184            self
5185        }
5186    }
5187
5188    #[doc(hidden)]
5189    impl gax::options::internal::RequestBuilder for AsymmetricSign {
5190        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5191            &mut self.0.options
5192        }
5193    }
5194
5195    /// The request builder for [KeyManagementService::asymmetric_decrypt][crate::client::KeyManagementService::asymmetric_decrypt] calls.
5196    ///
5197    /// # Example
5198    /// ```
5199    /// # use google_cloud_kms_v1::builder::key_management_service::AsymmetricDecrypt;
5200    /// # async fn sample() -> gax::Result<()> {
5201    ///
5202    /// let builder = prepare_request_builder();
5203    /// let response = builder.send().await?;
5204    /// # Ok(()) }
5205    ///
5206    /// fn prepare_request_builder() -> AsymmetricDecrypt {
5207    ///   # panic!();
5208    ///   // ... details omitted ...
5209    /// }
5210    /// ```
5211    #[derive(Clone, Debug)]
5212    pub struct AsymmetricDecrypt(RequestBuilder<crate::model::AsymmetricDecryptRequest>);
5213
5214    impl AsymmetricDecrypt {
5215        pub(crate) fn new(
5216            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5217        ) -> Self {
5218            Self(RequestBuilder::new(stub))
5219        }
5220
5221        /// Sets the full request, replacing any prior values.
5222        pub fn with_request<V: Into<crate::model::AsymmetricDecryptRequest>>(
5223            mut self,
5224            v: V,
5225        ) -> Self {
5226            self.0.request = v.into();
5227            self
5228        }
5229
5230        /// Sets all the options, replacing any prior values.
5231        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5232            self.0.options = v.into();
5233            self
5234        }
5235
5236        /// Sends the request.
5237        pub async fn send(self) -> Result<crate::model::AsymmetricDecryptResponse> {
5238            (*self.0.stub)
5239                .asymmetric_decrypt(self.0.request, self.0.options)
5240                .await
5241                .map(gax::response::Response::into_body)
5242        }
5243
5244        /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
5245        ///
5246        /// This is a **required** field for requests.
5247        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5248            self.0.request.name = v.into();
5249            self
5250        }
5251
5252        /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
5253        ///
5254        /// This is a **required** field for requests.
5255        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5256            self.0.request.ciphertext = v.into();
5257            self
5258        }
5259
5260        /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
5261        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
5262        where
5263            T: std::convert::Into<wkt::Int64Value>,
5264        {
5265            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
5266            self
5267        }
5268
5269        /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
5270        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5271        where
5272            T: std::convert::Into<wkt::Int64Value>,
5273        {
5274            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
5275            self
5276        }
5277    }
5278
5279    #[doc(hidden)]
5280    impl gax::options::internal::RequestBuilder for AsymmetricDecrypt {
5281        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5282            &mut self.0.options
5283        }
5284    }
5285
5286    /// The request builder for [KeyManagementService::mac_sign][crate::client::KeyManagementService::mac_sign] calls.
5287    ///
5288    /// # Example
5289    /// ```
5290    /// # use google_cloud_kms_v1::builder::key_management_service::MacSign;
5291    /// # async fn sample() -> gax::Result<()> {
5292    ///
5293    /// let builder = prepare_request_builder();
5294    /// let response = builder.send().await?;
5295    /// # Ok(()) }
5296    ///
5297    /// fn prepare_request_builder() -> MacSign {
5298    ///   # panic!();
5299    ///   // ... details omitted ...
5300    /// }
5301    /// ```
5302    #[derive(Clone, Debug)]
5303    pub struct MacSign(RequestBuilder<crate::model::MacSignRequest>);
5304
5305    impl MacSign {
5306        pub(crate) fn new(
5307            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5308        ) -> Self {
5309            Self(RequestBuilder::new(stub))
5310        }
5311
5312        /// Sets the full request, replacing any prior values.
5313        pub fn with_request<V: Into<crate::model::MacSignRequest>>(mut self, v: V) -> Self {
5314            self.0.request = v.into();
5315            self
5316        }
5317
5318        /// Sets all the options, replacing any prior values.
5319        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5320            self.0.options = v.into();
5321            self
5322        }
5323
5324        /// Sends the request.
5325        pub async fn send(self) -> Result<crate::model::MacSignResponse> {
5326            (*self.0.stub)
5327                .mac_sign(self.0.request, self.0.options)
5328                .await
5329                .map(gax::response::Response::into_body)
5330        }
5331
5332        /// Sets the value of [name][crate::model::MacSignRequest::name].
5333        ///
5334        /// This is a **required** field for requests.
5335        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5336            self.0.request.name = v.into();
5337            self
5338        }
5339
5340        /// Sets the value of [data][crate::model::MacSignRequest::data].
5341        ///
5342        /// This is a **required** field for requests.
5343        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5344            self.0.request.data = v.into();
5345            self
5346        }
5347
5348        /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
5349        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
5350        where
5351            T: std::convert::Into<wkt::Int64Value>,
5352        {
5353            self.0.request.data_crc32c = std::option::Option::Some(v.into());
5354            self
5355        }
5356
5357        /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
5358        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5359        where
5360            T: std::convert::Into<wkt::Int64Value>,
5361        {
5362            self.0.request.data_crc32c = v.map(|x| x.into());
5363            self
5364        }
5365    }
5366
5367    #[doc(hidden)]
5368    impl gax::options::internal::RequestBuilder for MacSign {
5369        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5370            &mut self.0.options
5371        }
5372    }
5373
5374    /// The request builder for [KeyManagementService::mac_verify][crate::client::KeyManagementService::mac_verify] calls.
5375    ///
5376    /// # Example
5377    /// ```
5378    /// # use google_cloud_kms_v1::builder::key_management_service::MacVerify;
5379    /// # async fn sample() -> gax::Result<()> {
5380    ///
5381    /// let builder = prepare_request_builder();
5382    /// let response = builder.send().await?;
5383    /// # Ok(()) }
5384    ///
5385    /// fn prepare_request_builder() -> MacVerify {
5386    ///   # panic!();
5387    ///   // ... details omitted ...
5388    /// }
5389    /// ```
5390    #[derive(Clone, Debug)]
5391    pub struct MacVerify(RequestBuilder<crate::model::MacVerifyRequest>);
5392
5393    impl MacVerify {
5394        pub(crate) fn new(
5395            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5396        ) -> Self {
5397            Self(RequestBuilder::new(stub))
5398        }
5399
5400        /// Sets the full request, replacing any prior values.
5401        pub fn with_request<V: Into<crate::model::MacVerifyRequest>>(mut self, v: V) -> Self {
5402            self.0.request = v.into();
5403            self
5404        }
5405
5406        /// Sets all the options, replacing any prior values.
5407        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5408            self.0.options = v.into();
5409            self
5410        }
5411
5412        /// Sends the request.
5413        pub async fn send(self) -> Result<crate::model::MacVerifyResponse> {
5414            (*self.0.stub)
5415                .mac_verify(self.0.request, self.0.options)
5416                .await
5417                .map(gax::response::Response::into_body)
5418        }
5419
5420        /// Sets the value of [name][crate::model::MacVerifyRequest::name].
5421        ///
5422        /// This is a **required** field for requests.
5423        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5424            self.0.request.name = v.into();
5425            self
5426        }
5427
5428        /// Sets the value of [data][crate::model::MacVerifyRequest::data].
5429        ///
5430        /// This is a **required** field for requests.
5431        pub fn set_data<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5432            self.0.request.data = v.into();
5433            self
5434        }
5435
5436        /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
5437        pub fn set_data_crc32c<T>(mut self, v: T) -> Self
5438        where
5439            T: std::convert::Into<wkt::Int64Value>,
5440        {
5441            self.0.request.data_crc32c = std::option::Option::Some(v.into());
5442            self
5443        }
5444
5445        /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
5446        pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5447        where
5448            T: std::convert::Into<wkt::Int64Value>,
5449        {
5450            self.0.request.data_crc32c = v.map(|x| x.into());
5451            self
5452        }
5453
5454        /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
5455        ///
5456        /// This is a **required** field for requests.
5457        pub fn set_mac<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5458            self.0.request.mac = v.into();
5459            self
5460        }
5461
5462        /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
5463        pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
5464        where
5465            T: std::convert::Into<wkt::Int64Value>,
5466        {
5467            self.0.request.mac_crc32c = std::option::Option::Some(v.into());
5468            self
5469        }
5470
5471        /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
5472        pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5473        where
5474            T: std::convert::Into<wkt::Int64Value>,
5475        {
5476            self.0.request.mac_crc32c = v.map(|x| x.into());
5477            self
5478        }
5479    }
5480
5481    #[doc(hidden)]
5482    impl gax::options::internal::RequestBuilder for MacVerify {
5483        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5484            &mut self.0.options
5485        }
5486    }
5487
5488    /// The request builder for [KeyManagementService::decapsulate][crate::client::KeyManagementService::decapsulate] calls.
5489    ///
5490    /// # Example
5491    /// ```
5492    /// # use google_cloud_kms_v1::builder::key_management_service::Decapsulate;
5493    /// # async fn sample() -> gax::Result<()> {
5494    ///
5495    /// let builder = prepare_request_builder();
5496    /// let response = builder.send().await?;
5497    /// # Ok(()) }
5498    ///
5499    /// fn prepare_request_builder() -> Decapsulate {
5500    ///   # panic!();
5501    ///   // ... details omitted ...
5502    /// }
5503    /// ```
5504    #[derive(Clone, Debug)]
5505    pub struct Decapsulate(RequestBuilder<crate::model::DecapsulateRequest>);
5506
5507    impl Decapsulate {
5508        pub(crate) fn new(
5509            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5510        ) -> Self {
5511            Self(RequestBuilder::new(stub))
5512        }
5513
5514        /// Sets the full request, replacing any prior values.
5515        pub fn with_request<V: Into<crate::model::DecapsulateRequest>>(mut self, v: V) -> Self {
5516            self.0.request = v.into();
5517            self
5518        }
5519
5520        /// Sets all the options, replacing any prior values.
5521        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5522            self.0.options = v.into();
5523            self
5524        }
5525
5526        /// Sends the request.
5527        pub async fn send(self) -> Result<crate::model::DecapsulateResponse> {
5528            (*self.0.stub)
5529                .decapsulate(self.0.request, self.0.options)
5530                .await
5531                .map(gax::response::Response::into_body)
5532        }
5533
5534        /// Sets the value of [name][crate::model::DecapsulateRequest::name].
5535        ///
5536        /// This is a **required** field for requests.
5537        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5538            self.0.request.name = v.into();
5539            self
5540        }
5541
5542        /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
5543        ///
5544        /// This is a **required** field for requests.
5545        pub fn set_ciphertext<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5546            self.0.request.ciphertext = v.into();
5547            self
5548        }
5549
5550        /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
5551        pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
5552        where
5553            T: std::convert::Into<wkt::Int64Value>,
5554        {
5555            self.0.request.ciphertext_crc32c = std::option::Option::Some(v.into());
5556            self
5557        }
5558
5559        /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
5560        pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5561        where
5562            T: std::convert::Into<wkt::Int64Value>,
5563        {
5564            self.0.request.ciphertext_crc32c = v.map(|x| x.into());
5565            self
5566        }
5567    }
5568
5569    #[doc(hidden)]
5570    impl gax::options::internal::RequestBuilder for Decapsulate {
5571        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5572            &mut self.0.options
5573        }
5574    }
5575
5576    /// The request builder for [KeyManagementService::generate_random_bytes][crate::client::KeyManagementService::generate_random_bytes] calls.
5577    ///
5578    /// # Example
5579    /// ```
5580    /// # use google_cloud_kms_v1::builder::key_management_service::GenerateRandomBytes;
5581    /// # async fn sample() -> gax::Result<()> {
5582    ///
5583    /// let builder = prepare_request_builder();
5584    /// let response = builder.send().await?;
5585    /// # Ok(()) }
5586    ///
5587    /// fn prepare_request_builder() -> GenerateRandomBytes {
5588    ///   # panic!();
5589    ///   // ... details omitted ...
5590    /// }
5591    /// ```
5592    #[derive(Clone, Debug)]
5593    pub struct GenerateRandomBytes(RequestBuilder<crate::model::GenerateRandomBytesRequest>);
5594
5595    impl GenerateRandomBytes {
5596        pub(crate) fn new(
5597            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5598        ) -> Self {
5599            Self(RequestBuilder::new(stub))
5600        }
5601
5602        /// Sets the full request, replacing any prior values.
5603        pub fn with_request<V: Into<crate::model::GenerateRandomBytesRequest>>(
5604            mut self,
5605            v: V,
5606        ) -> Self {
5607            self.0.request = v.into();
5608            self
5609        }
5610
5611        /// Sets all the options, replacing any prior values.
5612        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5613            self.0.options = v.into();
5614            self
5615        }
5616
5617        /// Sends the request.
5618        pub async fn send(self) -> Result<crate::model::GenerateRandomBytesResponse> {
5619            (*self.0.stub)
5620                .generate_random_bytes(self.0.request, self.0.options)
5621                .await
5622                .map(gax::response::Response::into_body)
5623        }
5624
5625        /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
5626        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
5627            self.0.request.location = v.into();
5628            self
5629        }
5630
5631        /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
5632        pub fn set_length_bytes<T: Into<i32>>(mut self, v: T) -> Self {
5633            self.0.request.length_bytes = v.into();
5634            self
5635        }
5636
5637        /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
5638        pub fn set_protection_level<T: Into<crate::model::ProtectionLevel>>(
5639            mut self,
5640            v: T,
5641        ) -> Self {
5642            self.0.request.protection_level = v.into();
5643            self
5644        }
5645    }
5646
5647    #[doc(hidden)]
5648    impl gax::options::internal::RequestBuilder for GenerateRandomBytes {
5649        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5650            &mut self.0.options
5651        }
5652    }
5653
5654    /// The request builder for [KeyManagementService::list_locations][crate::client::KeyManagementService::list_locations] calls.
5655    ///
5656    /// # Example
5657    /// ```
5658    /// # use google_cloud_kms_v1::builder::key_management_service::ListLocations;
5659    /// # async fn sample() -> gax::Result<()> {
5660    /// use gax::paginator::ItemPaginator;
5661    ///
5662    /// let builder = prepare_request_builder();
5663    /// let mut items = builder.by_item();
5664    /// while let Some(result) = items.next().await {
5665    ///   let item = result?;
5666    /// }
5667    /// # Ok(()) }
5668    ///
5669    /// fn prepare_request_builder() -> ListLocations {
5670    ///   # panic!();
5671    ///   // ... details omitted ...
5672    /// }
5673    /// ```
5674    #[derive(Clone, Debug)]
5675    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
5676
5677    impl ListLocations {
5678        pub(crate) fn new(
5679            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5680        ) -> Self {
5681            Self(RequestBuilder::new(stub))
5682        }
5683
5684        /// Sets the full request, replacing any prior values.
5685        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
5686            mut self,
5687            v: V,
5688        ) -> Self {
5689            self.0.request = v.into();
5690            self
5691        }
5692
5693        /// Sets all the options, replacing any prior values.
5694        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5695            self.0.options = v.into();
5696            self
5697        }
5698
5699        /// Sends the request.
5700        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
5701            (*self.0.stub)
5702                .list_locations(self.0.request, self.0.options)
5703                .await
5704                .map(gax::response::Response::into_body)
5705        }
5706
5707        /// Streams each page in the collection.
5708        pub fn by_page(
5709            self,
5710        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
5711        {
5712            use std::clone::Clone;
5713            let token = self.0.request.page_token.clone();
5714            let execute = move |token: String| {
5715                let mut builder = self.clone();
5716                builder.0.request = builder.0.request.set_page_token(token);
5717                builder.send()
5718            };
5719            gax::paginator::internal::new_paginator(token, execute)
5720        }
5721
5722        /// Streams each item in the collection.
5723        pub fn by_item(
5724            self,
5725        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
5726        {
5727            use gax::paginator::Paginator;
5728            self.by_page().items()
5729        }
5730
5731        /// Sets the value of [name][location::model::ListLocationsRequest::name].
5732        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5733            self.0.request.name = v.into();
5734            self
5735        }
5736
5737        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
5738        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5739            self.0.request.filter = v.into();
5740            self
5741        }
5742
5743        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
5744        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5745            self.0.request.page_size = v.into();
5746            self
5747        }
5748
5749        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
5750        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5751            self.0.request.page_token = v.into();
5752            self
5753        }
5754    }
5755
5756    #[doc(hidden)]
5757    impl gax::options::internal::RequestBuilder for ListLocations {
5758        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5759            &mut self.0.options
5760        }
5761    }
5762
5763    /// The request builder for [KeyManagementService::get_location][crate::client::KeyManagementService::get_location] calls.
5764    ///
5765    /// # Example
5766    /// ```
5767    /// # use google_cloud_kms_v1::builder::key_management_service::GetLocation;
5768    /// # async fn sample() -> gax::Result<()> {
5769    ///
5770    /// let builder = prepare_request_builder();
5771    /// let response = builder.send().await?;
5772    /// # Ok(()) }
5773    ///
5774    /// fn prepare_request_builder() -> GetLocation {
5775    ///   # panic!();
5776    ///   // ... details omitted ...
5777    /// }
5778    /// ```
5779    #[derive(Clone, Debug)]
5780    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
5781
5782    impl GetLocation {
5783        pub(crate) fn new(
5784            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5785        ) -> Self {
5786            Self(RequestBuilder::new(stub))
5787        }
5788
5789        /// Sets the full request, replacing any prior values.
5790        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
5791            self.0.request = v.into();
5792            self
5793        }
5794
5795        /// Sets all the options, replacing any prior values.
5796        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5797            self.0.options = v.into();
5798            self
5799        }
5800
5801        /// Sends the request.
5802        pub async fn send(self) -> Result<location::model::Location> {
5803            (*self.0.stub)
5804                .get_location(self.0.request, self.0.options)
5805                .await
5806                .map(gax::response::Response::into_body)
5807        }
5808
5809        /// Sets the value of [name][location::model::GetLocationRequest::name].
5810        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5811            self.0.request.name = v.into();
5812            self
5813        }
5814    }
5815
5816    #[doc(hidden)]
5817    impl gax::options::internal::RequestBuilder for GetLocation {
5818        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5819            &mut self.0.options
5820        }
5821    }
5822
5823    /// The request builder for [KeyManagementService::set_iam_policy][crate::client::KeyManagementService::set_iam_policy] calls.
5824    ///
5825    /// # Example
5826    /// ```
5827    /// # use google_cloud_kms_v1::builder::key_management_service::SetIamPolicy;
5828    /// # async fn sample() -> gax::Result<()> {
5829    ///
5830    /// let builder = prepare_request_builder();
5831    /// let response = builder.send().await?;
5832    /// # Ok(()) }
5833    ///
5834    /// fn prepare_request_builder() -> SetIamPolicy {
5835    ///   # panic!();
5836    ///   // ... details omitted ...
5837    /// }
5838    /// ```
5839    #[derive(Clone, Debug)]
5840    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5841
5842    impl SetIamPolicy {
5843        pub(crate) fn new(
5844            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5845        ) -> Self {
5846            Self(RequestBuilder::new(stub))
5847        }
5848
5849        /// Sets the full request, replacing any prior values.
5850        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5851            self.0.request = v.into();
5852            self
5853        }
5854
5855        /// Sets all the options, replacing any prior values.
5856        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5857            self.0.options = v.into();
5858            self
5859        }
5860
5861        /// Sends the request.
5862        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5863            (*self.0.stub)
5864                .set_iam_policy(self.0.request, self.0.options)
5865                .await
5866                .map(gax::response::Response::into_body)
5867        }
5868
5869        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
5870        ///
5871        /// This is a **required** field for requests.
5872        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5873            self.0.request.resource = v.into();
5874            self
5875        }
5876
5877        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5878        ///
5879        /// This is a **required** field for requests.
5880        pub fn set_policy<T>(mut self, v: T) -> Self
5881        where
5882            T: std::convert::Into<iam_v1::model::Policy>,
5883        {
5884            self.0.request.policy = std::option::Option::Some(v.into());
5885            self
5886        }
5887
5888        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5889        ///
5890        /// This is a **required** field for requests.
5891        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5892        where
5893            T: std::convert::Into<iam_v1::model::Policy>,
5894        {
5895            self.0.request.policy = v.map(|x| x.into());
5896            self
5897        }
5898
5899        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5900        pub fn set_update_mask<T>(mut self, v: T) -> Self
5901        where
5902            T: std::convert::Into<wkt::FieldMask>,
5903        {
5904            self.0.request.update_mask = std::option::Option::Some(v.into());
5905            self
5906        }
5907
5908        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5909        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5910        where
5911            T: std::convert::Into<wkt::FieldMask>,
5912        {
5913            self.0.request.update_mask = v.map(|x| x.into());
5914            self
5915        }
5916    }
5917
5918    #[doc(hidden)]
5919    impl gax::options::internal::RequestBuilder for SetIamPolicy {
5920        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5921            &mut self.0.options
5922        }
5923    }
5924
5925    /// The request builder for [KeyManagementService::get_iam_policy][crate::client::KeyManagementService::get_iam_policy] calls.
5926    ///
5927    /// # Example
5928    /// ```
5929    /// # use google_cloud_kms_v1::builder::key_management_service::GetIamPolicy;
5930    /// # async fn sample() -> gax::Result<()> {
5931    ///
5932    /// let builder = prepare_request_builder();
5933    /// let response = builder.send().await?;
5934    /// # Ok(()) }
5935    ///
5936    /// fn prepare_request_builder() -> GetIamPolicy {
5937    ///   # panic!();
5938    ///   // ... details omitted ...
5939    /// }
5940    /// ```
5941    #[derive(Clone, Debug)]
5942    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5943
5944    impl GetIamPolicy {
5945        pub(crate) fn new(
5946            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
5947        ) -> Self {
5948            Self(RequestBuilder::new(stub))
5949        }
5950
5951        /// Sets the full request, replacing any prior values.
5952        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5953            self.0.request = v.into();
5954            self
5955        }
5956
5957        /// Sets all the options, replacing any prior values.
5958        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5959            self.0.options = v.into();
5960            self
5961        }
5962
5963        /// Sends the request.
5964        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5965            (*self.0.stub)
5966                .get_iam_policy(self.0.request, self.0.options)
5967                .await
5968                .map(gax::response::Response::into_body)
5969        }
5970
5971        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
5972        ///
5973        /// This is a **required** field for requests.
5974        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5975            self.0.request.resource = v.into();
5976            self
5977        }
5978
5979        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5980        pub fn set_options<T>(mut self, v: T) -> Self
5981        where
5982            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5983        {
5984            self.0.request.options = std::option::Option::Some(v.into());
5985            self
5986        }
5987
5988        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5989        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5990        where
5991            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5992        {
5993            self.0.request.options = v.map(|x| x.into());
5994            self
5995        }
5996    }
5997
5998    #[doc(hidden)]
5999    impl gax::options::internal::RequestBuilder for GetIamPolicy {
6000        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6001            &mut self.0.options
6002        }
6003    }
6004
6005    /// The request builder for [KeyManagementService::test_iam_permissions][crate::client::KeyManagementService::test_iam_permissions] calls.
6006    ///
6007    /// # Example
6008    /// ```
6009    /// # use google_cloud_kms_v1::builder::key_management_service::TestIamPermissions;
6010    /// # async fn sample() -> gax::Result<()> {
6011    ///
6012    /// let builder = prepare_request_builder();
6013    /// let response = builder.send().await?;
6014    /// # Ok(()) }
6015    ///
6016    /// fn prepare_request_builder() -> TestIamPermissions {
6017    ///   # panic!();
6018    ///   // ... details omitted ...
6019    /// }
6020    /// ```
6021    #[derive(Clone, Debug)]
6022    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
6023
6024    impl TestIamPermissions {
6025        pub(crate) fn new(
6026            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6027        ) -> Self {
6028            Self(RequestBuilder::new(stub))
6029        }
6030
6031        /// Sets the full request, replacing any prior values.
6032        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6033            mut self,
6034            v: V,
6035        ) -> Self {
6036            self.0.request = v.into();
6037            self
6038        }
6039
6040        /// Sets all the options, replacing any prior values.
6041        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6042            self.0.options = v.into();
6043            self
6044        }
6045
6046        /// Sends the request.
6047        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6048            (*self.0.stub)
6049                .test_iam_permissions(self.0.request, self.0.options)
6050                .await
6051                .map(gax::response::Response::into_body)
6052        }
6053
6054        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
6055        ///
6056        /// This is a **required** field for requests.
6057        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6058            self.0.request.resource = v.into();
6059            self
6060        }
6061
6062        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
6063        ///
6064        /// This is a **required** field for requests.
6065        pub fn set_permissions<T, V>(mut self, v: T) -> Self
6066        where
6067            T: std::iter::IntoIterator<Item = V>,
6068            V: std::convert::Into<std::string::String>,
6069        {
6070            use std::iter::Iterator;
6071            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6072            self
6073        }
6074    }
6075
6076    #[doc(hidden)]
6077    impl gax::options::internal::RequestBuilder for TestIamPermissions {
6078        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6079            &mut self.0.options
6080        }
6081    }
6082
6083    /// The request builder for [KeyManagementService::get_operation][crate::client::KeyManagementService::get_operation] calls.
6084    ///
6085    /// # Example
6086    /// ```
6087    /// # use google_cloud_kms_v1::builder::key_management_service::GetOperation;
6088    /// # async fn sample() -> gax::Result<()> {
6089    ///
6090    /// let builder = prepare_request_builder();
6091    /// let response = builder.send().await?;
6092    /// # Ok(()) }
6093    ///
6094    /// fn prepare_request_builder() -> GetOperation {
6095    ///   # panic!();
6096    ///   // ... details omitted ...
6097    /// }
6098    /// ```
6099    #[derive(Clone, Debug)]
6100    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6101
6102    impl GetOperation {
6103        pub(crate) fn new(
6104            stub: std::sync::Arc<dyn super::super::stub::dynamic::KeyManagementService>,
6105        ) -> Self {
6106            Self(RequestBuilder::new(stub))
6107        }
6108
6109        /// Sets the full request, replacing any prior values.
6110        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6111            mut self,
6112            v: V,
6113        ) -> Self {
6114            self.0.request = v.into();
6115            self
6116        }
6117
6118        /// Sets all the options, replacing any prior values.
6119        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6120            self.0.options = v.into();
6121            self
6122        }
6123
6124        /// Sends the request.
6125        pub async fn send(self) -> Result<longrunning::model::Operation> {
6126            (*self.0.stub)
6127                .get_operation(self.0.request, self.0.options)
6128                .await
6129                .map(gax::response::Response::into_body)
6130        }
6131
6132        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
6133        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6134            self.0.request.name = v.into();
6135            self
6136        }
6137    }
6138
6139    #[doc(hidden)]
6140    impl gax::options::internal::RequestBuilder for GetOperation {
6141        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6142            &mut self.0.options
6143        }
6144    }
6145}