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