Skip to main content

google_cloud_kms_v1/
model.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#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate iam_v1;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request message for
42/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
43///
44/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct CreateKeyHandleRequest {
48    /// Required. Name of the resource project and location to create the
49    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
50    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
51    ///
52    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
53    pub parent: std::string::String,
54
55    /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
56    /// unique to the resource project and location. If not provided by the caller,
57    /// a new UUID is used.
58    ///
59    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
60    pub key_handle_id: std::string::String,
61
62    /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
63    ///
64    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
65    pub key_handle: std::option::Option<crate::model::KeyHandle>,
66
67    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
68}
69
70impl CreateKeyHandleRequest {
71    pub fn new() -> Self {
72        std::default::Default::default()
73    }
74
75    /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
76    ///
77    /// # Example
78    /// ```ignore,no_run
79    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
80    /// let x = CreateKeyHandleRequest::new().set_parent("example");
81    /// ```
82    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83        self.parent = v.into();
84        self
85    }
86
87    /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
88    ///
89    /// # Example
90    /// ```ignore,no_run
91    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
92    /// let x = CreateKeyHandleRequest::new().set_key_handle_id("example");
93    /// ```
94    pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
95        self.key_handle_id = v.into();
96        self
97    }
98
99    /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
100    ///
101    /// # Example
102    /// ```ignore,no_run
103    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
104    /// use google_cloud_kms_v1::model::KeyHandle;
105    /// let x = CreateKeyHandleRequest::new().set_key_handle(KeyHandle::default()/* use setters */);
106    /// ```
107    pub fn set_key_handle<T>(mut self, v: T) -> Self
108    where
109        T: std::convert::Into<crate::model::KeyHandle>,
110    {
111        self.key_handle = std::option::Option::Some(v.into());
112        self
113    }
114
115    /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
116    ///
117    /// # Example
118    /// ```ignore,no_run
119    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
120    /// use google_cloud_kms_v1::model::KeyHandle;
121    /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(Some(KeyHandle::default()/* use setters */));
122    /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(None::<KeyHandle>);
123    /// ```
124    pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
125    where
126        T: std::convert::Into<crate::model::KeyHandle>,
127    {
128        self.key_handle = v.map(|x| x.into());
129        self
130    }
131}
132
133impl wkt::message::Message for CreateKeyHandleRequest {
134    fn typename() -> &'static str {
135        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
136    }
137}
138
139/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
140///
141/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
142#[derive(Clone, Default, PartialEq)]
143#[non_exhaustive]
144pub struct GetKeyHandleRequest {
145    /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
146    /// e.g.
147    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
148    ///
149    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
150    pub name: std::string::String,
151
152    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
153}
154
155impl GetKeyHandleRequest {
156    pub fn new() -> Self {
157        std::default::Default::default()
158    }
159
160    /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
161    ///
162    /// # Example
163    /// ```ignore,no_run
164    /// # use google_cloud_kms_v1::model::GetKeyHandleRequest;
165    /// let x = GetKeyHandleRequest::new().set_name("example");
166    /// ```
167    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
168        self.name = v.into();
169        self
170    }
171}
172
173impl wkt::message::Message for GetKeyHandleRequest {
174    fn typename() -> &'static str {
175        "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
176    }
177}
178
179/// Resource-oriented representation of a request to Cloud KMS Autokey and the
180/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
181///
182/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
183#[derive(Clone, Default, PartialEq)]
184#[non_exhaustive]
185pub struct KeyHandle {
186    /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
187    /// resource, e.g.
188    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
189    ///
190    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
191    pub name: std::string::String,
192
193    /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
194    /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
195    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
196    /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
197    /// project will reflect the value configured in the
198    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
199    /// project's ancestor folder at the time of the
200    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
201    /// ancestor folder has a configured
202    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
203    /// configurations is used.
204    ///
205    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
206    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
207    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
208    pub kms_key: std::string::String,
209
210    /// Required. Indicates the resource type that the resulting
211    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
212    /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
213    /// types.
214    ///
215    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
216    pub resource_type_selector: std::string::String,
217
218    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
219}
220
221impl KeyHandle {
222    pub fn new() -> Self {
223        std::default::Default::default()
224    }
225
226    /// Sets the value of [name][crate::model::KeyHandle::name].
227    ///
228    /// # Example
229    /// ```ignore,no_run
230    /// # use google_cloud_kms_v1::model::KeyHandle;
231    /// let x = KeyHandle::new().set_name("example");
232    /// ```
233    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
234        self.name = v.into();
235        self
236    }
237
238    /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
239    ///
240    /// # Example
241    /// ```ignore,no_run
242    /// # use google_cloud_kms_v1::model::KeyHandle;
243    /// let x = KeyHandle::new().set_kms_key("example");
244    /// ```
245    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
246        self.kms_key = v.into();
247        self
248    }
249
250    /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
251    ///
252    /// # Example
253    /// ```ignore,no_run
254    /// # use google_cloud_kms_v1::model::KeyHandle;
255    /// let x = KeyHandle::new().set_resource_type_selector("example");
256    /// ```
257    pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
258        mut self,
259        v: T,
260    ) -> Self {
261        self.resource_type_selector = v.into();
262        self
263    }
264}
265
266impl wkt::message::Message for KeyHandle {
267    fn typename() -> &'static str {
268        "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
269    }
270}
271
272/// Metadata message for
273/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
274/// operation response.
275///
276/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
277#[derive(Clone, Default, PartialEq)]
278#[non_exhaustive]
279pub struct CreateKeyHandleMetadata {
280    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
281}
282
283impl CreateKeyHandleMetadata {
284    pub fn new() -> Self {
285        std::default::Default::default()
286    }
287}
288
289impl wkt::message::Message for CreateKeyHandleMetadata {
290    fn typename() -> &'static str {
291        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
292    }
293}
294
295/// Request message for
296/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
297///
298/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
299#[derive(Clone, Default, PartialEq)]
300#[non_exhaustive]
301pub struct ListKeyHandlesRequest {
302    /// Required. Name of the resource project and location from which to list
303    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
304    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
305    ///
306    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
307    pub parent: std::string::String,
308
309    /// Optional. Optional limit on the number of
310    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
311    /// service may return fewer than this value. Further
312    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
313    /// including the
314    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
315    /// in a subsequent request.  If unspecified, at most 100
316    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
317    ///
318    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
319    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
320    pub page_size: i32,
321
322    /// Optional. Optional pagination token, returned earlier via
323    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
324    ///
325    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
326    pub page_token: std::string::String,
327
328    /// Optional. Filter to apply when listing
329    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
330    /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
331    ///
332    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
333    pub filter: std::string::String,
334
335    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
336}
337
338impl ListKeyHandlesRequest {
339    pub fn new() -> Self {
340        std::default::Default::default()
341    }
342
343    /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
344    ///
345    /// # Example
346    /// ```ignore,no_run
347    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
348    /// let x = ListKeyHandlesRequest::new().set_parent("example");
349    /// ```
350    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
351        self.parent = v.into();
352        self
353    }
354
355    /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
360    /// let x = ListKeyHandlesRequest::new().set_page_size(42);
361    /// ```
362    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
363        self.page_size = v.into();
364        self
365    }
366
367    /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
368    ///
369    /// # Example
370    /// ```ignore,no_run
371    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
372    /// let x = ListKeyHandlesRequest::new().set_page_token("example");
373    /// ```
374    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
375        self.page_token = v.into();
376        self
377    }
378
379    /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
380    ///
381    /// # Example
382    /// ```ignore,no_run
383    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
384    /// let x = ListKeyHandlesRequest::new().set_filter("example");
385    /// ```
386    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
387        self.filter = v.into();
388        self
389    }
390}
391
392impl wkt::message::Message for ListKeyHandlesRequest {
393    fn typename() -> &'static str {
394        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
395    }
396}
397
398/// Response message for
399/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
400///
401/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
402#[derive(Clone, Default, PartialEq)]
403#[non_exhaustive]
404pub struct ListKeyHandlesResponse {
405    /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
406    ///
407    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
408    pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
409
410    /// A token to retrieve next page of results. Pass this value in
411    /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
412    /// to retrieve the next page of results.
413    ///
414    /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
415    pub next_page_token: std::string::String,
416
417    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
418}
419
420impl ListKeyHandlesResponse {
421    pub fn new() -> Self {
422        std::default::Default::default()
423    }
424
425    /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
426    ///
427    /// # Example
428    /// ```ignore,no_run
429    /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
430    /// use google_cloud_kms_v1::model::KeyHandle;
431    /// let x = ListKeyHandlesResponse::new()
432    ///     .set_key_handles([
433    ///         KeyHandle::default()/* use setters */,
434    ///         KeyHandle::default()/* use (different) setters */,
435    ///     ]);
436    /// ```
437    pub fn set_key_handles<T, V>(mut self, v: T) -> Self
438    where
439        T: std::iter::IntoIterator<Item = V>,
440        V: std::convert::Into<crate::model::KeyHandle>,
441    {
442        use std::iter::Iterator;
443        self.key_handles = v.into_iter().map(|i| i.into()).collect();
444        self
445    }
446
447    /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
448    ///
449    /// # Example
450    /// ```ignore,no_run
451    /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
452    /// let x = ListKeyHandlesResponse::new().set_next_page_token("example");
453    /// ```
454    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
455        self.next_page_token = v.into();
456        self
457    }
458}
459
460impl wkt::message::Message for ListKeyHandlesResponse {
461    fn typename() -> &'static str {
462        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
463    }
464}
465
466#[doc(hidden)]
467impl gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
468    type PageItem = crate::model::KeyHandle;
469
470    fn items(self) -> std::vec::Vec<Self::PageItem> {
471        self.key_handles
472    }
473
474    fn next_page_token(&self) -> std::string::String {
475        use std::clone::Clone;
476        self.next_page_token.clone()
477    }
478}
479
480/// Request message for
481/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
482///
483/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
484#[derive(Clone, Default, PartialEq)]
485#[non_exhaustive]
486pub struct UpdateAutokeyConfigRequest {
487    /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
488    /// update.
489    ///
490    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
491    pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
492
493    /// Required. Masks which fields of the
494    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
495    /// `keyProject`.
496    ///
497    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
498    pub update_mask: std::option::Option<wkt::FieldMask>,
499
500    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
501}
502
503impl UpdateAutokeyConfigRequest {
504    pub fn new() -> Self {
505        std::default::Default::default()
506    }
507
508    /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
509    ///
510    /// # Example
511    /// ```ignore,no_run
512    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
513    /// use google_cloud_kms_v1::model::AutokeyConfig;
514    /// let x = UpdateAutokeyConfigRequest::new().set_autokey_config(AutokeyConfig::default()/* use setters */);
515    /// ```
516    pub fn set_autokey_config<T>(mut self, v: T) -> Self
517    where
518        T: std::convert::Into<crate::model::AutokeyConfig>,
519    {
520        self.autokey_config = std::option::Option::Some(v.into());
521        self
522    }
523
524    /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
525    ///
526    /// # Example
527    /// ```ignore,no_run
528    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
529    /// use google_cloud_kms_v1::model::AutokeyConfig;
530    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(Some(AutokeyConfig::default()/* use setters */));
531    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(None::<AutokeyConfig>);
532    /// ```
533    pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
534    where
535        T: std::convert::Into<crate::model::AutokeyConfig>,
536    {
537        self.autokey_config = v.map(|x| x.into());
538        self
539    }
540
541    /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
542    ///
543    /// # Example
544    /// ```ignore,no_run
545    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
546    /// use wkt::FieldMask;
547    /// let x = UpdateAutokeyConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
548    /// ```
549    pub fn set_update_mask<T>(mut self, v: T) -> Self
550    where
551        T: std::convert::Into<wkt::FieldMask>,
552    {
553        self.update_mask = std::option::Option::Some(v.into());
554        self
555    }
556
557    /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
558    ///
559    /// # Example
560    /// ```ignore,no_run
561    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
562    /// use wkt::FieldMask;
563    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
564    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
565    /// ```
566    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
567    where
568        T: std::convert::Into<wkt::FieldMask>,
569    {
570        self.update_mask = v.map(|x| x.into());
571        self
572    }
573}
574
575impl wkt::message::Message for UpdateAutokeyConfigRequest {
576    fn typename() -> &'static str {
577        "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
578    }
579}
580
581/// Request message for
582/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
583///
584/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
585#[derive(Clone, Default, PartialEq)]
586#[non_exhaustive]
587pub struct GetAutokeyConfigRequest {
588    /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
589    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
590    ///
591    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
592    pub name: std::string::String,
593
594    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
595}
596
597impl GetAutokeyConfigRequest {
598    pub fn new() -> Self {
599        std::default::Default::default()
600    }
601
602    /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
603    ///
604    /// # Example
605    /// ```ignore,no_run
606    /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
607    /// let x = GetAutokeyConfigRequest::new().set_name("example");
608    /// ```
609    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
610        self.name = v.into();
611        self
612    }
613}
614
615impl wkt::message::Message for GetAutokeyConfigRequest {
616    fn typename() -> &'static str {
617        "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
618    }
619}
620
621/// Cloud KMS Autokey configuration for a folder.
622#[derive(Clone, Default, PartialEq)]
623#[non_exhaustive]
624pub struct AutokeyConfig {
625    /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
626    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
627    ///
628    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
629    pub name: std::string::String,
630
631    /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
632    /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
633    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
634    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
635    /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
636    /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
637    /// this key project. Once configured, for Cloud KMS Autokey to function
638    /// properly, this key project must have the Cloud KMS API activated and the
639    /// Cloud KMS Service Agent for this key project must be granted the
640    /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
641    /// key project field will clear the configuration.
642    ///
643    /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
644    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
645    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
646    pub key_project: std::string::String,
647
648    /// Output only. The state for the AutokeyConfig.
649    pub state: crate::model::autokey_config::State,
650
651    /// Optional. A checksum computed by the server based on the value of other
652    /// fields. This may be sent on update requests to ensure that the client has
653    /// an up-to-date value before proceeding. The request will be rejected with an
654    /// ABORTED error on a mismatched etag.
655    pub etag: std::string::String,
656
657    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
658}
659
660impl AutokeyConfig {
661    pub fn new() -> Self {
662        std::default::Default::default()
663    }
664
665    /// Sets the value of [name][crate::model::AutokeyConfig::name].
666    ///
667    /// # Example
668    /// ```ignore,no_run
669    /// # use google_cloud_kms_v1::model::AutokeyConfig;
670    /// let x = AutokeyConfig::new().set_name("example");
671    /// ```
672    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
673        self.name = v.into();
674        self
675    }
676
677    /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
678    ///
679    /// # Example
680    /// ```ignore,no_run
681    /// # use google_cloud_kms_v1::model::AutokeyConfig;
682    /// let x = AutokeyConfig::new().set_key_project("example");
683    /// ```
684    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
685        self.key_project = v.into();
686        self
687    }
688
689    /// Sets the value of [state][crate::model::AutokeyConfig::state].
690    ///
691    /// # Example
692    /// ```ignore,no_run
693    /// # use google_cloud_kms_v1::model::AutokeyConfig;
694    /// use google_cloud_kms_v1::model::autokey_config::State;
695    /// let x0 = AutokeyConfig::new().set_state(State::Active);
696    /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
697    /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
698    /// ```
699    pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
700        mut self,
701        v: T,
702    ) -> Self {
703        self.state = v.into();
704        self
705    }
706
707    /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
708    ///
709    /// # Example
710    /// ```ignore,no_run
711    /// # use google_cloud_kms_v1::model::AutokeyConfig;
712    /// let x = AutokeyConfig::new().set_etag("example");
713    /// ```
714    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
715        self.etag = v.into();
716        self
717    }
718}
719
720impl wkt::message::Message for AutokeyConfig {
721    fn typename() -> &'static str {
722        "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
723    }
724}
725
726/// Defines additional types related to [AutokeyConfig].
727pub mod autokey_config {
728    #[allow(unused_imports)]
729    use super::*;
730
731    /// The states AutokeyConfig can be in.
732    ///
733    /// # Working with unknown values
734    ///
735    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
736    /// additional enum variants at any time. Adding new variants is not considered
737    /// a breaking change. Applications should write their code in anticipation of:
738    ///
739    /// - New values appearing in future releases of the client library, **and**
740    /// - New values received dynamically, without application changes.
741    ///
742    /// Please consult the [Working with enums] section in the user guide for some
743    /// guidelines.
744    ///
745    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
746    #[derive(Clone, Debug, PartialEq)]
747    #[non_exhaustive]
748    pub enum State {
749        /// The state of the AutokeyConfig is unspecified.
750        Unspecified,
751        /// The AutokeyConfig is currently active.
752        Active,
753        /// A previously configured key project has been deleted and the current
754        /// AutokeyConfig is unusable.
755        KeyProjectDeleted,
756        /// The AutokeyConfig is not yet initialized or has been reset to its default
757        /// uninitialized state.
758        Uninitialized,
759        /// If set, the enum was initialized with an unknown value.
760        ///
761        /// Applications can examine the value using [State::value] or
762        /// [State::name].
763        UnknownValue(state::UnknownValue),
764    }
765
766    #[doc(hidden)]
767    pub mod state {
768        #[allow(unused_imports)]
769        use super::*;
770        #[derive(Clone, Debug, PartialEq)]
771        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
772    }
773
774    impl State {
775        /// Gets the enum value.
776        ///
777        /// Returns `None` if the enum contains an unknown value deserialized from
778        /// the string representation of enums.
779        pub fn value(&self) -> std::option::Option<i32> {
780            match self {
781                Self::Unspecified => std::option::Option::Some(0),
782                Self::Active => std::option::Option::Some(1),
783                Self::KeyProjectDeleted => std::option::Option::Some(2),
784                Self::Uninitialized => std::option::Option::Some(3),
785                Self::UnknownValue(u) => u.0.value(),
786            }
787        }
788
789        /// Gets the enum value as a string.
790        ///
791        /// Returns `None` if the enum contains an unknown value deserialized from
792        /// the integer representation of enums.
793        pub fn name(&self) -> std::option::Option<&str> {
794            match self {
795                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
796                Self::Active => std::option::Option::Some("ACTIVE"),
797                Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
798                Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
799                Self::UnknownValue(u) => u.0.name(),
800            }
801        }
802    }
803
804    impl std::default::Default for State {
805        fn default() -> Self {
806            use std::convert::From;
807            Self::from(0)
808        }
809    }
810
811    impl std::fmt::Display for State {
812        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
813            wkt::internal::display_enum(f, self.name(), self.value())
814        }
815    }
816
817    impl std::convert::From<i32> for State {
818        fn from(value: i32) -> Self {
819            match value {
820                0 => Self::Unspecified,
821                1 => Self::Active,
822                2 => Self::KeyProjectDeleted,
823                3 => Self::Uninitialized,
824                _ => Self::UnknownValue(state::UnknownValue(
825                    wkt::internal::UnknownEnumValue::Integer(value),
826                )),
827            }
828        }
829    }
830
831    impl std::convert::From<&str> for State {
832        fn from(value: &str) -> Self {
833            use std::string::ToString;
834            match value {
835                "STATE_UNSPECIFIED" => Self::Unspecified,
836                "ACTIVE" => Self::Active,
837                "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
838                "UNINITIALIZED" => Self::Uninitialized,
839                _ => Self::UnknownValue(state::UnknownValue(
840                    wkt::internal::UnknownEnumValue::String(value.to_string()),
841                )),
842            }
843        }
844    }
845
846    impl serde::ser::Serialize for State {
847        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
848        where
849            S: serde::Serializer,
850        {
851            match self {
852                Self::Unspecified => serializer.serialize_i32(0),
853                Self::Active => serializer.serialize_i32(1),
854                Self::KeyProjectDeleted => serializer.serialize_i32(2),
855                Self::Uninitialized => serializer.serialize_i32(3),
856                Self::UnknownValue(u) => u.0.serialize(serializer),
857            }
858        }
859    }
860
861    impl<'de> serde::de::Deserialize<'de> for State {
862        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
863        where
864            D: serde::Deserializer<'de>,
865        {
866            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
867                ".google.cloud.kms.v1.AutokeyConfig.State",
868            ))
869        }
870    }
871}
872
873/// Request message for
874/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
875///
876/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
877#[derive(Clone, Default, PartialEq)]
878#[non_exhaustive]
879pub struct ShowEffectiveAutokeyConfigRequest {
880    /// Required. Name of the resource project to the show effective Cloud KMS
881    /// Autokey configuration for. This may be helpful for interrogating the effect
882    /// of nested folder configurations on a given resource project.
883    pub parent: std::string::String,
884
885    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
886}
887
888impl ShowEffectiveAutokeyConfigRequest {
889    pub fn new() -> Self {
890        std::default::Default::default()
891    }
892
893    /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
894    ///
895    /// # Example
896    /// ```ignore,no_run
897    /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
898    /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
899    /// ```
900    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
901        self.parent = v.into();
902        self
903    }
904}
905
906impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
907    fn typename() -> &'static str {
908        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
909    }
910}
911
912/// Response message for
913/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
914///
915/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
916#[derive(Clone, Default, PartialEq)]
917#[non_exhaustive]
918pub struct ShowEffectiveAutokeyConfigResponse {
919    /// Name of the key project configured in the resource project's folder
920    /// ancestry.
921    pub key_project: std::string::String,
922
923    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
924}
925
926impl ShowEffectiveAutokeyConfigResponse {
927    pub fn new() -> Self {
928        std::default::Default::default()
929    }
930
931    /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
932    ///
933    /// # Example
934    /// ```ignore,no_run
935    /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
936    /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
937    /// ```
938    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
939        self.key_project = v.into();
940        self
941    }
942}
943
944impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
945    fn typename() -> &'static str {
946        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
947    }
948}
949
950/// Request message for
951/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
952///
953/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
954#[derive(Clone, Default, PartialEq)]
955#[non_exhaustive]
956pub struct ListEkmConnectionsRequest {
957    /// Required. The resource name of the location associated with the
958    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
959    /// `projects/*/locations/*`.
960    ///
961    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
962    pub parent: std::string::String,
963
964    /// Optional. Optional limit on the number of
965    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
966    /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
967    /// subsequently be obtained by including the
968    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
969    /// in a subsequent request. If unspecified, the server will pick an
970    /// appropriate default.
971    ///
972    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
973    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
974    pub page_size: i32,
975
976    /// Optional. Optional pagination token, returned earlier via
977    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
978    ///
979    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
980    pub page_token: std::string::String,
981
982    /// Optional. Only include resources that match the filter in the response. For
983    /// more information, see
984    /// [Sorting and filtering list
985    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
986    pub filter: std::string::String,
987
988    /// Optional. Specify how the results should be sorted. If not specified, the
989    /// results will be sorted in the default order.  For more information, see
990    /// [Sorting and filtering list
991    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
992    pub order_by: std::string::String,
993
994    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
995}
996
997impl ListEkmConnectionsRequest {
998    pub fn new() -> Self {
999        std::default::Default::default()
1000    }
1001
1002    /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1003    ///
1004    /// # Example
1005    /// ```ignore,no_run
1006    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1007    /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1008    /// ```
1009    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1010        self.parent = v.into();
1011        self
1012    }
1013
1014    /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1015    ///
1016    /// # Example
1017    /// ```ignore,no_run
1018    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1019    /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1020    /// ```
1021    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1022        self.page_size = v.into();
1023        self
1024    }
1025
1026    /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1027    ///
1028    /// # Example
1029    /// ```ignore,no_run
1030    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1031    /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1032    /// ```
1033    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1034        self.page_token = v.into();
1035        self
1036    }
1037
1038    /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1039    ///
1040    /// # Example
1041    /// ```ignore,no_run
1042    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1043    /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1044    /// ```
1045    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1046        self.filter = v.into();
1047        self
1048    }
1049
1050    /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1051    ///
1052    /// # Example
1053    /// ```ignore,no_run
1054    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1055    /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1056    /// ```
1057    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1058        self.order_by = v.into();
1059        self
1060    }
1061}
1062
1063impl wkt::message::Message for ListEkmConnectionsRequest {
1064    fn typename() -> &'static str {
1065        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1066    }
1067}
1068
1069/// Response message for
1070/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1071///
1072/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1073#[derive(Clone, Default, PartialEq)]
1074#[non_exhaustive]
1075pub struct ListEkmConnectionsResponse {
1076    /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1077    ///
1078    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1079    pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1080
1081    /// A token to retrieve next page of results. Pass this value in
1082    /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1083    /// to retrieve the next page of results.
1084    ///
1085    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1086    pub next_page_token: std::string::String,
1087
1088    /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1089    /// that matched the query.
1090    ///
1091    /// This field is not populated if
1092    /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1093    /// is applied.
1094    ///
1095    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1096    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1097    pub total_size: i32,
1098
1099    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1100}
1101
1102impl ListEkmConnectionsResponse {
1103    pub fn new() -> Self {
1104        std::default::Default::default()
1105    }
1106
1107    /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1108    ///
1109    /// # Example
1110    /// ```ignore,no_run
1111    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1112    /// use google_cloud_kms_v1::model::EkmConnection;
1113    /// let x = ListEkmConnectionsResponse::new()
1114    ///     .set_ekm_connections([
1115    ///         EkmConnection::default()/* use setters */,
1116    ///         EkmConnection::default()/* use (different) setters */,
1117    ///     ]);
1118    /// ```
1119    pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1120    where
1121        T: std::iter::IntoIterator<Item = V>,
1122        V: std::convert::Into<crate::model::EkmConnection>,
1123    {
1124        use std::iter::Iterator;
1125        self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1126        self
1127    }
1128
1129    /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1130    ///
1131    /// # Example
1132    /// ```ignore,no_run
1133    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1134    /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1135    /// ```
1136    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1137        self.next_page_token = v.into();
1138        self
1139    }
1140
1141    /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1142    ///
1143    /// # Example
1144    /// ```ignore,no_run
1145    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1146    /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1147    /// ```
1148    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1149        self.total_size = v.into();
1150        self
1151    }
1152}
1153
1154impl wkt::message::Message for ListEkmConnectionsResponse {
1155    fn typename() -> &'static str {
1156        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1157    }
1158}
1159
1160#[doc(hidden)]
1161impl gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1162    type PageItem = crate::model::EkmConnection;
1163
1164    fn items(self) -> std::vec::Vec<Self::PageItem> {
1165        self.ekm_connections
1166    }
1167
1168    fn next_page_token(&self) -> std::string::String {
1169        use std::clone::Clone;
1170        self.next_page_token.clone()
1171    }
1172}
1173
1174/// Request message for
1175/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1176///
1177/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1178#[derive(Clone, Default, PartialEq)]
1179#[non_exhaustive]
1180pub struct GetEkmConnectionRequest {
1181    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1182    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1183    ///
1184    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1185    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1186    pub name: std::string::String,
1187
1188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1189}
1190
1191impl GetEkmConnectionRequest {
1192    pub fn new() -> Self {
1193        std::default::Default::default()
1194    }
1195
1196    /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1197    ///
1198    /// # Example
1199    /// ```ignore,no_run
1200    /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1201    /// let x = GetEkmConnectionRequest::new().set_name("example");
1202    /// ```
1203    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1204        self.name = v.into();
1205        self
1206    }
1207}
1208
1209impl wkt::message::Message for GetEkmConnectionRequest {
1210    fn typename() -> &'static str {
1211        "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1212    }
1213}
1214
1215/// Request message for
1216/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1217///
1218/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1219#[derive(Clone, Default, PartialEq)]
1220#[non_exhaustive]
1221pub struct CreateEkmConnectionRequest {
1222    /// Required. The resource name of the location associated with the
1223    /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1224    /// `projects/*/locations/*`.
1225    ///
1226    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1227    pub parent: std::string::String,
1228
1229    /// Required. It must be unique within a location and match the regular
1230    /// expression `[a-zA-Z0-9_-]{1,63}`.
1231    pub ekm_connection_id: std::string::String,
1232
1233    /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1234    /// initial field values.
1235    ///
1236    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1237    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1238
1239    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1240}
1241
1242impl CreateEkmConnectionRequest {
1243    pub fn new() -> Self {
1244        std::default::Default::default()
1245    }
1246
1247    /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1248    ///
1249    /// # Example
1250    /// ```ignore,no_run
1251    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1252    /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1253    /// ```
1254    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255        self.parent = v.into();
1256        self
1257    }
1258
1259    /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1260    ///
1261    /// # Example
1262    /// ```ignore,no_run
1263    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1264    /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1265    /// ```
1266    pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1267        mut self,
1268        v: T,
1269    ) -> Self {
1270        self.ekm_connection_id = v.into();
1271        self
1272    }
1273
1274    /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1275    ///
1276    /// # Example
1277    /// ```ignore,no_run
1278    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1279    /// use google_cloud_kms_v1::model::EkmConnection;
1280    /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1281    /// ```
1282    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1283    where
1284        T: std::convert::Into<crate::model::EkmConnection>,
1285    {
1286        self.ekm_connection = std::option::Option::Some(v.into());
1287        self
1288    }
1289
1290    /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1291    ///
1292    /// # Example
1293    /// ```ignore,no_run
1294    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1295    /// use google_cloud_kms_v1::model::EkmConnection;
1296    /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1297    /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1298    /// ```
1299    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1300    where
1301        T: std::convert::Into<crate::model::EkmConnection>,
1302    {
1303        self.ekm_connection = v.map(|x| x.into());
1304        self
1305    }
1306}
1307
1308impl wkt::message::Message for CreateEkmConnectionRequest {
1309    fn typename() -> &'static str {
1310        "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1311    }
1312}
1313
1314/// Request message for
1315/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1316///
1317/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1318#[derive(Clone, Default, PartialEq)]
1319#[non_exhaustive]
1320pub struct UpdateEkmConnectionRequest {
1321    /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1322    /// values.
1323    ///
1324    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1325    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1326
1327    /// Required. List of fields to be updated in this request.
1328    pub update_mask: std::option::Option<wkt::FieldMask>,
1329
1330    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1331}
1332
1333impl UpdateEkmConnectionRequest {
1334    pub fn new() -> Self {
1335        std::default::Default::default()
1336    }
1337
1338    /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1339    ///
1340    /// # Example
1341    /// ```ignore,no_run
1342    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1343    /// use google_cloud_kms_v1::model::EkmConnection;
1344    /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1345    /// ```
1346    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1347    where
1348        T: std::convert::Into<crate::model::EkmConnection>,
1349    {
1350        self.ekm_connection = std::option::Option::Some(v.into());
1351        self
1352    }
1353
1354    /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1355    ///
1356    /// # Example
1357    /// ```ignore,no_run
1358    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1359    /// use google_cloud_kms_v1::model::EkmConnection;
1360    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1361    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1362    /// ```
1363    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1364    where
1365        T: std::convert::Into<crate::model::EkmConnection>,
1366    {
1367        self.ekm_connection = v.map(|x| x.into());
1368        self
1369    }
1370
1371    /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1372    ///
1373    /// # Example
1374    /// ```ignore,no_run
1375    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1376    /// use wkt::FieldMask;
1377    /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1378    /// ```
1379    pub fn set_update_mask<T>(mut self, v: T) -> Self
1380    where
1381        T: std::convert::Into<wkt::FieldMask>,
1382    {
1383        self.update_mask = std::option::Option::Some(v.into());
1384        self
1385    }
1386
1387    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1388    ///
1389    /// # Example
1390    /// ```ignore,no_run
1391    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1392    /// use wkt::FieldMask;
1393    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1394    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1395    /// ```
1396    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1397    where
1398        T: std::convert::Into<wkt::FieldMask>,
1399    {
1400        self.update_mask = v.map(|x| x.into());
1401        self
1402    }
1403}
1404
1405impl wkt::message::Message for UpdateEkmConnectionRequest {
1406    fn typename() -> &'static str {
1407        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1408    }
1409}
1410
1411/// Request message for
1412/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1413///
1414/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1415#[derive(Clone, Default, PartialEq)]
1416#[non_exhaustive]
1417pub struct GetEkmConfigRequest {
1418    /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1419    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1420    ///
1421    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1422    /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1423    pub name: std::string::String,
1424
1425    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1426}
1427
1428impl GetEkmConfigRequest {
1429    pub fn new() -> Self {
1430        std::default::Default::default()
1431    }
1432
1433    /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1434    ///
1435    /// # Example
1436    /// ```ignore,no_run
1437    /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1438    /// let x = GetEkmConfigRequest::new().set_name("example");
1439    /// ```
1440    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1441        self.name = v.into();
1442        self
1443    }
1444}
1445
1446impl wkt::message::Message for GetEkmConfigRequest {
1447    fn typename() -> &'static str {
1448        "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1449    }
1450}
1451
1452/// Request message for
1453/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1454///
1455/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1456#[derive(Clone, Default, PartialEq)]
1457#[non_exhaustive]
1458pub struct UpdateEkmConfigRequest {
1459    /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1460    ///
1461    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1462    pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1463
1464    /// Required. List of fields to be updated in this request.
1465    pub update_mask: std::option::Option<wkt::FieldMask>,
1466
1467    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1468}
1469
1470impl UpdateEkmConfigRequest {
1471    pub fn new() -> Self {
1472        std::default::Default::default()
1473    }
1474
1475    /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1476    ///
1477    /// # Example
1478    /// ```ignore,no_run
1479    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1480    /// use google_cloud_kms_v1::model::EkmConfig;
1481    /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1482    /// ```
1483    pub fn set_ekm_config<T>(mut self, v: T) -> Self
1484    where
1485        T: std::convert::Into<crate::model::EkmConfig>,
1486    {
1487        self.ekm_config = std::option::Option::Some(v.into());
1488        self
1489    }
1490
1491    /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1492    ///
1493    /// # Example
1494    /// ```ignore,no_run
1495    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1496    /// use google_cloud_kms_v1::model::EkmConfig;
1497    /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1498    /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1499    /// ```
1500    pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1501    where
1502        T: std::convert::Into<crate::model::EkmConfig>,
1503    {
1504        self.ekm_config = v.map(|x| x.into());
1505        self
1506    }
1507
1508    /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1509    ///
1510    /// # Example
1511    /// ```ignore,no_run
1512    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1513    /// use wkt::FieldMask;
1514    /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1515    /// ```
1516    pub fn set_update_mask<T>(mut self, v: T) -> Self
1517    where
1518        T: std::convert::Into<wkt::FieldMask>,
1519    {
1520        self.update_mask = std::option::Option::Some(v.into());
1521        self
1522    }
1523
1524    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1525    ///
1526    /// # Example
1527    /// ```ignore,no_run
1528    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1529    /// use wkt::FieldMask;
1530    /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1531    /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1532    /// ```
1533    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1534    where
1535        T: std::convert::Into<wkt::FieldMask>,
1536    {
1537        self.update_mask = v.map(|x| x.into());
1538        self
1539    }
1540}
1541
1542impl wkt::message::Message for UpdateEkmConfigRequest {
1543    fn typename() -> &'static str {
1544        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1545    }
1546}
1547
1548/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1549/// certificate used to authenticate HTTPS connections to EKM replicas.
1550///
1551/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1552#[derive(Clone, Default, PartialEq)]
1553#[non_exhaustive]
1554pub struct Certificate {
1555    /// Required. The raw certificate bytes in DER format.
1556    pub raw_der: ::bytes::Bytes,
1557
1558    /// Output only. True if the certificate was parsed successfully.
1559    pub parsed: bool,
1560
1561    /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1562    /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1563    ///
1564    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1565    pub issuer: std::string::String,
1566
1567    /// Output only. The subject distinguished name in RFC 2253 format. Only
1568    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1569    ///
1570    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1571    pub subject: std::string::String,
1572
1573    /// Output only. The subject Alternative DNS names. Only present if
1574    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1575    ///
1576    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1577    pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1578
1579    /// Output only. The certificate is not valid before this time. Only present if
1580    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1581    ///
1582    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1583    pub not_before_time: std::option::Option<wkt::Timestamp>,
1584
1585    /// Output only. The certificate is not valid after this time. Only present if
1586    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1587    ///
1588    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1589    pub not_after_time: std::option::Option<wkt::Timestamp>,
1590
1591    /// Output only. The certificate serial number as a hex string. Only present if
1592    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1593    ///
1594    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1595    pub serial_number: std::string::String,
1596
1597    /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1598    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1599    ///
1600    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1601    pub sha256_fingerprint: std::string::String,
1602
1603    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1604}
1605
1606impl Certificate {
1607    pub fn new() -> Self {
1608        std::default::Default::default()
1609    }
1610
1611    /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1612    ///
1613    /// # Example
1614    /// ```ignore,no_run
1615    /// # use google_cloud_kms_v1::model::Certificate;
1616    /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1617    /// ```
1618    pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1619        self.raw_der = v.into();
1620        self
1621    }
1622
1623    /// Sets the value of [parsed][crate::model::Certificate::parsed].
1624    ///
1625    /// # Example
1626    /// ```ignore,no_run
1627    /// # use google_cloud_kms_v1::model::Certificate;
1628    /// let x = Certificate::new().set_parsed(true);
1629    /// ```
1630    pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1631        self.parsed = v.into();
1632        self
1633    }
1634
1635    /// Sets the value of [issuer][crate::model::Certificate::issuer].
1636    ///
1637    /// # Example
1638    /// ```ignore,no_run
1639    /// # use google_cloud_kms_v1::model::Certificate;
1640    /// let x = Certificate::new().set_issuer("example");
1641    /// ```
1642    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1643        self.issuer = v.into();
1644        self
1645    }
1646
1647    /// Sets the value of [subject][crate::model::Certificate::subject].
1648    ///
1649    /// # Example
1650    /// ```ignore,no_run
1651    /// # use google_cloud_kms_v1::model::Certificate;
1652    /// let x = Certificate::new().set_subject("example");
1653    /// ```
1654    pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1655        self.subject = v.into();
1656        self
1657    }
1658
1659    /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1660    ///
1661    /// # Example
1662    /// ```ignore,no_run
1663    /// # use google_cloud_kms_v1::model::Certificate;
1664    /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1665    /// ```
1666    pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1667    where
1668        T: std::iter::IntoIterator<Item = V>,
1669        V: std::convert::Into<std::string::String>,
1670    {
1671        use std::iter::Iterator;
1672        self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1673        self
1674    }
1675
1676    /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1677    ///
1678    /// # Example
1679    /// ```ignore,no_run
1680    /// # use google_cloud_kms_v1::model::Certificate;
1681    /// use wkt::Timestamp;
1682    /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1683    /// ```
1684    pub fn set_not_before_time<T>(mut self, v: T) -> Self
1685    where
1686        T: std::convert::Into<wkt::Timestamp>,
1687    {
1688        self.not_before_time = std::option::Option::Some(v.into());
1689        self
1690    }
1691
1692    /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1693    ///
1694    /// # Example
1695    /// ```ignore,no_run
1696    /// # use google_cloud_kms_v1::model::Certificate;
1697    /// use wkt::Timestamp;
1698    /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1699    /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1700    /// ```
1701    pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1702    where
1703        T: std::convert::Into<wkt::Timestamp>,
1704    {
1705        self.not_before_time = v.map(|x| x.into());
1706        self
1707    }
1708
1709    /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1710    ///
1711    /// # Example
1712    /// ```ignore,no_run
1713    /// # use google_cloud_kms_v1::model::Certificate;
1714    /// use wkt::Timestamp;
1715    /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1716    /// ```
1717    pub fn set_not_after_time<T>(mut self, v: T) -> Self
1718    where
1719        T: std::convert::Into<wkt::Timestamp>,
1720    {
1721        self.not_after_time = std::option::Option::Some(v.into());
1722        self
1723    }
1724
1725    /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1726    ///
1727    /// # Example
1728    /// ```ignore,no_run
1729    /// # use google_cloud_kms_v1::model::Certificate;
1730    /// use wkt::Timestamp;
1731    /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1732    /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1733    /// ```
1734    pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1735    where
1736        T: std::convert::Into<wkt::Timestamp>,
1737    {
1738        self.not_after_time = v.map(|x| x.into());
1739        self
1740    }
1741
1742    /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1743    ///
1744    /// # Example
1745    /// ```ignore,no_run
1746    /// # use google_cloud_kms_v1::model::Certificate;
1747    /// let x = Certificate::new().set_serial_number("example");
1748    /// ```
1749    pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1750        self.serial_number = v.into();
1751        self
1752    }
1753
1754    /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1755    ///
1756    /// # Example
1757    /// ```ignore,no_run
1758    /// # use google_cloud_kms_v1::model::Certificate;
1759    /// let x = Certificate::new().set_sha256_fingerprint("example");
1760    /// ```
1761    pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1762        mut self,
1763        v: T,
1764    ) -> Self {
1765        self.sha256_fingerprint = v.into();
1766        self
1767    }
1768}
1769
1770impl wkt::message::Message for Certificate {
1771    fn typename() -> &'static str {
1772        "type.googleapis.com/google.cloud.kms.v1.Certificate"
1773    }
1774}
1775
1776/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
1777/// individual EKM connection. It can be used for creating
1778/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
1779/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
1780/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
1781/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
1782/// performing cryptographic operations using keys created within the
1783/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1784///
1785/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1786/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1787/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1788/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
1789/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
1790#[derive(Clone, Default, PartialEq)]
1791#[non_exhaustive]
1792pub struct EkmConnection {
1793    /// Output only. The resource name for the
1794    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
1795    /// `projects/*/locations/*/ekmConnections/*`.
1796    ///
1797    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1798    pub name: std::string::String,
1799
1800    /// Output only. The time at which the
1801    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
1802    ///
1803    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1804    pub create_time: std::option::Option<wkt::Timestamp>,
1805
1806    /// Optional. A list of
1807    /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
1808    /// the EKM can be reached. There should be one ServiceResolver per EKM
1809    /// replica. Currently, only a single
1810    /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
1811    /// supported.
1812    ///
1813    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
1814    pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
1815
1816    /// Optional. Etag of the currently stored
1817    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1818    ///
1819    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1820    pub etag: std::string::String,
1821
1822    /// Optional. Describes who can perform control plane operations on the EKM. If
1823    /// unset, this defaults to
1824    /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
1825    ///
1826    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
1827    pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
1828
1829    /// Optional. Identifies the EKM Crypto Space that this
1830    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
1831    /// field is required if
1832    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
1833    /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
1834    ///
1835    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1836    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
1837    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
1838    pub crypto_space_path: std::string::String,
1839
1840    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1841}
1842
1843impl EkmConnection {
1844    pub fn new() -> Self {
1845        std::default::Default::default()
1846    }
1847
1848    /// Sets the value of [name][crate::model::EkmConnection::name].
1849    ///
1850    /// # Example
1851    /// ```ignore,no_run
1852    /// # use google_cloud_kms_v1::model::EkmConnection;
1853    /// let x = EkmConnection::new().set_name("example");
1854    /// ```
1855    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1856        self.name = v.into();
1857        self
1858    }
1859
1860    /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
1861    ///
1862    /// # Example
1863    /// ```ignore,no_run
1864    /// # use google_cloud_kms_v1::model::EkmConnection;
1865    /// use wkt::Timestamp;
1866    /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
1867    /// ```
1868    pub fn set_create_time<T>(mut self, v: T) -> Self
1869    where
1870        T: std::convert::Into<wkt::Timestamp>,
1871    {
1872        self.create_time = std::option::Option::Some(v.into());
1873        self
1874    }
1875
1876    /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
1877    ///
1878    /// # Example
1879    /// ```ignore,no_run
1880    /// # use google_cloud_kms_v1::model::EkmConnection;
1881    /// use wkt::Timestamp;
1882    /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1883    /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
1884    /// ```
1885    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1886    where
1887        T: std::convert::Into<wkt::Timestamp>,
1888    {
1889        self.create_time = v.map(|x| x.into());
1890        self
1891    }
1892
1893    /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
1894    ///
1895    /// # Example
1896    /// ```ignore,no_run
1897    /// # use google_cloud_kms_v1::model::EkmConnection;
1898    /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
1899    /// let x = EkmConnection::new()
1900    ///     .set_service_resolvers([
1901    ///         ServiceResolver::default()/* use setters */,
1902    ///         ServiceResolver::default()/* use (different) setters */,
1903    ///     ]);
1904    /// ```
1905    pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
1906    where
1907        T: std::iter::IntoIterator<Item = V>,
1908        V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
1909    {
1910        use std::iter::Iterator;
1911        self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
1912        self
1913    }
1914
1915    /// Sets the value of [etag][crate::model::EkmConnection::etag].
1916    ///
1917    /// # Example
1918    /// ```ignore,no_run
1919    /// # use google_cloud_kms_v1::model::EkmConnection;
1920    /// let x = EkmConnection::new().set_etag("example");
1921    /// ```
1922    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1923        self.etag = v.into();
1924        self
1925    }
1926
1927    /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
1928    ///
1929    /// # Example
1930    /// ```ignore,no_run
1931    /// # use google_cloud_kms_v1::model::EkmConnection;
1932    /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
1933    /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
1934    /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
1935    /// ```
1936    pub fn set_key_management_mode<
1937        T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
1938    >(
1939        mut self,
1940        v: T,
1941    ) -> Self {
1942        self.key_management_mode = v.into();
1943        self
1944    }
1945
1946    /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
1947    ///
1948    /// # Example
1949    /// ```ignore,no_run
1950    /// # use google_cloud_kms_v1::model::EkmConnection;
1951    /// let x = EkmConnection::new().set_crypto_space_path("example");
1952    /// ```
1953    pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
1954        mut self,
1955        v: T,
1956    ) -> Self {
1957        self.crypto_space_path = v.into();
1958        self
1959    }
1960}
1961
1962impl wkt::message::Message for EkmConnection {
1963    fn typename() -> &'static str {
1964        "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
1965    }
1966}
1967
1968/// Defines additional types related to [EkmConnection].
1969pub mod ekm_connection {
1970    #[allow(unused_imports)]
1971    use super::*;
1972
1973    /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
1974    /// represents an EKM replica that can be reached within an
1975    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1976    ///
1977    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1978    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
1979    #[derive(Clone, Default, PartialEq)]
1980    #[non_exhaustive]
1981    pub struct ServiceResolver {
1982        /// Required. The resource name of the Service Directory service pointing to
1983        /// an EKM replica, in the format
1984        /// `projects/*/locations/*/namespaces/*/services/*`.
1985        pub service_directory_service: std::string::String,
1986
1987        /// Optional. The filter applied to the endpoints of the resolved service. If
1988        /// no filter is specified, all endpoints will be considered. An endpoint
1989        /// will be chosen arbitrarily from the filtered list for each request.
1990        ///
1991        /// For endpoint filter syntax and examples, see
1992        /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
1993        pub endpoint_filter: std::string::String,
1994
1995        /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
1996        pub hostname: std::string::String,
1997
1998        /// Required. A list of leaf server certificates used to authenticate HTTPS
1999        /// connections to the EKM replica. Currently, a maximum of 10
2000        /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2001        ///
2002        /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2003        pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2004
2005        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2006    }
2007
2008    impl ServiceResolver {
2009        pub fn new() -> Self {
2010            std::default::Default::default()
2011        }
2012
2013        /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2014        ///
2015        /// # Example
2016        /// ```ignore,no_run
2017        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2018        /// let x = ServiceResolver::new().set_service_directory_service("example");
2019        /// ```
2020        pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2021            mut self,
2022            v: T,
2023        ) -> Self {
2024            self.service_directory_service = v.into();
2025            self
2026        }
2027
2028        /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2029        ///
2030        /// # Example
2031        /// ```ignore,no_run
2032        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2033        /// let x = ServiceResolver::new().set_endpoint_filter("example");
2034        /// ```
2035        pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2036            mut self,
2037            v: T,
2038        ) -> Self {
2039            self.endpoint_filter = v.into();
2040            self
2041        }
2042
2043        /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2044        ///
2045        /// # Example
2046        /// ```ignore,no_run
2047        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2048        /// let x = ServiceResolver::new().set_hostname("example");
2049        /// ```
2050        pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2051            self.hostname = v.into();
2052            self
2053        }
2054
2055        /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2056        ///
2057        /// # Example
2058        /// ```ignore,no_run
2059        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2060        /// use google_cloud_kms_v1::model::Certificate;
2061        /// let x = ServiceResolver::new()
2062        ///     .set_server_certificates([
2063        ///         Certificate::default()/* use setters */,
2064        ///         Certificate::default()/* use (different) setters */,
2065        ///     ]);
2066        /// ```
2067        pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2068        where
2069            T: std::iter::IntoIterator<Item = V>,
2070            V: std::convert::Into<crate::model::Certificate>,
2071        {
2072            use std::iter::Iterator;
2073            self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2074            self
2075        }
2076    }
2077
2078    impl wkt::message::Message for ServiceResolver {
2079        fn typename() -> &'static str {
2080            "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2081        }
2082    }
2083
2084    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2085    /// describes who can perform control plane cryptographic operations using this
2086    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2087    ///
2088    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2089    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2090    ///
2091    /// # Working with unknown values
2092    ///
2093    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2094    /// additional enum variants at any time. Adding new variants is not considered
2095    /// a breaking change. Applications should write their code in anticipation of:
2096    ///
2097    /// - New values appearing in future releases of the client library, **and**
2098    /// - New values received dynamically, without application changes.
2099    ///
2100    /// Please consult the [Working with enums] section in the user guide for some
2101    /// guidelines.
2102    ///
2103    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2104    #[derive(Clone, Debug, PartialEq)]
2105    #[non_exhaustive]
2106    pub enum KeyManagementMode {
2107        /// Not specified.
2108        Unspecified,
2109        /// EKM-side key management operations on
2110        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2111        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2112        /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2113        ///
2114        /// * When creating a
2115        ///   [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2116        ///   this
2117        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2118        ///   supply the key path of pre-existing external key material that will be
2119        ///   linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2120        /// * Destruction of external key material cannot be requested via the
2121        ///   Cloud KMS API and must be performed directly in the EKM.
2122        /// * Automatic rotation of key material is not supported.
2123        ///
2124        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2125        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2126        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2127        Manual,
2128        /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2129        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2130        /// management operations initiated from Cloud KMS. This means that:
2131        ///
2132        /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2133        ///   associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2134        ///   is
2135        ///   created, the EKM automatically generates new key material and a new
2136        ///   key path. The caller cannot supply the key path of pre-existing
2137        ///   external key material.
2138        /// * Destruction of external key material associated with this
2139        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2140        ///   calling
2141        ///   [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2142        /// * Automatic rotation of key material is supported.
2143        ///
2144        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2145        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2146        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2147        /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2148        CloudKms,
2149        /// If set, the enum was initialized with an unknown value.
2150        ///
2151        /// Applications can examine the value using [KeyManagementMode::value] or
2152        /// [KeyManagementMode::name].
2153        UnknownValue(key_management_mode::UnknownValue),
2154    }
2155
2156    #[doc(hidden)]
2157    pub mod key_management_mode {
2158        #[allow(unused_imports)]
2159        use super::*;
2160        #[derive(Clone, Debug, PartialEq)]
2161        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2162    }
2163
2164    impl KeyManagementMode {
2165        /// Gets the enum value.
2166        ///
2167        /// Returns `None` if the enum contains an unknown value deserialized from
2168        /// the string representation of enums.
2169        pub fn value(&self) -> std::option::Option<i32> {
2170            match self {
2171                Self::Unspecified => std::option::Option::Some(0),
2172                Self::Manual => std::option::Option::Some(1),
2173                Self::CloudKms => std::option::Option::Some(2),
2174                Self::UnknownValue(u) => u.0.value(),
2175            }
2176        }
2177
2178        /// Gets the enum value as a string.
2179        ///
2180        /// Returns `None` if the enum contains an unknown value deserialized from
2181        /// the integer representation of enums.
2182        pub fn name(&self) -> std::option::Option<&str> {
2183            match self {
2184                Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2185                Self::Manual => std::option::Option::Some("MANUAL"),
2186                Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2187                Self::UnknownValue(u) => u.0.name(),
2188            }
2189        }
2190    }
2191
2192    impl std::default::Default for KeyManagementMode {
2193        fn default() -> Self {
2194            use std::convert::From;
2195            Self::from(0)
2196        }
2197    }
2198
2199    impl std::fmt::Display for KeyManagementMode {
2200        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2201            wkt::internal::display_enum(f, self.name(), self.value())
2202        }
2203    }
2204
2205    impl std::convert::From<i32> for KeyManagementMode {
2206        fn from(value: i32) -> Self {
2207            match value {
2208                0 => Self::Unspecified,
2209                1 => Self::Manual,
2210                2 => Self::CloudKms,
2211                _ => Self::UnknownValue(key_management_mode::UnknownValue(
2212                    wkt::internal::UnknownEnumValue::Integer(value),
2213                )),
2214            }
2215        }
2216    }
2217
2218    impl std::convert::From<&str> for KeyManagementMode {
2219        fn from(value: &str) -> Self {
2220            use std::string::ToString;
2221            match value {
2222                "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2223                "MANUAL" => Self::Manual,
2224                "CLOUD_KMS" => Self::CloudKms,
2225                _ => Self::UnknownValue(key_management_mode::UnknownValue(
2226                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2227                )),
2228            }
2229        }
2230    }
2231
2232    impl serde::ser::Serialize for KeyManagementMode {
2233        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2234        where
2235            S: serde::Serializer,
2236        {
2237            match self {
2238                Self::Unspecified => serializer.serialize_i32(0),
2239                Self::Manual => serializer.serialize_i32(1),
2240                Self::CloudKms => serializer.serialize_i32(2),
2241                Self::UnknownValue(u) => u.0.serialize(serializer),
2242            }
2243        }
2244    }
2245
2246    impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2247        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2248        where
2249            D: serde::Deserializer<'de>,
2250        {
2251            deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2252                ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2253            ))
2254        }
2255    }
2256}
2257
2258/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2259/// represents configuration parameters that apply to all
2260/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2261/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2262/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2263/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2264/// project and location.
2265///
2266/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2267/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2268/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2269/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2270/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2271#[derive(Clone, Default, PartialEq)]
2272#[non_exhaustive]
2273pub struct EkmConfig {
2274    /// Output only. The resource name for the
2275    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2276    /// `projects/*/locations/*/ekmConfig`.
2277    ///
2278    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2279    pub name: std::string::String,
2280
2281    /// Optional. Resource name of the default
2282    /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2283    /// the empty string removes the default.
2284    ///
2285    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2286    pub default_ekm_connection: std::string::String,
2287
2288    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2289}
2290
2291impl EkmConfig {
2292    pub fn new() -> Self {
2293        std::default::Default::default()
2294    }
2295
2296    /// Sets the value of [name][crate::model::EkmConfig::name].
2297    ///
2298    /// # Example
2299    /// ```ignore,no_run
2300    /// # use google_cloud_kms_v1::model::EkmConfig;
2301    /// let x = EkmConfig::new().set_name("example");
2302    /// ```
2303    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2304        self.name = v.into();
2305        self
2306    }
2307
2308    /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2309    ///
2310    /// # Example
2311    /// ```ignore,no_run
2312    /// # use google_cloud_kms_v1::model::EkmConfig;
2313    /// let x = EkmConfig::new().set_default_ekm_connection("example");
2314    /// ```
2315    pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2316        mut self,
2317        v: T,
2318    ) -> Self {
2319        self.default_ekm_connection = v.into();
2320        self
2321    }
2322}
2323
2324impl wkt::message::Message for EkmConfig {
2325    fn typename() -> &'static str {
2326        "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2327    }
2328}
2329
2330/// Request message for
2331/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2332///
2333/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2334#[derive(Clone, Default, PartialEq)]
2335#[non_exhaustive]
2336pub struct VerifyConnectivityRequest {
2337    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2338    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2339    ///
2340    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2341    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2342    pub name: std::string::String,
2343
2344    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2345}
2346
2347impl VerifyConnectivityRequest {
2348    pub fn new() -> Self {
2349        std::default::Default::default()
2350    }
2351
2352    /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2353    ///
2354    /// # Example
2355    /// ```ignore,no_run
2356    /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2357    /// let x = VerifyConnectivityRequest::new().set_name("example");
2358    /// ```
2359    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2360        self.name = v.into();
2361        self
2362    }
2363}
2364
2365impl wkt::message::Message for VerifyConnectivityRequest {
2366    fn typename() -> &'static str {
2367        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2368    }
2369}
2370
2371/// Response message for
2372/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2373///
2374/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2375#[derive(Clone, Default, PartialEq)]
2376#[non_exhaustive]
2377pub struct VerifyConnectivityResponse {
2378    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2379}
2380
2381impl VerifyConnectivityResponse {
2382    pub fn new() -> Self {
2383        std::default::Default::default()
2384    }
2385}
2386
2387impl wkt::message::Message for VerifyConnectivityResponse {
2388    fn typename() -> &'static str {
2389        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2390    }
2391}
2392
2393/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2394/// represents a single-tenant HSM instance. It can be used for creating
2395/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2396/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2397/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2398/// well as performing cryptographic operations using keys created within the
2399/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2400///
2401/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2402/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2403/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2404#[derive(Clone, Default, PartialEq)]
2405#[non_exhaustive]
2406pub struct SingleTenantHsmInstance {
2407    /// Identifier. The resource name for this
2408    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2409    /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2410    ///
2411    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2412    pub name: std::string::String,
2413
2414    /// Output only. The time at which the
2415    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2416    /// created.
2417    ///
2418    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2419    pub create_time: std::option::Option<wkt::Timestamp>,
2420
2421    /// Output only. The state of the
2422    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2423    ///
2424    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2425    pub state: crate::model::single_tenant_hsm_instance::State,
2426
2427    /// Required. The quorum auth configuration for the
2428    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2429    ///
2430    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2431    pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2432
2433    /// Output only. The time at which the
2434    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2435    /// deleted.
2436    ///
2437    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2438    pub delete_time: std::option::Option<wkt::Timestamp>,
2439
2440    /// Output only. The system-defined duration that an instance can remain
2441    /// unrefreshed until it is automatically disabled. This will have a value of
2442    /// 120 days.
2443    pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2444
2445    /// Output only. The time at which the instance will be automatically disabled
2446    /// if not refreshed. This field is updated upon creation and after each
2447    /// successful refresh operation and enable. A
2448    /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2449    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2450    /// before this time otherwise the
2451    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2452    /// become disabled.
2453    ///
2454    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2455    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2456    pub disable_time: std::option::Option<wkt::Timestamp>,
2457
2458    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2459}
2460
2461impl SingleTenantHsmInstance {
2462    pub fn new() -> Self {
2463        std::default::Default::default()
2464    }
2465
2466    /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2467    ///
2468    /// # Example
2469    /// ```ignore,no_run
2470    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2471    /// let x = SingleTenantHsmInstance::new().set_name("example");
2472    /// ```
2473    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2474        self.name = v.into();
2475        self
2476    }
2477
2478    /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2479    ///
2480    /// # Example
2481    /// ```ignore,no_run
2482    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2483    /// use wkt::Timestamp;
2484    /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2485    /// ```
2486    pub fn set_create_time<T>(mut self, v: T) -> Self
2487    where
2488        T: std::convert::Into<wkt::Timestamp>,
2489    {
2490        self.create_time = std::option::Option::Some(v.into());
2491        self
2492    }
2493
2494    /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2495    ///
2496    /// # Example
2497    /// ```ignore,no_run
2498    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2499    /// use wkt::Timestamp;
2500    /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2501    /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2502    /// ```
2503    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2504    where
2505        T: std::convert::Into<wkt::Timestamp>,
2506    {
2507        self.create_time = v.map(|x| x.into());
2508        self
2509    }
2510
2511    /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2512    ///
2513    /// # Example
2514    /// ```ignore,no_run
2515    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2516    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2517    /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2518    /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2519    /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2520    /// ```
2521    pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2522        mut self,
2523        v: T,
2524    ) -> Self {
2525        self.state = v.into();
2526        self
2527    }
2528
2529    /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2530    ///
2531    /// # Example
2532    /// ```ignore,no_run
2533    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2534    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2535    /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2536    /// ```
2537    pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2538    where
2539        T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2540    {
2541        self.quorum_auth = std::option::Option::Some(v.into());
2542        self
2543    }
2544
2545    /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2546    ///
2547    /// # Example
2548    /// ```ignore,no_run
2549    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2550    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2551    /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2552    /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2553    /// ```
2554    pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2555    where
2556        T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2557    {
2558        self.quorum_auth = v.map(|x| x.into());
2559        self
2560    }
2561
2562    /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2563    ///
2564    /// # Example
2565    /// ```ignore,no_run
2566    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2567    /// use wkt::Timestamp;
2568    /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2569    /// ```
2570    pub fn set_delete_time<T>(mut self, v: T) -> Self
2571    where
2572        T: std::convert::Into<wkt::Timestamp>,
2573    {
2574        self.delete_time = std::option::Option::Some(v.into());
2575        self
2576    }
2577
2578    /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2579    ///
2580    /// # Example
2581    /// ```ignore,no_run
2582    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2583    /// use wkt::Timestamp;
2584    /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2585    /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2586    /// ```
2587    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2588    where
2589        T: std::convert::Into<wkt::Timestamp>,
2590    {
2591        self.delete_time = v.map(|x| x.into());
2592        self
2593    }
2594
2595    /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2596    ///
2597    /// # Example
2598    /// ```ignore,no_run
2599    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2600    /// use wkt::Duration;
2601    /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2602    /// ```
2603    pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2604    where
2605        T: std::convert::Into<wkt::Duration>,
2606    {
2607        self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2608        self
2609    }
2610
2611    /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2612    ///
2613    /// # Example
2614    /// ```ignore,no_run
2615    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2616    /// use wkt::Duration;
2617    /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2618    /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2619    /// ```
2620    pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2621        mut self,
2622        v: std::option::Option<T>,
2623    ) -> Self
2624    where
2625        T: std::convert::Into<wkt::Duration>,
2626    {
2627        self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2628        self
2629    }
2630
2631    /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2632    ///
2633    /// # Example
2634    /// ```ignore,no_run
2635    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2636    /// use wkt::Timestamp;
2637    /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2638    /// ```
2639    pub fn set_disable_time<T>(mut self, v: T) -> Self
2640    where
2641        T: std::convert::Into<wkt::Timestamp>,
2642    {
2643        self.disable_time = std::option::Option::Some(v.into());
2644        self
2645    }
2646
2647    /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2648    ///
2649    /// # Example
2650    /// ```ignore,no_run
2651    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2652    /// use wkt::Timestamp;
2653    /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2654    /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2655    /// ```
2656    pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2657    where
2658        T: std::convert::Into<wkt::Timestamp>,
2659    {
2660        self.disable_time = v.map(|x| x.into());
2661        self
2662    }
2663}
2664
2665impl wkt::message::Message for SingleTenantHsmInstance {
2666    fn typename() -> &'static str {
2667        "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2668    }
2669}
2670
2671/// Defines additional types related to [SingleTenantHsmInstance].
2672pub mod single_tenant_hsm_instance {
2673    #[allow(unused_imports)]
2674    use super::*;
2675
2676    /// Configuration for M of N quorum auth.
2677    #[derive(Clone, Default, PartialEq)]
2678    #[non_exhaustive]
2679    pub struct QuorumAuth {
2680        /// Required. The total number of approvers. This is the N value used
2681        /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2682        /// or equal to 16.
2683        pub total_approver_count: i32,
2684
2685        /// Output only. The required numbers of approvers. The M value used for M of
2686        /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2687        /// to
2688        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2689        ///
2690        ///
2691        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2692        pub required_approver_count: i32,
2693
2694        /// Output only. The public keys associated with the 2FA keys for M of N
2695        /// quorum auth.
2696        pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2697
2698        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2699    }
2700
2701    impl QuorumAuth {
2702        pub fn new() -> Self {
2703            std::default::Default::default()
2704        }
2705
2706        /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2707        ///
2708        /// # Example
2709        /// ```ignore,no_run
2710        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2711        /// let x = QuorumAuth::new().set_total_approver_count(42);
2712        /// ```
2713        pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2714            self.total_approver_count = v.into();
2715            self
2716        }
2717
2718        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2719        ///
2720        /// # Example
2721        /// ```ignore,no_run
2722        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2723        /// let x = QuorumAuth::new().set_required_approver_count(42);
2724        /// ```
2725        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2726            self.required_approver_count = v.into();
2727            self
2728        }
2729
2730        /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
2731        ///
2732        /// # Example
2733        /// ```ignore,no_run
2734        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2735        /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
2736        /// ```
2737        pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
2738        where
2739            T: std::iter::IntoIterator<Item = V>,
2740            V: std::convert::Into<std::string::String>,
2741        {
2742            use std::iter::Iterator;
2743            self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
2744            self
2745        }
2746    }
2747
2748    impl wkt::message::Message for QuorumAuth {
2749        fn typename() -> &'static str {
2750            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
2751        }
2752    }
2753
2754    /// The set of states of a
2755    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2756    ///
2757    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2758    ///
2759    /// # Working with unknown values
2760    ///
2761    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2762    /// additional enum variants at any time. Adding new variants is not considered
2763    /// a breaking change. Applications should write their code in anticipation of:
2764    ///
2765    /// - New values appearing in future releases of the client library, **and**
2766    /// - New values received dynamically, without application changes.
2767    ///
2768    /// Please consult the [Working with enums] section in the user guide for some
2769    /// guidelines.
2770    ///
2771    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2772    #[derive(Clone, Debug, PartialEq)]
2773    #[non_exhaustive]
2774    pub enum State {
2775        /// Not specified.
2776        Unspecified,
2777        /// The
2778        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2779        /// being created.
2780        ///
2781        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2782        Creating,
2783        /// The
2784        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2785        /// waiting for 2FA keys to be registered. This can be done by calling
2786        /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
2787        /// with the [RegisterTwoFactorAuthKeys][] operation.
2788        ///
2789        /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
2790        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2791        PendingTwoFactorAuthRegistration,
2792        /// The
2793        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2794        /// ready to use. A
2795        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2796        /// must be in the
2797        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
2798        /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
2799        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
2800        /// be usable.
2801        ///
2802        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2803        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2804        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
2805        Active,
2806        /// The
2807        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2808        /// being disabled.
2809        ///
2810        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2811        Disabling,
2812        /// The
2813        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2814        /// disabled.
2815        ///
2816        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2817        Disabled,
2818        /// The
2819        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2820        /// being deleted. Requests to the instance will be rejected in this state.
2821        ///
2822        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2823        Deleting,
2824        /// The
2825        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2826        /// has been deleted.
2827        ///
2828        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2829        Deleted,
2830        /// The
2831        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2832        /// has failed and can not be recovered or used.
2833        ///
2834        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2835        Failed,
2836        /// If set, the enum was initialized with an unknown value.
2837        ///
2838        /// Applications can examine the value using [State::value] or
2839        /// [State::name].
2840        UnknownValue(state::UnknownValue),
2841    }
2842
2843    #[doc(hidden)]
2844    pub mod state {
2845        #[allow(unused_imports)]
2846        use super::*;
2847        #[derive(Clone, Debug, PartialEq)]
2848        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2849    }
2850
2851    impl State {
2852        /// Gets the enum value.
2853        ///
2854        /// Returns `None` if the enum contains an unknown value deserialized from
2855        /// the string representation of enums.
2856        pub fn value(&self) -> std::option::Option<i32> {
2857            match self {
2858                Self::Unspecified => std::option::Option::Some(0),
2859                Self::Creating => std::option::Option::Some(1),
2860                Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
2861                Self::Active => std::option::Option::Some(3),
2862                Self::Disabling => std::option::Option::Some(4),
2863                Self::Disabled => std::option::Option::Some(5),
2864                Self::Deleting => std::option::Option::Some(6),
2865                Self::Deleted => std::option::Option::Some(7),
2866                Self::Failed => std::option::Option::Some(8),
2867                Self::UnknownValue(u) => u.0.value(),
2868            }
2869        }
2870
2871        /// Gets the enum value as a string.
2872        ///
2873        /// Returns `None` if the enum contains an unknown value deserialized from
2874        /// the integer representation of enums.
2875        pub fn name(&self) -> std::option::Option<&str> {
2876            match self {
2877                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2878                Self::Creating => std::option::Option::Some("CREATING"),
2879                Self::PendingTwoFactorAuthRegistration => {
2880                    std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
2881                }
2882                Self::Active => std::option::Option::Some("ACTIVE"),
2883                Self::Disabling => std::option::Option::Some("DISABLING"),
2884                Self::Disabled => std::option::Option::Some("DISABLED"),
2885                Self::Deleting => std::option::Option::Some("DELETING"),
2886                Self::Deleted => std::option::Option::Some("DELETED"),
2887                Self::Failed => std::option::Option::Some("FAILED"),
2888                Self::UnknownValue(u) => u.0.name(),
2889            }
2890        }
2891    }
2892
2893    impl std::default::Default for State {
2894        fn default() -> Self {
2895            use std::convert::From;
2896            Self::from(0)
2897        }
2898    }
2899
2900    impl std::fmt::Display for State {
2901        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2902            wkt::internal::display_enum(f, self.name(), self.value())
2903        }
2904    }
2905
2906    impl std::convert::From<i32> for State {
2907        fn from(value: i32) -> Self {
2908            match value {
2909                0 => Self::Unspecified,
2910                1 => Self::Creating,
2911                2 => Self::PendingTwoFactorAuthRegistration,
2912                3 => Self::Active,
2913                4 => Self::Disabling,
2914                5 => Self::Disabled,
2915                6 => Self::Deleting,
2916                7 => Self::Deleted,
2917                8 => Self::Failed,
2918                _ => Self::UnknownValue(state::UnknownValue(
2919                    wkt::internal::UnknownEnumValue::Integer(value),
2920                )),
2921            }
2922        }
2923    }
2924
2925    impl std::convert::From<&str> for State {
2926        fn from(value: &str) -> Self {
2927            use std::string::ToString;
2928            match value {
2929                "STATE_UNSPECIFIED" => Self::Unspecified,
2930                "CREATING" => Self::Creating,
2931                "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
2932                "ACTIVE" => Self::Active,
2933                "DISABLING" => Self::Disabling,
2934                "DISABLED" => Self::Disabled,
2935                "DELETING" => Self::Deleting,
2936                "DELETED" => Self::Deleted,
2937                "FAILED" => Self::Failed,
2938                _ => Self::UnknownValue(state::UnknownValue(
2939                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2940                )),
2941            }
2942        }
2943    }
2944
2945    impl serde::ser::Serialize for State {
2946        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2947        where
2948            S: serde::Serializer,
2949        {
2950            match self {
2951                Self::Unspecified => serializer.serialize_i32(0),
2952                Self::Creating => serializer.serialize_i32(1),
2953                Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
2954                Self::Active => serializer.serialize_i32(3),
2955                Self::Disabling => serializer.serialize_i32(4),
2956                Self::Disabled => serializer.serialize_i32(5),
2957                Self::Deleting => serializer.serialize_i32(6),
2958                Self::Deleted => serializer.serialize_i32(7),
2959                Self::Failed => serializer.serialize_i32(8),
2960                Self::UnknownValue(u) => u.0.serialize(serializer),
2961            }
2962        }
2963    }
2964
2965    impl<'de> serde::de::Deserialize<'de> for State {
2966        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2967        where
2968            D: serde::Deserializer<'de>,
2969        {
2970            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2971                ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
2972            ))
2973        }
2974    }
2975}
2976
2977/// A
2978/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2979/// represents a proposal to perform an operation on a
2980/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2981///
2982/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2983/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2984#[derive(Clone, Default, PartialEq)]
2985#[non_exhaustive]
2986pub struct SingleTenantHsmInstanceProposal {
2987    /// Identifier. The resource name for this
2988    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2989    /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
2990    ///
2991    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2992    pub name: std::string::String,
2993
2994    /// Output only. The time at which the
2995    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2996    /// was created.
2997    ///
2998    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2999    pub create_time: std::option::Option<wkt::Timestamp>,
3000
3001    /// Output only. The state of the
3002    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3003    ///
3004    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3005    pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3006
3007    /// Output only. The root cause of the most recent failure. Only present if
3008    /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3009    /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3010    ///
3011    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3012    pub failure_reason: std::string::String,
3013
3014    /// Output only. The time at which the
3015    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3016    /// was deleted.
3017    ///
3018    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3019    pub delete_time: std::option::Option<wkt::Timestamp>,
3020
3021    /// Output only. The time at which the soft-deleted
3022    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3023    /// will be permanently purged. This field is only populated
3024    /// when the state is DELETED and will be set a time after expiration of the
3025    /// proposal, i.e. >= expire_time or (create_time + ttl).
3026    ///
3027    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3028    pub purge_time: std::option::Option<wkt::Timestamp>,
3029
3030    /// The approval parameters for the
3031    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3032    /// The type of parameters is determined by the operation being proposed.
3033    ///
3034    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3035    pub approval_parameters:
3036        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3037
3038    /// The expiration of the
3039    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3040    /// If not set, the
3041    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3042    /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3043    /// time is 5 minutes.
3044    ///
3045    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3046    pub expiration:
3047        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3048
3049    /// The operation to perform on the
3050    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3051    ///
3052    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3053    pub operation:
3054        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3055
3056    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3057}
3058
3059impl SingleTenantHsmInstanceProposal {
3060    pub fn new() -> Self {
3061        std::default::Default::default()
3062    }
3063
3064    /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3065    ///
3066    /// # Example
3067    /// ```ignore,no_run
3068    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3069    /// let x = SingleTenantHsmInstanceProposal::new().set_name("example");
3070    /// ```
3071    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3072        self.name = v.into();
3073        self
3074    }
3075
3076    /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3077    ///
3078    /// # Example
3079    /// ```ignore,no_run
3080    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3081    /// use wkt::Timestamp;
3082    /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3083    /// ```
3084    pub fn set_create_time<T>(mut self, v: T) -> Self
3085    where
3086        T: std::convert::Into<wkt::Timestamp>,
3087    {
3088        self.create_time = std::option::Option::Some(v.into());
3089        self
3090    }
3091
3092    /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3093    ///
3094    /// # Example
3095    /// ```ignore,no_run
3096    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3097    /// use wkt::Timestamp;
3098    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3099    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3100    /// ```
3101    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3102    where
3103        T: std::convert::Into<wkt::Timestamp>,
3104    {
3105        self.create_time = v.map(|x| x.into());
3106        self
3107    }
3108
3109    /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3110    ///
3111    /// # Example
3112    /// ```ignore,no_run
3113    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3114    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3115    /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3116    /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3117    /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3118    /// ```
3119    pub fn set_state<
3120        T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3121    >(
3122        mut self,
3123        v: T,
3124    ) -> Self {
3125        self.state = v.into();
3126        self
3127    }
3128
3129    /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3130    ///
3131    /// # Example
3132    /// ```ignore,no_run
3133    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3134    /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3135    /// ```
3136    pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3137        self.failure_reason = v.into();
3138        self
3139    }
3140
3141    /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3142    ///
3143    /// # Example
3144    /// ```ignore,no_run
3145    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3146    /// use wkt::Timestamp;
3147    /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3148    /// ```
3149    pub fn set_delete_time<T>(mut self, v: T) -> Self
3150    where
3151        T: std::convert::Into<wkt::Timestamp>,
3152    {
3153        self.delete_time = std::option::Option::Some(v.into());
3154        self
3155    }
3156
3157    /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3158    ///
3159    /// # Example
3160    /// ```ignore,no_run
3161    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3162    /// use wkt::Timestamp;
3163    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3164    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3165    /// ```
3166    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3167    where
3168        T: std::convert::Into<wkt::Timestamp>,
3169    {
3170        self.delete_time = v.map(|x| x.into());
3171        self
3172    }
3173
3174    /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3175    ///
3176    /// # Example
3177    /// ```ignore,no_run
3178    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3179    /// use wkt::Timestamp;
3180    /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3181    /// ```
3182    pub fn set_purge_time<T>(mut self, v: T) -> Self
3183    where
3184        T: std::convert::Into<wkt::Timestamp>,
3185    {
3186        self.purge_time = std::option::Option::Some(v.into());
3187        self
3188    }
3189
3190    /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3191    ///
3192    /// # Example
3193    /// ```ignore,no_run
3194    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3195    /// use wkt::Timestamp;
3196    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3197    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3198    /// ```
3199    pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3200    where
3201        T: std::convert::Into<wkt::Timestamp>,
3202    {
3203        self.purge_time = v.map(|x| x.into());
3204        self
3205    }
3206
3207    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3208    ///
3209    /// Note that all the setters affecting `approval_parameters` are mutually
3210    /// exclusive.
3211    ///
3212    /// # Example
3213    /// ```ignore,no_run
3214    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3215    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3216    /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3217    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3218    /// ```
3219    pub fn set_approval_parameters<
3220        T: std::convert::Into<
3221                std::option::Option<
3222                    crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3223                >,
3224            >,
3225    >(
3226        mut self,
3227        v: T,
3228    ) -> Self {
3229        self.approval_parameters = v.into();
3230        self
3231    }
3232
3233    /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3234    /// if it holds a `QuorumParameters`, `None` if the field is not set or
3235    /// holds a different branch.
3236    pub fn quorum_parameters(
3237        &self,
3238    ) -> std::option::Option<
3239        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3240    > {
3241        #[allow(unreachable_patterns)]
3242        self.approval_parameters.as_ref().and_then(|v| match v {
3243            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3244            _ => std::option::Option::None,
3245        })
3246    }
3247
3248    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3249    /// to hold a `QuorumParameters`.
3250    ///
3251    /// Note that all the setters affecting `approval_parameters` are
3252    /// mutually exclusive.
3253    ///
3254    /// # Example
3255    /// ```ignore,no_run
3256    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3257    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3258    /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3259    /// assert!(x.quorum_parameters().is_some());
3260    /// assert!(x.required_action_quorum_parameters().is_none());
3261    /// ```
3262    pub fn set_quorum_parameters<
3263        T: std::convert::Into<
3264                std::boxed::Box<
3265                    crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3266                >,
3267            >,
3268    >(
3269        mut self,
3270        v: T,
3271    ) -> Self {
3272        self.approval_parameters = std::option::Option::Some(
3273            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3274                v.into(),
3275            ),
3276        );
3277        self
3278    }
3279
3280    /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3281    /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3282    /// holds a different branch.
3283    pub fn required_action_quorum_parameters(
3284        &self,
3285    ) -> std::option::Option<
3286        &std::boxed::Box<
3287            crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3288        >,
3289    > {
3290        #[allow(unreachable_patterns)]
3291        self.approval_parameters.as_ref().and_then(|v| match v {
3292            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3293            _ => std::option::Option::None,
3294        })
3295    }
3296
3297    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3298    /// to hold a `RequiredActionQuorumParameters`.
3299    ///
3300    /// Note that all the setters affecting `approval_parameters` are
3301    /// mutually exclusive.
3302    ///
3303    /// # Example
3304    /// ```ignore,no_run
3305    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3306    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3307    /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3308    /// assert!(x.required_action_quorum_parameters().is_some());
3309    /// assert!(x.quorum_parameters().is_none());
3310    /// ```
3311    pub fn set_required_action_quorum_parameters<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters>>>(mut self, v: T) -> Self{
3312        self.approval_parameters = std::option::Option::Some(
3313            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3314                v.into()
3315            )
3316        );
3317        self
3318    }
3319
3320    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3321    ///
3322    /// Note that all the setters affecting `expiration` are mutually
3323    /// exclusive.
3324    ///
3325    /// # Example
3326    /// ```ignore,no_run
3327    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3328    /// use wkt::Timestamp;
3329    /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3330    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3331    /// ```
3332    pub fn set_expiration<
3333        T: std::convert::Into<
3334                std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3335            >,
3336    >(
3337        mut self,
3338        v: T,
3339    ) -> Self {
3340        self.expiration = v.into();
3341        self
3342    }
3343
3344    /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3345    /// if it holds a `ExpireTime`, `None` if the field is not set or
3346    /// holds a different branch.
3347    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3348        #[allow(unreachable_patterns)]
3349        self.expiration.as_ref().and_then(|v| match v {
3350            crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3351                std::option::Option::Some(v)
3352            }
3353            _ => std::option::Option::None,
3354        })
3355    }
3356
3357    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3358    /// to hold a `ExpireTime`.
3359    ///
3360    /// Note that all the setters affecting `expiration` are
3361    /// mutually exclusive.
3362    ///
3363    /// # Example
3364    /// ```ignore,no_run
3365    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3366    /// use wkt::Timestamp;
3367    /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3368    /// assert!(x.expire_time().is_some());
3369    /// assert!(x.ttl().is_none());
3370    /// ```
3371    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3372        mut self,
3373        v: T,
3374    ) -> Self {
3375        self.expiration = std::option::Option::Some(
3376            crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3377        );
3378        self
3379    }
3380
3381    /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3382    /// if it holds a `Ttl`, `None` if the field is not set or
3383    /// holds a different branch.
3384    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3385        #[allow(unreachable_patterns)]
3386        self.expiration.as_ref().and_then(|v| match v {
3387            crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3388                std::option::Option::Some(v)
3389            }
3390            _ => std::option::Option::None,
3391        })
3392    }
3393
3394    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3395    /// to hold a `Ttl`.
3396    ///
3397    /// Note that all the setters affecting `expiration` are
3398    /// mutually exclusive.
3399    ///
3400    /// # Example
3401    /// ```ignore,no_run
3402    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3403    /// use wkt::Duration;
3404    /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3405    /// assert!(x.ttl().is_some());
3406    /// assert!(x.expire_time().is_none());
3407    /// ```
3408    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3409        self.expiration = std::option::Option::Some(
3410            crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3411        );
3412        self
3413    }
3414
3415    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3416    ///
3417    /// Note that all the setters affecting `operation` are mutually
3418    /// exclusive.
3419    ///
3420    /// # Example
3421    /// ```ignore,no_run
3422    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3423    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3424    /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3425    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3426    /// ```
3427    pub fn set_operation<
3428        T: std::convert::Into<
3429                std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3430            >,
3431    >(
3432        mut self,
3433        v: T,
3434    ) -> Self {
3435        self.operation = v.into();
3436        self
3437    }
3438
3439    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3440    /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3441    /// holds a different branch.
3442    pub fn register_two_factor_auth_keys(
3443        &self,
3444    ) -> std::option::Option<
3445        &std::boxed::Box<
3446            crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3447        >,
3448    > {
3449        #[allow(unreachable_patterns)]
3450        self.operation.as_ref().and_then(|v| match v {
3451            crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3452            _ => std::option::Option::None,
3453        })
3454    }
3455
3456    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3457    /// to hold a `RegisterTwoFactorAuthKeys`.
3458    ///
3459    /// Note that all the setters affecting `operation` are
3460    /// mutually exclusive.
3461    ///
3462    /// # Example
3463    /// ```ignore,no_run
3464    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3465    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3466    /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3467    /// assert!(x.register_two_factor_auth_keys().is_some());
3468    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3469    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3470    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3471    /// assert!(x.add_quorum_member().is_none());
3472    /// assert!(x.remove_quorum_member().is_none());
3473    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3474    /// ```
3475    pub fn set_register_two_factor_auth_keys<
3476        T: std::convert::Into<
3477                std::boxed::Box<
3478                    crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3479                >,
3480            >,
3481    >(
3482        mut self,
3483        v: T,
3484    ) -> Self {
3485        self.operation = std::option::Option::Some(
3486            crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3487                v.into(),
3488            ),
3489        );
3490        self
3491    }
3492
3493    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3494    /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3495    /// holds a different branch.
3496    pub fn disable_single_tenant_hsm_instance(
3497        &self,
3498    ) -> std::option::Option<
3499        &std::boxed::Box<
3500            crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3501        >,
3502    > {
3503        #[allow(unreachable_patterns)]
3504        self.operation.as_ref().and_then(|v| match v {
3505            crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3506            _ => std::option::Option::None,
3507        })
3508    }
3509
3510    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3511    /// to hold a `DisableSingleTenantHsmInstance`.
3512    ///
3513    /// Note that all the setters affecting `operation` are
3514    /// mutually exclusive.
3515    ///
3516    /// # Example
3517    /// ```ignore,no_run
3518    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3519    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3520    /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3521    /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3522    /// assert!(x.register_two_factor_auth_keys().is_none());
3523    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3524    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3525    /// assert!(x.add_quorum_member().is_none());
3526    /// assert!(x.remove_quorum_member().is_none());
3527    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3528    /// ```
3529    pub fn set_disable_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3530        self.operation = std::option::Option::Some(
3531            crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3532                v.into()
3533            )
3534        );
3535        self
3536    }
3537
3538    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3539    /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3540    /// holds a different branch.
3541    pub fn enable_single_tenant_hsm_instance(
3542        &self,
3543    ) -> std::option::Option<
3544        &std::boxed::Box<
3545            crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3546        >,
3547    > {
3548        #[allow(unreachable_patterns)]
3549        self.operation.as_ref().and_then(|v| match v {
3550            crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3551            _ => std::option::Option::None,
3552        })
3553    }
3554
3555    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3556    /// to hold a `EnableSingleTenantHsmInstance`.
3557    ///
3558    /// Note that all the setters affecting `operation` are
3559    /// mutually exclusive.
3560    ///
3561    /// # Example
3562    /// ```ignore,no_run
3563    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3564    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3565    /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3566    /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3567    /// assert!(x.register_two_factor_auth_keys().is_none());
3568    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3569    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3570    /// assert!(x.add_quorum_member().is_none());
3571    /// assert!(x.remove_quorum_member().is_none());
3572    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3573    /// ```
3574    pub fn set_enable_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3575        self.operation = std::option::Option::Some(
3576            crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3577                v.into()
3578            )
3579        );
3580        self
3581    }
3582
3583    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3584    /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3585    /// holds a different branch.
3586    pub fn delete_single_tenant_hsm_instance(
3587        &self,
3588    ) -> std::option::Option<
3589        &std::boxed::Box<
3590            crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3591        >,
3592    > {
3593        #[allow(unreachable_patterns)]
3594        self.operation.as_ref().and_then(|v| match v {
3595            crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3596            _ => std::option::Option::None,
3597        })
3598    }
3599
3600    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3601    /// to hold a `DeleteSingleTenantHsmInstance`.
3602    ///
3603    /// Note that all the setters affecting `operation` are
3604    /// mutually exclusive.
3605    ///
3606    /// # Example
3607    /// ```ignore,no_run
3608    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3609    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3610    /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3611    /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3612    /// assert!(x.register_two_factor_auth_keys().is_none());
3613    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3614    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3615    /// assert!(x.add_quorum_member().is_none());
3616    /// assert!(x.remove_quorum_member().is_none());
3617    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3618    /// ```
3619    pub fn set_delete_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3620        self.operation = std::option::Option::Some(
3621            crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3622                v.into()
3623            )
3624        );
3625        self
3626    }
3627
3628    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3629    /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3630    /// holds a different branch.
3631    pub fn add_quorum_member(
3632        &self,
3633    ) -> std::option::Option<
3634        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3635    > {
3636        #[allow(unreachable_patterns)]
3637        self.operation.as_ref().and_then(|v| match v {
3638            crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3639                std::option::Option::Some(v)
3640            }
3641            _ => std::option::Option::None,
3642        })
3643    }
3644
3645    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3646    /// to hold a `AddQuorumMember`.
3647    ///
3648    /// Note that all the setters affecting `operation` are
3649    /// mutually exclusive.
3650    ///
3651    /// # Example
3652    /// ```ignore,no_run
3653    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3654    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3655    /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3656    /// assert!(x.add_quorum_member().is_some());
3657    /// assert!(x.register_two_factor_auth_keys().is_none());
3658    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3659    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3660    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3661    /// assert!(x.remove_quorum_member().is_none());
3662    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3663    /// ```
3664    pub fn set_add_quorum_member<
3665        T: std::convert::Into<
3666                std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3667            >,
3668    >(
3669        mut self,
3670        v: T,
3671    ) -> Self {
3672        self.operation = std::option::Option::Some(
3673            crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3674        );
3675        self
3676    }
3677
3678    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3679    /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3680    /// holds a different branch.
3681    pub fn remove_quorum_member(
3682        &self,
3683    ) -> std::option::Option<
3684        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3685    > {
3686        #[allow(unreachable_patterns)]
3687        self.operation.as_ref().and_then(|v| match v {
3688            crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3689                std::option::Option::Some(v)
3690            }
3691            _ => std::option::Option::None,
3692        })
3693    }
3694
3695    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3696    /// to hold a `RemoveQuorumMember`.
3697    ///
3698    /// Note that all the setters affecting `operation` are
3699    /// mutually exclusive.
3700    ///
3701    /// # Example
3702    /// ```ignore,no_run
3703    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3704    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
3705    /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3706    /// assert!(x.remove_quorum_member().is_some());
3707    /// assert!(x.register_two_factor_auth_keys().is_none());
3708    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3709    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3710    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3711    /// assert!(x.add_quorum_member().is_none());
3712    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3713    /// ```
3714    pub fn set_remove_quorum_member<
3715        T: std::convert::Into<
3716                std::boxed::Box<
3717                    crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
3718                >,
3719            >,
3720    >(
3721        mut self,
3722        v: T,
3723    ) -> Self {
3724        self.operation = std::option::Option::Some(
3725            crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
3726                v.into(),
3727            ),
3728        );
3729        self
3730    }
3731
3732    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3733    /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
3734    /// holds a different branch.
3735    pub fn refresh_single_tenant_hsm_instance(
3736        &self,
3737    ) -> std::option::Option<
3738        &std::boxed::Box<
3739            crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
3740        >,
3741    > {
3742        #[allow(unreachable_patterns)]
3743        self.operation.as_ref().and_then(|v| match v {
3744            crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3745            _ => std::option::Option::None,
3746        })
3747    }
3748
3749    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3750    /// to hold a `RefreshSingleTenantHsmInstance`.
3751    ///
3752    /// Note that all the setters affecting `operation` are
3753    /// mutually exclusive.
3754    ///
3755    /// # Example
3756    /// ```ignore,no_run
3757    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3758    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
3759    /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
3760    /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
3761    /// assert!(x.register_two_factor_auth_keys().is_none());
3762    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3763    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3764    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3765    /// assert!(x.add_quorum_member().is_none());
3766    /// assert!(x.remove_quorum_member().is_none());
3767    /// ```
3768    pub fn set_refresh_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3769        self.operation = std::option::Option::Some(
3770            crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
3771                v.into()
3772            )
3773        );
3774        self
3775    }
3776}
3777
3778impl wkt::message::Message for SingleTenantHsmInstanceProposal {
3779    fn typename() -> &'static str {
3780        "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
3781    }
3782}
3783
3784/// Defines additional types related to [SingleTenantHsmInstanceProposal].
3785pub mod single_tenant_hsm_instance_proposal {
3786    #[allow(unused_imports)]
3787    use super::*;
3788
3789    /// Parameters of quorum approval for the
3790    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3791    ///
3792    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3793    #[derive(Clone, Default, PartialEq)]
3794    #[non_exhaustive]
3795    pub struct QuorumParameters {
3796        /// Output only. The required numbers of approvers. This is the M value used
3797        /// for M of N quorum auth. It is less than the number of public keys.
3798        pub required_approver_count: i32,
3799
3800        /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
3801        /// of N of these challenges are required to be signed to approve the
3802        /// operation.
3803        pub challenges: std::vec::Vec<crate::model::Challenge>,
3804
3805        /// Output only. The public keys associated with the 2FA keys that have
3806        /// already approved the
3807        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3808        /// by signing the challenge.
3809        ///
3810        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3811        pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
3812
3813        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3814    }
3815
3816    impl QuorumParameters {
3817        pub fn new() -> Self {
3818            std::default::Default::default()
3819        }
3820
3821        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
3822        ///
3823        /// # Example
3824        /// ```ignore,no_run
3825        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3826        /// let x = QuorumParameters::new().set_required_approver_count(42);
3827        /// ```
3828        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3829            self.required_approver_count = v.into();
3830            self
3831        }
3832
3833        /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
3834        ///
3835        /// # Example
3836        /// ```ignore,no_run
3837        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3838        /// use google_cloud_kms_v1::model::Challenge;
3839        /// let x = QuorumParameters::new()
3840        ///     .set_challenges([
3841        ///         Challenge::default()/* use setters */,
3842        ///         Challenge::default()/* use (different) setters */,
3843        ///     ]);
3844        /// ```
3845        pub fn set_challenges<T, V>(mut self, v: T) -> Self
3846        where
3847            T: std::iter::IntoIterator<Item = V>,
3848            V: std::convert::Into<crate::model::Challenge>,
3849        {
3850            use std::iter::Iterator;
3851            self.challenges = v.into_iter().map(|i| i.into()).collect();
3852            self
3853        }
3854
3855        /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
3856        ///
3857        /// # Example
3858        /// ```ignore,no_run
3859        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3860        /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
3861        /// ```
3862        pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
3863        where
3864            T: std::iter::IntoIterator<Item = V>,
3865            V: std::convert::Into<std::string::String>,
3866        {
3867            use std::iter::Iterator;
3868            self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
3869            self
3870        }
3871    }
3872
3873    impl wkt::message::Message for QuorumParameters {
3874        fn typename() -> &'static str {
3875            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
3876        }
3877    }
3878
3879    /// Parameters for an approval that has both required challenges and a
3880    /// quorum.
3881    #[derive(Clone, Default, PartialEq)]
3882    #[non_exhaustive]
3883    pub struct RequiredActionQuorumParameters {
3884        /// Output only. A list of specific challenges that must be signed.
3885        /// For some operations, this will contain a single challenge.
3886        pub required_challenges: std::vec::Vec<crate::model::Challenge>,
3887
3888        /// Output only. The required number of quorum approvers. This is the M value
3889        /// used for M of N quorum auth. It is less than the number of public keys.
3890        pub required_approver_count: i32,
3891
3892        /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
3893        /// of N of these challenges are required to be signed to approve the
3894        /// operation.
3895        pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
3896
3897        /// Output only. The public keys associated with the 2FA keys that have
3898        /// already approved the
3899        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3900        /// by signing the challenge.
3901        ///
3902        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3903        pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
3904
3905        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3906    }
3907
3908    impl RequiredActionQuorumParameters {
3909        pub fn new() -> Self {
3910            std::default::Default::default()
3911        }
3912
3913        /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
3914        ///
3915        /// # Example
3916        /// ```ignore,no_run
3917        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3918        /// use google_cloud_kms_v1::model::Challenge;
3919        /// let x = RequiredActionQuorumParameters::new()
3920        ///     .set_required_challenges([
3921        ///         Challenge::default()/* use setters */,
3922        ///         Challenge::default()/* use (different) setters */,
3923        ///     ]);
3924        /// ```
3925        pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
3926        where
3927            T: std::iter::IntoIterator<Item = V>,
3928            V: std::convert::Into<crate::model::Challenge>,
3929        {
3930            use std::iter::Iterator;
3931            self.required_challenges = v.into_iter().map(|i| i.into()).collect();
3932            self
3933        }
3934
3935        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
3936        ///
3937        /// # Example
3938        /// ```ignore,no_run
3939        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3940        /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
3941        /// ```
3942        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3943            self.required_approver_count = v.into();
3944            self
3945        }
3946
3947        /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
3948        ///
3949        /// # Example
3950        /// ```ignore,no_run
3951        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3952        /// use google_cloud_kms_v1::model::Challenge;
3953        /// let x = RequiredActionQuorumParameters::new()
3954        ///     .set_quorum_challenges([
3955        ///         Challenge::default()/* use setters */,
3956        ///         Challenge::default()/* use (different) setters */,
3957        ///     ]);
3958        /// ```
3959        pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
3960        where
3961            T: std::iter::IntoIterator<Item = V>,
3962            V: std::convert::Into<crate::model::Challenge>,
3963        {
3964            use std::iter::Iterator;
3965            self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
3966            self
3967        }
3968
3969        /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
3970        ///
3971        /// # Example
3972        /// ```ignore,no_run
3973        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3974        /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
3975        /// ```
3976        pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
3977        where
3978            T: std::iter::IntoIterator<Item = V>,
3979            V: std::convert::Into<std::string::String>,
3980        {
3981            use std::iter::Iterator;
3982            self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
3983            self
3984        }
3985    }
3986
3987    impl wkt::message::Message for RequiredActionQuorumParameters {
3988        fn typename() -> &'static str {
3989            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
3990        }
3991    }
3992
3993    /// Register 2FA keys for the
3994    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3995    /// This operation requires all Challenges to be signed by 2FA keys. The
3996    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
3997    /// be in the
3998    /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
3999    /// state to perform this operation.
4000    ///
4001    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4002    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4003    #[derive(Clone, Default, PartialEq)]
4004    #[non_exhaustive]
4005    pub struct RegisterTwoFactorAuthKeys {
4006        /// Required. The required numbers of approvers to set for the
4007        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4008        /// This is the M value used for M of N quorum auth. Must be greater than or
4009        /// equal to 2 and less than or equal to
4010        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4011        ///
4012        ///
4013        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4014        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4015        pub required_approver_count: i32,
4016
4017        /// Required. The public keys associated with the 2FA keys for M of N quorum
4018        /// auth. Public keys must be associated with RSA 2048 keys.
4019        pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4020
4021        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4022    }
4023
4024    impl RegisterTwoFactorAuthKeys {
4025        pub fn new() -> Self {
4026            std::default::Default::default()
4027        }
4028
4029        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4030        ///
4031        /// # Example
4032        /// ```ignore,no_run
4033        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4034        /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4035        /// ```
4036        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4037            self.required_approver_count = v.into();
4038            self
4039        }
4040
4041        /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4042        ///
4043        /// # Example
4044        /// ```ignore,no_run
4045        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4046        /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4047        /// ```
4048        pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4049        where
4050            T: std::iter::IntoIterator<Item = V>,
4051            V: std::convert::Into<std::string::String>,
4052        {
4053            use std::iter::Iterator;
4054            self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4055            self
4056        }
4057    }
4058
4059    impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4060        fn typename() -> &'static str {
4061            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4062        }
4063    }
4064
4065    /// Disable the
4066    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4067    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4068    /// be in the
4069    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4070    /// perform this operation.
4071    ///
4072    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4073    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4074    #[derive(Clone, Default, PartialEq)]
4075    #[non_exhaustive]
4076    pub struct DisableSingleTenantHsmInstance {
4077        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4078    }
4079
4080    impl DisableSingleTenantHsmInstance {
4081        pub fn new() -> Self {
4082            std::default::Default::default()
4083        }
4084    }
4085
4086    impl wkt::message::Message for DisableSingleTenantHsmInstance {
4087        fn typename() -> &'static str {
4088            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4089        }
4090    }
4091
4092    /// Enable the
4093    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4094    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4095    /// be in the
4096    /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4097    /// state to perform this operation.
4098    ///
4099    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4100    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4101    #[derive(Clone, Default, PartialEq)]
4102    #[non_exhaustive]
4103    pub struct EnableSingleTenantHsmInstance {
4104        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4105    }
4106
4107    impl EnableSingleTenantHsmInstance {
4108        pub fn new() -> Self {
4109            std::default::Default::default()
4110        }
4111    }
4112
4113    impl wkt::message::Message for EnableSingleTenantHsmInstance {
4114        fn typename() -> &'static str {
4115            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4116        }
4117    }
4118
4119    /// Delete the
4120    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4121    /// Deleting a
4122    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4123    /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4124    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4125    /// unusable. The
4126    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4127    /// not be in the
4128    /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4129    /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4130    /// to perform this operation.
4131    ///
4132    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4133    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4134    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4135    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4136    #[derive(Clone, Default, PartialEq)]
4137    #[non_exhaustive]
4138    pub struct DeleteSingleTenantHsmInstance {
4139        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4140    }
4141
4142    impl DeleteSingleTenantHsmInstance {
4143        pub fn new() -> Self {
4144            std::default::Default::default()
4145        }
4146    }
4147
4148    impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4149        fn typename() -> &'static str {
4150            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4151        }
4152    }
4153
4154    /// Add a quorum member to the
4155    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4156    /// This will increase the
4157    /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4158    /// by 1. The
4159    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4160    /// be in the
4161    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4162    /// perform this operation.
4163    ///
4164    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4165    /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4166    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4167    #[derive(Clone, Default, PartialEq)]
4168    #[non_exhaustive]
4169    pub struct AddQuorumMember {
4170        /// Required. The public key associated with the 2FA key for the new quorum
4171        /// member to add. Public keys must be associated with RSA 2048 keys.
4172        pub two_factor_public_key_pem: std::string::String,
4173
4174        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4175    }
4176
4177    impl AddQuorumMember {
4178        pub fn new() -> Self {
4179            std::default::Default::default()
4180        }
4181
4182        /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4183        ///
4184        /// # Example
4185        /// ```ignore,no_run
4186        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4187        /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4188        /// ```
4189        pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4190            mut self,
4191            v: T,
4192        ) -> Self {
4193            self.two_factor_public_key_pem = v.into();
4194            self
4195        }
4196    }
4197
4198    impl wkt::message::Message for AddQuorumMember {
4199        fn typename() -> &'static str {
4200            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4201        }
4202    }
4203
4204    /// Remove a quorum member from the
4205    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4206    /// This will reduce
4207    /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4208    /// by 1. The
4209    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4210    /// be in the
4211    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4212    /// perform this operation.
4213    ///
4214    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4215    /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4216    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4217    #[derive(Clone, Default, PartialEq)]
4218    #[non_exhaustive]
4219    pub struct RemoveQuorumMember {
4220        /// Required. The public key associated with the 2FA key for the quorum
4221        /// member to remove. Public keys must be associated with RSA 2048 keys.
4222        pub two_factor_public_key_pem: std::string::String,
4223
4224        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4225    }
4226
4227    impl RemoveQuorumMember {
4228        pub fn new() -> Self {
4229            std::default::Default::default()
4230        }
4231
4232        /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4233        ///
4234        /// # Example
4235        /// ```ignore,no_run
4236        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4237        /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4238        /// ```
4239        pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4240            mut self,
4241            v: T,
4242        ) -> Self {
4243            self.two_factor_public_key_pem = v.into();
4244            self
4245        }
4246    }
4247
4248    impl wkt::message::Message for RemoveQuorumMember {
4249        fn typename() -> &'static str {
4250            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4251        }
4252    }
4253
4254    /// Refreshes the
4255    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4256    /// This operation must be performed periodically to keep the
4257    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4258    /// active. This operation must be performed before
4259    /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4260    /// has passed. The
4261    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4262    /// be in the
4263    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4264    /// perform this operation.
4265    ///
4266    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4267    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4268    /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4269    #[derive(Clone, Default, PartialEq)]
4270    #[non_exhaustive]
4271    pub struct RefreshSingleTenantHsmInstance {
4272        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4273    }
4274
4275    impl RefreshSingleTenantHsmInstance {
4276        pub fn new() -> Self {
4277            std::default::Default::default()
4278        }
4279    }
4280
4281    impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4282        fn typename() -> &'static str {
4283            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4284        }
4285    }
4286
4287    /// The set of states of a
4288    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4289    ///
4290    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4291    ///
4292    /// # Working with unknown values
4293    ///
4294    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4295    /// additional enum variants at any time. Adding new variants is not considered
4296    /// a breaking change. Applications should write their code in anticipation of:
4297    ///
4298    /// - New values appearing in future releases of the client library, **and**
4299    /// - New values received dynamically, without application changes.
4300    ///
4301    /// Please consult the [Working with enums] section in the user guide for some
4302    /// guidelines.
4303    ///
4304    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4305    #[derive(Clone, Debug, PartialEq)]
4306    #[non_exhaustive]
4307    pub enum State {
4308        /// Not specified.
4309        Unspecified,
4310        /// The
4311        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4312        /// is being created.
4313        ///
4314        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4315        Creating,
4316        /// The
4317        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4318        /// is pending approval.
4319        ///
4320        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4321        Pending,
4322        /// The
4323        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4324        /// has been approved.
4325        ///
4326        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4327        Approved,
4328        /// The
4329        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4330        /// is being executed.
4331        ///
4332        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4333        Running,
4334        /// The
4335        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4336        /// has been executed successfully.
4337        ///
4338        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4339        Succeeded,
4340        /// The
4341        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4342        /// has failed.
4343        ///
4344        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4345        Failed,
4346        /// The
4347        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4348        /// has been deleted and will be purged after the purge_time.
4349        ///
4350        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4351        Deleted,
4352        /// If set, the enum was initialized with an unknown value.
4353        ///
4354        /// Applications can examine the value using [State::value] or
4355        /// [State::name].
4356        UnknownValue(state::UnknownValue),
4357    }
4358
4359    #[doc(hidden)]
4360    pub mod state {
4361        #[allow(unused_imports)]
4362        use super::*;
4363        #[derive(Clone, Debug, PartialEq)]
4364        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4365    }
4366
4367    impl State {
4368        /// Gets the enum value.
4369        ///
4370        /// Returns `None` if the enum contains an unknown value deserialized from
4371        /// the string representation of enums.
4372        pub fn value(&self) -> std::option::Option<i32> {
4373            match self {
4374                Self::Unspecified => std::option::Option::Some(0),
4375                Self::Creating => std::option::Option::Some(1),
4376                Self::Pending => std::option::Option::Some(2),
4377                Self::Approved => std::option::Option::Some(3),
4378                Self::Running => std::option::Option::Some(4),
4379                Self::Succeeded => std::option::Option::Some(5),
4380                Self::Failed => std::option::Option::Some(6),
4381                Self::Deleted => std::option::Option::Some(7),
4382                Self::UnknownValue(u) => u.0.value(),
4383            }
4384        }
4385
4386        /// Gets the enum value as a string.
4387        ///
4388        /// Returns `None` if the enum contains an unknown value deserialized from
4389        /// the integer representation of enums.
4390        pub fn name(&self) -> std::option::Option<&str> {
4391            match self {
4392                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4393                Self::Creating => std::option::Option::Some("CREATING"),
4394                Self::Pending => std::option::Option::Some("PENDING"),
4395                Self::Approved => std::option::Option::Some("APPROVED"),
4396                Self::Running => std::option::Option::Some("RUNNING"),
4397                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4398                Self::Failed => std::option::Option::Some("FAILED"),
4399                Self::Deleted => std::option::Option::Some("DELETED"),
4400                Self::UnknownValue(u) => u.0.name(),
4401            }
4402        }
4403    }
4404
4405    impl std::default::Default for State {
4406        fn default() -> Self {
4407            use std::convert::From;
4408            Self::from(0)
4409        }
4410    }
4411
4412    impl std::fmt::Display for State {
4413        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4414            wkt::internal::display_enum(f, self.name(), self.value())
4415        }
4416    }
4417
4418    impl std::convert::From<i32> for State {
4419        fn from(value: i32) -> Self {
4420            match value {
4421                0 => Self::Unspecified,
4422                1 => Self::Creating,
4423                2 => Self::Pending,
4424                3 => Self::Approved,
4425                4 => Self::Running,
4426                5 => Self::Succeeded,
4427                6 => Self::Failed,
4428                7 => Self::Deleted,
4429                _ => Self::UnknownValue(state::UnknownValue(
4430                    wkt::internal::UnknownEnumValue::Integer(value),
4431                )),
4432            }
4433        }
4434    }
4435
4436    impl std::convert::From<&str> for State {
4437        fn from(value: &str) -> Self {
4438            use std::string::ToString;
4439            match value {
4440                "STATE_UNSPECIFIED" => Self::Unspecified,
4441                "CREATING" => Self::Creating,
4442                "PENDING" => Self::Pending,
4443                "APPROVED" => Self::Approved,
4444                "RUNNING" => Self::Running,
4445                "SUCCEEDED" => Self::Succeeded,
4446                "FAILED" => Self::Failed,
4447                "DELETED" => Self::Deleted,
4448                _ => Self::UnknownValue(state::UnknownValue(
4449                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4450                )),
4451            }
4452        }
4453    }
4454
4455    impl serde::ser::Serialize for State {
4456        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4457        where
4458            S: serde::Serializer,
4459        {
4460            match self {
4461                Self::Unspecified => serializer.serialize_i32(0),
4462                Self::Creating => serializer.serialize_i32(1),
4463                Self::Pending => serializer.serialize_i32(2),
4464                Self::Approved => serializer.serialize_i32(3),
4465                Self::Running => serializer.serialize_i32(4),
4466                Self::Succeeded => serializer.serialize_i32(5),
4467                Self::Failed => serializer.serialize_i32(6),
4468                Self::Deleted => serializer.serialize_i32(7),
4469                Self::UnknownValue(u) => u.0.serialize(serializer),
4470            }
4471        }
4472    }
4473
4474    impl<'de> serde::de::Deserialize<'de> for State {
4475        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4476        where
4477            D: serde::Deserializer<'de>,
4478        {
4479            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4480                ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4481            ))
4482        }
4483    }
4484
4485    /// The approval parameters for the
4486    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4487    /// The type of parameters is determined by the operation being proposed.
4488    ///
4489    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4490    #[derive(Clone, Debug, PartialEq)]
4491    #[non_exhaustive]
4492    pub enum ApprovalParameters {
4493        /// Output only. The quorum approval parameters for the
4494        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4495        ///
4496        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4497        QuorumParameters(
4498            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4499        ),
4500        /// Output only. Parameters for an approval of a
4501        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4502        /// that has both required challenges and a quorum.
4503        ///
4504        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4505        RequiredActionQuorumParameters(
4506            std::boxed::Box<
4507                crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4508            >,
4509        ),
4510    }
4511
4512    /// The expiration of the
4513    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4514    /// If not set, the
4515    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4516    /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4517    /// time is 5 minutes.
4518    ///
4519    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4520    #[derive(Clone, Debug, PartialEq)]
4521    #[non_exhaustive]
4522    pub enum Expiration {
4523        /// The time at which the
4524        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4525        /// will expire if not approved and executed.
4526        ///
4527        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4528        ExpireTime(std::boxed::Box<wkt::Timestamp>),
4529        /// Input only. The TTL for the
4530        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4531        /// Proposals will expire after this duration.
4532        ///
4533        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4534        Ttl(std::boxed::Box<wkt::Duration>),
4535    }
4536
4537    /// The operation to perform on the
4538    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4539    ///
4540    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4541    #[derive(Clone, Debug, PartialEq)]
4542    #[non_exhaustive]
4543    pub enum Operation {
4544        /// Register 2FA keys for the
4545        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4546        /// This operation requires all N Challenges to be signed by 2FA keys. The
4547        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4548        /// must be in the
4549        /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4550        /// state to perform this operation.
4551        ///
4552        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4553        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4554        RegisterTwoFactorAuthKeys(
4555            std::boxed::Box<
4556                crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4557            >,
4558        ),
4559        /// Disable the
4560        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4561        /// The
4562        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4563        /// must be in the
4564        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4565        /// to perform this operation.
4566        ///
4567        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4568        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4569        DisableSingleTenantHsmInstance(
4570            std::boxed::Box<
4571                crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4572            >,
4573        ),
4574        /// Enable the
4575        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4576        /// The
4577        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4578        /// must be in the
4579        /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4580        /// state to perform this operation.
4581        ///
4582        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4583        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4584        EnableSingleTenantHsmInstance(
4585            std::boxed::Box<
4586                crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4587            >,
4588        ),
4589        /// Delete the
4590        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4591        /// Deleting a
4592        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4593        /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4594        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4595        /// unusable. The
4596        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4597        /// must be in the
4598        /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
4599        /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4600        /// state to perform this operation.
4601        ///
4602        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4603        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4604        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4605        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4606        DeleteSingleTenantHsmInstance(
4607            std::boxed::Box<
4608                crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
4609            >,
4610        ),
4611        /// Add a quorum member to the
4612        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4613        /// This will increase the
4614        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4615        /// by 1. The
4616        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4617        /// must be in the
4618        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4619        /// to perform this operation.
4620        ///
4621        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4622        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4623        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4624        AddQuorumMember(
4625            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
4626        ),
4627        /// Remove a quorum member from the
4628        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4629        /// This will reduce
4630        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4631        /// by 1. The
4632        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4633        /// must be in the
4634        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4635        /// to perform this operation.
4636        ///
4637        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4638        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4639        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4640        RemoveQuorumMember(
4641            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
4642        ),
4643        /// Refreshes the
4644        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4645        /// This operation must be performed periodically to keep the
4646        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4647        /// active. This operation must be performed before
4648        /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4649        /// has passed. The
4650        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4651        /// must be in the
4652        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4653        /// to perform this operation.
4654        ///
4655        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4656        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4657        /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4658        RefreshSingleTenantHsmInstance(
4659            std::boxed::Box<
4660                crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4661            >,
4662        ),
4663    }
4664}
4665
4666/// A challenge to be signed by a 2FA key.
4667#[derive(Clone, Default, PartialEq)]
4668#[non_exhaustive]
4669pub struct Challenge {
4670    /// Output only. The challenge to be signed by the 2FA key indicated by the
4671    /// public key.
4672    pub challenge: ::bytes::Bytes,
4673
4674    /// Output only. The public key associated with the 2FA key that should sign
4675    /// the challenge.
4676    pub public_key_pem: std::string::String,
4677
4678    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4679}
4680
4681impl Challenge {
4682    pub fn new() -> Self {
4683        std::default::Default::default()
4684    }
4685
4686    /// Sets the value of [challenge][crate::model::Challenge::challenge].
4687    ///
4688    /// # Example
4689    /// ```ignore,no_run
4690    /// # use google_cloud_kms_v1::model::Challenge;
4691    /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
4692    /// ```
4693    pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4694        self.challenge = v.into();
4695        self
4696    }
4697
4698    /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
4699    ///
4700    /// # Example
4701    /// ```ignore,no_run
4702    /// # use google_cloud_kms_v1::model::Challenge;
4703    /// let x = Challenge::new().set_public_key_pem("example");
4704    /// ```
4705    pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4706        self.public_key_pem = v.into();
4707        self
4708    }
4709}
4710
4711impl wkt::message::Message for Challenge {
4712    fn typename() -> &'static str {
4713        "type.googleapis.com/google.cloud.kms.v1.Challenge"
4714    }
4715}
4716
4717/// A reply to a challenge signed by a 2FA key.
4718#[derive(Clone, Default, PartialEq)]
4719#[non_exhaustive]
4720pub struct ChallengeReply {
4721    /// Required. The signed challenge associated with the 2FA key.
4722    /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
4723    pub signed_challenge: ::bytes::Bytes,
4724
4725    /// Required. The public key associated with the 2FA key.
4726    pub public_key_pem: std::string::String,
4727
4728    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4729}
4730
4731impl ChallengeReply {
4732    pub fn new() -> Self {
4733        std::default::Default::default()
4734    }
4735
4736    /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
4737    ///
4738    /// # Example
4739    /// ```ignore,no_run
4740    /// # use google_cloud_kms_v1::model::ChallengeReply;
4741    /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
4742    /// ```
4743    pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4744        self.signed_challenge = v.into();
4745        self
4746    }
4747
4748    /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
4749    ///
4750    /// # Example
4751    /// ```ignore,no_run
4752    /// # use google_cloud_kms_v1::model::ChallengeReply;
4753    /// let x = ChallengeReply::new().set_public_key_pem("example");
4754    /// ```
4755    pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4756        self.public_key_pem = v.into();
4757        self
4758    }
4759}
4760
4761impl wkt::message::Message for ChallengeReply {
4762    fn typename() -> &'static str {
4763        "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
4764    }
4765}
4766
4767/// Request message for
4768/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
4769///
4770/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4771#[derive(Clone, Default, PartialEq)]
4772#[non_exhaustive]
4773pub struct ListSingleTenantHsmInstancesRequest {
4774    /// Required. The resource name of the location associated with the
4775    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4776    /// list, in the format `projects/*/locations/*`.
4777    ///
4778    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4779    pub parent: std::string::String,
4780
4781    /// Optional. Optional limit on the number of
4782    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4783    /// include in the response. Further
4784    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
4785    /// subsequently be
4786    /// obtained by including the
4787    /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
4788    /// in a subsequent request. If unspecified, the server will pick an
4789    /// appropriate default.
4790    ///
4791    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4792    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4793    pub page_size: i32,
4794
4795    /// Optional. Optional pagination token, returned earlier via
4796    /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
4797    ///
4798    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4799    pub page_token: std::string::String,
4800
4801    /// Optional. Only include resources that match the filter in the response. For
4802    /// more information, see
4803    /// [Sorting and filtering list
4804    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
4805    pub filter: std::string::String,
4806
4807    /// Optional. Specify how the results should be sorted. If not specified, the
4808    /// results will be sorted in the default order.  For more information, see
4809    /// [Sorting and filtering list
4810    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
4811    pub order_by: std::string::String,
4812
4813    /// Optional. If set to true,
4814    /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
4815    /// will also return
4816    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
4817    /// DELETED state.
4818    ///
4819    /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4820    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4821    pub show_deleted: bool,
4822
4823    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4824}
4825
4826impl ListSingleTenantHsmInstancesRequest {
4827    pub fn new() -> Self {
4828        std::default::Default::default()
4829    }
4830
4831    /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
4832    ///
4833    /// # Example
4834    /// ```ignore,no_run
4835    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4836    /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
4837    /// ```
4838    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4839        self.parent = v.into();
4840        self
4841    }
4842
4843    /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
4844    ///
4845    /// # Example
4846    /// ```ignore,no_run
4847    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4848    /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
4849    /// ```
4850    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4851        self.page_size = v.into();
4852        self
4853    }
4854
4855    /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
4856    ///
4857    /// # Example
4858    /// ```ignore,no_run
4859    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4860    /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
4861    /// ```
4862    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4863        self.page_token = v.into();
4864        self
4865    }
4866
4867    /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
4868    ///
4869    /// # Example
4870    /// ```ignore,no_run
4871    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4872    /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
4873    /// ```
4874    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4875        self.filter = v.into();
4876        self
4877    }
4878
4879    /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
4880    ///
4881    /// # Example
4882    /// ```ignore,no_run
4883    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4884    /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
4885    /// ```
4886    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4887        self.order_by = v.into();
4888        self
4889    }
4890
4891    /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
4892    ///
4893    /// # Example
4894    /// ```ignore,no_run
4895    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4896    /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
4897    /// ```
4898    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4899        self.show_deleted = v.into();
4900        self
4901    }
4902}
4903
4904impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
4905    fn typename() -> &'static str {
4906        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
4907    }
4908}
4909
4910/// Response message for
4911/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
4912///
4913/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4914#[derive(Clone, Default, PartialEq)]
4915#[non_exhaustive]
4916pub struct ListSingleTenantHsmInstancesResponse {
4917    /// The list of
4918    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
4919    ///
4920    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4921    pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
4922
4923    /// A token to retrieve next page of results. Pass this value in
4924    /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
4925    /// to retrieve the next page of results.
4926    ///
4927    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
4928    pub next_page_token: std::string::String,
4929
4930    /// The total number of
4931    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
4932    /// that matched the query.
4933    ///
4934    /// This field is not populated if
4935    /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
4936    /// is applied.
4937    ///
4938    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
4939    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4940    pub total_size: i32,
4941
4942    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4943}
4944
4945impl ListSingleTenantHsmInstancesResponse {
4946    pub fn new() -> Self {
4947        std::default::Default::default()
4948    }
4949
4950    /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
4951    ///
4952    /// # Example
4953    /// ```ignore,no_run
4954    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
4955    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
4956    /// let x = ListSingleTenantHsmInstancesResponse::new()
4957    ///     .set_single_tenant_hsm_instances([
4958    ///         SingleTenantHsmInstance::default()/* use setters */,
4959    ///         SingleTenantHsmInstance::default()/* use (different) setters */,
4960    ///     ]);
4961    /// ```
4962    pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
4963    where
4964        T: std::iter::IntoIterator<Item = V>,
4965        V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
4966    {
4967        use std::iter::Iterator;
4968        self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
4969        self
4970    }
4971
4972    /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
4973    ///
4974    /// # Example
4975    /// ```ignore,no_run
4976    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
4977    /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
4978    /// ```
4979    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4980        self.next_page_token = v.into();
4981        self
4982    }
4983
4984    /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
4985    ///
4986    /// # Example
4987    /// ```ignore,no_run
4988    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
4989    /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
4990    /// ```
4991    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4992        self.total_size = v.into();
4993        self
4994    }
4995}
4996
4997impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
4998    fn typename() -> &'static str {
4999        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
5000    }
5001}
5002
5003#[doc(hidden)]
5004impl gax::paginator::internal::PageableResponse for ListSingleTenantHsmInstancesResponse {
5005    type PageItem = crate::model::SingleTenantHsmInstance;
5006
5007    fn items(self) -> std::vec::Vec<Self::PageItem> {
5008        self.single_tenant_hsm_instances
5009    }
5010
5011    fn next_page_token(&self) -> std::string::String {
5012        use std::clone::Clone;
5013        self.next_page_token.clone()
5014    }
5015}
5016
5017/// Request message for
5018/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5019///
5020/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5021#[derive(Clone, Default, PartialEq)]
5022#[non_exhaustive]
5023pub struct GetSingleTenantHsmInstanceRequest {
5024    /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5025    /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5026    /// to get.
5027    ///
5028    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5029    /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5030    pub name: std::string::String,
5031
5032    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5033}
5034
5035impl GetSingleTenantHsmInstanceRequest {
5036    pub fn new() -> Self {
5037        std::default::Default::default()
5038    }
5039
5040    /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5041    ///
5042    /// # Example
5043    /// ```ignore,no_run
5044    /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5045    /// let x = GetSingleTenantHsmInstanceRequest::new().set_name("example");
5046    /// ```
5047    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5048        self.name = v.into();
5049        self
5050    }
5051}
5052
5053impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5054    fn typename() -> &'static str {
5055        "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5056    }
5057}
5058
5059/// Request message for
5060/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5061///
5062/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5063#[derive(Clone, Default, PartialEq)]
5064#[non_exhaustive]
5065pub struct CreateSingleTenantHsmInstanceRequest {
5066    /// Required. The resource name of the location associated with the
5067    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5068    /// the format `projects/*/locations/*`.
5069    ///
5070    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5071    pub parent: std::string::String,
5072
5073    /// Optional. It must be unique within a location and match the regular
5074    /// expression `[a-zA-Z0-9_-]{1,63}`.
5075    pub single_tenant_hsm_instance_id: std::string::String,
5076
5077    /// Required. An
5078    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5079    /// initial field values.
5080    ///
5081    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5082    pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5083
5084    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5085}
5086
5087impl CreateSingleTenantHsmInstanceRequest {
5088    pub fn new() -> Self {
5089        std::default::Default::default()
5090    }
5091
5092    /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5093    ///
5094    /// # Example
5095    /// ```ignore,no_run
5096    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5097    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5098    /// ```
5099    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5100        self.parent = v.into();
5101        self
5102    }
5103
5104    /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5105    ///
5106    /// # Example
5107    /// ```ignore,no_run
5108    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5109    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5110    /// ```
5111    pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5112        mut self,
5113        v: T,
5114    ) -> Self {
5115        self.single_tenant_hsm_instance_id = v.into();
5116        self
5117    }
5118
5119    /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5120    ///
5121    /// # Example
5122    /// ```ignore,no_run
5123    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5124    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5125    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5126    /// ```
5127    pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5128    where
5129        T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5130    {
5131        self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5132        self
5133    }
5134
5135    /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5136    ///
5137    /// # Example
5138    /// ```ignore,no_run
5139    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5140    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5141    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5142    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5143    /// ```
5144    pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5145    where
5146        T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5147    {
5148        self.single_tenant_hsm_instance = v.map(|x| x.into());
5149        self
5150    }
5151}
5152
5153impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5154    fn typename() -> &'static str {
5155        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5156    }
5157}
5158
5159/// Metadata message for
5160/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5161/// long-running operation response.
5162///
5163/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5164#[derive(Clone, Default, PartialEq)]
5165#[non_exhaustive]
5166pub struct CreateSingleTenantHsmInstanceMetadata {
5167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5168}
5169
5170impl CreateSingleTenantHsmInstanceMetadata {
5171    pub fn new() -> Self {
5172        std::default::Default::default()
5173    }
5174}
5175
5176impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5177    fn typename() -> &'static str {
5178        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5179    }
5180}
5181
5182/// Request message for
5183/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5184///
5185/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5186#[derive(Clone, Default, PartialEq)]
5187#[non_exhaustive]
5188pub struct CreateSingleTenantHsmInstanceProposalRequest {
5189    /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5190    /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5191    /// associated with the
5192    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5193    ///
5194    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5195    /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5196    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5197    pub parent: std::string::String,
5198
5199    /// Optional. It must be unique within a location and match the regular
5200    /// expression `[a-zA-Z0-9_-]{1,63}`.
5201    pub single_tenant_hsm_instance_proposal_id: std::string::String,
5202
5203    /// Required. The
5204    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5205    /// to create.
5206    ///
5207    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5208    pub single_tenant_hsm_instance_proposal:
5209        std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5210
5211    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5212}
5213
5214impl CreateSingleTenantHsmInstanceProposalRequest {
5215    pub fn new() -> Self {
5216        std::default::Default::default()
5217    }
5218
5219    /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5220    ///
5221    /// # Example
5222    /// ```ignore,no_run
5223    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5224    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent("example");
5225    /// ```
5226    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5227        self.parent = v.into();
5228        self
5229    }
5230
5231    /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5232    ///
5233    /// # Example
5234    /// ```ignore,no_run
5235    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5236    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5237    /// ```
5238    pub fn set_single_tenant_hsm_instance_proposal_id<
5239        T: std::convert::Into<std::string::String>,
5240    >(
5241        mut self,
5242        v: T,
5243    ) -> Self {
5244        self.single_tenant_hsm_instance_proposal_id = v.into();
5245        self
5246    }
5247
5248    /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5249    ///
5250    /// # Example
5251    /// ```ignore,no_run
5252    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5253    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5254    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5255    /// ```
5256    pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5257    where
5258        T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5259    {
5260        self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5261        self
5262    }
5263
5264    /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5265    ///
5266    /// # Example
5267    /// ```ignore,no_run
5268    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5269    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5270    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5271    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5272    /// ```
5273    pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5274        mut self,
5275        v: std::option::Option<T>,
5276    ) -> Self
5277    where
5278        T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5279    {
5280        self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5281        self
5282    }
5283}
5284
5285impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5286    fn typename() -> &'static str {
5287        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5288    }
5289}
5290
5291/// Metadata message for
5292/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5293/// long-running operation response.
5294///
5295/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5296#[derive(Clone, Default, PartialEq)]
5297#[non_exhaustive]
5298pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5299    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5300}
5301
5302impl CreateSingleTenantHsmInstanceProposalMetadata {
5303    pub fn new() -> Self {
5304        std::default::Default::default()
5305    }
5306}
5307
5308impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5309    fn typename() -> &'static str {
5310        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5311    }
5312}
5313
5314/// Request message for
5315/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5316///
5317/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5318#[derive(Clone, Default, PartialEq)]
5319#[non_exhaustive]
5320pub struct GetSingleTenantHsmInstanceProposalRequest {
5321    /// Required. The
5322    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5323    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5324    /// to get.
5325    ///
5326    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5327    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5328    pub name: std::string::String,
5329
5330    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5331}
5332
5333impl GetSingleTenantHsmInstanceProposalRequest {
5334    pub fn new() -> Self {
5335        std::default::Default::default()
5336    }
5337
5338    /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5339    ///
5340    /// # Example
5341    /// ```ignore,no_run
5342    /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5343    /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5344    /// ```
5345    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5346        self.name = v.into();
5347        self
5348    }
5349}
5350
5351impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5352    fn typename() -> &'static str {
5353        "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5354    }
5355}
5356
5357/// Request message for
5358/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5359///
5360/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5361#[derive(Clone, Default, PartialEq)]
5362#[non_exhaustive]
5363pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5364    /// Required. The
5365    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5366    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5367    /// to approve.
5368    ///
5369    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5370    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5371    pub name: std::string::String,
5372
5373    /// The approval payload. The type of approval payload must correspond to the
5374    /// type of approval_parameters in the proposal.
5375    pub approval_payload: std::option::Option<
5376        crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5377    >,
5378
5379    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5380}
5381
5382impl ApproveSingleTenantHsmInstanceProposalRequest {
5383    pub fn new() -> Self {
5384        std::default::Default::default()
5385    }
5386
5387    /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5388    ///
5389    /// # Example
5390    /// ```ignore,no_run
5391    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5392    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5393    /// ```
5394    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5395        self.name = v.into();
5396        self
5397    }
5398
5399    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5400    ///
5401    /// Note that all the setters affecting `approval_payload` are mutually
5402    /// exclusive.
5403    ///
5404    /// # Example
5405    /// ```ignore,no_run
5406    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5407    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5408    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5409    ///     google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5410    /// ```
5411    pub fn set_approval_payload<T: std::convert::Into<std::option::Option<crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload>>>(mut self, v: T) -> Self
5412    {
5413        self.approval_payload = v.into();
5414        self
5415    }
5416
5417    /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5418    /// if it holds a `QuorumReply`, `None` if the field is not set or
5419    /// holds a different branch.
5420    pub fn quorum_reply(
5421        &self,
5422    ) -> std::option::Option<
5423        &std::boxed::Box<
5424            crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5425        >,
5426    > {
5427        #[allow(unreachable_patterns)]
5428        self.approval_payload.as_ref().and_then(|v| match v {
5429            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5430            _ => std::option::Option::None,
5431        })
5432    }
5433
5434    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5435    /// to hold a `QuorumReply`.
5436    ///
5437    /// Note that all the setters affecting `approval_payload` are
5438    /// mutually exclusive.
5439    ///
5440    /// # Example
5441    /// ```ignore,no_run
5442    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5443    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5444    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5445    /// assert!(x.quorum_reply().is_some());
5446    /// assert!(x.required_action_quorum_reply().is_none());
5447    /// ```
5448    pub fn set_quorum_reply<
5449        T: std::convert::Into<
5450                std::boxed::Box<
5451                    crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5452                >,
5453            >,
5454    >(
5455        mut self,
5456        v: T,
5457    ) -> Self {
5458        self.approval_payload = std::option::Option::Some(
5459            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5460                v.into()
5461            )
5462        );
5463        self
5464    }
5465
5466    /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5467    /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5468    /// holds a different branch.
5469    pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5470        #[allow(unreachable_patterns)]
5471        self.approval_payload.as_ref().and_then(|v| match v {
5472            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5473            _ => std::option::Option::None,
5474        })
5475    }
5476
5477    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5478    /// to hold a `RequiredActionQuorumReply`.
5479    ///
5480    /// Note that all the setters affecting `approval_payload` are
5481    /// mutually exclusive.
5482    ///
5483    /// # Example
5484    /// ```ignore,no_run
5485    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5486    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5487    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5488    /// assert!(x.required_action_quorum_reply().is_some());
5489    /// assert!(x.quorum_reply().is_none());
5490    /// ```
5491    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{
5492        self.approval_payload = std::option::Option::Some(
5493            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5494                v.into()
5495            )
5496        );
5497        self
5498    }
5499}
5500
5501impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5502    fn typename() -> &'static str {
5503        "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5504    }
5505}
5506
5507/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5508pub mod approve_single_tenant_hsm_instance_proposal_request {
5509    #[allow(unused_imports)]
5510    use super::*;
5511
5512    /// The reply to
5513    /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5514    /// for approving the proposal.
5515    ///
5516    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5517    #[derive(Clone, Default, PartialEq)]
5518    #[non_exhaustive]
5519    pub struct QuorumReply {
5520        /// Required. The challenge replies to approve the proposal. Challenge
5521        /// replies can be sent across multiple requests. The proposal will be
5522        /// approved when
5523        /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5524        /// challenge replies are provided.
5525        ///
5526        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5527        pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5528
5529        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5530    }
5531
5532    impl QuorumReply {
5533        pub fn new() -> Self {
5534            std::default::Default::default()
5535        }
5536
5537        /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5538        ///
5539        /// # Example
5540        /// ```ignore,no_run
5541        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5542        /// use google_cloud_kms_v1::model::ChallengeReply;
5543        /// let x = QuorumReply::new()
5544        ///     .set_challenge_replies([
5545        ///         ChallengeReply::default()/* use setters */,
5546        ///         ChallengeReply::default()/* use (different) setters */,
5547        ///     ]);
5548        /// ```
5549        pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5550        where
5551            T: std::iter::IntoIterator<Item = V>,
5552            V: std::convert::Into<crate::model::ChallengeReply>,
5553        {
5554            use std::iter::Iterator;
5555            self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5556            self
5557        }
5558    }
5559
5560    impl wkt::message::Message for QuorumReply {
5561        fn typename() -> &'static str {
5562            "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
5563        }
5564    }
5565
5566    /// The reply to
5567    /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5568    /// for approving the proposal.
5569    ///
5570    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5571    #[derive(Clone, Default, PartialEq)]
5572    #[non_exhaustive]
5573    pub struct RequiredActionQuorumReply {
5574        /// Required. All required challenges must be signed for the proposal to be
5575        /// approved. These can be sent across multiple requests.
5576        pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5577
5578        /// Required. Quorum members' signed challenge replies. These can be provided
5579        /// across multiple requests. The proposal will be approved when
5580        /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
5581        /// quorum_challenge_replies are provided and when all
5582        /// required_challenge_replies are provided.
5583        ///
5584        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
5585        pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5586
5587        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5588    }
5589
5590    impl RequiredActionQuorumReply {
5591        pub fn new() -> Self {
5592            std::default::Default::default()
5593        }
5594
5595        /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
5596        ///
5597        /// # Example
5598        /// ```ignore,no_run
5599        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5600        /// use google_cloud_kms_v1::model::ChallengeReply;
5601        /// let x = RequiredActionQuorumReply::new()
5602        ///     .set_required_challenge_replies([
5603        ///         ChallengeReply::default()/* use setters */,
5604        ///         ChallengeReply::default()/* use (different) setters */,
5605        ///     ]);
5606        /// ```
5607        pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
5608        where
5609            T: std::iter::IntoIterator<Item = V>,
5610            V: std::convert::Into<crate::model::ChallengeReply>,
5611        {
5612            use std::iter::Iterator;
5613            self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5614            self
5615        }
5616
5617        /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
5618        ///
5619        /// # Example
5620        /// ```ignore,no_run
5621        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5622        /// use google_cloud_kms_v1::model::ChallengeReply;
5623        /// let x = RequiredActionQuorumReply::new()
5624        ///     .set_quorum_challenge_replies([
5625        ///         ChallengeReply::default()/* use setters */,
5626        ///         ChallengeReply::default()/* use (different) setters */,
5627        ///     ]);
5628        /// ```
5629        pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
5630        where
5631            T: std::iter::IntoIterator<Item = V>,
5632            V: std::convert::Into<crate::model::ChallengeReply>,
5633        {
5634            use std::iter::Iterator;
5635            self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5636            self
5637        }
5638    }
5639
5640    impl wkt::message::Message for RequiredActionQuorumReply {
5641        fn typename() -> &'static str {
5642            "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
5643        }
5644    }
5645
5646    /// The approval payload. The type of approval payload must correspond to the
5647    /// type of approval_parameters in the proposal.
5648    #[derive(Clone, Debug, PartialEq)]
5649    #[non_exhaustive]
5650    pub enum ApprovalPayload {
5651        /// Required. The reply to
5652        /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5653        /// for approving the proposal.
5654        ///
5655        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5656        QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
5657        /// Required. The reply to
5658        /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5659        /// for approving the proposal.
5660        ///
5661        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5662        RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
5663    }
5664}
5665
5666/// Response message for
5667/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5668///
5669/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5670#[derive(Clone, Default, PartialEq)]
5671#[non_exhaustive]
5672pub struct ApproveSingleTenantHsmInstanceProposalResponse {
5673    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5674}
5675
5676impl ApproveSingleTenantHsmInstanceProposalResponse {
5677    pub fn new() -> Self {
5678        std::default::Default::default()
5679    }
5680}
5681
5682impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
5683    fn typename() -> &'static str {
5684        "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
5685    }
5686}
5687
5688/// Request message for
5689/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5690///
5691/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5692#[derive(Clone, Default, PartialEq)]
5693#[non_exhaustive]
5694pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
5695    /// Required. The
5696    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5697    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5698    /// to execute.
5699    ///
5700    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5701    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5702    pub name: std::string::String,
5703
5704    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5705}
5706
5707impl ExecuteSingleTenantHsmInstanceProposalRequest {
5708    pub fn new() -> Self {
5709        std::default::Default::default()
5710    }
5711
5712    /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
5713    ///
5714    /// # Example
5715    /// ```ignore,no_run
5716    /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
5717    /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5718    /// ```
5719    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5720        self.name = v.into();
5721        self
5722    }
5723}
5724
5725impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
5726    fn typename() -> &'static str {
5727        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
5728    }
5729}
5730
5731/// Response message for
5732/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5733///
5734/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5735#[derive(Clone, Default, PartialEq)]
5736#[non_exhaustive]
5737pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
5738    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5739}
5740
5741impl ExecuteSingleTenantHsmInstanceProposalResponse {
5742    pub fn new() -> Self {
5743        std::default::Default::default()
5744    }
5745}
5746
5747impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
5748    fn typename() -> &'static str {
5749        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
5750    }
5751}
5752
5753/// Metadata message for
5754/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
5755/// long-running operation response.
5756///
5757/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5758#[derive(Clone, Default, PartialEq)]
5759#[non_exhaustive]
5760pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
5761    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5762}
5763
5764impl ExecuteSingleTenantHsmInstanceProposalMetadata {
5765    pub fn new() -> Self {
5766        std::default::Default::default()
5767    }
5768}
5769
5770impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
5771    fn typename() -> &'static str {
5772        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
5773    }
5774}
5775
5776/// Request message for
5777/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
5778///
5779/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5780#[derive(Clone, Default, PartialEq)]
5781#[non_exhaustive]
5782pub struct ListSingleTenantHsmInstanceProposalsRequest {
5783    /// Required. The resource name of the single tenant HSM instance associated
5784    /// with the
5785    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5786    /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
5787    ///
5788    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5789    pub parent: std::string::String,
5790
5791    /// Optional. Optional limit on the number of
5792    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5793    /// to include in the response. Further
5794    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5795    /// can subsequently be obtained by including the
5796    /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
5797    /// in a subsequent request. If unspecified, the server will pick an
5798    /// appropriate default.
5799    ///
5800    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
5801    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5802    pub page_size: i32,
5803
5804    /// Optional. Optional pagination token, returned earlier via
5805    /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
5806    ///
5807    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
5808    pub page_token: std::string::String,
5809
5810    /// Optional. Only include resources that match the filter in the response. For
5811    /// more information, see
5812    /// [Sorting and filtering list
5813    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5814    pub filter: std::string::String,
5815
5816    /// Optional. Specify how the results should be sorted. If not specified, the
5817    /// results will be sorted in the default order.  For more information, see
5818    /// [Sorting and filtering list
5819    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5820    pub order_by: std::string::String,
5821
5822    /// Optional. If set to true,
5823    /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
5824    /// will also return
5825    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5826    /// in DELETED state.
5827    ///
5828    /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5829    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5830    pub show_deleted: bool,
5831
5832    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5833}
5834
5835impl ListSingleTenantHsmInstanceProposalsRequest {
5836    pub fn new() -> Self {
5837        std::default::Default::default()
5838    }
5839
5840    /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
5841    ///
5842    /// # Example
5843    /// ```ignore,no_run
5844    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5845    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent("example");
5846    /// ```
5847    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5848        self.parent = v.into();
5849        self
5850    }
5851
5852    /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
5853    ///
5854    /// # Example
5855    /// ```ignore,no_run
5856    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5857    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
5858    /// ```
5859    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5860        self.page_size = v.into();
5861        self
5862    }
5863
5864    /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
5865    ///
5866    /// # Example
5867    /// ```ignore,no_run
5868    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5869    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
5870    /// ```
5871    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5872        self.page_token = v.into();
5873        self
5874    }
5875
5876    /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
5877    ///
5878    /// # Example
5879    /// ```ignore,no_run
5880    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5881    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
5882    /// ```
5883    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5884        self.filter = v.into();
5885        self
5886    }
5887
5888    /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
5889    ///
5890    /// # Example
5891    /// ```ignore,no_run
5892    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5893    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
5894    /// ```
5895    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5896        self.order_by = v.into();
5897        self
5898    }
5899
5900    /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
5901    ///
5902    /// # Example
5903    /// ```ignore,no_run
5904    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5905    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
5906    /// ```
5907    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5908        self.show_deleted = v.into();
5909        self
5910    }
5911}
5912
5913impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
5914    fn typename() -> &'static str {
5915        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
5916    }
5917}
5918
5919/// Response message for
5920/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
5921///
5922/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5923#[derive(Clone, Default, PartialEq)]
5924#[non_exhaustive]
5925pub struct ListSingleTenantHsmInstanceProposalsResponse {
5926    /// The list of
5927    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5928    ///
5929    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5930    pub single_tenant_hsm_instance_proposals:
5931        std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
5932
5933    /// A token to retrieve next page of results. Pass this value in
5934    /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
5935    /// to retrieve the next page of results.
5936    ///
5937    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
5938    pub next_page_token: std::string::String,
5939
5940    /// The total number of
5941    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5942    /// that matched the query.
5943    ///
5944    /// This field is not populated if
5945    /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
5946    /// is applied.
5947    ///
5948    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
5949    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5950    pub total_size: i32,
5951
5952    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5953}
5954
5955impl ListSingleTenantHsmInstanceProposalsResponse {
5956    pub fn new() -> Self {
5957        std::default::Default::default()
5958    }
5959
5960    /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
5961    ///
5962    /// # Example
5963    /// ```ignore,no_run
5964    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
5965    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5966    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
5967    ///     .set_single_tenant_hsm_instance_proposals([
5968    ///         SingleTenantHsmInstanceProposal::default()/* use setters */,
5969    ///         SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
5970    ///     ]);
5971    /// ```
5972    pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
5973    where
5974        T: std::iter::IntoIterator<Item = V>,
5975        V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5976    {
5977        use std::iter::Iterator;
5978        self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
5979        self
5980    }
5981
5982    /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
5983    ///
5984    /// # Example
5985    /// ```ignore,no_run
5986    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
5987    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
5988    /// ```
5989    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5990        self.next_page_token = v.into();
5991        self
5992    }
5993
5994    /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
5995    ///
5996    /// # Example
5997    /// ```ignore,no_run
5998    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
5999    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6000    /// ```
6001    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6002        self.total_size = v.into();
6003        self
6004    }
6005}
6006
6007impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6008    fn typename() -> &'static str {
6009        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6010    }
6011}
6012
6013#[doc(hidden)]
6014impl gax::paginator::internal::PageableResponse for ListSingleTenantHsmInstanceProposalsResponse {
6015    type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6016
6017    fn items(self) -> std::vec::Vec<Self::PageItem> {
6018        self.single_tenant_hsm_instance_proposals
6019    }
6020
6021    fn next_page_token(&self) -> std::string::String {
6022        use std::clone::Clone;
6023        self.next_page_token.clone()
6024    }
6025}
6026
6027/// Request message for
6028/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6029///
6030/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6031#[derive(Clone, Default, PartialEq)]
6032#[non_exhaustive]
6033pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6034    /// Required. The
6035    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6036    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6037    /// to delete.
6038    ///
6039    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6040    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6041    pub name: std::string::String,
6042
6043    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6044}
6045
6046impl DeleteSingleTenantHsmInstanceProposalRequest {
6047    pub fn new() -> Self {
6048        std::default::Default::default()
6049    }
6050
6051    /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6052    ///
6053    /// # Example
6054    /// ```ignore,no_run
6055    /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6056    /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
6057    /// ```
6058    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6059        self.name = v.into();
6060        self
6061    }
6062}
6063
6064impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6065    fn typename() -> &'static str {
6066        "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6067    }
6068}
6069
6070/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6071/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6072///
6073/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6074/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6075#[derive(Clone, Default, PartialEq)]
6076#[non_exhaustive]
6077pub struct KeyRing {
6078    /// Output only. The resource name for the
6079    /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6080    /// `projects/*/locations/*/keyRings/*`.
6081    ///
6082    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6083    pub name: std::string::String,
6084
6085    /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6086    /// was created.
6087    ///
6088    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6089    pub create_time: std::option::Option<wkt::Timestamp>,
6090
6091    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6092}
6093
6094impl KeyRing {
6095    pub fn new() -> Self {
6096        std::default::Default::default()
6097    }
6098
6099    /// Sets the value of [name][crate::model::KeyRing::name].
6100    ///
6101    /// # Example
6102    /// ```ignore,no_run
6103    /// # use google_cloud_kms_v1::model::KeyRing;
6104    /// let x = KeyRing::new().set_name("example");
6105    /// ```
6106    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6107        self.name = v.into();
6108        self
6109    }
6110
6111    /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6112    ///
6113    /// # Example
6114    /// ```ignore,no_run
6115    /// # use google_cloud_kms_v1::model::KeyRing;
6116    /// use wkt::Timestamp;
6117    /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6118    /// ```
6119    pub fn set_create_time<T>(mut self, v: T) -> Self
6120    where
6121        T: std::convert::Into<wkt::Timestamp>,
6122    {
6123        self.create_time = std::option::Option::Some(v.into());
6124        self
6125    }
6126
6127    /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6128    ///
6129    /// # Example
6130    /// ```ignore,no_run
6131    /// # use google_cloud_kms_v1::model::KeyRing;
6132    /// use wkt::Timestamp;
6133    /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6134    /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6135    /// ```
6136    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6137    where
6138        T: std::convert::Into<wkt::Timestamp>,
6139    {
6140        self.create_time = v.map(|x| x.into());
6141        self
6142    }
6143}
6144
6145impl wkt::message::Message for KeyRing {
6146    fn typename() -> &'static str {
6147        "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6148    }
6149}
6150
6151/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6152/// can be used for cryptographic operations.
6153///
6154/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6155/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6156/// key material used in cryptographic operations.
6157///
6158/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6159/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6160#[derive(Clone, Default, PartialEq)]
6161#[non_exhaustive]
6162pub struct CryptoKey {
6163    /// Output only. The resource name for this
6164    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6165    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6166    ///
6167    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6168    pub name: std::string::String,
6169
6170    /// Output only. A copy of the "primary"
6171    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6172    /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6173    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6174    /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6175    ///
6176    /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6177    /// updated via
6178    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6179    ///
6180    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6181    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6182    /// may have a primary. For other keys, this field will be omitted.
6183    ///
6184    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6185    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6186    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6187    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6188    /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6189    /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6190    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6191    pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6192
6193    /// Immutable. The immutable purpose of this
6194    /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6195    ///
6196    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6197    pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6198
6199    /// Output only. The time at which this
6200    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6201    ///
6202    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6203    pub create_time: std::option::Option<wkt::Timestamp>,
6204
6205    /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6206    /// the Key Management Service will automatically:
6207    ///
6208    /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6209    /// 1. Mark the new version as primary.
6210    ///
6211    /// Key rotations performed manually via
6212    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6213    /// and
6214    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6215    /// do not affect
6216    /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6217    ///
6218    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6219    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6220    /// support automatic rotation. For other keys, this field must be omitted.
6221    ///
6222    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6223    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6224    /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6225    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6226    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6227    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6228    pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6229
6230    /// A template describing settings for new
6231    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6232    /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6233    /// instances created by either
6234    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6235    /// or auto-rotation are controlled by this template.
6236    ///
6237    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6238    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6239    pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6240
6241    /// Labels with user-defined metadata. For more information, see
6242    /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6243    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6244
6245    /// Immutable. Whether this key may contain imported versions only.
6246    pub import_only: bool,
6247
6248    /// Immutable. The period of time that versions of this key spend in the
6249    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6250    /// state before transitioning to
6251    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6252    /// If not specified at creation time, the default duration is 30 days.
6253    ///
6254    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6255    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6256    pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6257
6258    /// Immutable. The resource name of the backend environment where the key
6259    /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6260    /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6261    /// where all related cryptographic operations are performed. Only applicable
6262    /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6263    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6264    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6265    /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6266    /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6267    /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6268    /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6269    /// with the resource name in the format
6270    /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6271    /// Note, this list is non-exhaustive and may apply to additional
6272    /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6273    ///
6274    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6275    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6276    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6277    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6278    /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6279    pub crypto_key_backend: std::string::String,
6280
6281    /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6282    /// If this field is present and this key is enrolled in Key Access
6283    /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6284    /// decrypt, and sign operations, and the operation will fail if rejected by
6285    /// the policy. The policy is defined by specifying zero or more allowed
6286    /// justification codes.
6287    /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6288    /// By default, this field is absent, and all justification codes are allowed.
6289    pub key_access_justifications_policy:
6290        std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6291
6292    /// Controls the rate of automatic rotation.
6293    pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6294
6295    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6296}
6297
6298impl CryptoKey {
6299    pub fn new() -> Self {
6300        std::default::Default::default()
6301    }
6302
6303    /// Sets the value of [name][crate::model::CryptoKey::name].
6304    ///
6305    /// # Example
6306    /// ```ignore,no_run
6307    /// # use google_cloud_kms_v1::model::CryptoKey;
6308    /// let x = CryptoKey::new().set_name("example");
6309    /// ```
6310    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6311        self.name = v.into();
6312        self
6313    }
6314
6315    /// Sets the value of [primary][crate::model::CryptoKey::primary].
6316    ///
6317    /// # Example
6318    /// ```ignore,no_run
6319    /// # use google_cloud_kms_v1::model::CryptoKey;
6320    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6321    /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6322    /// ```
6323    pub fn set_primary<T>(mut self, v: T) -> Self
6324    where
6325        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6326    {
6327        self.primary = std::option::Option::Some(v.into());
6328        self
6329    }
6330
6331    /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6332    ///
6333    /// # Example
6334    /// ```ignore,no_run
6335    /// # use google_cloud_kms_v1::model::CryptoKey;
6336    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6337    /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6338    /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6339    /// ```
6340    pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6341    where
6342        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6343    {
6344        self.primary = v.map(|x| x.into());
6345        self
6346    }
6347
6348    /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6349    ///
6350    /// # Example
6351    /// ```ignore,no_run
6352    /// # use google_cloud_kms_v1::model::CryptoKey;
6353    /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6354    /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6355    /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6356    /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6357    /// ```
6358    pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6359        mut self,
6360        v: T,
6361    ) -> Self {
6362        self.purpose = v.into();
6363        self
6364    }
6365
6366    /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6367    ///
6368    /// # Example
6369    /// ```ignore,no_run
6370    /// # use google_cloud_kms_v1::model::CryptoKey;
6371    /// use wkt::Timestamp;
6372    /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6373    /// ```
6374    pub fn set_create_time<T>(mut self, v: T) -> Self
6375    where
6376        T: std::convert::Into<wkt::Timestamp>,
6377    {
6378        self.create_time = std::option::Option::Some(v.into());
6379        self
6380    }
6381
6382    /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6383    ///
6384    /// # Example
6385    /// ```ignore,no_run
6386    /// # use google_cloud_kms_v1::model::CryptoKey;
6387    /// use wkt::Timestamp;
6388    /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6389    /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6390    /// ```
6391    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6392    where
6393        T: std::convert::Into<wkt::Timestamp>,
6394    {
6395        self.create_time = v.map(|x| x.into());
6396        self
6397    }
6398
6399    /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6400    ///
6401    /// # Example
6402    /// ```ignore,no_run
6403    /// # use google_cloud_kms_v1::model::CryptoKey;
6404    /// use wkt::Timestamp;
6405    /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6406    /// ```
6407    pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6408    where
6409        T: std::convert::Into<wkt::Timestamp>,
6410    {
6411        self.next_rotation_time = std::option::Option::Some(v.into());
6412        self
6413    }
6414
6415    /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6416    ///
6417    /// # Example
6418    /// ```ignore,no_run
6419    /// # use google_cloud_kms_v1::model::CryptoKey;
6420    /// use wkt::Timestamp;
6421    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6422    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6423    /// ```
6424    pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6425    where
6426        T: std::convert::Into<wkt::Timestamp>,
6427    {
6428        self.next_rotation_time = v.map(|x| x.into());
6429        self
6430    }
6431
6432    /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6433    ///
6434    /// # Example
6435    /// ```ignore,no_run
6436    /// # use google_cloud_kms_v1::model::CryptoKey;
6437    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6438    /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6439    /// ```
6440    pub fn set_version_template<T>(mut self, v: T) -> Self
6441    where
6442        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6443    {
6444        self.version_template = std::option::Option::Some(v.into());
6445        self
6446    }
6447
6448    /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6449    ///
6450    /// # Example
6451    /// ```ignore,no_run
6452    /// # use google_cloud_kms_v1::model::CryptoKey;
6453    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6454    /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6455    /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6456    /// ```
6457    pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6458    where
6459        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6460    {
6461        self.version_template = v.map(|x| x.into());
6462        self
6463    }
6464
6465    /// Sets the value of [labels][crate::model::CryptoKey::labels].
6466    ///
6467    /// # Example
6468    /// ```ignore,no_run
6469    /// # use google_cloud_kms_v1::model::CryptoKey;
6470    /// let x = CryptoKey::new().set_labels([
6471    ///     ("key0", "abc"),
6472    ///     ("key1", "xyz"),
6473    /// ]);
6474    /// ```
6475    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6476    where
6477        T: std::iter::IntoIterator<Item = (K, V)>,
6478        K: std::convert::Into<std::string::String>,
6479        V: std::convert::Into<std::string::String>,
6480    {
6481        use std::iter::Iterator;
6482        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6483        self
6484    }
6485
6486    /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6487    ///
6488    /// # Example
6489    /// ```ignore,no_run
6490    /// # use google_cloud_kms_v1::model::CryptoKey;
6491    /// let x = CryptoKey::new().set_import_only(true);
6492    /// ```
6493    pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6494        self.import_only = v.into();
6495        self
6496    }
6497
6498    /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6499    ///
6500    /// # Example
6501    /// ```ignore,no_run
6502    /// # use google_cloud_kms_v1::model::CryptoKey;
6503    /// use wkt::Duration;
6504    /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6505    /// ```
6506    pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6507    where
6508        T: std::convert::Into<wkt::Duration>,
6509    {
6510        self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6511        self
6512    }
6513
6514    /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6515    ///
6516    /// # Example
6517    /// ```ignore,no_run
6518    /// # use google_cloud_kms_v1::model::CryptoKey;
6519    /// use wkt::Duration;
6520    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6521    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6522    /// ```
6523    pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
6524    where
6525        T: std::convert::Into<wkt::Duration>,
6526    {
6527        self.destroy_scheduled_duration = v.map(|x| x.into());
6528        self
6529    }
6530
6531    /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
6532    ///
6533    /// # Example
6534    /// ```ignore,no_run
6535    /// # use google_cloud_kms_v1::model::CryptoKey;
6536    /// let x = CryptoKey::new().set_crypto_key_backend("example");
6537    /// ```
6538    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
6539        mut self,
6540        v: T,
6541    ) -> Self {
6542        self.crypto_key_backend = v.into();
6543        self
6544    }
6545
6546    /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6547    ///
6548    /// # Example
6549    /// ```ignore,no_run
6550    /// # use google_cloud_kms_v1::model::CryptoKey;
6551    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6552    /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
6553    /// ```
6554    pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
6555    where
6556        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6557    {
6558        self.key_access_justifications_policy = std::option::Option::Some(v.into());
6559        self
6560    }
6561
6562    /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6563    ///
6564    /// # Example
6565    /// ```ignore,no_run
6566    /// # use google_cloud_kms_v1::model::CryptoKey;
6567    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6568    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
6569    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
6570    /// ```
6571    pub fn set_or_clear_key_access_justifications_policy<T>(
6572        mut self,
6573        v: std::option::Option<T>,
6574    ) -> Self
6575    where
6576        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6577    {
6578        self.key_access_justifications_policy = v.map(|x| x.into());
6579        self
6580    }
6581
6582    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
6583    ///
6584    /// Note that all the setters affecting `rotation_schedule` are mutually
6585    /// exclusive.
6586    ///
6587    /// # Example
6588    /// ```ignore,no_run
6589    /// # use google_cloud_kms_v1::model::CryptoKey;
6590    /// use wkt::Duration;
6591    /// let x = CryptoKey::new().set_rotation_schedule(Some(
6592    ///     google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
6593    /// ```
6594    pub fn set_rotation_schedule<
6595        T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
6596    >(
6597        mut self,
6598        v: T,
6599    ) -> Self {
6600        self.rotation_schedule = v.into();
6601        self
6602    }
6603
6604    /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6605    /// if it holds a `RotationPeriod`, `None` if the field is not set or
6606    /// holds a different branch.
6607    pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6608        #[allow(unreachable_patterns)]
6609        self.rotation_schedule.as_ref().and_then(|v| match v {
6610            crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
6611                std::option::Option::Some(v)
6612            }
6613            _ => std::option::Option::None,
6614        })
6615    }
6616
6617    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6618    /// to hold a `RotationPeriod`.
6619    ///
6620    /// Note that all the setters affecting `rotation_schedule` are
6621    /// mutually exclusive.
6622    ///
6623    /// # Example
6624    /// ```ignore,no_run
6625    /// # use google_cloud_kms_v1::model::CryptoKey;
6626    /// use wkt::Duration;
6627    /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
6628    /// assert!(x.rotation_period().is_some());
6629    /// ```
6630    pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
6631        mut self,
6632        v: T,
6633    ) -> Self {
6634        self.rotation_schedule = std::option::Option::Some(
6635            crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
6636        );
6637        self
6638    }
6639}
6640
6641impl wkt::message::Message for CryptoKey {
6642    fn typename() -> &'static str {
6643        "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
6644    }
6645}
6646
6647/// Defines additional types related to [CryptoKey].
6648pub mod crypto_key {
6649    #[allow(unused_imports)]
6650    use super::*;
6651
6652    /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
6653    /// describes the cryptographic capabilities of a
6654    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
6655    /// for the operations allowed by its purpose. For more information, see [Key
6656    /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
6657    ///
6658    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6659    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
6660    ///
6661    /// # Working with unknown values
6662    ///
6663    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6664    /// additional enum variants at any time. Adding new variants is not considered
6665    /// a breaking change. Applications should write their code in anticipation of:
6666    ///
6667    /// - New values appearing in future releases of the client library, **and**
6668    /// - New values received dynamically, without application changes.
6669    ///
6670    /// Please consult the [Working with enums] section in the user guide for some
6671    /// guidelines.
6672    ///
6673    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6674    #[derive(Clone, Debug, PartialEq)]
6675    #[non_exhaustive]
6676    pub enum CryptoKeyPurpose {
6677        /// Not specified.
6678        Unspecified,
6679        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6680        /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
6681        /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
6682        ///
6683        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6684        /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
6685        /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6686        EncryptDecrypt,
6687        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6688        /// with
6689        /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
6690        /// and
6691        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6692        ///
6693        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6694        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
6695        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6696        AsymmetricSign,
6697        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6698        /// with
6699        /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
6700        /// and
6701        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6702        ///
6703        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6704        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
6705        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6706        AsymmetricDecrypt,
6707        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6708        /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
6709        /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
6710        /// This purpose is meant to be used for interoperable symmetric
6711        /// encryption and does not support automatic CryptoKey rotation.
6712        ///
6713        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6714        /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
6715        /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
6716        RawEncryptDecrypt,
6717        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6718        /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
6719        ///
6720        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6721        /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
6722        Mac,
6723        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6724        /// with
6725        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
6726        /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
6727        ///
6728        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6729        /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
6730        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6731        KeyEncapsulation,
6732        /// If set, the enum was initialized with an unknown value.
6733        ///
6734        /// Applications can examine the value using [CryptoKeyPurpose::value] or
6735        /// [CryptoKeyPurpose::name].
6736        UnknownValue(crypto_key_purpose::UnknownValue),
6737    }
6738
6739    #[doc(hidden)]
6740    pub mod crypto_key_purpose {
6741        #[allow(unused_imports)]
6742        use super::*;
6743        #[derive(Clone, Debug, PartialEq)]
6744        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6745    }
6746
6747    impl CryptoKeyPurpose {
6748        /// Gets the enum value.
6749        ///
6750        /// Returns `None` if the enum contains an unknown value deserialized from
6751        /// the string representation of enums.
6752        pub fn value(&self) -> std::option::Option<i32> {
6753            match self {
6754                Self::Unspecified => std::option::Option::Some(0),
6755                Self::EncryptDecrypt => std::option::Option::Some(1),
6756                Self::AsymmetricSign => std::option::Option::Some(5),
6757                Self::AsymmetricDecrypt => std::option::Option::Some(6),
6758                Self::RawEncryptDecrypt => std::option::Option::Some(7),
6759                Self::Mac => std::option::Option::Some(9),
6760                Self::KeyEncapsulation => std::option::Option::Some(10),
6761                Self::UnknownValue(u) => u.0.value(),
6762            }
6763        }
6764
6765        /// Gets the enum value as a string.
6766        ///
6767        /// Returns `None` if the enum contains an unknown value deserialized from
6768        /// the integer representation of enums.
6769        pub fn name(&self) -> std::option::Option<&str> {
6770            match self {
6771                Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
6772                Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
6773                Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
6774                Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
6775                Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
6776                Self::Mac => std::option::Option::Some("MAC"),
6777                Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
6778                Self::UnknownValue(u) => u.0.name(),
6779            }
6780        }
6781    }
6782
6783    impl std::default::Default for CryptoKeyPurpose {
6784        fn default() -> Self {
6785            use std::convert::From;
6786            Self::from(0)
6787        }
6788    }
6789
6790    impl std::fmt::Display for CryptoKeyPurpose {
6791        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6792            wkt::internal::display_enum(f, self.name(), self.value())
6793        }
6794    }
6795
6796    impl std::convert::From<i32> for CryptoKeyPurpose {
6797        fn from(value: i32) -> Self {
6798            match value {
6799                0 => Self::Unspecified,
6800                1 => Self::EncryptDecrypt,
6801                5 => Self::AsymmetricSign,
6802                6 => Self::AsymmetricDecrypt,
6803                7 => Self::RawEncryptDecrypt,
6804                9 => Self::Mac,
6805                10 => Self::KeyEncapsulation,
6806                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
6807                    wkt::internal::UnknownEnumValue::Integer(value),
6808                )),
6809            }
6810        }
6811    }
6812
6813    impl std::convert::From<&str> for CryptoKeyPurpose {
6814        fn from(value: &str) -> Self {
6815            use std::string::ToString;
6816            match value {
6817                "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
6818                "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
6819                "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
6820                "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
6821                "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
6822                "MAC" => Self::Mac,
6823                "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
6824                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
6825                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6826                )),
6827            }
6828        }
6829    }
6830
6831    impl serde::ser::Serialize for CryptoKeyPurpose {
6832        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6833        where
6834            S: serde::Serializer,
6835        {
6836            match self {
6837                Self::Unspecified => serializer.serialize_i32(0),
6838                Self::EncryptDecrypt => serializer.serialize_i32(1),
6839                Self::AsymmetricSign => serializer.serialize_i32(5),
6840                Self::AsymmetricDecrypt => serializer.serialize_i32(6),
6841                Self::RawEncryptDecrypt => serializer.serialize_i32(7),
6842                Self::Mac => serializer.serialize_i32(9),
6843                Self::KeyEncapsulation => serializer.serialize_i32(10),
6844                Self::UnknownValue(u) => u.0.serialize(serializer),
6845            }
6846        }
6847    }
6848
6849    impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
6850        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6851        where
6852            D: serde::Deserializer<'de>,
6853        {
6854            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
6855                ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
6856            ))
6857        }
6858    }
6859
6860    /// Controls the rate of automatic rotation.
6861    #[derive(Clone, Debug, PartialEq)]
6862    #[non_exhaustive]
6863    pub enum RotationSchedule {
6864        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
6865        /// will be advanced by this period when the service automatically rotates a
6866        /// key. Must be at least 24 hours and at most 876,000 hours.
6867        ///
6868        /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
6869        /// set,
6870        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
6871        /// must also be set.
6872        ///
6873        /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6874        /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6875        /// support automatic rotation. For other keys, this field must be omitted.
6876        ///
6877        /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6878        /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6879        /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6880        /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
6881        RotationPeriod(std::boxed::Box<wkt::Duration>),
6882    }
6883}
6884
6885/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
6886/// specifies the properties to use when creating a new
6887/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
6888/// with
6889/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6890/// or automatically as a result of auto-rotation.
6891///
6892/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6893/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
6894/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6895#[derive(Clone, Default, PartialEq)]
6896#[non_exhaustive]
6897pub struct CryptoKeyVersionTemplate {
6898    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
6899    /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
6900    /// template. Immutable. Defaults to
6901    /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
6902    ///
6903    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6904    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6905    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
6906    pub protection_level: crate::model::ProtectionLevel,
6907
6908    /// Required.
6909    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
6910    /// to use when creating a
6911    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
6912    /// template.
6913    ///
6914    /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
6915    /// this field is omitted and
6916    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
6917    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
6918    ///
6919    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6920    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6921    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6922    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
6923    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
6924
6925    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6926}
6927
6928impl CryptoKeyVersionTemplate {
6929    pub fn new() -> Self {
6930        std::default::Default::default()
6931    }
6932
6933    /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
6934    ///
6935    /// # Example
6936    /// ```ignore,no_run
6937    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6938    /// use google_cloud_kms_v1::model::ProtectionLevel;
6939    /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
6940    /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
6941    /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
6942    /// ```
6943    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
6944        mut self,
6945        v: T,
6946    ) -> Self {
6947        self.protection_level = v.into();
6948        self
6949    }
6950
6951    /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
6952    ///
6953    /// # Example
6954    /// ```ignore,no_run
6955    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6956    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
6957    /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
6958    /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
6959    /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
6960    /// ```
6961    pub fn set_algorithm<
6962        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
6963    >(
6964        mut self,
6965        v: T,
6966    ) -> Self {
6967        self.algorithm = v.into();
6968        self
6969    }
6970}
6971
6972impl wkt::message::Message for CryptoKeyVersionTemplate {
6973    fn typename() -> &'static str {
6974        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
6975    }
6976}
6977
6978/// Contains an HSM-generated attestation about a key operation. For more
6979/// information, see [Verifying attestations]
6980/// (<https://cloud.google.com/kms/docs/attest-key>).
6981#[derive(Clone, Default, PartialEq)]
6982#[non_exhaustive]
6983pub struct KeyOperationAttestation {
6984    /// Output only. The format of the attestation data.
6985    pub format: crate::model::key_operation_attestation::AttestationFormat,
6986
6987    /// Output only. The attestation data provided by the HSM when the key
6988    /// operation was performed.
6989    pub content: ::bytes::Bytes,
6990
6991    /// Output only. The certificate chains needed to validate the attestation
6992    pub cert_chains:
6993        std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
6994
6995    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6996}
6997
6998impl KeyOperationAttestation {
6999    pub fn new() -> Self {
7000        std::default::Default::default()
7001    }
7002
7003    /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7004    ///
7005    /// # Example
7006    /// ```ignore,no_run
7007    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7008    /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7009    /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7010    /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7011    /// ```
7012    pub fn set_format<
7013        T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7014    >(
7015        mut self,
7016        v: T,
7017    ) -> Self {
7018        self.format = v.into();
7019        self
7020    }
7021
7022    /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7023    ///
7024    /// # Example
7025    /// ```ignore,no_run
7026    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7027    /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7028    /// ```
7029    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7030        self.content = v.into();
7031        self
7032    }
7033
7034    /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7035    ///
7036    /// # Example
7037    /// ```ignore,no_run
7038    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7039    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7040    /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7041    /// ```
7042    pub fn set_cert_chains<T>(mut self, v: T) -> Self
7043    where
7044        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7045    {
7046        self.cert_chains = std::option::Option::Some(v.into());
7047        self
7048    }
7049
7050    /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7051    ///
7052    /// # Example
7053    /// ```ignore,no_run
7054    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7055    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7056    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7057    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7058    /// ```
7059    pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7060    where
7061        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7062    {
7063        self.cert_chains = v.map(|x| x.into());
7064        self
7065    }
7066}
7067
7068impl wkt::message::Message for KeyOperationAttestation {
7069    fn typename() -> &'static str {
7070        "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7071    }
7072}
7073
7074/// Defines additional types related to [KeyOperationAttestation].
7075pub mod key_operation_attestation {
7076    #[allow(unused_imports)]
7077    use super::*;
7078
7079    /// Certificate chains needed to verify the attestation.
7080    /// Certificates in chains are PEM-encoded and are ordered based on
7081    /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7082    #[derive(Clone, Default, PartialEq)]
7083    #[non_exhaustive]
7084    pub struct CertificateChains {
7085        /// Cavium certificate chain corresponding to the attestation.
7086        pub cavium_certs: std::vec::Vec<std::string::String>,
7087
7088        /// Google card certificate chain corresponding to the attestation.
7089        pub google_card_certs: std::vec::Vec<std::string::String>,
7090
7091        /// Google partition certificate chain corresponding to the attestation.
7092        pub google_partition_certs: std::vec::Vec<std::string::String>,
7093
7094        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7095    }
7096
7097    impl CertificateChains {
7098        pub fn new() -> Self {
7099            std::default::Default::default()
7100        }
7101
7102        /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7103        ///
7104        /// # Example
7105        /// ```ignore,no_run
7106        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7107        /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7108        /// ```
7109        pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7110        where
7111            T: std::iter::IntoIterator<Item = V>,
7112            V: std::convert::Into<std::string::String>,
7113        {
7114            use std::iter::Iterator;
7115            self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7116            self
7117        }
7118
7119        /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7120        ///
7121        /// # Example
7122        /// ```ignore,no_run
7123        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7124        /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7125        /// ```
7126        pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7127        where
7128            T: std::iter::IntoIterator<Item = V>,
7129            V: std::convert::Into<std::string::String>,
7130        {
7131            use std::iter::Iterator;
7132            self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7133            self
7134        }
7135
7136        /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7137        ///
7138        /// # Example
7139        /// ```ignore,no_run
7140        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7141        /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7142        /// ```
7143        pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7144        where
7145            T: std::iter::IntoIterator<Item = V>,
7146            V: std::convert::Into<std::string::String>,
7147        {
7148            use std::iter::Iterator;
7149            self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7150            self
7151        }
7152    }
7153
7154    impl wkt::message::Message for CertificateChains {
7155        fn typename() -> &'static str {
7156            "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7157        }
7158    }
7159
7160    /// Attestation formats provided by the HSM.
7161    ///
7162    /// # Working with unknown values
7163    ///
7164    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7165    /// additional enum variants at any time. Adding new variants is not considered
7166    /// a breaking change. Applications should write their code in anticipation of:
7167    ///
7168    /// - New values appearing in future releases of the client library, **and**
7169    /// - New values received dynamically, without application changes.
7170    ///
7171    /// Please consult the [Working with enums] section in the user guide for some
7172    /// guidelines.
7173    ///
7174    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7175    #[derive(Clone, Debug, PartialEq)]
7176    #[non_exhaustive]
7177    pub enum AttestationFormat {
7178        /// Not specified.
7179        Unspecified,
7180        /// Cavium HSM attestation compressed with gzip. Note that this format is
7181        /// defined by Cavium and subject to change at any time.
7182        ///
7183        /// See
7184        /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7185        CaviumV1Compressed,
7186        /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7187        /// introduced in Cavium's version 3.2-08.
7188        CaviumV2Compressed,
7189        /// If set, the enum was initialized with an unknown value.
7190        ///
7191        /// Applications can examine the value using [AttestationFormat::value] or
7192        /// [AttestationFormat::name].
7193        UnknownValue(attestation_format::UnknownValue),
7194    }
7195
7196    #[doc(hidden)]
7197    pub mod attestation_format {
7198        #[allow(unused_imports)]
7199        use super::*;
7200        #[derive(Clone, Debug, PartialEq)]
7201        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7202    }
7203
7204    impl AttestationFormat {
7205        /// Gets the enum value.
7206        ///
7207        /// Returns `None` if the enum contains an unknown value deserialized from
7208        /// the string representation of enums.
7209        pub fn value(&self) -> std::option::Option<i32> {
7210            match self {
7211                Self::Unspecified => std::option::Option::Some(0),
7212                Self::CaviumV1Compressed => std::option::Option::Some(3),
7213                Self::CaviumV2Compressed => std::option::Option::Some(4),
7214                Self::UnknownValue(u) => u.0.value(),
7215            }
7216        }
7217
7218        /// Gets the enum value as a string.
7219        ///
7220        /// Returns `None` if the enum contains an unknown value deserialized from
7221        /// the integer representation of enums.
7222        pub fn name(&self) -> std::option::Option<&str> {
7223            match self {
7224                Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7225                Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7226                Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7227                Self::UnknownValue(u) => u.0.name(),
7228            }
7229        }
7230    }
7231
7232    impl std::default::Default for AttestationFormat {
7233        fn default() -> Self {
7234            use std::convert::From;
7235            Self::from(0)
7236        }
7237    }
7238
7239    impl std::fmt::Display for AttestationFormat {
7240        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7241            wkt::internal::display_enum(f, self.name(), self.value())
7242        }
7243    }
7244
7245    impl std::convert::From<i32> for AttestationFormat {
7246        fn from(value: i32) -> Self {
7247            match value {
7248                0 => Self::Unspecified,
7249                3 => Self::CaviumV1Compressed,
7250                4 => Self::CaviumV2Compressed,
7251                _ => Self::UnknownValue(attestation_format::UnknownValue(
7252                    wkt::internal::UnknownEnumValue::Integer(value),
7253                )),
7254            }
7255        }
7256    }
7257
7258    impl std::convert::From<&str> for AttestationFormat {
7259        fn from(value: &str) -> Self {
7260            use std::string::ToString;
7261            match value {
7262                "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7263                "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7264                "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7265                _ => Self::UnknownValue(attestation_format::UnknownValue(
7266                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7267                )),
7268            }
7269        }
7270    }
7271
7272    impl serde::ser::Serialize for AttestationFormat {
7273        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7274        where
7275            S: serde::Serializer,
7276        {
7277            match self {
7278                Self::Unspecified => serializer.serialize_i32(0),
7279                Self::CaviumV1Compressed => serializer.serialize_i32(3),
7280                Self::CaviumV2Compressed => serializer.serialize_i32(4),
7281                Self::UnknownValue(u) => u.0.serialize(serializer),
7282            }
7283        }
7284    }
7285
7286    impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7287        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7288        where
7289            D: serde::Deserializer<'de>,
7290        {
7291            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7292                ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7293            ))
7294        }
7295    }
7296}
7297
7298/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7299/// individual cryptographic key, and the associated key material.
7300///
7301/// An
7302/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7303/// version can be used for cryptographic operations.
7304///
7305/// For security reasons, the raw cryptographic key material represented by a
7306/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7307/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7308/// authorized user or application invokes Cloud KMS.
7309///
7310/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7311/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7312#[derive(Clone, Default, PartialEq)]
7313#[non_exhaustive]
7314pub struct CryptoKeyVersion {
7315    /// Output only. The resource name for this
7316    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7317    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7318    ///
7319    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7320    pub name: std::string::String,
7321
7322    /// The current state of the
7323    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7324    ///
7325    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7326    pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7327
7328    /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7329    /// describing how crypto operations are performed with this
7330    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7331    ///
7332    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7333    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7334    pub protection_level: crate::model::ProtectionLevel,
7335
7336    /// Output only. The
7337    /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7338    /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7339    /// supports.
7340    ///
7341    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7342    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7343    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7344
7345    /// Output only. Statement that was generated and signed by the HSM at key
7346    /// creation time. Use this statement to verify attributes of the key as stored
7347    /// on the HSM, independently of Google. Only provided for key versions with
7348    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7349    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7350    ///
7351    /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7352    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7353    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7354
7355    /// Output only. The time at which this
7356    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7357    ///
7358    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7359    pub create_time: std::option::Option<wkt::Timestamp>,
7360
7361    /// Output only. The time this
7362    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7363    /// generated.
7364    ///
7365    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7366    pub generate_time: std::option::Option<wkt::Timestamp>,
7367
7368    /// Output only. The time this
7369    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7370    /// scheduled for destruction. Only present if
7371    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7372    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7373    ///
7374    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7375    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7376    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7377    pub destroy_time: std::option::Option<wkt::Timestamp>,
7378
7379    /// Output only. The time this CryptoKeyVersion's key material was
7380    /// destroyed. Only present if
7381    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7382    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7383    ///
7384    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7385    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7386    pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7387
7388    /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7389    /// used in the most recent import of this
7390    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7391    /// the underlying key material was imported.
7392    ///
7393    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7394    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7395    pub import_job: std::string::String,
7396
7397    /// Output only. The time at which this
7398    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7399    /// most recently imported.
7400    ///
7401    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7402    pub import_time: std::option::Option<wkt::Timestamp>,
7403
7404    /// Output only. The root cause of the most recent import failure. Only present
7405    /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7406    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7407    ///
7408    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7409    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7410    pub import_failure_reason: std::string::String,
7411
7412    /// Output only. The root cause of the most recent generation failure. Only
7413    /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7414    /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7415    ///
7416    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7417    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7418    pub generation_failure_reason: std::string::String,
7419
7420    /// Output only. The root cause of the most recent external destruction
7421    /// failure. Only present if
7422    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7423    /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7424    ///
7425    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7426    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7427    pub external_destruction_failure_reason: std::string::String,
7428
7429    /// ExternalProtectionLevelOptions stores a group of additional fields for
7430    /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7431    /// are specific to the
7432    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7433    /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7434    /// protection levels.
7435    ///
7436    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7437    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7438    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7439    pub external_protection_level_options:
7440        std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7441
7442    /// Output only. Whether or not this key version is eligible for reimport, by
7443    /// being specified as a target in
7444    /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7445    ///
7446    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7447    pub reimport_eligible: bool,
7448
7449    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7450}
7451
7452impl CryptoKeyVersion {
7453    pub fn new() -> Self {
7454        std::default::Default::default()
7455    }
7456
7457    /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7458    ///
7459    /// # Example
7460    /// ```ignore,no_run
7461    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7462    /// let x = CryptoKeyVersion::new().set_name("example");
7463    /// ```
7464    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7465        self.name = v.into();
7466        self
7467    }
7468
7469    /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7470    ///
7471    /// # Example
7472    /// ```ignore,no_run
7473    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7474    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7475    /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7476    /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7477    /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7478    /// ```
7479    pub fn set_state<
7480        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
7481    >(
7482        mut self,
7483        v: T,
7484    ) -> Self {
7485        self.state = v.into();
7486        self
7487    }
7488
7489    /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
7490    ///
7491    /// # Example
7492    /// ```ignore,no_run
7493    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7494    /// use google_cloud_kms_v1::model::ProtectionLevel;
7495    /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
7496    /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
7497    /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
7498    /// ```
7499    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7500        mut self,
7501        v: T,
7502    ) -> Self {
7503        self.protection_level = v.into();
7504        self
7505    }
7506
7507    /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
7508    ///
7509    /// # Example
7510    /// ```ignore,no_run
7511    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7512    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7513    /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7514    /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7515    /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7516    /// ```
7517    pub fn set_algorithm<
7518        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7519    >(
7520        mut self,
7521        v: T,
7522    ) -> Self {
7523        self.algorithm = v.into();
7524        self
7525    }
7526
7527    /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7528    ///
7529    /// # Example
7530    /// ```ignore,no_run
7531    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7532    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7533    /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
7534    /// ```
7535    pub fn set_attestation<T>(mut self, v: T) -> Self
7536    where
7537        T: std::convert::Into<crate::model::KeyOperationAttestation>,
7538    {
7539        self.attestation = std::option::Option::Some(v.into());
7540        self
7541    }
7542
7543    /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7544    ///
7545    /// # Example
7546    /// ```ignore,no_run
7547    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7548    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7549    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
7550    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
7551    /// ```
7552    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
7553    where
7554        T: std::convert::Into<crate::model::KeyOperationAttestation>,
7555    {
7556        self.attestation = v.map(|x| x.into());
7557        self
7558    }
7559
7560    /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7561    ///
7562    /// # Example
7563    /// ```ignore,no_run
7564    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7565    /// use wkt::Timestamp;
7566    /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
7567    /// ```
7568    pub fn set_create_time<T>(mut self, v: T) -> Self
7569    where
7570        T: std::convert::Into<wkt::Timestamp>,
7571    {
7572        self.create_time = std::option::Option::Some(v.into());
7573        self
7574    }
7575
7576    /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7577    ///
7578    /// # Example
7579    /// ```ignore,no_run
7580    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7581    /// use wkt::Timestamp;
7582    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7583    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
7584    /// ```
7585    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7586    where
7587        T: std::convert::Into<wkt::Timestamp>,
7588    {
7589        self.create_time = v.map(|x| x.into());
7590        self
7591    }
7592
7593    /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7594    ///
7595    /// # Example
7596    /// ```ignore,no_run
7597    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7598    /// use wkt::Timestamp;
7599    /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
7600    /// ```
7601    pub fn set_generate_time<T>(mut self, v: T) -> Self
7602    where
7603        T: std::convert::Into<wkt::Timestamp>,
7604    {
7605        self.generate_time = std::option::Option::Some(v.into());
7606        self
7607    }
7608
7609    /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7610    ///
7611    /// # Example
7612    /// ```ignore,no_run
7613    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7614    /// use wkt::Timestamp;
7615    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
7616    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
7617    /// ```
7618    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
7619    where
7620        T: std::convert::Into<wkt::Timestamp>,
7621    {
7622        self.generate_time = v.map(|x| x.into());
7623        self
7624    }
7625
7626    /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7627    ///
7628    /// # Example
7629    /// ```ignore,no_run
7630    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7631    /// use wkt::Timestamp;
7632    /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
7633    /// ```
7634    pub fn set_destroy_time<T>(mut self, v: T) -> Self
7635    where
7636        T: std::convert::Into<wkt::Timestamp>,
7637    {
7638        self.destroy_time = std::option::Option::Some(v.into());
7639        self
7640    }
7641
7642    /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7643    ///
7644    /// # Example
7645    /// ```ignore,no_run
7646    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7647    /// use wkt::Timestamp;
7648    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
7649    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
7650    /// ```
7651    pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
7652    where
7653        T: std::convert::Into<wkt::Timestamp>,
7654    {
7655        self.destroy_time = v.map(|x| x.into());
7656        self
7657    }
7658
7659    /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7660    ///
7661    /// # Example
7662    /// ```ignore,no_run
7663    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7664    /// use wkt::Timestamp;
7665    /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
7666    /// ```
7667    pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
7668    where
7669        T: std::convert::Into<wkt::Timestamp>,
7670    {
7671        self.destroy_event_time = std::option::Option::Some(v.into());
7672        self
7673    }
7674
7675    /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7676    ///
7677    /// # Example
7678    /// ```ignore,no_run
7679    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7680    /// use wkt::Timestamp;
7681    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
7682    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
7683    /// ```
7684    pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
7685    where
7686        T: std::convert::Into<wkt::Timestamp>,
7687    {
7688        self.destroy_event_time = v.map(|x| x.into());
7689        self
7690    }
7691
7692    /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
7693    ///
7694    /// # Example
7695    /// ```ignore,no_run
7696    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7697    /// let x = CryptoKeyVersion::new().set_import_job("example");
7698    /// ```
7699    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7700        self.import_job = v.into();
7701        self
7702    }
7703
7704    /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7705    ///
7706    /// # Example
7707    /// ```ignore,no_run
7708    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7709    /// use wkt::Timestamp;
7710    /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
7711    /// ```
7712    pub fn set_import_time<T>(mut self, v: T) -> Self
7713    where
7714        T: std::convert::Into<wkt::Timestamp>,
7715    {
7716        self.import_time = std::option::Option::Some(v.into());
7717        self
7718    }
7719
7720    /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7721    ///
7722    /// # Example
7723    /// ```ignore,no_run
7724    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7725    /// use wkt::Timestamp;
7726    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
7727    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
7728    /// ```
7729    pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
7730    where
7731        T: std::convert::Into<wkt::Timestamp>,
7732    {
7733        self.import_time = v.map(|x| x.into());
7734        self
7735    }
7736
7737    /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
7738    ///
7739    /// # Example
7740    /// ```ignore,no_run
7741    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7742    /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
7743    /// ```
7744    pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
7745        mut self,
7746        v: T,
7747    ) -> Self {
7748        self.import_failure_reason = v.into();
7749        self
7750    }
7751
7752    /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
7753    ///
7754    /// # Example
7755    /// ```ignore,no_run
7756    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7757    /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
7758    /// ```
7759    pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
7760        mut self,
7761        v: T,
7762    ) -> Self {
7763        self.generation_failure_reason = v.into();
7764        self
7765    }
7766
7767    /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
7768    ///
7769    /// # Example
7770    /// ```ignore,no_run
7771    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7772    /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
7773    /// ```
7774    pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
7775        mut self,
7776        v: T,
7777    ) -> Self {
7778        self.external_destruction_failure_reason = v.into();
7779        self
7780    }
7781
7782    /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
7783    ///
7784    /// # Example
7785    /// ```ignore,no_run
7786    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7787    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
7788    /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
7789    /// ```
7790    pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
7791    where
7792        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
7793    {
7794        self.external_protection_level_options = std::option::Option::Some(v.into());
7795        self
7796    }
7797
7798    /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
7799    ///
7800    /// # Example
7801    /// ```ignore,no_run
7802    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7803    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
7804    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
7805    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
7806    /// ```
7807    pub fn set_or_clear_external_protection_level_options<T>(
7808        mut self,
7809        v: std::option::Option<T>,
7810    ) -> Self
7811    where
7812        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
7813    {
7814        self.external_protection_level_options = v.map(|x| x.into());
7815        self
7816    }
7817
7818    /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
7819    ///
7820    /// # Example
7821    /// ```ignore,no_run
7822    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7823    /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
7824    /// ```
7825    pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7826        self.reimport_eligible = v.into();
7827        self
7828    }
7829}
7830
7831impl wkt::message::Message for CryptoKeyVersion {
7832    fn typename() -> &'static str {
7833        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
7834    }
7835}
7836
7837/// Defines additional types related to [CryptoKeyVersion].
7838pub mod crypto_key_version {
7839    #[allow(unused_imports)]
7840    use super::*;
7841
7842    /// The algorithm of the
7843    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
7844    /// parameters must be used for each cryptographic operation.
7845    ///
7846    /// The
7847    /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
7848    /// algorithm is usable with
7849    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7850    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7851    ///
7852    /// Algorithms beginning with `RSA_SIGN_` are usable with
7853    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7854    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
7855    ///
7856    /// The fields in the name after `RSA_SIGN_` correspond to the following
7857    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
7858    ///
7859    /// For PSS, the salt length used is equal to the length of digest
7860    /// algorithm. For example,
7861    /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
7862    /// will use PSS with a salt length of 256 bits or 32 bytes.
7863    ///
7864    /// Algorithms beginning with `RSA_DECRYPT_` are usable with
7865    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7866    /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
7867    ///
7868    /// The fields in the name after `RSA_DECRYPT_` correspond to the following
7869    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
7870    ///
7871    /// Algorithms beginning with `EC_SIGN_` are usable with
7872    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7873    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
7874    ///
7875    /// The fields in the name after `EC_SIGN_` correspond to the following
7876    /// parameters: elliptic curve, digest algorithm.
7877    ///
7878    /// Algorithms beginning with `HMAC_` are usable with
7879    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7880    /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
7881    ///
7882    /// The suffix following `HMAC_` corresponds to the hash algorithm being used
7883    /// (eg. SHA256).
7884    ///
7885    /// Algorithms beginning with `PQ_` are post-quantum.
7886    ///
7887    /// For more information, see [Key purposes and algorithms]
7888    /// (<https://cloud.google.com/kms/docs/algorithms>).
7889    ///
7890    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
7891    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
7892    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7893    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
7894    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7895    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7896    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
7897    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
7898    ///
7899    /// # Working with unknown values
7900    ///
7901    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7902    /// additional enum variants at any time. Adding new variants is not considered
7903    /// a breaking change. Applications should write their code in anticipation of:
7904    ///
7905    /// - New values appearing in future releases of the client library, **and**
7906    /// - New values received dynamically, without application changes.
7907    ///
7908    /// Please consult the [Working with enums] section in the user guide for some
7909    /// guidelines.
7910    ///
7911    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7912    #[derive(Clone, Debug, PartialEq)]
7913    #[non_exhaustive]
7914    pub enum CryptoKeyVersionAlgorithm {
7915        /// Not specified.
7916        Unspecified,
7917        /// Creates symmetric encryption keys.
7918        GoogleSymmetricEncryption,
7919        /// AES-GCM (Galois Counter Mode) using 128-bit keys.
7920        Aes128Gcm,
7921        /// AES-GCM (Galois Counter Mode) using 256-bit keys.
7922        Aes256Gcm,
7923        /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
7924        Aes128Cbc,
7925        /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
7926        Aes256Cbc,
7927        /// AES-CTR (Counter Mode) using 128-bit keys.
7928        Aes128Ctr,
7929        /// AES-CTR (Counter Mode) using 256-bit keys.
7930        Aes256Ctr,
7931        /// RSASSA-PSS 2048 bit key with a SHA256 digest.
7932        RsaSignPss2048Sha256,
7933        /// RSASSA-PSS 3072 bit key with a SHA256 digest.
7934        RsaSignPss3072Sha256,
7935        /// RSASSA-PSS 4096 bit key with a SHA256 digest.
7936        RsaSignPss4096Sha256,
7937        /// RSASSA-PSS 4096 bit key with a SHA512 digest.
7938        RsaSignPss4096Sha512,
7939        /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
7940        RsaSignPkcs12048Sha256,
7941        /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
7942        RsaSignPkcs13072Sha256,
7943        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
7944        RsaSignPkcs14096Sha256,
7945        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
7946        RsaSignPkcs14096Sha512,
7947        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
7948        RsaSignRawPkcs12048,
7949        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
7950        RsaSignRawPkcs13072,
7951        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
7952        RsaSignRawPkcs14096,
7953        /// RSAES-OAEP 2048 bit key with a SHA256 digest.
7954        RsaDecryptOaep2048Sha256,
7955        /// RSAES-OAEP 3072 bit key with a SHA256 digest.
7956        RsaDecryptOaep3072Sha256,
7957        /// RSAES-OAEP 4096 bit key with a SHA256 digest.
7958        RsaDecryptOaep4096Sha256,
7959        /// RSAES-OAEP 4096 bit key with a SHA512 digest.
7960        RsaDecryptOaep4096Sha512,
7961        /// RSAES-OAEP 2048 bit key with a SHA1 digest.
7962        RsaDecryptOaep2048Sha1,
7963        /// RSAES-OAEP 3072 bit key with a SHA1 digest.
7964        RsaDecryptOaep3072Sha1,
7965        /// RSAES-OAEP 4096 bit key with a SHA1 digest.
7966        RsaDecryptOaep4096Sha1,
7967        /// ECDSA on the NIST P-256 curve with a SHA256 digest.
7968        /// Other hash functions can also be used:
7969        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
7970        EcSignP256Sha256,
7971        /// ECDSA on the NIST P-384 curve with a SHA384 digest.
7972        /// Other hash functions can also be used:
7973        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
7974        EcSignP384Sha384,
7975        /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
7976        /// HSM protection level.
7977        /// Other hash functions can also be used:
7978        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
7979        EcSignSecp256K1Sha256,
7980        /// EdDSA on the Curve25519 in pure mode (taking data as input).
7981        EcSignEd25519,
7982        /// HMAC-SHA256 signing with a 256 bit key.
7983        HmacSha256,
7984        /// HMAC-SHA1 signing with a 160 bit key.
7985        HmacSha1,
7986        /// HMAC-SHA384 signing with a 384 bit key.
7987        HmacSha384,
7988        /// HMAC-SHA512 signing with a 512 bit key.
7989        HmacSha512,
7990        /// HMAC-SHA224 signing with a 224 bit key.
7991        HmacSha224,
7992        /// Algorithm representing symmetric encryption by an external key manager.
7993        ExternalSymmetricEncryption,
7994        /// ML-KEM-768 (FIPS 203)
7995        MlKem768,
7996        /// ML-KEM-1024 (FIPS 203)
7997        MlKem1024,
7998        /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
7999        /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8000        KemXwing,
8001        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8002        /// security level 3. Randomized version.
8003        PqSignMlDsa65,
8004        /// The post-quantum stateless hash-based digital signature algorithm, at
8005        /// security level 1. Randomized version.
8006        PqSignSlhDsaSha2128S,
8007        /// If set, the enum was initialized with an unknown value.
8008        ///
8009        /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8010        /// [CryptoKeyVersionAlgorithm::name].
8011        UnknownValue(crypto_key_version_algorithm::UnknownValue),
8012    }
8013
8014    #[doc(hidden)]
8015    pub mod crypto_key_version_algorithm {
8016        #[allow(unused_imports)]
8017        use super::*;
8018        #[derive(Clone, Debug, PartialEq)]
8019        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8020    }
8021
8022    impl CryptoKeyVersionAlgorithm {
8023        /// Gets the enum value.
8024        ///
8025        /// Returns `None` if the enum contains an unknown value deserialized from
8026        /// the string representation of enums.
8027        pub fn value(&self) -> std::option::Option<i32> {
8028            match self {
8029                Self::Unspecified => std::option::Option::Some(0),
8030                Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8031                Self::Aes128Gcm => std::option::Option::Some(41),
8032                Self::Aes256Gcm => std::option::Option::Some(19),
8033                Self::Aes128Cbc => std::option::Option::Some(42),
8034                Self::Aes256Cbc => std::option::Option::Some(43),
8035                Self::Aes128Ctr => std::option::Option::Some(44),
8036                Self::Aes256Ctr => std::option::Option::Some(45),
8037                Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8038                Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8039                Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8040                Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8041                Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8042                Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8043                Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8044                Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8045                Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8046                Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8047                Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8048                Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8049                Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8050                Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8051                Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8052                Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8053                Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8054                Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8055                Self::EcSignP256Sha256 => std::option::Option::Some(12),
8056                Self::EcSignP384Sha384 => std::option::Option::Some(13),
8057                Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8058                Self::EcSignEd25519 => std::option::Option::Some(40),
8059                Self::HmacSha256 => std::option::Option::Some(32),
8060                Self::HmacSha1 => std::option::Option::Some(33),
8061                Self::HmacSha384 => std::option::Option::Some(34),
8062                Self::HmacSha512 => std::option::Option::Some(35),
8063                Self::HmacSha224 => std::option::Option::Some(36),
8064                Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8065                Self::MlKem768 => std::option::Option::Some(47),
8066                Self::MlKem1024 => std::option::Option::Some(48),
8067                Self::KemXwing => std::option::Option::Some(63),
8068                Self::PqSignMlDsa65 => std::option::Option::Some(56),
8069                Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8070                Self::UnknownValue(u) => u.0.value(),
8071            }
8072        }
8073
8074        /// Gets the enum value as a string.
8075        ///
8076        /// Returns `None` if the enum contains an unknown value deserialized from
8077        /// the integer representation of enums.
8078        pub fn name(&self) -> std::option::Option<&str> {
8079            match self {
8080                Self::Unspecified => {
8081                    std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8082                }
8083                Self::GoogleSymmetricEncryption => {
8084                    std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8085                }
8086                Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8087                Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8088                Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8089                Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8090                Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8091                Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8092                Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8093                Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8094                Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8095                Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8096                Self::RsaSignPkcs12048Sha256 => {
8097                    std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8098                }
8099                Self::RsaSignPkcs13072Sha256 => {
8100                    std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8101                }
8102                Self::RsaSignPkcs14096Sha256 => {
8103                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8104                }
8105                Self::RsaSignPkcs14096Sha512 => {
8106                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8107                }
8108                Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8109                Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8110                Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8111                Self::RsaDecryptOaep2048Sha256 => {
8112                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8113                }
8114                Self::RsaDecryptOaep3072Sha256 => {
8115                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8116                }
8117                Self::RsaDecryptOaep4096Sha256 => {
8118                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8119                }
8120                Self::RsaDecryptOaep4096Sha512 => {
8121                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8122                }
8123                Self::RsaDecryptOaep2048Sha1 => {
8124                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8125                }
8126                Self::RsaDecryptOaep3072Sha1 => {
8127                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8128                }
8129                Self::RsaDecryptOaep4096Sha1 => {
8130                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8131                }
8132                Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8133                Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8134                Self::EcSignSecp256K1Sha256 => {
8135                    std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8136                }
8137                Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8138                Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8139                Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8140                Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8141                Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8142                Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8143                Self::ExternalSymmetricEncryption => {
8144                    std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8145                }
8146                Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8147                Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8148                Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8149                Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8150                Self::PqSignSlhDsaSha2128S => {
8151                    std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8152                }
8153                Self::UnknownValue(u) => u.0.name(),
8154            }
8155        }
8156    }
8157
8158    impl std::default::Default for CryptoKeyVersionAlgorithm {
8159        fn default() -> Self {
8160            use std::convert::From;
8161            Self::from(0)
8162        }
8163    }
8164
8165    impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8166        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8167            wkt::internal::display_enum(f, self.name(), self.value())
8168        }
8169    }
8170
8171    impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8172        fn from(value: i32) -> Self {
8173            match value {
8174                0 => Self::Unspecified,
8175                1 => Self::GoogleSymmetricEncryption,
8176                2 => Self::RsaSignPss2048Sha256,
8177                3 => Self::RsaSignPss3072Sha256,
8178                4 => Self::RsaSignPss4096Sha256,
8179                5 => Self::RsaSignPkcs12048Sha256,
8180                6 => Self::RsaSignPkcs13072Sha256,
8181                7 => Self::RsaSignPkcs14096Sha256,
8182                8 => Self::RsaDecryptOaep2048Sha256,
8183                9 => Self::RsaDecryptOaep3072Sha256,
8184                10 => Self::RsaDecryptOaep4096Sha256,
8185                12 => Self::EcSignP256Sha256,
8186                13 => Self::EcSignP384Sha384,
8187                15 => Self::RsaSignPss4096Sha512,
8188                16 => Self::RsaSignPkcs14096Sha512,
8189                17 => Self::RsaDecryptOaep4096Sha512,
8190                18 => Self::ExternalSymmetricEncryption,
8191                19 => Self::Aes256Gcm,
8192                28 => Self::RsaSignRawPkcs12048,
8193                29 => Self::RsaSignRawPkcs13072,
8194                30 => Self::RsaSignRawPkcs14096,
8195                31 => Self::EcSignSecp256K1Sha256,
8196                32 => Self::HmacSha256,
8197                33 => Self::HmacSha1,
8198                34 => Self::HmacSha384,
8199                35 => Self::HmacSha512,
8200                36 => Self::HmacSha224,
8201                37 => Self::RsaDecryptOaep2048Sha1,
8202                38 => Self::RsaDecryptOaep3072Sha1,
8203                39 => Self::RsaDecryptOaep4096Sha1,
8204                40 => Self::EcSignEd25519,
8205                41 => Self::Aes128Gcm,
8206                42 => Self::Aes128Cbc,
8207                43 => Self::Aes256Cbc,
8208                44 => Self::Aes128Ctr,
8209                45 => Self::Aes256Ctr,
8210                47 => Self::MlKem768,
8211                48 => Self::MlKem1024,
8212                56 => Self::PqSignMlDsa65,
8213                57 => Self::PqSignSlhDsaSha2128S,
8214                63 => Self::KemXwing,
8215                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8216                    wkt::internal::UnknownEnumValue::Integer(value),
8217                )),
8218            }
8219        }
8220    }
8221
8222    impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8223        fn from(value: &str) -> Self {
8224            use std::string::ToString;
8225            match value {
8226                "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8227                "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8228                "AES_128_GCM" => Self::Aes128Gcm,
8229                "AES_256_GCM" => Self::Aes256Gcm,
8230                "AES_128_CBC" => Self::Aes128Cbc,
8231                "AES_256_CBC" => Self::Aes256Cbc,
8232                "AES_128_CTR" => Self::Aes128Ctr,
8233                "AES_256_CTR" => Self::Aes256Ctr,
8234                "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8235                "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8236                "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8237                "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8238                "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8239                "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8240                "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8241                "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8242                "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8243                "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8244                "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8245                "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8246                "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8247                "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8248                "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8249                "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8250                "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8251                "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8252                "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8253                "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8254                "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8255                "EC_SIGN_ED25519" => Self::EcSignEd25519,
8256                "HMAC_SHA256" => Self::HmacSha256,
8257                "HMAC_SHA1" => Self::HmacSha1,
8258                "HMAC_SHA384" => Self::HmacSha384,
8259                "HMAC_SHA512" => Self::HmacSha512,
8260                "HMAC_SHA224" => Self::HmacSha224,
8261                "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8262                "ML_KEM_768" => Self::MlKem768,
8263                "ML_KEM_1024" => Self::MlKem1024,
8264                "KEM_XWING" => Self::KemXwing,
8265                "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8266                "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8267                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8268                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8269                )),
8270            }
8271        }
8272    }
8273
8274    impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8275        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8276        where
8277            S: serde::Serializer,
8278        {
8279            match self {
8280                Self::Unspecified => serializer.serialize_i32(0),
8281                Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8282                Self::Aes128Gcm => serializer.serialize_i32(41),
8283                Self::Aes256Gcm => serializer.serialize_i32(19),
8284                Self::Aes128Cbc => serializer.serialize_i32(42),
8285                Self::Aes256Cbc => serializer.serialize_i32(43),
8286                Self::Aes128Ctr => serializer.serialize_i32(44),
8287                Self::Aes256Ctr => serializer.serialize_i32(45),
8288                Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8289                Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8290                Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8291                Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8292                Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8293                Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8294                Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8295                Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8296                Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8297                Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8298                Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8299                Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8300                Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8301                Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8302                Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8303                Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8304                Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8305                Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8306                Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8307                Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8308                Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8309                Self::EcSignEd25519 => serializer.serialize_i32(40),
8310                Self::HmacSha256 => serializer.serialize_i32(32),
8311                Self::HmacSha1 => serializer.serialize_i32(33),
8312                Self::HmacSha384 => serializer.serialize_i32(34),
8313                Self::HmacSha512 => serializer.serialize_i32(35),
8314                Self::HmacSha224 => serializer.serialize_i32(36),
8315                Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8316                Self::MlKem768 => serializer.serialize_i32(47),
8317                Self::MlKem1024 => serializer.serialize_i32(48),
8318                Self::KemXwing => serializer.serialize_i32(63),
8319                Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8320                Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8321                Self::UnknownValue(u) => u.0.serialize(serializer),
8322            }
8323        }
8324    }
8325
8326    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8327        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8328        where
8329            D: serde::Deserializer<'de>,
8330        {
8331            deserializer.deserialize_any(
8332                wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8333                    ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8334                ),
8335            )
8336        }
8337    }
8338
8339    /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8340    /// indicating if it can be used.
8341    ///
8342    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8343    ///
8344    /// # Working with unknown values
8345    ///
8346    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8347    /// additional enum variants at any time. Adding new variants is not considered
8348    /// a breaking change. Applications should write their code in anticipation of:
8349    ///
8350    /// - New values appearing in future releases of the client library, **and**
8351    /// - New values received dynamically, without application changes.
8352    ///
8353    /// Please consult the [Working with enums] section in the user guide for some
8354    /// guidelines.
8355    ///
8356    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8357    #[derive(Clone, Debug, PartialEq)]
8358    #[non_exhaustive]
8359    pub enum CryptoKeyVersionState {
8360        /// Not specified.
8361        Unspecified,
8362        /// This version is still being generated. It may not be used, enabled,
8363        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8364        /// version
8365        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8366        /// as soon as the version is ready.
8367        ///
8368        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8369        PendingGeneration,
8370        /// This version may be used for cryptographic operations.
8371        Enabled,
8372        /// This version may not be used, but the key material is still available,
8373        /// and the version can be placed back into the
8374        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8375        /// state.
8376        ///
8377        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8378        Disabled,
8379        /// The key material of this version is destroyed and no longer stored.
8380        /// This version may only become
8381        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8382        /// again if this version is
8383        /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8384        /// and the original key material is reimported with a call to
8385        /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8386        ///
8387        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8388        /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
8389        /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8390        Destroyed,
8391        /// This version is scheduled for destruction, and will be destroyed soon.
8392        /// Call
8393        /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
8394        /// to put it back into the
8395        /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
8396        /// state.
8397        ///
8398        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
8399        /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8400        DestroyScheduled,
8401        /// This version is still being imported. It may not be used, enabled,
8402        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8403        /// version
8404        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8405        /// as soon as the version is ready.
8406        ///
8407        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8408        PendingImport,
8409        /// This version was not imported successfully. It may not be used, enabled,
8410        /// disabled, or destroyed. The submitted key material has been discarded.
8411        /// Additional details can be found in
8412        /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
8413        ///
8414        /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
8415        ImportFailed,
8416        /// This version was not generated successfully. It may not be used, enabled,
8417        /// disabled, or destroyed. Additional details can be found in
8418        /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
8419        ///
8420        /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
8421        GenerationFailed,
8422        /// This version was destroyed, and it may not be used or enabled again.
8423        /// Cloud KMS is waiting for the corresponding key material residing in an
8424        /// external key manager to be destroyed.
8425        PendingExternalDestruction,
8426        /// This version was destroyed, and it may not be used or enabled again.
8427        /// However, Cloud KMS could not confirm that the corresponding key material
8428        /// residing in an external key manager was destroyed. Additional details can
8429        /// be found in
8430        /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
8431        ///
8432        /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
8433        ExternalDestructionFailed,
8434        /// If set, the enum was initialized with an unknown value.
8435        ///
8436        /// Applications can examine the value using [CryptoKeyVersionState::value] or
8437        /// [CryptoKeyVersionState::name].
8438        UnknownValue(crypto_key_version_state::UnknownValue),
8439    }
8440
8441    #[doc(hidden)]
8442    pub mod crypto_key_version_state {
8443        #[allow(unused_imports)]
8444        use super::*;
8445        #[derive(Clone, Debug, PartialEq)]
8446        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8447    }
8448
8449    impl CryptoKeyVersionState {
8450        /// Gets the enum value.
8451        ///
8452        /// Returns `None` if the enum contains an unknown value deserialized from
8453        /// the string representation of enums.
8454        pub fn value(&self) -> std::option::Option<i32> {
8455            match self {
8456                Self::Unspecified => std::option::Option::Some(0),
8457                Self::PendingGeneration => std::option::Option::Some(5),
8458                Self::Enabled => std::option::Option::Some(1),
8459                Self::Disabled => std::option::Option::Some(2),
8460                Self::Destroyed => std::option::Option::Some(3),
8461                Self::DestroyScheduled => std::option::Option::Some(4),
8462                Self::PendingImport => std::option::Option::Some(6),
8463                Self::ImportFailed => std::option::Option::Some(7),
8464                Self::GenerationFailed => std::option::Option::Some(8),
8465                Self::PendingExternalDestruction => std::option::Option::Some(9),
8466                Self::ExternalDestructionFailed => std::option::Option::Some(10),
8467                Self::UnknownValue(u) => u.0.value(),
8468            }
8469        }
8470
8471        /// Gets the enum value as a string.
8472        ///
8473        /// Returns `None` if the enum contains an unknown value deserialized from
8474        /// the integer representation of enums.
8475        pub fn name(&self) -> std::option::Option<&str> {
8476            match self {
8477                Self::Unspecified => {
8478                    std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
8479                }
8480                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
8481                Self::Enabled => std::option::Option::Some("ENABLED"),
8482                Self::Disabled => std::option::Option::Some("DISABLED"),
8483                Self::Destroyed => std::option::Option::Some("DESTROYED"),
8484                Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
8485                Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
8486                Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
8487                Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
8488                Self::PendingExternalDestruction => {
8489                    std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
8490                }
8491                Self::ExternalDestructionFailed => {
8492                    std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
8493                }
8494                Self::UnknownValue(u) => u.0.name(),
8495            }
8496        }
8497    }
8498
8499    impl std::default::Default for CryptoKeyVersionState {
8500        fn default() -> Self {
8501            use std::convert::From;
8502            Self::from(0)
8503        }
8504    }
8505
8506    impl std::fmt::Display for CryptoKeyVersionState {
8507        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8508            wkt::internal::display_enum(f, self.name(), self.value())
8509        }
8510    }
8511
8512    impl std::convert::From<i32> for CryptoKeyVersionState {
8513        fn from(value: i32) -> Self {
8514            match value {
8515                0 => Self::Unspecified,
8516                1 => Self::Enabled,
8517                2 => Self::Disabled,
8518                3 => Self::Destroyed,
8519                4 => Self::DestroyScheduled,
8520                5 => Self::PendingGeneration,
8521                6 => Self::PendingImport,
8522                7 => Self::ImportFailed,
8523                8 => Self::GenerationFailed,
8524                9 => Self::PendingExternalDestruction,
8525                10 => Self::ExternalDestructionFailed,
8526                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8527                    wkt::internal::UnknownEnumValue::Integer(value),
8528                )),
8529            }
8530        }
8531    }
8532
8533    impl std::convert::From<&str> for CryptoKeyVersionState {
8534        fn from(value: &str) -> Self {
8535            use std::string::ToString;
8536            match value {
8537                "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
8538                "PENDING_GENERATION" => Self::PendingGeneration,
8539                "ENABLED" => Self::Enabled,
8540                "DISABLED" => Self::Disabled,
8541                "DESTROYED" => Self::Destroyed,
8542                "DESTROY_SCHEDULED" => Self::DestroyScheduled,
8543                "PENDING_IMPORT" => Self::PendingImport,
8544                "IMPORT_FAILED" => Self::ImportFailed,
8545                "GENERATION_FAILED" => Self::GenerationFailed,
8546                "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
8547                "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
8548                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8549                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8550                )),
8551            }
8552        }
8553    }
8554
8555    impl serde::ser::Serialize for CryptoKeyVersionState {
8556        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8557        where
8558            S: serde::Serializer,
8559        {
8560            match self {
8561                Self::Unspecified => serializer.serialize_i32(0),
8562                Self::PendingGeneration => serializer.serialize_i32(5),
8563                Self::Enabled => serializer.serialize_i32(1),
8564                Self::Disabled => serializer.serialize_i32(2),
8565                Self::Destroyed => serializer.serialize_i32(3),
8566                Self::DestroyScheduled => serializer.serialize_i32(4),
8567                Self::PendingImport => serializer.serialize_i32(6),
8568                Self::ImportFailed => serializer.serialize_i32(7),
8569                Self::GenerationFailed => serializer.serialize_i32(8),
8570                Self::PendingExternalDestruction => serializer.serialize_i32(9),
8571                Self::ExternalDestructionFailed => serializer.serialize_i32(10),
8572                Self::UnknownValue(u) => u.0.serialize(serializer),
8573            }
8574        }
8575    }
8576
8577    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
8578        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8579        where
8580            D: serde::Deserializer<'de>,
8581        {
8582            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
8583                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
8584            ))
8585        }
8586    }
8587
8588    /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
8589    /// Controls the level of detail returned for
8590    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
8591    /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
8592    /// and
8593    /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
8594    ///
8595    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8596    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
8597    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
8598    ///
8599    /// # Working with unknown values
8600    ///
8601    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8602    /// additional enum variants at any time. Adding new variants is not considered
8603    /// a breaking change. Applications should write their code in anticipation of:
8604    ///
8605    /// - New values appearing in future releases of the client library, **and**
8606    /// - New values received dynamically, without application changes.
8607    ///
8608    /// Please consult the [Working with enums] section in the user guide for some
8609    /// guidelines.
8610    ///
8611    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8612    #[derive(Clone, Debug, PartialEq)]
8613    #[non_exhaustive]
8614    pub enum CryptoKeyVersionView {
8615        /// Default view for each
8616        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
8617        /// include the
8618        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
8619        ///
8620        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8621        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8622        Unspecified,
8623        /// Provides all fields in each
8624        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
8625        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
8626        ///
8627        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8628        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8629        Full,
8630        /// If set, the enum was initialized with an unknown value.
8631        ///
8632        /// Applications can examine the value using [CryptoKeyVersionView::value] or
8633        /// [CryptoKeyVersionView::name].
8634        UnknownValue(crypto_key_version_view::UnknownValue),
8635    }
8636
8637    #[doc(hidden)]
8638    pub mod crypto_key_version_view {
8639        #[allow(unused_imports)]
8640        use super::*;
8641        #[derive(Clone, Debug, PartialEq)]
8642        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8643    }
8644
8645    impl CryptoKeyVersionView {
8646        /// Gets the enum value.
8647        ///
8648        /// Returns `None` if the enum contains an unknown value deserialized from
8649        /// the string representation of enums.
8650        pub fn value(&self) -> std::option::Option<i32> {
8651            match self {
8652                Self::Unspecified => std::option::Option::Some(0),
8653                Self::Full => std::option::Option::Some(1),
8654                Self::UnknownValue(u) => u.0.value(),
8655            }
8656        }
8657
8658        /// Gets the enum value as a string.
8659        ///
8660        /// Returns `None` if the enum contains an unknown value deserialized from
8661        /// the integer representation of enums.
8662        pub fn name(&self) -> std::option::Option<&str> {
8663            match self {
8664                Self::Unspecified => {
8665                    std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
8666                }
8667                Self::Full => std::option::Option::Some("FULL"),
8668                Self::UnknownValue(u) => u.0.name(),
8669            }
8670        }
8671    }
8672
8673    impl std::default::Default for CryptoKeyVersionView {
8674        fn default() -> Self {
8675            use std::convert::From;
8676            Self::from(0)
8677        }
8678    }
8679
8680    impl std::fmt::Display for CryptoKeyVersionView {
8681        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8682            wkt::internal::display_enum(f, self.name(), self.value())
8683        }
8684    }
8685
8686    impl std::convert::From<i32> for CryptoKeyVersionView {
8687        fn from(value: i32) -> Self {
8688            match value {
8689                0 => Self::Unspecified,
8690                1 => Self::Full,
8691                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8692                    wkt::internal::UnknownEnumValue::Integer(value),
8693                )),
8694            }
8695        }
8696    }
8697
8698    impl std::convert::From<&str> for CryptoKeyVersionView {
8699        fn from(value: &str) -> Self {
8700            use std::string::ToString;
8701            match value {
8702                "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
8703                "FULL" => Self::Full,
8704                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8705                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8706                )),
8707            }
8708        }
8709    }
8710
8711    impl serde::ser::Serialize for CryptoKeyVersionView {
8712        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8713        where
8714            S: serde::Serializer,
8715        {
8716            match self {
8717                Self::Unspecified => serializer.serialize_i32(0),
8718                Self::Full => serializer.serialize_i32(1),
8719                Self::UnknownValue(u) => u.0.serialize(serializer),
8720            }
8721        }
8722    }
8723
8724    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
8725        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8726        where
8727            D: serde::Deserializer<'de>,
8728        {
8729            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
8730                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
8731            ))
8732        }
8733    }
8734}
8735
8736/// Data with integrity verification field.
8737#[derive(Clone, Default, PartialEq)]
8738#[non_exhaustive]
8739pub struct ChecksummedData {
8740    /// Raw Data.
8741    pub data: ::bytes::Bytes,
8742
8743    /// Integrity verification field. A CRC32C
8744    /// checksum of the returned
8745    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
8746    /// integrity check of
8747    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
8748    /// performed by computing the CRC32C checksum of
8749    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
8750    /// comparing your results to this field. Discard the response in case of
8751    /// non-matching checksum values, and perform a limited number of retries. A
8752    /// persistent mismatch may indicate an issue in your computation of the CRC32C
8753    /// checksum. Note: This field is defined as int64 for reasons of compatibility
8754    /// across different languages. However, it is a non-negative integer, which
8755    /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
8756    /// languages that support this type.
8757    ///
8758    /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
8759    pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
8760
8761    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8762}
8763
8764impl ChecksummedData {
8765    pub fn new() -> Self {
8766        std::default::Default::default()
8767    }
8768
8769    /// Sets the value of [data][crate::model::ChecksummedData::data].
8770    ///
8771    /// # Example
8772    /// ```ignore,no_run
8773    /// # use google_cloud_kms_v1::model::ChecksummedData;
8774    /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
8775    /// ```
8776    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8777        self.data = v.into();
8778        self
8779    }
8780
8781    /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
8782    ///
8783    /// # Example
8784    /// ```ignore,no_run
8785    /// # use google_cloud_kms_v1::model::ChecksummedData;
8786    /// use wkt::Int64Value;
8787    /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
8788    /// ```
8789    pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
8790    where
8791        T: std::convert::Into<wkt::Int64Value>,
8792    {
8793        self.crc32c_checksum = std::option::Option::Some(v.into());
8794        self
8795    }
8796
8797    /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
8798    ///
8799    /// # Example
8800    /// ```ignore,no_run
8801    /// # use google_cloud_kms_v1::model::ChecksummedData;
8802    /// use wkt::Int64Value;
8803    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
8804    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
8805    /// ```
8806    pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
8807    where
8808        T: std::convert::Into<wkt::Int64Value>,
8809    {
8810        self.crc32c_checksum = v.map(|x| x.into());
8811        self
8812    }
8813}
8814
8815impl wkt::message::Message for ChecksummedData {
8816    fn typename() -> &'static str {
8817        "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
8818    }
8819}
8820
8821/// The public keys for a given
8822/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
8823/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
8824///
8825/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8826/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
8827#[derive(Clone, Default, PartialEq)]
8828#[non_exhaustive]
8829pub struct PublicKey {
8830    /// The public key, encoded in PEM format. For more information, see the
8831    /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
8832    /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
8833    /// [Textual Encoding of Subject Public Key Info]
8834    /// (<https://tools.ietf.org/html/rfc7468#section-13>).
8835    pub pem: std::string::String,
8836
8837    /// The
8838    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
8839    /// associated with this key.
8840    ///
8841    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
8842    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
8843
8844    /// Integrity verification field. A CRC32C checksum of the returned
8845    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
8846    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
8847    /// computing the CRC32C checksum of
8848    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
8849    /// results to this field. Discard the response in case of non-matching
8850    /// checksum values, and perform a limited number of retries. A persistent
8851    /// mismatch may indicate an issue in your computation of the CRC32C checksum.
8852    /// Note: This field is defined as int64 for reasons of compatibility across
8853    /// different languages. However, it is a non-negative integer, which will
8854    /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
8855    /// languages that support this type.
8856    ///
8857    /// NOTE: This field is in Beta.
8858    ///
8859    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
8860    pub pem_crc32c: std::option::Option<wkt::Int64Value>,
8861
8862    /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
8863    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
8864    /// Provided here for verification.
8865    ///
8866    /// NOTE: This field is in Beta.
8867    ///
8868    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8869    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
8870    pub name: std::string::String,
8871
8872    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
8873    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
8874    ///
8875    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8876    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
8877    pub protection_level: crate::model::ProtectionLevel,
8878
8879    /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
8880    /// customer through the
8881    /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
8882    /// field.
8883    ///
8884    /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
8885    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
8886    pub public_key_format: crate::model::public_key::PublicKeyFormat,
8887
8888    /// This field contains the public key (with integrity verification), formatted
8889    /// according to the
8890    /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
8891    ///
8892    /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
8893    pub public_key: std::option::Option<crate::model::ChecksummedData>,
8894
8895    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8896}
8897
8898impl PublicKey {
8899    pub fn new() -> Self {
8900        std::default::Default::default()
8901    }
8902
8903    /// Sets the value of [pem][crate::model::PublicKey::pem].
8904    ///
8905    /// # Example
8906    /// ```ignore,no_run
8907    /// # use google_cloud_kms_v1::model::PublicKey;
8908    /// let x = PublicKey::new().set_pem("example");
8909    /// ```
8910    pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8911        self.pem = v.into();
8912        self
8913    }
8914
8915    /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
8916    ///
8917    /// # Example
8918    /// ```ignore,no_run
8919    /// # use google_cloud_kms_v1::model::PublicKey;
8920    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
8921    /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
8922    /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
8923    /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
8924    /// ```
8925    pub fn set_algorithm<
8926        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
8927    >(
8928        mut self,
8929        v: T,
8930    ) -> Self {
8931        self.algorithm = v.into();
8932        self
8933    }
8934
8935    /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
8936    ///
8937    /// # Example
8938    /// ```ignore,no_run
8939    /// # use google_cloud_kms_v1::model::PublicKey;
8940    /// use wkt::Int64Value;
8941    /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
8942    /// ```
8943    pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
8944    where
8945        T: std::convert::Into<wkt::Int64Value>,
8946    {
8947        self.pem_crc32c = std::option::Option::Some(v.into());
8948        self
8949    }
8950
8951    /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
8952    ///
8953    /// # Example
8954    /// ```ignore,no_run
8955    /// # use google_cloud_kms_v1::model::PublicKey;
8956    /// use wkt::Int64Value;
8957    /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
8958    /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
8959    /// ```
8960    pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8961    where
8962        T: std::convert::Into<wkt::Int64Value>,
8963    {
8964        self.pem_crc32c = v.map(|x| x.into());
8965        self
8966    }
8967
8968    /// Sets the value of [name][crate::model::PublicKey::name].
8969    ///
8970    /// # Example
8971    /// ```ignore,no_run
8972    /// # use google_cloud_kms_v1::model::PublicKey;
8973    /// let x = PublicKey::new().set_name("example");
8974    /// ```
8975    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8976        self.name = v.into();
8977        self
8978    }
8979
8980    /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
8981    ///
8982    /// # Example
8983    /// ```ignore,no_run
8984    /// # use google_cloud_kms_v1::model::PublicKey;
8985    /// use google_cloud_kms_v1::model::ProtectionLevel;
8986    /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
8987    /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
8988    /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
8989    /// ```
8990    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
8991        mut self,
8992        v: T,
8993    ) -> Self {
8994        self.protection_level = v.into();
8995        self
8996    }
8997
8998    /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
8999    ///
9000    /// # Example
9001    /// ```ignore,no_run
9002    /// # use google_cloud_kms_v1::model::PublicKey;
9003    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9004    /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9005    /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9006    /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9007    /// ```
9008    pub fn set_public_key_format<
9009        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9010    >(
9011        mut self,
9012        v: T,
9013    ) -> Self {
9014        self.public_key_format = v.into();
9015        self
9016    }
9017
9018    /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9019    ///
9020    /// # Example
9021    /// ```ignore,no_run
9022    /// # use google_cloud_kms_v1::model::PublicKey;
9023    /// use google_cloud_kms_v1::model::ChecksummedData;
9024    /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9025    /// ```
9026    pub fn set_public_key<T>(mut self, v: T) -> Self
9027    where
9028        T: std::convert::Into<crate::model::ChecksummedData>,
9029    {
9030        self.public_key = std::option::Option::Some(v.into());
9031        self
9032    }
9033
9034    /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9035    ///
9036    /// # Example
9037    /// ```ignore,no_run
9038    /// # use google_cloud_kms_v1::model::PublicKey;
9039    /// use google_cloud_kms_v1::model::ChecksummedData;
9040    /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9041    /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9042    /// ```
9043    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9044    where
9045        T: std::convert::Into<crate::model::ChecksummedData>,
9046    {
9047        self.public_key = v.map(|x| x.into());
9048        self
9049    }
9050}
9051
9052impl wkt::message::Message for PublicKey {
9053    fn typename() -> &'static str {
9054        "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9055    }
9056}
9057
9058/// Defines additional types related to [PublicKey].
9059pub mod public_key {
9060    #[allow(unused_imports)]
9061    use super::*;
9062
9063    /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9064    ///
9065    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9066    ///
9067    /// # Working with unknown values
9068    ///
9069    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9070    /// additional enum variants at any time. Adding new variants is not considered
9071    /// a breaking change. Applications should write their code in anticipation of:
9072    ///
9073    /// - New values appearing in future releases of the client library, **and**
9074    /// - New values received dynamically, without application changes.
9075    ///
9076    /// Please consult the [Working with enums] section in the user guide for some
9077    /// guidelines.
9078    ///
9079    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9080    #[derive(Clone, Debug, PartialEq)]
9081    #[non_exhaustive]
9082    pub enum PublicKeyFormat {
9083        /// If the
9084        /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9085        /// field is not specified:
9086        ///
9087        /// - For PQC algorithms, an error will be returned.
9088        /// - For non-PQC algorithms, the default format is PEM, and the field
9089        ///   [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9090        ///
9091        /// Otherwise, the public key will be exported through the
9092        /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9093        /// requested format.
9094        ///
9095        /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9096        /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9097        /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9098        Unspecified,
9099        /// The returned public key will be encoded in PEM format.
9100        /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9101        /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9102        /// and [Textual Encoding of Subject Public Key Info]
9103        /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9104        Pem,
9105        /// The returned public key will be encoded in DER format (the
9106        /// PrivateKeyInfo structure from RFC 5208).
9107        Der,
9108        /// This is supported only for PQC algorithms.
9109        /// The key material is returned in the format defined by NIST PQC
9110        /// standards (FIPS 203, FIPS 204, and FIPS 205).
9111        NistPqc,
9112        /// The returned public key is in raw bytes format defined in its standard
9113        /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9114        XwingRawBytes,
9115        /// If set, the enum was initialized with an unknown value.
9116        ///
9117        /// Applications can examine the value using [PublicKeyFormat::value] or
9118        /// [PublicKeyFormat::name].
9119        UnknownValue(public_key_format::UnknownValue),
9120    }
9121
9122    #[doc(hidden)]
9123    pub mod public_key_format {
9124        #[allow(unused_imports)]
9125        use super::*;
9126        #[derive(Clone, Debug, PartialEq)]
9127        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9128    }
9129
9130    impl PublicKeyFormat {
9131        /// Gets the enum value.
9132        ///
9133        /// Returns `None` if the enum contains an unknown value deserialized from
9134        /// the string representation of enums.
9135        pub fn value(&self) -> std::option::Option<i32> {
9136            match self {
9137                Self::Unspecified => std::option::Option::Some(0),
9138                Self::Pem => std::option::Option::Some(1),
9139                Self::Der => std::option::Option::Some(2),
9140                Self::NistPqc => std::option::Option::Some(3),
9141                Self::XwingRawBytes => std::option::Option::Some(4),
9142                Self::UnknownValue(u) => u.0.value(),
9143            }
9144        }
9145
9146        /// Gets the enum value as a string.
9147        ///
9148        /// Returns `None` if the enum contains an unknown value deserialized from
9149        /// the integer representation of enums.
9150        pub fn name(&self) -> std::option::Option<&str> {
9151            match self {
9152                Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9153                Self::Pem => std::option::Option::Some("PEM"),
9154                Self::Der => std::option::Option::Some("DER"),
9155                Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9156                Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9157                Self::UnknownValue(u) => u.0.name(),
9158            }
9159        }
9160    }
9161
9162    impl std::default::Default for PublicKeyFormat {
9163        fn default() -> Self {
9164            use std::convert::From;
9165            Self::from(0)
9166        }
9167    }
9168
9169    impl std::fmt::Display for PublicKeyFormat {
9170        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9171            wkt::internal::display_enum(f, self.name(), self.value())
9172        }
9173    }
9174
9175    impl std::convert::From<i32> for PublicKeyFormat {
9176        fn from(value: i32) -> Self {
9177            match value {
9178                0 => Self::Unspecified,
9179                1 => Self::Pem,
9180                2 => Self::Der,
9181                3 => Self::NistPqc,
9182                4 => Self::XwingRawBytes,
9183                _ => Self::UnknownValue(public_key_format::UnknownValue(
9184                    wkt::internal::UnknownEnumValue::Integer(value),
9185                )),
9186            }
9187        }
9188    }
9189
9190    impl std::convert::From<&str> for PublicKeyFormat {
9191        fn from(value: &str) -> Self {
9192            use std::string::ToString;
9193            match value {
9194                "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9195                "PEM" => Self::Pem,
9196                "DER" => Self::Der,
9197                "NIST_PQC" => Self::NistPqc,
9198                "XWING_RAW_BYTES" => Self::XwingRawBytes,
9199                _ => Self::UnknownValue(public_key_format::UnknownValue(
9200                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9201                )),
9202            }
9203        }
9204    }
9205
9206    impl serde::ser::Serialize for PublicKeyFormat {
9207        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9208        where
9209            S: serde::Serializer,
9210        {
9211            match self {
9212                Self::Unspecified => serializer.serialize_i32(0),
9213                Self::Pem => serializer.serialize_i32(1),
9214                Self::Der => serializer.serialize_i32(2),
9215                Self::NistPqc => serializer.serialize_i32(3),
9216                Self::XwingRawBytes => serializer.serialize_i32(4),
9217                Self::UnknownValue(u) => u.0.serialize(serializer),
9218            }
9219        }
9220    }
9221
9222    impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9223        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9224        where
9225            D: serde::Deserializer<'de>,
9226        {
9227            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9228                ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9229            ))
9230        }
9231    }
9232}
9233
9234/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9235/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9236/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9237/// key material, generated outside of Cloud KMS.
9238///
9239/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9240/// generate a "wrapping key", which is a public/private key pair. You use the
9241/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9242/// protect it during the import process. The nature of the wrapping key depends
9243/// on the choice of
9244/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9245/// wrapping key generation is complete, the
9246/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9247/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9248/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9249/// fetched public key can then be used to wrap your pre-existing key material.
9250///
9251/// Once the key material is wrapped, it can be imported into a new
9252/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9253/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9254/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9255/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9256/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9257/// uses the private key portion of the wrapping key to unwrap the key material.
9258/// Only Cloud KMS has access to the private key.
9259///
9260/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9261/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9262/// any key material that was wrapped with the
9263/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9264///
9265/// For more information, see
9266/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9267///
9268/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9269/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9270/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9271/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9272/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9273/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9274/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9275/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9276#[derive(Clone, Default, PartialEq)]
9277#[non_exhaustive]
9278pub struct ImportJob {
9279    /// Output only. The resource name for this
9280    /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9281    /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9282    ///
9283    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9284    pub name: std::string::String,
9285
9286    /// Required. Immutable. The wrapping method to be used for incoming key
9287    /// material.
9288    pub import_method: crate::model::import_job::ImportMethod,
9289
9290    /// Required. Immutable. The protection level of the
9291    /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9292    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9293    /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9294    /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9295    /// into.
9296    ///
9297    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9298    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9299    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9300    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9301    pub protection_level: crate::model::ProtectionLevel,
9302
9303    /// Output only. The time at which this
9304    /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9305    ///
9306    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9307    pub create_time: std::option::Option<wkt::Timestamp>,
9308
9309    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9310    /// material was generated.
9311    ///
9312    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9313    pub generate_time: std::option::Option<wkt::Timestamp>,
9314
9315    /// Output only. The time at which this
9316    /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9317    /// can no longer be used to import key material.
9318    ///
9319    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9320    pub expire_time: std::option::Option<wkt::Timestamp>,
9321
9322    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9323    /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9324    /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9325    ///
9326    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9327    /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9328    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9329    pub expire_event_time: std::option::Option<wkt::Timestamp>,
9330
9331    /// Output only. The current state of the
9332    /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9333    ///
9334    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9335    pub state: crate::model::import_job::ImportJobState,
9336
9337    /// Output only. The public key with which to wrap key material prior to
9338    /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9339    /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9340    ///
9341    /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9342    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9343    pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9344
9345    /// Output only. Statement that was generated and signed by the key creator
9346    /// (for example, an HSM) at key creation time. Use this statement to verify
9347    /// attributes of the key as stored on the HSM, independently of Google.
9348    /// Only present if the chosen
9349    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9350    /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9351    ///
9352    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9353    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9354    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9355
9356    /// Immutable. The resource name of the backend environment where the key
9357    /// material for the wrapping key resides and where all related cryptographic
9358    /// operations are performed. Currently, this field is only populated for keys
9359    /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9360    /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9361    /// in the future.
9362    /// Supported resources:
9363    ///
9364    /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9365    ///
9366    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9367    pub crypto_key_backend: std::string::String,
9368
9369    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9370}
9371
9372impl ImportJob {
9373    pub fn new() -> Self {
9374        std::default::Default::default()
9375    }
9376
9377    /// Sets the value of [name][crate::model::ImportJob::name].
9378    ///
9379    /// # Example
9380    /// ```ignore,no_run
9381    /// # use google_cloud_kms_v1::model::ImportJob;
9382    /// let x = ImportJob::new().set_name("example");
9383    /// ```
9384    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9385        self.name = v.into();
9386        self
9387    }
9388
9389    /// Sets the value of [import_method][crate::model::ImportJob::import_method].
9390    ///
9391    /// # Example
9392    /// ```ignore,no_run
9393    /// # use google_cloud_kms_v1::model::ImportJob;
9394    /// use google_cloud_kms_v1::model::import_job::ImportMethod;
9395    /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
9396    /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
9397    /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
9398    /// ```
9399    pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
9400        mut self,
9401        v: T,
9402    ) -> Self {
9403        self.import_method = v.into();
9404        self
9405    }
9406
9407    /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
9408    ///
9409    /// # Example
9410    /// ```ignore,no_run
9411    /// # use google_cloud_kms_v1::model::ImportJob;
9412    /// use google_cloud_kms_v1::model::ProtectionLevel;
9413    /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
9414    /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
9415    /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
9416    /// ```
9417    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9418        mut self,
9419        v: T,
9420    ) -> Self {
9421        self.protection_level = v.into();
9422        self
9423    }
9424
9425    /// Sets the value of [create_time][crate::model::ImportJob::create_time].
9426    ///
9427    /// # Example
9428    /// ```ignore,no_run
9429    /// # use google_cloud_kms_v1::model::ImportJob;
9430    /// use wkt::Timestamp;
9431    /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
9432    /// ```
9433    pub fn set_create_time<T>(mut self, v: T) -> Self
9434    where
9435        T: std::convert::Into<wkt::Timestamp>,
9436    {
9437        self.create_time = std::option::Option::Some(v.into());
9438        self
9439    }
9440
9441    /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
9442    ///
9443    /// # Example
9444    /// ```ignore,no_run
9445    /// # use google_cloud_kms_v1::model::ImportJob;
9446    /// use wkt::Timestamp;
9447    /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9448    /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
9449    /// ```
9450    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9451    where
9452        T: std::convert::Into<wkt::Timestamp>,
9453    {
9454        self.create_time = v.map(|x| x.into());
9455        self
9456    }
9457
9458    /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
9459    ///
9460    /// # Example
9461    /// ```ignore,no_run
9462    /// # use google_cloud_kms_v1::model::ImportJob;
9463    /// use wkt::Timestamp;
9464    /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
9465    /// ```
9466    pub fn set_generate_time<T>(mut self, v: T) -> Self
9467    where
9468        T: std::convert::Into<wkt::Timestamp>,
9469    {
9470        self.generate_time = std::option::Option::Some(v.into());
9471        self
9472    }
9473
9474    /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
9475    ///
9476    /// # Example
9477    /// ```ignore,no_run
9478    /// # use google_cloud_kms_v1::model::ImportJob;
9479    /// use wkt::Timestamp;
9480    /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
9481    /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
9482    /// ```
9483    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
9484    where
9485        T: std::convert::Into<wkt::Timestamp>,
9486    {
9487        self.generate_time = v.map(|x| x.into());
9488        self
9489    }
9490
9491    /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
9492    ///
9493    /// # Example
9494    /// ```ignore,no_run
9495    /// # use google_cloud_kms_v1::model::ImportJob;
9496    /// use wkt::Timestamp;
9497    /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
9498    /// ```
9499    pub fn set_expire_time<T>(mut self, v: T) -> Self
9500    where
9501        T: std::convert::Into<wkt::Timestamp>,
9502    {
9503        self.expire_time = std::option::Option::Some(v.into());
9504        self
9505    }
9506
9507    /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
9508    ///
9509    /// # Example
9510    /// ```ignore,no_run
9511    /// # use google_cloud_kms_v1::model::ImportJob;
9512    /// use wkt::Timestamp;
9513    /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9514    /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
9515    /// ```
9516    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9517    where
9518        T: std::convert::Into<wkt::Timestamp>,
9519    {
9520        self.expire_time = v.map(|x| x.into());
9521        self
9522    }
9523
9524    /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9525    ///
9526    /// # Example
9527    /// ```ignore,no_run
9528    /// # use google_cloud_kms_v1::model::ImportJob;
9529    /// use wkt::Timestamp;
9530    /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
9531    /// ```
9532    pub fn set_expire_event_time<T>(mut self, v: T) -> Self
9533    where
9534        T: std::convert::Into<wkt::Timestamp>,
9535    {
9536        self.expire_event_time = std::option::Option::Some(v.into());
9537        self
9538    }
9539
9540    /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9541    ///
9542    /// # Example
9543    /// ```ignore,no_run
9544    /// # use google_cloud_kms_v1::model::ImportJob;
9545    /// use wkt::Timestamp;
9546    /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
9547    /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
9548    /// ```
9549    pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
9550    where
9551        T: std::convert::Into<wkt::Timestamp>,
9552    {
9553        self.expire_event_time = v.map(|x| x.into());
9554        self
9555    }
9556
9557    /// Sets the value of [state][crate::model::ImportJob::state].
9558    ///
9559    /// # Example
9560    /// ```ignore,no_run
9561    /// # use google_cloud_kms_v1::model::ImportJob;
9562    /// use google_cloud_kms_v1::model::import_job::ImportJobState;
9563    /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
9564    /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
9565    /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
9566    /// ```
9567    pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
9568        mut self,
9569        v: T,
9570    ) -> Self {
9571        self.state = v.into();
9572        self
9573    }
9574
9575    /// Sets the value of [public_key][crate::model::ImportJob::public_key].
9576    ///
9577    /// # Example
9578    /// ```ignore,no_run
9579    /// # use google_cloud_kms_v1::model::ImportJob;
9580    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9581    /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
9582    /// ```
9583    pub fn set_public_key<T>(mut self, v: T) -> Self
9584    where
9585        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9586    {
9587        self.public_key = std::option::Option::Some(v.into());
9588        self
9589    }
9590
9591    /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
9592    ///
9593    /// # Example
9594    /// ```ignore,no_run
9595    /// # use google_cloud_kms_v1::model::ImportJob;
9596    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9597    /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
9598    /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
9599    /// ```
9600    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9601    where
9602        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9603    {
9604        self.public_key = v.map(|x| x.into());
9605        self
9606    }
9607
9608    /// Sets the value of [attestation][crate::model::ImportJob::attestation].
9609    ///
9610    /// # Example
9611    /// ```ignore,no_run
9612    /// # use google_cloud_kms_v1::model::ImportJob;
9613    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9614    /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
9615    /// ```
9616    pub fn set_attestation<T>(mut self, v: T) -> Self
9617    where
9618        T: std::convert::Into<crate::model::KeyOperationAttestation>,
9619    {
9620        self.attestation = std::option::Option::Some(v.into());
9621        self
9622    }
9623
9624    /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
9625    ///
9626    /// # Example
9627    /// ```ignore,no_run
9628    /// # use google_cloud_kms_v1::model::ImportJob;
9629    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9630    /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
9631    /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
9632    /// ```
9633    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
9634    where
9635        T: std::convert::Into<crate::model::KeyOperationAttestation>,
9636    {
9637        self.attestation = v.map(|x| x.into());
9638        self
9639    }
9640
9641    /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
9642    ///
9643    /// # Example
9644    /// ```ignore,no_run
9645    /// # use google_cloud_kms_v1::model::ImportJob;
9646    /// let x = ImportJob::new().set_crypto_key_backend("example");
9647    /// ```
9648    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
9649        mut self,
9650        v: T,
9651    ) -> Self {
9652        self.crypto_key_backend = v.into();
9653        self
9654    }
9655}
9656
9657impl wkt::message::Message for ImportJob {
9658    fn typename() -> &'static str {
9659        "type.googleapis.com/google.cloud.kms.v1.ImportJob"
9660    }
9661}
9662
9663/// Defines additional types related to [ImportJob].
9664pub mod import_job {
9665    #[allow(unused_imports)]
9666    use super::*;
9667
9668    /// The public key component of the wrapping key. For details of the type of
9669    /// key this public key corresponds to, see the
9670    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
9671    ///
9672    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9673    #[derive(Clone, Default, PartialEq)]
9674    #[non_exhaustive]
9675    pub struct WrappingPublicKey {
9676        /// The public key, encoded in PEM format. For more information, see the [RFC
9677        /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
9678        /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9679        /// [Textual Encoding of Subject Public Key Info]
9680        /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9681        pub pem: std::string::String,
9682
9683        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9684    }
9685
9686    impl WrappingPublicKey {
9687        pub fn new() -> Self {
9688            std::default::Default::default()
9689        }
9690
9691        /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
9692        ///
9693        /// # Example
9694        /// ```ignore,no_run
9695        /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9696        /// let x = WrappingPublicKey::new().set_pem("example");
9697        /// ```
9698        pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9699            self.pem = v.into();
9700            self
9701        }
9702    }
9703
9704    impl wkt::message::Message for WrappingPublicKey {
9705        fn typename() -> &'static str {
9706            "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
9707        }
9708    }
9709
9710    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
9711    /// key wrapping method chosen for this
9712    /// [ImportJob][google.cloud.kms.v1.ImportJob].
9713    ///
9714    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9715    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9716    ///
9717    /// # Working with unknown values
9718    ///
9719    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9720    /// additional enum variants at any time. Adding new variants is not considered
9721    /// a breaking change. Applications should write their code in anticipation of:
9722    ///
9723    /// - New values appearing in future releases of the client library, **and**
9724    /// - New values received dynamically, without application changes.
9725    ///
9726    /// Please consult the [Working with enums] section in the user guide for some
9727    /// guidelines.
9728    ///
9729    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9730    #[derive(Clone, Debug, PartialEq)]
9731    #[non_exhaustive]
9732    pub enum ImportMethod {
9733        /// Not specified.
9734        Unspecified,
9735        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9736        /// scheme defined in the PKCS #11 standard. In summary, this involves
9737        /// wrapping the raw key with an ephemeral AES key, and wrapping the
9738        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
9739        /// [RSA AES key wrap
9740        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9741        RsaOaep3072Sha1Aes256,
9742        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9743        /// scheme defined in the PKCS #11 standard. In summary, this involves
9744        /// wrapping the raw key with an ephemeral AES key, and wrapping the
9745        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
9746        /// [RSA AES key wrap
9747        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9748        RsaOaep4096Sha1Aes256,
9749        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9750        /// scheme defined in the PKCS #11 standard. In summary, this involves
9751        /// wrapping the raw key with an ephemeral AES key, and wrapping the
9752        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
9753        /// [RSA AES key wrap
9754        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9755        RsaOaep3072Sha256Aes256,
9756        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9757        /// scheme defined in the PKCS #11 standard. In summary, this involves
9758        /// wrapping the raw key with an ephemeral AES key, and wrapping the
9759        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
9760        /// [RSA AES key wrap
9761        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9762        RsaOaep4096Sha256Aes256,
9763        /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
9764        /// key material to be imported is wrapped directly with the RSA key. Due
9765        /// to technical limitations of RSA wrapping, this method cannot be used to
9766        /// wrap RSA keys for import.
9767        RsaOaep3072Sha256,
9768        /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
9769        /// key material to be imported is wrapped directly with the RSA key. Due
9770        /// to technical limitations of RSA wrapping, this method cannot be used to
9771        /// wrap RSA keys for import.
9772        RsaOaep4096Sha256,
9773        /// If set, the enum was initialized with an unknown value.
9774        ///
9775        /// Applications can examine the value using [ImportMethod::value] or
9776        /// [ImportMethod::name].
9777        UnknownValue(import_method::UnknownValue),
9778    }
9779
9780    #[doc(hidden)]
9781    pub mod import_method {
9782        #[allow(unused_imports)]
9783        use super::*;
9784        #[derive(Clone, Debug, PartialEq)]
9785        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9786    }
9787
9788    impl ImportMethod {
9789        /// Gets the enum value.
9790        ///
9791        /// Returns `None` if the enum contains an unknown value deserialized from
9792        /// the string representation of enums.
9793        pub fn value(&self) -> std::option::Option<i32> {
9794            match self {
9795                Self::Unspecified => std::option::Option::Some(0),
9796                Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
9797                Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
9798                Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
9799                Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
9800                Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
9801                Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
9802                Self::UnknownValue(u) => u.0.value(),
9803            }
9804        }
9805
9806        /// Gets the enum value as a string.
9807        ///
9808        /// Returns `None` if the enum contains an unknown value deserialized from
9809        /// the integer representation of enums.
9810        pub fn name(&self) -> std::option::Option<&str> {
9811            match self {
9812                Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
9813                Self::RsaOaep3072Sha1Aes256 => {
9814                    std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
9815                }
9816                Self::RsaOaep4096Sha1Aes256 => {
9817                    std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
9818                }
9819                Self::RsaOaep3072Sha256Aes256 => {
9820                    std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
9821                }
9822                Self::RsaOaep4096Sha256Aes256 => {
9823                    std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
9824                }
9825                Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
9826                Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
9827                Self::UnknownValue(u) => u.0.name(),
9828            }
9829        }
9830    }
9831
9832    impl std::default::Default for ImportMethod {
9833        fn default() -> Self {
9834            use std::convert::From;
9835            Self::from(0)
9836        }
9837    }
9838
9839    impl std::fmt::Display for ImportMethod {
9840        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9841            wkt::internal::display_enum(f, self.name(), self.value())
9842        }
9843    }
9844
9845    impl std::convert::From<i32> for ImportMethod {
9846        fn from(value: i32) -> Self {
9847            match value {
9848                0 => Self::Unspecified,
9849                1 => Self::RsaOaep3072Sha1Aes256,
9850                2 => Self::RsaOaep4096Sha1Aes256,
9851                3 => Self::RsaOaep3072Sha256Aes256,
9852                4 => Self::RsaOaep4096Sha256Aes256,
9853                5 => Self::RsaOaep3072Sha256,
9854                6 => Self::RsaOaep4096Sha256,
9855                _ => Self::UnknownValue(import_method::UnknownValue(
9856                    wkt::internal::UnknownEnumValue::Integer(value),
9857                )),
9858            }
9859        }
9860    }
9861
9862    impl std::convert::From<&str> for ImportMethod {
9863        fn from(value: &str) -> Self {
9864            use std::string::ToString;
9865            match value {
9866                "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
9867                "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
9868                "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
9869                "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
9870                "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
9871                "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
9872                "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
9873                _ => Self::UnknownValue(import_method::UnknownValue(
9874                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9875                )),
9876            }
9877        }
9878    }
9879
9880    impl serde::ser::Serialize for ImportMethod {
9881        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9882        where
9883            S: serde::Serializer,
9884        {
9885            match self {
9886                Self::Unspecified => serializer.serialize_i32(0),
9887                Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
9888                Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
9889                Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
9890                Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
9891                Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
9892                Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
9893                Self::UnknownValue(u) => u.0.serialize(serializer),
9894            }
9895        }
9896    }
9897
9898    impl<'de> serde::de::Deserialize<'de> for ImportMethod {
9899        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9900        where
9901            D: serde::Deserializer<'de>,
9902        {
9903            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
9904                ".google.cloud.kms.v1.ImportJob.ImportMethod",
9905            ))
9906        }
9907    }
9908
9909    /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
9910    /// it can be used.
9911    ///
9912    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9913    ///
9914    /// # Working with unknown values
9915    ///
9916    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9917    /// additional enum variants at any time. Adding new variants is not considered
9918    /// a breaking change. Applications should write their code in anticipation of:
9919    ///
9920    /// - New values appearing in future releases of the client library, **and**
9921    /// - New values received dynamically, without application changes.
9922    ///
9923    /// Please consult the [Working with enums] section in the user guide for some
9924    /// guidelines.
9925    ///
9926    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9927    #[derive(Clone, Debug, PartialEq)]
9928    #[non_exhaustive]
9929    pub enum ImportJobState {
9930        /// Not specified.
9931        Unspecified,
9932        /// The wrapping key for this job is still being generated. It may not be
9933        /// used. Cloud KMS will automatically mark this job as
9934        /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
9935        /// the wrapping key is generated.
9936        ///
9937        /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9938        PendingGeneration,
9939        /// This job may be used in
9940        /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
9941        /// and
9942        /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
9943        /// requests.
9944        ///
9945        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
9946        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
9947        Active,
9948        /// This job can no longer be used and may not leave this state once entered.
9949        Expired,
9950        /// If set, the enum was initialized with an unknown value.
9951        ///
9952        /// Applications can examine the value using [ImportJobState::value] or
9953        /// [ImportJobState::name].
9954        UnknownValue(import_job_state::UnknownValue),
9955    }
9956
9957    #[doc(hidden)]
9958    pub mod import_job_state {
9959        #[allow(unused_imports)]
9960        use super::*;
9961        #[derive(Clone, Debug, PartialEq)]
9962        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9963    }
9964
9965    impl ImportJobState {
9966        /// Gets the enum value.
9967        ///
9968        /// Returns `None` if the enum contains an unknown value deserialized from
9969        /// the string representation of enums.
9970        pub fn value(&self) -> std::option::Option<i32> {
9971            match self {
9972                Self::Unspecified => std::option::Option::Some(0),
9973                Self::PendingGeneration => std::option::Option::Some(1),
9974                Self::Active => std::option::Option::Some(2),
9975                Self::Expired => std::option::Option::Some(3),
9976                Self::UnknownValue(u) => u.0.value(),
9977            }
9978        }
9979
9980        /// Gets the enum value as a string.
9981        ///
9982        /// Returns `None` if the enum contains an unknown value deserialized from
9983        /// the integer representation of enums.
9984        pub fn name(&self) -> std::option::Option<&str> {
9985            match self {
9986                Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
9987                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
9988                Self::Active => std::option::Option::Some("ACTIVE"),
9989                Self::Expired => std::option::Option::Some("EXPIRED"),
9990                Self::UnknownValue(u) => u.0.name(),
9991            }
9992        }
9993    }
9994
9995    impl std::default::Default for ImportJobState {
9996        fn default() -> Self {
9997            use std::convert::From;
9998            Self::from(0)
9999        }
10000    }
10001
10002    impl std::fmt::Display for ImportJobState {
10003        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10004            wkt::internal::display_enum(f, self.name(), self.value())
10005        }
10006    }
10007
10008    impl std::convert::From<i32> for ImportJobState {
10009        fn from(value: i32) -> Self {
10010            match value {
10011                0 => Self::Unspecified,
10012                1 => Self::PendingGeneration,
10013                2 => Self::Active,
10014                3 => Self::Expired,
10015                _ => Self::UnknownValue(import_job_state::UnknownValue(
10016                    wkt::internal::UnknownEnumValue::Integer(value),
10017                )),
10018            }
10019        }
10020    }
10021
10022    impl std::convert::From<&str> for ImportJobState {
10023        fn from(value: &str) -> Self {
10024            use std::string::ToString;
10025            match value {
10026                "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10027                "PENDING_GENERATION" => Self::PendingGeneration,
10028                "ACTIVE" => Self::Active,
10029                "EXPIRED" => Self::Expired,
10030                _ => Self::UnknownValue(import_job_state::UnknownValue(
10031                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10032                )),
10033            }
10034        }
10035    }
10036
10037    impl serde::ser::Serialize for ImportJobState {
10038        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10039        where
10040            S: serde::Serializer,
10041        {
10042            match self {
10043                Self::Unspecified => serializer.serialize_i32(0),
10044                Self::PendingGeneration => serializer.serialize_i32(1),
10045                Self::Active => serializer.serialize_i32(2),
10046                Self::Expired => serializer.serialize_i32(3),
10047                Self::UnknownValue(u) => u.0.serialize(serializer),
10048            }
10049        }
10050    }
10051
10052    impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10053        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10054        where
10055            D: serde::Deserializer<'de>,
10056        {
10057            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10058                ".google.cloud.kms.v1.ImportJob.ImportJobState",
10059            ))
10060        }
10061    }
10062}
10063
10064/// ExternalProtectionLevelOptions stores a group of additional fields for
10065/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10066/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10067/// protection level and
10068/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10069/// levels.
10070///
10071/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10072/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10073/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10074#[derive(Clone, Default, PartialEq)]
10075#[non_exhaustive]
10076pub struct ExternalProtectionLevelOptions {
10077    /// The URI for an external resource that this
10078    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10079    ///
10080    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10081    pub external_key_uri: std::string::String,
10082
10083    /// The path to the external key material on the EKM when using
10084    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10085    /// this field instead of external_key_uri when using an
10086    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10087    ///
10088    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10089    pub ekm_connection_key_path: std::string::String,
10090
10091    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10092}
10093
10094impl ExternalProtectionLevelOptions {
10095    pub fn new() -> Self {
10096        std::default::Default::default()
10097    }
10098
10099    /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10100    ///
10101    /// # Example
10102    /// ```ignore,no_run
10103    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10104    /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10105    /// ```
10106    pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10107        mut self,
10108        v: T,
10109    ) -> Self {
10110        self.external_key_uri = v.into();
10111        self
10112    }
10113
10114    /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10115    ///
10116    /// # Example
10117    /// ```ignore,no_run
10118    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10119    /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10120    /// ```
10121    pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10122        mut self,
10123        v: T,
10124    ) -> Self {
10125        self.ekm_connection_key_path = v.into();
10126        self
10127    }
10128}
10129
10130impl wkt::message::Message for ExternalProtectionLevelOptions {
10131    fn typename() -> &'static str {
10132        "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10133    }
10134}
10135
10136/// A
10137/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10138/// specifies zero or more allowed
10139/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10140/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey].
10141///
10142/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10143/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10144/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10145#[derive(Clone, Default, PartialEq)]
10146#[non_exhaustive]
10147pub struct KeyAccessJustificationsPolicy {
10148    /// The list of allowed reasons for access to a
10149    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Zero allowed access reasons
10150    /// means all encrypt, decrypt, and sign operations for the
10151    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with this policy will
10152    /// fail.
10153    ///
10154    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10155    pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10156
10157    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10158}
10159
10160impl KeyAccessJustificationsPolicy {
10161    pub fn new() -> Self {
10162        std::default::Default::default()
10163    }
10164
10165    /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10166    ///
10167    /// # Example
10168    /// ```ignore,no_run
10169    /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10170    /// use google_cloud_kms_v1::model::AccessReason;
10171    /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10172    ///     AccessReason::CustomerInitiatedSupport,
10173    ///     AccessReason::GoogleInitiatedService,
10174    ///     AccessReason::ThirdPartyDataRequest,
10175    /// ]);
10176    /// ```
10177    pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10178    where
10179        T: std::iter::IntoIterator<Item = V>,
10180        V: std::convert::Into<crate::model::AccessReason>,
10181    {
10182        use std::iter::Iterator;
10183        self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10184        self
10185    }
10186}
10187
10188impl wkt::message::Message for KeyAccessJustificationsPolicy {
10189    fn typename() -> &'static str {
10190        "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10191    }
10192}
10193
10194/// Request message for
10195/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10196///
10197/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10198#[derive(Clone, Default, PartialEq)]
10199#[non_exhaustive]
10200pub struct ListKeyRingsRequest {
10201    /// Required. The resource name of the location associated with the
10202    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
10203    /// `projects/*/locations/*`.
10204    ///
10205    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10206    pub parent: std::string::String,
10207
10208    /// Optional. Optional limit on the number of
10209    /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
10210    /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
10211    /// including the
10212    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
10213    /// in a subsequent request.  If unspecified, the server will pick an
10214    /// appropriate default.
10215    ///
10216    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10217    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10218    pub page_size: i32,
10219
10220    /// Optional. Optional pagination token, returned earlier via
10221    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
10222    ///
10223    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10224    pub page_token: std::string::String,
10225
10226    /// Optional. Only include resources that match the filter in the response. For
10227    /// more information, see
10228    /// [Sorting and filtering list
10229    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10230    pub filter: std::string::String,
10231
10232    /// Optional. Specify how the results should be sorted. If not specified, the
10233    /// results will be sorted in the default order.  For more information, see
10234    /// [Sorting and filtering list
10235    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10236    pub order_by: std::string::String,
10237
10238    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10239}
10240
10241impl ListKeyRingsRequest {
10242    pub fn new() -> Self {
10243        std::default::Default::default()
10244    }
10245
10246    /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
10247    ///
10248    /// # Example
10249    /// ```ignore,no_run
10250    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10251    /// let x = ListKeyRingsRequest::new().set_parent("example");
10252    /// ```
10253    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10254        self.parent = v.into();
10255        self
10256    }
10257
10258    /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
10259    ///
10260    /// # Example
10261    /// ```ignore,no_run
10262    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10263    /// let x = ListKeyRingsRequest::new().set_page_size(42);
10264    /// ```
10265    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10266        self.page_size = v.into();
10267        self
10268    }
10269
10270    /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
10271    ///
10272    /// # Example
10273    /// ```ignore,no_run
10274    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10275    /// let x = ListKeyRingsRequest::new().set_page_token("example");
10276    /// ```
10277    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10278        self.page_token = v.into();
10279        self
10280    }
10281
10282    /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
10283    ///
10284    /// # Example
10285    /// ```ignore,no_run
10286    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10287    /// let x = ListKeyRingsRequest::new().set_filter("example");
10288    /// ```
10289    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10290        self.filter = v.into();
10291        self
10292    }
10293
10294    /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
10295    ///
10296    /// # Example
10297    /// ```ignore,no_run
10298    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10299    /// let x = ListKeyRingsRequest::new().set_order_by("example");
10300    /// ```
10301    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10302        self.order_by = v.into();
10303        self
10304    }
10305}
10306
10307impl wkt::message::Message for ListKeyRingsRequest {
10308    fn typename() -> &'static str {
10309        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
10310    }
10311}
10312
10313/// Request message for
10314/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10315///
10316/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10317#[derive(Clone, Default, PartialEq)]
10318#[non_exhaustive]
10319pub struct ListCryptoKeysRequest {
10320    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10321    /// to list, in the format `projects/*/locations/*/keyRings/*`.
10322    ///
10323    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10324    pub parent: std::string::String,
10325
10326    /// Optional. Optional limit on the number of
10327    /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
10328    /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
10329    /// obtained by including the
10330    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
10331    /// in a subsequent request.  If unspecified, the server will pick an
10332    /// appropriate default.
10333    ///
10334    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10335    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10336    pub page_size: i32,
10337
10338    /// Optional. Optional pagination token, returned earlier via
10339    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
10340    ///
10341    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10342    pub page_token: std::string::String,
10343
10344    /// The fields of the primary version to include in the response.
10345    pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
10346
10347    /// Optional. Only include resources that match the filter in the response. For
10348    /// more information, see
10349    /// [Sorting and filtering list
10350    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10351    pub filter: std::string::String,
10352
10353    /// Optional. Specify how the results should be sorted. If not specified, the
10354    /// results will be sorted in the default order. For more information, see
10355    /// [Sorting and filtering list
10356    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10357    pub order_by: std::string::String,
10358
10359    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10360}
10361
10362impl ListCryptoKeysRequest {
10363    pub fn new() -> Self {
10364        std::default::Default::default()
10365    }
10366
10367    /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
10368    ///
10369    /// # Example
10370    /// ```ignore,no_run
10371    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10372    /// let x = ListCryptoKeysRequest::new().set_parent("example");
10373    /// ```
10374    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10375        self.parent = v.into();
10376        self
10377    }
10378
10379    /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
10380    ///
10381    /// # Example
10382    /// ```ignore,no_run
10383    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10384    /// let x = ListCryptoKeysRequest::new().set_page_size(42);
10385    /// ```
10386    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10387        self.page_size = v.into();
10388        self
10389    }
10390
10391    /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
10392    ///
10393    /// # Example
10394    /// ```ignore,no_run
10395    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10396    /// let x = ListCryptoKeysRequest::new().set_page_token("example");
10397    /// ```
10398    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10399        self.page_token = v.into();
10400        self
10401    }
10402
10403    /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
10404    ///
10405    /// # Example
10406    /// ```ignore,no_run
10407    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10408    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10409    /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
10410    /// ```
10411    pub fn set_version_view<
10412        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10413    >(
10414        mut self,
10415        v: T,
10416    ) -> Self {
10417        self.version_view = v.into();
10418        self
10419    }
10420
10421    /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
10422    ///
10423    /// # Example
10424    /// ```ignore,no_run
10425    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10426    /// let x = ListCryptoKeysRequest::new().set_filter("example");
10427    /// ```
10428    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10429        self.filter = v.into();
10430        self
10431    }
10432
10433    /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
10434    ///
10435    /// # Example
10436    /// ```ignore,no_run
10437    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10438    /// let x = ListCryptoKeysRequest::new().set_order_by("example");
10439    /// ```
10440    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10441        self.order_by = v.into();
10442        self
10443    }
10444}
10445
10446impl wkt::message::Message for ListCryptoKeysRequest {
10447    fn typename() -> &'static str {
10448        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
10449    }
10450}
10451
10452/// Request message for
10453/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
10454///
10455/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
10456#[derive(Clone, Default, PartialEq)]
10457#[non_exhaustive]
10458pub struct ListCryptoKeyVersionsRequest {
10459    /// Required. The resource name of the
10460    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
10461    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10462    ///
10463    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10464    pub parent: std::string::String,
10465
10466    /// Optional. Optional limit on the number of
10467    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
10468    /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
10469    /// can subsequently be obtained by including the
10470    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
10471    /// in a subsequent request. If unspecified, the server will pick an
10472    /// appropriate default.
10473    ///
10474    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10475    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10476    pub page_size: i32,
10477
10478    /// Optional. Optional pagination token, returned earlier via
10479    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
10480    ///
10481    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10482    pub page_token: std::string::String,
10483
10484    /// The fields to include in the response.
10485    pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
10486
10487    /// Optional. Only include resources that match the filter in the response. For
10488    /// more information, see
10489    /// [Sorting and filtering list
10490    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10491    pub filter: std::string::String,
10492
10493    /// Optional. Specify how the results should be sorted. If not specified, the
10494    /// results will be sorted in the default order. For more information, see
10495    /// [Sorting and filtering list
10496    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10497    pub order_by: std::string::String,
10498
10499    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10500}
10501
10502impl ListCryptoKeyVersionsRequest {
10503    pub fn new() -> Self {
10504        std::default::Default::default()
10505    }
10506
10507    /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
10508    ///
10509    /// # Example
10510    /// ```ignore,no_run
10511    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10512    /// let x = ListCryptoKeyVersionsRequest::new().set_parent("example");
10513    /// ```
10514    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10515        self.parent = v.into();
10516        self
10517    }
10518
10519    /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
10520    ///
10521    /// # Example
10522    /// ```ignore,no_run
10523    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10524    /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
10525    /// ```
10526    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10527        self.page_size = v.into();
10528        self
10529    }
10530
10531    /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
10532    ///
10533    /// # Example
10534    /// ```ignore,no_run
10535    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10536    /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
10537    /// ```
10538    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10539        self.page_token = v.into();
10540        self
10541    }
10542
10543    /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
10544    ///
10545    /// # Example
10546    /// ```ignore,no_run
10547    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10548    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10549    /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
10550    /// ```
10551    pub fn set_view<
10552        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10553    >(
10554        mut self,
10555        v: T,
10556    ) -> Self {
10557        self.view = v.into();
10558        self
10559    }
10560
10561    /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
10562    ///
10563    /// # Example
10564    /// ```ignore,no_run
10565    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10566    /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
10567    /// ```
10568    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10569        self.filter = v.into();
10570        self
10571    }
10572
10573    /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
10574    ///
10575    /// # Example
10576    /// ```ignore,no_run
10577    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10578    /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
10579    /// ```
10580    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10581        self.order_by = v.into();
10582        self
10583    }
10584}
10585
10586impl wkt::message::Message for ListCryptoKeyVersionsRequest {
10587    fn typename() -> &'static str {
10588        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
10589    }
10590}
10591
10592/// Request message for
10593/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
10594///
10595/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
10596#[derive(Clone, Default, PartialEq)]
10597#[non_exhaustive]
10598pub struct ListImportJobsRequest {
10599    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10600    /// to list, in the format `projects/*/locations/*/keyRings/*`.
10601    ///
10602    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10603    pub parent: std::string::String,
10604
10605    /// Optional. Optional limit on the number of
10606    /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
10607    /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
10608    /// obtained by including the
10609    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
10610    /// in a subsequent request. If unspecified, the server will pick an
10611    /// appropriate default.
10612    ///
10613    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10614    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10615    pub page_size: i32,
10616
10617    /// Optional. Optional pagination token, returned earlier via
10618    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
10619    ///
10620    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10621    pub page_token: std::string::String,
10622
10623    /// Optional. Only include resources that match the filter in the response. For
10624    /// more information, see
10625    /// [Sorting and filtering list
10626    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10627    pub filter: std::string::String,
10628
10629    /// Optional. Specify how the results should be sorted. If not specified, the
10630    /// results will be sorted in the default order. For more information, see
10631    /// [Sorting and filtering list
10632    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10633    pub order_by: std::string::String,
10634
10635    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10636}
10637
10638impl ListImportJobsRequest {
10639    pub fn new() -> Self {
10640        std::default::Default::default()
10641    }
10642
10643    /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
10644    ///
10645    /// # Example
10646    /// ```ignore,no_run
10647    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10648    /// let x = ListImportJobsRequest::new().set_parent("example");
10649    /// ```
10650    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10651        self.parent = v.into();
10652        self
10653    }
10654
10655    /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
10656    ///
10657    /// # Example
10658    /// ```ignore,no_run
10659    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10660    /// let x = ListImportJobsRequest::new().set_page_size(42);
10661    /// ```
10662    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10663        self.page_size = v.into();
10664        self
10665    }
10666
10667    /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
10668    ///
10669    /// # Example
10670    /// ```ignore,no_run
10671    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10672    /// let x = ListImportJobsRequest::new().set_page_token("example");
10673    /// ```
10674    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10675        self.page_token = v.into();
10676        self
10677    }
10678
10679    /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
10680    ///
10681    /// # Example
10682    /// ```ignore,no_run
10683    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10684    /// let x = ListImportJobsRequest::new().set_filter("example");
10685    /// ```
10686    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10687        self.filter = v.into();
10688        self
10689    }
10690
10691    /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
10692    ///
10693    /// # Example
10694    /// ```ignore,no_run
10695    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10696    /// let x = ListImportJobsRequest::new().set_order_by("example");
10697    /// ```
10698    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10699        self.order_by = v.into();
10700        self
10701    }
10702}
10703
10704impl wkt::message::Message for ListImportJobsRequest {
10705    fn typename() -> &'static str {
10706        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
10707    }
10708}
10709
10710/// Response message for
10711/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10712///
10713/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10714#[derive(Clone, Default, PartialEq)]
10715#[non_exhaustive]
10716pub struct ListKeyRingsResponse {
10717    /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
10718    ///
10719    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10720    pub key_rings: std::vec::Vec<crate::model::KeyRing>,
10721
10722    /// A token to retrieve next page of results. Pass this value in
10723    /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
10724    /// to retrieve the next page of results.
10725    ///
10726    /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
10727    pub next_page_token: std::string::String,
10728
10729    /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
10730    /// the query.
10731    ///
10732    /// This field is not populated if
10733    /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
10734    /// is applied.
10735    ///
10736    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10737    /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
10738    pub total_size: i32,
10739
10740    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10741}
10742
10743impl ListKeyRingsResponse {
10744    pub fn new() -> Self {
10745        std::default::Default::default()
10746    }
10747
10748    /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
10749    ///
10750    /// # Example
10751    /// ```ignore,no_run
10752    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
10753    /// use google_cloud_kms_v1::model::KeyRing;
10754    /// let x = ListKeyRingsResponse::new()
10755    ///     .set_key_rings([
10756    ///         KeyRing::default()/* use setters */,
10757    ///         KeyRing::default()/* use (different) setters */,
10758    ///     ]);
10759    /// ```
10760    pub fn set_key_rings<T, V>(mut self, v: T) -> Self
10761    where
10762        T: std::iter::IntoIterator<Item = V>,
10763        V: std::convert::Into<crate::model::KeyRing>,
10764    {
10765        use std::iter::Iterator;
10766        self.key_rings = v.into_iter().map(|i| i.into()).collect();
10767        self
10768    }
10769
10770    /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
10771    ///
10772    /// # Example
10773    /// ```ignore,no_run
10774    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
10775    /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
10776    /// ```
10777    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10778        self.next_page_token = v.into();
10779        self
10780    }
10781
10782    /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
10783    ///
10784    /// # Example
10785    /// ```ignore,no_run
10786    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
10787    /// let x = ListKeyRingsResponse::new().set_total_size(42);
10788    /// ```
10789    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10790        self.total_size = v.into();
10791        self
10792    }
10793}
10794
10795impl wkt::message::Message for ListKeyRingsResponse {
10796    fn typename() -> &'static str {
10797        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
10798    }
10799}
10800
10801#[doc(hidden)]
10802impl gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
10803    type PageItem = crate::model::KeyRing;
10804
10805    fn items(self) -> std::vec::Vec<Self::PageItem> {
10806        self.key_rings
10807    }
10808
10809    fn next_page_token(&self) -> std::string::String {
10810        use std::clone::Clone;
10811        self.next_page_token.clone()
10812    }
10813}
10814
10815/// Response message for
10816/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10817///
10818/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10819#[derive(Clone, Default, PartialEq)]
10820#[non_exhaustive]
10821pub struct ListCryptoKeysResponse {
10822    /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10823    ///
10824    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10825    pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
10826
10827    /// A token to retrieve next page of results. Pass this value in
10828    /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
10829    /// to retrieve the next page of results.
10830    ///
10831    /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
10832    pub next_page_token: std::string::String,
10833
10834    /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
10835    /// matched the query.
10836    ///
10837    /// This field is not populated if
10838    /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
10839    /// is applied.
10840    ///
10841    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10842    /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
10843    pub total_size: i32,
10844
10845    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10846}
10847
10848impl ListCryptoKeysResponse {
10849    pub fn new() -> Self {
10850        std::default::Default::default()
10851    }
10852
10853    /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
10854    ///
10855    /// # Example
10856    /// ```ignore,no_run
10857    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
10858    /// use google_cloud_kms_v1::model::CryptoKey;
10859    /// let x = ListCryptoKeysResponse::new()
10860    ///     .set_crypto_keys([
10861    ///         CryptoKey::default()/* use setters */,
10862    ///         CryptoKey::default()/* use (different) setters */,
10863    ///     ]);
10864    /// ```
10865    pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
10866    where
10867        T: std::iter::IntoIterator<Item = V>,
10868        V: std::convert::Into<crate::model::CryptoKey>,
10869    {
10870        use std::iter::Iterator;
10871        self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
10872        self
10873    }
10874
10875    /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
10876    ///
10877    /// # Example
10878    /// ```ignore,no_run
10879    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
10880    /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
10881    /// ```
10882    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10883        self.next_page_token = v.into();
10884        self
10885    }
10886
10887    /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
10888    ///
10889    /// # Example
10890    /// ```ignore,no_run
10891    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
10892    /// let x = ListCryptoKeysResponse::new().set_total_size(42);
10893    /// ```
10894    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10895        self.total_size = v.into();
10896        self
10897    }
10898}
10899
10900impl wkt::message::Message for ListCryptoKeysResponse {
10901    fn typename() -> &'static str {
10902        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
10903    }
10904}
10905
10906#[doc(hidden)]
10907impl gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
10908    type PageItem = crate::model::CryptoKey;
10909
10910    fn items(self) -> std::vec::Vec<Self::PageItem> {
10911        self.crypto_keys
10912    }
10913
10914    fn next_page_token(&self) -> std::string::String {
10915        use std::clone::Clone;
10916        self.next_page_token.clone()
10917    }
10918}
10919
10920/// Response message for
10921/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
10922///
10923/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
10924#[derive(Clone, Default, PartialEq)]
10925#[non_exhaustive]
10926pub struct ListCryptoKeyVersionsResponse {
10927    /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
10928    ///
10929    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10930    pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
10931
10932    /// A token to retrieve next page of results. Pass this value in
10933    /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
10934    /// to retrieve the next page of results.
10935    ///
10936    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
10937    pub next_page_token: std::string::String,
10938
10939    /// The total number of
10940    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
10941    /// query.
10942    ///
10943    /// This field is not populated if
10944    /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
10945    /// is applied.
10946    ///
10947    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10948    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
10949    pub total_size: i32,
10950
10951    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10952}
10953
10954impl ListCryptoKeyVersionsResponse {
10955    pub fn new() -> Self {
10956        std::default::Default::default()
10957    }
10958
10959    /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
10960    ///
10961    /// # Example
10962    /// ```ignore,no_run
10963    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
10964    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
10965    /// let x = ListCryptoKeyVersionsResponse::new()
10966    ///     .set_crypto_key_versions([
10967    ///         CryptoKeyVersion::default()/* use setters */,
10968    ///         CryptoKeyVersion::default()/* use (different) setters */,
10969    ///     ]);
10970    /// ```
10971    pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
10972    where
10973        T: std::iter::IntoIterator<Item = V>,
10974        V: std::convert::Into<crate::model::CryptoKeyVersion>,
10975    {
10976        use std::iter::Iterator;
10977        self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
10978        self
10979    }
10980
10981    /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
10982    ///
10983    /// # Example
10984    /// ```ignore,no_run
10985    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
10986    /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
10987    /// ```
10988    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10989        self.next_page_token = v.into();
10990        self
10991    }
10992
10993    /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
10994    ///
10995    /// # Example
10996    /// ```ignore,no_run
10997    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
10998    /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
10999    /// ```
11000    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11001        self.total_size = v.into();
11002        self
11003    }
11004}
11005
11006impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11007    fn typename() -> &'static str {
11008        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11009    }
11010}
11011
11012#[doc(hidden)]
11013impl gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11014    type PageItem = crate::model::CryptoKeyVersion;
11015
11016    fn items(self) -> std::vec::Vec<Self::PageItem> {
11017        self.crypto_key_versions
11018    }
11019
11020    fn next_page_token(&self) -> std::string::String {
11021        use std::clone::Clone;
11022        self.next_page_token.clone()
11023    }
11024}
11025
11026/// Response message for
11027/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11028///
11029/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11030#[derive(Clone, Default, PartialEq)]
11031#[non_exhaustive]
11032pub struct ListImportJobsResponse {
11033    /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11034    ///
11035    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11036    pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
11037
11038    /// A token to retrieve next page of results. Pass this value in
11039    /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
11040    /// to retrieve the next page of results.
11041    ///
11042    /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
11043    pub next_page_token: std::string::String,
11044
11045    /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
11046    /// matched the query.
11047    ///
11048    /// This field is not populated if
11049    /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
11050    /// is applied.
11051    ///
11052    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11053    /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
11054    pub total_size: i32,
11055
11056    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11057}
11058
11059impl ListImportJobsResponse {
11060    pub fn new() -> Self {
11061        std::default::Default::default()
11062    }
11063
11064    /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
11065    ///
11066    /// # Example
11067    /// ```ignore,no_run
11068    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11069    /// use google_cloud_kms_v1::model::ImportJob;
11070    /// let x = ListImportJobsResponse::new()
11071    ///     .set_import_jobs([
11072    ///         ImportJob::default()/* use setters */,
11073    ///         ImportJob::default()/* use (different) setters */,
11074    ///     ]);
11075    /// ```
11076    pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
11077    where
11078        T: std::iter::IntoIterator<Item = V>,
11079        V: std::convert::Into<crate::model::ImportJob>,
11080    {
11081        use std::iter::Iterator;
11082        self.import_jobs = v.into_iter().map(|i| i.into()).collect();
11083        self
11084    }
11085
11086    /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
11087    ///
11088    /// # Example
11089    /// ```ignore,no_run
11090    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11091    /// let x = ListImportJobsResponse::new().set_next_page_token("example");
11092    /// ```
11093    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11094        self.next_page_token = v.into();
11095        self
11096    }
11097
11098    /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
11099    ///
11100    /// # Example
11101    /// ```ignore,no_run
11102    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11103    /// let x = ListImportJobsResponse::new().set_total_size(42);
11104    /// ```
11105    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11106        self.total_size = v.into();
11107        self
11108    }
11109}
11110
11111impl wkt::message::Message for ListImportJobsResponse {
11112    fn typename() -> &'static str {
11113        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
11114    }
11115}
11116
11117#[doc(hidden)]
11118impl gax::paginator::internal::PageableResponse for ListImportJobsResponse {
11119    type PageItem = crate::model::ImportJob;
11120
11121    fn items(self) -> std::vec::Vec<Self::PageItem> {
11122        self.import_jobs
11123    }
11124
11125    fn next_page_token(&self) -> std::string::String {
11126        use std::clone::Clone;
11127        self.next_page_token.clone()
11128    }
11129}
11130
11131/// Request message for
11132/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
11133///
11134/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
11135#[derive(Clone, Default, PartialEq)]
11136#[non_exhaustive]
11137pub struct GetKeyRingRequest {
11138    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
11139    /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
11140    ///
11141    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11142    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11143    pub name: std::string::String,
11144
11145    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11146}
11147
11148impl GetKeyRingRequest {
11149    pub fn new() -> Self {
11150        std::default::Default::default()
11151    }
11152
11153    /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
11154    ///
11155    /// # Example
11156    /// ```ignore,no_run
11157    /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
11158    /// let x = GetKeyRingRequest::new().set_name("example");
11159    /// ```
11160    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11161        self.name = v.into();
11162        self
11163    }
11164}
11165
11166impl wkt::message::Message for GetKeyRingRequest {
11167    fn typename() -> &'static str {
11168        "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
11169    }
11170}
11171
11172/// Request message for
11173/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
11174///
11175/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
11176#[derive(Clone, Default, PartialEq)]
11177#[non_exhaustive]
11178pub struct GetCryptoKeyRequest {
11179    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11180    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
11181    ///
11182    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11183    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11184    pub name: std::string::String,
11185
11186    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11187}
11188
11189impl GetCryptoKeyRequest {
11190    pub fn new() -> Self {
11191        std::default::Default::default()
11192    }
11193
11194    /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
11195    ///
11196    /// # Example
11197    /// ```ignore,no_run
11198    /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
11199    /// let x = GetCryptoKeyRequest::new().set_name("example");
11200    /// ```
11201    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11202        self.name = v.into();
11203        self
11204    }
11205}
11206
11207impl wkt::message::Message for GetCryptoKeyRequest {
11208    fn typename() -> &'static str {
11209        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
11210    }
11211}
11212
11213/// Request message for
11214/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
11215///
11216/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
11217#[derive(Clone, Default, PartialEq)]
11218#[non_exhaustive]
11219pub struct GetCryptoKeyVersionRequest {
11220    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11221    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
11222    ///
11223    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11224    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11225    pub name: std::string::String,
11226
11227    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11228}
11229
11230impl GetCryptoKeyVersionRequest {
11231    pub fn new() -> Self {
11232        std::default::Default::default()
11233    }
11234
11235    /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
11236    ///
11237    /// # Example
11238    /// ```ignore,no_run
11239    /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
11240    /// let x = GetCryptoKeyVersionRequest::new().set_name("example");
11241    /// ```
11242    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11243        self.name = v.into();
11244        self
11245    }
11246}
11247
11248impl wkt::message::Message for GetCryptoKeyVersionRequest {
11249    fn typename() -> &'static str {
11250        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
11251    }
11252}
11253
11254/// Request message for
11255/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
11256///
11257/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
11258#[derive(Clone, Default, PartialEq)]
11259#[non_exhaustive]
11260pub struct GetPublicKeyRequest {
11261    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11262    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
11263    ///
11264    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11265    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11266    pub name: std::string::String,
11267
11268    /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
11269    /// by the user. This field is required for PQC algorithms. If specified, the
11270    /// public key will be exported through the
11271    /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
11272    /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
11273    /// field will be populated for non-PQC algorithms, and an error will be
11274    /// returned for PQC algorithms.
11275    ///
11276    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
11277    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
11278    /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
11279    pub public_key_format: crate::model::public_key::PublicKeyFormat,
11280
11281    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11282}
11283
11284impl GetPublicKeyRequest {
11285    pub fn new() -> Self {
11286        std::default::Default::default()
11287    }
11288
11289    /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
11290    ///
11291    /// # Example
11292    /// ```ignore,no_run
11293    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11294    /// let x = GetPublicKeyRequest::new().set_name("example");
11295    /// ```
11296    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11297        self.name = v.into();
11298        self
11299    }
11300
11301    /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
11302    ///
11303    /// # Example
11304    /// ```ignore,no_run
11305    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11306    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
11307    /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
11308    /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
11309    /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
11310    /// ```
11311    pub fn set_public_key_format<
11312        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
11313    >(
11314        mut self,
11315        v: T,
11316    ) -> Self {
11317        self.public_key_format = v.into();
11318        self
11319    }
11320}
11321
11322impl wkt::message::Message for GetPublicKeyRequest {
11323    fn typename() -> &'static str {
11324        "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
11325    }
11326}
11327
11328/// Request message for
11329/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
11330///
11331/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
11332#[derive(Clone, Default, PartialEq)]
11333#[non_exhaustive]
11334pub struct GetImportJobRequest {
11335    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
11336    /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
11337    ///
11338    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11339    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
11340    pub name: std::string::String,
11341
11342    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11343}
11344
11345impl GetImportJobRequest {
11346    pub fn new() -> Self {
11347        std::default::Default::default()
11348    }
11349
11350    /// Sets the value of [name][crate::model::GetImportJobRequest::name].
11351    ///
11352    /// # Example
11353    /// ```ignore,no_run
11354    /// # use google_cloud_kms_v1::model::GetImportJobRequest;
11355    /// let x = GetImportJobRequest::new().set_name("example");
11356    /// ```
11357    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11358        self.name = v.into();
11359        self
11360    }
11361}
11362
11363impl wkt::message::Message for GetImportJobRequest {
11364    fn typename() -> &'static str {
11365        "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
11366    }
11367}
11368
11369/// Request message for
11370/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
11371///
11372/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
11373#[derive(Clone, Default, PartialEq)]
11374#[non_exhaustive]
11375pub struct CreateKeyRingRequest {
11376    /// Required. The resource name of the location associated with the
11377    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
11378    /// `projects/*/locations/*`.
11379    ///
11380    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11381    pub parent: std::string::String,
11382
11383    /// Required. It must be unique within a location and match the regular
11384    /// expression `[a-zA-Z0-9_-]{1,63}`
11385    pub key_ring_id: std::string::String,
11386
11387    /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
11388    /// values.
11389    ///
11390    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11391    pub key_ring: std::option::Option<crate::model::KeyRing>,
11392
11393    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11394}
11395
11396impl CreateKeyRingRequest {
11397    pub fn new() -> Self {
11398        std::default::Default::default()
11399    }
11400
11401    /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
11402    ///
11403    /// # Example
11404    /// ```ignore,no_run
11405    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11406    /// let x = CreateKeyRingRequest::new().set_parent("example");
11407    /// ```
11408    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11409        self.parent = v.into();
11410        self
11411    }
11412
11413    /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
11414    ///
11415    /// # Example
11416    /// ```ignore,no_run
11417    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11418    /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
11419    /// ```
11420    pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11421        self.key_ring_id = v.into();
11422        self
11423    }
11424
11425    /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
11426    ///
11427    /// # Example
11428    /// ```ignore,no_run
11429    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11430    /// use google_cloud_kms_v1::model::KeyRing;
11431    /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
11432    /// ```
11433    pub fn set_key_ring<T>(mut self, v: T) -> Self
11434    where
11435        T: std::convert::Into<crate::model::KeyRing>,
11436    {
11437        self.key_ring = std::option::Option::Some(v.into());
11438        self
11439    }
11440
11441    /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
11442    ///
11443    /// # Example
11444    /// ```ignore,no_run
11445    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11446    /// use google_cloud_kms_v1::model::KeyRing;
11447    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
11448    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
11449    /// ```
11450    pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
11451    where
11452        T: std::convert::Into<crate::model::KeyRing>,
11453    {
11454        self.key_ring = v.map(|x| x.into());
11455        self
11456    }
11457}
11458
11459impl wkt::message::Message for CreateKeyRingRequest {
11460    fn typename() -> &'static str {
11461        "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
11462    }
11463}
11464
11465/// Request message for
11466/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
11467///
11468/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
11469#[derive(Clone, Default, PartialEq)]
11470#[non_exhaustive]
11471pub struct CreateCryptoKeyRequest {
11472    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
11473    /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11474    ///
11475    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11476    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11477    pub parent: std::string::String,
11478
11479    /// Required. It must be unique within a KeyRing and match the regular
11480    /// expression `[a-zA-Z0-9_-]{1,63}`
11481    pub crypto_key_id: std::string::String,
11482
11483    /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
11484    /// values.
11485    ///
11486    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11487    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
11488
11489    /// If set to true, the request will create a
11490    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
11491    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
11492    /// manually call
11493    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
11494    /// or
11495    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
11496    /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
11497    ///
11498    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11499    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11500    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
11501    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
11502    pub skip_initial_version_creation: bool,
11503
11504    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11505}
11506
11507impl CreateCryptoKeyRequest {
11508    pub fn new() -> Self {
11509        std::default::Default::default()
11510    }
11511
11512    /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
11513    ///
11514    /// # Example
11515    /// ```ignore,no_run
11516    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11517    /// let x = CreateCryptoKeyRequest::new().set_parent("example");
11518    /// ```
11519    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11520        self.parent = v.into();
11521        self
11522    }
11523
11524    /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
11525    ///
11526    /// # Example
11527    /// ```ignore,no_run
11528    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11529    /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
11530    /// ```
11531    pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11532        self.crypto_key_id = v.into();
11533        self
11534    }
11535
11536    /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
11537    ///
11538    /// # Example
11539    /// ```ignore,no_run
11540    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11541    /// use google_cloud_kms_v1::model::CryptoKey;
11542    /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
11543    /// ```
11544    pub fn set_crypto_key<T>(mut self, v: T) -> Self
11545    where
11546        T: std::convert::Into<crate::model::CryptoKey>,
11547    {
11548        self.crypto_key = std::option::Option::Some(v.into());
11549        self
11550    }
11551
11552    /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
11553    ///
11554    /// # Example
11555    /// ```ignore,no_run
11556    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11557    /// use google_cloud_kms_v1::model::CryptoKey;
11558    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
11559    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
11560    /// ```
11561    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
11562    where
11563        T: std::convert::Into<crate::model::CryptoKey>,
11564    {
11565        self.crypto_key = v.map(|x| x.into());
11566        self
11567    }
11568
11569    /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
11570    ///
11571    /// # Example
11572    /// ```ignore,no_run
11573    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11574    /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
11575    /// ```
11576    pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11577        self.skip_initial_version_creation = v.into();
11578        self
11579    }
11580}
11581
11582impl wkt::message::Message for CreateCryptoKeyRequest {
11583    fn typename() -> &'static str {
11584        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
11585    }
11586}
11587
11588/// Request message for
11589/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
11590///
11591/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
11592#[derive(Clone, Default, PartialEq)]
11593#[non_exhaustive]
11594pub struct CreateCryptoKeyVersionRequest {
11595    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11596    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
11597    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11598    ///
11599    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11600    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11601    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11602    pub parent: std::string::String,
11603
11604    /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
11605    /// initial field values.
11606    ///
11607    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11608    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
11609
11610    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11611}
11612
11613impl CreateCryptoKeyVersionRequest {
11614    pub fn new() -> Self {
11615        std::default::Default::default()
11616    }
11617
11618    /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
11619    ///
11620    /// # Example
11621    /// ```ignore,no_run
11622    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
11623    /// let x = CreateCryptoKeyVersionRequest::new().set_parent("example");
11624    /// ```
11625    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11626        self.parent = v.into();
11627        self
11628    }
11629
11630    /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
11631    ///
11632    /// # Example
11633    /// ```ignore,no_run
11634    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
11635    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11636    /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
11637    /// ```
11638    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
11639    where
11640        T: std::convert::Into<crate::model::CryptoKeyVersion>,
11641    {
11642        self.crypto_key_version = std::option::Option::Some(v.into());
11643        self
11644    }
11645
11646    /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
11647    ///
11648    /// # Example
11649    /// ```ignore,no_run
11650    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
11651    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11652    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
11653    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
11654    /// ```
11655    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
11656    where
11657        T: std::convert::Into<crate::model::CryptoKeyVersion>,
11658    {
11659        self.crypto_key_version = v.map(|x| x.into());
11660        self
11661    }
11662}
11663
11664impl wkt::message::Message for CreateCryptoKeyVersionRequest {
11665    fn typename() -> &'static str {
11666        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
11667    }
11668}
11669
11670/// Request message for
11671/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
11672///
11673/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
11674#[derive(Clone, Default, PartialEq)]
11675#[non_exhaustive]
11676pub struct ImportCryptoKeyVersionRequest {
11677    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11678    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
11679    ///
11680    /// The create permission is only required on this key when creating a new
11681    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
11682    ///
11683    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11684    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11685    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11686    pub parent: std::string::String,
11687
11688    /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
11689    /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
11690    /// target for an import operation. If this field is not present, a new
11691    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
11692    /// supplied key material is created.
11693    ///
11694    /// If this field is present, the supplied key material is imported into
11695    /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
11696    /// import into an existing
11697    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
11698    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
11699    /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
11700    /// have been previously created via
11701    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
11702    /// and be in
11703    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
11704    /// or
11705    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
11706    /// state. The key material and algorithm must match the previous
11707    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
11708    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
11709    /// key material.
11710    ///
11711    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11712    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
11713    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
11714    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11715    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
11716    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
11717    pub crypto_key_version: std::string::String,
11718
11719    /// Required. The
11720    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
11721    /// of the key being imported. This does not need to match the
11722    /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
11723    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
11724    ///
11725    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11726    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
11727    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
11728    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
11729
11730    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
11731    /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
11732    /// material.
11733    ///
11734    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11735    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
11736    pub import_job: std::string::String,
11737
11738    /// Optional. The wrapped key material to import.
11739    ///
11740    /// Before wrapping, key material must be formatted. If importing symmetric key
11741    /// material, the expected key material format is plain bytes. If importing
11742    /// asymmetric key material, the expected key material format is PKCS#8-encoded
11743    /// DER (the PrivateKeyInfo structure from RFC 5208).
11744    ///
11745    /// When wrapping with import methods
11746    /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
11747    /// or
11748    /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
11749    /// or
11750    /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
11751    /// or
11752    /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
11753    ///
11754    /// this field must contain the concatenation of:
11755    ///
11756    /// This format is the same as the format produced by PKCS#11 mechanism
11757    /// CKM_RSA_AES_KEY_WRAP.
11758    ///
11759    /// When wrapping with import methods
11760    /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
11761    /// or
11762    /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
11763    ///
11764    /// this field must contain the formatted key to be imported, wrapped with the
11765    /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
11766    /// with SHA-256, MGF1 with SHA-256, and an empty label.
11767    ///
11768    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
11769    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
11770    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
11771    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
11772    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
11773    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
11774    /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
11775    pub wrapped_key: ::bytes::Bytes,
11776
11777    /// This field is legacy. Use the field
11778    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
11779    /// instead.
11780    ///
11781    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
11782    pub wrapped_key_material:
11783        std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
11784
11785    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11786}
11787
11788impl ImportCryptoKeyVersionRequest {
11789    pub fn new() -> Self {
11790        std::default::Default::default()
11791    }
11792
11793    /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
11794    ///
11795    /// # Example
11796    /// ```ignore,no_run
11797    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
11798    /// let x = ImportCryptoKeyVersionRequest::new().set_parent("example");
11799    /// ```
11800    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11801        self.parent = v.into();
11802        self
11803    }
11804
11805    /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
11806    ///
11807    /// # Example
11808    /// ```ignore,no_run
11809    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
11810    /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version("example");
11811    /// ```
11812    pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
11813        mut self,
11814        v: T,
11815    ) -> Self {
11816        self.crypto_key_version = v.into();
11817        self
11818    }
11819
11820    /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
11821    ///
11822    /// # Example
11823    /// ```ignore,no_run
11824    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
11825    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
11826    /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
11827    /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
11828    /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
11829    /// ```
11830    pub fn set_algorithm<
11831        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
11832    >(
11833        mut self,
11834        v: T,
11835    ) -> Self {
11836        self.algorithm = v.into();
11837        self
11838    }
11839
11840    /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
11841    ///
11842    /// # Example
11843    /// ```ignore,no_run
11844    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
11845    /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
11846    /// ```
11847    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11848        self.import_job = v.into();
11849        self
11850    }
11851
11852    /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
11853    ///
11854    /// # Example
11855    /// ```ignore,no_run
11856    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
11857    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
11858    /// ```
11859    pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11860        self.wrapped_key = v.into();
11861        self
11862    }
11863
11864    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
11865    ///
11866    /// Note that all the setters affecting `wrapped_key_material` are mutually
11867    /// exclusive.
11868    ///
11869    /// # Example
11870    /// ```ignore,no_run
11871    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
11872    /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
11873    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
11874    /// ```
11875    pub fn set_wrapped_key_material<
11876        T: std::convert::Into<
11877                std::option::Option<
11878                    crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
11879                >,
11880            >,
11881    >(
11882        mut self,
11883        v: T,
11884    ) -> Self {
11885        self.wrapped_key_material = v.into();
11886        self
11887    }
11888
11889    /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
11890    /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
11891    /// holds a different branch.
11892    pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
11893        #[allow(unreachable_patterns)]
11894        self.wrapped_key_material.as_ref().and_then(|v| match v {
11895            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
11896            _ => std::option::Option::None,
11897        })
11898    }
11899
11900    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
11901    /// to hold a `RsaAesWrappedKey`.
11902    ///
11903    /// Note that all the setters affecting `wrapped_key_material` are
11904    /// mutually exclusive.
11905    ///
11906    /// # Example
11907    /// ```ignore,no_run
11908    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
11909    /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
11910    /// assert!(x.rsa_aes_wrapped_key().is_some());
11911    /// ```
11912    pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11913        self.wrapped_key_material = std::option::Option::Some(
11914            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
11915                v.into(),
11916            ),
11917        );
11918        self
11919    }
11920}
11921
11922impl wkt::message::Message for ImportCryptoKeyVersionRequest {
11923    fn typename() -> &'static str {
11924        "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
11925    }
11926}
11927
11928/// Defines additional types related to [ImportCryptoKeyVersionRequest].
11929pub mod import_crypto_key_version_request {
11930    #[allow(unused_imports)]
11931    use super::*;
11932
11933    /// This field is legacy. Use the field
11934    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
11935    /// instead.
11936    ///
11937    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
11938    #[derive(Clone, Debug, PartialEq)]
11939    #[non_exhaustive]
11940    pub enum WrappedKeyMaterial {
11941        /// Optional. This field has the same meaning as
11942        /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
11943        /// Prefer to use that field in new work. Either that field or this field
11944        /// (but not both) must be specified.
11945        ///
11946        /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
11947        RsaAesWrappedKey(::bytes::Bytes),
11948    }
11949}
11950
11951/// Request message for
11952/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
11953///
11954/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
11955#[derive(Clone, Default, PartialEq)]
11956#[non_exhaustive]
11957pub struct CreateImportJobRequest {
11958    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
11959    /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
11960    /// [ImportJobs][google.cloud.kms.v1.ImportJob].
11961    ///
11962    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11963    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11964    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11965    pub parent: std::string::String,
11966
11967    /// Required. It must be unique within a KeyRing and match the regular
11968    /// expression `[a-zA-Z0-9_-]{1,63}`
11969    pub import_job_id: std::string::String,
11970
11971    /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
11972    /// values.
11973    ///
11974    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11975    pub import_job: std::option::Option<crate::model::ImportJob>,
11976
11977    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11978}
11979
11980impl CreateImportJobRequest {
11981    pub fn new() -> Self {
11982        std::default::Default::default()
11983    }
11984
11985    /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
11986    ///
11987    /// # Example
11988    /// ```ignore,no_run
11989    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
11990    /// let x = CreateImportJobRequest::new().set_parent("example");
11991    /// ```
11992    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11993        self.parent = v.into();
11994        self
11995    }
11996
11997    /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
11998    ///
11999    /// # Example
12000    /// ```ignore,no_run
12001    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12002    /// let x = CreateImportJobRequest::new().set_import_job_id("example");
12003    /// ```
12004    pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12005        self.import_job_id = v.into();
12006        self
12007    }
12008
12009    /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12010    ///
12011    /// # Example
12012    /// ```ignore,no_run
12013    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12014    /// use google_cloud_kms_v1::model::ImportJob;
12015    /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
12016    /// ```
12017    pub fn set_import_job<T>(mut self, v: T) -> Self
12018    where
12019        T: std::convert::Into<crate::model::ImportJob>,
12020    {
12021        self.import_job = std::option::Option::Some(v.into());
12022        self
12023    }
12024
12025    /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12026    ///
12027    /// # Example
12028    /// ```ignore,no_run
12029    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12030    /// use google_cloud_kms_v1::model::ImportJob;
12031    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
12032    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
12033    /// ```
12034    pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
12035    where
12036        T: std::convert::Into<crate::model::ImportJob>,
12037    {
12038        self.import_job = v.map(|x| x.into());
12039        self
12040    }
12041}
12042
12043impl wkt::message::Message for CreateImportJobRequest {
12044    fn typename() -> &'static str {
12045        "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
12046    }
12047}
12048
12049/// Request message for
12050/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
12051///
12052/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
12053#[derive(Clone, Default, PartialEq)]
12054#[non_exhaustive]
12055pub struct UpdateCryptoKeyRequest {
12056    /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
12057    ///
12058    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12059    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12060
12061    /// Required. List of fields to be updated in this request.
12062    pub update_mask: std::option::Option<wkt::FieldMask>,
12063
12064    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12065}
12066
12067impl UpdateCryptoKeyRequest {
12068    pub fn new() -> Self {
12069        std::default::Default::default()
12070    }
12071
12072    /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12073    ///
12074    /// # Example
12075    /// ```ignore,no_run
12076    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12077    /// use google_cloud_kms_v1::model::CryptoKey;
12078    /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12079    /// ```
12080    pub fn set_crypto_key<T>(mut self, v: T) -> Self
12081    where
12082        T: std::convert::Into<crate::model::CryptoKey>,
12083    {
12084        self.crypto_key = std::option::Option::Some(v.into());
12085        self
12086    }
12087
12088    /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12089    ///
12090    /// # Example
12091    /// ```ignore,no_run
12092    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12093    /// use google_cloud_kms_v1::model::CryptoKey;
12094    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12095    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12096    /// ```
12097    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12098    where
12099        T: std::convert::Into<crate::model::CryptoKey>,
12100    {
12101        self.crypto_key = v.map(|x| x.into());
12102        self
12103    }
12104
12105    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12106    ///
12107    /// # Example
12108    /// ```ignore,no_run
12109    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12110    /// use wkt::FieldMask;
12111    /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12112    /// ```
12113    pub fn set_update_mask<T>(mut self, v: T) -> Self
12114    where
12115        T: std::convert::Into<wkt::FieldMask>,
12116    {
12117        self.update_mask = std::option::Option::Some(v.into());
12118        self
12119    }
12120
12121    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12122    ///
12123    /// # Example
12124    /// ```ignore,no_run
12125    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12126    /// use wkt::FieldMask;
12127    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12128    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12129    /// ```
12130    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12131    where
12132        T: std::convert::Into<wkt::FieldMask>,
12133    {
12134        self.update_mask = v.map(|x| x.into());
12135        self
12136    }
12137}
12138
12139impl wkt::message::Message for UpdateCryptoKeyRequest {
12140    fn typename() -> &'static str {
12141        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
12142    }
12143}
12144
12145/// Request message for
12146/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
12147///
12148/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
12149#[derive(Clone, Default, PartialEq)]
12150#[non_exhaustive]
12151pub struct UpdateCryptoKeyVersionRequest {
12152    /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12153    /// updated values.
12154    ///
12155    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12156    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12157
12158    /// Required. List of fields to be updated in this request.
12159    pub update_mask: std::option::Option<wkt::FieldMask>,
12160
12161    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12162}
12163
12164impl UpdateCryptoKeyVersionRequest {
12165    pub fn new() -> Self {
12166        std::default::Default::default()
12167    }
12168
12169    /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12170    ///
12171    /// # Example
12172    /// ```ignore,no_run
12173    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12174    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12175    /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12176    /// ```
12177    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12178    where
12179        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12180    {
12181        self.crypto_key_version = std::option::Option::Some(v.into());
12182        self
12183    }
12184
12185    /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12186    ///
12187    /// # Example
12188    /// ```ignore,no_run
12189    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12190    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12191    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12192    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12193    /// ```
12194    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12195    where
12196        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12197    {
12198        self.crypto_key_version = v.map(|x| x.into());
12199        self
12200    }
12201
12202    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12203    ///
12204    /// # Example
12205    /// ```ignore,no_run
12206    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12207    /// use wkt::FieldMask;
12208    /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12209    /// ```
12210    pub fn set_update_mask<T>(mut self, v: T) -> Self
12211    where
12212        T: std::convert::Into<wkt::FieldMask>,
12213    {
12214        self.update_mask = std::option::Option::Some(v.into());
12215        self
12216    }
12217
12218    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12219    ///
12220    /// # Example
12221    /// ```ignore,no_run
12222    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12223    /// use wkt::FieldMask;
12224    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12225    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12226    /// ```
12227    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12228    where
12229        T: std::convert::Into<wkt::FieldMask>,
12230    {
12231        self.update_mask = v.map(|x| x.into());
12232        self
12233    }
12234}
12235
12236impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
12237    fn typename() -> &'static str {
12238        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
12239    }
12240}
12241
12242/// Request message for
12243/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
12244///
12245/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
12246#[derive(Clone, Default, PartialEq)]
12247#[non_exhaustive]
12248pub struct UpdateCryptoKeyPrimaryVersionRequest {
12249    /// Required. The resource name of the
12250    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
12251    ///
12252    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12253    pub name: std::string::String,
12254
12255    /// Required. The id of the child
12256    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
12257    ///
12258    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12259    pub crypto_key_version_id: std::string::String,
12260
12261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12262}
12263
12264impl UpdateCryptoKeyPrimaryVersionRequest {
12265    pub fn new() -> Self {
12266        std::default::Default::default()
12267    }
12268
12269    /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
12270    ///
12271    /// # Example
12272    /// ```ignore,no_run
12273    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12274    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name("example");
12275    /// ```
12276    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12277        self.name = v.into();
12278        self
12279    }
12280
12281    /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
12282    ///
12283    /// # Example
12284    /// ```ignore,no_run
12285    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12286    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
12287    /// ```
12288    pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
12289        mut self,
12290        v: T,
12291    ) -> Self {
12292        self.crypto_key_version_id = v.into();
12293        self
12294    }
12295}
12296
12297impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
12298    fn typename() -> &'static str {
12299        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
12300    }
12301}
12302
12303/// Request message for
12304/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
12305///
12306/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
12307#[derive(Clone, Default, PartialEq)]
12308#[non_exhaustive]
12309pub struct DestroyCryptoKeyVersionRequest {
12310    /// Required. The resource name of the
12311    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
12312    ///
12313    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12314    pub name: std::string::String,
12315
12316    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12317}
12318
12319impl DestroyCryptoKeyVersionRequest {
12320    pub fn new() -> Self {
12321        std::default::Default::default()
12322    }
12323
12324    /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
12325    ///
12326    /// # Example
12327    /// ```ignore,no_run
12328    /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
12329    /// let x = DestroyCryptoKeyVersionRequest::new().set_name("example");
12330    /// ```
12331    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12332        self.name = v.into();
12333        self
12334    }
12335}
12336
12337impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
12338    fn typename() -> &'static str {
12339        "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
12340    }
12341}
12342
12343/// Request message for
12344/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
12345///
12346/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
12347#[derive(Clone, Default, PartialEq)]
12348#[non_exhaustive]
12349pub struct RestoreCryptoKeyVersionRequest {
12350    /// Required. The resource name of the
12351    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
12352    ///
12353    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12354    pub name: std::string::String,
12355
12356    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12357}
12358
12359impl RestoreCryptoKeyVersionRequest {
12360    pub fn new() -> Self {
12361        std::default::Default::default()
12362    }
12363
12364    /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
12365    ///
12366    /// # Example
12367    /// ```ignore,no_run
12368    /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
12369    /// let x = RestoreCryptoKeyVersionRequest::new().set_name("example");
12370    /// ```
12371    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12372        self.name = v.into();
12373        self
12374    }
12375}
12376
12377impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
12378    fn typename() -> &'static str {
12379        "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
12380    }
12381}
12382
12383/// Request message for
12384/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
12385///
12386/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
12387#[derive(Clone, Default, PartialEq)]
12388#[non_exhaustive]
12389pub struct EncryptRequest {
12390    /// Required. The resource name of the
12391    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
12392    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
12393    /// encryption.
12394    ///
12395    /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
12396    /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
12397    ///
12398    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12399    /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
12400    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12401    pub name: std::string::String,
12402
12403    /// Required. The data to encrypt. Must be no larger than 64KiB.
12404    ///
12405    /// The maximum size depends on the key version's
12406    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
12407    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
12408    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
12409    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
12410    /// plaintext must be no larger than 64KiB. For
12411    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
12412    /// the plaintext and additional_authenticated_data fields must be no larger
12413    /// than 8KiB.
12414    ///
12415    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12416    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
12417    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
12418    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
12419    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
12420    pub plaintext: ::bytes::Bytes,
12421
12422    /// Optional. Optional data that, if specified, must also be provided during
12423    /// decryption through
12424    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
12425    ///
12426    /// The maximum size depends on the key version's
12427    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
12428    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
12429    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
12430    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
12431    /// AAD must be no larger than 64KiB. For
12432    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
12433    /// the plaintext and additional_authenticated_data fields must be no larger
12434    /// than 8KiB.
12435    ///
12436    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12437    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
12438    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
12439    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
12440    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
12441    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
12442    pub additional_authenticated_data: ::bytes::Bytes,
12443
12444    /// Optional. An optional CRC32C checksum of the
12445    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
12446    /// If specified,
12447    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12448    /// verify the integrity of the received
12449    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
12450    /// using this checksum.
12451    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12452    /// report an error if the checksum verification fails. If you receive a
12453    /// checksum error, your client should verify that
12454    /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
12455    /// is equal to
12456    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
12457    /// and if so, perform a limited number of retries. A persistent mismatch may
12458    /// indicate an issue in your computation of the CRC32C checksum. Note: This
12459    /// field is defined as int64 for reasons of compatibility across different
12460    /// languages. However, it is a non-negative integer, which will never exceed
12461    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
12462    /// this type.
12463    ///
12464    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
12465    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
12466    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12467    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
12468
12469    /// Optional. An optional CRC32C checksum of the
12470    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
12471    /// If specified,
12472    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12473    /// verify the integrity of the received
12474    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
12475    /// using this checksum.
12476    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12477    /// report an error if the checksum verification fails. If you receive a
12478    /// checksum error, your client should verify that
12479    /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
12480    /// is equal to
12481    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
12482    /// and if so, perform a limited number of retries. A persistent mismatch may
12483    /// indicate an issue in your computation of the CRC32C checksum. Note: This
12484    /// field is defined as int64 for reasons of compatibility across different
12485    /// languages. However, it is a non-negative integer, which will never exceed
12486    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
12487    /// this type.
12488    ///
12489    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
12490    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
12491    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12492    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
12493
12494    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12495}
12496
12497impl EncryptRequest {
12498    pub fn new() -> Self {
12499        std::default::Default::default()
12500    }
12501
12502    /// Sets the value of [name][crate::model::EncryptRequest::name].
12503    ///
12504    /// # Example
12505    /// ```ignore,no_run
12506    /// # use google_cloud_kms_v1::model::EncryptRequest;
12507    /// let x = EncryptRequest::new().set_name("example");
12508    /// ```
12509    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12510        self.name = v.into();
12511        self
12512    }
12513
12514    /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
12515    ///
12516    /// # Example
12517    /// ```ignore,no_run
12518    /// # use google_cloud_kms_v1::model::EncryptRequest;
12519    /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
12520    /// ```
12521    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12522        self.plaintext = v.into();
12523        self
12524    }
12525
12526    /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
12527    ///
12528    /// # Example
12529    /// ```ignore,no_run
12530    /// # use google_cloud_kms_v1::model::EncryptRequest;
12531    /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
12532    /// ```
12533    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
12534        mut self,
12535        v: T,
12536    ) -> Self {
12537        self.additional_authenticated_data = v.into();
12538        self
12539    }
12540
12541    /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
12542    ///
12543    /// # Example
12544    /// ```ignore,no_run
12545    /// # use google_cloud_kms_v1::model::EncryptRequest;
12546    /// use wkt::Int64Value;
12547    /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
12548    /// ```
12549    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
12550    where
12551        T: std::convert::Into<wkt::Int64Value>,
12552    {
12553        self.plaintext_crc32c = std::option::Option::Some(v.into());
12554        self
12555    }
12556
12557    /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
12558    ///
12559    /// # Example
12560    /// ```ignore,no_run
12561    /// # use google_cloud_kms_v1::model::EncryptRequest;
12562    /// use wkt::Int64Value;
12563    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
12564    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
12565    /// ```
12566    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
12567    where
12568        T: std::convert::Into<wkt::Int64Value>,
12569    {
12570        self.plaintext_crc32c = v.map(|x| x.into());
12571        self
12572    }
12573
12574    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
12575    ///
12576    /// # Example
12577    /// ```ignore,no_run
12578    /// # use google_cloud_kms_v1::model::EncryptRequest;
12579    /// use wkt::Int64Value;
12580    /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
12581    /// ```
12582    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
12583    where
12584        T: std::convert::Into<wkt::Int64Value>,
12585    {
12586        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
12587        self
12588    }
12589
12590    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
12591    ///
12592    /// # Example
12593    /// ```ignore,no_run
12594    /// # use google_cloud_kms_v1::model::EncryptRequest;
12595    /// use wkt::Int64Value;
12596    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
12597    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
12598    /// ```
12599    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
12600        mut self,
12601        v: std::option::Option<T>,
12602    ) -> Self
12603    where
12604        T: std::convert::Into<wkt::Int64Value>,
12605    {
12606        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
12607        self
12608    }
12609}
12610
12611impl wkt::message::Message for EncryptRequest {
12612    fn typename() -> &'static str {
12613        "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
12614    }
12615}
12616
12617/// Request message for
12618/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
12619///
12620/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
12621#[derive(Clone, Default, PartialEq)]
12622#[non_exhaustive]
12623pub struct DecryptRequest {
12624    /// Required. The resource name of the
12625    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
12626    /// server will choose the appropriate version.
12627    ///
12628    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12629    pub name: std::string::String,
12630
12631    /// Required. The encrypted data originally returned in
12632    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
12633    ///
12634    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
12635    pub ciphertext: ::bytes::Bytes,
12636
12637    /// Optional. Optional data that must match the data originally supplied in
12638    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
12639    ///
12640    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
12641    pub additional_authenticated_data: ::bytes::Bytes,
12642
12643    /// Optional. An optional CRC32C checksum of the
12644    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
12645    /// If specified,
12646    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12647    /// verify the integrity of the received
12648    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
12649    /// using this checksum.
12650    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12651    /// report an error if the checksum verification fails. If you receive a
12652    /// checksum error, your client should verify that
12653    /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
12654    /// is equal to
12655    /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
12656    /// and if so, perform a limited number of retries. A persistent mismatch may
12657    /// indicate an issue in your computation of the CRC32C checksum. Note: This
12658    /// field is defined as int64 for reasons of compatibility across different
12659    /// languages. However, it is a non-negative integer, which will never exceed
12660    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
12661    /// this type.
12662    ///
12663    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
12664    /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
12665    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12666    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
12667
12668    /// Optional. An optional CRC32C checksum of the
12669    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
12670    /// If specified,
12671    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12672    /// verify the integrity of the received
12673    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
12674    /// using this checksum.
12675    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12676    /// report an error if the checksum verification fails. If you receive a
12677    /// checksum error, your client should verify that
12678    /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
12679    /// is equal to
12680    /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
12681    /// and if so, perform a limited number of retries. A persistent mismatch may
12682    /// indicate an issue in your computation of the CRC32C checksum. Note: This
12683    /// field is defined as int64 for reasons of compatibility across different
12684    /// languages. However, it is a non-negative integer, which will never exceed
12685    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
12686    /// this type.
12687    ///
12688    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
12689    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
12690    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12691    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
12692
12693    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12694}
12695
12696impl DecryptRequest {
12697    pub fn new() -> Self {
12698        std::default::Default::default()
12699    }
12700
12701    /// Sets the value of [name][crate::model::DecryptRequest::name].
12702    ///
12703    /// # Example
12704    /// ```ignore,no_run
12705    /// # use google_cloud_kms_v1::model::DecryptRequest;
12706    /// let x = DecryptRequest::new().set_name("example");
12707    /// ```
12708    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12709        self.name = v.into();
12710        self
12711    }
12712
12713    /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
12714    ///
12715    /// # Example
12716    /// ```ignore,no_run
12717    /// # use google_cloud_kms_v1::model::DecryptRequest;
12718    /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
12719    /// ```
12720    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12721        self.ciphertext = v.into();
12722        self
12723    }
12724
12725    /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
12726    ///
12727    /// # Example
12728    /// ```ignore,no_run
12729    /// # use google_cloud_kms_v1::model::DecryptRequest;
12730    /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
12731    /// ```
12732    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
12733        mut self,
12734        v: T,
12735    ) -> Self {
12736        self.additional_authenticated_data = v.into();
12737        self
12738    }
12739
12740    /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
12741    ///
12742    /// # Example
12743    /// ```ignore,no_run
12744    /// # use google_cloud_kms_v1::model::DecryptRequest;
12745    /// use wkt::Int64Value;
12746    /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
12747    /// ```
12748    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
12749    where
12750        T: std::convert::Into<wkt::Int64Value>,
12751    {
12752        self.ciphertext_crc32c = std::option::Option::Some(v.into());
12753        self
12754    }
12755
12756    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
12757    ///
12758    /// # Example
12759    /// ```ignore,no_run
12760    /// # use google_cloud_kms_v1::model::DecryptRequest;
12761    /// use wkt::Int64Value;
12762    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
12763    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
12764    /// ```
12765    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
12766    where
12767        T: std::convert::Into<wkt::Int64Value>,
12768    {
12769        self.ciphertext_crc32c = v.map(|x| x.into());
12770        self
12771    }
12772
12773    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
12774    ///
12775    /// # Example
12776    /// ```ignore,no_run
12777    /// # use google_cloud_kms_v1::model::DecryptRequest;
12778    /// use wkt::Int64Value;
12779    /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
12780    /// ```
12781    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
12782    where
12783        T: std::convert::Into<wkt::Int64Value>,
12784    {
12785        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
12786        self
12787    }
12788
12789    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
12790    ///
12791    /// # Example
12792    /// ```ignore,no_run
12793    /// # use google_cloud_kms_v1::model::DecryptRequest;
12794    /// use wkt::Int64Value;
12795    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
12796    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
12797    /// ```
12798    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
12799        mut self,
12800        v: std::option::Option<T>,
12801    ) -> Self
12802    where
12803        T: std::convert::Into<wkt::Int64Value>,
12804    {
12805        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
12806        self
12807    }
12808}
12809
12810impl wkt::message::Message for DecryptRequest {
12811    fn typename() -> &'static str {
12812        "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
12813    }
12814}
12815
12816/// Request message for
12817/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
12818///
12819/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
12820#[derive(Clone, Default, PartialEq)]
12821#[non_exhaustive]
12822pub struct RawEncryptRequest {
12823    /// Required. The resource name of the
12824    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
12825    /// encryption.
12826    ///
12827    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12828    pub name: std::string::String,
12829
12830    /// Required. The data to encrypt. Must be no larger than 64KiB.
12831    ///
12832    /// The maximum size depends on the key version's
12833    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
12834    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
12835    /// plaintext must be no larger than 64KiB. For
12836    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
12837    /// the plaintext and additional_authenticated_data fields must be no larger
12838    /// than 8KiB.
12839    ///
12840    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12841    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
12842    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
12843    pub plaintext: ::bytes::Bytes,
12844
12845    /// Optional. Optional data that, if specified, must also be provided during
12846    /// decryption through
12847    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
12848    ///
12849    /// This field may only be used in conjunction with an
12850    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
12851    /// additional authenticated data (for example, AES-GCM).
12852    ///
12853    /// The maximum size depends on the key version's
12854    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
12855    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
12856    /// plaintext must be no larger than 64KiB. For
12857    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
12858    /// the plaintext and additional_authenticated_data fields must be no larger
12859    /// than 8KiB.
12860    ///
12861    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
12862    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12863    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
12864    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
12865    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
12866    pub additional_authenticated_data: ::bytes::Bytes,
12867
12868    /// Optional. An optional CRC32C checksum of the
12869    /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
12870    /// If specified,
12871    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12872    /// verify the integrity of the received plaintext using this checksum.
12873    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12874    /// report an error if the checksum verification fails. If you receive a
12875    /// checksum error, your client should verify that CRC32C(plaintext) is equal
12876    /// to plaintext_crc32c, and if so, perform a limited number of retries. A
12877    /// persistent mismatch may indicate an issue in your computation of the CRC32C
12878    /// checksum. Note: This field is defined as int64 for reasons of compatibility
12879    /// across different languages. However, it is a non-negative integer, which
12880    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
12881    /// languages that support this type.
12882    ///
12883    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12884    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
12885    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
12886
12887    /// Optional. An optional CRC32C checksum of the
12888    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
12889    /// If specified,
12890    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12891    /// verify the integrity of the received additional_authenticated_data using
12892    /// this checksum.
12893    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12894    /// report an error if the checksum verification fails. If you receive a
12895    /// checksum error, your client should verify that
12896    /// CRC32C(additional_authenticated_data) is equal to
12897    /// additional_authenticated_data_crc32c, and if so, perform
12898    /// a limited number of retries. A persistent mismatch may indicate an issue in
12899    /// your computation of the CRC32C checksum.
12900    /// Note: This field is defined as int64 for reasons of compatibility across
12901    /// different languages. However, it is a non-negative integer, which will
12902    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
12903    /// that support this type.
12904    ///
12905    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12906    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
12907    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
12908
12909    /// Optional. A customer-supplied initialization vector that will be used for
12910    /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
12911    /// generated. It will be returned in
12912    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
12913    ///
12914    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
12915    pub initialization_vector: ::bytes::Bytes,
12916
12917    /// Optional. An optional CRC32C checksum of the
12918    /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
12919    /// If specified,
12920    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12921    /// verify the integrity of the received initialization_vector using this
12922    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
12923    /// will report an error if the checksum verification fails. If you receive a
12924    /// checksum error, your client should verify that
12925    /// CRC32C(initialization_vector) is equal to
12926    /// initialization_vector_crc32c, and if so, perform
12927    /// a limited number of retries. A persistent mismatch may indicate an issue in
12928    /// your computation of the CRC32C checksum.
12929    /// Note: This field is defined as int64 for reasons of compatibility across
12930    /// different languages. However, it is a non-negative integer, which will
12931    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
12932    /// that support this type.
12933    ///
12934    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12935    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
12936    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
12937
12938    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12939}
12940
12941impl RawEncryptRequest {
12942    pub fn new() -> Self {
12943        std::default::Default::default()
12944    }
12945
12946    /// Sets the value of [name][crate::model::RawEncryptRequest::name].
12947    ///
12948    /// # Example
12949    /// ```ignore,no_run
12950    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
12951    /// let x = RawEncryptRequest::new().set_name("example");
12952    /// ```
12953    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12954        self.name = v.into();
12955        self
12956    }
12957
12958    /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
12959    ///
12960    /// # Example
12961    /// ```ignore,no_run
12962    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
12963    /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
12964    /// ```
12965    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12966        self.plaintext = v.into();
12967        self
12968    }
12969
12970    /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
12971    ///
12972    /// # Example
12973    /// ```ignore,no_run
12974    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
12975    /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
12976    /// ```
12977    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
12978        mut self,
12979        v: T,
12980    ) -> Self {
12981        self.additional_authenticated_data = v.into();
12982        self
12983    }
12984
12985    /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
12986    ///
12987    /// # Example
12988    /// ```ignore,no_run
12989    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
12990    /// use wkt::Int64Value;
12991    /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
12992    /// ```
12993    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
12994    where
12995        T: std::convert::Into<wkt::Int64Value>,
12996    {
12997        self.plaintext_crc32c = std::option::Option::Some(v.into());
12998        self
12999    }
13000
13001    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13002    ///
13003    /// # Example
13004    /// ```ignore,no_run
13005    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13006    /// use wkt::Int64Value;
13007    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13008    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13009    /// ```
13010    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13011    where
13012        T: std::convert::Into<wkt::Int64Value>,
13013    {
13014        self.plaintext_crc32c = v.map(|x| x.into());
13015        self
13016    }
13017
13018    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13019    ///
13020    /// # Example
13021    /// ```ignore,no_run
13022    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13023    /// use wkt::Int64Value;
13024    /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13025    /// ```
13026    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13027    where
13028        T: std::convert::Into<wkt::Int64Value>,
13029    {
13030        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13031        self
13032    }
13033
13034    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13035    ///
13036    /// # Example
13037    /// ```ignore,no_run
13038    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13039    /// use wkt::Int64Value;
13040    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13041    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13042    /// ```
13043    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13044        mut self,
13045        v: std::option::Option<T>,
13046    ) -> Self
13047    where
13048        T: std::convert::Into<wkt::Int64Value>,
13049    {
13050        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13051        self
13052    }
13053
13054    /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
13055    ///
13056    /// # Example
13057    /// ```ignore,no_run
13058    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13059    /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13060    /// ```
13061    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13062        mut self,
13063        v: T,
13064    ) -> Self {
13065        self.initialization_vector = v.into();
13066        self
13067    }
13068
13069    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13070    ///
13071    /// # Example
13072    /// ```ignore,no_run
13073    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13074    /// use wkt::Int64Value;
13075    /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
13076    /// ```
13077    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
13078    where
13079        T: std::convert::Into<wkt::Int64Value>,
13080    {
13081        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
13082        self
13083    }
13084
13085    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13086    ///
13087    /// # Example
13088    /// ```ignore,no_run
13089    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13090    /// use wkt::Int64Value;
13091    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
13092    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
13093    /// ```
13094    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13095    where
13096        T: std::convert::Into<wkt::Int64Value>,
13097    {
13098        self.initialization_vector_crc32c = v.map(|x| x.into());
13099        self
13100    }
13101}
13102
13103impl wkt::message::Message for RawEncryptRequest {
13104    fn typename() -> &'static str {
13105        "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
13106    }
13107}
13108
13109/// Request message for
13110/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
13111///
13112/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
13113#[derive(Clone, Default, PartialEq)]
13114#[non_exhaustive]
13115pub struct RawDecryptRequest {
13116    /// Required. The resource name of the
13117    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13118    /// decryption.
13119    ///
13120    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13121    pub name: std::string::String,
13122
13123    /// Required. The encrypted data originally returned in
13124    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
13125    ///
13126    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
13127    pub ciphertext: ::bytes::Bytes,
13128
13129    /// Optional. Optional data that must match the data originally supplied in
13130    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13131    ///
13132    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13133    pub additional_authenticated_data: ::bytes::Bytes,
13134
13135    /// Required. The initialization vector (IV) used during encryption, which must
13136    /// match the data originally provided in
13137    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13138    ///
13139    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13140    pub initialization_vector: ::bytes::Bytes,
13141
13142    /// The length of the authentication tag that is appended to the end of
13143    /// the ciphertext. If unspecified (0), the default value for the key's
13144    /// algorithm will be used (for AES-GCM, the default value is 16).
13145    pub tag_length: i32,
13146
13147    /// Optional. An optional CRC32C checksum of the
13148    /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
13149    /// If specified,
13150    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13151    /// verify the integrity of the received ciphertext using this checksum.
13152    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13153    /// report an error if the checksum verification fails. If you receive a
13154    /// checksum error, your client should verify that CRC32C(ciphertext) is equal
13155    /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
13156    /// persistent mismatch may indicate an issue in your computation of the CRC32C
13157    /// checksum. Note: This field is defined as int64 for reasons of compatibility
13158    /// across different languages. However, it is a non-negative integer, which
13159    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13160    /// languages that support this type.
13161    ///
13162    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13163    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
13164    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13165
13166    /// Optional. An optional CRC32C checksum of the
13167    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13168    /// If specified,
13169    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13170    /// verify the integrity of the received additional_authenticated_data using
13171    /// this checksum.
13172    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13173    /// report an error if the checksum verification fails. If you receive a
13174    /// checksum error, your client should verify that
13175    /// CRC32C(additional_authenticated_data) is equal to
13176    /// additional_authenticated_data_crc32c, and if so, perform
13177    /// a limited number of retries. A persistent mismatch may indicate an issue in
13178    /// your computation of the CRC32C checksum.
13179    /// Note: This field is defined as int64 for reasons of compatibility across
13180    /// different languages. However, it is a non-negative integer, which will
13181    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13182    /// that support this type.
13183    ///
13184    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13185    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13186    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13187
13188    /// Optional. An optional CRC32C checksum of the
13189    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
13190    /// If specified,
13191    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13192    /// verify the integrity of the received initialization_vector using this
13193    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13194    /// will report an error if the checksum verification fails. If you receive a
13195    /// checksum error, your client should verify that
13196    /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
13197    /// if so, perform a limited number of retries. A persistent mismatch may
13198    /// indicate an issue in your computation of the CRC32C checksum.
13199    /// Note: This field is defined as int64 for reasons of compatibility across
13200    /// different languages. However, it is a non-negative integer, which will
13201    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13202    /// that support this type.
13203    ///
13204    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13205    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
13206    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13207
13208    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13209}
13210
13211impl RawDecryptRequest {
13212    pub fn new() -> Self {
13213        std::default::Default::default()
13214    }
13215
13216    /// Sets the value of [name][crate::model::RawDecryptRequest::name].
13217    ///
13218    /// # Example
13219    /// ```ignore,no_run
13220    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13221    /// let x = RawDecryptRequest::new().set_name("example");
13222    /// ```
13223    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13224        self.name = v.into();
13225        self
13226    }
13227
13228    /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
13229    ///
13230    /// # Example
13231    /// ```ignore,no_run
13232    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13233    /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13234    /// ```
13235    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13236        self.ciphertext = v.into();
13237        self
13238    }
13239
13240    /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
13241    ///
13242    /// # Example
13243    /// ```ignore,no_run
13244    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13245    /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13246    /// ```
13247    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13248        mut self,
13249        v: T,
13250    ) -> Self {
13251        self.additional_authenticated_data = v.into();
13252        self
13253    }
13254
13255    /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
13256    ///
13257    /// # Example
13258    /// ```ignore,no_run
13259    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13260    /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13261    /// ```
13262    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13263        mut self,
13264        v: T,
13265    ) -> Self {
13266        self.initialization_vector = v.into();
13267        self
13268    }
13269
13270    /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
13271    ///
13272    /// # Example
13273    /// ```ignore,no_run
13274    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13275    /// let x = RawDecryptRequest::new().set_tag_length(42);
13276    /// ```
13277    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13278        self.tag_length = v.into();
13279        self
13280    }
13281
13282    /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13283    ///
13284    /// # Example
13285    /// ```ignore,no_run
13286    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13287    /// use wkt::Int64Value;
13288    /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13289    /// ```
13290    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13291    where
13292        T: std::convert::Into<wkt::Int64Value>,
13293    {
13294        self.ciphertext_crc32c = std::option::Option::Some(v.into());
13295        self
13296    }
13297
13298    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13299    ///
13300    /// # Example
13301    /// ```ignore,no_run
13302    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13303    /// use wkt::Int64Value;
13304    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13305    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13306    /// ```
13307    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13308    where
13309        T: std::convert::Into<wkt::Int64Value>,
13310    {
13311        self.ciphertext_crc32c = v.map(|x| x.into());
13312        self
13313    }
13314
13315    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
13316    ///
13317    /// # Example
13318    /// ```ignore,no_run
13319    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13320    /// use wkt::Int64Value;
13321    /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13322    /// ```
13323    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13324    where
13325        T: std::convert::Into<wkt::Int64Value>,
13326    {
13327        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13328        self
13329    }
13330
13331    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
13332    ///
13333    /// # Example
13334    /// ```ignore,no_run
13335    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13336    /// use wkt::Int64Value;
13337    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13338    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13339    /// ```
13340    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13341        mut self,
13342        v: std::option::Option<T>,
13343    ) -> Self
13344    where
13345        T: std::convert::Into<wkt::Int64Value>,
13346    {
13347        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13348        self
13349    }
13350
13351    /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
13352    ///
13353    /// # Example
13354    /// ```ignore,no_run
13355    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13356    /// use wkt::Int64Value;
13357    /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
13358    /// ```
13359    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
13360    where
13361        T: std::convert::Into<wkt::Int64Value>,
13362    {
13363        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
13364        self
13365    }
13366
13367    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
13368    ///
13369    /// # Example
13370    /// ```ignore,no_run
13371    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13372    /// use wkt::Int64Value;
13373    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
13374    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
13375    /// ```
13376    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13377    where
13378        T: std::convert::Into<wkt::Int64Value>,
13379    {
13380        self.initialization_vector_crc32c = v.map(|x| x.into());
13381        self
13382    }
13383}
13384
13385impl wkt::message::Message for RawDecryptRequest {
13386    fn typename() -> &'static str {
13387        "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
13388    }
13389}
13390
13391/// Request message for
13392/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
13393///
13394/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
13395#[derive(Clone, Default, PartialEq)]
13396#[non_exhaustive]
13397pub struct AsymmetricSignRequest {
13398    /// Required. The resource name of the
13399    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13400    /// signing.
13401    ///
13402    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13403    pub name: std::string::String,
13404
13405    /// Optional. The digest of the data to sign. The digest must be produced with
13406    /// the same digest algorithm as specified by the key version's
13407    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
13408    ///
13409    /// This field may not be supplied if
13410    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
13411    /// is supplied.
13412    ///
13413    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
13414    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13415    pub digest: std::option::Option<crate::model::Digest>,
13416
13417    /// Optional. An optional CRC32C checksum of the
13418    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
13419    /// If specified,
13420    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13421    /// verify the integrity of the received
13422    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
13423    /// using this checksum.
13424    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13425    /// report an error if the checksum verification fails. If you receive a
13426    /// checksum error, your client should verify that
13427    /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
13428    /// is equal to
13429    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
13430    /// and if so, perform a limited number of retries. A persistent mismatch may
13431    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13432    /// field is defined as int64 for reasons of compatibility across different
13433    /// languages. However, it is a non-negative integer, which will never exceed
13434    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13435    /// this type.
13436    ///
13437    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
13438    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
13439    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13440    pub digest_crc32c: std::option::Option<wkt::Int64Value>,
13441
13442    /// Optional. The data to sign.
13443    /// It can't be supplied if
13444    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
13445    /// is supplied.
13446    ///
13447    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
13448    pub data: ::bytes::Bytes,
13449
13450    /// Optional. An optional CRC32C checksum of the
13451    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
13452    /// If specified,
13453    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13454    /// verify the integrity of the received
13455    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
13456    /// using this checksum.
13457    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13458    /// report an error if the checksum verification fails. If you receive a
13459    /// checksum error, your client should verify that
13460    /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
13461    /// is equal to
13462    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
13463    /// and if so, perform a limited number of retries. A persistent mismatch may
13464    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13465    /// field is defined as int64 for reasons of compatibility across different
13466    /// languages. However, it is a non-negative integer, which will never exceed
13467    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13468    /// this type.
13469    ///
13470    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
13471    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
13472    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13473    pub data_crc32c: std::option::Option<wkt::Int64Value>,
13474
13475    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13476}
13477
13478impl AsymmetricSignRequest {
13479    pub fn new() -> Self {
13480        std::default::Default::default()
13481    }
13482
13483    /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
13484    ///
13485    /// # Example
13486    /// ```ignore,no_run
13487    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13488    /// let x = AsymmetricSignRequest::new().set_name("example");
13489    /// ```
13490    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13491        self.name = v.into();
13492        self
13493    }
13494
13495    /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
13496    ///
13497    /// # Example
13498    /// ```ignore,no_run
13499    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13500    /// use google_cloud_kms_v1::model::Digest;
13501    /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
13502    /// ```
13503    pub fn set_digest<T>(mut self, v: T) -> Self
13504    where
13505        T: std::convert::Into<crate::model::Digest>,
13506    {
13507        self.digest = std::option::Option::Some(v.into());
13508        self
13509    }
13510
13511    /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
13512    ///
13513    /// # Example
13514    /// ```ignore,no_run
13515    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13516    /// use google_cloud_kms_v1::model::Digest;
13517    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
13518    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
13519    /// ```
13520    pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
13521    where
13522        T: std::convert::Into<crate::model::Digest>,
13523    {
13524        self.digest = v.map(|x| x.into());
13525        self
13526    }
13527
13528    /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
13529    ///
13530    /// # Example
13531    /// ```ignore,no_run
13532    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13533    /// use wkt::Int64Value;
13534    /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
13535    /// ```
13536    pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
13537    where
13538        T: std::convert::Into<wkt::Int64Value>,
13539    {
13540        self.digest_crc32c = std::option::Option::Some(v.into());
13541        self
13542    }
13543
13544    /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
13545    ///
13546    /// # Example
13547    /// ```ignore,no_run
13548    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13549    /// use wkt::Int64Value;
13550    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
13551    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
13552    /// ```
13553    pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13554    where
13555        T: std::convert::Into<wkt::Int64Value>,
13556    {
13557        self.digest_crc32c = v.map(|x| x.into());
13558        self
13559    }
13560
13561    /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
13562    ///
13563    /// # Example
13564    /// ```ignore,no_run
13565    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13566    /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
13567    /// ```
13568    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13569        self.data = v.into();
13570        self
13571    }
13572
13573    /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
13574    ///
13575    /// # Example
13576    /// ```ignore,no_run
13577    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13578    /// use wkt::Int64Value;
13579    /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
13580    /// ```
13581    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
13582    where
13583        T: std::convert::Into<wkt::Int64Value>,
13584    {
13585        self.data_crc32c = std::option::Option::Some(v.into());
13586        self
13587    }
13588
13589    /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
13590    ///
13591    /// # Example
13592    /// ```ignore,no_run
13593    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13594    /// use wkt::Int64Value;
13595    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
13596    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
13597    /// ```
13598    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13599    where
13600        T: std::convert::Into<wkt::Int64Value>,
13601    {
13602        self.data_crc32c = v.map(|x| x.into());
13603        self
13604    }
13605}
13606
13607impl wkt::message::Message for AsymmetricSignRequest {
13608    fn typename() -> &'static str {
13609        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
13610    }
13611}
13612
13613/// Request message for
13614/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
13615///
13616/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
13617#[derive(Clone, Default, PartialEq)]
13618#[non_exhaustive]
13619pub struct AsymmetricDecryptRequest {
13620    /// Required. The resource name of the
13621    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13622    /// decryption.
13623    ///
13624    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13625    pub name: std::string::String,
13626
13627    /// Required. The data encrypted with the named
13628    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
13629    /// OAEP.
13630    ///
13631    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13632    pub ciphertext: ::bytes::Bytes,
13633
13634    /// Optional. An optional CRC32C checksum of the
13635    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
13636    /// If specified,
13637    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13638    /// verify the integrity of the received
13639    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
13640    /// using this checksum.
13641    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13642    /// report an error if the checksum verification fails. If you receive a
13643    /// checksum error, your client should verify that
13644    /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
13645    /// is equal to
13646    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
13647    /// and if so, perform a limited number of retries. A persistent mismatch may
13648    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13649    /// field is defined as int64 for reasons of compatibility across different
13650    /// languages. However, it is a non-negative integer, which will never exceed
13651    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13652    /// this type.
13653    ///
13654    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
13655    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
13656    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13657    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13658
13659    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13660}
13661
13662impl AsymmetricDecryptRequest {
13663    pub fn new() -> Self {
13664        std::default::Default::default()
13665    }
13666
13667    /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
13668    ///
13669    /// # Example
13670    /// ```ignore,no_run
13671    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
13672    /// let x = AsymmetricDecryptRequest::new().set_name("example");
13673    /// ```
13674    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13675        self.name = v.into();
13676        self
13677    }
13678
13679    /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
13680    ///
13681    /// # Example
13682    /// ```ignore,no_run
13683    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
13684    /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13685    /// ```
13686    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13687        self.ciphertext = v.into();
13688        self
13689    }
13690
13691    /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
13692    ///
13693    /// # Example
13694    /// ```ignore,no_run
13695    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
13696    /// use wkt::Int64Value;
13697    /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13698    /// ```
13699    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13700    where
13701        T: std::convert::Into<wkt::Int64Value>,
13702    {
13703        self.ciphertext_crc32c = std::option::Option::Some(v.into());
13704        self
13705    }
13706
13707    /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
13708    ///
13709    /// # Example
13710    /// ```ignore,no_run
13711    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
13712    /// use wkt::Int64Value;
13713    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13714    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13715    /// ```
13716    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13717    where
13718        T: std::convert::Into<wkt::Int64Value>,
13719    {
13720        self.ciphertext_crc32c = v.map(|x| x.into());
13721        self
13722    }
13723}
13724
13725impl wkt::message::Message for AsymmetricDecryptRequest {
13726    fn typename() -> &'static str {
13727        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
13728    }
13729}
13730
13731/// Request message for
13732/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
13733///
13734/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
13735#[derive(Clone, Default, PartialEq)]
13736#[non_exhaustive]
13737pub struct MacSignRequest {
13738    /// Required. The resource name of the
13739    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13740    /// signing.
13741    ///
13742    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13743    pub name: std::string::String,
13744
13745    /// Required. The data to sign. The MAC tag is computed over this data field
13746    /// based on the specific algorithm.
13747    pub data: ::bytes::Bytes,
13748
13749    /// Optional. An optional CRC32C checksum of the
13750    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
13751    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13752    /// will verify the integrity of the received
13753    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
13754    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13755    /// will report an error if the checksum verification fails. If you receive a
13756    /// checksum error, your client should verify that
13757    /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
13758    /// equal to
13759    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
13760    /// and if so, perform a limited number of retries. A persistent mismatch may
13761    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13762    /// field is defined as int64 for reasons of compatibility across different
13763    /// languages. However, it is a non-negative integer, which will never exceed
13764    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13765    /// this type.
13766    ///
13767    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13768    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
13769    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
13770    pub data_crc32c: std::option::Option<wkt::Int64Value>,
13771
13772    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13773}
13774
13775impl MacSignRequest {
13776    pub fn new() -> Self {
13777        std::default::Default::default()
13778    }
13779
13780    /// Sets the value of [name][crate::model::MacSignRequest::name].
13781    ///
13782    /// # Example
13783    /// ```ignore,no_run
13784    /// # use google_cloud_kms_v1::model::MacSignRequest;
13785    /// let x = MacSignRequest::new().set_name("example");
13786    /// ```
13787    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13788        self.name = v.into();
13789        self
13790    }
13791
13792    /// Sets the value of [data][crate::model::MacSignRequest::data].
13793    ///
13794    /// # Example
13795    /// ```ignore,no_run
13796    /// # use google_cloud_kms_v1::model::MacSignRequest;
13797    /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
13798    /// ```
13799    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13800        self.data = v.into();
13801        self
13802    }
13803
13804    /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
13805    ///
13806    /// # Example
13807    /// ```ignore,no_run
13808    /// # use google_cloud_kms_v1::model::MacSignRequest;
13809    /// use wkt::Int64Value;
13810    /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
13811    /// ```
13812    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
13813    where
13814        T: std::convert::Into<wkt::Int64Value>,
13815    {
13816        self.data_crc32c = std::option::Option::Some(v.into());
13817        self
13818    }
13819
13820    /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
13821    ///
13822    /// # Example
13823    /// ```ignore,no_run
13824    /// # use google_cloud_kms_v1::model::MacSignRequest;
13825    /// use wkt::Int64Value;
13826    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
13827    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
13828    /// ```
13829    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13830    where
13831        T: std::convert::Into<wkt::Int64Value>,
13832    {
13833        self.data_crc32c = v.map(|x| x.into());
13834        self
13835    }
13836}
13837
13838impl wkt::message::Message for MacSignRequest {
13839    fn typename() -> &'static str {
13840        "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
13841    }
13842}
13843
13844/// Request message for
13845/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
13846///
13847/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
13848#[derive(Clone, Default, PartialEq)]
13849#[non_exhaustive]
13850pub struct MacVerifyRequest {
13851    /// Required. The resource name of the
13852    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13853    /// verification.
13854    ///
13855    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13856    pub name: std::string::String,
13857
13858    /// Required. The data used previously as a
13859    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
13860    /// the MAC tag.
13861    ///
13862    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
13863    pub data: ::bytes::Bytes,
13864
13865    /// Optional. An optional CRC32C checksum of the
13866    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
13867    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13868    /// will verify the integrity of the received
13869    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
13870    /// this checksum.
13871    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13872    /// report an error if the checksum verification fails. If you receive a
13873    /// checksum error, your client should verify that
13874    /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
13875    /// is equal to
13876    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
13877    /// and if so, perform a limited number of retries. A persistent mismatch may
13878    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13879    /// field is defined as int64 for reasons of compatibility across different
13880    /// languages. However, it is a non-negative integer, which will never exceed
13881    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13882    /// this type.
13883    ///
13884    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13885    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
13886    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
13887    pub data_crc32c: std::option::Option<wkt::Int64Value>,
13888
13889    /// Required. The signature to verify.
13890    pub mac: ::bytes::Bytes,
13891
13892    /// Optional. An optional CRC32C checksum of the
13893    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
13894    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13895    /// will verify the integrity of the received
13896    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
13897    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13898    /// will report an error if the checksum verification fails. If you receive a
13899    /// checksum error, your client should verify that
13900    /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
13901    /// equal to
13902    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
13903    /// and if so, perform a limited number of retries. A persistent mismatch may
13904    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13905    /// field is defined as int64 for reasons of compatibility across different
13906    /// languages. However, it is a non-negative integer, which will never exceed
13907    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13908    /// this type.
13909    ///
13910    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13911    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
13912    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
13913    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
13914
13915    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13916}
13917
13918impl MacVerifyRequest {
13919    pub fn new() -> Self {
13920        std::default::Default::default()
13921    }
13922
13923    /// Sets the value of [name][crate::model::MacVerifyRequest::name].
13924    ///
13925    /// # Example
13926    /// ```ignore,no_run
13927    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
13928    /// let x = MacVerifyRequest::new().set_name("example");
13929    /// ```
13930    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13931        self.name = v.into();
13932        self
13933    }
13934
13935    /// Sets the value of [data][crate::model::MacVerifyRequest::data].
13936    ///
13937    /// # Example
13938    /// ```ignore,no_run
13939    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
13940    /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
13941    /// ```
13942    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13943        self.data = v.into();
13944        self
13945    }
13946
13947    /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
13948    ///
13949    /// # Example
13950    /// ```ignore,no_run
13951    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
13952    /// use wkt::Int64Value;
13953    /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
13954    /// ```
13955    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
13956    where
13957        T: std::convert::Into<wkt::Int64Value>,
13958    {
13959        self.data_crc32c = std::option::Option::Some(v.into());
13960        self
13961    }
13962
13963    /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
13964    ///
13965    /// # Example
13966    /// ```ignore,no_run
13967    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
13968    /// use wkt::Int64Value;
13969    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
13970    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
13971    /// ```
13972    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13973    where
13974        T: std::convert::Into<wkt::Int64Value>,
13975    {
13976        self.data_crc32c = v.map(|x| x.into());
13977        self
13978    }
13979
13980    /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
13981    ///
13982    /// # Example
13983    /// ```ignore,no_run
13984    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
13985    /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
13986    /// ```
13987    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13988        self.mac = v.into();
13989        self
13990    }
13991
13992    /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
13993    ///
13994    /// # Example
13995    /// ```ignore,no_run
13996    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
13997    /// use wkt::Int64Value;
13998    /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
13999    /// ```
14000    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
14001    where
14002        T: std::convert::Into<wkt::Int64Value>,
14003    {
14004        self.mac_crc32c = std::option::Option::Some(v.into());
14005        self
14006    }
14007
14008    /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14009    ///
14010    /// # Example
14011    /// ```ignore,no_run
14012    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14013    /// use wkt::Int64Value;
14014    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
14015    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
14016    /// ```
14017    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14018    where
14019        T: std::convert::Into<wkt::Int64Value>,
14020    {
14021        self.mac_crc32c = v.map(|x| x.into());
14022        self
14023    }
14024}
14025
14026impl wkt::message::Message for MacVerifyRequest {
14027    fn typename() -> &'static str {
14028        "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
14029    }
14030}
14031
14032/// Request message for
14033/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
14034///
14035/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
14036#[derive(Clone, Default, PartialEq)]
14037#[non_exhaustive]
14038pub struct DecapsulateRequest {
14039    /// Required. The resource name of the
14040    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14041    /// decapsulation.
14042    ///
14043    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14044    pub name: std::string::String,
14045
14046    /// Required. The ciphertext produced from encapsulation with the
14047    /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
14048    /// key(s).
14049    ///
14050    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14051    pub ciphertext: ::bytes::Bytes,
14052
14053    /// Optional. A CRC32C checksum of the
14054    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
14055    /// If specified,
14056    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14057    /// verify the integrity of the received
14058    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
14059    /// using this checksum.
14060    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14061    /// report an error if the checksum verification fails. If you receive a
14062    /// checksum error, your client should verify that
14063    /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
14064    /// is equal to
14065    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
14066    /// and if so, perform a limited number of retries. A persistent mismatch may
14067    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14068    /// field is defined as int64 for reasons of compatibility across different
14069    /// languages. However, it is a non-negative integer, which will never exceed
14070    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14071    /// this type.
14072    ///
14073    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
14074    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
14075    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14076    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14077
14078    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14079}
14080
14081impl DecapsulateRequest {
14082    pub fn new() -> Self {
14083        std::default::Default::default()
14084    }
14085
14086    /// Sets the value of [name][crate::model::DecapsulateRequest::name].
14087    ///
14088    /// # Example
14089    /// ```ignore,no_run
14090    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14091    /// let x = DecapsulateRequest::new().set_name("example");
14092    /// ```
14093    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14094        self.name = v.into();
14095        self
14096    }
14097
14098    /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
14099    ///
14100    /// # Example
14101    /// ```ignore,no_run
14102    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14103    /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14104    /// ```
14105    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14106        self.ciphertext = v.into();
14107        self
14108    }
14109
14110    /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14111    ///
14112    /// # Example
14113    /// ```ignore,no_run
14114    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14115    /// use wkt::Int64Value;
14116    /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14117    /// ```
14118    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14119    where
14120        T: std::convert::Into<wkt::Int64Value>,
14121    {
14122        self.ciphertext_crc32c = std::option::Option::Some(v.into());
14123        self
14124    }
14125
14126    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14127    ///
14128    /// # Example
14129    /// ```ignore,no_run
14130    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14131    /// use wkt::Int64Value;
14132    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14133    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14134    /// ```
14135    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14136    where
14137        T: std::convert::Into<wkt::Int64Value>,
14138    {
14139        self.ciphertext_crc32c = v.map(|x| x.into());
14140        self
14141    }
14142}
14143
14144impl wkt::message::Message for DecapsulateRequest {
14145    fn typename() -> &'static str {
14146        "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
14147    }
14148}
14149
14150/// Request message for
14151/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
14152///
14153/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
14154#[derive(Clone, Default, PartialEq)]
14155#[non_exhaustive]
14156pub struct GenerateRandomBytesRequest {
14157    /// The project-specific location in which to generate random bytes.
14158    /// For example, "projects/my-project/locations/us-central1".
14159    pub location: std::string::String,
14160
14161    /// The length in bytes of the amount of randomness to retrieve.  Minimum 8
14162    /// bytes, maximum 1024 bytes.
14163    pub length_bytes: i32,
14164
14165    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
14166    /// generating the random data. Currently, only
14167    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
14168    /// supported.
14169    ///
14170    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14171    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14172    pub protection_level: crate::model::ProtectionLevel,
14173
14174    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14175}
14176
14177impl GenerateRandomBytesRequest {
14178    pub fn new() -> Self {
14179        std::default::Default::default()
14180    }
14181
14182    /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
14183    ///
14184    /// # Example
14185    /// ```ignore,no_run
14186    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14187    /// let x = GenerateRandomBytesRequest::new().set_location("example");
14188    /// ```
14189    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14190        self.location = v.into();
14191        self
14192    }
14193
14194    /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
14195    ///
14196    /// # Example
14197    /// ```ignore,no_run
14198    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14199    /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
14200    /// ```
14201    pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14202        self.length_bytes = v.into();
14203        self
14204    }
14205
14206    /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
14207    ///
14208    /// # Example
14209    /// ```ignore,no_run
14210    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14211    /// use google_cloud_kms_v1::model::ProtectionLevel;
14212    /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
14213    /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
14214    /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
14215    /// ```
14216    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14217        mut self,
14218        v: T,
14219    ) -> Self {
14220        self.protection_level = v.into();
14221        self
14222    }
14223}
14224
14225impl wkt::message::Message for GenerateRandomBytesRequest {
14226    fn typename() -> &'static str {
14227        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
14228    }
14229}
14230
14231/// Response message for
14232/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
14233///
14234/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
14235#[derive(Clone, Default, PartialEq)]
14236#[non_exhaustive]
14237pub struct EncryptResponse {
14238    /// The resource name of the
14239    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14240    /// encryption. Check this field to verify that the intended resource was used
14241    /// for encryption.
14242    ///
14243    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14244    pub name: std::string::String,
14245
14246    /// The encrypted data.
14247    pub ciphertext: ::bytes::Bytes,
14248
14249    /// Integrity verification field. A CRC32C checksum of the returned
14250    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
14251    /// An integrity check of
14252    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14253    /// can be performed by computing the CRC32C checksum of
14254    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14255    /// and comparing your results to this field. Discard the response in case of
14256    /// non-matching checksum values, and perform a limited number of retries. A
14257    /// persistent mismatch may indicate an issue in your computation of the CRC32C
14258    /// checksum. Note: This field is defined as int64 for reasons of compatibility
14259    /// across different languages. However, it is a non-negative integer, which
14260    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14261    /// languages that support this type.
14262    ///
14263    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
14264    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14265
14266    /// Integrity verification field. A flag indicating whether
14267    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14268    /// was received by
14269    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14270    /// for the integrity verification of the
14271    /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
14272    /// this field indicates either that
14273    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14274    /// was left unset or that it was not delivered to
14275    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14276    /// set
14277    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14278    /// but this field is still false, discard the response and perform a limited
14279    /// number of retries.
14280    ///
14281    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
14282    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
14283    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14284    pub verified_plaintext_crc32c: bool,
14285
14286    /// Integrity verification field. A flag indicating whether
14287    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14288    /// was received by
14289    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14290    /// for the integrity verification of the
14291    /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
14292    /// false value of this field indicates either that
14293    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14294    /// was left unset or that it was not delivered to
14295    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14296    /// set
14297    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14298    /// but this field is still false, discard the response and perform a limited
14299    /// number of retries.
14300    ///
14301    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
14302    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
14303    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14304    pub verified_additional_authenticated_data_crc32c: bool,
14305
14306    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14307    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14308    /// encryption.
14309    ///
14310    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14311    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14312    pub protection_level: crate::model::ProtectionLevel,
14313
14314    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14315}
14316
14317impl EncryptResponse {
14318    pub fn new() -> Self {
14319        std::default::Default::default()
14320    }
14321
14322    /// Sets the value of [name][crate::model::EncryptResponse::name].
14323    ///
14324    /// # Example
14325    /// ```ignore,no_run
14326    /// # use google_cloud_kms_v1::model::EncryptResponse;
14327    /// let x = EncryptResponse::new().set_name("example");
14328    /// ```
14329    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14330        self.name = v.into();
14331        self
14332    }
14333
14334    /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
14335    ///
14336    /// # Example
14337    /// ```ignore,no_run
14338    /// # use google_cloud_kms_v1::model::EncryptResponse;
14339    /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14340    /// ```
14341    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14342        self.ciphertext = v.into();
14343        self
14344    }
14345
14346    /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
14347    ///
14348    /// # Example
14349    /// ```ignore,no_run
14350    /// # use google_cloud_kms_v1::model::EncryptResponse;
14351    /// use wkt::Int64Value;
14352    /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14353    /// ```
14354    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14355    where
14356        T: std::convert::Into<wkt::Int64Value>,
14357    {
14358        self.ciphertext_crc32c = std::option::Option::Some(v.into());
14359        self
14360    }
14361
14362    /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
14363    ///
14364    /// # Example
14365    /// ```ignore,no_run
14366    /// # use google_cloud_kms_v1::model::EncryptResponse;
14367    /// use wkt::Int64Value;
14368    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14369    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14370    /// ```
14371    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14372    where
14373        T: std::convert::Into<wkt::Int64Value>,
14374    {
14375        self.ciphertext_crc32c = v.map(|x| x.into());
14376        self
14377    }
14378
14379    /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
14380    ///
14381    /// # Example
14382    /// ```ignore,no_run
14383    /// # use google_cloud_kms_v1::model::EncryptResponse;
14384    /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
14385    /// ```
14386    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14387        self.verified_plaintext_crc32c = v.into();
14388        self
14389    }
14390
14391    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
14392    ///
14393    /// # Example
14394    /// ```ignore,no_run
14395    /// # use google_cloud_kms_v1::model::EncryptResponse;
14396    /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
14397    /// ```
14398    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
14399        mut self,
14400        v: T,
14401    ) -> Self {
14402        self.verified_additional_authenticated_data_crc32c = v.into();
14403        self
14404    }
14405
14406    /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
14407    ///
14408    /// # Example
14409    /// ```ignore,no_run
14410    /// # use google_cloud_kms_v1::model::EncryptResponse;
14411    /// use google_cloud_kms_v1::model::ProtectionLevel;
14412    /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
14413    /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
14414    /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
14415    /// ```
14416    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14417        mut self,
14418        v: T,
14419    ) -> Self {
14420        self.protection_level = v.into();
14421        self
14422    }
14423}
14424
14425impl wkt::message::Message for EncryptResponse {
14426    fn typename() -> &'static str {
14427        "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
14428    }
14429}
14430
14431/// Response message for
14432/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
14433///
14434/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
14435#[derive(Clone, Default, PartialEq)]
14436#[non_exhaustive]
14437pub struct DecryptResponse {
14438    /// The decrypted data originally supplied in
14439    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
14440    ///
14441    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
14442    pub plaintext: ::bytes::Bytes,
14443
14444    /// Integrity verification field. A CRC32C checksum of the returned
14445    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
14446    /// An integrity check of
14447    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
14448    /// can be performed by computing the CRC32C checksum of
14449    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
14450    /// and comparing your results to this field. Discard the response in case of
14451    /// non-matching checksum values, and perform a limited number of retries. A
14452    /// persistent mismatch may indicate an issue in your computation of the CRC32C
14453    /// checksum. Note: receiving this response message indicates that
14454    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
14455    /// successfully decrypt the
14456    /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
14457    /// field is defined as int64 for reasons of compatibility across different
14458    /// languages. However, it is a non-negative integer, which will never exceed
14459    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14460    /// this type.
14461    ///
14462    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
14463    /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
14464    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14465    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
14466
14467    /// Whether the Decryption was performed using the primary key version.
14468    pub used_primary: bool,
14469
14470    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14471    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14472    /// decryption.
14473    ///
14474    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14475    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14476    pub protection_level: crate::model::ProtectionLevel,
14477
14478    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14479}
14480
14481impl DecryptResponse {
14482    pub fn new() -> Self {
14483        std::default::Default::default()
14484    }
14485
14486    /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
14487    ///
14488    /// # Example
14489    /// ```ignore,no_run
14490    /// # use google_cloud_kms_v1::model::DecryptResponse;
14491    /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
14492    /// ```
14493    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14494        self.plaintext = v.into();
14495        self
14496    }
14497
14498    /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
14499    ///
14500    /// # Example
14501    /// ```ignore,no_run
14502    /// # use google_cloud_kms_v1::model::DecryptResponse;
14503    /// use wkt::Int64Value;
14504    /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
14505    /// ```
14506    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
14507    where
14508        T: std::convert::Into<wkt::Int64Value>,
14509    {
14510        self.plaintext_crc32c = std::option::Option::Some(v.into());
14511        self
14512    }
14513
14514    /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
14515    ///
14516    /// # Example
14517    /// ```ignore,no_run
14518    /// # use google_cloud_kms_v1::model::DecryptResponse;
14519    /// use wkt::Int64Value;
14520    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
14521    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
14522    /// ```
14523    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14524    where
14525        T: std::convert::Into<wkt::Int64Value>,
14526    {
14527        self.plaintext_crc32c = v.map(|x| x.into());
14528        self
14529    }
14530
14531    /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
14532    ///
14533    /// # Example
14534    /// ```ignore,no_run
14535    /// # use google_cloud_kms_v1::model::DecryptResponse;
14536    /// let x = DecryptResponse::new().set_used_primary(true);
14537    /// ```
14538    pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14539        self.used_primary = v.into();
14540        self
14541    }
14542
14543    /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
14544    ///
14545    /// # Example
14546    /// ```ignore,no_run
14547    /// # use google_cloud_kms_v1::model::DecryptResponse;
14548    /// use google_cloud_kms_v1::model::ProtectionLevel;
14549    /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
14550    /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
14551    /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
14552    /// ```
14553    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14554        mut self,
14555        v: T,
14556    ) -> Self {
14557        self.protection_level = v.into();
14558        self
14559    }
14560}
14561
14562impl wkt::message::Message for DecryptResponse {
14563    fn typename() -> &'static str {
14564        "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
14565    }
14566}
14567
14568/// Response message for
14569/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
14570///
14571/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
14572#[derive(Clone, Default, PartialEq)]
14573#[non_exhaustive]
14574pub struct RawEncryptResponse {
14575    /// The encrypted data. In the case of AES-GCM, the authentication tag
14576    /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
14577    /// bytes at the end of this field.
14578    ///
14579    /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
14580    pub ciphertext: ::bytes::Bytes,
14581
14582    /// The initialization vector (IV) generated by the service during
14583    /// encryption. This value must be stored and provided in
14584    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
14585    /// at decryption time.
14586    ///
14587    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
14588    pub initialization_vector: ::bytes::Bytes,
14589
14590    /// The length of the authentication tag that is appended to
14591    /// the end of the ciphertext.
14592    pub tag_length: i32,
14593
14594    /// Integrity verification field. A CRC32C checksum of the returned
14595    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
14596    /// An integrity check of ciphertext can be performed by computing the CRC32C
14597    /// checksum of ciphertext and comparing your results to this field. Discard
14598    /// the response in case of non-matching checksum values, and perform a limited
14599    /// number of retries. A persistent mismatch may indicate an issue in your
14600    /// computation of the CRC32C checksum. Note: This field is defined as int64
14601    /// for reasons of compatibility across different languages. However, it is a
14602    /// non-negative integer, which will never exceed 2^32-1, and can be safely
14603    /// downconverted to uint32 in languages that support this type.
14604    ///
14605    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
14606    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14607
14608    /// Integrity verification field. A CRC32C checksum of the returned
14609    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
14610    /// An integrity check of initialization_vector can be performed by computing
14611    /// the CRC32C checksum of initialization_vector and comparing your results to
14612    /// this field. Discard the response in case of non-matching checksum values,
14613    /// and perform a limited number of retries. A persistent mismatch may indicate
14614    /// an issue in your computation of the CRC32C checksum. Note: This field is
14615    /// defined as int64 for reasons of compatibility across different languages.
14616    /// However, it is a non-negative integer, which will never exceed 2^32-1, and
14617    /// can be safely downconverted to uint32 in languages that support this type.
14618    ///
14619    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
14620    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
14621
14622    /// Integrity verification field. A flag indicating whether
14623    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
14624    /// was received by
14625    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14626    /// for the integrity verification of the plaintext. A false value of this
14627    /// field indicates either that
14628    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
14629    /// was left unset or that it was not delivered to
14630    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14631    /// set
14632    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
14633    /// but this field is still false, discard the response and perform a limited
14634    /// number of retries.
14635    ///
14636    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14637    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
14638    pub verified_plaintext_crc32c: bool,
14639
14640    /// Integrity verification field. A flag indicating whether
14641    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
14642    /// was received by
14643    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14644    /// for the integrity verification of additional_authenticated_data. A false
14645    /// value of this field indicates either that //
14646    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
14647    /// was left unset or that it was not delivered to
14648    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14649    /// set
14650    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
14651    /// but this field is still false, discard the response and perform a limited
14652    /// number of retries.
14653    ///
14654    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14655    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
14656    pub verified_additional_authenticated_data_crc32c: bool,
14657
14658    /// Integrity verification field. A flag indicating whether
14659    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
14660    /// was received by
14661    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14662    /// for the integrity verification of initialization_vector. A false value of
14663    /// this field indicates either that
14664    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
14665    /// was left unset or that it was not delivered to
14666    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14667    /// set
14668    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
14669    /// but this field is still false, discard the response and perform a limited
14670    /// number of retries.
14671    ///
14672    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14673    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
14674    pub verified_initialization_vector_crc32c: bool,
14675
14676    /// The resource name of the
14677    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14678    /// encryption. Check this field to verify that the intended resource was used
14679    /// for encryption.
14680    ///
14681    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14682    pub name: std::string::String,
14683
14684    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14685    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14686    /// encryption.
14687    ///
14688    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14689    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14690    pub protection_level: crate::model::ProtectionLevel,
14691
14692    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14693}
14694
14695impl RawEncryptResponse {
14696    pub fn new() -> Self {
14697        std::default::Default::default()
14698    }
14699
14700    /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
14701    ///
14702    /// # Example
14703    /// ```ignore,no_run
14704    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14705    /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14706    /// ```
14707    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14708        self.ciphertext = v.into();
14709        self
14710    }
14711
14712    /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
14713    ///
14714    /// # Example
14715    /// ```ignore,no_run
14716    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14717    /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14718    /// ```
14719    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14720        mut self,
14721        v: T,
14722    ) -> Self {
14723        self.initialization_vector = v.into();
14724        self
14725    }
14726
14727    /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
14728    ///
14729    /// # Example
14730    /// ```ignore,no_run
14731    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14732    /// let x = RawEncryptResponse::new().set_tag_length(42);
14733    /// ```
14734    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14735        self.tag_length = v.into();
14736        self
14737    }
14738
14739    /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
14740    ///
14741    /// # Example
14742    /// ```ignore,no_run
14743    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14744    /// use wkt::Int64Value;
14745    /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14746    /// ```
14747    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14748    where
14749        T: std::convert::Into<wkt::Int64Value>,
14750    {
14751        self.ciphertext_crc32c = std::option::Option::Some(v.into());
14752        self
14753    }
14754
14755    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
14756    ///
14757    /// # Example
14758    /// ```ignore,no_run
14759    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14760    /// use wkt::Int64Value;
14761    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14762    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14763    /// ```
14764    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14765    where
14766        T: std::convert::Into<wkt::Int64Value>,
14767    {
14768        self.ciphertext_crc32c = v.map(|x| x.into());
14769        self
14770    }
14771
14772    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
14773    ///
14774    /// # Example
14775    /// ```ignore,no_run
14776    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14777    /// use wkt::Int64Value;
14778    /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14779    /// ```
14780    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14781    where
14782        T: std::convert::Into<wkt::Int64Value>,
14783    {
14784        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14785        self
14786    }
14787
14788    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
14789    ///
14790    /// # Example
14791    /// ```ignore,no_run
14792    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14793    /// use wkt::Int64Value;
14794    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14795    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14796    /// ```
14797    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14798    where
14799        T: std::convert::Into<wkt::Int64Value>,
14800    {
14801        self.initialization_vector_crc32c = v.map(|x| x.into());
14802        self
14803    }
14804
14805    /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
14806    ///
14807    /// # Example
14808    /// ```ignore,no_run
14809    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14810    /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
14811    /// ```
14812    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14813        self.verified_plaintext_crc32c = v.into();
14814        self
14815    }
14816
14817    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
14818    ///
14819    /// # Example
14820    /// ```ignore,no_run
14821    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14822    /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
14823    /// ```
14824    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
14825        mut self,
14826        v: T,
14827    ) -> Self {
14828        self.verified_additional_authenticated_data_crc32c = v.into();
14829        self
14830    }
14831
14832    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
14833    ///
14834    /// # Example
14835    /// ```ignore,no_run
14836    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14837    /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
14838    /// ```
14839    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
14840        mut self,
14841        v: T,
14842    ) -> Self {
14843        self.verified_initialization_vector_crc32c = v.into();
14844        self
14845    }
14846
14847    /// Sets the value of [name][crate::model::RawEncryptResponse::name].
14848    ///
14849    /// # Example
14850    /// ```ignore,no_run
14851    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14852    /// let x = RawEncryptResponse::new().set_name("example");
14853    /// ```
14854    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14855        self.name = v.into();
14856        self
14857    }
14858
14859    /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
14860    ///
14861    /// # Example
14862    /// ```ignore,no_run
14863    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
14864    /// use google_cloud_kms_v1::model::ProtectionLevel;
14865    /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
14866    /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
14867    /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
14868    /// ```
14869    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14870        mut self,
14871        v: T,
14872    ) -> Self {
14873        self.protection_level = v.into();
14874        self
14875    }
14876}
14877
14878impl wkt::message::Message for RawEncryptResponse {
14879    fn typename() -> &'static str {
14880        "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
14881    }
14882}
14883
14884/// Response message for
14885/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
14886///
14887/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
14888#[derive(Clone, Default, PartialEq)]
14889#[non_exhaustive]
14890pub struct RawDecryptResponse {
14891    /// The decrypted data.
14892    pub plaintext: ::bytes::Bytes,
14893
14894    /// Integrity verification field. A CRC32C checksum of the returned
14895    /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
14896    /// An integrity check of plaintext can be performed by computing the CRC32C
14897    /// checksum of plaintext and comparing your results to this field. Discard the
14898    /// response in case of non-matching checksum values, and perform a limited
14899    /// number of retries. A persistent mismatch may indicate an issue in your
14900    /// computation of the CRC32C checksum. Note: receiving this response message
14901    /// indicates that
14902    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
14903    /// successfully decrypt the
14904    /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
14905    /// Note: This field is defined as int64 for reasons of compatibility across
14906    /// different languages. However, it is a non-negative integer, which will
14907    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14908    /// that support this type.
14909    ///
14910    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14911    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
14912    /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
14913    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
14914
14915    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14916    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14917    /// decryption.
14918    ///
14919    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14920    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14921    pub protection_level: crate::model::ProtectionLevel,
14922
14923    /// Integrity verification field. A flag indicating whether
14924    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
14925    /// was received by
14926    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14927    /// for the integrity verification of the ciphertext. A false value of this
14928    /// field indicates either that
14929    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
14930    /// was left unset or that it was not delivered to
14931    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14932    /// set
14933    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
14934    /// but this field is still false, discard the response and perform a limited
14935    /// number of retries.
14936    ///
14937    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14938    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
14939    pub verified_ciphertext_crc32c: bool,
14940
14941    /// Integrity verification field. A flag indicating whether
14942    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
14943    /// was received by
14944    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14945    /// for the integrity verification of additional_authenticated_data. A false
14946    /// value of this field indicates either that //
14947    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
14948    /// was left unset or that it was not delivered to
14949    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14950    /// set
14951    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
14952    /// but this field is still false, discard the response and perform a limited
14953    /// number of retries.
14954    ///
14955    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14956    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
14957    pub verified_additional_authenticated_data_crc32c: bool,
14958
14959    /// Integrity verification field. A flag indicating whether
14960    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
14961    /// was received by
14962    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14963    /// for the integrity verification of initialization_vector. A false value of
14964    /// this field indicates either that
14965    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
14966    /// was left unset or that it was not delivered to
14967    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14968    /// set
14969    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
14970    /// but this field is still false, discard the response and perform a limited
14971    /// number of retries.
14972    ///
14973    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14974    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
14975    pub verified_initialization_vector_crc32c: bool,
14976
14977    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14978}
14979
14980impl RawDecryptResponse {
14981    pub fn new() -> Self {
14982        std::default::Default::default()
14983    }
14984
14985    /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
14986    ///
14987    /// # Example
14988    /// ```ignore,no_run
14989    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
14990    /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
14991    /// ```
14992    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14993        self.plaintext = v.into();
14994        self
14995    }
14996
14997    /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
14998    ///
14999    /// # Example
15000    /// ```ignore,no_run
15001    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15002    /// use wkt::Int64Value;
15003    /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15004    /// ```
15005    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15006    where
15007        T: std::convert::Into<wkt::Int64Value>,
15008    {
15009        self.plaintext_crc32c = std::option::Option::Some(v.into());
15010        self
15011    }
15012
15013    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15014    ///
15015    /// # Example
15016    /// ```ignore,no_run
15017    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15018    /// use wkt::Int64Value;
15019    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15020    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15021    /// ```
15022    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15023    where
15024        T: std::convert::Into<wkt::Int64Value>,
15025    {
15026        self.plaintext_crc32c = v.map(|x| x.into());
15027        self
15028    }
15029
15030    /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
15031    ///
15032    /// # Example
15033    /// ```ignore,no_run
15034    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15035    /// use google_cloud_kms_v1::model::ProtectionLevel;
15036    /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15037    /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15038    /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
15039    /// ```
15040    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15041        mut self,
15042        v: T,
15043    ) -> Self {
15044        self.protection_level = v.into();
15045        self
15046    }
15047
15048    /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
15049    ///
15050    /// # Example
15051    /// ```ignore,no_run
15052    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15053    /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
15054    /// ```
15055    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15056        self.verified_ciphertext_crc32c = v.into();
15057        self
15058    }
15059
15060    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
15061    ///
15062    /// # Example
15063    /// ```ignore,no_run
15064    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15065    /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15066    /// ```
15067    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15068        mut self,
15069        v: T,
15070    ) -> Self {
15071        self.verified_additional_authenticated_data_crc32c = v.into();
15072        self
15073    }
15074
15075    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
15076    ///
15077    /// # Example
15078    /// ```ignore,no_run
15079    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15080    /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
15081    /// ```
15082    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15083        mut self,
15084        v: T,
15085    ) -> Self {
15086        self.verified_initialization_vector_crc32c = v.into();
15087        self
15088    }
15089}
15090
15091impl wkt::message::Message for RawDecryptResponse {
15092    fn typename() -> &'static str {
15093        "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
15094    }
15095}
15096
15097/// Response message for
15098/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
15099///
15100/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
15101#[derive(Clone, Default, PartialEq)]
15102#[non_exhaustive]
15103pub struct AsymmetricSignResponse {
15104    /// The created signature.
15105    pub signature: ::bytes::Bytes,
15106
15107    /// Integrity verification field. A CRC32C checksum of the returned
15108    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
15109    /// An integrity check of
15110    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15111    /// can be performed by computing the CRC32C checksum of
15112    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15113    /// and comparing your results to this field. Discard the response in case of
15114    /// non-matching checksum values, and perform a limited number of retries. A
15115    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15116    /// checksum. Note: This field is defined as int64 for reasons of compatibility
15117    /// across different languages. However, it is a non-negative integer, which
15118    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15119    /// languages that support this type.
15120    ///
15121    /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
15122    pub signature_crc32c: std::option::Option<wkt::Int64Value>,
15123
15124    /// Integrity verification field. A flag indicating whether
15125    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15126    /// was received by
15127    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15128    /// for the integrity verification of the
15129    /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
15130    /// of this field indicates either that
15131    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15132    /// was left unset or that it was not delivered to
15133    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15134    /// set
15135    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15136    /// but this field is still false, discard the response and perform a limited
15137    /// number of retries.
15138    ///
15139    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
15140    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
15141    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15142    pub verified_digest_crc32c: bool,
15143
15144    /// The resource name of the
15145    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15146    /// Check this field to verify that the intended resource was used for signing.
15147    ///
15148    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15149    pub name: std::string::String,
15150
15151    /// Integrity verification field. A flag indicating whether
15152    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15153    /// was received by
15154    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15155    /// for the integrity verification of the
15156    /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
15157    /// this field indicates either that
15158    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15159    /// was left unset or that it was not delivered to
15160    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15161    /// set
15162    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15163    /// but this field is still false, discard the response and perform a limited
15164    /// number of retries.
15165    ///
15166    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
15167    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
15168    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15169    pub verified_data_crc32c: bool,
15170
15171    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15172    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15173    ///
15174    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15175    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15176    pub protection_level: crate::model::ProtectionLevel,
15177
15178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15179}
15180
15181impl AsymmetricSignResponse {
15182    pub fn new() -> Self {
15183        std::default::Default::default()
15184    }
15185
15186    /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
15187    ///
15188    /// # Example
15189    /// ```ignore,no_run
15190    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15191    /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
15192    /// ```
15193    pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15194        self.signature = v.into();
15195        self
15196    }
15197
15198    /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15199    ///
15200    /// # Example
15201    /// ```ignore,no_run
15202    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15203    /// use wkt::Int64Value;
15204    /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
15205    /// ```
15206    pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
15207    where
15208        T: std::convert::Into<wkt::Int64Value>,
15209    {
15210        self.signature_crc32c = std::option::Option::Some(v.into());
15211        self
15212    }
15213
15214    /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15215    ///
15216    /// # Example
15217    /// ```ignore,no_run
15218    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15219    /// use wkt::Int64Value;
15220    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
15221    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
15222    /// ```
15223    pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15224    where
15225        T: std::convert::Into<wkt::Int64Value>,
15226    {
15227        self.signature_crc32c = v.map(|x| x.into());
15228        self
15229    }
15230
15231    /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
15232    ///
15233    /// # Example
15234    /// ```ignore,no_run
15235    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15236    /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
15237    /// ```
15238    pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15239        self.verified_digest_crc32c = v.into();
15240        self
15241    }
15242
15243    /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
15244    ///
15245    /// # Example
15246    /// ```ignore,no_run
15247    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15248    /// let x = AsymmetricSignResponse::new().set_name("example");
15249    /// ```
15250    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15251        self.name = v.into();
15252        self
15253    }
15254
15255    /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
15256    ///
15257    /// # Example
15258    /// ```ignore,no_run
15259    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15260    /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
15261    /// ```
15262    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15263        self.verified_data_crc32c = v.into();
15264        self
15265    }
15266
15267    /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
15268    ///
15269    /// # Example
15270    /// ```ignore,no_run
15271    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15272    /// use google_cloud_kms_v1::model::ProtectionLevel;
15273    /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
15274    /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
15275    /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
15276    /// ```
15277    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15278        mut self,
15279        v: T,
15280    ) -> Self {
15281        self.protection_level = v.into();
15282        self
15283    }
15284}
15285
15286impl wkt::message::Message for AsymmetricSignResponse {
15287    fn typename() -> &'static str {
15288        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
15289    }
15290}
15291
15292/// Response message for
15293/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
15294///
15295/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
15296#[derive(Clone, Default, PartialEq)]
15297#[non_exhaustive]
15298pub struct AsymmetricDecryptResponse {
15299    /// The decrypted data originally encrypted with the matching public key.
15300    pub plaintext: ::bytes::Bytes,
15301
15302    /// Integrity verification field. A CRC32C checksum of the returned
15303    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
15304    /// An integrity check of
15305    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15306    /// can be performed by computing the CRC32C checksum of
15307    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15308    /// and comparing your results to this field. Discard the response in case of
15309    /// non-matching checksum values, and perform a limited number of retries. A
15310    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15311    /// checksum. Note: This field is defined as int64 for reasons of compatibility
15312    /// across different languages. However, it is a non-negative integer, which
15313    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15314    /// languages that support this type.
15315    ///
15316    /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
15317    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15318
15319    /// Integrity verification field. A flag indicating whether
15320    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
15321    /// was received by
15322    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15323    /// for the integrity verification of the
15324    /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
15325    /// false value of this field indicates either that
15326    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
15327    /// was left unset or that it was not delivered to
15328    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15329    /// set
15330    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
15331    /// but this field is still false, discard the response and perform a limited
15332    /// number of retries.
15333    ///
15334    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
15335    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
15336    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15337    pub verified_ciphertext_crc32c: bool,
15338
15339    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15340    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15341    /// decryption.
15342    ///
15343    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15344    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15345    pub protection_level: crate::model::ProtectionLevel,
15346
15347    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15348}
15349
15350impl AsymmetricDecryptResponse {
15351    pub fn new() -> Self {
15352        std::default::Default::default()
15353    }
15354
15355    /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
15356    ///
15357    /// # Example
15358    /// ```ignore,no_run
15359    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15360    /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15361    /// ```
15362    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15363        self.plaintext = v.into();
15364        self
15365    }
15366
15367    /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
15368    ///
15369    /// # Example
15370    /// ```ignore,no_run
15371    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15372    /// use wkt::Int64Value;
15373    /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15374    /// ```
15375    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15376    where
15377        T: std::convert::Into<wkt::Int64Value>,
15378    {
15379        self.plaintext_crc32c = std::option::Option::Some(v.into());
15380        self
15381    }
15382
15383    /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
15384    ///
15385    /// # Example
15386    /// ```ignore,no_run
15387    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15388    /// use wkt::Int64Value;
15389    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15390    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15391    /// ```
15392    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15393    where
15394        T: std::convert::Into<wkt::Int64Value>,
15395    {
15396        self.plaintext_crc32c = v.map(|x| x.into());
15397        self
15398    }
15399
15400    /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
15401    ///
15402    /// # Example
15403    /// ```ignore,no_run
15404    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15405    /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
15406    /// ```
15407    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15408        self.verified_ciphertext_crc32c = v.into();
15409        self
15410    }
15411
15412    /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
15413    ///
15414    /// # Example
15415    /// ```ignore,no_run
15416    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15417    /// use google_cloud_kms_v1::model::ProtectionLevel;
15418    /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15419    /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15420    /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
15421    /// ```
15422    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15423        mut self,
15424        v: T,
15425    ) -> Self {
15426        self.protection_level = v.into();
15427        self
15428    }
15429}
15430
15431impl wkt::message::Message for AsymmetricDecryptResponse {
15432    fn typename() -> &'static str {
15433        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
15434    }
15435}
15436
15437/// Response message for
15438/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
15439///
15440/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
15441#[derive(Clone, Default, PartialEq)]
15442#[non_exhaustive]
15443pub struct MacSignResponse {
15444    /// The resource name of the
15445    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15446    /// Check this field to verify that the intended resource was used for signing.
15447    ///
15448    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15449    pub name: std::string::String,
15450
15451    /// The created signature.
15452    pub mac: ::bytes::Bytes,
15453
15454    /// Integrity verification field. A CRC32C checksum of the returned
15455    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
15456    /// integrity check of
15457    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
15458    /// performed by computing the CRC32C checksum of
15459    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
15460    /// comparing your results to this field. Discard the response in case of
15461    /// non-matching checksum values, and perform a limited number of retries. A
15462    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15463    /// checksum. Note: This field is defined as int64 for reasons of compatibility
15464    /// across different languages. However, it is a non-negative integer, which
15465    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15466    /// languages that support this type.
15467    ///
15468    /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
15469    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
15470
15471    /// Integrity verification field. A flag indicating whether
15472    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
15473    /// was received by
15474    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15475    /// for the integrity verification of the
15476    /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
15477    /// field indicates either that
15478    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
15479    /// was left unset or that it was not delivered to
15480    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15481    /// set
15482    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
15483    /// but this field is still false, discard the response and perform a limited
15484    /// number of retries.
15485    ///
15486    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15487    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
15488    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
15489    pub verified_data_crc32c: bool,
15490
15491    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15492    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15493    ///
15494    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15495    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15496    pub protection_level: crate::model::ProtectionLevel,
15497
15498    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15499}
15500
15501impl MacSignResponse {
15502    pub fn new() -> Self {
15503        std::default::Default::default()
15504    }
15505
15506    /// Sets the value of [name][crate::model::MacSignResponse::name].
15507    ///
15508    /// # Example
15509    /// ```ignore,no_run
15510    /// # use google_cloud_kms_v1::model::MacSignResponse;
15511    /// let x = MacSignResponse::new().set_name("example");
15512    /// ```
15513    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15514        self.name = v.into();
15515        self
15516    }
15517
15518    /// Sets the value of [mac][crate::model::MacSignResponse::mac].
15519    ///
15520    /// # Example
15521    /// ```ignore,no_run
15522    /// # use google_cloud_kms_v1::model::MacSignResponse;
15523    /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
15524    /// ```
15525    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15526        self.mac = v.into();
15527        self
15528    }
15529
15530    /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
15531    ///
15532    /// # Example
15533    /// ```ignore,no_run
15534    /// # use google_cloud_kms_v1::model::MacSignResponse;
15535    /// use wkt::Int64Value;
15536    /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
15537    /// ```
15538    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
15539    where
15540        T: std::convert::Into<wkt::Int64Value>,
15541    {
15542        self.mac_crc32c = std::option::Option::Some(v.into());
15543        self
15544    }
15545
15546    /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
15547    ///
15548    /// # Example
15549    /// ```ignore,no_run
15550    /// # use google_cloud_kms_v1::model::MacSignResponse;
15551    /// use wkt::Int64Value;
15552    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
15553    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
15554    /// ```
15555    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15556    where
15557        T: std::convert::Into<wkt::Int64Value>,
15558    {
15559        self.mac_crc32c = v.map(|x| x.into());
15560        self
15561    }
15562
15563    /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
15564    ///
15565    /// # Example
15566    /// ```ignore,no_run
15567    /// # use google_cloud_kms_v1::model::MacSignResponse;
15568    /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
15569    /// ```
15570    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15571        self.verified_data_crc32c = v.into();
15572        self
15573    }
15574
15575    /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
15576    ///
15577    /// # Example
15578    /// ```ignore,no_run
15579    /// # use google_cloud_kms_v1::model::MacSignResponse;
15580    /// use google_cloud_kms_v1::model::ProtectionLevel;
15581    /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
15582    /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
15583    /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
15584    /// ```
15585    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15586        mut self,
15587        v: T,
15588    ) -> Self {
15589        self.protection_level = v.into();
15590        self
15591    }
15592}
15593
15594impl wkt::message::Message for MacSignResponse {
15595    fn typename() -> &'static str {
15596        "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
15597    }
15598}
15599
15600/// Response message for
15601/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
15602///
15603/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
15604#[derive(Clone, Default, PartialEq)]
15605#[non_exhaustive]
15606pub struct MacVerifyResponse {
15607    /// The resource name of the
15608    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
15609    /// verification. Check this field to verify that the intended resource was
15610    /// used for verification.
15611    ///
15612    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15613    pub name: std::string::String,
15614
15615    /// This field indicates whether or not the verification operation for
15616    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
15617    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
15618    /// successful.
15619    ///
15620    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
15621    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
15622    pub success: bool,
15623
15624    /// Integrity verification field. A flag indicating whether
15625    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
15626    /// was received by
15627    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15628    /// for the integrity verification of the
15629    /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
15630    /// field indicates either that
15631    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
15632    /// was left unset or that it was not delivered to
15633    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15634    /// set
15635    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
15636    /// but this field is still false, discard the response and perform a limited
15637    /// number of retries.
15638    ///
15639    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15640    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
15641    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
15642    pub verified_data_crc32c: bool,
15643
15644    /// Integrity verification field. A flag indicating whether
15645    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
15646    /// was received by
15647    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15648    /// for the integrity verification of the
15649    /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
15650    /// field indicates either that
15651    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
15652    /// was left unset or that it was not delivered to
15653    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15654    /// set
15655    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
15656    /// but this field is still false, discard the response and perform a limited
15657    /// number of retries.
15658    ///
15659    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15660    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
15661    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
15662    pub verified_mac_crc32c: bool,
15663
15664    /// Integrity verification field. This value is used for the integrity
15665    /// verification of [MacVerifyResponse.success]. If the value of this field
15666    /// contradicts the value of [MacVerifyResponse.success], discard the response
15667    /// and perform a limited number of retries.
15668    pub verified_success_integrity: bool,
15669
15670    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15671    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
15672    /// verification.
15673    ///
15674    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15675    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15676    pub protection_level: crate::model::ProtectionLevel,
15677
15678    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15679}
15680
15681impl MacVerifyResponse {
15682    pub fn new() -> Self {
15683        std::default::Default::default()
15684    }
15685
15686    /// Sets the value of [name][crate::model::MacVerifyResponse::name].
15687    ///
15688    /// # Example
15689    /// ```ignore,no_run
15690    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
15691    /// let x = MacVerifyResponse::new().set_name("example");
15692    /// ```
15693    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15694        self.name = v.into();
15695        self
15696    }
15697
15698    /// Sets the value of [success][crate::model::MacVerifyResponse::success].
15699    ///
15700    /// # Example
15701    /// ```ignore,no_run
15702    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
15703    /// let x = MacVerifyResponse::new().set_success(true);
15704    /// ```
15705    pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15706        self.success = v.into();
15707        self
15708    }
15709
15710    /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
15711    ///
15712    /// # Example
15713    /// ```ignore,no_run
15714    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
15715    /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
15716    /// ```
15717    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15718        self.verified_data_crc32c = v.into();
15719        self
15720    }
15721
15722    /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
15723    ///
15724    /// # Example
15725    /// ```ignore,no_run
15726    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
15727    /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
15728    /// ```
15729    pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15730        self.verified_mac_crc32c = v.into();
15731        self
15732    }
15733
15734    /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
15735    ///
15736    /// # Example
15737    /// ```ignore,no_run
15738    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
15739    /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
15740    /// ```
15741    pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15742        self.verified_success_integrity = v.into();
15743        self
15744    }
15745
15746    /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
15747    ///
15748    /// # Example
15749    /// ```ignore,no_run
15750    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
15751    /// use google_cloud_kms_v1::model::ProtectionLevel;
15752    /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
15753    /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
15754    /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
15755    /// ```
15756    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15757        mut self,
15758        v: T,
15759    ) -> Self {
15760        self.protection_level = v.into();
15761        self
15762    }
15763}
15764
15765impl wkt::message::Message for MacVerifyResponse {
15766    fn typename() -> &'static str {
15767        "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
15768    }
15769}
15770
15771/// Response message for
15772/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
15773///
15774/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
15775#[derive(Clone, Default, PartialEq)]
15776#[non_exhaustive]
15777pub struct DecapsulateResponse {
15778    /// The resource name of the
15779    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
15780    /// decapsulation. Check this field to verify that the intended resource was
15781    /// used for decapsulation.
15782    ///
15783    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15784    pub name: std::string::String,
15785
15786    /// The decapsulated shared_secret originally encapsulated with the matching
15787    /// public key.
15788    pub shared_secret: ::bytes::Bytes,
15789
15790    /// Integrity verification field. A CRC32C checksum of the returned
15791    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
15792    /// An integrity check of
15793    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
15794    /// can be performed by computing the CRC32C checksum of
15795    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
15796    /// and comparing your results to this field. Discard the response in case of
15797    /// non-matching checksum values, and perform a limited number of retries. A
15798    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15799    /// checksum. Note: receiving this response message indicates that
15800    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15801    /// successfully decrypt the
15802    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
15803    /// field is defined as int64 for reasons of compatibility across different
15804    /// languages. However, it is a non-negative integer, which will never exceed
15805    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15806    /// this type.
15807    ///
15808    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
15809    /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
15810    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15811    pub shared_secret_crc32c: std::option::Option<i64>,
15812
15813    /// Integrity verification field. A flag indicating whether
15814    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
15815    /// was received by
15816    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15817    /// for the integrity verification of the
15818    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
15819    /// value of this field indicates either that
15820    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
15821    /// was left unset or that it was not delivered to
15822    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15823    /// set
15824    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
15825    /// but this field is still false, discard the response and perform a limited
15826    /// number of retries.
15827    ///
15828    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
15829    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
15830    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15831    pub verified_ciphertext_crc32c: bool,
15832
15833    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15834    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15835    /// decapsulation.
15836    ///
15837    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15838    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15839    pub protection_level: crate::model::ProtectionLevel,
15840
15841    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15842}
15843
15844impl DecapsulateResponse {
15845    pub fn new() -> Self {
15846        std::default::Default::default()
15847    }
15848
15849    /// Sets the value of [name][crate::model::DecapsulateResponse::name].
15850    ///
15851    /// # Example
15852    /// ```ignore,no_run
15853    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
15854    /// let x = DecapsulateResponse::new().set_name("example");
15855    /// ```
15856    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15857        self.name = v.into();
15858        self
15859    }
15860
15861    /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
15862    ///
15863    /// # Example
15864    /// ```ignore,no_run
15865    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
15866    /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
15867    /// ```
15868    pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15869        self.shared_secret = v.into();
15870        self
15871    }
15872
15873    /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
15874    ///
15875    /// # Example
15876    /// ```ignore,no_run
15877    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
15878    /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
15879    /// ```
15880    pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
15881    where
15882        T: std::convert::Into<i64>,
15883    {
15884        self.shared_secret_crc32c = std::option::Option::Some(v.into());
15885        self
15886    }
15887
15888    /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
15889    ///
15890    /// # Example
15891    /// ```ignore,no_run
15892    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
15893    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
15894    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
15895    /// ```
15896    pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15897    where
15898        T: std::convert::Into<i64>,
15899    {
15900        self.shared_secret_crc32c = v.map(|x| x.into());
15901        self
15902    }
15903
15904    /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
15905    ///
15906    /// # Example
15907    /// ```ignore,no_run
15908    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
15909    /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
15910    /// ```
15911    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15912        self.verified_ciphertext_crc32c = v.into();
15913        self
15914    }
15915
15916    /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
15917    ///
15918    /// # Example
15919    /// ```ignore,no_run
15920    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
15921    /// use google_cloud_kms_v1::model::ProtectionLevel;
15922    /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
15923    /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
15924    /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
15925    /// ```
15926    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15927        mut self,
15928        v: T,
15929    ) -> Self {
15930        self.protection_level = v.into();
15931        self
15932    }
15933}
15934
15935impl wkt::message::Message for DecapsulateResponse {
15936    fn typename() -> &'static str {
15937        "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
15938    }
15939}
15940
15941/// Response message for
15942/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
15943///
15944/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
15945#[derive(Clone, Default, PartialEq)]
15946#[non_exhaustive]
15947pub struct GenerateRandomBytesResponse {
15948    /// The generated data.
15949    pub data: ::bytes::Bytes,
15950
15951    /// Integrity verification field. A CRC32C checksum of the returned
15952    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
15953    /// An integrity check of
15954    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
15955    /// can be performed by computing the CRC32C checksum of
15956    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
15957    /// and comparing your results to this field. Discard the response in case of
15958    /// non-matching checksum values, and perform a limited number of retries. A
15959    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15960    /// checksum. Note: This field is defined as int64 for reasons of compatibility
15961    /// across different languages. However, it is a non-negative integer, which
15962    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15963    /// languages that support this type.
15964    ///
15965    /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
15966    pub data_crc32c: std::option::Option<wkt::Int64Value>,
15967
15968    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15969}
15970
15971impl GenerateRandomBytesResponse {
15972    pub fn new() -> Self {
15973        std::default::Default::default()
15974    }
15975
15976    /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
15977    ///
15978    /// # Example
15979    /// ```ignore,no_run
15980    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
15981    /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
15982    /// ```
15983    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15984        self.data = v.into();
15985        self
15986    }
15987
15988    /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
15989    ///
15990    /// # Example
15991    /// ```ignore,no_run
15992    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
15993    /// use wkt::Int64Value;
15994    /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
15995    /// ```
15996    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
15997    where
15998        T: std::convert::Into<wkt::Int64Value>,
15999    {
16000        self.data_crc32c = std::option::Option::Some(v.into());
16001        self
16002    }
16003
16004    /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16005    ///
16006    /// # Example
16007    /// ```ignore,no_run
16008    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16009    /// use wkt::Int64Value;
16010    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
16011    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
16012    /// ```
16013    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16014    where
16015        T: std::convert::Into<wkt::Int64Value>,
16016    {
16017        self.data_crc32c = v.map(|x| x.into());
16018        self
16019    }
16020}
16021
16022impl wkt::message::Message for GenerateRandomBytesResponse {
16023    fn typename() -> &'static str {
16024        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
16025    }
16026}
16027
16028/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
16029///
16030/// [google.cloud.kms.v1.Digest]: crate::model::Digest
16031#[derive(Clone, Default, PartialEq)]
16032#[non_exhaustive]
16033pub struct Digest {
16034    /// Required. The message digest.
16035    pub digest: std::option::Option<crate::model::digest::Digest>,
16036
16037    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16038}
16039
16040impl Digest {
16041    pub fn new() -> Self {
16042        std::default::Default::default()
16043    }
16044
16045    /// Sets the value of [digest][crate::model::Digest::digest].
16046    ///
16047    /// Note that all the setters affecting `digest` are mutually
16048    /// exclusive.
16049    ///
16050    /// # Example
16051    /// ```ignore,no_run
16052    /// # use google_cloud_kms_v1::model::Digest;
16053    /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
16054    /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
16055    /// ```
16056    pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
16057        mut self,
16058        v: T,
16059    ) -> Self {
16060        self.digest = v.into();
16061        self
16062    }
16063
16064    /// The value of [digest][crate::model::Digest::digest]
16065    /// if it holds a `Sha256`, `None` if the field is not set or
16066    /// holds a different branch.
16067    pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
16068        #[allow(unreachable_patterns)]
16069        self.digest.as_ref().and_then(|v| match v {
16070            crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
16071            _ => std::option::Option::None,
16072        })
16073    }
16074
16075    /// Sets the value of [digest][crate::model::Digest::digest]
16076    /// to hold a `Sha256`.
16077    ///
16078    /// Note that all the setters affecting `digest` are
16079    /// mutually exclusive.
16080    ///
16081    /// # Example
16082    /// ```ignore,no_run
16083    /// # use google_cloud_kms_v1::model::Digest;
16084    /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
16085    /// assert!(x.sha256().is_some());
16086    /// assert!(x.sha384().is_none());
16087    /// assert!(x.sha512().is_none());
16088    /// ```
16089    pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16090        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
16091        self
16092    }
16093
16094    /// The value of [digest][crate::model::Digest::digest]
16095    /// if it holds a `Sha384`, `None` if the field is not set or
16096    /// holds a different branch.
16097    pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
16098        #[allow(unreachable_patterns)]
16099        self.digest.as_ref().and_then(|v| match v {
16100            crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
16101            _ => std::option::Option::None,
16102        })
16103    }
16104
16105    /// Sets the value of [digest][crate::model::Digest::digest]
16106    /// to hold a `Sha384`.
16107    ///
16108    /// Note that all the setters affecting `digest` are
16109    /// mutually exclusive.
16110    ///
16111    /// # Example
16112    /// ```ignore,no_run
16113    /// # use google_cloud_kms_v1::model::Digest;
16114    /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
16115    /// assert!(x.sha384().is_some());
16116    /// assert!(x.sha256().is_none());
16117    /// assert!(x.sha512().is_none());
16118    /// ```
16119    pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16120        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
16121        self
16122    }
16123
16124    /// The value of [digest][crate::model::Digest::digest]
16125    /// if it holds a `Sha512`, `None` if the field is not set or
16126    /// holds a different branch.
16127    pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
16128        #[allow(unreachable_patterns)]
16129        self.digest.as_ref().and_then(|v| match v {
16130            crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
16131            _ => std::option::Option::None,
16132        })
16133    }
16134
16135    /// Sets the value of [digest][crate::model::Digest::digest]
16136    /// to hold a `Sha512`.
16137    ///
16138    /// Note that all the setters affecting `digest` are
16139    /// mutually exclusive.
16140    ///
16141    /// # Example
16142    /// ```ignore,no_run
16143    /// # use google_cloud_kms_v1::model::Digest;
16144    /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
16145    /// assert!(x.sha512().is_some());
16146    /// assert!(x.sha256().is_none());
16147    /// assert!(x.sha384().is_none());
16148    /// ```
16149    pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16150        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
16151        self
16152    }
16153}
16154
16155impl wkt::message::Message for Digest {
16156    fn typename() -> &'static str {
16157        "type.googleapis.com/google.cloud.kms.v1.Digest"
16158    }
16159}
16160
16161/// Defines additional types related to [Digest].
16162pub mod digest {
16163    #[allow(unused_imports)]
16164    use super::*;
16165
16166    /// Required. The message digest.
16167    #[derive(Clone, Debug, PartialEq)]
16168    #[non_exhaustive]
16169    pub enum Digest {
16170        /// A message digest produced with the SHA-256 algorithm.
16171        Sha256(::bytes::Bytes),
16172        /// A message digest produced with the SHA-384 algorithm.
16173        Sha384(::bytes::Bytes),
16174        /// A message digest produced with the SHA-512 algorithm.
16175        Sha512(::bytes::Bytes),
16176    }
16177}
16178
16179/// Cloud KMS metadata for the given
16180/// [google.cloud.location.Location][google.cloud.location.Location].
16181///
16182/// [google.cloud.location.Location]: location::model::Location
16183#[derive(Clone, Default, PartialEq)]
16184#[non_exhaustive]
16185pub struct LocationMetadata {
16186    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16187    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16188    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
16189    /// location.
16190    ///
16191    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16192    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16193    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
16194    pub hsm_available: bool,
16195
16196    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16197    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16198    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
16199    /// this location.
16200    ///
16201    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16202    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16203    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
16204    pub ekm_available: bool,
16205
16206    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16207    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16208    /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
16209    /// can be created in this location.
16210    ///
16211    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16212    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16213    /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
16214    pub hsm_single_tenant_available: bool,
16215
16216    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16217}
16218
16219impl LocationMetadata {
16220    pub fn new() -> Self {
16221        std::default::Default::default()
16222    }
16223
16224    /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
16225    ///
16226    /// # Example
16227    /// ```ignore,no_run
16228    /// # use google_cloud_kms_v1::model::LocationMetadata;
16229    /// let x = LocationMetadata::new().set_hsm_available(true);
16230    /// ```
16231    pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16232        self.hsm_available = v.into();
16233        self
16234    }
16235
16236    /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
16237    ///
16238    /// # Example
16239    /// ```ignore,no_run
16240    /// # use google_cloud_kms_v1::model::LocationMetadata;
16241    /// let x = LocationMetadata::new().set_ekm_available(true);
16242    /// ```
16243    pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16244        self.ekm_available = v.into();
16245        self
16246    }
16247
16248    /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
16249    ///
16250    /// # Example
16251    /// ```ignore,no_run
16252    /// # use google_cloud_kms_v1::model::LocationMetadata;
16253    /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
16254    /// ```
16255    pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16256        self.hsm_single_tenant_available = v.into();
16257        self
16258    }
16259}
16260
16261impl wkt::message::Message for LocationMetadata {
16262    fn typename() -> &'static str {
16263        "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
16264    }
16265}
16266
16267/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
16268/// cryptographic operations are performed. For more information, see [Protection
16269/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
16270///
16271/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16272///
16273/// # Working with unknown values
16274///
16275/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16276/// additional enum variants at any time. Adding new variants is not considered
16277/// a breaking change. Applications should write their code in anticipation of:
16278///
16279/// - New values appearing in future releases of the client library, **and**
16280/// - New values received dynamically, without application changes.
16281///
16282/// Please consult the [Working with enums] section in the user guide for some
16283/// guidelines.
16284///
16285/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16286#[derive(Clone, Debug, PartialEq)]
16287#[non_exhaustive]
16288pub enum ProtectionLevel {
16289    /// Not specified.
16290    Unspecified,
16291    /// Crypto operations are performed in software.
16292    Software,
16293    /// Crypto operations are performed in a Hardware Security Module.
16294    Hsm,
16295    /// Crypto operations are performed by an external key manager.
16296    External,
16297    /// Crypto operations are performed in an EKM-over-VPC backend.
16298    ExternalVpc,
16299    /// Crypto operations are performed in a single-tenant HSM.
16300    HsmSingleTenant,
16301    /// If set, the enum was initialized with an unknown value.
16302    ///
16303    /// Applications can examine the value using [ProtectionLevel::value] or
16304    /// [ProtectionLevel::name].
16305    UnknownValue(protection_level::UnknownValue),
16306}
16307
16308#[doc(hidden)]
16309pub mod protection_level {
16310    #[allow(unused_imports)]
16311    use super::*;
16312    #[derive(Clone, Debug, PartialEq)]
16313    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16314}
16315
16316impl ProtectionLevel {
16317    /// Gets the enum value.
16318    ///
16319    /// Returns `None` if the enum contains an unknown value deserialized from
16320    /// the string representation of enums.
16321    pub fn value(&self) -> std::option::Option<i32> {
16322        match self {
16323            Self::Unspecified => std::option::Option::Some(0),
16324            Self::Software => std::option::Option::Some(1),
16325            Self::Hsm => std::option::Option::Some(2),
16326            Self::External => std::option::Option::Some(3),
16327            Self::ExternalVpc => std::option::Option::Some(4),
16328            Self::HsmSingleTenant => std::option::Option::Some(5),
16329            Self::UnknownValue(u) => u.0.value(),
16330        }
16331    }
16332
16333    /// Gets the enum value as a string.
16334    ///
16335    /// Returns `None` if the enum contains an unknown value deserialized from
16336    /// the integer representation of enums.
16337    pub fn name(&self) -> std::option::Option<&str> {
16338        match self {
16339            Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
16340            Self::Software => std::option::Option::Some("SOFTWARE"),
16341            Self::Hsm => std::option::Option::Some("HSM"),
16342            Self::External => std::option::Option::Some("EXTERNAL"),
16343            Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
16344            Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
16345            Self::UnknownValue(u) => u.0.name(),
16346        }
16347    }
16348}
16349
16350impl std::default::Default for ProtectionLevel {
16351    fn default() -> Self {
16352        use std::convert::From;
16353        Self::from(0)
16354    }
16355}
16356
16357impl std::fmt::Display for ProtectionLevel {
16358    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16359        wkt::internal::display_enum(f, self.name(), self.value())
16360    }
16361}
16362
16363impl std::convert::From<i32> for ProtectionLevel {
16364    fn from(value: i32) -> Self {
16365        match value {
16366            0 => Self::Unspecified,
16367            1 => Self::Software,
16368            2 => Self::Hsm,
16369            3 => Self::External,
16370            4 => Self::ExternalVpc,
16371            5 => Self::HsmSingleTenant,
16372            _ => Self::UnknownValue(protection_level::UnknownValue(
16373                wkt::internal::UnknownEnumValue::Integer(value),
16374            )),
16375        }
16376    }
16377}
16378
16379impl std::convert::From<&str> for ProtectionLevel {
16380    fn from(value: &str) -> Self {
16381        use std::string::ToString;
16382        match value {
16383            "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
16384            "SOFTWARE" => Self::Software,
16385            "HSM" => Self::Hsm,
16386            "EXTERNAL" => Self::External,
16387            "EXTERNAL_VPC" => Self::ExternalVpc,
16388            "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
16389            _ => Self::UnknownValue(protection_level::UnknownValue(
16390                wkt::internal::UnknownEnumValue::String(value.to_string()),
16391            )),
16392        }
16393    }
16394}
16395
16396impl serde::ser::Serialize for ProtectionLevel {
16397    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16398    where
16399        S: serde::Serializer,
16400    {
16401        match self {
16402            Self::Unspecified => serializer.serialize_i32(0),
16403            Self::Software => serializer.serialize_i32(1),
16404            Self::Hsm => serializer.serialize_i32(2),
16405            Self::External => serializer.serialize_i32(3),
16406            Self::ExternalVpc => serializer.serialize_i32(4),
16407            Self::HsmSingleTenant => serializer.serialize_i32(5),
16408            Self::UnknownValue(u) => u.0.serialize(serializer),
16409        }
16410    }
16411}
16412
16413impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
16414    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16415    where
16416        D: serde::Deserializer<'de>,
16417    {
16418        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
16419            ".google.cloud.kms.v1.ProtectionLevel",
16420        ))
16421    }
16422}
16423
16424/// Describes the reason for a data access. Please refer to
16425/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
16426/// for the detailed semantic meaning of justification reason codes.
16427///
16428/// # Working with unknown values
16429///
16430/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16431/// additional enum variants at any time. Adding new variants is not considered
16432/// a breaking change. Applications should write their code in anticipation of:
16433///
16434/// - New values appearing in future releases of the client library, **and**
16435/// - New values received dynamically, without application changes.
16436///
16437/// Please consult the [Working with enums] section in the user guide for some
16438/// guidelines.
16439///
16440/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16441#[derive(Clone, Debug, PartialEq)]
16442#[non_exhaustive]
16443pub enum AccessReason {
16444    /// Unspecified access reason.
16445    ReasonUnspecified,
16446    /// Customer-initiated support.
16447    CustomerInitiatedSupport,
16448    /// Google-initiated access for system management and troubleshooting.
16449    GoogleInitiatedService,
16450    /// Google-initiated access in response to a legal request or legal process.
16451    ThirdPartyDataRequest,
16452    /// Google-initiated access for security, fraud, abuse, or compliance purposes.
16453    GoogleInitiatedReview,
16454    /// Customer uses their account to perform any access to their own data which
16455    /// their IAM policy authorizes.
16456    CustomerInitiatedAccess,
16457    /// Google systems access customer data to help optimize the structure of the
16458    /// data or quality for future uses by the customer.
16459    GoogleInitiatedSystemOperation,
16460    /// No reason is expected for this key request.
16461    ReasonNotExpected,
16462    /// Deprecated: This code is no longer generated by
16463    /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
16464    /// available in both Key Access Justifications and Access Transparency logs
16465    /// provide customer-visible signals of emergency access in more precise
16466    /// contexts.
16467    ///
16468    /// Customer uses their account to perform any access to their own data which
16469    /// their IAM policy authorizes, and one of the following is true:
16470    ///
16471    /// * A Google administrator has reset the root-access account associated with
16472    ///   the user's organization within the past 7 days.
16473    /// * A Google-initiated emergency access operation has interacted with a
16474    ///   resource in the same project or folder as the currently accessed resource
16475    ///   within the past 7 days.
16476    #[deprecated]
16477    ModifiedCustomerInitiatedAccess,
16478    /// Deprecated: This code is no longer generated by
16479    /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
16480    /// available in both Key Access Justifications and Access Transparency logs
16481    /// provide customer-visible signals of emergency access in more precise
16482    /// contexts.
16483    ///
16484    /// Google systems access customer data to help optimize the structure of the
16485    /// data or quality for future uses by the customer, and one of the following
16486    /// is true:
16487    ///
16488    /// * A Google administrator has reset the root-access account associated with
16489    ///   the user's organization within the past 7 days.
16490    /// * A Google-initiated emergency access operation has interacted with a
16491    ///   resource in the same project or folder as the currently accessed resource
16492    ///   within the past 7 days.
16493    #[deprecated]
16494    ModifiedGoogleInitiatedSystemOperation,
16495    /// Google-initiated access to maintain system reliability.
16496    GoogleResponseToProductionAlert,
16497    /// One of the following operations is being executed while simultaneously
16498    /// encountering an internal technical issue which prevented a more precise
16499    /// justification code from being generated:
16500    ///
16501    /// * Your account has been used to perform any access to your own data which
16502    ///   your IAM policy authorizes.
16503    /// * An automated Google system operates on encrypted customer data which your
16504    ///   IAM policy authorizes.
16505    /// * Customer-initiated Google support access.
16506    /// * Google-initiated support access to protect system reliability.
16507    CustomerAuthorizedWorkflowServicing,
16508    /// If set, the enum was initialized with an unknown value.
16509    ///
16510    /// Applications can examine the value using [AccessReason::value] or
16511    /// [AccessReason::name].
16512    UnknownValue(access_reason::UnknownValue),
16513}
16514
16515#[doc(hidden)]
16516pub mod access_reason {
16517    #[allow(unused_imports)]
16518    use super::*;
16519    #[derive(Clone, Debug, PartialEq)]
16520    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16521}
16522
16523impl AccessReason {
16524    /// Gets the enum value.
16525    ///
16526    /// Returns `None` if the enum contains an unknown value deserialized from
16527    /// the string representation of enums.
16528    pub fn value(&self) -> std::option::Option<i32> {
16529        match self {
16530            Self::ReasonUnspecified => std::option::Option::Some(0),
16531            Self::CustomerInitiatedSupport => std::option::Option::Some(1),
16532            Self::GoogleInitiatedService => std::option::Option::Some(2),
16533            Self::ThirdPartyDataRequest => std::option::Option::Some(3),
16534            Self::GoogleInitiatedReview => std::option::Option::Some(4),
16535            Self::CustomerInitiatedAccess => std::option::Option::Some(5),
16536            Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
16537            Self::ReasonNotExpected => std::option::Option::Some(7),
16538            Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
16539            Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
16540            Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
16541            Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
16542            Self::UnknownValue(u) => u.0.value(),
16543        }
16544    }
16545
16546    /// Gets the enum value as a string.
16547    ///
16548    /// Returns `None` if the enum contains an unknown value deserialized from
16549    /// the integer representation of enums.
16550    pub fn name(&self) -> std::option::Option<&str> {
16551        match self {
16552            Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
16553            Self::CustomerInitiatedSupport => {
16554                std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
16555            }
16556            Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
16557            Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
16558            Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
16559            Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
16560            Self::GoogleInitiatedSystemOperation => {
16561                std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
16562            }
16563            Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
16564            Self::ModifiedCustomerInitiatedAccess => {
16565                std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
16566            }
16567            Self::ModifiedGoogleInitiatedSystemOperation => {
16568                std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
16569            }
16570            Self::GoogleResponseToProductionAlert => {
16571                std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
16572            }
16573            Self::CustomerAuthorizedWorkflowServicing => {
16574                std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
16575            }
16576            Self::UnknownValue(u) => u.0.name(),
16577        }
16578    }
16579}
16580
16581impl std::default::Default for AccessReason {
16582    fn default() -> Self {
16583        use std::convert::From;
16584        Self::from(0)
16585    }
16586}
16587
16588impl std::fmt::Display for AccessReason {
16589    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16590        wkt::internal::display_enum(f, self.name(), self.value())
16591    }
16592}
16593
16594impl std::convert::From<i32> for AccessReason {
16595    fn from(value: i32) -> Self {
16596        match value {
16597            0 => Self::ReasonUnspecified,
16598            1 => Self::CustomerInitiatedSupport,
16599            2 => Self::GoogleInitiatedService,
16600            3 => Self::ThirdPartyDataRequest,
16601            4 => Self::GoogleInitiatedReview,
16602            5 => Self::CustomerInitiatedAccess,
16603            6 => Self::GoogleInitiatedSystemOperation,
16604            7 => Self::ReasonNotExpected,
16605            8 => Self::ModifiedCustomerInitiatedAccess,
16606            9 => Self::ModifiedGoogleInitiatedSystemOperation,
16607            10 => Self::GoogleResponseToProductionAlert,
16608            11 => Self::CustomerAuthorizedWorkflowServicing,
16609            _ => Self::UnknownValue(access_reason::UnknownValue(
16610                wkt::internal::UnknownEnumValue::Integer(value),
16611            )),
16612        }
16613    }
16614}
16615
16616impl std::convert::From<&str> for AccessReason {
16617    fn from(value: &str) -> Self {
16618        use std::string::ToString;
16619        match value {
16620            "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
16621            "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
16622            "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
16623            "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
16624            "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
16625            "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
16626            "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
16627            "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
16628            "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
16629            "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
16630                Self::ModifiedGoogleInitiatedSystemOperation
16631            }
16632            "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
16633            "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
16634            _ => Self::UnknownValue(access_reason::UnknownValue(
16635                wkt::internal::UnknownEnumValue::String(value.to_string()),
16636            )),
16637        }
16638    }
16639}
16640
16641impl serde::ser::Serialize for AccessReason {
16642    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16643    where
16644        S: serde::Serializer,
16645    {
16646        match self {
16647            Self::ReasonUnspecified => serializer.serialize_i32(0),
16648            Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
16649            Self::GoogleInitiatedService => serializer.serialize_i32(2),
16650            Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
16651            Self::GoogleInitiatedReview => serializer.serialize_i32(4),
16652            Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
16653            Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
16654            Self::ReasonNotExpected => serializer.serialize_i32(7),
16655            Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
16656            Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
16657            Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
16658            Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
16659            Self::UnknownValue(u) => u.0.serialize(serializer),
16660        }
16661    }
16662}
16663
16664impl<'de> serde::de::Deserialize<'de> for AccessReason {
16665    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16666    where
16667        D: serde::Deserializer<'de>,
16668    {
16669        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
16670            ".google.cloud.kms.v1.AccessReason",
16671        ))
16672    }
16673}