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 [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
2394/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
2395///
2396/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2397/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
2398#[derive(Clone, Default, PartialEq)]
2399#[non_exhaustive]
2400pub struct KeyRing {
2401    /// Output only. The resource name for the
2402    /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
2403    /// `projects/*/locations/*/keyRings/*`.
2404    ///
2405    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
2406    pub name: std::string::String,
2407
2408    /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
2409    /// was created.
2410    ///
2411    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
2412    pub create_time: std::option::Option<wkt::Timestamp>,
2413
2414    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2415}
2416
2417impl KeyRing {
2418    pub fn new() -> Self {
2419        std::default::Default::default()
2420    }
2421
2422    /// Sets the value of [name][crate::model::KeyRing::name].
2423    ///
2424    /// # Example
2425    /// ```ignore,no_run
2426    /// # use google_cloud_kms_v1::model::KeyRing;
2427    /// let x = KeyRing::new().set_name("example");
2428    /// ```
2429    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2430        self.name = v.into();
2431        self
2432    }
2433
2434    /// Sets the value of [create_time][crate::model::KeyRing::create_time].
2435    ///
2436    /// # Example
2437    /// ```ignore,no_run
2438    /// # use google_cloud_kms_v1::model::KeyRing;
2439    /// use wkt::Timestamp;
2440    /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
2441    /// ```
2442    pub fn set_create_time<T>(mut self, v: T) -> Self
2443    where
2444        T: std::convert::Into<wkt::Timestamp>,
2445    {
2446        self.create_time = std::option::Option::Some(v.into());
2447        self
2448    }
2449
2450    /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
2451    ///
2452    /// # Example
2453    /// ```ignore,no_run
2454    /// # use google_cloud_kms_v1::model::KeyRing;
2455    /// use wkt::Timestamp;
2456    /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2457    /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
2458    /// ```
2459    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2460    where
2461        T: std::convert::Into<wkt::Timestamp>,
2462    {
2463        self.create_time = v.map(|x| x.into());
2464        self
2465    }
2466}
2467
2468impl wkt::message::Message for KeyRing {
2469    fn typename() -> &'static str {
2470        "type.googleapis.com/google.cloud.kms.v1.KeyRing"
2471    }
2472}
2473
2474/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
2475/// can be used for cryptographic operations.
2476///
2477/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
2478/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
2479/// key material used in cryptographic operations.
2480///
2481/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2482/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2483#[derive(Clone, Default, PartialEq)]
2484#[non_exhaustive]
2485pub struct CryptoKey {
2486    /// Output only. The resource name for this
2487    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
2488    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
2489    ///
2490    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2491    pub name: std::string::String,
2492
2493    /// Output only. A copy of the "primary"
2494    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
2495    /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
2496    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
2497    /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
2498    ///
2499    /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
2500    /// updated via
2501    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
2502    ///
2503    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
2504    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
2505    /// may have a primary. For other keys, this field will be omitted.
2506    ///
2507    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2508    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
2509    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
2510    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2511    /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
2512    /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
2513    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
2514    pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
2515
2516    /// Immutable. The immutable purpose of this
2517    /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
2518    ///
2519    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2520    pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
2521
2522    /// Output only. The time at which this
2523    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
2524    ///
2525    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2526    pub create_time: std::option::Option<wkt::Timestamp>,
2527
2528    /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
2529    /// the Key Management Service will automatically:
2530    ///
2531    /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
2532    /// 1. Mark the new version as primary.
2533    ///
2534    /// Key rotations performed manually via
2535    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
2536    /// and
2537    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
2538    /// do not affect
2539    /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
2540    ///
2541    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
2542    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
2543    /// support automatic rotation. For other keys, this field must be omitted.
2544    ///
2545    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2546    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
2547    /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
2548    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
2549    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
2550    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
2551    pub next_rotation_time: std::option::Option<wkt::Timestamp>,
2552
2553    /// A template describing settings for new
2554    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
2555    /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2556    /// instances created by either
2557    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
2558    /// or auto-rotation are controlled by this template.
2559    ///
2560    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2561    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
2562    pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
2563
2564    /// Labels with user-defined metadata. For more information, see
2565    /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
2566    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2567
2568    /// Immutable. Whether this key may contain imported versions only.
2569    pub import_only: bool,
2570
2571    /// Immutable. The period of time that versions of this key spend in the
2572    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
2573    /// state before transitioning to
2574    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
2575    /// If not specified at creation time, the default duration is 30 days.
2576    ///
2577    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
2578    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
2579    pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
2580
2581    /// Immutable. The resource name of the backend environment where the key
2582    /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
2583    /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
2584    /// where all related cryptographic operations are performed. Only applicable
2585    /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
2586    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2587    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
2588    /// resource name in the format `projects/*/locations/*/ekmConnections/*`.
2589    /// Note, this list is non-exhaustive and may apply to additional
2590    /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
2591    ///
2592    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2593    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2594    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2595    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2596    pub crypto_key_backend: std::string::String,
2597
2598    /// Optional. The policy used for Key Access Justifications Policy Enforcement.
2599    /// If this field is present and this key is enrolled in Key Access
2600    /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
2601    /// decrypt, and sign operations, and the operation will fail if rejected by
2602    /// the policy. The policy is defined by specifying zero or more allowed
2603    /// justification codes.
2604    /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
2605    /// By default, this field is absent, and all justification codes are allowed.
2606    pub key_access_justifications_policy:
2607        std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
2608
2609    /// Controls the rate of automatic rotation.
2610    pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
2611
2612    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2613}
2614
2615impl CryptoKey {
2616    pub fn new() -> Self {
2617        std::default::Default::default()
2618    }
2619
2620    /// Sets the value of [name][crate::model::CryptoKey::name].
2621    ///
2622    /// # Example
2623    /// ```ignore,no_run
2624    /// # use google_cloud_kms_v1::model::CryptoKey;
2625    /// let x = CryptoKey::new().set_name("example");
2626    /// ```
2627    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2628        self.name = v.into();
2629        self
2630    }
2631
2632    /// Sets the value of [primary][crate::model::CryptoKey::primary].
2633    ///
2634    /// # Example
2635    /// ```ignore,no_run
2636    /// # use google_cloud_kms_v1::model::CryptoKey;
2637    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
2638    /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
2639    /// ```
2640    pub fn set_primary<T>(mut self, v: T) -> Self
2641    where
2642        T: std::convert::Into<crate::model::CryptoKeyVersion>,
2643    {
2644        self.primary = std::option::Option::Some(v.into());
2645        self
2646    }
2647
2648    /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
2649    ///
2650    /// # Example
2651    /// ```ignore,no_run
2652    /// # use google_cloud_kms_v1::model::CryptoKey;
2653    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
2654    /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
2655    /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
2656    /// ```
2657    pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
2658    where
2659        T: std::convert::Into<crate::model::CryptoKeyVersion>,
2660    {
2661        self.primary = v.map(|x| x.into());
2662        self
2663    }
2664
2665    /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
2666    ///
2667    /// # Example
2668    /// ```ignore,no_run
2669    /// # use google_cloud_kms_v1::model::CryptoKey;
2670    /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
2671    /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
2672    /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
2673    /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
2674    /// ```
2675    pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
2676        mut self,
2677        v: T,
2678    ) -> Self {
2679        self.purpose = v.into();
2680        self
2681    }
2682
2683    /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
2684    ///
2685    /// # Example
2686    /// ```ignore,no_run
2687    /// # use google_cloud_kms_v1::model::CryptoKey;
2688    /// use wkt::Timestamp;
2689    /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
2690    /// ```
2691    pub fn set_create_time<T>(mut self, v: T) -> Self
2692    where
2693        T: std::convert::Into<wkt::Timestamp>,
2694    {
2695        self.create_time = std::option::Option::Some(v.into());
2696        self
2697    }
2698
2699    /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
2700    ///
2701    /// # Example
2702    /// ```ignore,no_run
2703    /// # use google_cloud_kms_v1::model::CryptoKey;
2704    /// use wkt::Timestamp;
2705    /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2706    /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
2707    /// ```
2708    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2709    where
2710        T: std::convert::Into<wkt::Timestamp>,
2711    {
2712        self.create_time = v.map(|x| x.into());
2713        self
2714    }
2715
2716    /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
2717    ///
2718    /// # Example
2719    /// ```ignore,no_run
2720    /// # use google_cloud_kms_v1::model::CryptoKey;
2721    /// use wkt::Timestamp;
2722    /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
2723    /// ```
2724    pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
2725    where
2726        T: std::convert::Into<wkt::Timestamp>,
2727    {
2728        self.next_rotation_time = std::option::Option::Some(v.into());
2729        self
2730    }
2731
2732    /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
2733    ///
2734    /// # Example
2735    /// ```ignore,no_run
2736    /// # use google_cloud_kms_v1::model::CryptoKey;
2737    /// use wkt::Timestamp;
2738    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
2739    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
2740    /// ```
2741    pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
2742    where
2743        T: std::convert::Into<wkt::Timestamp>,
2744    {
2745        self.next_rotation_time = v.map(|x| x.into());
2746        self
2747    }
2748
2749    /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
2750    ///
2751    /// # Example
2752    /// ```ignore,no_run
2753    /// # use google_cloud_kms_v1::model::CryptoKey;
2754    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
2755    /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
2756    /// ```
2757    pub fn set_version_template<T>(mut self, v: T) -> Self
2758    where
2759        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
2760    {
2761        self.version_template = std::option::Option::Some(v.into());
2762        self
2763    }
2764
2765    /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
2766    ///
2767    /// # Example
2768    /// ```ignore,no_run
2769    /// # use google_cloud_kms_v1::model::CryptoKey;
2770    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
2771    /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
2772    /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
2773    /// ```
2774    pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
2775    where
2776        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
2777    {
2778        self.version_template = v.map(|x| x.into());
2779        self
2780    }
2781
2782    /// Sets the value of [labels][crate::model::CryptoKey::labels].
2783    ///
2784    /// # Example
2785    /// ```ignore,no_run
2786    /// # use google_cloud_kms_v1::model::CryptoKey;
2787    /// let x = CryptoKey::new().set_labels([
2788    ///     ("key0", "abc"),
2789    ///     ("key1", "xyz"),
2790    /// ]);
2791    /// ```
2792    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2793    where
2794        T: std::iter::IntoIterator<Item = (K, V)>,
2795        K: std::convert::Into<std::string::String>,
2796        V: std::convert::Into<std::string::String>,
2797    {
2798        use std::iter::Iterator;
2799        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2800        self
2801    }
2802
2803    /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
2804    ///
2805    /// # Example
2806    /// ```ignore,no_run
2807    /// # use google_cloud_kms_v1::model::CryptoKey;
2808    /// let x = CryptoKey::new().set_import_only(true);
2809    /// ```
2810    pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2811        self.import_only = v.into();
2812        self
2813    }
2814
2815    /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
2816    ///
2817    /// # Example
2818    /// ```ignore,no_run
2819    /// # use google_cloud_kms_v1::model::CryptoKey;
2820    /// use wkt::Duration;
2821    /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
2822    /// ```
2823    pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
2824    where
2825        T: std::convert::Into<wkt::Duration>,
2826    {
2827        self.destroy_scheduled_duration = std::option::Option::Some(v.into());
2828        self
2829    }
2830
2831    /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
2832    ///
2833    /// # Example
2834    /// ```ignore,no_run
2835    /// # use google_cloud_kms_v1::model::CryptoKey;
2836    /// use wkt::Duration;
2837    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
2838    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
2839    /// ```
2840    pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
2841    where
2842        T: std::convert::Into<wkt::Duration>,
2843    {
2844        self.destroy_scheduled_duration = v.map(|x| x.into());
2845        self
2846    }
2847
2848    /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
2849    ///
2850    /// # Example
2851    /// ```ignore,no_run
2852    /// # use google_cloud_kms_v1::model::CryptoKey;
2853    /// let x = CryptoKey::new().set_crypto_key_backend("example");
2854    /// ```
2855    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
2856        mut self,
2857        v: T,
2858    ) -> Self {
2859        self.crypto_key_backend = v.into();
2860        self
2861    }
2862
2863    /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
2864    ///
2865    /// # Example
2866    /// ```ignore,no_run
2867    /// # use google_cloud_kms_v1::model::CryptoKey;
2868    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
2869    /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
2870    /// ```
2871    pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
2872    where
2873        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
2874    {
2875        self.key_access_justifications_policy = std::option::Option::Some(v.into());
2876        self
2877    }
2878
2879    /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
2880    ///
2881    /// # Example
2882    /// ```ignore,no_run
2883    /// # use google_cloud_kms_v1::model::CryptoKey;
2884    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
2885    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
2886    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
2887    /// ```
2888    pub fn set_or_clear_key_access_justifications_policy<T>(
2889        mut self,
2890        v: std::option::Option<T>,
2891    ) -> Self
2892    where
2893        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
2894    {
2895        self.key_access_justifications_policy = v.map(|x| x.into());
2896        self
2897    }
2898
2899    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
2900    ///
2901    /// Note that all the setters affecting `rotation_schedule` are mutually
2902    /// exclusive.
2903    ///
2904    /// # Example
2905    /// ```ignore,no_run
2906    /// # use google_cloud_kms_v1::model::CryptoKey;
2907    /// use wkt::Duration;
2908    /// let x = CryptoKey::new().set_rotation_schedule(Some(
2909    ///     google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
2910    /// ```
2911    pub fn set_rotation_schedule<
2912        T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
2913    >(
2914        mut self,
2915        v: T,
2916    ) -> Self {
2917        self.rotation_schedule = v.into();
2918        self
2919    }
2920
2921    /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
2922    /// if it holds a `RotationPeriod`, `None` if the field is not set or
2923    /// holds a different branch.
2924    pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
2925        #[allow(unreachable_patterns)]
2926        self.rotation_schedule.as_ref().and_then(|v| match v {
2927            crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
2928                std::option::Option::Some(v)
2929            }
2930            _ => std::option::Option::None,
2931        })
2932    }
2933
2934    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
2935    /// to hold a `RotationPeriod`.
2936    ///
2937    /// Note that all the setters affecting `rotation_schedule` are
2938    /// mutually exclusive.
2939    ///
2940    /// # Example
2941    /// ```ignore,no_run
2942    /// # use google_cloud_kms_v1::model::CryptoKey;
2943    /// use wkt::Duration;
2944    /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
2945    /// assert!(x.rotation_period().is_some());
2946    /// ```
2947    pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
2948        mut self,
2949        v: T,
2950    ) -> Self {
2951        self.rotation_schedule = std::option::Option::Some(
2952            crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
2953        );
2954        self
2955    }
2956}
2957
2958impl wkt::message::Message for CryptoKey {
2959    fn typename() -> &'static str {
2960        "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
2961    }
2962}
2963
2964/// Defines additional types related to [CryptoKey].
2965pub mod crypto_key {
2966    #[allow(unused_imports)]
2967    use super::*;
2968
2969    /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
2970    /// describes the cryptographic capabilities of a
2971    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
2972    /// for the operations allowed by its purpose. For more information, see [Key
2973    /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
2974    ///
2975    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2976    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
2977    ///
2978    /// # Working with unknown values
2979    ///
2980    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2981    /// additional enum variants at any time. Adding new variants is not considered
2982    /// a breaking change. Applications should write their code in anticipation of:
2983    ///
2984    /// - New values appearing in future releases of the client library, **and**
2985    /// - New values received dynamically, without application changes.
2986    ///
2987    /// Please consult the [Working with enums] section in the user guide for some
2988    /// guidelines.
2989    ///
2990    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2991    #[derive(Clone, Debug, PartialEq)]
2992    #[non_exhaustive]
2993    pub enum CryptoKeyPurpose {
2994        /// Not specified.
2995        Unspecified,
2996        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
2997        /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
2998        /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
2999        ///
3000        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3001        /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
3002        /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
3003        EncryptDecrypt,
3004        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
3005        /// with
3006        /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
3007        /// and
3008        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
3009        ///
3010        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3011        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
3012        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
3013        AsymmetricSign,
3014        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
3015        /// with
3016        /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
3017        /// and
3018        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
3019        ///
3020        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3021        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
3022        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
3023        AsymmetricDecrypt,
3024        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
3025        /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
3026        /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
3027        /// This purpose is meant to be used for interoperable symmetric
3028        /// encryption and does not support automatic CryptoKey rotation.
3029        ///
3030        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3031        /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
3032        /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
3033        RawEncryptDecrypt,
3034        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
3035        /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
3036        ///
3037        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3038        /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
3039        Mac,
3040        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
3041        /// with
3042        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
3043        /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
3044        ///
3045        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3046        /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
3047        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
3048        KeyEncapsulation,
3049        /// If set, the enum was initialized with an unknown value.
3050        ///
3051        /// Applications can examine the value using [CryptoKeyPurpose::value] or
3052        /// [CryptoKeyPurpose::name].
3053        UnknownValue(crypto_key_purpose::UnknownValue),
3054    }
3055
3056    #[doc(hidden)]
3057    pub mod crypto_key_purpose {
3058        #[allow(unused_imports)]
3059        use super::*;
3060        #[derive(Clone, Debug, PartialEq)]
3061        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3062    }
3063
3064    impl CryptoKeyPurpose {
3065        /// Gets the enum value.
3066        ///
3067        /// Returns `None` if the enum contains an unknown value deserialized from
3068        /// the string representation of enums.
3069        pub fn value(&self) -> std::option::Option<i32> {
3070            match self {
3071                Self::Unspecified => std::option::Option::Some(0),
3072                Self::EncryptDecrypt => std::option::Option::Some(1),
3073                Self::AsymmetricSign => std::option::Option::Some(5),
3074                Self::AsymmetricDecrypt => std::option::Option::Some(6),
3075                Self::RawEncryptDecrypt => std::option::Option::Some(7),
3076                Self::Mac => std::option::Option::Some(9),
3077                Self::KeyEncapsulation => std::option::Option::Some(10),
3078                Self::UnknownValue(u) => u.0.value(),
3079            }
3080        }
3081
3082        /// Gets the enum value as a string.
3083        ///
3084        /// Returns `None` if the enum contains an unknown value deserialized from
3085        /// the integer representation of enums.
3086        pub fn name(&self) -> std::option::Option<&str> {
3087            match self {
3088                Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
3089                Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
3090                Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
3091                Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
3092                Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
3093                Self::Mac => std::option::Option::Some("MAC"),
3094                Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
3095                Self::UnknownValue(u) => u.0.name(),
3096            }
3097        }
3098    }
3099
3100    impl std::default::Default for CryptoKeyPurpose {
3101        fn default() -> Self {
3102            use std::convert::From;
3103            Self::from(0)
3104        }
3105    }
3106
3107    impl std::fmt::Display for CryptoKeyPurpose {
3108        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3109            wkt::internal::display_enum(f, self.name(), self.value())
3110        }
3111    }
3112
3113    impl std::convert::From<i32> for CryptoKeyPurpose {
3114        fn from(value: i32) -> Self {
3115            match value {
3116                0 => Self::Unspecified,
3117                1 => Self::EncryptDecrypt,
3118                5 => Self::AsymmetricSign,
3119                6 => Self::AsymmetricDecrypt,
3120                7 => Self::RawEncryptDecrypt,
3121                9 => Self::Mac,
3122                10 => Self::KeyEncapsulation,
3123                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
3124                    wkt::internal::UnknownEnumValue::Integer(value),
3125                )),
3126            }
3127        }
3128    }
3129
3130    impl std::convert::From<&str> for CryptoKeyPurpose {
3131        fn from(value: &str) -> Self {
3132            use std::string::ToString;
3133            match value {
3134                "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
3135                "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
3136                "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
3137                "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
3138                "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
3139                "MAC" => Self::Mac,
3140                "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
3141                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
3142                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3143                )),
3144            }
3145        }
3146    }
3147
3148    impl serde::ser::Serialize for CryptoKeyPurpose {
3149        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3150        where
3151            S: serde::Serializer,
3152        {
3153            match self {
3154                Self::Unspecified => serializer.serialize_i32(0),
3155                Self::EncryptDecrypt => serializer.serialize_i32(1),
3156                Self::AsymmetricSign => serializer.serialize_i32(5),
3157                Self::AsymmetricDecrypt => serializer.serialize_i32(6),
3158                Self::RawEncryptDecrypt => serializer.serialize_i32(7),
3159                Self::Mac => serializer.serialize_i32(9),
3160                Self::KeyEncapsulation => serializer.serialize_i32(10),
3161                Self::UnknownValue(u) => u.0.serialize(serializer),
3162            }
3163        }
3164    }
3165
3166    impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
3167        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3168        where
3169            D: serde::Deserializer<'de>,
3170        {
3171            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
3172                ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
3173            ))
3174        }
3175    }
3176
3177    /// Controls the rate of automatic rotation.
3178    #[derive(Clone, Debug, PartialEq)]
3179    #[non_exhaustive]
3180    pub enum RotationSchedule {
3181        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
3182        /// will be advanced by this period when the service automatically rotates a
3183        /// key. Must be at least 24 hours and at most 876,000 hours.
3184        ///
3185        /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
3186        /// set,
3187        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
3188        /// must also be set.
3189        ///
3190        /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
3191        /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
3192        /// support automatic rotation. For other keys, this field must be omitted.
3193        ///
3194        /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
3195        /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
3196        /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
3197        /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
3198        RotationPeriod(std::boxed::Box<wkt::Duration>),
3199    }
3200}
3201
3202/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
3203/// specifies the properties to use when creating a new
3204/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
3205/// with
3206/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
3207/// or automatically as a result of auto-rotation.
3208///
3209/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3210/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
3211/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
3212#[derive(Clone, Default, PartialEq)]
3213#[non_exhaustive]
3214pub struct CryptoKeyVersionTemplate {
3215    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
3216    /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
3217    /// template. Immutable. Defaults to
3218    /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
3219    ///
3220    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3221    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
3222    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
3223    pub protection_level: crate::model::ProtectionLevel,
3224
3225    /// Required.
3226    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
3227    /// to use when creating a
3228    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
3229    /// template.
3230    ///
3231    /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
3232    /// this field is omitted and
3233    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
3234    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
3235    ///
3236    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
3237    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
3238    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3239    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
3240    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
3241
3242    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3243}
3244
3245impl CryptoKeyVersionTemplate {
3246    pub fn new() -> Self {
3247        std::default::Default::default()
3248    }
3249
3250    /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
3251    ///
3252    /// # Example
3253    /// ```ignore,no_run
3254    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
3255    /// use google_cloud_kms_v1::model::ProtectionLevel;
3256    /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
3257    /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
3258    /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
3259    /// ```
3260    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
3261        mut self,
3262        v: T,
3263    ) -> Self {
3264        self.protection_level = v.into();
3265        self
3266    }
3267
3268    /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
3269    ///
3270    /// # Example
3271    /// ```ignore,no_run
3272    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
3273    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
3274    /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
3275    /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
3276    /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
3277    /// ```
3278    pub fn set_algorithm<
3279        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
3280    >(
3281        mut self,
3282        v: T,
3283    ) -> Self {
3284        self.algorithm = v.into();
3285        self
3286    }
3287}
3288
3289impl wkt::message::Message for CryptoKeyVersionTemplate {
3290    fn typename() -> &'static str {
3291        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
3292    }
3293}
3294
3295/// Contains an HSM-generated attestation about a key operation. For more
3296/// information, see [Verifying attestations]
3297/// (<https://cloud.google.com/kms/docs/attest-key>).
3298#[derive(Clone, Default, PartialEq)]
3299#[non_exhaustive]
3300pub struct KeyOperationAttestation {
3301    /// Output only. The format of the attestation data.
3302    pub format: crate::model::key_operation_attestation::AttestationFormat,
3303
3304    /// Output only. The attestation data provided by the HSM when the key
3305    /// operation was performed.
3306    pub content: ::bytes::Bytes,
3307
3308    /// Output only. The certificate chains needed to validate the attestation
3309    pub cert_chains:
3310        std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
3311
3312    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3313}
3314
3315impl KeyOperationAttestation {
3316    pub fn new() -> Self {
3317        std::default::Default::default()
3318    }
3319
3320    /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
3321    ///
3322    /// # Example
3323    /// ```ignore,no_run
3324    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
3325    /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
3326    /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
3327    /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
3328    /// ```
3329    pub fn set_format<
3330        T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
3331    >(
3332        mut self,
3333        v: T,
3334    ) -> Self {
3335        self.format = v.into();
3336        self
3337    }
3338
3339    /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
3340    ///
3341    /// # Example
3342    /// ```ignore,no_run
3343    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
3344    /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
3345    /// ```
3346    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3347        self.content = v.into();
3348        self
3349    }
3350
3351    /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
3352    ///
3353    /// # Example
3354    /// ```ignore,no_run
3355    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
3356    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
3357    /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
3358    /// ```
3359    pub fn set_cert_chains<T>(mut self, v: T) -> Self
3360    where
3361        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
3362    {
3363        self.cert_chains = std::option::Option::Some(v.into());
3364        self
3365    }
3366
3367    /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
3368    ///
3369    /// # Example
3370    /// ```ignore,no_run
3371    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
3372    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
3373    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
3374    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
3375    /// ```
3376    pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
3377    where
3378        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
3379    {
3380        self.cert_chains = v.map(|x| x.into());
3381        self
3382    }
3383}
3384
3385impl wkt::message::Message for KeyOperationAttestation {
3386    fn typename() -> &'static str {
3387        "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
3388    }
3389}
3390
3391/// Defines additional types related to [KeyOperationAttestation].
3392pub mod key_operation_attestation {
3393    #[allow(unused_imports)]
3394    use super::*;
3395
3396    /// Certificate chains needed to verify the attestation.
3397    /// Certificates in chains are PEM-encoded and are ordered based on
3398    /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
3399    #[derive(Clone, Default, PartialEq)]
3400    #[non_exhaustive]
3401    pub struct CertificateChains {
3402        /// Cavium certificate chain corresponding to the attestation.
3403        pub cavium_certs: std::vec::Vec<std::string::String>,
3404
3405        /// Google card certificate chain corresponding to the attestation.
3406        pub google_card_certs: std::vec::Vec<std::string::String>,
3407
3408        /// Google partition certificate chain corresponding to the attestation.
3409        pub google_partition_certs: std::vec::Vec<std::string::String>,
3410
3411        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3412    }
3413
3414    impl CertificateChains {
3415        pub fn new() -> Self {
3416            std::default::Default::default()
3417        }
3418
3419        /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
3420        ///
3421        /// # Example
3422        /// ```ignore,no_run
3423        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
3424        /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
3425        /// ```
3426        pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
3427        where
3428            T: std::iter::IntoIterator<Item = V>,
3429            V: std::convert::Into<std::string::String>,
3430        {
3431            use std::iter::Iterator;
3432            self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
3433            self
3434        }
3435
3436        /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
3437        ///
3438        /// # Example
3439        /// ```ignore,no_run
3440        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
3441        /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
3442        /// ```
3443        pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
3444        where
3445            T: std::iter::IntoIterator<Item = V>,
3446            V: std::convert::Into<std::string::String>,
3447        {
3448            use std::iter::Iterator;
3449            self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
3450            self
3451        }
3452
3453        /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
3454        ///
3455        /// # Example
3456        /// ```ignore,no_run
3457        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
3458        /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
3459        /// ```
3460        pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
3461        where
3462            T: std::iter::IntoIterator<Item = V>,
3463            V: std::convert::Into<std::string::String>,
3464        {
3465            use std::iter::Iterator;
3466            self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
3467            self
3468        }
3469    }
3470
3471    impl wkt::message::Message for CertificateChains {
3472        fn typename() -> &'static str {
3473            "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
3474        }
3475    }
3476
3477    /// Attestation formats provided by the HSM.
3478    ///
3479    /// # Working with unknown values
3480    ///
3481    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3482    /// additional enum variants at any time. Adding new variants is not considered
3483    /// a breaking change. Applications should write their code in anticipation of:
3484    ///
3485    /// - New values appearing in future releases of the client library, **and**
3486    /// - New values received dynamically, without application changes.
3487    ///
3488    /// Please consult the [Working with enums] section in the user guide for some
3489    /// guidelines.
3490    ///
3491    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3492    #[derive(Clone, Debug, PartialEq)]
3493    #[non_exhaustive]
3494    pub enum AttestationFormat {
3495        /// Not specified.
3496        Unspecified,
3497        /// Cavium HSM attestation compressed with gzip. Note that this format is
3498        /// defined by Cavium and subject to change at any time.
3499        ///
3500        /// See
3501        /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
3502        CaviumV1Compressed,
3503        /// Cavium HSM attestation V2 compressed with gzip. This is a new format
3504        /// introduced in Cavium's version 3.2-08.
3505        CaviumV2Compressed,
3506        /// If set, the enum was initialized with an unknown value.
3507        ///
3508        /// Applications can examine the value using [AttestationFormat::value] or
3509        /// [AttestationFormat::name].
3510        UnknownValue(attestation_format::UnknownValue),
3511    }
3512
3513    #[doc(hidden)]
3514    pub mod attestation_format {
3515        #[allow(unused_imports)]
3516        use super::*;
3517        #[derive(Clone, Debug, PartialEq)]
3518        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3519    }
3520
3521    impl AttestationFormat {
3522        /// Gets the enum value.
3523        ///
3524        /// Returns `None` if the enum contains an unknown value deserialized from
3525        /// the string representation of enums.
3526        pub fn value(&self) -> std::option::Option<i32> {
3527            match self {
3528                Self::Unspecified => std::option::Option::Some(0),
3529                Self::CaviumV1Compressed => std::option::Option::Some(3),
3530                Self::CaviumV2Compressed => std::option::Option::Some(4),
3531                Self::UnknownValue(u) => u.0.value(),
3532            }
3533        }
3534
3535        /// Gets the enum value as a string.
3536        ///
3537        /// Returns `None` if the enum contains an unknown value deserialized from
3538        /// the integer representation of enums.
3539        pub fn name(&self) -> std::option::Option<&str> {
3540            match self {
3541                Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
3542                Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
3543                Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
3544                Self::UnknownValue(u) => u.0.name(),
3545            }
3546        }
3547    }
3548
3549    impl std::default::Default for AttestationFormat {
3550        fn default() -> Self {
3551            use std::convert::From;
3552            Self::from(0)
3553        }
3554    }
3555
3556    impl std::fmt::Display for AttestationFormat {
3557        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3558            wkt::internal::display_enum(f, self.name(), self.value())
3559        }
3560    }
3561
3562    impl std::convert::From<i32> for AttestationFormat {
3563        fn from(value: i32) -> Self {
3564            match value {
3565                0 => Self::Unspecified,
3566                3 => Self::CaviumV1Compressed,
3567                4 => Self::CaviumV2Compressed,
3568                _ => Self::UnknownValue(attestation_format::UnknownValue(
3569                    wkt::internal::UnknownEnumValue::Integer(value),
3570                )),
3571            }
3572        }
3573    }
3574
3575    impl std::convert::From<&str> for AttestationFormat {
3576        fn from(value: &str) -> Self {
3577            use std::string::ToString;
3578            match value {
3579                "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
3580                "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
3581                "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
3582                _ => Self::UnknownValue(attestation_format::UnknownValue(
3583                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3584                )),
3585            }
3586        }
3587    }
3588
3589    impl serde::ser::Serialize for AttestationFormat {
3590        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3591        where
3592            S: serde::Serializer,
3593        {
3594            match self {
3595                Self::Unspecified => serializer.serialize_i32(0),
3596                Self::CaviumV1Compressed => serializer.serialize_i32(3),
3597                Self::CaviumV2Compressed => serializer.serialize_i32(4),
3598                Self::UnknownValue(u) => u.0.serialize(serializer),
3599            }
3600        }
3601    }
3602
3603    impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
3604        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3605        where
3606            D: serde::Deserializer<'de>,
3607        {
3608            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
3609                ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
3610            ))
3611        }
3612    }
3613}
3614
3615/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
3616/// individual cryptographic key, and the associated key material.
3617///
3618/// An
3619/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
3620/// version can be used for cryptographic operations.
3621///
3622/// For security reasons, the raw cryptographic key material represented by a
3623/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
3624/// or exported. It can only be used to encrypt, decrypt, or sign data when an
3625/// authorized user or application invokes Cloud KMS.
3626///
3627/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3628/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
3629#[derive(Clone, Default, PartialEq)]
3630#[non_exhaustive]
3631pub struct CryptoKeyVersion {
3632    /// Output only. The resource name for this
3633    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
3634    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
3635    ///
3636    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3637    pub name: std::string::String,
3638
3639    /// The current state of the
3640    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
3641    ///
3642    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3643    pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
3644
3645    /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
3646    /// describing how crypto operations are performed with this
3647    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
3648    ///
3649    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3650    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
3651    pub protection_level: crate::model::ProtectionLevel,
3652
3653    /// Output only. The
3654    /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
3655    /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
3656    /// supports.
3657    ///
3658    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3659    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
3660    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
3661
3662    /// Output only. Statement that was generated and signed by the HSM at key
3663    /// creation time. Use this statement to verify attributes of the key as stored
3664    /// on the HSM, independently of Google. Only provided for key versions with
3665    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
3666    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
3667    ///
3668    /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
3669    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
3670    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
3671
3672    /// Output only. The time at which this
3673    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
3674    ///
3675    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3676    pub create_time: std::option::Option<wkt::Timestamp>,
3677
3678    /// Output only. The time this
3679    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
3680    /// generated.
3681    ///
3682    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3683    pub generate_time: std::option::Option<wkt::Timestamp>,
3684
3685    /// Output only. The time this
3686    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
3687    /// scheduled for destruction. Only present if
3688    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3689    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
3690    ///
3691    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3692    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
3693    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3694    pub destroy_time: std::option::Option<wkt::Timestamp>,
3695
3696    /// Output only. The time this CryptoKeyVersion's key material was
3697    /// destroyed. Only present if
3698    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3699    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
3700    ///
3701    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
3702    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3703    pub destroy_event_time: std::option::Option<wkt::Timestamp>,
3704
3705    /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
3706    /// used in the most recent import of this
3707    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
3708    /// the underlying key material was imported.
3709    ///
3710    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3711    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
3712    pub import_job: std::string::String,
3713
3714    /// Output only. The time at which this
3715    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
3716    /// most recently imported.
3717    ///
3718    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3719    pub import_time: std::option::Option<wkt::Timestamp>,
3720
3721    /// Output only. The root cause of the most recent import failure. Only present
3722    /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3723    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
3724    ///
3725    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
3726    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3727    pub import_failure_reason: std::string::String,
3728
3729    /// Output only. The root cause of the most recent generation failure. Only
3730    /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3731    /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
3732    ///
3733    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
3734    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3735    pub generation_failure_reason: std::string::String,
3736
3737    /// Output only. The root cause of the most recent external destruction
3738    /// failure. Only present if
3739    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3740    /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
3741    ///
3742    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
3743    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3744    pub external_destruction_failure_reason: std::string::String,
3745
3746    /// ExternalProtectionLevelOptions stores a group of additional fields for
3747    /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
3748    /// are specific to the
3749    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
3750    /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
3751    /// protection levels.
3752    ///
3753    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3754    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
3755    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
3756    pub external_protection_level_options:
3757        std::option::Option<crate::model::ExternalProtectionLevelOptions>,
3758
3759    /// Output only. Whether or not this key version is eligible for reimport, by
3760    /// being specified as a target in
3761    /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
3762    ///
3763    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
3764    pub reimport_eligible: bool,
3765
3766    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3767}
3768
3769impl CryptoKeyVersion {
3770    pub fn new() -> Self {
3771        std::default::Default::default()
3772    }
3773
3774    /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
3775    ///
3776    /// # Example
3777    /// ```ignore,no_run
3778    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3779    /// let x = CryptoKeyVersion::new().set_name("example");
3780    /// ```
3781    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3782        self.name = v.into();
3783        self
3784    }
3785
3786    /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
3787    ///
3788    /// # Example
3789    /// ```ignore,no_run
3790    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3791    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
3792    /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
3793    /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
3794    /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
3795    /// ```
3796    pub fn set_state<
3797        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
3798    >(
3799        mut self,
3800        v: T,
3801    ) -> Self {
3802        self.state = v.into();
3803        self
3804    }
3805
3806    /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
3807    ///
3808    /// # Example
3809    /// ```ignore,no_run
3810    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3811    /// use google_cloud_kms_v1::model::ProtectionLevel;
3812    /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
3813    /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
3814    /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
3815    /// ```
3816    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
3817        mut self,
3818        v: T,
3819    ) -> Self {
3820        self.protection_level = v.into();
3821        self
3822    }
3823
3824    /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
3825    ///
3826    /// # Example
3827    /// ```ignore,no_run
3828    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3829    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
3830    /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
3831    /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
3832    /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
3833    /// ```
3834    pub fn set_algorithm<
3835        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
3836    >(
3837        mut self,
3838        v: T,
3839    ) -> Self {
3840        self.algorithm = v.into();
3841        self
3842    }
3843
3844    /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
3845    ///
3846    /// # Example
3847    /// ```ignore,no_run
3848    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3849    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
3850    /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
3851    /// ```
3852    pub fn set_attestation<T>(mut self, v: T) -> Self
3853    where
3854        T: std::convert::Into<crate::model::KeyOperationAttestation>,
3855    {
3856        self.attestation = std::option::Option::Some(v.into());
3857        self
3858    }
3859
3860    /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
3861    ///
3862    /// # Example
3863    /// ```ignore,no_run
3864    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3865    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
3866    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
3867    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
3868    /// ```
3869    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
3870    where
3871        T: std::convert::Into<crate::model::KeyOperationAttestation>,
3872    {
3873        self.attestation = v.map(|x| x.into());
3874        self
3875    }
3876
3877    /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
3878    ///
3879    /// # Example
3880    /// ```ignore,no_run
3881    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3882    /// use wkt::Timestamp;
3883    /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
3884    /// ```
3885    pub fn set_create_time<T>(mut self, v: T) -> Self
3886    where
3887        T: std::convert::Into<wkt::Timestamp>,
3888    {
3889        self.create_time = std::option::Option::Some(v.into());
3890        self
3891    }
3892
3893    /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
3894    ///
3895    /// # Example
3896    /// ```ignore,no_run
3897    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3898    /// use wkt::Timestamp;
3899    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3900    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
3901    /// ```
3902    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3903    where
3904        T: std::convert::Into<wkt::Timestamp>,
3905    {
3906        self.create_time = v.map(|x| x.into());
3907        self
3908    }
3909
3910    /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
3911    ///
3912    /// # Example
3913    /// ```ignore,no_run
3914    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3915    /// use wkt::Timestamp;
3916    /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
3917    /// ```
3918    pub fn set_generate_time<T>(mut self, v: T) -> Self
3919    where
3920        T: std::convert::Into<wkt::Timestamp>,
3921    {
3922        self.generate_time = std::option::Option::Some(v.into());
3923        self
3924    }
3925
3926    /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
3927    ///
3928    /// # Example
3929    /// ```ignore,no_run
3930    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3931    /// use wkt::Timestamp;
3932    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
3933    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
3934    /// ```
3935    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
3936    where
3937        T: std::convert::Into<wkt::Timestamp>,
3938    {
3939        self.generate_time = v.map(|x| x.into());
3940        self
3941    }
3942
3943    /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
3944    ///
3945    /// # Example
3946    /// ```ignore,no_run
3947    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3948    /// use wkt::Timestamp;
3949    /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
3950    /// ```
3951    pub fn set_destroy_time<T>(mut self, v: T) -> Self
3952    where
3953        T: std::convert::Into<wkt::Timestamp>,
3954    {
3955        self.destroy_time = std::option::Option::Some(v.into());
3956        self
3957    }
3958
3959    /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
3960    ///
3961    /// # Example
3962    /// ```ignore,no_run
3963    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3964    /// use wkt::Timestamp;
3965    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
3966    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
3967    /// ```
3968    pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
3969    where
3970        T: std::convert::Into<wkt::Timestamp>,
3971    {
3972        self.destroy_time = v.map(|x| x.into());
3973        self
3974    }
3975
3976    /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
3977    ///
3978    /// # Example
3979    /// ```ignore,no_run
3980    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3981    /// use wkt::Timestamp;
3982    /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
3983    /// ```
3984    pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
3985    where
3986        T: std::convert::Into<wkt::Timestamp>,
3987    {
3988        self.destroy_event_time = std::option::Option::Some(v.into());
3989        self
3990    }
3991
3992    /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
3993    ///
3994    /// # Example
3995    /// ```ignore,no_run
3996    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
3997    /// use wkt::Timestamp;
3998    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
3999    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
4000    /// ```
4001    pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
4002    where
4003        T: std::convert::Into<wkt::Timestamp>,
4004    {
4005        self.destroy_event_time = v.map(|x| x.into());
4006        self
4007    }
4008
4009    /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
4010    ///
4011    /// # Example
4012    /// ```ignore,no_run
4013    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4014    /// let x = CryptoKeyVersion::new().set_import_job("example");
4015    /// ```
4016    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4017        self.import_job = v.into();
4018        self
4019    }
4020
4021    /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
4022    ///
4023    /// # Example
4024    /// ```ignore,no_run
4025    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4026    /// use wkt::Timestamp;
4027    /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
4028    /// ```
4029    pub fn set_import_time<T>(mut self, v: T) -> Self
4030    where
4031        T: std::convert::Into<wkt::Timestamp>,
4032    {
4033        self.import_time = std::option::Option::Some(v.into());
4034        self
4035    }
4036
4037    /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
4038    ///
4039    /// # Example
4040    /// ```ignore,no_run
4041    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4042    /// use wkt::Timestamp;
4043    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
4044    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
4045    /// ```
4046    pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
4047    where
4048        T: std::convert::Into<wkt::Timestamp>,
4049    {
4050        self.import_time = v.map(|x| x.into());
4051        self
4052    }
4053
4054    /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
4055    ///
4056    /// # Example
4057    /// ```ignore,no_run
4058    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4059    /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
4060    /// ```
4061    pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
4062        mut self,
4063        v: T,
4064    ) -> Self {
4065        self.import_failure_reason = v.into();
4066        self
4067    }
4068
4069    /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
4070    ///
4071    /// # Example
4072    /// ```ignore,no_run
4073    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4074    /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
4075    /// ```
4076    pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
4077        mut self,
4078        v: T,
4079    ) -> Self {
4080        self.generation_failure_reason = v.into();
4081        self
4082    }
4083
4084    /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
4085    ///
4086    /// # Example
4087    /// ```ignore,no_run
4088    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4089    /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
4090    /// ```
4091    pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
4092        mut self,
4093        v: T,
4094    ) -> Self {
4095        self.external_destruction_failure_reason = v.into();
4096        self
4097    }
4098
4099    /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
4100    ///
4101    /// # Example
4102    /// ```ignore,no_run
4103    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4104    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
4105    /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
4106    /// ```
4107    pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
4108    where
4109        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
4110    {
4111        self.external_protection_level_options = std::option::Option::Some(v.into());
4112        self
4113    }
4114
4115    /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
4116    ///
4117    /// # Example
4118    /// ```ignore,no_run
4119    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4120    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
4121    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
4122    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
4123    /// ```
4124    pub fn set_or_clear_external_protection_level_options<T>(
4125        mut self,
4126        v: std::option::Option<T>,
4127    ) -> Self
4128    where
4129        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
4130    {
4131        self.external_protection_level_options = v.map(|x| x.into());
4132        self
4133    }
4134
4135    /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
4136    ///
4137    /// # Example
4138    /// ```ignore,no_run
4139    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
4140    /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
4141    /// ```
4142    pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4143        self.reimport_eligible = v.into();
4144        self
4145    }
4146}
4147
4148impl wkt::message::Message for CryptoKeyVersion {
4149    fn typename() -> &'static str {
4150        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
4151    }
4152}
4153
4154/// Defines additional types related to [CryptoKeyVersion].
4155pub mod crypto_key_version {
4156    #[allow(unused_imports)]
4157    use super::*;
4158
4159    /// The algorithm of the
4160    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
4161    /// parameters must be used for each cryptographic operation.
4162    ///
4163    /// The
4164    /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
4165    /// algorithm is usable with
4166    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
4167    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
4168    ///
4169    /// Algorithms beginning with `RSA_SIGN_` are usable with
4170    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
4171    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
4172    ///
4173    /// The fields in the name after `RSA_SIGN_` correspond to the following
4174    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
4175    ///
4176    /// For PSS, the salt length used is equal to the length of digest
4177    /// algorithm. For example,
4178    /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
4179    /// will use PSS with a salt length of 256 bits or 32 bytes.
4180    ///
4181    /// Algorithms beginning with `RSA_DECRYPT_` are usable with
4182    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
4183    /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
4184    ///
4185    /// The fields in the name after `RSA_DECRYPT_` correspond to the following
4186    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
4187    ///
4188    /// Algorithms beginning with `EC_SIGN_` are usable with
4189    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
4190    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
4191    ///
4192    /// The fields in the name after `EC_SIGN_` correspond to the following
4193    /// parameters: elliptic curve, digest algorithm.
4194    ///
4195    /// Algorithms beginning with `HMAC_` are usable with
4196    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
4197    /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
4198    ///
4199    /// The suffix following `HMAC_` corresponds to the hash algorithm being used
4200    /// (eg. SHA256).
4201    ///
4202    /// Algorithms beginning with `PQ_` are post-quantum.
4203    ///
4204    /// For more information, see [Key purposes and algorithms]
4205    /// (<https://cloud.google.com/kms/docs/algorithms>).
4206    ///
4207    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
4208    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
4209    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
4210    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
4211    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
4212    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4213    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
4214    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
4215    ///
4216    /// # Working with unknown values
4217    ///
4218    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4219    /// additional enum variants at any time. Adding new variants is not considered
4220    /// a breaking change. Applications should write their code in anticipation of:
4221    ///
4222    /// - New values appearing in future releases of the client library, **and**
4223    /// - New values received dynamically, without application changes.
4224    ///
4225    /// Please consult the [Working with enums] section in the user guide for some
4226    /// guidelines.
4227    ///
4228    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4229    #[derive(Clone, Debug, PartialEq)]
4230    #[non_exhaustive]
4231    pub enum CryptoKeyVersionAlgorithm {
4232        /// Not specified.
4233        Unspecified,
4234        /// Creates symmetric encryption keys.
4235        GoogleSymmetricEncryption,
4236        /// AES-GCM (Galois Counter Mode) using 128-bit keys.
4237        Aes128Gcm,
4238        /// AES-GCM (Galois Counter Mode) using 256-bit keys.
4239        Aes256Gcm,
4240        /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
4241        Aes128Cbc,
4242        /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
4243        Aes256Cbc,
4244        /// AES-CTR (Counter Mode) using 128-bit keys.
4245        Aes128Ctr,
4246        /// AES-CTR (Counter Mode) using 256-bit keys.
4247        Aes256Ctr,
4248        /// RSASSA-PSS 2048 bit key with a SHA256 digest.
4249        RsaSignPss2048Sha256,
4250        /// RSASSA-PSS 3072 bit key with a SHA256 digest.
4251        RsaSignPss3072Sha256,
4252        /// RSASSA-PSS 4096 bit key with a SHA256 digest.
4253        RsaSignPss4096Sha256,
4254        /// RSASSA-PSS 4096 bit key with a SHA512 digest.
4255        RsaSignPss4096Sha512,
4256        /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
4257        RsaSignPkcs12048Sha256,
4258        /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
4259        RsaSignPkcs13072Sha256,
4260        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
4261        RsaSignPkcs14096Sha256,
4262        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
4263        RsaSignPkcs14096Sha512,
4264        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
4265        RsaSignRawPkcs12048,
4266        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
4267        RsaSignRawPkcs13072,
4268        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
4269        RsaSignRawPkcs14096,
4270        /// RSAES-OAEP 2048 bit key with a SHA256 digest.
4271        RsaDecryptOaep2048Sha256,
4272        /// RSAES-OAEP 3072 bit key with a SHA256 digest.
4273        RsaDecryptOaep3072Sha256,
4274        /// RSAES-OAEP 4096 bit key with a SHA256 digest.
4275        RsaDecryptOaep4096Sha256,
4276        /// RSAES-OAEP 4096 bit key with a SHA512 digest.
4277        RsaDecryptOaep4096Sha512,
4278        /// RSAES-OAEP 2048 bit key with a SHA1 digest.
4279        RsaDecryptOaep2048Sha1,
4280        /// RSAES-OAEP 3072 bit key with a SHA1 digest.
4281        RsaDecryptOaep3072Sha1,
4282        /// RSAES-OAEP 4096 bit key with a SHA1 digest.
4283        RsaDecryptOaep4096Sha1,
4284        /// ECDSA on the NIST P-256 curve with a SHA256 digest.
4285        /// Other hash functions can also be used:
4286        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
4287        EcSignP256Sha256,
4288        /// ECDSA on the NIST P-384 curve with a SHA384 digest.
4289        /// Other hash functions can also be used:
4290        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
4291        EcSignP384Sha384,
4292        /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
4293        /// HSM protection level.
4294        /// Other hash functions can also be used:
4295        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
4296        EcSignSecp256K1Sha256,
4297        /// EdDSA on the Curve25519 in pure mode (taking data as input).
4298        EcSignEd25519,
4299        /// HMAC-SHA256 signing with a 256 bit key.
4300        HmacSha256,
4301        /// HMAC-SHA1 signing with a 160 bit key.
4302        HmacSha1,
4303        /// HMAC-SHA384 signing with a 384 bit key.
4304        HmacSha384,
4305        /// HMAC-SHA512 signing with a 512 bit key.
4306        HmacSha512,
4307        /// HMAC-SHA224 signing with a 224 bit key.
4308        HmacSha224,
4309        /// Algorithm representing symmetric encryption by an external key manager.
4310        ExternalSymmetricEncryption,
4311        /// ML-KEM-768 (FIPS 203)
4312        MlKem768,
4313        /// ML-KEM-1024 (FIPS 203)
4314        MlKem1024,
4315        /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
4316        /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
4317        KemXwing,
4318        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
4319        /// security level 3. Randomized version.
4320        PqSignMlDsa65,
4321        /// The post-quantum stateless hash-based digital signature algorithm, at
4322        /// security level 1. Randomized version.
4323        PqSignSlhDsaSha2128S,
4324        /// If set, the enum was initialized with an unknown value.
4325        ///
4326        /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
4327        /// [CryptoKeyVersionAlgorithm::name].
4328        UnknownValue(crypto_key_version_algorithm::UnknownValue),
4329    }
4330
4331    #[doc(hidden)]
4332    pub mod crypto_key_version_algorithm {
4333        #[allow(unused_imports)]
4334        use super::*;
4335        #[derive(Clone, Debug, PartialEq)]
4336        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4337    }
4338
4339    impl CryptoKeyVersionAlgorithm {
4340        /// Gets the enum value.
4341        ///
4342        /// Returns `None` if the enum contains an unknown value deserialized from
4343        /// the string representation of enums.
4344        pub fn value(&self) -> std::option::Option<i32> {
4345            match self {
4346                Self::Unspecified => std::option::Option::Some(0),
4347                Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
4348                Self::Aes128Gcm => std::option::Option::Some(41),
4349                Self::Aes256Gcm => std::option::Option::Some(19),
4350                Self::Aes128Cbc => std::option::Option::Some(42),
4351                Self::Aes256Cbc => std::option::Option::Some(43),
4352                Self::Aes128Ctr => std::option::Option::Some(44),
4353                Self::Aes256Ctr => std::option::Option::Some(45),
4354                Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
4355                Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
4356                Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
4357                Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
4358                Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
4359                Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
4360                Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
4361                Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
4362                Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
4363                Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
4364                Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
4365                Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
4366                Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
4367                Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
4368                Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
4369                Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
4370                Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
4371                Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
4372                Self::EcSignP256Sha256 => std::option::Option::Some(12),
4373                Self::EcSignP384Sha384 => std::option::Option::Some(13),
4374                Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
4375                Self::EcSignEd25519 => std::option::Option::Some(40),
4376                Self::HmacSha256 => std::option::Option::Some(32),
4377                Self::HmacSha1 => std::option::Option::Some(33),
4378                Self::HmacSha384 => std::option::Option::Some(34),
4379                Self::HmacSha512 => std::option::Option::Some(35),
4380                Self::HmacSha224 => std::option::Option::Some(36),
4381                Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
4382                Self::MlKem768 => std::option::Option::Some(47),
4383                Self::MlKem1024 => std::option::Option::Some(48),
4384                Self::KemXwing => std::option::Option::Some(63),
4385                Self::PqSignMlDsa65 => std::option::Option::Some(56),
4386                Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
4387                Self::UnknownValue(u) => u.0.value(),
4388            }
4389        }
4390
4391        /// Gets the enum value as a string.
4392        ///
4393        /// Returns `None` if the enum contains an unknown value deserialized from
4394        /// the integer representation of enums.
4395        pub fn name(&self) -> std::option::Option<&str> {
4396            match self {
4397                Self::Unspecified => {
4398                    std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
4399                }
4400                Self::GoogleSymmetricEncryption => {
4401                    std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
4402                }
4403                Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
4404                Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
4405                Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
4406                Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
4407                Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
4408                Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
4409                Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
4410                Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
4411                Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
4412                Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
4413                Self::RsaSignPkcs12048Sha256 => {
4414                    std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
4415                }
4416                Self::RsaSignPkcs13072Sha256 => {
4417                    std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
4418                }
4419                Self::RsaSignPkcs14096Sha256 => {
4420                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
4421                }
4422                Self::RsaSignPkcs14096Sha512 => {
4423                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
4424                }
4425                Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
4426                Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
4427                Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
4428                Self::RsaDecryptOaep2048Sha256 => {
4429                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
4430                }
4431                Self::RsaDecryptOaep3072Sha256 => {
4432                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
4433                }
4434                Self::RsaDecryptOaep4096Sha256 => {
4435                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
4436                }
4437                Self::RsaDecryptOaep4096Sha512 => {
4438                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
4439                }
4440                Self::RsaDecryptOaep2048Sha1 => {
4441                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
4442                }
4443                Self::RsaDecryptOaep3072Sha1 => {
4444                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
4445                }
4446                Self::RsaDecryptOaep4096Sha1 => {
4447                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
4448                }
4449                Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
4450                Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
4451                Self::EcSignSecp256K1Sha256 => {
4452                    std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
4453                }
4454                Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
4455                Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
4456                Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
4457                Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
4458                Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
4459                Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
4460                Self::ExternalSymmetricEncryption => {
4461                    std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
4462                }
4463                Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
4464                Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
4465                Self::KemXwing => std::option::Option::Some("KEM_XWING"),
4466                Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
4467                Self::PqSignSlhDsaSha2128S => {
4468                    std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
4469                }
4470                Self::UnknownValue(u) => u.0.name(),
4471            }
4472        }
4473    }
4474
4475    impl std::default::Default for CryptoKeyVersionAlgorithm {
4476        fn default() -> Self {
4477            use std::convert::From;
4478            Self::from(0)
4479        }
4480    }
4481
4482    impl std::fmt::Display for CryptoKeyVersionAlgorithm {
4483        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4484            wkt::internal::display_enum(f, self.name(), self.value())
4485        }
4486    }
4487
4488    impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
4489        fn from(value: i32) -> Self {
4490            match value {
4491                0 => Self::Unspecified,
4492                1 => Self::GoogleSymmetricEncryption,
4493                2 => Self::RsaSignPss2048Sha256,
4494                3 => Self::RsaSignPss3072Sha256,
4495                4 => Self::RsaSignPss4096Sha256,
4496                5 => Self::RsaSignPkcs12048Sha256,
4497                6 => Self::RsaSignPkcs13072Sha256,
4498                7 => Self::RsaSignPkcs14096Sha256,
4499                8 => Self::RsaDecryptOaep2048Sha256,
4500                9 => Self::RsaDecryptOaep3072Sha256,
4501                10 => Self::RsaDecryptOaep4096Sha256,
4502                12 => Self::EcSignP256Sha256,
4503                13 => Self::EcSignP384Sha384,
4504                15 => Self::RsaSignPss4096Sha512,
4505                16 => Self::RsaSignPkcs14096Sha512,
4506                17 => Self::RsaDecryptOaep4096Sha512,
4507                18 => Self::ExternalSymmetricEncryption,
4508                19 => Self::Aes256Gcm,
4509                28 => Self::RsaSignRawPkcs12048,
4510                29 => Self::RsaSignRawPkcs13072,
4511                30 => Self::RsaSignRawPkcs14096,
4512                31 => Self::EcSignSecp256K1Sha256,
4513                32 => Self::HmacSha256,
4514                33 => Self::HmacSha1,
4515                34 => Self::HmacSha384,
4516                35 => Self::HmacSha512,
4517                36 => Self::HmacSha224,
4518                37 => Self::RsaDecryptOaep2048Sha1,
4519                38 => Self::RsaDecryptOaep3072Sha1,
4520                39 => Self::RsaDecryptOaep4096Sha1,
4521                40 => Self::EcSignEd25519,
4522                41 => Self::Aes128Gcm,
4523                42 => Self::Aes128Cbc,
4524                43 => Self::Aes256Cbc,
4525                44 => Self::Aes128Ctr,
4526                45 => Self::Aes256Ctr,
4527                47 => Self::MlKem768,
4528                48 => Self::MlKem1024,
4529                56 => Self::PqSignMlDsa65,
4530                57 => Self::PqSignSlhDsaSha2128S,
4531                63 => Self::KemXwing,
4532                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
4533                    wkt::internal::UnknownEnumValue::Integer(value),
4534                )),
4535            }
4536        }
4537    }
4538
4539    impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
4540        fn from(value: &str) -> Self {
4541            use std::string::ToString;
4542            match value {
4543                "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
4544                "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
4545                "AES_128_GCM" => Self::Aes128Gcm,
4546                "AES_256_GCM" => Self::Aes256Gcm,
4547                "AES_128_CBC" => Self::Aes128Cbc,
4548                "AES_256_CBC" => Self::Aes256Cbc,
4549                "AES_128_CTR" => Self::Aes128Ctr,
4550                "AES_256_CTR" => Self::Aes256Ctr,
4551                "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
4552                "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
4553                "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
4554                "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
4555                "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
4556                "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
4557                "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
4558                "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
4559                "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
4560                "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
4561                "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
4562                "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
4563                "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
4564                "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
4565                "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
4566                "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
4567                "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
4568                "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
4569                "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
4570                "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
4571                "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
4572                "EC_SIGN_ED25519" => Self::EcSignEd25519,
4573                "HMAC_SHA256" => Self::HmacSha256,
4574                "HMAC_SHA1" => Self::HmacSha1,
4575                "HMAC_SHA384" => Self::HmacSha384,
4576                "HMAC_SHA512" => Self::HmacSha512,
4577                "HMAC_SHA224" => Self::HmacSha224,
4578                "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
4579                "ML_KEM_768" => Self::MlKem768,
4580                "ML_KEM_1024" => Self::MlKem1024,
4581                "KEM_XWING" => Self::KemXwing,
4582                "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
4583                "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
4584                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
4585                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4586                )),
4587            }
4588        }
4589    }
4590
4591    impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
4592        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4593        where
4594            S: serde::Serializer,
4595        {
4596            match self {
4597                Self::Unspecified => serializer.serialize_i32(0),
4598                Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
4599                Self::Aes128Gcm => serializer.serialize_i32(41),
4600                Self::Aes256Gcm => serializer.serialize_i32(19),
4601                Self::Aes128Cbc => serializer.serialize_i32(42),
4602                Self::Aes256Cbc => serializer.serialize_i32(43),
4603                Self::Aes128Ctr => serializer.serialize_i32(44),
4604                Self::Aes256Ctr => serializer.serialize_i32(45),
4605                Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
4606                Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
4607                Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
4608                Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
4609                Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
4610                Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
4611                Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
4612                Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
4613                Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
4614                Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
4615                Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
4616                Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
4617                Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
4618                Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
4619                Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
4620                Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
4621                Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
4622                Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
4623                Self::EcSignP256Sha256 => serializer.serialize_i32(12),
4624                Self::EcSignP384Sha384 => serializer.serialize_i32(13),
4625                Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
4626                Self::EcSignEd25519 => serializer.serialize_i32(40),
4627                Self::HmacSha256 => serializer.serialize_i32(32),
4628                Self::HmacSha1 => serializer.serialize_i32(33),
4629                Self::HmacSha384 => serializer.serialize_i32(34),
4630                Self::HmacSha512 => serializer.serialize_i32(35),
4631                Self::HmacSha224 => serializer.serialize_i32(36),
4632                Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
4633                Self::MlKem768 => serializer.serialize_i32(47),
4634                Self::MlKem1024 => serializer.serialize_i32(48),
4635                Self::KemXwing => serializer.serialize_i32(63),
4636                Self::PqSignMlDsa65 => serializer.serialize_i32(56),
4637                Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
4638                Self::UnknownValue(u) => u.0.serialize(serializer),
4639            }
4640        }
4641    }
4642
4643    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
4644        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4645        where
4646            D: serde::Deserializer<'de>,
4647        {
4648            deserializer.deserialize_any(
4649                wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
4650                    ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
4651                ),
4652            )
4653        }
4654    }
4655
4656    /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
4657    /// indicating if it can be used.
4658    ///
4659    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4660    ///
4661    /// # Working with unknown values
4662    ///
4663    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4664    /// additional enum variants at any time. Adding new variants is not considered
4665    /// a breaking change. Applications should write their code in anticipation of:
4666    ///
4667    /// - New values appearing in future releases of the client library, **and**
4668    /// - New values received dynamically, without application changes.
4669    ///
4670    /// Please consult the [Working with enums] section in the user guide for some
4671    /// guidelines.
4672    ///
4673    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4674    #[derive(Clone, Debug, PartialEq)]
4675    #[non_exhaustive]
4676    pub enum CryptoKeyVersionState {
4677        /// Not specified.
4678        Unspecified,
4679        /// This version is still being generated. It may not be used, enabled,
4680        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
4681        /// version
4682        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
4683        /// as soon as the version is ready.
4684        ///
4685        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
4686        PendingGeneration,
4687        /// This version may be used for cryptographic operations.
4688        Enabled,
4689        /// This version may not be used, but the key material is still available,
4690        /// and the version can be placed back into the
4691        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
4692        /// state.
4693        ///
4694        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
4695        Disabled,
4696        /// The key material of this version is destroyed and no longer stored.
4697        /// This version may only become
4698        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
4699        /// again if this version is
4700        /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
4701        /// and the original key material is reimported with a call to
4702        /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
4703        ///
4704        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
4705        /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
4706        /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
4707        Destroyed,
4708        /// This version is scheduled for destruction, and will be destroyed soon.
4709        /// Call
4710        /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
4711        /// to put it back into the
4712        /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
4713        /// state.
4714        ///
4715        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
4716        /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
4717        DestroyScheduled,
4718        /// This version is still being imported. It may not be used, enabled,
4719        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
4720        /// version
4721        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
4722        /// as soon as the version is ready.
4723        ///
4724        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
4725        PendingImport,
4726        /// This version was not imported successfully. It may not be used, enabled,
4727        /// disabled, or destroyed. The submitted key material has been discarded.
4728        /// Additional details can be found in
4729        /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
4730        ///
4731        /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
4732        ImportFailed,
4733        /// This version was not generated successfully. It may not be used, enabled,
4734        /// disabled, or destroyed. Additional details can be found in
4735        /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
4736        ///
4737        /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
4738        GenerationFailed,
4739        /// This version was destroyed, and it may not be used or enabled again.
4740        /// Cloud KMS is waiting for the corresponding key material residing in an
4741        /// external key manager to be destroyed.
4742        PendingExternalDestruction,
4743        /// This version was destroyed, and it may not be used or enabled again.
4744        /// However, Cloud KMS could not confirm that the corresponding key material
4745        /// residing in an external key manager was destroyed. Additional details can
4746        /// be found in
4747        /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
4748        ///
4749        /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
4750        ExternalDestructionFailed,
4751        /// If set, the enum was initialized with an unknown value.
4752        ///
4753        /// Applications can examine the value using [CryptoKeyVersionState::value] or
4754        /// [CryptoKeyVersionState::name].
4755        UnknownValue(crypto_key_version_state::UnknownValue),
4756    }
4757
4758    #[doc(hidden)]
4759    pub mod crypto_key_version_state {
4760        #[allow(unused_imports)]
4761        use super::*;
4762        #[derive(Clone, Debug, PartialEq)]
4763        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4764    }
4765
4766    impl CryptoKeyVersionState {
4767        /// Gets the enum value.
4768        ///
4769        /// Returns `None` if the enum contains an unknown value deserialized from
4770        /// the string representation of enums.
4771        pub fn value(&self) -> std::option::Option<i32> {
4772            match self {
4773                Self::Unspecified => std::option::Option::Some(0),
4774                Self::PendingGeneration => std::option::Option::Some(5),
4775                Self::Enabled => std::option::Option::Some(1),
4776                Self::Disabled => std::option::Option::Some(2),
4777                Self::Destroyed => std::option::Option::Some(3),
4778                Self::DestroyScheduled => std::option::Option::Some(4),
4779                Self::PendingImport => std::option::Option::Some(6),
4780                Self::ImportFailed => std::option::Option::Some(7),
4781                Self::GenerationFailed => std::option::Option::Some(8),
4782                Self::PendingExternalDestruction => std::option::Option::Some(9),
4783                Self::ExternalDestructionFailed => std::option::Option::Some(10),
4784                Self::UnknownValue(u) => u.0.value(),
4785            }
4786        }
4787
4788        /// Gets the enum value as a string.
4789        ///
4790        /// Returns `None` if the enum contains an unknown value deserialized from
4791        /// the integer representation of enums.
4792        pub fn name(&self) -> std::option::Option<&str> {
4793            match self {
4794                Self::Unspecified => {
4795                    std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
4796                }
4797                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
4798                Self::Enabled => std::option::Option::Some("ENABLED"),
4799                Self::Disabled => std::option::Option::Some("DISABLED"),
4800                Self::Destroyed => std::option::Option::Some("DESTROYED"),
4801                Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
4802                Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
4803                Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
4804                Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
4805                Self::PendingExternalDestruction => {
4806                    std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
4807                }
4808                Self::ExternalDestructionFailed => {
4809                    std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
4810                }
4811                Self::UnknownValue(u) => u.0.name(),
4812            }
4813        }
4814    }
4815
4816    impl std::default::Default for CryptoKeyVersionState {
4817        fn default() -> Self {
4818            use std::convert::From;
4819            Self::from(0)
4820        }
4821    }
4822
4823    impl std::fmt::Display for CryptoKeyVersionState {
4824        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4825            wkt::internal::display_enum(f, self.name(), self.value())
4826        }
4827    }
4828
4829    impl std::convert::From<i32> for CryptoKeyVersionState {
4830        fn from(value: i32) -> Self {
4831            match value {
4832                0 => Self::Unspecified,
4833                1 => Self::Enabled,
4834                2 => Self::Disabled,
4835                3 => Self::Destroyed,
4836                4 => Self::DestroyScheduled,
4837                5 => Self::PendingGeneration,
4838                6 => Self::PendingImport,
4839                7 => Self::ImportFailed,
4840                8 => Self::GenerationFailed,
4841                9 => Self::PendingExternalDestruction,
4842                10 => Self::ExternalDestructionFailed,
4843                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
4844                    wkt::internal::UnknownEnumValue::Integer(value),
4845                )),
4846            }
4847        }
4848    }
4849
4850    impl std::convert::From<&str> for CryptoKeyVersionState {
4851        fn from(value: &str) -> Self {
4852            use std::string::ToString;
4853            match value {
4854                "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
4855                "PENDING_GENERATION" => Self::PendingGeneration,
4856                "ENABLED" => Self::Enabled,
4857                "DISABLED" => Self::Disabled,
4858                "DESTROYED" => Self::Destroyed,
4859                "DESTROY_SCHEDULED" => Self::DestroyScheduled,
4860                "PENDING_IMPORT" => Self::PendingImport,
4861                "IMPORT_FAILED" => Self::ImportFailed,
4862                "GENERATION_FAILED" => Self::GenerationFailed,
4863                "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
4864                "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
4865                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
4866                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4867                )),
4868            }
4869        }
4870    }
4871
4872    impl serde::ser::Serialize for CryptoKeyVersionState {
4873        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4874        where
4875            S: serde::Serializer,
4876        {
4877            match self {
4878                Self::Unspecified => serializer.serialize_i32(0),
4879                Self::PendingGeneration => serializer.serialize_i32(5),
4880                Self::Enabled => serializer.serialize_i32(1),
4881                Self::Disabled => serializer.serialize_i32(2),
4882                Self::Destroyed => serializer.serialize_i32(3),
4883                Self::DestroyScheduled => serializer.serialize_i32(4),
4884                Self::PendingImport => serializer.serialize_i32(6),
4885                Self::ImportFailed => serializer.serialize_i32(7),
4886                Self::GenerationFailed => serializer.serialize_i32(8),
4887                Self::PendingExternalDestruction => serializer.serialize_i32(9),
4888                Self::ExternalDestructionFailed => serializer.serialize_i32(10),
4889                Self::UnknownValue(u) => u.0.serialize(serializer),
4890            }
4891        }
4892    }
4893
4894    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
4895        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4896        where
4897            D: serde::Deserializer<'de>,
4898        {
4899            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
4900                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
4901            ))
4902        }
4903    }
4904
4905    /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
4906    /// Controls the level of detail returned for
4907    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
4908    /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
4909    /// and
4910    /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
4911    ///
4912    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4913    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
4914    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
4915    ///
4916    /// # Working with unknown values
4917    ///
4918    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4919    /// additional enum variants at any time. Adding new variants is not considered
4920    /// a breaking change. Applications should write their code in anticipation of:
4921    ///
4922    /// - New values appearing in future releases of the client library, **and**
4923    /// - New values received dynamically, without application changes.
4924    ///
4925    /// Please consult the [Working with enums] section in the user guide for some
4926    /// guidelines.
4927    ///
4928    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4929    #[derive(Clone, Debug, PartialEq)]
4930    #[non_exhaustive]
4931    pub enum CryptoKeyVersionView {
4932        /// Default view for each
4933        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
4934        /// include the
4935        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
4936        ///
4937        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4938        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
4939        Unspecified,
4940        /// Provides all fields in each
4941        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
4942        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
4943        ///
4944        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4945        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
4946        Full,
4947        /// If set, the enum was initialized with an unknown value.
4948        ///
4949        /// Applications can examine the value using [CryptoKeyVersionView::value] or
4950        /// [CryptoKeyVersionView::name].
4951        UnknownValue(crypto_key_version_view::UnknownValue),
4952    }
4953
4954    #[doc(hidden)]
4955    pub mod crypto_key_version_view {
4956        #[allow(unused_imports)]
4957        use super::*;
4958        #[derive(Clone, Debug, PartialEq)]
4959        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4960    }
4961
4962    impl CryptoKeyVersionView {
4963        /// Gets the enum value.
4964        ///
4965        /// Returns `None` if the enum contains an unknown value deserialized from
4966        /// the string representation of enums.
4967        pub fn value(&self) -> std::option::Option<i32> {
4968            match self {
4969                Self::Unspecified => std::option::Option::Some(0),
4970                Self::Full => std::option::Option::Some(1),
4971                Self::UnknownValue(u) => u.0.value(),
4972            }
4973        }
4974
4975        /// Gets the enum value as a string.
4976        ///
4977        /// Returns `None` if the enum contains an unknown value deserialized from
4978        /// the integer representation of enums.
4979        pub fn name(&self) -> std::option::Option<&str> {
4980            match self {
4981                Self::Unspecified => {
4982                    std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
4983                }
4984                Self::Full => std::option::Option::Some("FULL"),
4985                Self::UnknownValue(u) => u.0.name(),
4986            }
4987        }
4988    }
4989
4990    impl std::default::Default for CryptoKeyVersionView {
4991        fn default() -> Self {
4992            use std::convert::From;
4993            Self::from(0)
4994        }
4995    }
4996
4997    impl std::fmt::Display for CryptoKeyVersionView {
4998        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4999            wkt::internal::display_enum(f, self.name(), self.value())
5000        }
5001    }
5002
5003    impl std::convert::From<i32> for CryptoKeyVersionView {
5004        fn from(value: i32) -> Self {
5005            match value {
5006                0 => Self::Unspecified,
5007                1 => Self::Full,
5008                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
5009                    wkt::internal::UnknownEnumValue::Integer(value),
5010                )),
5011            }
5012        }
5013    }
5014
5015    impl std::convert::From<&str> for CryptoKeyVersionView {
5016        fn from(value: &str) -> Self {
5017            use std::string::ToString;
5018            match value {
5019                "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
5020                "FULL" => Self::Full,
5021                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
5022                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5023                )),
5024            }
5025        }
5026    }
5027
5028    impl serde::ser::Serialize for CryptoKeyVersionView {
5029        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5030        where
5031            S: serde::Serializer,
5032        {
5033            match self {
5034                Self::Unspecified => serializer.serialize_i32(0),
5035                Self::Full => serializer.serialize_i32(1),
5036                Self::UnknownValue(u) => u.0.serialize(serializer),
5037            }
5038        }
5039    }
5040
5041    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
5042        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5043        where
5044            D: serde::Deserializer<'de>,
5045        {
5046            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
5047                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
5048            ))
5049        }
5050    }
5051}
5052
5053/// Data with integrity verification field.
5054#[derive(Clone, Default, PartialEq)]
5055#[non_exhaustive]
5056pub struct ChecksummedData {
5057    /// Raw Data.
5058    pub data: ::bytes::Bytes,
5059
5060    /// Integrity verification field. A CRC32C
5061    /// checksum of the returned
5062    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
5063    /// integrity check of
5064    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
5065    /// performed by computing the CRC32C checksum of
5066    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
5067    /// comparing your results to this field. Discard the response in case of
5068    /// non-matching checksum values, and perform a limited number of retries. A
5069    /// persistent mismatch may indicate an issue in your computation of the CRC32C
5070    /// checksum. Note: This field is defined as int64 for reasons of compatibility
5071    /// across different languages. However, it is a non-negative integer, which
5072    /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
5073    /// languages that support this type.
5074    ///
5075    /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
5076    pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
5077
5078    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5079}
5080
5081impl ChecksummedData {
5082    pub fn new() -> Self {
5083        std::default::Default::default()
5084    }
5085
5086    /// Sets the value of [data][crate::model::ChecksummedData::data].
5087    ///
5088    /// # Example
5089    /// ```ignore,no_run
5090    /// # use google_cloud_kms_v1::model::ChecksummedData;
5091    /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
5092    /// ```
5093    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5094        self.data = v.into();
5095        self
5096    }
5097
5098    /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
5099    ///
5100    /// # Example
5101    /// ```ignore,no_run
5102    /// # use google_cloud_kms_v1::model::ChecksummedData;
5103    /// use wkt::Int64Value;
5104    /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
5105    /// ```
5106    pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
5107    where
5108        T: std::convert::Into<wkt::Int64Value>,
5109    {
5110        self.crc32c_checksum = std::option::Option::Some(v.into());
5111        self
5112    }
5113
5114    /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
5115    ///
5116    /// # Example
5117    /// ```ignore,no_run
5118    /// # use google_cloud_kms_v1::model::ChecksummedData;
5119    /// use wkt::Int64Value;
5120    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
5121    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
5122    /// ```
5123    pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
5124    where
5125        T: std::convert::Into<wkt::Int64Value>,
5126    {
5127        self.crc32c_checksum = v.map(|x| x.into());
5128        self
5129    }
5130}
5131
5132impl wkt::message::Message for ChecksummedData {
5133    fn typename() -> &'static str {
5134        "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
5135    }
5136}
5137
5138/// The public keys for a given
5139/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
5140/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
5141///
5142/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5143/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
5144#[derive(Clone, Default, PartialEq)]
5145#[non_exhaustive]
5146pub struct PublicKey {
5147    /// The public key, encoded in PEM format. For more information, see the
5148    /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
5149    /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
5150    /// [Textual Encoding of Subject Public Key Info]
5151    /// (<https://tools.ietf.org/html/rfc7468#section-13>).
5152    pub pem: std::string::String,
5153
5154    /// The
5155    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
5156    /// associated with this key.
5157    ///
5158    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
5159    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
5160
5161    /// Integrity verification field. A CRC32C checksum of the returned
5162    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
5163    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
5164    /// computing the CRC32C checksum of
5165    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
5166    /// results to this field. Discard the response in case of non-matching
5167    /// checksum values, and perform a limited number of retries. A persistent
5168    /// mismatch may indicate an issue in your computation of the CRC32C checksum.
5169    /// Note: This field is defined as int64 for reasons of compatibility across
5170    /// different languages. However, it is a non-negative integer, which will
5171    /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
5172    /// languages that support this type.
5173    ///
5174    /// NOTE: This field is in Beta.
5175    ///
5176    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
5177    pub pem_crc32c: std::option::Option<wkt::Int64Value>,
5178
5179    /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
5180    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
5181    /// Provided here for verification.
5182    ///
5183    /// NOTE: This field is in Beta.
5184    ///
5185    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5186    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
5187    pub name: std::string::String,
5188
5189    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
5190    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
5191    ///
5192    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5193    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
5194    pub protection_level: crate::model::ProtectionLevel,
5195
5196    /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
5197    /// customer through the
5198    /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
5199    /// field.
5200    ///
5201    /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
5202    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
5203    pub public_key_format: crate::model::public_key::PublicKeyFormat,
5204
5205    /// This field contains the public key (with integrity verification), formatted
5206    /// according to the
5207    /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
5208    ///
5209    /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
5210    pub public_key: std::option::Option<crate::model::ChecksummedData>,
5211
5212    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5213}
5214
5215impl PublicKey {
5216    pub fn new() -> Self {
5217        std::default::Default::default()
5218    }
5219
5220    /// Sets the value of [pem][crate::model::PublicKey::pem].
5221    ///
5222    /// # Example
5223    /// ```ignore,no_run
5224    /// # use google_cloud_kms_v1::model::PublicKey;
5225    /// let x = PublicKey::new().set_pem("example");
5226    /// ```
5227    pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5228        self.pem = v.into();
5229        self
5230    }
5231
5232    /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
5233    ///
5234    /// # Example
5235    /// ```ignore,no_run
5236    /// # use google_cloud_kms_v1::model::PublicKey;
5237    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
5238    /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
5239    /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
5240    /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
5241    /// ```
5242    pub fn set_algorithm<
5243        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
5244    >(
5245        mut self,
5246        v: T,
5247    ) -> Self {
5248        self.algorithm = v.into();
5249        self
5250    }
5251
5252    /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
5253    ///
5254    /// # Example
5255    /// ```ignore,no_run
5256    /// # use google_cloud_kms_v1::model::PublicKey;
5257    /// use wkt::Int64Value;
5258    /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
5259    /// ```
5260    pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
5261    where
5262        T: std::convert::Into<wkt::Int64Value>,
5263    {
5264        self.pem_crc32c = std::option::Option::Some(v.into());
5265        self
5266    }
5267
5268    /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
5269    ///
5270    /// # Example
5271    /// ```ignore,no_run
5272    /// # use google_cloud_kms_v1::model::PublicKey;
5273    /// use wkt::Int64Value;
5274    /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
5275    /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
5276    /// ```
5277    pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
5278    where
5279        T: std::convert::Into<wkt::Int64Value>,
5280    {
5281        self.pem_crc32c = v.map(|x| x.into());
5282        self
5283    }
5284
5285    /// Sets the value of [name][crate::model::PublicKey::name].
5286    ///
5287    /// # Example
5288    /// ```ignore,no_run
5289    /// # use google_cloud_kms_v1::model::PublicKey;
5290    /// let x = PublicKey::new().set_name("example");
5291    /// ```
5292    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5293        self.name = v.into();
5294        self
5295    }
5296
5297    /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
5298    ///
5299    /// # Example
5300    /// ```ignore,no_run
5301    /// # use google_cloud_kms_v1::model::PublicKey;
5302    /// use google_cloud_kms_v1::model::ProtectionLevel;
5303    /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
5304    /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
5305    /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
5306    /// ```
5307    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
5308        mut self,
5309        v: T,
5310    ) -> Self {
5311        self.protection_level = v.into();
5312        self
5313    }
5314
5315    /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
5316    ///
5317    /// # Example
5318    /// ```ignore,no_run
5319    /// # use google_cloud_kms_v1::model::PublicKey;
5320    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
5321    /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
5322    /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
5323    /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
5324    /// ```
5325    pub fn set_public_key_format<
5326        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
5327    >(
5328        mut self,
5329        v: T,
5330    ) -> Self {
5331        self.public_key_format = v.into();
5332        self
5333    }
5334
5335    /// Sets the value of [public_key][crate::model::PublicKey::public_key].
5336    ///
5337    /// # Example
5338    /// ```ignore,no_run
5339    /// # use google_cloud_kms_v1::model::PublicKey;
5340    /// use google_cloud_kms_v1::model::ChecksummedData;
5341    /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
5342    /// ```
5343    pub fn set_public_key<T>(mut self, v: T) -> Self
5344    where
5345        T: std::convert::Into<crate::model::ChecksummedData>,
5346    {
5347        self.public_key = std::option::Option::Some(v.into());
5348        self
5349    }
5350
5351    /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
5352    ///
5353    /// # Example
5354    /// ```ignore,no_run
5355    /// # use google_cloud_kms_v1::model::PublicKey;
5356    /// use google_cloud_kms_v1::model::ChecksummedData;
5357    /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
5358    /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
5359    /// ```
5360    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
5361    where
5362        T: std::convert::Into<crate::model::ChecksummedData>,
5363    {
5364        self.public_key = v.map(|x| x.into());
5365        self
5366    }
5367}
5368
5369impl wkt::message::Message for PublicKey {
5370    fn typename() -> &'static str {
5371        "type.googleapis.com/google.cloud.kms.v1.PublicKey"
5372    }
5373}
5374
5375/// Defines additional types related to [PublicKey].
5376pub mod public_key {
5377    #[allow(unused_imports)]
5378    use super::*;
5379
5380    /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
5381    ///
5382    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
5383    ///
5384    /// # Working with unknown values
5385    ///
5386    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5387    /// additional enum variants at any time. Adding new variants is not considered
5388    /// a breaking change. Applications should write their code in anticipation of:
5389    ///
5390    /// - New values appearing in future releases of the client library, **and**
5391    /// - New values received dynamically, without application changes.
5392    ///
5393    /// Please consult the [Working with enums] section in the user guide for some
5394    /// guidelines.
5395    ///
5396    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5397    #[derive(Clone, Debug, PartialEq)]
5398    #[non_exhaustive]
5399    pub enum PublicKeyFormat {
5400        /// If the
5401        /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
5402        /// field is not specified:
5403        ///
5404        /// - For PQC algorithms, an error will be returned.
5405        /// - For non-PQC algorithms, the default format is PEM, and the field
5406        ///   [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
5407        ///
5408        /// Otherwise, the public key will be exported through the
5409        /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
5410        /// requested format.
5411        ///
5412        /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
5413        /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
5414        /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
5415        Unspecified,
5416        /// The returned public key will be encoded in PEM format.
5417        /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
5418        /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
5419        /// and [Textual Encoding of Subject Public Key Info]
5420        /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
5421        Pem,
5422        /// The returned public key will be encoded in DER format (the
5423        /// PrivateKeyInfo structure from RFC 5208).
5424        Der,
5425        /// This is supported only for PQC algorithms.
5426        /// The key material is returned in the format defined by NIST PQC
5427        /// standards (FIPS 203, FIPS 204, and FIPS 205).
5428        NistPqc,
5429        /// The returned public key is in raw bytes format defined in its standard
5430        /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
5431        XwingRawBytes,
5432        /// If set, the enum was initialized with an unknown value.
5433        ///
5434        /// Applications can examine the value using [PublicKeyFormat::value] or
5435        /// [PublicKeyFormat::name].
5436        UnknownValue(public_key_format::UnknownValue),
5437    }
5438
5439    #[doc(hidden)]
5440    pub mod public_key_format {
5441        #[allow(unused_imports)]
5442        use super::*;
5443        #[derive(Clone, Debug, PartialEq)]
5444        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5445    }
5446
5447    impl PublicKeyFormat {
5448        /// Gets the enum value.
5449        ///
5450        /// Returns `None` if the enum contains an unknown value deserialized from
5451        /// the string representation of enums.
5452        pub fn value(&self) -> std::option::Option<i32> {
5453            match self {
5454                Self::Unspecified => std::option::Option::Some(0),
5455                Self::Pem => std::option::Option::Some(1),
5456                Self::Der => std::option::Option::Some(2),
5457                Self::NistPqc => std::option::Option::Some(3),
5458                Self::XwingRawBytes => std::option::Option::Some(4),
5459                Self::UnknownValue(u) => u.0.value(),
5460            }
5461        }
5462
5463        /// Gets the enum value as a string.
5464        ///
5465        /// Returns `None` if the enum contains an unknown value deserialized from
5466        /// the integer representation of enums.
5467        pub fn name(&self) -> std::option::Option<&str> {
5468            match self {
5469                Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
5470                Self::Pem => std::option::Option::Some("PEM"),
5471                Self::Der => std::option::Option::Some("DER"),
5472                Self::NistPqc => std::option::Option::Some("NIST_PQC"),
5473                Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
5474                Self::UnknownValue(u) => u.0.name(),
5475            }
5476        }
5477    }
5478
5479    impl std::default::Default for PublicKeyFormat {
5480        fn default() -> Self {
5481            use std::convert::From;
5482            Self::from(0)
5483        }
5484    }
5485
5486    impl std::fmt::Display for PublicKeyFormat {
5487        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5488            wkt::internal::display_enum(f, self.name(), self.value())
5489        }
5490    }
5491
5492    impl std::convert::From<i32> for PublicKeyFormat {
5493        fn from(value: i32) -> Self {
5494            match value {
5495                0 => Self::Unspecified,
5496                1 => Self::Pem,
5497                2 => Self::Der,
5498                3 => Self::NistPqc,
5499                4 => Self::XwingRawBytes,
5500                _ => Self::UnknownValue(public_key_format::UnknownValue(
5501                    wkt::internal::UnknownEnumValue::Integer(value),
5502                )),
5503            }
5504        }
5505    }
5506
5507    impl std::convert::From<&str> for PublicKeyFormat {
5508        fn from(value: &str) -> Self {
5509            use std::string::ToString;
5510            match value {
5511                "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
5512                "PEM" => Self::Pem,
5513                "DER" => Self::Der,
5514                "NIST_PQC" => Self::NistPqc,
5515                "XWING_RAW_BYTES" => Self::XwingRawBytes,
5516                _ => Self::UnknownValue(public_key_format::UnknownValue(
5517                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5518                )),
5519            }
5520        }
5521    }
5522
5523    impl serde::ser::Serialize for PublicKeyFormat {
5524        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5525        where
5526            S: serde::Serializer,
5527        {
5528            match self {
5529                Self::Unspecified => serializer.serialize_i32(0),
5530                Self::Pem => serializer.serialize_i32(1),
5531                Self::Der => serializer.serialize_i32(2),
5532                Self::NistPqc => serializer.serialize_i32(3),
5533                Self::XwingRawBytes => serializer.serialize_i32(4),
5534                Self::UnknownValue(u) => u.0.serialize(serializer),
5535            }
5536        }
5537    }
5538
5539    impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
5540        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5541        where
5542            D: serde::Deserializer<'de>,
5543        {
5544            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
5545                ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
5546            ))
5547        }
5548    }
5549}
5550
5551/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
5552/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
5553/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
5554/// key material, generated outside of Cloud KMS.
5555///
5556/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
5557/// generate a "wrapping key", which is a public/private key pair. You use the
5558/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
5559/// protect it during the import process. The nature of the wrapping key depends
5560/// on the choice of
5561/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
5562/// wrapping key generation is complete, the
5563/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
5564/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
5565/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
5566/// fetched public key can then be used to wrap your pre-existing key material.
5567///
5568/// Once the key material is wrapped, it can be imported into a new
5569/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
5570/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
5571/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
5572/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
5573/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
5574/// uses the private key portion of the wrapping key to unwrap the key material.
5575/// Only Cloud KMS has access to the private key.
5576///
5577/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
5578/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
5579/// any key material that was wrapped with the
5580/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
5581///
5582/// For more information, see
5583/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
5584///
5585/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5586/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5587/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5588/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
5589/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
5590/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
5591/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
5592/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
5593#[derive(Clone, Default, PartialEq)]
5594#[non_exhaustive]
5595pub struct ImportJob {
5596    /// Output only. The resource name for this
5597    /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
5598    /// `projects/*/locations/*/keyRings/*/importJobs/*`.
5599    ///
5600    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5601    pub name: std::string::String,
5602
5603    /// Required. Immutable. The wrapping method to be used for incoming key
5604    /// material.
5605    pub import_method: crate::model::import_job::ImportMethod,
5606
5607    /// Required. Immutable. The protection level of the
5608    /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
5609    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
5610    /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
5611    /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
5612    /// into.
5613    ///
5614    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5615    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
5616    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
5617    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5618    pub protection_level: crate::model::ProtectionLevel,
5619
5620    /// Output only. The time at which this
5621    /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
5622    ///
5623    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5624    pub create_time: std::option::Option<wkt::Timestamp>,
5625
5626    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
5627    /// material was generated.
5628    ///
5629    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5630    pub generate_time: std::option::Option<wkt::Timestamp>,
5631
5632    /// Output only. The time at which this
5633    /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
5634    /// can no longer be used to import key material.
5635    ///
5636    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5637    pub expire_time: std::option::Option<wkt::Timestamp>,
5638
5639    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
5640    /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
5641    /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
5642    ///
5643    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5644    /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
5645    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
5646    pub expire_event_time: std::option::Option<wkt::Timestamp>,
5647
5648    /// Output only. The current state of the
5649    /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
5650    ///
5651    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5652    pub state: crate::model::import_job::ImportJobState,
5653
5654    /// Output only. The public key with which to wrap key material prior to
5655    /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
5656    /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
5657    ///
5658    /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
5659    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
5660    pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
5661
5662    /// Output only. Statement that was generated and signed by the key creator
5663    /// (for example, an HSM) at key creation time. Use this statement to verify
5664    /// attributes of the key as stored on the HSM, independently of Google.
5665    /// Only present if the chosen
5666    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
5667    /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
5668    ///
5669    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
5670    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
5671    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
5672
5673    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5674}
5675
5676impl ImportJob {
5677    pub fn new() -> Self {
5678        std::default::Default::default()
5679    }
5680
5681    /// Sets the value of [name][crate::model::ImportJob::name].
5682    ///
5683    /// # Example
5684    /// ```ignore,no_run
5685    /// # use google_cloud_kms_v1::model::ImportJob;
5686    /// let x = ImportJob::new().set_name("example");
5687    /// ```
5688    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5689        self.name = v.into();
5690        self
5691    }
5692
5693    /// Sets the value of [import_method][crate::model::ImportJob::import_method].
5694    ///
5695    /// # Example
5696    /// ```ignore,no_run
5697    /// # use google_cloud_kms_v1::model::ImportJob;
5698    /// use google_cloud_kms_v1::model::import_job::ImportMethod;
5699    /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
5700    /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
5701    /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
5702    /// ```
5703    pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
5704        mut self,
5705        v: T,
5706    ) -> Self {
5707        self.import_method = v.into();
5708        self
5709    }
5710
5711    /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
5712    ///
5713    /// # Example
5714    /// ```ignore,no_run
5715    /// # use google_cloud_kms_v1::model::ImportJob;
5716    /// use google_cloud_kms_v1::model::ProtectionLevel;
5717    /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
5718    /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
5719    /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
5720    /// ```
5721    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
5722        mut self,
5723        v: T,
5724    ) -> Self {
5725        self.protection_level = v.into();
5726        self
5727    }
5728
5729    /// Sets the value of [create_time][crate::model::ImportJob::create_time].
5730    ///
5731    /// # Example
5732    /// ```ignore,no_run
5733    /// # use google_cloud_kms_v1::model::ImportJob;
5734    /// use wkt::Timestamp;
5735    /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
5736    /// ```
5737    pub fn set_create_time<T>(mut self, v: T) -> Self
5738    where
5739        T: std::convert::Into<wkt::Timestamp>,
5740    {
5741        self.create_time = std::option::Option::Some(v.into());
5742        self
5743    }
5744
5745    /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
5746    ///
5747    /// # Example
5748    /// ```ignore,no_run
5749    /// # use google_cloud_kms_v1::model::ImportJob;
5750    /// use wkt::Timestamp;
5751    /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5752    /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
5753    /// ```
5754    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5755    where
5756        T: std::convert::Into<wkt::Timestamp>,
5757    {
5758        self.create_time = v.map(|x| x.into());
5759        self
5760    }
5761
5762    /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
5763    ///
5764    /// # Example
5765    /// ```ignore,no_run
5766    /// # use google_cloud_kms_v1::model::ImportJob;
5767    /// use wkt::Timestamp;
5768    /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
5769    /// ```
5770    pub fn set_generate_time<T>(mut self, v: T) -> Self
5771    where
5772        T: std::convert::Into<wkt::Timestamp>,
5773    {
5774        self.generate_time = std::option::Option::Some(v.into());
5775        self
5776    }
5777
5778    /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
5779    ///
5780    /// # Example
5781    /// ```ignore,no_run
5782    /// # use google_cloud_kms_v1::model::ImportJob;
5783    /// use wkt::Timestamp;
5784    /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
5785    /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
5786    /// ```
5787    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
5788    where
5789        T: std::convert::Into<wkt::Timestamp>,
5790    {
5791        self.generate_time = v.map(|x| x.into());
5792        self
5793    }
5794
5795    /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
5796    ///
5797    /// # Example
5798    /// ```ignore,no_run
5799    /// # use google_cloud_kms_v1::model::ImportJob;
5800    /// use wkt::Timestamp;
5801    /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
5802    /// ```
5803    pub fn set_expire_time<T>(mut self, v: T) -> Self
5804    where
5805        T: std::convert::Into<wkt::Timestamp>,
5806    {
5807        self.expire_time = std::option::Option::Some(v.into());
5808        self
5809    }
5810
5811    /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
5812    ///
5813    /// # Example
5814    /// ```ignore,no_run
5815    /// # use google_cloud_kms_v1::model::ImportJob;
5816    /// use wkt::Timestamp;
5817    /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5818    /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
5819    /// ```
5820    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5821    where
5822        T: std::convert::Into<wkt::Timestamp>,
5823    {
5824        self.expire_time = v.map(|x| x.into());
5825        self
5826    }
5827
5828    /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
5829    ///
5830    /// # Example
5831    /// ```ignore,no_run
5832    /// # use google_cloud_kms_v1::model::ImportJob;
5833    /// use wkt::Timestamp;
5834    /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
5835    /// ```
5836    pub fn set_expire_event_time<T>(mut self, v: T) -> Self
5837    where
5838        T: std::convert::Into<wkt::Timestamp>,
5839    {
5840        self.expire_event_time = std::option::Option::Some(v.into());
5841        self
5842    }
5843
5844    /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
5845    ///
5846    /// # Example
5847    /// ```ignore,no_run
5848    /// # use google_cloud_kms_v1::model::ImportJob;
5849    /// use wkt::Timestamp;
5850    /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
5851    /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
5852    /// ```
5853    pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
5854    where
5855        T: std::convert::Into<wkt::Timestamp>,
5856    {
5857        self.expire_event_time = v.map(|x| x.into());
5858        self
5859    }
5860
5861    /// Sets the value of [state][crate::model::ImportJob::state].
5862    ///
5863    /// # Example
5864    /// ```ignore,no_run
5865    /// # use google_cloud_kms_v1::model::ImportJob;
5866    /// use google_cloud_kms_v1::model::import_job::ImportJobState;
5867    /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
5868    /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
5869    /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
5870    /// ```
5871    pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
5872        mut self,
5873        v: T,
5874    ) -> Self {
5875        self.state = v.into();
5876        self
5877    }
5878
5879    /// Sets the value of [public_key][crate::model::ImportJob::public_key].
5880    ///
5881    /// # Example
5882    /// ```ignore,no_run
5883    /// # use google_cloud_kms_v1::model::ImportJob;
5884    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
5885    /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
5886    /// ```
5887    pub fn set_public_key<T>(mut self, v: T) -> Self
5888    where
5889        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
5890    {
5891        self.public_key = std::option::Option::Some(v.into());
5892        self
5893    }
5894
5895    /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
5896    ///
5897    /// # Example
5898    /// ```ignore,no_run
5899    /// # use google_cloud_kms_v1::model::ImportJob;
5900    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
5901    /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
5902    /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
5903    /// ```
5904    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
5905    where
5906        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
5907    {
5908        self.public_key = v.map(|x| x.into());
5909        self
5910    }
5911
5912    /// Sets the value of [attestation][crate::model::ImportJob::attestation].
5913    ///
5914    /// # Example
5915    /// ```ignore,no_run
5916    /// # use google_cloud_kms_v1::model::ImportJob;
5917    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
5918    /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
5919    /// ```
5920    pub fn set_attestation<T>(mut self, v: T) -> Self
5921    where
5922        T: std::convert::Into<crate::model::KeyOperationAttestation>,
5923    {
5924        self.attestation = std::option::Option::Some(v.into());
5925        self
5926    }
5927
5928    /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
5929    ///
5930    /// # Example
5931    /// ```ignore,no_run
5932    /// # use google_cloud_kms_v1::model::ImportJob;
5933    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
5934    /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
5935    /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
5936    /// ```
5937    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
5938    where
5939        T: std::convert::Into<crate::model::KeyOperationAttestation>,
5940    {
5941        self.attestation = v.map(|x| x.into());
5942        self
5943    }
5944}
5945
5946impl wkt::message::Message for ImportJob {
5947    fn typename() -> &'static str {
5948        "type.googleapis.com/google.cloud.kms.v1.ImportJob"
5949    }
5950}
5951
5952/// Defines additional types related to [ImportJob].
5953pub mod import_job {
5954    #[allow(unused_imports)]
5955    use super::*;
5956
5957    /// The public key component of the wrapping key. For details of the type of
5958    /// key this public key corresponds to, see the
5959    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
5960    ///
5961    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
5962    #[derive(Clone, Default, PartialEq)]
5963    #[non_exhaustive]
5964    pub struct WrappingPublicKey {
5965        /// The public key, encoded in PEM format. For more information, see the [RFC
5966        /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
5967        /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
5968        /// [Textual Encoding of Subject Public Key Info]
5969        /// (<https://tools.ietf.org/html/rfc7468#section-13>).
5970        pub pem: std::string::String,
5971
5972        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5973    }
5974
5975    impl WrappingPublicKey {
5976        pub fn new() -> Self {
5977            std::default::Default::default()
5978        }
5979
5980        /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
5981        ///
5982        /// # Example
5983        /// ```ignore,no_run
5984        /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
5985        /// let x = WrappingPublicKey::new().set_pem("example");
5986        /// ```
5987        pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5988            self.pem = v.into();
5989            self
5990        }
5991    }
5992
5993    impl wkt::message::Message for WrappingPublicKey {
5994        fn typename() -> &'static str {
5995            "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
5996        }
5997    }
5998
5999    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
6000    /// key wrapping method chosen for this
6001    /// [ImportJob][google.cloud.kms.v1.ImportJob].
6002    ///
6003    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6004    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
6005    ///
6006    /// # Working with unknown values
6007    ///
6008    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6009    /// additional enum variants at any time. Adding new variants is not considered
6010    /// a breaking change. Applications should write their code in anticipation of:
6011    ///
6012    /// - New values appearing in future releases of the client library, **and**
6013    /// - New values received dynamically, without application changes.
6014    ///
6015    /// Please consult the [Working with enums] section in the user guide for some
6016    /// guidelines.
6017    ///
6018    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6019    #[derive(Clone, Debug, PartialEq)]
6020    #[non_exhaustive]
6021    pub enum ImportMethod {
6022        /// Not specified.
6023        Unspecified,
6024        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
6025        /// scheme defined in the PKCS #11 standard. In summary, this involves
6026        /// wrapping the raw key with an ephemeral AES key, and wrapping the
6027        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
6028        /// [RSA AES key wrap
6029        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
6030        RsaOaep3072Sha1Aes256,
6031        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
6032        /// scheme defined in the PKCS #11 standard. In summary, this involves
6033        /// wrapping the raw key with an ephemeral AES key, and wrapping the
6034        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
6035        /// [RSA AES key wrap
6036        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
6037        RsaOaep4096Sha1Aes256,
6038        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
6039        /// scheme defined in the PKCS #11 standard. In summary, this involves
6040        /// wrapping the raw key with an ephemeral AES key, and wrapping the
6041        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
6042        /// [RSA AES key wrap
6043        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
6044        RsaOaep3072Sha256Aes256,
6045        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
6046        /// scheme defined in the PKCS #11 standard. In summary, this involves
6047        /// wrapping the raw key with an ephemeral AES key, and wrapping the
6048        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
6049        /// [RSA AES key wrap
6050        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
6051        RsaOaep4096Sha256Aes256,
6052        /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
6053        /// key material to be imported is wrapped directly with the RSA key. Due
6054        /// to technical limitations of RSA wrapping, this method cannot be used to
6055        /// wrap RSA keys for import.
6056        RsaOaep3072Sha256,
6057        /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
6058        /// key material to be imported is wrapped directly with the RSA key. Due
6059        /// to technical limitations of RSA wrapping, this method cannot be used to
6060        /// wrap RSA keys for import.
6061        RsaOaep4096Sha256,
6062        /// If set, the enum was initialized with an unknown value.
6063        ///
6064        /// Applications can examine the value using [ImportMethod::value] or
6065        /// [ImportMethod::name].
6066        UnknownValue(import_method::UnknownValue),
6067    }
6068
6069    #[doc(hidden)]
6070    pub mod import_method {
6071        #[allow(unused_imports)]
6072        use super::*;
6073        #[derive(Clone, Debug, PartialEq)]
6074        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6075    }
6076
6077    impl ImportMethod {
6078        /// Gets the enum value.
6079        ///
6080        /// Returns `None` if the enum contains an unknown value deserialized from
6081        /// the string representation of enums.
6082        pub fn value(&self) -> std::option::Option<i32> {
6083            match self {
6084                Self::Unspecified => std::option::Option::Some(0),
6085                Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
6086                Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
6087                Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
6088                Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
6089                Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
6090                Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
6091                Self::UnknownValue(u) => u.0.value(),
6092            }
6093        }
6094
6095        /// Gets the enum value as a string.
6096        ///
6097        /// Returns `None` if the enum contains an unknown value deserialized from
6098        /// the integer representation of enums.
6099        pub fn name(&self) -> std::option::Option<&str> {
6100            match self {
6101                Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
6102                Self::RsaOaep3072Sha1Aes256 => {
6103                    std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
6104                }
6105                Self::RsaOaep4096Sha1Aes256 => {
6106                    std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
6107                }
6108                Self::RsaOaep3072Sha256Aes256 => {
6109                    std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
6110                }
6111                Self::RsaOaep4096Sha256Aes256 => {
6112                    std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
6113                }
6114                Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
6115                Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
6116                Self::UnknownValue(u) => u.0.name(),
6117            }
6118        }
6119    }
6120
6121    impl std::default::Default for ImportMethod {
6122        fn default() -> Self {
6123            use std::convert::From;
6124            Self::from(0)
6125        }
6126    }
6127
6128    impl std::fmt::Display for ImportMethod {
6129        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6130            wkt::internal::display_enum(f, self.name(), self.value())
6131        }
6132    }
6133
6134    impl std::convert::From<i32> for ImportMethod {
6135        fn from(value: i32) -> Self {
6136            match value {
6137                0 => Self::Unspecified,
6138                1 => Self::RsaOaep3072Sha1Aes256,
6139                2 => Self::RsaOaep4096Sha1Aes256,
6140                3 => Self::RsaOaep3072Sha256Aes256,
6141                4 => Self::RsaOaep4096Sha256Aes256,
6142                5 => Self::RsaOaep3072Sha256,
6143                6 => Self::RsaOaep4096Sha256,
6144                _ => Self::UnknownValue(import_method::UnknownValue(
6145                    wkt::internal::UnknownEnumValue::Integer(value),
6146                )),
6147            }
6148        }
6149    }
6150
6151    impl std::convert::From<&str> for ImportMethod {
6152        fn from(value: &str) -> Self {
6153            use std::string::ToString;
6154            match value {
6155                "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
6156                "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
6157                "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
6158                "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
6159                "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
6160                "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
6161                "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
6162                _ => Self::UnknownValue(import_method::UnknownValue(
6163                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6164                )),
6165            }
6166        }
6167    }
6168
6169    impl serde::ser::Serialize for ImportMethod {
6170        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6171        where
6172            S: serde::Serializer,
6173        {
6174            match self {
6175                Self::Unspecified => serializer.serialize_i32(0),
6176                Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
6177                Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
6178                Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
6179                Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
6180                Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
6181                Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
6182                Self::UnknownValue(u) => u.0.serialize(serializer),
6183            }
6184        }
6185    }
6186
6187    impl<'de> serde::de::Deserialize<'de> for ImportMethod {
6188        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6189        where
6190            D: serde::Deserializer<'de>,
6191        {
6192            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
6193                ".google.cloud.kms.v1.ImportJob.ImportMethod",
6194            ))
6195        }
6196    }
6197
6198    /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
6199    /// it can be used.
6200    ///
6201    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6202    ///
6203    /// # Working with unknown values
6204    ///
6205    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6206    /// additional enum variants at any time. Adding new variants is not considered
6207    /// a breaking change. Applications should write their code in anticipation of:
6208    ///
6209    /// - New values appearing in future releases of the client library, **and**
6210    /// - New values received dynamically, without application changes.
6211    ///
6212    /// Please consult the [Working with enums] section in the user guide for some
6213    /// guidelines.
6214    ///
6215    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6216    #[derive(Clone, Debug, PartialEq)]
6217    #[non_exhaustive]
6218    pub enum ImportJobState {
6219        /// Not specified.
6220        Unspecified,
6221        /// The wrapping key for this job is still being generated. It may not be
6222        /// used. Cloud KMS will automatically mark this job as
6223        /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
6224        /// the wrapping key is generated.
6225        ///
6226        /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
6227        PendingGeneration,
6228        /// This job may be used in
6229        /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
6230        /// and
6231        /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6232        /// requests.
6233        ///
6234        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
6235        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6236        Active,
6237        /// This job can no longer be used and may not leave this state once entered.
6238        Expired,
6239        /// If set, the enum was initialized with an unknown value.
6240        ///
6241        /// Applications can examine the value using [ImportJobState::value] or
6242        /// [ImportJobState::name].
6243        UnknownValue(import_job_state::UnknownValue),
6244    }
6245
6246    #[doc(hidden)]
6247    pub mod import_job_state {
6248        #[allow(unused_imports)]
6249        use super::*;
6250        #[derive(Clone, Debug, PartialEq)]
6251        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6252    }
6253
6254    impl ImportJobState {
6255        /// Gets the enum value.
6256        ///
6257        /// Returns `None` if the enum contains an unknown value deserialized from
6258        /// the string representation of enums.
6259        pub fn value(&self) -> std::option::Option<i32> {
6260            match self {
6261                Self::Unspecified => std::option::Option::Some(0),
6262                Self::PendingGeneration => std::option::Option::Some(1),
6263                Self::Active => std::option::Option::Some(2),
6264                Self::Expired => std::option::Option::Some(3),
6265                Self::UnknownValue(u) => u.0.value(),
6266            }
6267        }
6268
6269        /// Gets the enum value as a string.
6270        ///
6271        /// Returns `None` if the enum contains an unknown value deserialized from
6272        /// the integer representation of enums.
6273        pub fn name(&self) -> std::option::Option<&str> {
6274            match self {
6275                Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
6276                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
6277                Self::Active => std::option::Option::Some("ACTIVE"),
6278                Self::Expired => std::option::Option::Some("EXPIRED"),
6279                Self::UnknownValue(u) => u.0.name(),
6280            }
6281        }
6282    }
6283
6284    impl std::default::Default for ImportJobState {
6285        fn default() -> Self {
6286            use std::convert::From;
6287            Self::from(0)
6288        }
6289    }
6290
6291    impl std::fmt::Display for ImportJobState {
6292        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6293            wkt::internal::display_enum(f, self.name(), self.value())
6294        }
6295    }
6296
6297    impl std::convert::From<i32> for ImportJobState {
6298        fn from(value: i32) -> Self {
6299            match value {
6300                0 => Self::Unspecified,
6301                1 => Self::PendingGeneration,
6302                2 => Self::Active,
6303                3 => Self::Expired,
6304                _ => Self::UnknownValue(import_job_state::UnknownValue(
6305                    wkt::internal::UnknownEnumValue::Integer(value),
6306                )),
6307            }
6308        }
6309    }
6310
6311    impl std::convert::From<&str> for ImportJobState {
6312        fn from(value: &str) -> Self {
6313            use std::string::ToString;
6314            match value {
6315                "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
6316                "PENDING_GENERATION" => Self::PendingGeneration,
6317                "ACTIVE" => Self::Active,
6318                "EXPIRED" => Self::Expired,
6319                _ => Self::UnknownValue(import_job_state::UnknownValue(
6320                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6321                )),
6322            }
6323        }
6324    }
6325
6326    impl serde::ser::Serialize for ImportJobState {
6327        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6328        where
6329            S: serde::Serializer,
6330        {
6331            match self {
6332                Self::Unspecified => serializer.serialize_i32(0),
6333                Self::PendingGeneration => serializer.serialize_i32(1),
6334                Self::Active => serializer.serialize_i32(2),
6335                Self::Expired => serializer.serialize_i32(3),
6336                Self::UnknownValue(u) => u.0.serialize(serializer),
6337            }
6338        }
6339    }
6340
6341    impl<'de> serde::de::Deserialize<'de> for ImportJobState {
6342        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6343        where
6344            D: serde::Deserializer<'de>,
6345        {
6346            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
6347                ".google.cloud.kms.v1.ImportJob.ImportJobState",
6348            ))
6349        }
6350    }
6351}
6352
6353/// ExternalProtectionLevelOptions stores a group of additional fields for
6354/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
6355/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
6356/// protection level and
6357/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
6358/// levels.
6359///
6360/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6361/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
6362/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6363#[derive(Clone, Default, PartialEq)]
6364#[non_exhaustive]
6365pub struct ExternalProtectionLevelOptions {
6366    /// The URI for an external resource that this
6367    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
6368    ///
6369    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6370    pub external_key_uri: std::string::String,
6371
6372    /// The path to the external key material on the EKM when using
6373    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
6374    /// this field instead of external_key_uri when using an
6375    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
6376    ///
6377    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
6378    pub ekm_connection_key_path: std::string::String,
6379
6380    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6381}
6382
6383impl ExternalProtectionLevelOptions {
6384    pub fn new() -> Self {
6385        std::default::Default::default()
6386    }
6387
6388    /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
6389    ///
6390    /// # Example
6391    /// ```ignore,no_run
6392    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
6393    /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
6394    /// ```
6395    pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
6396        mut self,
6397        v: T,
6398    ) -> Self {
6399        self.external_key_uri = v.into();
6400        self
6401    }
6402
6403    /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
6404    ///
6405    /// # Example
6406    /// ```ignore,no_run
6407    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
6408    /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
6409    /// ```
6410    pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
6411        mut self,
6412        v: T,
6413    ) -> Self {
6414        self.ekm_connection_key_path = v.into();
6415        self
6416    }
6417}
6418
6419impl wkt::message::Message for ExternalProtectionLevelOptions {
6420    fn typename() -> &'static str {
6421        "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
6422    }
6423}
6424
6425/// A
6426/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
6427/// specifies zero or more allowed
6428/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
6429/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey].
6430///
6431/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
6432/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6433/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
6434#[derive(Clone, Default, PartialEq)]
6435#[non_exhaustive]
6436pub struct KeyAccessJustificationsPolicy {
6437    /// The list of allowed reasons for access to a
6438    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Zero allowed access reasons
6439    /// means all encrypt, decrypt, and sign operations for the
6440    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with this policy will
6441    /// fail.
6442    ///
6443    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6444    pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
6445
6446    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6447}
6448
6449impl KeyAccessJustificationsPolicy {
6450    pub fn new() -> Self {
6451        std::default::Default::default()
6452    }
6453
6454    /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
6455    ///
6456    /// # Example
6457    /// ```ignore,no_run
6458    /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6459    /// use google_cloud_kms_v1::model::AccessReason;
6460    /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
6461    ///     AccessReason::CustomerInitiatedSupport,
6462    ///     AccessReason::GoogleInitiatedService,
6463    ///     AccessReason::ThirdPartyDataRequest,
6464    /// ]);
6465    /// ```
6466    pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
6467    where
6468        T: std::iter::IntoIterator<Item = V>,
6469        V: std::convert::Into<crate::model::AccessReason>,
6470    {
6471        use std::iter::Iterator;
6472        self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
6473        self
6474    }
6475}
6476
6477impl wkt::message::Message for KeyAccessJustificationsPolicy {
6478    fn typename() -> &'static str {
6479        "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
6480    }
6481}
6482
6483/// Request message for
6484/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
6485///
6486/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
6487#[derive(Clone, Default, PartialEq)]
6488#[non_exhaustive]
6489pub struct ListKeyRingsRequest {
6490    /// Required. The resource name of the location associated with the
6491    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
6492    /// `projects/*/locations/*`.
6493    ///
6494    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6495    pub parent: std::string::String,
6496
6497    /// Optional. Optional limit on the number of
6498    /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
6499    /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
6500    /// including the
6501    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
6502    /// in a subsequent request.  If unspecified, the server will pick an
6503    /// appropriate default.
6504    ///
6505    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6506    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
6507    pub page_size: i32,
6508
6509    /// Optional. Optional pagination token, returned earlier via
6510    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
6511    ///
6512    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
6513    pub page_token: std::string::String,
6514
6515    /// Optional. Only include resources that match the filter in the response. For
6516    /// more information, see
6517    /// [Sorting and filtering list
6518    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6519    pub filter: std::string::String,
6520
6521    /// Optional. Specify how the results should be sorted. If not specified, the
6522    /// results will be sorted in the default order.  For more information, see
6523    /// [Sorting and filtering list
6524    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6525    pub order_by: std::string::String,
6526
6527    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6528}
6529
6530impl ListKeyRingsRequest {
6531    pub fn new() -> Self {
6532        std::default::Default::default()
6533    }
6534
6535    /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
6536    ///
6537    /// # Example
6538    /// ```ignore,no_run
6539    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
6540    /// let x = ListKeyRingsRequest::new().set_parent("example");
6541    /// ```
6542    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6543        self.parent = v.into();
6544        self
6545    }
6546
6547    /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
6548    ///
6549    /// # Example
6550    /// ```ignore,no_run
6551    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
6552    /// let x = ListKeyRingsRequest::new().set_page_size(42);
6553    /// ```
6554    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6555        self.page_size = v.into();
6556        self
6557    }
6558
6559    /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
6560    ///
6561    /// # Example
6562    /// ```ignore,no_run
6563    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
6564    /// let x = ListKeyRingsRequest::new().set_page_token("example");
6565    /// ```
6566    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6567        self.page_token = v.into();
6568        self
6569    }
6570
6571    /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
6572    ///
6573    /// # Example
6574    /// ```ignore,no_run
6575    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
6576    /// let x = ListKeyRingsRequest::new().set_filter("example");
6577    /// ```
6578    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6579        self.filter = v.into();
6580        self
6581    }
6582
6583    /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
6584    ///
6585    /// # Example
6586    /// ```ignore,no_run
6587    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
6588    /// let x = ListKeyRingsRequest::new().set_order_by("example");
6589    /// ```
6590    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6591        self.order_by = v.into();
6592        self
6593    }
6594}
6595
6596impl wkt::message::Message for ListKeyRingsRequest {
6597    fn typename() -> &'static str {
6598        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
6599    }
6600}
6601
6602/// Request message for
6603/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
6604///
6605/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
6606#[derive(Clone, Default, PartialEq)]
6607#[non_exhaustive]
6608pub struct ListCryptoKeysRequest {
6609    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
6610    /// to list, in the format `projects/*/locations/*/keyRings/*`.
6611    ///
6612    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6613    pub parent: std::string::String,
6614
6615    /// Optional. Optional limit on the number of
6616    /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
6617    /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
6618    /// obtained by including the
6619    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
6620    /// in a subsequent request.  If unspecified, the server will pick an
6621    /// appropriate default.
6622    ///
6623    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6624    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
6625    pub page_size: i32,
6626
6627    /// Optional. Optional pagination token, returned earlier via
6628    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
6629    ///
6630    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
6631    pub page_token: std::string::String,
6632
6633    /// The fields of the primary version to include in the response.
6634    pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
6635
6636    /// Optional. Only include resources that match the filter in the response. For
6637    /// more information, see
6638    /// [Sorting and filtering list
6639    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6640    pub filter: std::string::String,
6641
6642    /// Optional. Specify how the results should be sorted. If not specified, the
6643    /// results will be sorted in the default order. For more information, see
6644    /// [Sorting and filtering list
6645    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6646    pub order_by: std::string::String,
6647
6648    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6649}
6650
6651impl ListCryptoKeysRequest {
6652    pub fn new() -> Self {
6653        std::default::Default::default()
6654    }
6655
6656    /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
6657    ///
6658    /// # Example
6659    /// ```ignore,no_run
6660    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
6661    /// let x = ListCryptoKeysRequest::new().set_parent("example");
6662    /// ```
6663    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6664        self.parent = v.into();
6665        self
6666    }
6667
6668    /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
6669    ///
6670    /// # Example
6671    /// ```ignore,no_run
6672    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
6673    /// let x = ListCryptoKeysRequest::new().set_page_size(42);
6674    /// ```
6675    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6676        self.page_size = v.into();
6677        self
6678    }
6679
6680    /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
6681    ///
6682    /// # Example
6683    /// ```ignore,no_run
6684    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
6685    /// let x = ListCryptoKeysRequest::new().set_page_token("example");
6686    /// ```
6687    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6688        self.page_token = v.into();
6689        self
6690    }
6691
6692    /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
6693    ///
6694    /// # Example
6695    /// ```ignore,no_run
6696    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
6697    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
6698    /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
6699    /// ```
6700    pub fn set_version_view<
6701        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
6702    >(
6703        mut self,
6704        v: T,
6705    ) -> Self {
6706        self.version_view = v.into();
6707        self
6708    }
6709
6710    /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
6711    ///
6712    /// # Example
6713    /// ```ignore,no_run
6714    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
6715    /// let x = ListCryptoKeysRequest::new().set_filter("example");
6716    /// ```
6717    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6718        self.filter = v.into();
6719        self
6720    }
6721
6722    /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
6723    ///
6724    /// # Example
6725    /// ```ignore,no_run
6726    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
6727    /// let x = ListCryptoKeysRequest::new().set_order_by("example");
6728    /// ```
6729    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6730        self.order_by = v.into();
6731        self
6732    }
6733}
6734
6735impl wkt::message::Message for ListCryptoKeysRequest {
6736    fn typename() -> &'static str {
6737        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
6738    }
6739}
6740
6741/// Request message for
6742/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
6743///
6744/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
6745#[derive(Clone, Default, PartialEq)]
6746#[non_exhaustive]
6747pub struct ListCryptoKeyVersionsRequest {
6748    /// Required. The resource name of the
6749    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
6750    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6751    ///
6752    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6753    pub parent: std::string::String,
6754
6755    /// Optional. Optional limit on the number of
6756    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
6757    /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6758    /// can subsequently be obtained by including the
6759    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
6760    /// in a subsequent request. If unspecified, the server will pick an
6761    /// appropriate default.
6762    ///
6763    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6764    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
6765    pub page_size: i32,
6766
6767    /// Optional. Optional pagination token, returned earlier via
6768    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
6769    ///
6770    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
6771    pub page_token: std::string::String,
6772
6773    /// The fields to include in the response.
6774    pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
6775
6776    /// Optional. Only include resources that match the filter in the response. For
6777    /// more information, see
6778    /// [Sorting and filtering list
6779    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6780    pub filter: std::string::String,
6781
6782    /// Optional. Specify how the results should be sorted. If not specified, the
6783    /// results will be sorted in the default order. For more information, see
6784    /// [Sorting and filtering list
6785    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6786    pub order_by: std::string::String,
6787
6788    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6789}
6790
6791impl ListCryptoKeyVersionsRequest {
6792    pub fn new() -> Self {
6793        std::default::Default::default()
6794    }
6795
6796    /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
6797    ///
6798    /// # Example
6799    /// ```ignore,no_run
6800    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
6801    /// let x = ListCryptoKeyVersionsRequest::new().set_parent("example");
6802    /// ```
6803    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6804        self.parent = v.into();
6805        self
6806    }
6807
6808    /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
6809    ///
6810    /// # Example
6811    /// ```ignore,no_run
6812    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
6813    /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
6814    /// ```
6815    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6816        self.page_size = v.into();
6817        self
6818    }
6819
6820    /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
6821    ///
6822    /// # Example
6823    /// ```ignore,no_run
6824    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
6825    /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
6826    /// ```
6827    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6828        self.page_token = v.into();
6829        self
6830    }
6831
6832    /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
6833    ///
6834    /// # Example
6835    /// ```ignore,no_run
6836    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
6837    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
6838    /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
6839    /// ```
6840    pub fn set_view<
6841        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
6842    >(
6843        mut self,
6844        v: T,
6845    ) -> Self {
6846        self.view = v.into();
6847        self
6848    }
6849
6850    /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
6851    ///
6852    /// # Example
6853    /// ```ignore,no_run
6854    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
6855    /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
6856    /// ```
6857    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6858        self.filter = v.into();
6859        self
6860    }
6861
6862    /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
6863    ///
6864    /// # Example
6865    /// ```ignore,no_run
6866    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
6867    /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
6868    /// ```
6869    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6870        self.order_by = v.into();
6871        self
6872    }
6873}
6874
6875impl wkt::message::Message for ListCryptoKeyVersionsRequest {
6876    fn typename() -> &'static str {
6877        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
6878    }
6879}
6880
6881/// Request message for
6882/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
6883///
6884/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
6885#[derive(Clone, Default, PartialEq)]
6886#[non_exhaustive]
6887pub struct ListImportJobsRequest {
6888    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
6889    /// to list, in the format `projects/*/locations/*/keyRings/*`.
6890    ///
6891    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6892    pub parent: std::string::String,
6893
6894    /// Optional. Optional limit on the number of
6895    /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
6896    /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
6897    /// obtained by including the
6898    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
6899    /// in a subsequent request. If unspecified, the server will pick an
6900    /// appropriate default.
6901    ///
6902    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6903    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
6904    pub page_size: i32,
6905
6906    /// Optional. Optional pagination token, returned earlier via
6907    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
6908    ///
6909    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
6910    pub page_token: std::string::String,
6911
6912    /// Optional. Only include resources that match the filter in the response. For
6913    /// more information, see
6914    /// [Sorting and filtering list
6915    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6916    pub filter: std::string::String,
6917
6918    /// Optional. Specify how the results should be sorted. If not specified, the
6919    /// results will be sorted in the default order. For more information, see
6920    /// [Sorting and filtering list
6921    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6922    pub order_by: std::string::String,
6923
6924    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6925}
6926
6927impl ListImportJobsRequest {
6928    pub fn new() -> Self {
6929        std::default::Default::default()
6930    }
6931
6932    /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
6933    ///
6934    /// # Example
6935    /// ```ignore,no_run
6936    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
6937    /// let x = ListImportJobsRequest::new().set_parent("example");
6938    /// ```
6939    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6940        self.parent = v.into();
6941        self
6942    }
6943
6944    /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
6945    ///
6946    /// # Example
6947    /// ```ignore,no_run
6948    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
6949    /// let x = ListImportJobsRequest::new().set_page_size(42);
6950    /// ```
6951    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6952        self.page_size = v.into();
6953        self
6954    }
6955
6956    /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
6957    ///
6958    /// # Example
6959    /// ```ignore,no_run
6960    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
6961    /// let x = ListImportJobsRequest::new().set_page_token("example");
6962    /// ```
6963    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6964        self.page_token = v.into();
6965        self
6966    }
6967
6968    /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
6969    ///
6970    /// # Example
6971    /// ```ignore,no_run
6972    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
6973    /// let x = ListImportJobsRequest::new().set_filter("example");
6974    /// ```
6975    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6976        self.filter = v.into();
6977        self
6978    }
6979
6980    /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
6981    ///
6982    /// # Example
6983    /// ```ignore,no_run
6984    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
6985    /// let x = ListImportJobsRequest::new().set_order_by("example");
6986    /// ```
6987    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6988        self.order_by = v.into();
6989        self
6990    }
6991}
6992
6993impl wkt::message::Message for ListImportJobsRequest {
6994    fn typename() -> &'static str {
6995        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
6996    }
6997}
6998
6999/// Response message for
7000/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
7001///
7002/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
7003#[derive(Clone, Default, PartialEq)]
7004#[non_exhaustive]
7005pub struct ListKeyRingsResponse {
7006    /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
7007    ///
7008    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
7009    pub key_rings: std::vec::Vec<crate::model::KeyRing>,
7010
7011    /// A token to retrieve next page of results. Pass this value in
7012    /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
7013    /// to retrieve the next page of results.
7014    ///
7015    /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
7016    pub next_page_token: std::string::String,
7017
7018    /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
7019    /// the query.
7020    ///
7021    /// This field is not populated if
7022    /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
7023    /// is applied.
7024    ///
7025    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
7026    /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
7027    pub total_size: i32,
7028
7029    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7030}
7031
7032impl ListKeyRingsResponse {
7033    pub fn new() -> Self {
7034        std::default::Default::default()
7035    }
7036
7037    /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
7038    ///
7039    /// # Example
7040    /// ```ignore,no_run
7041    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
7042    /// use google_cloud_kms_v1::model::KeyRing;
7043    /// let x = ListKeyRingsResponse::new()
7044    ///     .set_key_rings([
7045    ///         KeyRing::default()/* use setters */,
7046    ///         KeyRing::default()/* use (different) setters */,
7047    ///     ]);
7048    /// ```
7049    pub fn set_key_rings<T, V>(mut self, v: T) -> Self
7050    where
7051        T: std::iter::IntoIterator<Item = V>,
7052        V: std::convert::Into<crate::model::KeyRing>,
7053    {
7054        use std::iter::Iterator;
7055        self.key_rings = v.into_iter().map(|i| i.into()).collect();
7056        self
7057    }
7058
7059    /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
7060    ///
7061    /// # Example
7062    /// ```ignore,no_run
7063    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
7064    /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
7065    /// ```
7066    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7067        self.next_page_token = v.into();
7068        self
7069    }
7070
7071    /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
7072    ///
7073    /// # Example
7074    /// ```ignore,no_run
7075    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
7076    /// let x = ListKeyRingsResponse::new().set_total_size(42);
7077    /// ```
7078    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7079        self.total_size = v.into();
7080        self
7081    }
7082}
7083
7084impl wkt::message::Message for ListKeyRingsResponse {
7085    fn typename() -> &'static str {
7086        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
7087    }
7088}
7089
7090#[doc(hidden)]
7091impl gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
7092    type PageItem = crate::model::KeyRing;
7093
7094    fn items(self) -> std::vec::Vec<Self::PageItem> {
7095        self.key_rings
7096    }
7097
7098    fn next_page_token(&self) -> std::string::String {
7099        use std::clone::Clone;
7100        self.next_page_token.clone()
7101    }
7102}
7103
7104/// Response message for
7105/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
7106///
7107/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
7108#[derive(Clone, Default, PartialEq)]
7109#[non_exhaustive]
7110pub struct ListCryptoKeysResponse {
7111    /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
7112    ///
7113    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7114    pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
7115
7116    /// A token to retrieve next page of results. Pass this value in
7117    /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
7118    /// to retrieve the next page of results.
7119    ///
7120    /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
7121    pub next_page_token: std::string::String,
7122
7123    /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
7124    /// matched the query.
7125    ///
7126    /// This field is not populated if
7127    /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
7128    /// is applied.
7129    ///
7130    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7131    /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
7132    pub total_size: i32,
7133
7134    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7135}
7136
7137impl ListCryptoKeysResponse {
7138    pub fn new() -> Self {
7139        std::default::Default::default()
7140    }
7141
7142    /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
7143    ///
7144    /// # Example
7145    /// ```ignore,no_run
7146    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
7147    /// use google_cloud_kms_v1::model::CryptoKey;
7148    /// let x = ListCryptoKeysResponse::new()
7149    ///     .set_crypto_keys([
7150    ///         CryptoKey::default()/* use setters */,
7151    ///         CryptoKey::default()/* use (different) setters */,
7152    ///     ]);
7153    /// ```
7154    pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
7155    where
7156        T: std::iter::IntoIterator<Item = V>,
7157        V: std::convert::Into<crate::model::CryptoKey>,
7158    {
7159        use std::iter::Iterator;
7160        self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
7161        self
7162    }
7163
7164    /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
7165    ///
7166    /// # Example
7167    /// ```ignore,no_run
7168    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
7169    /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
7170    /// ```
7171    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7172        self.next_page_token = v.into();
7173        self
7174    }
7175
7176    /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
7177    ///
7178    /// # Example
7179    /// ```ignore,no_run
7180    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
7181    /// let x = ListCryptoKeysResponse::new().set_total_size(42);
7182    /// ```
7183    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7184        self.total_size = v.into();
7185        self
7186    }
7187}
7188
7189impl wkt::message::Message for ListCryptoKeysResponse {
7190    fn typename() -> &'static str {
7191        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
7192    }
7193}
7194
7195#[doc(hidden)]
7196impl gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
7197    type PageItem = crate::model::CryptoKey;
7198
7199    fn items(self) -> std::vec::Vec<Self::PageItem> {
7200        self.crypto_keys
7201    }
7202
7203    fn next_page_token(&self) -> std::string::String {
7204        use std::clone::Clone;
7205        self.next_page_token.clone()
7206    }
7207}
7208
7209/// Response message for
7210/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
7211///
7212/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
7213#[derive(Clone, Default, PartialEq)]
7214#[non_exhaustive]
7215pub struct ListCryptoKeyVersionsResponse {
7216    /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
7217    ///
7218    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7219    pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
7220
7221    /// A token to retrieve next page of results. Pass this value in
7222    /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
7223    /// to retrieve the next page of results.
7224    ///
7225    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
7226    pub next_page_token: std::string::String,
7227
7228    /// The total number of
7229    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
7230    /// query.
7231    ///
7232    /// This field is not populated if
7233    /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
7234    /// is applied.
7235    ///
7236    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7237    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
7238    pub total_size: i32,
7239
7240    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7241}
7242
7243impl ListCryptoKeyVersionsResponse {
7244    pub fn new() -> Self {
7245        std::default::Default::default()
7246    }
7247
7248    /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
7249    ///
7250    /// # Example
7251    /// ```ignore,no_run
7252    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
7253    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
7254    /// let x = ListCryptoKeyVersionsResponse::new()
7255    ///     .set_crypto_key_versions([
7256    ///         CryptoKeyVersion::default()/* use setters */,
7257    ///         CryptoKeyVersion::default()/* use (different) setters */,
7258    ///     ]);
7259    /// ```
7260    pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
7261    where
7262        T: std::iter::IntoIterator<Item = V>,
7263        V: std::convert::Into<crate::model::CryptoKeyVersion>,
7264    {
7265        use std::iter::Iterator;
7266        self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
7267        self
7268    }
7269
7270    /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
7271    ///
7272    /// # Example
7273    /// ```ignore,no_run
7274    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
7275    /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
7276    /// ```
7277    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7278        self.next_page_token = v.into();
7279        self
7280    }
7281
7282    /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
7283    ///
7284    /// # Example
7285    /// ```ignore,no_run
7286    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
7287    /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
7288    /// ```
7289    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7290        self.total_size = v.into();
7291        self
7292    }
7293}
7294
7295impl wkt::message::Message for ListCryptoKeyVersionsResponse {
7296    fn typename() -> &'static str {
7297        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
7298    }
7299}
7300
7301#[doc(hidden)]
7302impl gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
7303    type PageItem = crate::model::CryptoKeyVersion;
7304
7305    fn items(self) -> std::vec::Vec<Self::PageItem> {
7306        self.crypto_key_versions
7307    }
7308
7309    fn next_page_token(&self) -> std::string::String {
7310        use std::clone::Clone;
7311        self.next_page_token.clone()
7312    }
7313}
7314
7315/// Response message for
7316/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
7317///
7318/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
7319#[derive(Clone, Default, PartialEq)]
7320#[non_exhaustive]
7321pub struct ListImportJobsResponse {
7322    /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
7323    ///
7324    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7325    pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
7326
7327    /// A token to retrieve next page of results. Pass this value in
7328    /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
7329    /// to retrieve the next page of results.
7330    ///
7331    /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
7332    pub next_page_token: std::string::String,
7333
7334    /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
7335    /// matched the query.
7336    ///
7337    /// This field is not populated if
7338    /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
7339    /// is applied.
7340    ///
7341    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7342    /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
7343    pub total_size: i32,
7344
7345    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7346}
7347
7348impl ListImportJobsResponse {
7349    pub fn new() -> Self {
7350        std::default::Default::default()
7351    }
7352
7353    /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
7354    ///
7355    /// # Example
7356    /// ```ignore,no_run
7357    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
7358    /// use google_cloud_kms_v1::model::ImportJob;
7359    /// let x = ListImportJobsResponse::new()
7360    ///     .set_import_jobs([
7361    ///         ImportJob::default()/* use setters */,
7362    ///         ImportJob::default()/* use (different) setters */,
7363    ///     ]);
7364    /// ```
7365    pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
7366    where
7367        T: std::iter::IntoIterator<Item = V>,
7368        V: std::convert::Into<crate::model::ImportJob>,
7369    {
7370        use std::iter::Iterator;
7371        self.import_jobs = v.into_iter().map(|i| i.into()).collect();
7372        self
7373    }
7374
7375    /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
7376    ///
7377    /// # Example
7378    /// ```ignore,no_run
7379    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
7380    /// let x = ListImportJobsResponse::new().set_next_page_token("example");
7381    /// ```
7382    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7383        self.next_page_token = v.into();
7384        self
7385    }
7386
7387    /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
7388    ///
7389    /// # Example
7390    /// ```ignore,no_run
7391    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
7392    /// let x = ListImportJobsResponse::new().set_total_size(42);
7393    /// ```
7394    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7395        self.total_size = v.into();
7396        self
7397    }
7398}
7399
7400impl wkt::message::Message for ListImportJobsResponse {
7401    fn typename() -> &'static str {
7402        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
7403    }
7404}
7405
7406#[doc(hidden)]
7407impl gax::paginator::internal::PageableResponse for ListImportJobsResponse {
7408    type PageItem = crate::model::ImportJob;
7409
7410    fn items(self) -> std::vec::Vec<Self::PageItem> {
7411        self.import_jobs
7412    }
7413
7414    fn next_page_token(&self) -> std::string::String {
7415        use std::clone::Clone;
7416        self.next_page_token.clone()
7417    }
7418}
7419
7420/// Request message for
7421/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
7422///
7423/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
7424#[derive(Clone, Default, PartialEq)]
7425#[non_exhaustive]
7426pub struct GetKeyRingRequest {
7427    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
7428    /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
7429    ///
7430    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
7431    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
7432    pub name: std::string::String,
7433
7434    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7435}
7436
7437impl GetKeyRingRequest {
7438    pub fn new() -> Self {
7439        std::default::Default::default()
7440    }
7441
7442    /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
7443    ///
7444    /// # Example
7445    /// ```ignore,no_run
7446    /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
7447    /// let x = GetKeyRingRequest::new().set_name("example");
7448    /// ```
7449    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7450        self.name = v.into();
7451        self
7452    }
7453}
7454
7455impl wkt::message::Message for GetKeyRingRequest {
7456    fn typename() -> &'static str {
7457        "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
7458    }
7459}
7460
7461/// Request message for
7462/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
7463///
7464/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
7465#[derive(Clone, Default, PartialEq)]
7466#[non_exhaustive]
7467pub struct GetCryptoKeyRequest {
7468    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
7469    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
7470    ///
7471    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7472    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
7473    pub name: std::string::String,
7474
7475    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7476}
7477
7478impl GetCryptoKeyRequest {
7479    pub fn new() -> Self {
7480        std::default::Default::default()
7481    }
7482
7483    /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
7484    ///
7485    /// # Example
7486    /// ```ignore,no_run
7487    /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
7488    /// let x = GetCryptoKeyRequest::new().set_name("example");
7489    /// ```
7490    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7491        self.name = v.into();
7492        self
7493    }
7494}
7495
7496impl wkt::message::Message for GetCryptoKeyRequest {
7497    fn typename() -> &'static str {
7498        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
7499    }
7500}
7501
7502/// Request message for
7503/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
7504///
7505/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
7506#[derive(Clone, Default, PartialEq)]
7507#[non_exhaustive]
7508pub struct GetCryptoKeyVersionRequest {
7509    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
7510    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
7511    ///
7512    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7513    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
7514    pub name: std::string::String,
7515
7516    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7517}
7518
7519impl GetCryptoKeyVersionRequest {
7520    pub fn new() -> Self {
7521        std::default::Default::default()
7522    }
7523
7524    /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
7525    ///
7526    /// # Example
7527    /// ```ignore,no_run
7528    /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
7529    /// let x = GetCryptoKeyVersionRequest::new().set_name("example");
7530    /// ```
7531    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7532        self.name = v.into();
7533        self
7534    }
7535}
7536
7537impl wkt::message::Message for GetCryptoKeyVersionRequest {
7538    fn typename() -> &'static str {
7539        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
7540    }
7541}
7542
7543/// Request message for
7544/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
7545///
7546/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7547#[derive(Clone, Default, PartialEq)]
7548#[non_exhaustive]
7549pub struct GetPublicKeyRequest {
7550    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
7551    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
7552    ///
7553    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7554    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
7555    pub name: std::string::String,
7556
7557    /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
7558    /// by the user. This field is required for PQC algorithms. If specified, the
7559    /// public key will be exported through the
7560    /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
7561    /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
7562    /// field will be populated for non-PQC algorithms, and an error will be
7563    /// returned for PQC algorithms.
7564    ///
7565    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
7566    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
7567    /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
7568    pub public_key_format: crate::model::public_key::PublicKeyFormat,
7569
7570    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7571}
7572
7573impl GetPublicKeyRequest {
7574    pub fn new() -> Self {
7575        std::default::Default::default()
7576    }
7577
7578    /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
7579    ///
7580    /// # Example
7581    /// ```ignore,no_run
7582    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
7583    /// let x = GetPublicKeyRequest::new().set_name("example");
7584    /// ```
7585    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7586        self.name = v.into();
7587        self
7588    }
7589
7590    /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
7591    ///
7592    /// # Example
7593    /// ```ignore,no_run
7594    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
7595    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
7596    /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
7597    /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
7598    /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
7599    /// ```
7600    pub fn set_public_key_format<
7601        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
7602    >(
7603        mut self,
7604        v: T,
7605    ) -> Self {
7606        self.public_key_format = v.into();
7607        self
7608    }
7609}
7610
7611impl wkt::message::Message for GetPublicKeyRequest {
7612    fn typename() -> &'static str {
7613        "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
7614    }
7615}
7616
7617/// Request message for
7618/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
7619///
7620/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
7621#[derive(Clone, Default, PartialEq)]
7622#[non_exhaustive]
7623pub struct GetImportJobRequest {
7624    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
7625    /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
7626    ///
7627    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7628    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
7629    pub name: std::string::String,
7630
7631    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7632}
7633
7634impl GetImportJobRequest {
7635    pub fn new() -> Self {
7636        std::default::Default::default()
7637    }
7638
7639    /// Sets the value of [name][crate::model::GetImportJobRequest::name].
7640    ///
7641    /// # Example
7642    /// ```ignore,no_run
7643    /// # use google_cloud_kms_v1::model::GetImportJobRequest;
7644    /// let x = GetImportJobRequest::new().set_name("example");
7645    /// ```
7646    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7647        self.name = v.into();
7648        self
7649    }
7650}
7651
7652impl wkt::message::Message for GetImportJobRequest {
7653    fn typename() -> &'static str {
7654        "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
7655    }
7656}
7657
7658/// Request message for
7659/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
7660///
7661/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
7662#[derive(Clone, Default, PartialEq)]
7663#[non_exhaustive]
7664pub struct CreateKeyRingRequest {
7665    /// Required. The resource name of the location associated with the
7666    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
7667    /// `projects/*/locations/*`.
7668    ///
7669    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
7670    pub parent: std::string::String,
7671
7672    /// Required. It must be unique within a location and match the regular
7673    /// expression `[a-zA-Z0-9_-]{1,63}`
7674    pub key_ring_id: std::string::String,
7675
7676    /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
7677    /// values.
7678    ///
7679    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
7680    pub key_ring: std::option::Option<crate::model::KeyRing>,
7681
7682    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7683}
7684
7685impl CreateKeyRingRequest {
7686    pub fn new() -> Self {
7687        std::default::Default::default()
7688    }
7689
7690    /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
7691    ///
7692    /// # Example
7693    /// ```ignore,no_run
7694    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
7695    /// let x = CreateKeyRingRequest::new().set_parent("example");
7696    /// ```
7697    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7698        self.parent = v.into();
7699        self
7700    }
7701
7702    /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
7703    ///
7704    /// # Example
7705    /// ```ignore,no_run
7706    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
7707    /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
7708    /// ```
7709    pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7710        self.key_ring_id = v.into();
7711        self
7712    }
7713
7714    /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
7715    ///
7716    /// # Example
7717    /// ```ignore,no_run
7718    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
7719    /// use google_cloud_kms_v1::model::KeyRing;
7720    /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
7721    /// ```
7722    pub fn set_key_ring<T>(mut self, v: T) -> Self
7723    where
7724        T: std::convert::Into<crate::model::KeyRing>,
7725    {
7726        self.key_ring = std::option::Option::Some(v.into());
7727        self
7728    }
7729
7730    /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
7731    ///
7732    /// # Example
7733    /// ```ignore,no_run
7734    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
7735    /// use google_cloud_kms_v1::model::KeyRing;
7736    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
7737    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
7738    /// ```
7739    pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
7740    where
7741        T: std::convert::Into<crate::model::KeyRing>,
7742    {
7743        self.key_ring = v.map(|x| x.into());
7744        self
7745    }
7746}
7747
7748impl wkt::message::Message for CreateKeyRingRequest {
7749    fn typename() -> &'static str {
7750        "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
7751    }
7752}
7753
7754/// Request message for
7755/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
7756///
7757/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
7758#[derive(Clone, Default, PartialEq)]
7759#[non_exhaustive]
7760pub struct CreateCryptoKeyRequest {
7761    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
7762    /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
7763    ///
7764    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7765    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
7766    pub parent: std::string::String,
7767
7768    /// Required. It must be unique within a KeyRing and match the regular
7769    /// expression `[a-zA-Z0-9_-]{1,63}`
7770    pub crypto_key_id: std::string::String,
7771
7772    /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
7773    /// values.
7774    ///
7775    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7776    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
7777
7778    /// If set to true, the request will create a
7779    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
7780    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
7781    /// manually call
7782    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
7783    /// or
7784    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
7785    /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
7786    ///
7787    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7788    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7789    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7790    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
7791    pub skip_initial_version_creation: bool,
7792
7793    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7794}
7795
7796impl CreateCryptoKeyRequest {
7797    pub fn new() -> Self {
7798        std::default::Default::default()
7799    }
7800
7801    /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
7802    ///
7803    /// # Example
7804    /// ```ignore,no_run
7805    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
7806    /// let x = CreateCryptoKeyRequest::new().set_parent("example");
7807    /// ```
7808    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7809        self.parent = v.into();
7810        self
7811    }
7812
7813    /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
7814    ///
7815    /// # Example
7816    /// ```ignore,no_run
7817    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
7818    /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
7819    /// ```
7820    pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7821        self.crypto_key_id = v.into();
7822        self
7823    }
7824
7825    /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
7826    ///
7827    /// # Example
7828    /// ```ignore,no_run
7829    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
7830    /// use google_cloud_kms_v1::model::CryptoKey;
7831    /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
7832    /// ```
7833    pub fn set_crypto_key<T>(mut self, v: T) -> Self
7834    where
7835        T: std::convert::Into<crate::model::CryptoKey>,
7836    {
7837        self.crypto_key = std::option::Option::Some(v.into());
7838        self
7839    }
7840
7841    /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
7842    ///
7843    /// # Example
7844    /// ```ignore,no_run
7845    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
7846    /// use google_cloud_kms_v1::model::CryptoKey;
7847    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
7848    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
7849    /// ```
7850    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
7851    where
7852        T: std::convert::Into<crate::model::CryptoKey>,
7853    {
7854        self.crypto_key = v.map(|x| x.into());
7855        self
7856    }
7857
7858    /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
7859    ///
7860    /// # Example
7861    /// ```ignore,no_run
7862    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
7863    /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
7864    /// ```
7865    pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7866        self.skip_initial_version_creation = v.into();
7867        self
7868    }
7869}
7870
7871impl wkt::message::Message for CreateCryptoKeyRequest {
7872    fn typename() -> &'static str {
7873        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
7874    }
7875}
7876
7877/// Request message for
7878/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
7879///
7880/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7881#[derive(Clone, Default, PartialEq)]
7882#[non_exhaustive]
7883pub struct CreateCryptoKeyVersionRequest {
7884    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
7885    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
7886    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
7887    ///
7888    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7889    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
7890    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7891    pub parent: std::string::String,
7892
7893    /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
7894    /// initial field values.
7895    ///
7896    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7897    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
7898
7899    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7900}
7901
7902impl CreateCryptoKeyVersionRequest {
7903    pub fn new() -> Self {
7904        std::default::Default::default()
7905    }
7906
7907    /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
7908    ///
7909    /// # Example
7910    /// ```ignore,no_run
7911    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
7912    /// let x = CreateCryptoKeyVersionRequest::new().set_parent("example");
7913    /// ```
7914    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7915        self.parent = v.into();
7916        self
7917    }
7918
7919    /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
7920    ///
7921    /// # Example
7922    /// ```ignore,no_run
7923    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
7924    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
7925    /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
7926    /// ```
7927    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
7928    where
7929        T: std::convert::Into<crate::model::CryptoKeyVersion>,
7930    {
7931        self.crypto_key_version = std::option::Option::Some(v.into());
7932        self
7933    }
7934
7935    /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
7936    ///
7937    /// # Example
7938    /// ```ignore,no_run
7939    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
7940    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
7941    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
7942    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
7943    /// ```
7944    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
7945    where
7946        T: std::convert::Into<crate::model::CryptoKeyVersion>,
7947    {
7948        self.crypto_key_version = v.map(|x| x.into());
7949        self
7950    }
7951}
7952
7953impl wkt::message::Message for CreateCryptoKeyVersionRequest {
7954    fn typename() -> &'static str {
7955        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
7956    }
7957}
7958
7959/// Request message for
7960/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
7961///
7962/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
7963#[derive(Clone, Default, PartialEq)]
7964#[non_exhaustive]
7965pub struct ImportCryptoKeyVersionRequest {
7966    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
7967    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
7968    ///
7969    /// The create permission is only required on this key when creating a new
7970    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7971    ///
7972    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7973    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
7974    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7975    pub parent: std::string::String,
7976
7977    /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
7978    /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
7979    /// target for an import operation. If this field is not present, a new
7980    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
7981    /// supplied key material is created.
7982    ///
7983    /// If this field is present, the supplied key material is imported into
7984    /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
7985    /// import into an existing
7986    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
7987    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
7988    /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
7989    /// have been previously created via
7990    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
7991    /// and be in
7992    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
7993    /// or
7994    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
7995    /// state. The key material and algorithm must match the previous
7996    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
7997    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
7998    /// key material.
7999    ///
8000    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8001    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
8002    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
8003    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
8004    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
8005    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8006    pub crypto_key_version: std::string::String,
8007
8008    /// Required. The
8009    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
8010    /// of the key being imported. This does not need to match the
8011    /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
8012    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
8013    ///
8014    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
8015    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
8016    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
8017    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
8018
8019    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
8020    /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
8021    /// material.
8022    ///
8023    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
8024    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
8025    pub import_job: std::string::String,
8026
8027    /// Optional. The wrapped key material to import.
8028    ///
8029    /// Before wrapping, key material must be formatted. If importing symmetric key
8030    /// material, the expected key material format is plain bytes. If importing
8031    /// asymmetric key material, the expected key material format is PKCS#8-encoded
8032    /// DER (the PrivateKeyInfo structure from RFC 5208).
8033    ///
8034    /// When wrapping with import methods
8035    /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
8036    /// or
8037    /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
8038    /// or
8039    /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
8040    /// or
8041    /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
8042    ///
8043    /// this field must contain the concatenation of:
8044    ///
8045    /// This format is the same as the format produced by PKCS#11 mechanism
8046    /// CKM_RSA_AES_KEY_WRAP.
8047    ///
8048    /// When wrapping with import methods
8049    /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
8050    /// or
8051    /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
8052    ///
8053    /// this field must contain the formatted key to be imported, wrapped with the
8054    /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
8055    /// with SHA-256, MGF1 with SHA-256, and an empty label.
8056    ///
8057    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
8058    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
8059    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
8060    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
8061    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
8062    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
8063    /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
8064    pub wrapped_key: ::bytes::Bytes,
8065
8066    /// This field is legacy. Use the field
8067    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
8068    /// instead.
8069    ///
8070    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
8071    pub wrapped_key_material:
8072        std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
8073
8074    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8075}
8076
8077impl ImportCryptoKeyVersionRequest {
8078    pub fn new() -> Self {
8079        std::default::Default::default()
8080    }
8081
8082    /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
8083    ///
8084    /// # Example
8085    /// ```ignore,no_run
8086    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
8087    /// let x = ImportCryptoKeyVersionRequest::new().set_parent("example");
8088    /// ```
8089    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8090        self.parent = v.into();
8091        self
8092    }
8093
8094    /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
8095    ///
8096    /// # Example
8097    /// ```ignore,no_run
8098    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
8099    /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version("example");
8100    /// ```
8101    pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
8102        mut self,
8103        v: T,
8104    ) -> Self {
8105        self.crypto_key_version = v.into();
8106        self
8107    }
8108
8109    /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
8110    ///
8111    /// # Example
8112    /// ```ignore,no_run
8113    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
8114    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
8115    /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
8116    /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
8117    /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
8118    /// ```
8119    pub fn set_algorithm<
8120        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
8121    >(
8122        mut self,
8123        v: T,
8124    ) -> Self {
8125        self.algorithm = v.into();
8126        self
8127    }
8128
8129    /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
8130    ///
8131    /// # Example
8132    /// ```ignore,no_run
8133    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
8134    /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
8135    /// ```
8136    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8137        self.import_job = v.into();
8138        self
8139    }
8140
8141    /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
8142    ///
8143    /// # Example
8144    /// ```ignore,no_run
8145    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
8146    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
8147    /// ```
8148    pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8149        self.wrapped_key = v.into();
8150        self
8151    }
8152
8153    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
8154    ///
8155    /// Note that all the setters affecting `wrapped_key_material` are mutually
8156    /// exclusive.
8157    ///
8158    /// # Example
8159    /// ```ignore,no_run
8160    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
8161    /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
8162    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
8163    /// ```
8164    pub fn set_wrapped_key_material<
8165        T: std::convert::Into<
8166                std::option::Option<
8167                    crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
8168                >,
8169            >,
8170    >(
8171        mut self,
8172        v: T,
8173    ) -> Self {
8174        self.wrapped_key_material = v.into();
8175        self
8176    }
8177
8178    /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
8179    /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
8180    /// holds a different branch.
8181    pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
8182        #[allow(unreachable_patterns)]
8183        self.wrapped_key_material.as_ref().and_then(|v| match v {
8184            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
8185            _ => std::option::Option::None,
8186        })
8187    }
8188
8189    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
8190    /// to hold a `RsaAesWrappedKey`.
8191    ///
8192    /// Note that all the setters affecting `wrapped_key_material` are
8193    /// mutually exclusive.
8194    ///
8195    /// # Example
8196    /// ```ignore,no_run
8197    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
8198    /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
8199    /// assert!(x.rsa_aes_wrapped_key().is_some());
8200    /// ```
8201    pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8202        self.wrapped_key_material = std::option::Option::Some(
8203            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
8204                v.into(),
8205            ),
8206        );
8207        self
8208    }
8209}
8210
8211impl wkt::message::Message for ImportCryptoKeyVersionRequest {
8212    fn typename() -> &'static str {
8213        "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
8214    }
8215}
8216
8217/// Defines additional types related to [ImportCryptoKeyVersionRequest].
8218pub mod import_crypto_key_version_request {
8219    #[allow(unused_imports)]
8220    use super::*;
8221
8222    /// This field is legacy. Use the field
8223    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
8224    /// instead.
8225    ///
8226    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
8227    #[derive(Clone, Debug, PartialEq)]
8228    #[non_exhaustive]
8229    pub enum WrappedKeyMaterial {
8230        /// Optional. This field has the same meaning as
8231        /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
8232        /// Prefer to use that field in new work. Either that field or this field
8233        /// (but not both) must be specified.
8234        ///
8235        /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
8236        RsaAesWrappedKey(::bytes::Bytes),
8237    }
8238}
8239
8240/// Request message for
8241/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
8242///
8243/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
8244#[derive(Clone, Default, PartialEq)]
8245#[non_exhaustive]
8246pub struct CreateImportJobRequest {
8247    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
8248    /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
8249    /// [ImportJobs][google.cloud.kms.v1.ImportJob].
8250    ///
8251    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
8252    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
8253    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
8254    pub parent: std::string::String,
8255
8256    /// Required. It must be unique within a KeyRing and match the regular
8257    /// expression `[a-zA-Z0-9_-]{1,63}`
8258    pub import_job_id: std::string::String,
8259
8260    /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
8261    /// values.
8262    ///
8263    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
8264    pub import_job: std::option::Option<crate::model::ImportJob>,
8265
8266    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8267}
8268
8269impl CreateImportJobRequest {
8270    pub fn new() -> Self {
8271        std::default::Default::default()
8272    }
8273
8274    /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
8275    ///
8276    /// # Example
8277    /// ```ignore,no_run
8278    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
8279    /// let x = CreateImportJobRequest::new().set_parent("example");
8280    /// ```
8281    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8282        self.parent = v.into();
8283        self
8284    }
8285
8286    /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
8287    ///
8288    /// # Example
8289    /// ```ignore,no_run
8290    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
8291    /// let x = CreateImportJobRequest::new().set_import_job_id("example");
8292    /// ```
8293    pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8294        self.import_job_id = v.into();
8295        self
8296    }
8297
8298    /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
8299    ///
8300    /// # Example
8301    /// ```ignore,no_run
8302    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
8303    /// use google_cloud_kms_v1::model::ImportJob;
8304    /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
8305    /// ```
8306    pub fn set_import_job<T>(mut self, v: T) -> Self
8307    where
8308        T: std::convert::Into<crate::model::ImportJob>,
8309    {
8310        self.import_job = std::option::Option::Some(v.into());
8311        self
8312    }
8313
8314    /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
8315    ///
8316    /// # Example
8317    /// ```ignore,no_run
8318    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
8319    /// use google_cloud_kms_v1::model::ImportJob;
8320    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
8321    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
8322    /// ```
8323    pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
8324    where
8325        T: std::convert::Into<crate::model::ImportJob>,
8326    {
8327        self.import_job = v.map(|x| x.into());
8328        self
8329    }
8330}
8331
8332impl wkt::message::Message for CreateImportJobRequest {
8333    fn typename() -> &'static str {
8334        "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
8335    }
8336}
8337
8338/// Request message for
8339/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
8340///
8341/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
8342#[derive(Clone, Default, PartialEq)]
8343#[non_exhaustive]
8344pub struct UpdateCryptoKeyRequest {
8345    /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
8346    ///
8347    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
8348    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
8349
8350    /// Required. List of fields to be updated in this request.
8351    pub update_mask: std::option::Option<wkt::FieldMask>,
8352
8353    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8354}
8355
8356impl UpdateCryptoKeyRequest {
8357    pub fn new() -> Self {
8358        std::default::Default::default()
8359    }
8360
8361    /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
8362    ///
8363    /// # Example
8364    /// ```ignore,no_run
8365    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
8366    /// use google_cloud_kms_v1::model::CryptoKey;
8367    /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
8368    /// ```
8369    pub fn set_crypto_key<T>(mut self, v: T) -> Self
8370    where
8371        T: std::convert::Into<crate::model::CryptoKey>,
8372    {
8373        self.crypto_key = std::option::Option::Some(v.into());
8374        self
8375    }
8376
8377    /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
8378    ///
8379    /// # Example
8380    /// ```ignore,no_run
8381    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
8382    /// use google_cloud_kms_v1::model::CryptoKey;
8383    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
8384    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
8385    /// ```
8386    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
8387    where
8388        T: std::convert::Into<crate::model::CryptoKey>,
8389    {
8390        self.crypto_key = v.map(|x| x.into());
8391        self
8392    }
8393
8394    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
8395    ///
8396    /// # Example
8397    /// ```ignore,no_run
8398    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
8399    /// use wkt::FieldMask;
8400    /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8401    /// ```
8402    pub fn set_update_mask<T>(mut self, v: T) -> Self
8403    where
8404        T: std::convert::Into<wkt::FieldMask>,
8405    {
8406        self.update_mask = std::option::Option::Some(v.into());
8407        self
8408    }
8409
8410    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
8411    ///
8412    /// # Example
8413    /// ```ignore,no_run
8414    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
8415    /// use wkt::FieldMask;
8416    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8417    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8418    /// ```
8419    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8420    where
8421        T: std::convert::Into<wkt::FieldMask>,
8422    {
8423        self.update_mask = v.map(|x| x.into());
8424        self
8425    }
8426}
8427
8428impl wkt::message::Message for UpdateCryptoKeyRequest {
8429    fn typename() -> &'static str {
8430        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
8431    }
8432}
8433
8434/// Request message for
8435/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
8436///
8437/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
8438#[derive(Clone, Default, PartialEq)]
8439#[non_exhaustive]
8440pub struct UpdateCryptoKeyVersionRequest {
8441    /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
8442    /// updated values.
8443    ///
8444    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8445    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
8446
8447    /// Required. List of fields to be updated in this request.
8448    pub update_mask: std::option::Option<wkt::FieldMask>,
8449
8450    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8451}
8452
8453impl UpdateCryptoKeyVersionRequest {
8454    pub fn new() -> Self {
8455        std::default::Default::default()
8456    }
8457
8458    /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
8459    ///
8460    /// # Example
8461    /// ```ignore,no_run
8462    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
8463    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
8464    /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
8465    /// ```
8466    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
8467    where
8468        T: std::convert::Into<crate::model::CryptoKeyVersion>,
8469    {
8470        self.crypto_key_version = std::option::Option::Some(v.into());
8471        self
8472    }
8473
8474    /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
8475    ///
8476    /// # Example
8477    /// ```ignore,no_run
8478    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
8479    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
8480    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
8481    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
8482    /// ```
8483    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
8484    where
8485        T: std::convert::Into<crate::model::CryptoKeyVersion>,
8486    {
8487        self.crypto_key_version = v.map(|x| x.into());
8488        self
8489    }
8490
8491    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
8492    ///
8493    /// # Example
8494    /// ```ignore,no_run
8495    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
8496    /// use wkt::FieldMask;
8497    /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8498    /// ```
8499    pub fn set_update_mask<T>(mut self, v: T) -> Self
8500    where
8501        T: std::convert::Into<wkt::FieldMask>,
8502    {
8503        self.update_mask = std::option::Option::Some(v.into());
8504        self
8505    }
8506
8507    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
8508    ///
8509    /// # Example
8510    /// ```ignore,no_run
8511    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
8512    /// use wkt::FieldMask;
8513    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8514    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8515    /// ```
8516    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8517    where
8518        T: std::convert::Into<wkt::FieldMask>,
8519    {
8520        self.update_mask = v.map(|x| x.into());
8521        self
8522    }
8523}
8524
8525impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
8526    fn typename() -> &'static str {
8527        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
8528    }
8529}
8530
8531/// Request message for
8532/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
8533///
8534/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
8535#[derive(Clone, Default, PartialEq)]
8536#[non_exhaustive]
8537pub struct UpdateCryptoKeyPrimaryVersionRequest {
8538    /// Required. The resource name of the
8539    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
8540    ///
8541    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
8542    pub name: std::string::String,
8543
8544    /// Required. The id of the child
8545    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
8546    ///
8547    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8548    pub crypto_key_version_id: std::string::String,
8549
8550    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8551}
8552
8553impl UpdateCryptoKeyPrimaryVersionRequest {
8554    pub fn new() -> Self {
8555        std::default::Default::default()
8556    }
8557
8558    /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
8559    ///
8560    /// # Example
8561    /// ```ignore,no_run
8562    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
8563    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name("example");
8564    /// ```
8565    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8566        self.name = v.into();
8567        self
8568    }
8569
8570    /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
8571    ///
8572    /// # Example
8573    /// ```ignore,no_run
8574    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
8575    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
8576    /// ```
8577    pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
8578        mut self,
8579        v: T,
8580    ) -> Self {
8581        self.crypto_key_version_id = v.into();
8582        self
8583    }
8584}
8585
8586impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
8587    fn typename() -> &'static str {
8588        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
8589    }
8590}
8591
8592/// Request message for
8593/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
8594///
8595/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
8596#[derive(Clone, Default, PartialEq)]
8597#[non_exhaustive]
8598pub struct DestroyCryptoKeyVersionRequest {
8599    /// Required. The resource name of the
8600    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
8601    ///
8602    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8603    pub name: std::string::String,
8604
8605    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8606}
8607
8608impl DestroyCryptoKeyVersionRequest {
8609    pub fn new() -> Self {
8610        std::default::Default::default()
8611    }
8612
8613    /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
8614    ///
8615    /// # Example
8616    /// ```ignore,no_run
8617    /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
8618    /// let x = DestroyCryptoKeyVersionRequest::new().set_name("example");
8619    /// ```
8620    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8621        self.name = v.into();
8622        self
8623    }
8624}
8625
8626impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
8627    fn typename() -> &'static str {
8628        "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
8629    }
8630}
8631
8632/// Request message for
8633/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
8634///
8635/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8636#[derive(Clone, Default, PartialEq)]
8637#[non_exhaustive]
8638pub struct RestoreCryptoKeyVersionRequest {
8639    /// Required. The resource name of the
8640    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
8641    ///
8642    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8643    pub name: std::string::String,
8644
8645    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8646}
8647
8648impl RestoreCryptoKeyVersionRequest {
8649    pub fn new() -> Self {
8650        std::default::Default::default()
8651    }
8652
8653    /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
8654    ///
8655    /// # Example
8656    /// ```ignore,no_run
8657    /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
8658    /// let x = RestoreCryptoKeyVersionRequest::new().set_name("example");
8659    /// ```
8660    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8661        self.name = v.into();
8662        self
8663    }
8664}
8665
8666impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
8667    fn typename() -> &'static str {
8668        "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
8669    }
8670}
8671
8672/// Request message for
8673/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
8674///
8675/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
8676#[derive(Clone, Default, PartialEq)]
8677#[non_exhaustive]
8678pub struct EncryptRequest {
8679    /// Required. The resource name of the
8680    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
8681    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
8682    /// encryption.
8683    ///
8684    /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
8685    /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
8686    ///
8687    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
8688    /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
8689    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8690    pub name: std::string::String,
8691
8692    /// Required. The data to encrypt. Must be no larger than 64KiB.
8693    ///
8694    /// The maximum size depends on the key version's
8695    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
8696    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
8697    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
8698    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
8699    /// plaintext must be no larger than 64KiB. For
8700    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
8701    /// the plaintext and additional_authenticated_data fields must be no larger
8702    /// than 8KiB.
8703    ///
8704    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
8705    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
8706    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
8707    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
8708    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
8709    pub plaintext: ::bytes::Bytes,
8710
8711    /// Optional. Optional data that, if specified, must also be provided during
8712    /// decryption through
8713    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
8714    ///
8715    /// The maximum size depends on the key version's
8716    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
8717    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
8718    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
8719    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
8720    /// AAD must be no larger than 64KiB. For
8721    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
8722    /// the plaintext and additional_authenticated_data fields must be no larger
8723    /// than 8KiB.
8724    ///
8725    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
8726    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
8727    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
8728    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
8729    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
8730    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
8731    pub additional_authenticated_data: ::bytes::Bytes,
8732
8733    /// Optional. An optional CRC32C checksum of the
8734    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
8735    /// If specified,
8736    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8737    /// verify the integrity of the received
8738    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
8739    /// using this checksum.
8740    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8741    /// report an error if the checksum verification fails. If you receive a
8742    /// checksum error, your client should verify that
8743    /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
8744    /// is equal to
8745    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
8746    /// and if so, perform a limited number of retries. A persistent mismatch may
8747    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8748    /// field is defined as int64 for reasons of compatibility across different
8749    /// languages. However, it is a non-negative integer, which will never exceed
8750    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8751    /// this type.
8752    ///
8753    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
8754    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
8755    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8756    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
8757
8758    /// Optional. An optional CRC32C checksum of the
8759    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
8760    /// If specified,
8761    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8762    /// verify the integrity of the received
8763    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
8764    /// using this checksum.
8765    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8766    /// report an error if the checksum verification fails. If you receive a
8767    /// checksum error, your client should verify that
8768    /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
8769    /// is equal to
8770    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
8771    /// and if so, perform a limited number of retries. A persistent mismatch may
8772    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8773    /// field is defined as int64 for reasons of compatibility across different
8774    /// languages. However, it is a non-negative integer, which will never exceed
8775    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8776    /// this type.
8777    ///
8778    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
8779    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
8780    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8781    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
8782
8783    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8784}
8785
8786impl EncryptRequest {
8787    pub fn new() -> Self {
8788        std::default::Default::default()
8789    }
8790
8791    /// Sets the value of [name][crate::model::EncryptRequest::name].
8792    ///
8793    /// # Example
8794    /// ```ignore,no_run
8795    /// # use google_cloud_kms_v1::model::EncryptRequest;
8796    /// let x = EncryptRequest::new().set_name("example");
8797    /// ```
8798    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8799        self.name = v.into();
8800        self
8801    }
8802
8803    /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
8804    ///
8805    /// # Example
8806    /// ```ignore,no_run
8807    /// # use google_cloud_kms_v1::model::EncryptRequest;
8808    /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
8809    /// ```
8810    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8811        self.plaintext = v.into();
8812        self
8813    }
8814
8815    /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
8816    ///
8817    /// # Example
8818    /// ```ignore,no_run
8819    /// # use google_cloud_kms_v1::model::EncryptRequest;
8820    /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
8821    /// ```
8822    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
8823        mut self,
8824        v: T,
8825    ) -> Self {
8826        self.additional_authenticated_data = v.into();
8827        self
8828    }
8829
8830    /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
8831    ///
8832    /// # Example
8833    /// ```ignore,no_run
8834    /// # use google_cloud_kms_v1::model::EncryptRequest;
8835    /// use wkt::Int64Value;
8836    /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
8837    /// ```
8838    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
8839    where
8840        T: std::convert::Into<wkt::Int64Value>,
8841    {
8842        self.plaintext_crc32c = std::option::Option::Some(v.into());
8843        self
8844    }
8845
8846    /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
8847    ///
8848    /// # Example
8849    /// ```ignore,no_run
8850    /// # use google_cloud_kms_v1::model::EncryptRequest;
8851    /// use wkt::Int64Value;
8852    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
8853    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
8854    /// ```
8855    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8856    where
8857        T: std::convert::Into<wkt::Int64Value>,
8858    {
8859        self.plaintext_crc32c = v.map(|x| x.into());
8860        self
8861    }
8862
8863    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
8864    ///
8865    /// # Example
8866    /// ```ignore,no_run
8867    /// # use google_cloud_kms_v1::model::EncryptRequest;
8868    /// use wkt::Int64Value;
8869    /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
8870    /// ```
8871    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
8872    where
8873        T: std::convert::Into<wkt::Int64Value>,
8874    {
8875        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
8876        self
8877    }
8878
8879    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
8880    ///
8881    /// # Example
8882    /// ```ignore,no_run
8883    /// # use google_cloud_kms_v1::model::EncryptRequest;
8884    /// use wkt::Int64Value;
8885    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
8886    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
8887    /// ```
8888    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
8889        mut self,
8890        v: std::option::Option<T>,
8891    ) -> Self
8892    where
8893        T: std::convert::Into<wkt::Int64Value>,
8894    {
8895        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
8896        self
8897    }
8898}
8899
8900impl wkt::message::Message for EncryptRequest {
8901    fn typename() -> &'static str {
8902        "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
8903    }
8904}
8905
8906/// Request message for
8907/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
8908///
8909/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
8910#[derive(Clone, Default, PartialEq)]
8911#[non_exhaustive]
8912pub struct DecryptRequest {
8913    /// Required. The resource name of the
8914    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
8915    /// server will choose the appropriate version.
8916    ///
8917    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
8918    pub name: std::string::String,
8919
8920    /// Required. The encrypted data originally returned in
8921    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
8922    ///
8923    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
8924    pub ciphertext: ::bytes::Bytes,
8925
8926    /// Optional. Optional data that must match the data originally supplied in
8927    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
8928    ///
8929    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
8930    pub additional_authenticated_data: ::bytes::Bytes,
8931
8932    /// Optional. An optional CRC32C checksum of the
8933    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
8934    /// If specified,
8935    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8936    /// verify the integrity of the received
8937    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
8938    /// using this checksum.
8939    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8940    /// report an error if the checksum verification fails. If you receive a
8941    /// checksum error, your client should verify that
8942    /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
8943    /// is equal to
8944    /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
8945    /// and if so, perform a limited number of retries. A persistent mismatch may
8946    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8947    /// field is defined as int64 for reasons of compatibility across different
8948    /// languages. However, it is a non-negative integer, which will never exceed
8949    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8950    /// this type.
8951    ///
8952    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
8953    /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
8954    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8955    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
8956
8957    /// Optional. An optional CRC32C checksum of the
8958    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
8959    /// If specified,
8960    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8961    /// verify the integrity of the received
8962    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
8963    /// using this checksum.
8964    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8965    /// report an error if the checksum verification fails. If you receive a
8966    /// checksum error, your client should verify that
8967    /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
8968    /// is equal to
8969    /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
8970    /// and if so, perform a limited number of retries. A persistent mismatch may
8971    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8972    /// field is defined as int64 for reasons of compatibility across different
8973    /// languages. However, it is a non-negative integer, which will never exceed
8974    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8975    /// this type.
8976    ///
8977    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
8978    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
8979    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8980    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
8981
8982    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8983}
8984
8985impl DecryptRequest {
8986    pub fn new() -> Self {
8987        std::default::Default::default()
8988    }
8989
8990    /// Sets the value of [name][crate::model::DecryptRequest::name].
8991    ///
8992    /// # Example
8993    /// ```ignore,no_run
8994    /// # use google_cloud_kms_v1::model::DecryptRequest;
8995    /// let x = DecryptRequest::new().set_name("example");
8996    /// ```
8997    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8998        self.name = v.into();
8999        self
9000    }
9001
9002    /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
9003    ///
9004    /// # Example
9005    /// ```ignore,no_run
9006    /// # use google_cloud_kms_v1::model::DecryptRequest;
9007    /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
9008    /// ```
9009    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9010        self.ciphertext = v.into();
9011        self
9012    }
9013
9014    /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
9015    ///
9016    /// # Example
9017    /// ```ignore,no_run
9018    /// # use google_cloud_kms_v1::model::DecryptRequest;
9019    /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
9020    /// ```
9021    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
9022        mut self,
9023        v: T,
9024    ) -> Self {
9025        self.additional_authenticated_data = v.into();
9026        self
9027    }
9028
9029    /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
9030    ///
9031    /// # Example
9032    /// ```ignore,no_run
9033    /// # use google_cloud_kms_v1::model::DecryptRequest;
9034    /// use wkt::Int64Value;
9035    /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
9036    /// ```
9037    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
9038    where
9039        T: std::convert::Into<wkt::Int64Value>,
9040    {
9041        self.ciphertext_crc32c = std::option::Option::Some(v.into());
9042        self
9043    }
9044
9045    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
9046    ///
9047    /// # Example
9048    /// ```ignore,no_run
9049    /// # use google_cloud_kms_v1::model::DecryptRequest;
9050    /// use wkt::Int64Value;
9051    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
9052    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
9053    /// ```
9054    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9055    where
9056        T: std::convert::Into<wkt::Int64Value>,
9057    {
9058        self.ciphertext_crc32c = v.map(|x| x.into());
9059        self
9060    }
9061
9062    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
9063    ///
9064    /// # Example
9065    /// ```ignore,no_run
9066    /// # use google_cloud_kms_v1::model::DecryptRequest;
9067    /// use wkt::Int64Value;
9068    /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
9069    /// ```
9070    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
9071    where
9072        T: std::convert::Into<wkt::Int64Value>,
9073    {
9074        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
9075        self
9076    }
9077
9078    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
9079    ///
9080    /// # Example
9081    /// ```ignore,no_run
9082    /// # use google_cloud_kms_v1::model::DecryptRequest;
9083    /// use wkt::Int64Value;
9084    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
9085    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
9086    /// ```
9087    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
9088        mut self,
9089        v: std::option::Option<T>,
9090    ) -> Self
9091    where
9092        T: std::convert::Into<wkt::Int64Value>,
9093    {
9094        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
9095        self
9096    }
9097}
9098
9099impl wkt::message::Message for DecryptRequest {
9100    fn typename() -> &'static str {
9101        "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
9102    }
9103}
9104
9105/// Request message for
9106/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
9107///
9108/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
9109#[derive(Clone, Default, PartialEq)]
9110#[non_exhaustive]
9111pub struct RawEncryptRequest {
9112    /// Required. The resource name of the
9113    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
9114    /// encryption.
9115    ///
9116    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9117    pub name: std::string::String,
9118
9119    /// Required. The data to encrypt. Must be no larger than 64KiB.
9120    ///
9121    /// The maximum size depends on the key version's
9122    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
9123    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
9124    /// plaintext must be no larger than 64KiB. For
9125    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
9126    /// the plaintext and additional_authenticated_data fields must be no larger
9127    /// than 8KiB.
9128    ///
9129    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9130    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9131    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
9132    pub plaintext: ::bytes::Bytes,
9133
9134    /// Optional. Optional data that, if specified, must also be provided during
9135    /// decryption through
9136    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
9137    ///
9138    /// This field may only be used in conjunction with an
9139    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
9140    /// additional authenticated data (for example, AES-GCM).
9141    ///
9142    /// The maximum size depends on the key version's
9143    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
9144    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
9145    /// plaintext must be no larger than 64KiB. For
9146    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
9147    /// the plaintext and additional_authenticated_data fields must be no larger
9148    /// than 8KiB.
9149    ///
9150    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
9151    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9152    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9153    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
9154    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
9155    pub additional_authenticated_data: ::bytes::Bytes,
9156
9157    /// Optional. An optional CRC32C checksum of the
9158    /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
9159    /// If specified,
9160    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9161    /// verify the integrity of the received plaintext using this checksum.
9162    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9163    /// report an error if the checksum verification fails. If you receive a
9164    /// checksum error, your client should verify that CRC32C(plaintext) is equal
9165    /// to plaintext_crc32c, and if so, perform a limited number of retries. A
9166    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9167    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9168    /// across different languages. However, it is a non-negative integer, which
9169    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
9170    /// languages that support this type.
9171    ///
9172    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9173    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
9174    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
9175
9176    /// Optional. An optional CRC32C checksum of the
9177    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
9178    /// If specified,
9179    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9180    /// verify the integrity of the received additional_authenticated_data using
9181    /// this checksum.
9182    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9183    /// report an error if the checksum verification fails. If you receive a
9184    /// checksum error, your client should verify that
9185    /// CRC32C(additional_authenticated_data) is equal to
9186    /// additional_authenticated_data_crc32c, and if so, perform
9187    /// a limited number of retries. A persistent mismatch may indicate an issue in
9188    /// your computation of the CRC32C checksum.
9189    /// Note: This field is defined as int64 for reasons of compatibility across
9190    /// different languages. However, it is a non-negative integer, which will
9191    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
9192    /// that support this type.
9193    ///
9194    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9195    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
9196    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
9197
9198    /// Optional. A customer-supplied initialization vector that will be used for
9199    /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
9200    /// generated. It will be returned in
9201    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
9202    ///
9203    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
9204    pub initialization_vector: ::bytes::Bytes,
9205
9206    /// Optional. An optional CRC32C checksum of the
9207    /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
9208    /// If specified,
9209    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9210    /// verify the integrity of the received initialization_vector using this
9211    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
9212    /// will report an error if the checksum verification fails. If you receive a
9213    /// checksum error, your client should verify that
9214    /// CRC32C(initialization_vector) is equal to
9215    /// initialization_vector_crc32c, and if so, perform
9216    /// a limited number of retries. A persistent mismatch may indicate an issue in
9217    /// your computation of the CRC32C checksum.
9218    /// Note: This field is defined as int64 for reasons of compatibility across
9219    /// different languages. However, it is a non-negative integer, which will
9220    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
9221    /// that support this type.
9222    ///
9223    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9224    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
9225    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
9226
9227    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9228}
9229
9230impl RawEncryptRequest {
9231    pub fn new() -> Self {
9232        std::default::Default::default()
9233    }
9234
9235    /// Sets the value of [name][crate::model::RawEncryptRequest::name].
9236    ///
9237    /// # Example
9238    /// ```ignore,no_run
9239    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9240    /// let x = RawEncryptRequest::new().set_name("example");
9241    /// ```
9242    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9243        self.name = v.into();
9244        self
9245    }
9246
9247    /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
9248    ///
9249    /// # Example
9250    /// ```ignore,no_run
9251    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9252    /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
9253    /// ```
9254    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9255        self.plaintext = v.into();
9256        self
9257    }
9258
9259    /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
9260    ///
9261    /// # Example
9262    /// ```ignore,no_run
9263    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9264    /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
9265    /// ```
9266    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
9267        mut self,
9268        v: T,
9269    ) -> Self {
9270        self.additional_authenticated_data = v.into();
9271        self
9272    }
9273
9274    /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
9275    ///
9276    /// # Example
9277    /// ```ignore,no_run
9278    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9279    /// use wkt::Int64Value;
9280    /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
9281    /// ```
9282    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
9283    where
9284        T: std::convert::Into<wkt::Int64Value>,
9285    {
9286        self.plaintext_crc32c = std::option::Option::Some(v.into());
9287        self
9288    }
9289
9290    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
9291    ///
9292    /// # Example
9293    /// ```ignore,no_run
9294    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9295    /// use wkt::Int64Value;
9296    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
9297    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
9298    /// ```
9299    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9300    where
9301        T: std::convert::Into<wkt::Int64Value>,
9302    {
9303        self.plaintext_crc32c = v.map(|x| x.into());
9304        self
9305    }
9306
9307    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
9308    ///
9309    /// # Example
9310    /// ```ignore,no_run
9311    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9312    /// use wkt::Int64Value;
9313    /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
9314    /// ```
9315    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
9316    where
9317        T: std::convert::Into<wkt::Int64Value>,
9318    {
9319        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
9320        self
9321    }
9322
9323    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
9324    ///
9325    /// # Example
9326    /// ```ignore,no_run
9327    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9328    /// use wkt::Int64Value;
9329    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
9330    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
9331    /// ```
9332    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
9333        mut self,
9334        v: std::option::Option<T>,
9335    ) -> Self
9336    where
9337        T: std::convert::Into<wkt::Int64Value>,
9338    {
9339        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
9340        self
9341    }
9342
9343    /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
9344    ///
9345    /// # Example
9346    /// ```ignore,no_run
9347    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9348    /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
9349    /// ```
9350    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
9351        mut self,
9352        v: T,
9353    ) -> Self {
9354        self.initialization_vector = v.into();
9355        self
9356    }
9357
9358    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
9359    ///
9360    /// # Example
9361    /// ```ignore,no_run
9362    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9363    /// use wkt::Int64Value;
9364    /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
9365    /// ```
9366    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
9367    where
9368        T: std::convert::Into<wkt::Int64Value>,
9369    {
9370        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
9371        self
9372    }
9373
9374    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
9375    ///
9376    /// # Example
9377    /// ```ignore,no_run
9378    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
9379    /// use wkt::Int64Value;
9380    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
9381    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
9382    /// ```
9383    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9384    where
9385        T: std::convert::Into<wkt::Int64Value>,
9386    {
9387        self.initialization_vector_crc32c = v.map(|x| x.into());
9388        self
9389    }
9390}
9391
9392impl wkt::message::Message for RawEncryptRequest {
9393    fn typename() -> &'static str {
9394        "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
9395    }
9396}
9397
9398/// Request message for
9399/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
9400///
9401/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
9402#[derive(Clone, Default, PartialEq)]
9403#[non_exhaustive]
9404pub struct RawDecryptRequest {
9405    /// Required. The resource name of the
9406    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
9407    /// decryption.
9408    ///
9409    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9410    pub name: std::string::String,
9411
9412    /// Required. The encrypted data originally returned in
9413    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
9414    ///
9415    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
9416    pub ciphertext: ::bytes::Bytes,
9417
9418    /// Optional. Optional data that must match the data originally supplied in
9419    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
9420    ///
9421    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
9422    pub additional_authenticated_data: ::bytes::Bytes,
9423
9424    /// Required. The initialization vector (IV) used during encryption, which must
9425    /// match the data originally provided in
9426    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
9427    ///
9428    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
9429    pub initialization_vector: ::bytes::Bytes,
9430
9431    /// The length of the authentication tag that is appended to the end of
9432    /// the ciphertext. If unspecified (0), the default value for the key's
9433    /// algorithm will be used (for AES-GCM, the default value is 16).
9434    pub tag_length: i32,
9435
9436    /// Optional. An optional CRC32C checksum of the
9437    /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
9438    /// If specified,
9439    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9440    /// verify the integrity of the received ciphertext using this checksum.
9441    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9442    /// report an error if the checksum verification fails. If you receive a
9443    /// checksum error, your client should verify that CRC32C(ciphertext) is equal
9444    /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
9445    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9446    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9447    /// across different languages. However, it is a non-negative integer, which
9448    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
9449    /// languages that support this type.
9450    ///
9451    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9452    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
9453    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
9454
9455    /// Optional. An optional CRC32C checksum of the
9456    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
9457    /// If specified,
9458    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9459    /// verify the integrity of the received additional_authenticated_data using
9460    /// this checksum.
9461    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9462    /// report an error if the checksum verification fails. If you receive a
9463    /// checksum error, your client should verify that
9464    /// CRC32C(additional_authenticated_data) is equal to
9465    /// additional_authenticated_data_crc32c, and if so, perform
9466    /// a limited number of retries. A persistent mismatch may indicate an issue in
9467    /// your computation of the CRC32C checksum.
9468    /// Note: This field is defined as int64 for reasons of compatibility across
9469    /// different languages. However, it is a non-negative integer, which will
9470    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
9471    /// that support this type.
9472    ///
9473    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9474    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
9475    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
9476
9477    /// Optional. An optional CRC32C checksum of the
9478    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
9479    /// If specified,
9480    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9481    /// verify the integrity of the received initialization_vector using this
9482    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
9483    /// will report an error if the checksum verification fails. If you receive a
9484    /// checksum error, your client should verify that
9485    /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
9486    /// if so, perform a limited number of retries. A persistent mismatch may
9487    /// indicate an issue in your computation of the CRC32C checksum.
9488    /// Note: This field is defined as int64 for reasons of compatibility across
9489    /// different languages. However, it is a non-negative integer, which will
9490    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
9491    /// that support this type.
9492    ///
9493    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9494    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
9495    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
9496
9497    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9498}
9499
9500impl RawDecryptRequest {
9501    pub fn new() -> Self {
9502        std::default::Default::default()
9503    }
9504
9505    /// Sets the value of [name][crate::model::RawDecryptRequest::name].
9506    ///
9507    /// # Example
9508    /// ```ignore,no_run
9509    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9510    /// let x = RawDecryptRequest::new().set_name("example");
9511    /// ```
9512    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9513        self.name = v.into();
9514        self
9515    }
9516
9517    /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
9518    ///
9519    /// # Example
9520    /// ```ignore,no_run
9521    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9522    /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
9523    /// ```
9524    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9525        self.ciphertext = v.into();
9526        self
9527    }
9528
9529    /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
9530    ///
9531    /// # Example
9532    /// ```ignore,no_run
9533    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9534    /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
9535    /// ```
9536    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
9537        mut self,
9538        v: T,
9539    ) -> Self {
9540        self.additional_authenticated_data = v.into();
9541        self
9542    }
9543
9544    /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
9545    ///
9546    /// # Example
9547    /// ```ignore,no_run
9548    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9549    /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
9550    /// ```
9551    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
9552        mut self,
9553        v: T,
9554    ) -> Self {
9555        self.initialization_vector = v.into();
9556        self
9557    }
9558
9559    /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
9560    ///
9561    /// # Example
9562    /// ```ignore,no_run
9563    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9564    /// let x = RawDecryptRequest::new().set_tag_length(42);
9565    /// ```
9566    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9567        self.tag_length = v.into();
9568        self
9569    }
9570
9571    /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
9572    ///
9573    /// # Example
9574    /// ```ignore,no_run
9575    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9576    /// use wkt::Int64Value;
9577    /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
9578    /// ```
9579    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
9580    where
9581        T: std::convert::Into<wkt::Int64Value>,
9582    {
9583        self.ciphertext_crc32c = std::option::Option::Some(v.into());
9584        self
9585    }
9586
9587    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
9588    ///
9589    /// # Example
9590    /// ```ignore,no_run
9591    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9592    /// use wkt::Int64Value;
9593    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
9594    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
9595    /// ```
9596    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9597    where
9598        T: std::convert::Into<wkt::Int64Value>,
9599    {
9600        self.ciphertext_crc32c = v.map(|x| x.into());
9601        self
9602    }
9603
9604    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
9605    ///
9606    /// # Example
9607    /// ```ignore,no_run
9608    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9609    /// use wkt::Int64Value;
9610    /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
9611    /// ```
9612    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
9613    where
9614        T: std::convert::Into<wkt::Int64Value>,
9615    {
9616        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
9617        self
9618    }
9619
9620    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
9621    ///
9622    /// # Example
9623    /// ```ignore,no_run
9624    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9625    /// use wkt::Int64Value;
9626    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
9627    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
9628    /// ```
9629    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
9630        mut self,
9631        v: std::option::Option<T>,
9632    ) -> Self
9633    where
9634        T: std::convert::Into<wkt::Int64Value>,
9635    {
9636        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
9637        self
9638    }
9639
9640    /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
9641    ///
9642    /// # Example
9643    /// ```ignore,no_run
9644    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9645    /// use wkt::Int64Value;
9646    /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
9647    /// ```
9648    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
9649    where
9650        T: std::convert::Into<wkt::Int64Value>,
9651    {
9652        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
9653        self
9654    }
9655
9656    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
9657    ///
9658    /// # Example
9659    /// ```ignore,no_run
9660    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
9661    /// use wkt::Int64Value;
9662    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
9663    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
9664    /// ```
9665    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9666    where
9667        T: std::convert::Into<wkt::Int64Value>,
9668    {
9669        self.initialization_vector_crc32c = v.map(|x| x.into());
9670        self
9671    }
9672}
9673
9674impl wkt::message::Message for RawDecryptRequest {
9675    fn typename() -> &'static str {
9676        "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
9677    }
9678}
9679
9680/// Request message for
9681/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
9682///
9683/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
9684#[derive(Clone, Default, PartialEq)]
9685#[non_exhaustive]
9686pub struct AsymmetricSignRequest {
9687    /// Required. The resource name of the
9688    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
9689    /// signing.
9690    ///
9691    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9692    pub name: std::string::String,
9693
9694    /// Optional. The digest of the data to sign. The digest must be produced with
9695    /// the same digest algorithm as specified by the key version's
9696    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
9697    ///
9698    /// This field may not be supplied if
9699    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
9700    /// is supplied.
9701    ///
9702    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
9703    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
9704    pub digest: std::option::Option<crate::model::Digest>,
9705
9706    /// Optional. An optional CRC32C checksum of the
9707    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
9708    /// If specified,
9709    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9710    /// verify the integrity of the received
9711    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
9712    /// using this checksum.
9713    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9714    /// report an error if the checksum verification fails. If you receive a
9715    /// checksum error, your client should verify that
9716    /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
9717    /// is equal to
9718    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
9719    /// and if so, perform a limited number of retries. A persistent mismatch may
9720    /// indicate an issue in your computation of the CRC32C checksum. Note: This
9721    /// field is defined as int64 for reasons of compatibility across different
9722    /// languages. However, it is a non-negative integer, which will never exceed
9723    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
9724    /// this type.
9725    ///
9726    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
9727    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
9728    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9729    pub digest_crc32c: std::option::Option<wkt::Int64Value>,
9730
9731    /// Optional. The data to sign.
9732    /// It can't be supplied if
9733    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
9734    /// is supplied.
9735    ///
9736    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
9737    pub data: ::bytes::Bytes,
9738
9739    /// Optional. An optional CRC32C checksum of the
9740    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
9741    /// If specified,
9742    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9743    /// verify the integrity of the received
9744    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
9745    /// using this checksum.
9746    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9747    /// report an error if the checksum verification fails. If you receive a
9748    /// checksum error, your client should verify that
9749    /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
9750    /// is equal to
9751    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
9752    /// and if so, perform a limited number of retries. A persistent mismatch may
9753    /// indicate an issue in your computation of the CRC32C checksum. Note: This
9754    /// field is defined as int64 for reasons of compatibility across different
9755    /// languages. However, it is a non-negative integer, which will never exceed
9756    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
9757    /// this type.
9758    ///
9759    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
9760    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
9761    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9762    pub data_crc32c: std::option::Option<wkt::Int64Value>,
9763
9764    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9765}
9766
9767impl AsymmetricSignRequest {
9768    pub fn new() -> Self {
9769        std::default::Default::default()
9770    }
9771
9772    /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
9773    ///
9774    /// # Example
9775    /// ```ignore,no_run
9776    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9777    /// let x = AsymmetricSignRequest::new().set_name("example");
9778    /// ```
9779    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9780        self.name = v.into();
9781        self
9782    }
9783
9784    /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
9785    ///
9786    /// # Example
9787    /// ```ignore,no_run
9788    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9789    /// use google_cloud_kms_v1::model::Digest;
9790    /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
9791    /// ```
9792    pub fn set_digest<T>(mut self, v: T) -> Self
9793    where
9794        T: std::convert::Into<crate::model::Digest>,
9795    {
9796        self.digest = std::option::Option::Some(v.into());
9797        self
9798    }
9799
9800    /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
9801    ///
9802    /// # Example
9803    /// ```ignore,no_run
9804    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9805    /// use google_cloud_kms_v1::model::Digest;
9806    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
9807    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
9808    /// ```
9809    pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
9810    where
9811        T: std::convert::Into<crate::model::Digest>,
9812    {
9813        self.digest = v.map(|x| x.into());
9814        self
9815    }
9816
9817    /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
9818    ///
9819    /// # Example
9820    /// ```ignore,no_run
9821    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9822    /// use wkt::Int64Value;
9823    /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
9824    /// ```
9825    pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
9826    where
9827        T: std::convert::Into<wkt::Int64Value>,
9828    {
9829        self.digest_crc32c = std::option::Option::Some(v.into());
9830        self
9831    }
9832
9833    /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
9834    ///
9835    /// # Example
9836    /// ```ignore,no_run
9837    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9838    /// use wkt::Int64Value;
9839    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
9840    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
9841    /// ```
9842    pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9843    where
9844        T: std::convert::Into<wkt::Int64Value>,
9845    {
9846        self.digest_crc32c = v.map(|x| x.into());
9847        self
9848    }
9849
9850    /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
9851    ///
9852    /// # Example
9853    /// ```ignore,no_run
9854    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9855    /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
9856    /// ```
9857    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9858        self.data = v.into();
9859        self
9860    }
9861
9862    /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
9863    ///
9864    /// # Example
9865    /// ```ignore,no_run
9866    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9867    /// use wkt::Int64Value;
9868    /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
9869    /// ```
9870    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
9871    where
9872        T: std::convert::Into<wkt::Int64Value>,
9873    {
9874        self.data_crc32c = std::option::Option::Some(v.into());
9875        self
9876    }
9877
9878    /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
9879    ///
9880    /// # Example
9881    /// ```ignore,no_run
9882    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
9883    /// use wkt::Int64Value;
9884    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
9885    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
9886    /// ```
9887    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9888    where
9889        T: std::convert::Into<wkt::Int64Value>,
9890    {
9891        self.data_crc32c = v.map(|x| x.into());
9892        self
9893    }
9894}
9895
9896impl wkt::message::Message for AsymmetricSignRequest {
9897    fn typename() -> &'static str {
9898        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
9899    }
9900}
9901
9902/// Request message for
9903/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
9904///
9905/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
9906#[derive(Clone, Default, PartialEq)]
9907#[non_exhaustive]
9908pub struct AsymmetricDecryptRequest {
9909    /// Required. The resource name of the
9910    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
9911    /// decryption.
9912    ///
9913    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9914    pub name: std::string::String,
9915
9916    /// Required. The data encrypted with the named
9917    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
9918    /// OAEP.
9919    ///
9920    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9921    pub ciphertext: ::bytes::Bytes,
9922
9923    /// Optional. An optional CRC32C checksum of the
9924    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
9925    /// If specified,
9926    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9927    /// verify the integrity of the received
9928    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
9929    /// using this checksum.
9930    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
9931    /// report an error if the checksum verification fails. If you receive a
9932    /// checksum error, your client should verify that
9933    /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
9934    /// is equal to
9935    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
9936    /// and if so, perform a limited number of retries. A persistent mismatch may
9937    /// indicate an issue in your computation of the CRC32C checksum. Note: This
9938    /// field is defined as int64 for reasons of compatibility across different
9939    /// languages. However, it is a non-negative integer, which will never exceed
9940    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
9941    /// this type.
9942    ///
9943    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
9944    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
9945    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9946    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
9947
9948    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9949}
9950
9951impl AsymmetricDecryptRequest {
9952    pub fn new() -> Self {
9953        std::default::Default::default()
9954    }
9955
9956    /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
9957    ///
9958    /// # Example
9959    /// ```ignore,no_run
9960    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
9961    /// let x = AsymmetricDecryptRequest::new().set_name("example");
9962    /// ```
9963    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9964        self.name = v.into();
9965        self
9966    }
9967
9968    /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
9969    ///
9970    /// # Example
9971    /// ```ignore,no_run
9972    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
9973    /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
9974    /// ```
9975    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9976        self.ciphertext = v.into();
9977        self
9978    }
9979
9980    /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
9981    ///
9982    /// # Example
9983    /// ```ignore,no_run
9984    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
9985    /// use wkt::Int64Value;
9986    /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
9987    /// ```
9988    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
9989    where
9990        T: std::convert::Into<wkt::Int64Value>,
9991    {
9992        self.ciphertext_crc32c = std::option::Option::Some(v.into());
9993        self
9994    }
9995
9996    /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
9997    ///
9998    /// # Example
9999    /// ```ignore,no_run
10000    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
10001    /// use wkt::Int64Value;
10002    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
10003    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
10004    /// ```
10005    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
10006    where
10007        T: std::convert::Into<wkt::Int64Value>,
10008    {
10009        self.ciphertext_crc32c = v.map(|x| x.into());
10010        self
10011    }
10012}
10013
10014impl wkt::message::Message for AsymmetricDecryptRequest {
10015    fn typename() -> &'static str {
10016        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
10017    }
10018}
10019
10020/// Request message for
10021/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
10022///
10023/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
10024#[derive(Clone, Default, PartialEq)]
10025#[non_exhaustive]
10026pub struct MacSignRequest {
10027    /// Required. The resource name of the
10028    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
10029    /// signing.
10030    ///
10031    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10032    pub name: std::string::String,
10033
10034    /// Required. The data to sign. The MAC tag is computed over this data field
10035    /// based on the specific algorithm.
10036    pub data: ::bytes::Bytes,
10037
10038    /// Optional. An optional CRC32C checksum of the
10039    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
10040    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
10041    /// will verify the integrity of the received
10042    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
10043    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
10044    /// will report an error if the checksum verification fails. If you receive a
10045    /// checksum error, your client should verify that
10046    /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
10047    /// equal to
10048    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
10049    /// and if so, perform a limited number of retries. A persistent mismatch may
10050    /// indicate an issue in your computation of the CRC32C checksum. Note: This
10051    /// field is defined as int64 for reasons of compatibility across different
10052    /// languages. However, it is a non-negative integer, which will never exceed
10053    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
10054    /// this type.
10055    ///
10056    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10057    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
10058    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
10059    pub data_crc32c: std::option::Option<wkt::Int64Value>,
10060
10061    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10062}
10063
10064impl MacSignRequest {
10065    pub fn new() -> Self {
10066        std::default::Default::default()
10067    }
10068
10069    /// Sets the value of [name][crate::model::MacSignRequest::name].
10070    ///
10071    /// # Example
10072    /// ```ignore,no_run
10073    /// # use google_cloud_kms_v1::model::MacSignRequest;
10074    /// let x = MacSignRequest::new().set_name("example");
10075    /// ```
10076    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10077        self.name = v.into();
10078        self
10079    }
10080
10081    /// Sets the value of [data][crate::model::MacSignRequest::data].
10082    ///
10083    /// # Example
10084    /// ```ignore,no_run
10085    /// # use google_cloud_kms_v1::model::MacSignRequest;
10086    /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
10087    /// ```
10088    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10089        self.data = v.into();
10090        self
10091    }
10092
10093    /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
10094    ///
10095    /// # Example
10096    /// ```ignore,no_run
10097    /// # use google_cloud_kms_v1::model::MacSignRequest;
10098    /// use wkt::Int64Value;
10099    /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
10100    /// ```
10101    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
10102    where
10103        T: std::convert::Into<wkt::Int64Value>,
10104    {
10105        self.data_crc32c = std::option::Option::Some(v.into());
10106        self
10107    }
10108
10109    /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
10110    ///
10111    /// # Example
10112    /// ```ignore,no_run
10113    /// # use google_cloud_kms_v1::model::MacSignRequest;
10114    /// use wkt::Int64Value;
10115    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
10116    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
10117    /// ```
10118    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
10119    where
10120        T: std::convert::Into<wkt::Int64Value>,
10121    {
10122        self.data_crc32c = v.map(|x| x.into());
10123        self
10124    }
10125}
10126
10127impl wkt::message::Message for MacSignRequest {
10128    fn typename() -> &'static str {
10129        "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
10130    }
10131}
10132
10133/// Request message for
10134/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
10135///
10136/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
10137#[derive(Clone, Default, PartialEq)]
10138#[non_exhaustive]
10139pub struct MacVerifyRequest {
10140    /// Required. The resource name of the
10141    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
10142    /// verification.
10143    ///
10144    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10145    pub name: std::string::String,
10146
10147    /// Required. The data used previously as a
10148    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
10149    /// the MAC tag.
10150    ///
10151    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
10152    pub data: ::bytes::Bytes,
10153
10154    /// Optional. An optional CRC32C checksum of the
10155    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
10156    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
10157    /// will verify the integrity of the received
10158    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
10159    /// this checksum.
10160    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
10161    /// report an error if the checksum verification fails. If you receive a
10162    /// checksum error, your client should verify that
10163    /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
10164    /// is equal to
10165    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
10166    /// and if so, perform a limited number of retries. A persistent mismatch may
10167    /// indicate an issue in your computation of the CRC32C checksum. Note: This
10168    /// field is defined as int64 for reasons of compatibility across different
10169    /// languages. However, it is a non-negative integer, which will never exceed
10170    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
10171    /// this type.
10172    ///
10173    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10174    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
10175    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
10176    pub data_crc32c: std::option::Option<wkt::Int64Value>,
10177
10178    /// Required. The signature to verify.
10179    pub mac: ::bytes::Bytes,
10180
10181    /// Optional. An optional CRC32C checksum of the
10182    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
10183    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
10184    /// will verify the integrity of the received
10185    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
10186    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
10187    /// will report an error if the checksum verification fails. If you receive a
10188    /// checksum error, your client should verify that
10189    /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
10190    /// equal to
10191    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
10192    /// and if so, perform a limited number of retries. A persistent mismatch may
10193    /// indicate an issue in your computation of the CRC32C checksum. Note: This
10194    /// field is defined as int64 for reasons of compatibility across different
10195    /// languages. However, it is a non-negative integer, which will never exceed
10196    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
10197    /// this type.
10198    ///
10199    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10200    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
10201    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
10202    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
10203
10204    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10205}
10206
10207impl MacVerifyRequest {
10208    pub fn new() -> Self {
10209        std::default::Default::default()
10210    }
10211
10212    /// Sets the value of [name][crate::model::MacVerifyRequest::name].
10213    ///
10214    /// # Example
10215    /// ```ignore,no_run
10216    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
10217    /// let x = MacVerifyRequest::new().set_name("example");
10218    /// ```
10219    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10220        self.name = v.into();
10221        self
10222    }
10223
10224    /// Sets the value of [data][crate::model::MacVerifyRequest::data].
10225    ///
10226    /// # Example
10227    /// ```ignore,no_run
10228    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
10229    /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
10230    /// ```
10231    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10232        self.data = v.into();
10233        self
10234    }
10235
10236    /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
10237    ///
10238    /// # Example
10239    /// ```ignore,no_run
10240    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
10241    /// use wkt::Int64Value;
10242    /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
10243    /// ```
10244    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
10245    where
10246        T: std::convert::Into<wkt::Int64Value>,
10247    {
10248        self.data_crc32c = std::option::Option::Some(v.into());
10249        self
10250    }
10251
10252    /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
10253    ///
10254    /// # Example
10255    /// ```ignore,no_run
10256    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
10257    /// use wkt::Int64Value;
10258    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
10259    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
10260    /// ```
10261    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
10262    where
10263        T: std::convert::Into<wkt::Int64Value>,
10264    {
10265        self.data_crc32c = v.map(|x| x.into());
10266        self
10267    }
10268
10269    /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
10270    ///
10271    /// # Example
10272    /// ```ignore,no_run
10273    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
10274    /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
10275    /// ```
10276    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10277        self.mac = v.into();
10278        self
10279    }
10280
10281    /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
10282    ///
10283    /// # Example
10284    /// ```ignore,no_run
10285    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
10286    /// use wkt::Int64Value;
10287    /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
10288    /// ```
10289    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
10290    where
10291        T: std::convert::Into<wkt::Int64Value>,
10292    {
10293        self.mac_crc32c = std::option::Option::Some(v.into());
10294        self
10295    }
10296
10297    /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
10298    ///
10299    /// # Example
10300    /// ```ignore,no_run
10301    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
10302    /// use wkt::Int64Value;
10303    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
10304    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
10305    /// ```
10306    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
10307    where
10308        T: std::convert::Into<wkt::Int64Value>,
10309    {
10310        self.mac_crc32c = v.map(|x| x.into());
10311        self
10312    }
10313}
10314
10315impl wkt::message::Message for MacVerifyRequest {
10316    fn typename() -> &'static str {
10317        "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
10318    }
10319}
10320
10321/// Request message for
10322/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
10323///
10324/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
10325#[derive(Clone, Default, PartialEq)]
10326#[non_exhaustive]
10327pub struct DecapsulateRequest {
10328    /// Required. The resource name of the
10329    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
10330    /// decapsulation.
10331    ///
10332    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10333    pub name: std::string::String,
10334
10335    /// Required. The ciphertext produced from encapsulation with the
10336    /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
10337    /// key(s).
10338    ///
10339    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10340    pub ciphertext: ::bytes::Bytes,
10341
10342    /// Optional. A CRC32C checksum of the
10343    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
10344    /// If specified,
10345    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
10346    /// verify the integrity of the received
10347    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
10348    /// using this checksum.
10349    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
10350    /// report an error if the checksum verification fails. If you receive a
10351    /// checksum error, your client should verify that
10352    /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
10353    /// is equal to
10354    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
10355    /// and if so, perform a limited number of retries. A persistent mismatch may
10356    /// indicate an issue in your computation of the CRC32C checksum. Note: This
10357    /// field is defined as int64 for reasons of compatibility across different
10358    /// languages. However, it is a non-negative integer, which will never exceed
10359    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
10360    /// this type.
10361    ///
10362    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
10363    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
10364    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10365    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
10366
10367    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10368}
10369
10370impl DecapsulateRequest {
10371    pub fn new() -> Self {
10372        std::default::Default::default()
10373    }
10374
10375    /// Sets the value of [name][crate::model::DecapsulateRequest::name].
10376    ///
10377    /// # Example
10378    /// ```ignore,no_run
10379    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
10380    /// let x = DecapsulateRequest::new().set_name("example");
10381    /// ```
10382    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10383        self.name = v.into();
10384        self
10385    }
10386
10387    /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
10388    ///
10389    /// # Example
10390    /// ```ignore,no_run
10391    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
10392    /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
10393    /// ```
10394    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10395        self.ciphertext = v.into();
10396        self
10397    }
10398
10399    /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
10400    ///
10401    /// # Example
10402    /// ```ignore,no_run
10403    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
10404    /// use wkt::Int64Value;
10405    /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
10406    /// ```
10407    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
10408    where
10409        T: std::convert::Into<wkt::Int64Value>,
10410    {
10411        self.ciphertext_crc32c = std::option::Option::Some(v.into());
10412        self
10413    }
10414
10415    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
10416    ///
10417    /// # Example
10418    /// ```ignore,no_run
10419    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
10420    /// use wkt::Int64Value;
10421    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
10422    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
10423    /// ```
10424    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
10425    where
10426        T: std::convert::Into<wkt::Int64Value>,
10427    {
10428        self.ciphertext_crc32c = v.map(|x| x.into());
10429        self
10430    }
10431}
10432
10433impl wkt::message::Message for DecapsulateRequest {
10434    fn typename() -> &'static str {
10435        "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
10436    }
10437}
10438
10439/// Request message for
10440/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
10441///
10442/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
10443#[derive(Clone, Default, PartialEq)]
10444#[non_exhaustive]
10445pub struct GenerateRandomBytesRequest {
10446    /// The project-specific location in which to generate random bytes.
10447    /// For example, "projects/my-project/locations/us-central1".
10448    pub location: std::string::String,
10449
10450    /// The length in bytes of the amount of randomness to retrieve.  Minimum 8
10451    /// bytes, maximum 1024 bytes.
10452    pub length_bytes: i32,
10453
10454    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
10455    /// generating the random data. Currently, only
10456    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
10457    /// supported.
10458    ///
10459    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
10460    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
10461    pub protection_level: crate::model::ProtectionLevel,
10462
10463    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10464}
10465
10466impl GenerateRandomBytesRequest {
10467    pub fn new() -> Self {
10468        std::default::Default::default()
10469    }
10470
10471    /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
10472    ///
10473    /// # Example
10474    /// ```ignore,no_run
10475    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
10476    /// let x = GenerateRandomBytesRequest::new().set_location("example");
10477    /// ```
10478    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10479        self.location = v.into();
10480        self
10481    }
10482
10483    /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
10484    ///
10485    /// # Example
10486    /// ```ignore,no_run
10487    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
10488    /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
10489    /// ```
10490    pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10491        self.length_bytes = v.into();
10492        self
10493    }
10494
10495    /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
10496    ///
10497    /// # Example
10498    /// ```ignore,no_run
10499    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
10500    /// use google_cloud_kms_v1::model::ProtectionLevel;
10501    /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
10502    /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
10503    /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
10504    /// ```
10505    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
10506        mut self,
10507        v: T,
10508    ) -> Self {
10509        self.protection_level = v.into();
10510        self
10511    }
10512}
10513
10514impl wkt::message::Message for GenerateRandomBytesRequest {
10515    fn typename() -> &'static str {
10516        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
10517    }
10518}
10519
10520/// Response message for
10521/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
10522///
10523/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
10524#[derive(Clone, Default, PartialEq)]
10525#[non_exhaustive]
10526pub struct EncryptResponse {
10527    /// The resource name of the
10528    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
10529    /// encryption. Check this field to verify that the intended resource was used
10530    /// for encryption.
10531    ///
10532    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10533    pub name: std::string::String,
10534
10535    /// The encrypted data.
10536    pub ciphertext: ::bytes::Bytes,
10537
10538    /// Integrity verification field. A CRC32C checksum of the returned
10539    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
10540    /// An integrity check of
10541    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
10542    /// can be performed by computing the CRC32C checksum of
10543    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
10544    /// and comparing your results to this field. Discard the response in case of
10545    /// non-matching checksum values, and perform a limited number of retries. A
10546    /// persistent mismatch may indicate an issue in your computation of the CRC32C
10547    /// checksum. Note: This field is defined as int64 for reasons of compatibility
10548    /// across different languages. However, it is a non-negative integer, which
10549    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
10550    /// languages that support this type.
10551    ///
10552    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
10553    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
10554
10555    /// Integrity verification field. A flag indicating whether
10556    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
10557    /// was received by
10558    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
10559    /// for the integrity verification of the
10560    /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
10561    /// this field indicates either that
10562    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
10563    /// was left unset or that it was not delivered to
10564    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
10565    /// set
10566    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
10567    /// but this field is still false, discard the response and perform a limited
10568    /// number of retries.
10569    ///
10570    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
10571    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
10572    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10573    pub verified_plaintext_crc32c: bool,
10574
10575    /// Integrity verification field. A flag indicating whether
10576    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
10577    /// was received by
10578    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
10579    /// for the integrity verification of the
10580    /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
10581    /// false value of this field indicates either that
10582    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
10583    /// was left unset or that it was not delivered to
10584    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
10585    /// set
10586    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
10587    /// but this field is still false, discard the response and perform a limited
10588    /// number of retries.
10589    ///
10590    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
10591    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
10592    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10593    pub verified_additional_authenticated_data_crc32c: bool,
10594
10595    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
10596    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
10597    /// encryption.
10598    ///
10599    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10600    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
10601    pub protection_level: crate::model::ProtectionLevel,
10602
10603    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10604}
10605
10606impl EncryptResponse {
10607    pub fn new() -> Self {
10608        std::default::Default::default()
10609    }
10610
10611    /// Sets the value of [name][crate::model::EncryptResponse::name].
10612    ///
10613    /// # Example
10614    /// ```ignore,no_run
10615    /// # use google_cloud_kms_v1::model::EncryptResponse;
10616    /// let x = EncryptResponse::new().set_name("example");
10617    /// ```
10618    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10619        self.name = v.into();
10620        self
10621    }
10622
10623    /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
10624    ///
10625    /// # Example
10626    /// ```ignore,no_run
10627    /// # use google_cloud_kms_v1::model::EncryptResponse;
10628    /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
10629    /// ```
10630    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10631        self.ciphertext = v.into();
10632        self
10633    }
10634
10635    /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
10636    ///
10637    /// # Example
10638    /// ```ignore,no_run
10639    /// # use google_cloud_kms_v1::model::EncryptResponse;
10640    /// use wkt::Int64Value;
10641    /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
10642    /// ```
10643    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
10644    where
10645        T: std::convert::Into<wkt::Int64Value>,
10646    {
10647        self.ciphertext_crc32c = std::option::Option::Some(v.into());
10648        self
10649    }
10650
10651    /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
10652    ///
10653    /// # Example
10654    /// ```ignore,no_run
10655    /// # use google_cloud_kms_v1::model::EncryptResponse;
10656    /// use wkt::Int64Value;
10657    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
10658    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
10659    /// ```
10660    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
10661    where
10662        T: std::convert::Into<wkt::Int64Value>,
10663    {
10664        self.ciphertext_crc32c = v.map(|x| x.into());
10665        self
10666    }
10667
10668    /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
10669    ///
10670    /// # Example
10671    /// ```ignore,no_run
10672    /// # use google_cloud_kms_v1::model::EncryptResponse;
10673    /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
10674    /// ```
10675    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10676        self.verified_plaintext_crc32c = v.into();
10677        self
10678    }
10679
10680    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
10681    ///
10682    /// # Example
10683    /// ```ignore,no_run
10684    /// # use google_cloud_kms_v1::model::EncryptResponse;
10685    /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
10686    /// ```
10687    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
10688        mut self,
10689        v: T,
10690    ) -> Self {
10691        self.verified_additional_authenticated_data_crc32c = v.into();
10692        self
10693    }
10694
10695    /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
10696    ///
10697    /// # Example
10698    /// ```ignore,no_run
10699    /// # use google_cloud_kms_v1::model::EncryptResponse;
10700    /// use google_cloud_kms_v1::model::ProtectionLevel;
10701    /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
10702    /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
10703    /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
10704    /// ```
10705    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
10706        mut self,
10707        v: T,
10708    ) -> Self {
10709        self.protection_level = v.into();
10710        self
10711    }
10712}
10713
10714impl wkt::message::Message for EncryptResponse {
10715    fn typename() -> &'static str {
10716        "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
10717    }
10718}
10719
10720/// Response message for
10721/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
10722///
10723/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
10724#[derive(Clone, Default, PartialEq)]
10725#[non_exhaustive]
10726pub struct DecryptResponse {
10727    /// The decrypted data originally supplied in
10728    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
10729    ///
10730    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
10731    pub plaintext: ::bytes::Bytes,
10732
10733    /// Integrity verification field. A CRC32C checksum of the returned
10734    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
10735    /// An integrity check of
10736    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
10737    /// can be performed by computing the CRC32C checksum of
10738    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
10739    /// and comparing your results to this field. Discard the response in case of
10740    /// non-matching checksum values, and perform a limited number of retries. A
10741    /// persistent mismatch may indicate an issue in your computation of the CRC32C
10742    /// checksum. Note: receiving this response message indicates that
10743    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
10744    /// successfully decrypt the
10745    /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
10746    /// field is defined as int64 for reasons of compatibility across different
10747    /// languages. However, it is a non-negative integer, which will never exceed
10748    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
10749    /// this type.
10750    ///
10751    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
10752    /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
10753    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10754    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
10755
10756    /// Whether the Decryption was performed using the primary key version.
10757    pub used_primary: bool,
10758
10759    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
10760    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
10761    /// decryption.
10762    ///
10763    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10764    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
10765    pub protection_level: crate::model::ProtectionLevel,
10766
10767    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10768}
10769
10770impl DecryptResponse {
10771    pub fn new() -> Self {
10772        std::default::Default::default()
10773    }
10774
10775    /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
10776    ///
10777    /// # Example
10778    /// ```ignore,no_run
10779    /// # use google_cloud_kms_v1::model::DecryptResponse;
10780    /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
10781    /// ```
10782    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10783        self.plaintext = v.into();
10784        self
10785    }
10786
10787    /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
10788    ///
10789    /// # Example
10790    /// ```ignore,no_run
10791    /// # use google_cloud_kms_v1::model::DecryptResponse;
10792    /// use wkt::Int64Value;
10793    /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
10794    /// ```
10795    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
10796    where
10797        T: std::convert::Into<wkt::Int64Value>,
10798    {
10799        self.plaintext_crc32c = std::option::Option::Some(v.into());
10800        self
10801    }
10802
10803    /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
10804    ///
10805    /// # Example
10806    /// ```ignore,no_run
10807    /// # use google_cloud_kms_v1::model::DecryptResponse;
10808    /// use wkt::Int64Value;
10809    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
10810    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
10811    /// ```
10812    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
10813    where
10814        T: std::convert::Into<wkt::Int64Value>,
10815    {
10816        self.plaintext_crc32c = v.map(|x| x.into());
10817        self
10818    }
10819
10820    /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
10821    ///
10822    /// # Example
10823    /// ```ignore,no_run
10824    /// # use google_cloud_kms_v1::model::DecryptResponse;
10825    /// let x = DecryptResponse::new().set_used_primary(true);
10826    /// ```
10827    pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10828        self.used_primary = v.into();
10829        self
10830    }
10831
10832    /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
10833    ///
10834    /// # Example
10835    /// ```ignore,no_run
10836    /// # use google_cloud_kms_v1::model::DecryptResponse;
10837    /// use google_cloud_kms_v1::model::ProtectionLevel;
10838    /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
10839    /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
10840    /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
10841    /// ```
10842    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
10843        mut self,
10844        v: T,
10845    ) -> Self {
10846        self.protection_level = v.into();
10847        self
10848    }
10849}
10850
10851impl wkt::message::Message for DecryptResponse {
10852    fn typename() -> &'static str {
10853        "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
10854    }
10855}
10856
10857/// Response message for
10858/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
10859///
10860/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
10861#[derive(Clone, Default, PartialEq)]
10862#[non_exhaustive]
10863pub struct RawEncryptResponse {
10864    /// The encrypted data. In the case of AES-GCM, the authentication tag
10865    /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
10866    /// bytes at the end of this field.
10867    ///
10868    /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
10869    pub ciphertext: ::bytes::Bytes,
10870
10871    /// The initialization vector (IV) generated by the service during
10872    /// encryption. This value must be stored and provided in
10873    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
10874    /// at decryption time.
10875    ///
10876    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
10877    pub initialization_vector: ::bytes::Bytes,
10878
10879    /// The length of the authentication tag that is appended to
10880    /// the end of the ciphertext.
10881    pub tag_length: i32,
10882
10883    /// Integrity verification field. A CRC32C checksum of the returned
10884    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
10885    /// An integrity check of ciphertext can be performed by computing the CRC32C
10886    /// checksum of ciphertext and comparing your results to this field. Discard
10887    /// the response in case of non-matching checksum values, and perform a limited
10888    /// number of retries. A persistent mismatch may indicate an issue in your
10889    /// computation of the CRC32C checksum. Note: This field is defined as int64
10890    /// for reasons of compatibility across different languages. However, it is a
10891    /// non-negative integer, which will never exceed 2^32-1, and can be safely
10892    /// downconverted to uint32 in languages that support this type.
10893    ///
10894    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
10895    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
10896
10897    /// Integrity verification field. A CRC32C checksum of the returned
10898    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
10899    /// An integrity check of initialization_vector can be performed by computing
10900    /// the CRC32C checksum of initialization_vector and comparing your results to
10901    /// this field. Discard the response in case of non-matching checksum values,
10902    /// and perform a limited number of retries. A persistent mismatch may indicate
10903    /// an issue in your computation of the CRC32C checksum. Note: This field is
10904    /// defined as int64 for reasons of compatibility across different languages.
10905    /// However, it is a non-negative integer, which will never exceed 2^32-1, and
10906    /// can be safely downconverted to uint32 in languages that support this type.
10907    ///
10908    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
10909    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
10910
10911    /// Integrity verification field. A flag indicating whether
10912    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
10913    /// was received by
10914    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
10915    /// for the integrity verification of the plaintext. A false value of this
10916    /// field indicates either that
10917    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
10918    /// was left unset or that it was not delivered to
10919    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
10920    /// set
10921    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
10922    /// but this field is still false, discard the response and perform a limited
10923    /// number of retries.
10924    ///
10925    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10926    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
10927    pub verified_plaintext_crc32c: bool,
10928
10929    /// Integrity verification field. A flag indicating whether
10930    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
10931    /// was received by
10932    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
10933    /// for the integrity verification of additional_authenticated_data. A false
10934    /// value of this field indicates either that //
10935    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
10936    /// was left unset or that it was not delivered to
10937    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
10938    /// set
10939    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
10940    /// but this field is still false, discard the response and perform a limited
10941    /// number of retries.
10942    ///
10943    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10944    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
10945    pub verified_additional_authenticated_data_crc32c: bool,
10946
10947    /// Integrity verification field. A flag indicating whether
10948    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
10949    /// was received by
10950    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
10951    /// for the integrity verification of initialization_vector. A false value of
10952    /// this field indicates either that
10953    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
10954    /// was left unset or that it was not delivered to
10955    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
10956    /// set
10957    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
10958    /// but this field is still false, discard the response and perform a limited
10959    /// number of retries.
10960    ///
10961    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
10962    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
10963    pub verified_initialization_vector_crc32c: bool,
10964
10965    /// The resource name of the
10966    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
10967    /// encryption. Check this field to verify that the intended resource was used
10968    /// for encryption.
10969    ///
10970    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10971    pub name: std::string::String,
10972
10973    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
10974    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
10975    /// encryption.
10976    ///
10977    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10978    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
10979    pub protection_level: crate::model::ProtectionLevel,
10980
10981    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10982}
10983
10984impl RawEncryptResponse {
10985    pub fn new() -> Self {
10986        std::default::Default::default()
10987    }
10988
10989    /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
10990    ///
10991    /// # Example
10992    /// ```ignore,no_run
10993    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
10994    /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
10995    /// ```
10996    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10997        self.ciphertext = v.into();
10998        self
10999    }
11000
11001    /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
11002    ///
11003    /// # Example
11004    /// ```ignore,no_run
11005    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11006    /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
11007    /// ```
11008    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
11009        mut self,
11010        v: T,
11011    ) -> Self {
11012        self.initialization_vector = v.into();
11013        self
11014    }
11015
11016    /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
11017    ///
11018    /// # Example
11019    /// ```ignore,no_run
11020    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11021    /// let x = RawEncryptResponse::new().set_tag_length(42);
11022    /// ```
11023    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11024        self.tag_length = v.into();
11025        self
11026    }
11027
11028    /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
11029    ///
11030    /// # Example
11031    /// ```ignore,no_run
11032    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11033    /// use wkt::Int64Value;
11034    /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
11035    /// ```
11036    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
11037    where
11038        T: std::convert::Into<wkt::Int64Value>,
11039    {
11040        self.ciphertext_crc32c = std::option::Option::Some(v.into());
11041        self
11042    }
11043
11044    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
11045    ///
11046    /// # Example
11047    /// ```ignore,no_run
11048    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11049    /// use wkt::Int64Value;
11050    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
11051    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
11052    /// ```
11053    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
11054    where
11055        T: std::convert::Into<wkt::Int64Value>,
11056    {
11057        self.ciphertext_crc32c = v.map(|x| x.into());
11058        self
11059    }
11060
11061    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
11062    ///
11063    /// # Example
11064    /// ```ignore,no_run
11065    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11066    /// use wkt::Int64Value;
11067    /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
11068    /// ```
11069    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
11070    where
11071        T: std::convert::Into<wkt::Int64Value>,
11072    {
11073        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
11074        self
11075    }
11076
11077    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
11078    ///
11079    /// # Example
11080    /// ```ignore,no_run
11081    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11082    /// use wkt::Int64Value;
11083    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
11084    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
11085    /// ```
11086    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
11087    where
11088        T: std::convert::Into<wkt::Int64Value>,
11089    {
11090        self.initialization_vector_crc32c = v.map(|x| x.into());
11091        self
11092    }
11093
11094    /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
11095    ///
11096    /// # Example
11097    /// ```ignore,no_run
11098    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11099    /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
11100    /// ```
11101    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11102        self.verified_plaintext_crc32c = v.into();
11103        self
11104    }
11105
11106    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
11107    ///
11108    /// # Example
11109    /// ```ignore,no_run
11110    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11111    /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
11112    /// ```
11113    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
11114        mut self,
11115        v: T,
11116    ) -> Self {
11117        self.verified_additional_authenticated_data_crc32c = v.into();
11118        self
11119    }
11120
11121    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
11122    ///
11123    /// # Example
11124    /// ```ignore,no_run
11125    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11126    /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
11127    /// ```
11128    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
11129        mut self,
11130        v: T,
11131    ) -> Self {
11132        self.verified_initialization_vector_crc32c = v.into();
11133        self
11134    }
11135
11136    /// Sets the value of [name][crate::model::RawEncryptResponse::name].
11137    ///
11138    /// # Example
11139    /// ```ignore,no_run
11140    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11141    /// let x = RawEncryptResponse::new().set_name("example");
11142    /// ```
11143    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11144        self.name = v.into();
11145        self
11146    }
11147
11148    /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
11149    ///
11150    /// # Example
11151    /// ```ignore,no_run
11152    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
11153    /// use google_cloud_kms_v1::model::ProtectionLevel;
11154    /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
11155    /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
11156    /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
11157    /// ```
11158    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
11159        mut self,
11160        v: T,
11161    ) -> Self {
11162        self.protection_level = v.into();
11163        self
11164    }
11165}
11166
11167impl wkt::message::Message for RawEncryptResponse {
11168    fn typename() -> &'static str {
11169        "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
11170    }
11171}
11172
11173/// Response message for
11174/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
11175///
11176/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
11177#[derive(Clone, Default, PartialEq)]
11178#[non_exhaustive]
11179pub struct RawDecryptResponse {
11180    /// The decrypted data.
11181    pub plaintext: ::bytes::Bytes,
11182
11183    /// Integrity verification field. A CRC32C checksum of the returned
11184    /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
11185    /// An integrity check of plaintext can be performed by computing the CRC32C
11186    /// checksum of plaintext and comparing your results to this field. Discard the
11187    /// response in case of non-matching checksum values, and perform a limited
11188    /// number of retries. A persistent mismatch may indicate an issue in your
11189    /// computation of the CRC32C checksum. Note: receiving this response message
11190    /// indicates that
11191    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
11192    /// successfully decrypt the
11193    /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
11194    /// Note: This field is defined as int64 for reasons of compatibility across
11195    /// different languages. However, it is a non-negative integer, which will
11196    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
11197    /// that support this type.
11198    ///
11199    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11200    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
11201    /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
11202    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
11203
11204    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
11205    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
11206    /// decryption.
11207    ///
11208    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11209    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
11210    pub protection_level: crate::model::ProtectionLevel,
11211
11212    /// Integrity verification field. A flag indicating whether
11213    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
11214    /// was received by
11215    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11216    /// for the integrity verification of the ciphertext. A false value of this
11217    /// field indicates either that
11218    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
11219    /// was left unset or that it was not delivered to
11220    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11221    /// set
11222    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
11223    /// but this field is still false, discard the response and perform a limited
11224    /// number of retries.
11225    ///
11226    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11227    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
11228    pub verified_ciphertext_crc32c: bool,
11229
11230    /// Integrity verification field. A flag indicating whether
11231    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
11232    /// was received by
11233    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11234    /// for the integrity verification of additional_authenticated_data. A false
11235    /// value of this field indicates either that //
11236    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
11237    /// was left unset or that it was not delivered to
11238    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11239    /// set
11240    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
11241    /// but this field is still false, discard the response and perform a limited
11242    /// number of retries.
11243    ///
11244    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11245    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
11246    pub verified_additional_authenticated_data_crc32c: bool,
11247
11248    /// Integrity verification field. A flag indicating whether
11249    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
11250    /// was received by
11251    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11252    /// for the integrity verification of initialization_vector. A false value of
11253    /// this field indicates either that
11254    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
11255    /// was left unset or that it was not delivered to
11256    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11257    /// set
11258    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
11259    /// but this field is still false, discard the response and perform a limited
11260    /// number of retries.
11261    ///
11262    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11263    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
11264    pub verified_initialization_vector_crc32c: bool,
11265
11266    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11267}
11268
11269impl RawDecryptResponse {
11270    pub fn new() -> Self {
11271        std::default::Default::default()
11272    }
11273
11274    /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
11275    ///
11276    /// # Example
11277    /// ```ignore,no_run
11278    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
11279    /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
11280    /// ```
11281    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11282        self.plaintext = v.into();
11283        self
11284    }
11285
11286    /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
11287    ///
11288    /// # Example
11289    /// ```ignore,no_run
11290    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
11291    /// use wkt::Int64Value;
11292    /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
11293    /// ```
11294    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
11295    where
11296        T: std::convert::Into<wkt::Int64Value>,
11297    {
11298        self.plaintext_crc32c = std::option::Option::Some(v.into());
11299        self
11300    }
11301
11302    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
11303    ///
11304    /// # Example
11305    /// ```ignore,no_run
11306    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
11307    /// use wkt::Int64Value;
11308    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
11309    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
11310    /// ```
11311    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
11312    where
11313        T: std::convert::Into<wkt::Int64Value>,
11314    {
11315        self.plaintext_crc32c = v.map(|x| x.into());
11316        self
11317    }
11318
11319    /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
11320    ///
11321    /// # Example
11322    /// ```ignore,no_run
11323    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
11324    /// use google_cloud_kms_v1::model::ProtectionLevel;
11325    /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
11326    /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
11327    /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
11328    /// ```
11329    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
11330        mut self,
11331        v: T,
11332    ) -> Self {
11333        self.protection_level = v.into();
11334        self
11335    }
11336
11337    /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
11338    ///
11339    /// # Example
11340    /// ```ignore,no_run
11341    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
11342    /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
11343    /// ```
11344    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11345        self.verified_ciphertext_crc32c = v.into();
11346        self
11347    }
11348
11349    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
11350    ///
11351    /// # Example
11352    /// ```ignore,no_run
11353    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
11354    /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
11355    /// ```
11356    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
11357        mut self,
11358        v: T,
11359    ) -> Self {
11360        self.verified_additional_authenticated_data_crc32c = v.into();
11361        self
11362    }
11363
11364    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
11365    ///
11366    /// # Example
11367    /// ```ignore,no_run
11368    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
11369    /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
11370    /// ```
11371    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
11372        mut self,
11373        v: T,
11374    ) -> Self {
11375        self.verified_initialization_vector_crc32c = v.into();
11376        self
11377    }
11378}
11379
11380impl wkt::message::Message for RawDecryptResponse {
11381    fn typename() -> &'static str {
11382        "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
11383    }
11384}
11385
11386/// Response message for
11387/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
11388///
11389/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
11390#[derive(Clone, Default, PartialEq)]
11391#[non_exhaustive]
11392pub struct AsymmetricSignResponse {
11393    /// The created signature.
11394    pub signature: ::bytes::Bytes,
11395
11396    /// Integrity verification field. A CRC32C checksum of the returned
11397    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
11398    /// An integrity check of
11399    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
11400    /// can be performed by computing the CRC32C checksum of
11401    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
11402    /// and comparing your results to this field. Discard the response in case of
11403    /// non-matching checksum values, and perform a limited number of retries. A
11404    /// persistent mismatch may indicate an issue in your computation of the CRC32C
11405    /// checksum. Note: This field is defined as int64 for reasons of compatibility
11406    /// across different languages. However, it is a non-negative integer, which
11407    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
11408    /// languages that support this type.
11409    ///
11410    /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
11411    pub signature_crc32c: std::option::Option<wkt::Int64Value>,
11412
11413    /// Integrity verification field. A flag indicating whether
11414    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
11415    /// was received by
11416    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11417    /// for the integrity verification of the
11418    /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
11419    /// of this field indicates either that
11420    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
11421    /// was left unset or that it was not delivered to
11422    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11423    /// set
11424    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
11425    /// but this field is still false, discard the response and perform a limited
11426    /// number of retries.
11427    ///
11428    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
11429    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
11430    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11431    pub verified_digest_crc32c: bool,
11432
11433    /// The resource name of the
11434    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
11435    /// Check this field to verify that the intended resource was used for signing.
11436    ///
11437    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11438    pub name: std::string::String,
11439
11440    /// Integrity verification field. A flag indicating whether
11441    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
11442    /// was received by
11443    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11444    /// for the integrity verification of the
11445    /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
11446    /// this field indicates either that
11447    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
11448    /// was left unset or that it was not delivered to
11449    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11450    /// set
11451    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
11452    /// but this field is still false, discard the response and perform a limited
11453    /// number of retries.
11454    ///
11455    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
11456    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
11457    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11458    pub verified_data_crc32c: bool,
11459
11460    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
11461    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
11462    ///
11463    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11464    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
11465    pub protection_level: crate::model::ProtectionLevel,
11466
11467    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11468}
11469
11470impl AsymmetricSignResponse {
11471    pub fn new() -> Self {
11472        std::default::Default::default()
11473    }
11474
11475    /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
11476    ///
11477    /// # Example
11478    /// ```ignore,no_run
11479    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
11480    /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
11481    /// ```
11482    pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11483        self.signature = v.into();
11484        self
11485    }
11486
11487    /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
11488    ///
11489    /// # Example
11490    /// ```ignore,no_run
11491    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
11492    /// use wkt::Int64Value;
11493    /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
11494    /// ```
11495    pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
11496    where
11497        T: std::convert::Into<wkt::Int64Value>,
11498    {
11499        self.signature_crc32c = std::option::Option::Some(v.into());
11500        self
11501    }
11502
11503    /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
11504    ///
11505    /// # Example
11506    /// ```ignore,no_run
11507    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
11508    /// use wkt::Int64Value;
11509    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
11510    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
11511    /// ```
11512    pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
11513    where
11514        T: std::convert::Into<wkt::Int64Value>,
11515    {
11516        self.signature_crc32c = v.map(|x| x.into());
11517        self
11518    }
11519
11520    /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
11521    ///
11522    /// # Example
11523    /// ```ignore,no_run
11524    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
11525    /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
11526    /// ```
11527    pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11528        self.verified_digest_crc32c = v.into();
11529        self
11530    }
11531
11532    /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
11533    ///
11534    /// # Example
11535    /// ```ignore,no_run
11536    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
11537    /// let x = AsymmetricSignResponse::new().set_name("example");
11538    /// ```
11539    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11540        self.name = v.into();
11541        self
11542    }
11543
11544    /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
11545    ///
11546    /// # Example
11547    /// ```ignore,no_run
11548    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
11549    /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
11550    /// ```
11551    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11552        self.verified_data_crc32c = v.into();
11553        self
11554    }
11555
11556    /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
11557    ///
11558    /// # Example
11559    /// ```ignore,no_run
11560    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
11561    /// use google_cloud_kms_v1::model::ProtectionLevel;
11562    /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
11563    /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
11564    /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
11565    /// ```
11566    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
11567        mut self,
11568        v: T,
11569    ) -> Self {
11570        self.protection_level = v.into();
11571        self
11572    }
11573}
11574
11575impl wkt::message::Message for AsymmetricSignResponse {
11576    fn typename() -> &'static str {
11577        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
11578    }
11579}
11580
11581/// Response message for
11582/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
11583///
11584/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
11585#[derive(Clone, Default, PartialEq)]
11586#[non_exhaustive]
11587pub struct AsymmetricDecryptResponse {
11588    /// The decrypted data originally encrypted with the matching public key.
11589    pub plaintext: ::bytes::Bytes,
11590
11591    /// Integrity verification field. A CRC32C checksum of the returned
11592    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
11593    /// An integrity check of
11594    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
11595    /// can be performed by computing the CRC32C checksum of
11596    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
11597    /// and comparing your results to this field. Discard the response in case of
11598    /// non-matching checksum values, and perform a limited number of retries. A
11599    /// persistent mismatch may indicate an issue in your computation of the CRC32C
11600    /// checksum. Note: This field is defined as int64 for reasons of compatibility
11601    /// across different languages. However, it is a non-negative integer, which
11602    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
11603    /// languages that support this type.
11604    ///
11605    /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
11606    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
11607
11608    /// Integrity verification field. A flag indicating whether
11609    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
11610    /// was received by
11611    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11612    /// for the integrity verification of the
11613    /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
11614    /// false value of this field indicates either that
11615    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
11616    /// was left unset or that it was not delivered to
11617    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11618    /// set
11619    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
11620    /// but this field is still false, discard the response and perform a limited
11621    /// number of retries.
11622    ///
11623    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
11624    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
11625    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11626    pub verified_ciphertext_crc32c: bool,
11627
11628    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
11629    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
11630    /// decryption.
11631    ///
11632    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11633    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
11634    pub protection_level: crate::model::ProtectionLevel,
11635
11636    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11637}
11638
11639impl AsymmetricDecryptResponse {
11640    pub fn new() -> Self {
11641        std::default::Default::default()
11642    }
11643
11644    /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
11645    ///
11646    /// # Example
11647    /// ```ignore,no_run
11648    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
11649    /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
11650    /// ```
11651    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11652        self.plaintext = v.into();
11653        self
11654    }
11655
11656    /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
11657    ///
11658    /// # Example
11659    /// ```ignore,no_run
11660    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
11661    /// use wkt::Int64Value;
11662    /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
11663    /// ```
11664    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
11665    where
11666        T: std::convert::Into<wkt::Int64Value>,
11667    {
11668        self.plaintext_crc32c = std::option::Option::Some(v.into());
11669        self
11670    }
11671
11672    /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
11673    ///
11674    /// # Example
11675    /// ```ignore,no_run
11676    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
11677    /// use wkt::Int64Value;
11678    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
11679    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
11680    /// ```
11681    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
11682    where
11683        T: std::convert::Into<wkt::Int64Value>,
11684    {
11685        self.plaintext_crc32c = v.map(|x| x.into());
11686        self
11687    }
11688
11689    /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
11690    ///
11691    /// # Example
11692    /// ```ignore,no_run
11693    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
11694    /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
11695    /// ```
11696    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11697        self.verified_ciphertext_crc32c = v.into();
11698        self
11699    }
11700
11701    /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
11702    ///
11703    /// # Example
11704    /// ```ignore,no_run
11705    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
11706    /// use google_cloud_kms_v1::model::ProtectionLevel;
11707    /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
11708    /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
11709    /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
11710    /// ```
11711    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
11712        mut self,
11713        v: T,
11714    ) -> Self {
11715        self.protection_level = v.into();
11716        self
11717    }
11718}
11719
11720impl wkt::message::Message for AsymmetricDecryptResponse {
11721    fn typename() -> &'static str {
11722        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
11723    }
11724}
11725
11726/// Response message for
11727/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
11728///
11729/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
11730#[derive(Clone, Default, PartialEq)]
11731#[non_exhaustive]
11732pub struct MacSignResponse {
11733    /// The resource name of the
11734    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
11735    /// Check this field to verify that the intended resource was used for signing.
11736    ///
11737    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11738    pub name: std::string::String,
11739
11740    /// The created signature.
11741    pub mac: ::bytes::Bytes,
11742
11743    /// Integrity verification field. A CRC32C checksum of the returned
11744    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
11745    /// integrity check of
11746    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
11747    /// performed by computing the CRC32C checksum of
11748    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
11749    /// comparing your results to this field. Discard the response in case of
11750    /// non-matching checksum values, and perform a limited number of retries. A
11751    /// persistent mismatch may indicate an issue in your computation of the CRC32C
11752    /// checksum. Note: This field is defined as int64 for reasons of compatibility
11753    /// across different languages. However, it is a non-negative integer, which
11754    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
11755    /// languages that support this type.
11756    ///
11757    /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
11758    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
11759
11760    /// Integrity verification field. A flag indicating whether
11761    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
11762    /// was received by
11763    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11764    /// for the integrity verification of the
11765    /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
11766    /// field indicates either that
11767    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
11768    /// was left unset or that it was not delivered to
11769    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11770    /// set
11771    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
11772    /// but this field is still false, discard the response and perform a limited
11773    /// number of retries.
11774    ///
11775    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11776    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
11777    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
11778    pub verified_data_crc32c: bool,
11779
11780    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
11781    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
11782    ///
11783    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11784    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
11785    pub protection_level: crate::model::ProtectionLevel,
11786
11787    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11788}
11789
11790impl MacSignResponse {
11791    pub fn new() -> Self {
11792        std::default::Default::default()
11793    }
11794
11795    /// Sets the value of [name][crate::model::MacSignResponse::name].
11796    ///
11797    /// # Example
11798    /// ```ignore,no_run
11799    /// # use google_cloud_kms_v1::model::MacSignResponse;
11800    /// let x = MacSignResponse::new().set_name("example");
11801    /// ```
11802    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11803        self.name = v.into();
11804        self
11805    }
11806
11807    /// Sets the value of [mac][crate::model::MacSignResponse::mac].
11808    ///
11809    /// # Example
11810    /// ```ignore,no_run
11811    /// # use google_cloud_kms_v1::model::MacSignResponse;
11812    /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
11813    /// ```
11814    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11815        self.mac = v.into();
11816        self
11817    }
11818
11819    /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
11820    ///
11821    /// # Example
11822    /// ```ignore,no_run
11823    /// # use google_cloud_kms_v1::model::MacSignResponse;
11824    /// use wkt::Int64Value;
11825    /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
11826    /// ```
11827    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
11828    where
11829        T: std::convert::Into<wkt::Int64Value>,
11830    {
11831        self.mac_crc32c = std::option::Option::Some(v.into());
11832        self
11833    }
11834
11835    /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
11836    ///
11837    /// # Example
11838    /// ```ignore,no_run
11839    /// # use google_cloud_kms_v1::model::MacSignResponse;
11840    /// use wkt::Int64Value;
11841    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
11842    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
11843    /// ```
11844    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
11845    where
11846        T: std::convert::Into<wkt::Int64Value>,
11847    {
11848        self.mac_crc32c = v.map(|x| x.into());
11849        self
11850    }
11851
11852    /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
11853    ///
11854    /// # Example
11855    /// ```ignore,no_run
11856    /// # use google_cloud_kms_v1::model::MacSignResponse;
11857    /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
11858    /// ```
11859    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11860        self.verified_data_crc32c = v.into();
11861        self
11862    }
11863
11864    /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
11865    ///
11866    /// # Example
11867    /// ```ignore,no_run
11868    /// # use google_cloud_kms_v1::model::MacSignResponse;
11869    /// use google_cloud_kms_v1::model::ProtectionLevel;
11870    /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
11871    /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
11872    /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
11873    /// ```
11874    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
11875        mut self,
11876        v: T,
11877    ) -> Self {
11878        self.protection_level = v.into();
11879        self
11880    }
11881}
11882
11883impl wkt::message::Message for MacSignResponse {
11884    fn typename() -> &'static str {
11885        "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
11886    }
11887}
11888
11889/// Response message for
11890/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
11891///
11892/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
11893#[derive(Clone, Default, PartialEq)]
11894#[non_exhaustive]
11895pub struct MacVerifyResponse {
11896    /// The resource name of the
11897    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
11898    /// verification. Check this field to verify that the intended resource was
11899    /// used for verification.
11900    ///
11901    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11902    pub name: std::string::String,
11903
11904    /// This field indicates whether or not the verification operation for
11905    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
11906    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
11907    /// successful.
11908    ///
11909    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
11910    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
11911    pub success: bool,
11912
11913    /// Integrity verification field. A flag indicating whether
11914    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
11915    /// was received by
11916    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11917    /// for the integrity verification of the
11918    /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
11919    /// field indicates either that
11920    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
11921    /// was left unset or that it was not delivered to
11922    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11923    /// set
11924    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
11925    /// but this field is still false, discard the response and perform a limited
11926    /// number of retries.
11927    ///
11928    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11929    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
11930    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
11931    pub verified_data_crc32c: bool,
11932
11933    /// Integrity verification field. A flag indicating whether
11934    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
11935    /// was received by
11936    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
11937    /// for the integrity verification of the
11938    /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
11939    /// field indicates either that
11940    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
11941    /// was left unset or that it was not delivered to
11942    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
11943    /// set
11944    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
11945    /// but this field is still false, discard the response and perform a limited
11946    /// number of retries.
11947    ///
11948    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
11949    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
11950    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
11951    pub verified_mac_crc32c: bool,
11952
11953    /// Integrity verification field. This value is used for the integrity
11954    /// verification of [MacVerifyResponse.success]. If the value of this field
11955    /// contradicts the value of [MacVerifyResponse.success], discard the response
11956    /// and perform a limited number of retries.
11957    pub verified_success_integrity: bool,
11958
11959    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
11960    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
11961    /// verification.
11962    ///
11963    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11964    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
11965    pub protection_level: crate::model::ProtectionLevel,
11966
11967    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11968}
11969
11970impl MacVerifyResponse {
11971    pub fn new() -> Self {
11972        std::default::Default::default()
11973    }
11974
11975    /// Sets the value of [name][crate::model::MacVerifyResponse::name].
11976    ///
11977    /// # Example
11978    /// ```ignore,no_run
11979    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
11980    /// let x = MacVerifyResponse::new().set_name("example");
11981    /// ```
11982    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11983        self.name = v.into();
11984        self
11985    }
11986
11987    /// Sets the value of [success][crate::model::MacVerifyResponse::success].
11988    ///
11989    /// # Example
11990    /// ```ignore,no_run
11991    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
11992    /// let x = MacVerifyResponse::new().set_success(true);
11993    /// ```
11994    pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11995        self.success = v.into();
11996        self
11997    }
11998
11999    /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
12000    ///
12001    /// # Example
12002    /// ```ignore,no_run
12003    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
12004    /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
12005    /// ```
12006    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12007        self.verified_data_crc32c = v.into();
12008        self
12009    }
12010
12011    /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
12012    ///
12013    /// # Example
12014    /// ```ignore,no_run
12015    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
12016    /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
12017    /// ```
12018    pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12019        self.verified_mac_crc32c = v.into();
12020        self
12021    }
12022
12023    /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
12024    ///
12025    /// # Example
12026    /// ```ignore,no_run
12027    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
12028    /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
12029    /// ```
12030    pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12031        self.verified_success_integrity = v.into();
12032        self
12033    }
12034
12035    /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
12036    ///
12037    /// # Example
12038    /// ```ignore,no_run
12039    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
12040    /// use google_cloud_kms_v1::model::ProtectionLevel;
12041    /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
12042    /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
12043    /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
12044    /// ```
12045    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
12046        mut self,
12047        v: T,
12048    ) -> Self {
12049        self.protection_level = v.into();
12050        self
12051    }
12052}
12053
12054impl wkt::message::Message for MacVerifyResponse {
12055    fn typename() -> &'static str {
12056        "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
12057    }
12058}
12059
12060/// Response message for
12061/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
12062///
12063/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
12064#[derive(Clone, Default, PartialEq)]
12065#[non_exhaustive]
12066pub struct DecapsulateResponse {
12067    /// The resource name of the
12068    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
12069    /// decapsulation. Check this field to verify that the intended resource was
12070    /// used for decapsulation.
12071    ///
12072    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12073    pub name: std::string::String,
12074
12075    /// The decapsulated shared_secret originally encapsulated with the matching
12076    /// public key.
12077    pub shared_secret: ::bytes::Bytes,
12078
12079    /// Integrity verification field. A CRC32C checksum of the returned
12080    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
12081    /// An integrity check of
12082    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
12083    /// can be performed by computing the CRC32C checksum of
12084    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
12085    /// and comparing your results to this field. Discard the response in case of
12086    /// non-matching checksum values, and perform a limited number of retries. A
12087    /// persistent mismatch may indicate an issue in your computation of the CRC32C
12088    /// checksum. Note: receiving this response message indicates that
12089    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
12090    /// successfully decrypt the
12091    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
12092    /// field is defined as int64 for reasons of compatibility across different
12093    /// languages. However, it is a non-negative integer, which will never exceed
12094    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
12095    /// this type.
12096    ///
12097    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
12098    /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
12099    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12100    pub shared_secret_crc32c: std::option::Option<i64>,
12101
12102    /// Integrity verification field. A flag indicating whether
12103    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
12104    /// was received by
12105    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
12106    /// for the integrity verification of the
12107    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
12108    /// value of this field indicates either that
12109    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
12110    /// was left unset or that it was not delivered to
12111    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
12112    /// set
12113    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
12114    /// but this field is still false, discard the response and perform a limited
12115    /// number of retries.
12116    ///
12117    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
12118    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
12119    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12120    pub verified_ciphertext_crc32c: bool,
12121
12122    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
12123    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
12124    /// decapsulation.
12125    ///
12126    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12127    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
12128    pub protection_level: crate::model::ProtectionLevel,
12129
12130    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12131}
12132
12133impl DecapsulateResponse {
12134    pub fn new() -> Self {
12135        std::default::Default::default()
12136    }
12137
12138    /// Sets the value of [name][crate::model::DecapsulateResponse::name].
12139    ///
12140    /// # Example
12141    /// ```ignore,no_run
12142    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
12143    /// let x = DecapsulateResponse::new().set_name("example");
12144    /// ```
12145    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12146        self.name = v.into();
12147        self
12148    }
12149
12150    /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
12151    ///
12152    /// # Example
12153    /// ```ignore,no_run
12154    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
12155    /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
12156    /// ```
12157    pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12158        self.shared_secret = v.into();
12159        self
12160    }
12161
12162    /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
12163    ///
12164    /// # Example
12165    /// ```ignore,no_run
12166    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
12167    /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
12168    /// ```
12169    pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
12170    where
12171        T: std::convert::Into<i64>,
12172    {
12173        self.shared_secret_crc32c = std::option::Option::Some(v.into());
12174        self
12175    }
12176
12177    /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
12178    ///
12179    /// # Example
12180    /// ```ignore,no_run
12181    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
12182    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
12183    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
12184    /// ```
12185    pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
12186    where
12187        T: std::convert::Into<i64>,
12188    {
12189        self.shared_secret_crc32c = v.map(|x| x.into());
12190        self
12191    }
12192
12193    /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
12194    ///
12195    /// # Example
12196    /// ```ignore,no_run
12197    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
12198    /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
12199    /// ```
12200    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12201        self.verified_ciphertext_crc32c = v.into();
12202        self
12203    }
12204
12205    /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
12206    ///
12207    /// # Example
12208    /// ```ignore,no_run
12209    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
12210    /// use google_cloud_kms_v1::model::ProtectionLevel;
12211    /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
12212    /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
12213    /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
12214    /// ```
12215    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
12216        mut self,
12217        v: T,
12218    ) -> Self {
12219        self.protection_level = v.into();
12220        self
12221    }
12222}
12223
12224impl wkt::message::Message for DecapsulateResponse {
12225    fn typename() -> &'static str {
12226        "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
12227    }
12228}
12229
12230/// Response message for
12231/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
12232///
12233/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
12234#[derive(Clone, Default, PartialEq)]
12235#[non_exhaustive]
12236pub struct GenerateRandomBytesResponse {
12237    /// The generated data.
12238    pub data: ::bytes::Bytes,
12239
12240    /// Integrity verification field. A CRC32C checksum of the returned
12241    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
12242    /// An integrity check of
12243    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
12244    /// can be performed by computing the CRC32C checksum of
12245    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
12246    /// and comparing your results to this field. Discard the response in case of
12247    /// non-matching checksum values, and perform a limited number of retries. A
12248    /// persistent mismatch may indicate an issue in your computation of the CRC32C
12249    /// checksum. Note: This field is defined as int64 for reasons of compatibility
12250    /// across different languages. However, it is a non-negative integer, which
12251    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
12252    /// languages that support this type.
12253    ///
12254    /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
12255    pub data_crc32c: std::option::Option<wkt::Int64Value>,
12256
12257    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12258}
12259
12260impl GenerateRandomBytesResponse {
12261    pub fn new() -> Self {
12262        std::default::Default::default()
12263    }
12264
12265    /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
12266    ///
12267    /// # Example
12268    /// ```ignore,no_run
12269    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
12270    /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
12271    /// ```
12272    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12273        self.data = v.into();
12274        self
12275    }
12276
12277    /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
12278    ///
12279    /// # Example
12280    /// ```ignore,no_run
12281    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
12282    /// use wkt::Int64Value;
12283    /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
12284    /// ```
12285    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
12286    where
12287        T: std::convert::Into<wkt::Int64Value>,
12288    {
12289        self.data_crc32c = std::option::Option::Some(v.into());
12290        self
12291    }
12292
12293    /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
12294    ///
12295    /// # Example
12296    /// ```ignore,no_run
12297    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
12298    /// use wkt::Int64Value;
12299    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
12300    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
12301    /// ```
12302    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
12303    where
12304        T: std::convert::Into<wkt::Int64Value>,
12305    {
12306        self.data_crc32c = v.map(|x| x.into());
12307        self
12308    }
12309}
12310
12311impl wkt::message::Message for GenerateRandomBytesResponse {
12312    fn typename() -> &'static str {
12313        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
12314    }
12315}
12316
12317/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
12318///
12319/// [google.cloud.kms.v1.Digest]: crate::model::Digest
12320#[derive(Clone, Default, PartialEq)]
12321#[non_exhaustive]
12322pub struct Digest {
12323    /// Required. The message digest.
12324    pub digest: std::option::Option<crate::model::digest::Digest>,
12325
12326    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12327}
12328
12329impl Digest {
12330    pub fn new() -> Self {
12331        std::default::Default::default()
12332    }
12333
12334    /// Sets the value of [digest][crate::model::Digest::digest].
12335    ///
12336    /// Note that all the setters affecting `digest` are mutually
12337    /// exclusive.
12338    ///
12339    /// # Example
12340    /// ```ignore,no_run
12341    /// # use google_cloud_kms_v1::model::Digest;
12342    /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
12343    /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
12344    /// ```
12345    pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
12346        mut self,
12347        v: T,
12348    ) -> Self {
12349        self.digest = v.into();
12350        self
12351    }
12352
12353    /// The value of [digest][crate::model::Digest::digest]
12354    /// if it holds a `Sha256`, `None` if the field is not set or
12355    /// holds a different branch.
12356    pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
12357        #[allow(unreachable_patterns)]
12358        self.digest.as_ref().and_then(|v| match v {
12359            crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
12360            _ => std::option::Option::None,
12361        })
12362    }
12363
12364    /// Sets the value of [digest][crate::model::Digest::digest]
12365    /// to hold a `Sha256`.
12366    ///
12367    /// Note that all the setters affecting `digest` are
12368    /// mutually exclusive.
12369    ///
12370    /// # Example
12371    /// ```ignore,no_run
12372    /// # use google_cloud_kms_v1::model::Digest;
12373    /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
12374    /// assert!(x.sha256().is_some());
12375    /// assert!(x.sha384().is_none());
12376    /// assert!(x.sha512().is_none());
12377    /// ```
12378    pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12379        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
12380        self
12381    }
12382
12383    /// The value of [digest][crate::model::Digest::digest]
12384    /// if it holds a `Sha384`, `None` if the field is not set or
12385    /// holds a different branch.
12386    pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
12387        #[allow(unreachable_patterns)]
12388        self.digest.as_ref().and_then(|v| match v {
12389            crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
12390            _ => std::option::Option::None,
12391        })
12392    }
12393
12394    /// Sets the value of [digest][crate::model::Digest::digest]
12395    /// to hold a `Sha384`.
12396    ///
12397    /// Note that all the setters affecting `digest` are
12398    /// mutually exclusive.
12399    ///
12400    /// # Example
12401    /// ```ignore,no_run
12402    /// # use google_cloud_kms_v1::model::Digest;
12403    /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
12404    /// assert!(x.sha384().is_some());
12405    /// assert!(x.sha256().is_none());
12406    /// assert!(x.sha512().is_none());
12407    /// ```
12408    pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12409        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
12410        self
12411    }
12412
12413    /// The value of [digest][crate::model::Digest::digest]
12414    /// if it holds a `Sha512`, `None` if the field is not set or
12415    /// holds a different branch.
12416    pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
12417        #[allow(unreachable_patterns)]
12418        self.digest.as_ref().and_then(|v| match v {
12419            crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
12420            _ => std::option::Option::None,
12421        })
12422    }
12423
12424    /// Sets the value of [digest][crate::model::Digest::digest]
12425    /// to hold a `Sha512`.
12426    ///
12427    /// Note that all the setters affecting `digest` are
12428    /// mutually exclusive.
12429    ///
12430    /// # Example
12431    /// ```ignore,no_run
12432    /// # use google_cloud_kms_v1::model::Digest;
12433    /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
12434    /// assert!(x.sha512().is_some());
12435    /// assert!(x.sha256().is_none());
12436    /// assert!(x.sha384().is_none());
12437    /// ```
12438    pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12439        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
12440        self
12441    }
12442}
12443
12444impl wkt::message::Message for Digest {
12445    fn typename() -> &'static str {
12446        "type.googleapis.com/google.cloud.kms.v1.Digest"
12447    }
12448}
12449
12450/// Defines additional types related to [Digest].
12451pub mod digest {
12452    #[allow(unused_imports)]
12453    use super::*;
12454
12455    /// Required. The message digest.
12456    #[derive(Clone, Debug, PartialEq)]
12457    #[non_exhaustive]
12458    pub enum Digest {
12459        /// A message digest produced with the SHA-256 algorithm.
12460        Sha256(::bytes::Bytes),
12461        /// A message digest produced with the SHA-384 algorithm.
12462        Sha384(::bytes::Bytes),
12463        /// A message digest produced with the SHA-512 algorithm.
12464        Sha512(::bytes::Bytes),
12465    }
12466}
12467
12468/// Cloud KMS metadata for the given
12469/// [google.cloud.location.Location][google.cloud.location.Location].
12470///
12471/// [google.cloud.location.Location]: location::model::Location
12472#[derive(Clone, Default, PartialEq)]
12473#[non_exhaustive]
12474pub struct LocationMetadata {
12475    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
12476    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
12477    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
12478    /// location.
12479    ///
12480    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12481    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12482    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
12483    pub hsm_available: bool,
12484
12485    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
12486    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
12487    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
12488    /// this location.
12489    ///
12490    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12491    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12492    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
12493    pub ekm_available: bool,
12494
12495    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12496}
12497
12498impl LocationMetadata {
12499    pub fn new() -> Self {
12500        std::default::Default::default()
12501    }
12502
12503    /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
12504    ///
12505    /// # Example
12506    /// ```ignore,no_run
12507    /// # use google_cloud_kms_v1::model::LocationMetadata;
12508    /// let x = LocationMetadata::new().set_hsm_available(true);
12509    /// ```
12510    pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12511        self.hsm_available = v.into();
12512        self
12513    }
12514
12515    /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
12516    ///
12517    /// # Example
12518    /// ```ignore,no_run
12519    /// # use google_cloud_kms_v1::model::LocationMetadata;
12520    /// let x = LocationMetadata::new().set_ekm_available(true);
12521    /// ```
12522    pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12523        self.ekm_available = v.into();
12524        self
12525    }
12526}
12527
12528impl wkt::message::Message for LocationMetadata {
12529    fn typename() -> &'static str {
12530        "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
12531    }
12532}
12533
12534/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
12535/// cryptographic operations are performed. For more information, see [Protection
12536/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
12537///
12538/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
12539///
12540/// # Working with unknown values
12541///
12542/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12543/// additional enum variants at any time. Adding new variants is not considered
12544/// a breaking change. Applications should write their code in anticipation of:
12545///
12546/// - New values appearing in future releases of the client library, **and**
12547/// - New values received dynamically, without application changes.
12548///
12549/// Please consult the [Working with enums] section in the user guide for some
12550/// guidelines.
12551///
12552/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12553#[derive(Clone, Debug, PartialEq)]
12554#[non_exhaustive]
12555pub enum ProtectionLevel {
12556    /// Not specified.
12557    Unspecified,
12558    /// Crypto operations are performed in software.
12559    Software,
12560    /// Crypto operations are performed in a Hardware Security Module.
12561    Hsm,
12562    /// Crypto operations are performed by an external key manager.
12563    External,
12564    /// Crypto operations are performed in an EKM-over-VPC backend.
12565    ExternalVpc,
12566    /// If set, the enum was initialized with an unknown value.
12567    ///
12568    /// Applications can examine the value using [ProtectionLevel::value] or
12569    /// [ProtectionLevel::name].
12570    UnknownValue(protection_level::UnknownValue),
12571}
12572
12573#[doc(hidden)]
12574pub mod protection_level {
12575    #[allow(unused_imports)]
12576    use super::*;
12577    #[derive(Clone, Debug, PartialEq)]
12578    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12579}
12580
12581impl ProtectionLevel {
12582    /// Gets the enum value.
12583    ///
12584    /// Returns `None` if the enum contains an unknown value deserialized from
12585    /// the string representation of enums.
12586    pub fn value(&self) -> std::option::Option<i32> {
12587        match self {
12588            Self::Unspecified => std::option::Option::Some(0),
12589            Self::Software => std::option::Option::Some(1),
12590            Self::Hsm => std::option::Option::Some(2),
12591            Self::External => std::option::Option::Some(3),
12592            Self::ExternalVpc => std::option::Option::Some(4),
12593            Self::UnknownValue(u) => u.0.value(),
12594        }
12595    }
12596
12597    /// Gets the enum value as a string.
12598    ///
12599    /// Returns `None` if the enum contains an unknown value deserialized from
12600    /// the integer representation of enums.
12601    pub fn name(&self) -> std::option::Option<&str> {
12602        match self {
12603            Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
12604            Self::Software => std::option::Option::Some("SOFTWARE"),
12605            Self::Hsm => std::option::Option::Some("HSM"),
12606            Self::External => std::option::Option::Some("EXTERNAL"),
12607            Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
12608            Self::UnknownValue(u) => u.0.name(),
12609        }
12610    }
12611}
12612
12613impl std::default::Default for ProtectionLevel {
12614    fn default() -> Self {
12615        use std::convert::From;
12616        Self::from(0)
12617    }
12618}
12619
12620impl std::fmt::Display for ProtectionLevel {
12621    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12622        wkt::internal::display_enum(f, self.name(), self.value())
12623    }
12624}
12625
12626impl std::convert::From<i32> for ProtectionLevel {
12627    fn from(value: i32) -> Self {
12628        match value {
12629            0 => Self::Unspecified,
12630            1 => Self::Software,
12631            2 => Self::Hsm,
12632            3 => Self::External,
12633            4 => Self::ExternalVpc,
12634            _ => Self::UnknownValue(protection_level::UnknownValue(
12635                wkt::internal::UnknownEnumValue::Integer(value),
12636            )),
12637        }
12638    }
12639}
12640
12641impl std::convert::From<&str> for ProtectionLevel {
12642    fn from(value: &str) -> Self {
12643        use std::string::ToString;
12644        match value {
12645            "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
12646            "SOFTWARE" => Self::Software,
12647            "HSM" => Self::Hsm,
12648            "EXTERNAL" => Self::External,
12649            "EXTERNAL_VPC" => Self::ExternalVpc,
12650            _ => Self::UnknownValue(protection_level::UnknownValue(
12651                wkt::internal::UnknownEnumValue::String(value.to_string()),
12652            )),
12653        }
12654    }
12655}
12656
12657impl serde::ser::Serialize for ProtectionLevel {
12658    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12659    where
12660        S: serde::Serializer,
12661    {
12662        match self {
12663            Self::Unspecified => serializer.serialize_i32(0),
12664            Self::Software => serializer.serialize_i32(1),
12665            Self::Hsm => serializer.serialize_i32(2),
12666            Self::External => serializer.serialize_i32(3),
12667            Self::ExternalVpc => serializer.serialize_i32(4),
12668            Self::UnknownValue(u) => u.0.serialize(serializer),
12669        }
12670    }
12671}
12672
12673impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
12674    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12675    where
12676        D: serde::Deserializer<'de>,
12677    {
12678        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
12679            ".google.cloud.kms.v1.ProtectionLevel",
12680        ))
12681    }
12682}
12683
12684/// Describes the reason for a data access. Please refer to
12685/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
12686/// for the detailed semantic meaning of justification reason codes.
12687///
12688/// # Working with unknown values
12689///
12690/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12691/// additional enum variants at any time. Adding new variants is not considered
12692/// a breaking change. Applications should write their code in anticipation of:
12693///
12694/// - New values appearing in future releases of the client library, **and**
12695/// - New values received dynamically, without application changes.
12696///
12697/// Please consult the [Working with enums] section in the user guide for some
12698/// guidelines.
12699///
12700/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12701#[derive(Clone, Debug, PartialEq)]
12702#[non_exhaustive]
12703pub enum AccessReason {
12704    /// Unspecified access reason.
12705    ReasonUnspecified,
12706    /// Customer-initiated support.
12707    CustomerInitiatedSupport,
12708    /// Google-initiated access for system management and troubleshooting.
12709    GoogleInitiatedService,
12710    /// Google-initiated access in response to a legal request or legal process.
12711    ThirdPartyDataRequest,
12712    /// Google-initiated access for security, fraud, abuse, or compliance purposes.
12713    GoogleInitiatedReview,
12714    /// Customer uses their account to perform any access to their own data which
12715    /// their IAM policy authorizes.
12716    CustomerInitiatedAccess,
12717    /// Google systems access customer data to help optimize the structure of the
12718    /// data or quality for future uses by the customer.
12719    GoogleInitiatedSystemOperation,
12720    /// No reason is expected for this key request.
12721    ReasonNotExpected,
12722    /// Deprecated: This code is no longer generated by Google Cloud. The
12723    /// GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes available in both
12724    /// Key Access Justifications and Access Transparency logs provide
12725    /// customer-visible signals of emergency access in more precise contexts.
12726    ///
12727    /// Customer uses their account to perform any access to their own data which
12728    /// their IAM policy authorizes, and one of the following is true:
12729    ///
12730    /// * A Google administrator has reset the root-access account associated with
12731    ///   the user's organization within the past 7 days.
12732    /// * A Google-initiated emergency access operation has interacted with a
12733    ///   resource in the same project or folder as the currently accessed resource
12734    ///   within the past 7 days.
12735    #[deprecated]
12736    ModifiedCustomerInitiatedAccess,
12737    /// Deprecated: This code is no longer generated by Google Cloud. The
12738    /// GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes available in both
12739    /// Key Access Justifications and Access Transparency logs provide
12740    /// customer-visible signals of emergency access in more precise contexts.
12741    ///
12742    /// Google systems access customer data to help optimize the structure of the
12743    /// data or quality for future uses by the customer, and one of the following
12744    /// is true:
12745    ///
12746    /// * A Google administrator has reset the root-access account associated with
12747    ///   the user's organization within the past 7 days.
12748    /// * A Google-initiated emergency access operation has interacted with a
12749    ///   resource in the same project or folder as the currently accessed resource
12750    ///   within the past 7 days.
12751    #[deprecated]
12752    ModifiedGoogleInitiatedSystemOperation,
12753    /// Google-initiated access to maintain system reliability.
12754    GoogleResponseToProductionAlert,
12755    /// One of the following operations is being executed while simultaneously
12756    /// encountering an internal technical issue which prevented a more precise
12757    /// justification code from being generated:
12758    ///
12759    /// * Your account has been used to perform any access to your own data which
12760    ///   your IAM policy authorizes.
12761    /// * An automated Google system operates on encrypted customer data which your
12762    ///   IAM policy authorizes.
12763    /// * Customer-initiated Google support access.
12764    /// * Google-initiated support access to protect system reliability.
12765    CustomerAuthorizedWorkflowServicing,
12766    /// If set, the enum was initialized with an unknown value.
12767    ///
12768    /// Applications can examine the value using [AccessReason::value] or
12769    /// [AccessReason::name].
12770    UnknownValue(access_reason::UnknownValue),
12771}
12772
12773#[doc(hidden)]
12774pub mod access_reason {
12775    #[allow(unused_imports)]
12776    use super::*;
12777    #[derive(Clone, Debug, PartialEq)]
12778    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12779}
12780
12781impl AccessReason {
12782    /// Gets the enum value.
12783    ///
12784    /// Returns `None` if the enum contains an unknown value deserialized from
12785    /// the string representation of enums.
12786    pub fn value(&self) -> std::option::Option<i32> {
12787        match self {
12788            Self::ReasonUnspecified => std::option::Option::Some(0),
12789            Self::CustomerInitiatedSupport => std::option::Option::Some(1),
12790            Self::GoogleInitiatedService => std::option::Option::Some(2),
12791            Self::ThirdPartyDataRequest => std::option::Option::Some(3),
12792            Self::GoogleInitiatedReview => std::option::Option::Some(4),
12793            Self::CustomerInitiatedAccess => std::option::Option::Some(5),
12794            Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
12795            Self::ReasonNotExpected => std::option::Option::Some(7),
12796            Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
12797            Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
12798            Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
12799            Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
12800            Self::UnknownValue(u) => u.0.value(),
12801        }
12802    }
12803
12804    /// Gets the enum value as a string.
12805    ///
12806    /// Returns `None` if the enum contains an unknown value deserialized from
12807    /// the integer representation of enums.
12808    pub fn name(&self) -> std::option::Option<&str> {
12809        match self {
12810            Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
12811            Self::CustomerInitiatedSupport => {
12812                std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
12813            }
12814            Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
12815            Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
12816            Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
12817            Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
12818            Self::GoogleInitiatedSystemOperation => {
12819                std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
12820            }
12821            Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
12822            Self::ModifiedCustomerInitiatedAccess => {
12823                std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
12824            }
12825            Self::ModifiedGoogleInitiatedSystemOperation => {
12826                std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
12827            }
12828            Self::GoogleResponseToProductionAlert => {
12829                std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
12830            }
12831            Self::CustomerAuthorizedWorkflowServicing => {
12832                std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
12833            }
12834            Self::UnknownValue(u) => u.0.name(),
12835        }
12836    }
12837}
12838
12839impl std::default::Default for AccessReason {
12840    fn default() -> Self {
12841        use std::convert::From;
12842        Self::from(0)
12843    }
12844}
12845
12846impl std::fmt::Display for AccessReason {
12847    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12848        wkt::internal::display_enum(f, self.name(), self.value())
12849    }
12850}
12851
12852impl std::convert::From<i32> for AccessReason {
12853    fn from(value: i32) -> Self {
12854        match value {
12855            0 => Self::ReasonUnspecified,
12856            1 => Self::CustomerInitiatedSupport,
12857            2 => Self::GoogleInitiatedService,
12858            3 => Self::ThirdPartyDataRequest,
12859            4 => Self::GoogleInitiatedReview,
12860            5 => Self::CustomerInitiatedAccess,
12861            6 => Self::GoogleInitiatedSystemOperation,
12862            7 => Self::ReasonNotExpected,
12863            8 => Self::ModifiedCustomerInitiatedAccess,
12864            9 => Self::ModifiedGoogleInitiatedSystemOperation,
12865            10 => Self::GoogleResponseToProductionAlert,
12866            11 => Self::CustomerAuthorizedWorkflowServicing,
12867            _ => Self::UnknownValue(access_reason::UnknownValue(
12868                wkt::internal::UnknownEnumValue::Integer(value),
12869            )),
12870        }
12871    }
12872}
12873
12874impl std::convert::From<&str> for AccessReason {
12875    fn from(value: &str) -> Self {
12876        use std::string::ToString;
12877        match value {
12878            "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
12879            "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
12880            "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
12881            "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
12882            "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
12883            "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
12884            "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
12885            "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
12886            "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
12887            "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
12888                Self::ModifiedGoogleInitiatedSystemOperation
12889            }
12890            "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
12891            "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
12892            _ => Self::UnknownValue(access_reason::UnknownValue(
12893                wkt::internal::UnknownEnumValue::String(value.to_string()),
12894            )),
12895        }
12896    }
12897}
12898
12899impl serde::ser::Serialize for AccessReason {
12900    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12901    where
12902        S: serde::Serializer,
12903    {
12904        match self {
12905            Self::ReasonUnspecified => serializer.serialize_i32(0),
12906            Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
12907            Self::GoogleInitiatedService => serializer.serialize_i32(2),
12908            Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
12909            Self::GoogleInitiatedReview => serializer.serialize_i32(4),
12910            Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
12911            Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
12912            Self::ReasonNotExpected => serializer.serialize_i32(7),
12913            Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
12914            Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
12915            Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
12916            Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
12917            Self::UnknownValue(u) => u.0.serialize(serializer),
12918        }
12919    }
12920}
12921
12922impl<'de> serde::de::Deserialize<'de> for AccessReason {
12923    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12924    where
12925        D: serde::Deserializer<'de>,
12926    {
12927        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
12928            ".google.cloud.kms.v1.AccessReason",
12929        ))
12930    }
12931}