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