Skip to main content

google_cloud_kms_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Request message for
40/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
41///
42/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct CreateKeyHandleRequest {
46    /// Required. Name of the resource project and location to create the
47    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
48    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
49    ///
50    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
51    pub parent: std::string::String,
52
53    /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
54    /// unique to the resource project and location. If not provided by the caller,
55    /// a new UUID is used.
56    ///
57    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
58    pub key_handle_id: std::string::String,
59
60    /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
61    ///
62    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
63    pub key_handle: std::option::Option<crate::model::KeyHandle>,
64
65    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
66}
67
68impl CreateKeyHandleRequest {
69    pub fn new() -> Self {
70        std::default::Default::default()
71    }
72
73    /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
74    ///
75    /// # Example
76    /// ```ignore,no_run
77    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
78    /// let x = CreateKeyHandleRequest::new().set_parent("example");
79    /// ```
80    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
81        self.parent = v.into();
82        self
83    }
84
85    /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
86    ///
87    /// # Example
88    /// ```ignore,no_run
89    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
90    /// let x = CreateKeyHandleRequest::new().set_key_handle_id("example");
91    /// ```
92    pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
93        self.key_handle_id = v.into();
94        self
95    }
96
97    /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
98    ///
99    /// # Example
100    /// ```ignore,no_run
101    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
102    /// use google_cloud_kms_v1::model::KeyHandle;
103    /// let x = CreateKeyHandleRequest::new().set_key_handle(KeyHandle::default()/* use setters */);
104    /// ```
105    pub fn set_key_handle<T>(mut self, v: T) -> Self
106    where
107        T: std::convert::Into<crate::model::KeyHandle>,
108    {
109        self.key_handle = std::option::Option::Some(v.into());
110        self
111    }
112
113    /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
114    ///
115    /// # Example
116    /// ```ignore,no_run
117    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
118    /// use google_cloud_kms_v1::model::KeyHandle;
119    /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(Some(KeyHandle::default()/* use setters */));
120    /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(None::<KeyHandle>);
121    /// ```
122    pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
123    where
124        T: std::convert::Into<crate::model::KeyHandle>,
125    {
126        self.key_handle = v.map(|x| x.into());
127        self
128    }
129}
130
131impl wkt::message::Message for CreateKeyHandleRequest {
132    fn typename() -> &'static str {
133        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
134    }
135}
136
137/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
138///
139/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
140#[derive(Clone, Default, PartialEq)]
141#[non_exhaustive]
142pub struct GetKeyHandleRequest {
143    /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
144    /// e.g.
145    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
146    ///
147    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
148    pub name: std::string::String,
149
150    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
151}
152
153impl GetKeyHandleRequest {
154    pub fn new() -> Self {
155        std::default::Default::default()
156    }
157
158    /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
159    ///
160    /// # Example
161    /// ```ignore,no_run
162    /// # use google_cloud_kms_v1::model::GetKeyHandleRequest;
163    /// let x = GetKeyHandleRequest::new().set_name("example");
164    /// ```
165    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
166        self.name = v.into();
167        self
168    }
169}
170
171impl wkt::message::Message for GetKeyHandleRequest {
172    fn typename() -> &'static str {
173        "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
174    }
175}
176
177/// Resource-oriented representation of a request to Cloud KMS Autokey and the
178/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
179///
180/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
181#[derive(Clone, Default, PartialEq)]
182#[non_exhaustive]
183pub struct KeyHandle {
184    /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
185    /// resource, e.g.
186    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
187    ///
188    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
189    pub name: std::string::String,
190
191    /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
192    /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
193    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
194    /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
195    /// project will reflect the value configured in the
196    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
197    /// project's ancestor folder at the time of the
198    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
199    /// ancestor folder has a configured
200    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
201    /// configurations is used.
202    ///
203    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
204    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
205    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
206    pub kms_key: std::string::String,
207
208    /// Required. Indicates the resource type that the resulting
209    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
210    /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
211    /// types.
212    ///
213    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
214    pub resource_type_selector: std::string::String,
215
216    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
217}
218
219impl KeyHandle {
220    pub fn new() -> Self {
221        std::default::Default::default()
222    }
223
224    /// Sets the value of [name][crate::model::KeyHandle::name].
225    ///
226    /// # Example
227    /// ```ignore,no_run
228    /// # use google_cloud_kms_v1::model::KeyHandle;
229    /// let x = KeyHandle::new().set_name("example");
230    /// ```
231    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
232        self.name = v.into();
233        self
234    }
235
236    /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
237    ///
238    /// # Example
239    /// ```ignore,no_run
240    /// # use google_cloud_kms_v1::model::KeyHandle;
241    /// let x = KeyHandle::new().set_kms_key("example");
242    /// ```
243    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
244        self.kms_key = v.into();
245        self
246    }
247
248    /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
249    ///
250    /// # Example
251    /// ```ignore,no_run
252    /// # use google_cloud_kms_v1::model::KeyHandle;
253    /// let x = KeyHandle::new().set_resource_type_selector("example");
254    /// ```
255    pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
256        mut self,
257        v: T,
258    ) -> Self {
259        self.resource_type_selector = v.into();
260        self
261    }
262}
263
264impl wkt::message::Message for KeyHandle {
265    fn typename() -> &'static str {
266        "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
267    }
268}
269
270/// Metadata message for
271/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
272/// operation response.
273///
274/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
275#[derive(Clone, Default, PartialEq)]
276#[non_exhaustive]
277pub struct CreateKeyHandleMetadata {
278    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
279}
280
281impl CreateKeyHandleMetadata {
282    pub fn new() -> Self {
283        std::default::Default::default()
284    }
285}
286
287impl wkt::message::Message for CreateKeyHandleMetadata {
288    fn typename() -> &'static str {
289        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
290    }
291}
292
293/// Request message for
294/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
295///
296/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
297#[derive(Clone, Default, PartialEq)]
298#[non_exhaustive]
299pub struct ListKeyHandlesRequest {
300    /// Required. Name of the resource project and location from which to list
301    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
302    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
303    ///
304    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
305    pub parent: std::string::String,
306
307    /// Optional. Optional limit on the number of
308    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
309    /// service may return fewer than this value. Further
310    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
311    /// including the
312    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
313    /// in a subsequent request.  If unspecified, at most 100
314    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
315    ///
316    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
317    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
318    pub page_size: i32,
319
320    /// Optional. Optional pagination token, returned earlier via
321    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
322    ///
323    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
324    pub page_token: std::string::String,
325
326    /// Optional. Filter to apply when listing
327    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
328    /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
329    ///
330    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
331    pub filter: std::string::String,
332
333    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
334}
335
336impl ListKeyHandlesRequest {
337    pub fn new() -> Self {
338        std::default::Default::default()
339    }
340
341    /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
342    ///
343    /// # Example
344    /// ```ignore,no_run
345    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
346    /// let x = ListKeyHandlesRequest::new().set_parent("example");
347    /// ```
348    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
349        self.parent = v.into();
350        self
351    }
352
353    /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
354    ///
355    /// # Example
356    /// ```ignore,no_run
357    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
358    /// let x = ListKeyHandlesRequest::new().set_page_size(42);
359    /// ```
360    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
361        self.page_size = v.into();
362        self
363    }
364
365    /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
366    ///
367    /// # Example
368    /// ```ignore,no_run
369    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
370    /// let x = ListKeyHandlesRequest::new().set_page_token("example");
371    /// ```
372    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
373        self.page_token = v.into();
374        self
375    }
376
377    /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
378    ///
379    /// # Example
380    /// ```ignore,no_run
381    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
382    /// let x = ListKeyHandlesRequest::new().set_filter("example");
383    /// ```
384    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
385        self.filter = v.into();
386        self
387    }
388}
389
390impl wkt::message::Message for ListKeyHandlesRequest {
391    fn typename() -> &'static str {
392        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
393    }
394}
395
396/// Response message for
397/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
398///
399/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
400#[derive(Clone, Default, PartialEq)]
401#[non_exhaustive]
402pub struct ListKeyHandlesResponse {
403    /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
404    ///
405    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
406    pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
407
408    /// A token to retrieve next page of results. Pass this value in
409    /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
410    /// to retrieve the next page of results.
411    ///
412    /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
413    pub next_page_token: std::string::String,
414
415    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
416}
417
418impl ListKeyHandlesResponse {
419    pub fn new() -> Self {
420        std::default::Default::default()
421    }
422
423    /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
424    ///
425    /// # Example
426    /// ```ignore,no_run
427    /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
428    /// use google_cloud_kms_v1::model::KeyHandle;
429    /// let x = ListKeyHandlesResponse::new()
430    ///     .set_key_handles([
431    ///         KeyHandle::default()/* use setters */,
432    ///         KeyHandle::default()/* use (different) setters */,
433    ///     ]);
434    /// ```
435    pub fn set_key_handles<T, V>(mut self, v: T) -> Self
436    where
437        T: std::iter::IntoIterator<Item = V>,
438        V: std::convert::Into<crate::model::KeyHandle>,
439    {
440        use std::iter::Iterator;
441        self.key_handles = v.into_iter().map(|i| i.into()).collect();
442        self
443    }
444
445    /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
446    ///
447    /// # Example
448    /// ```ignore,no_run
449    /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
450    /// let x = ListKeyHandlesResponse::new().set_next_page_token("example");
451    /// ```
452    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
453        self.next_page_token = v.into();
454        self
455    }
456}
457
458impl wkt::message::Message for ListKeyHandlesResponse {
459    fn typename() -> &'static str {
460        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
461    }
462}
463
464#[doc(hidden)]
465impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
466    type PageItem = crate::model::KeyHandle;
467
468    fn items(self) -> std::vec::Vec<Self::PageItem> {
469        self.key_handles
470    }
471
472    fn next_page_token(&self) -> std::string::String {
473        use std::clone::Clone;
474        self.next_page_token.clone()
475    }
476}
477
478/// Request message for
479/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
480///
481/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
482#[derive(Clone, Default, PartialEq)]
483#[non_exhaustive]
484pub struct UpdateAutokeyConfigRequest {
485    /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
486    /// update.
487    ///
488    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
489    pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
490
491    /// Required. Masks which fields of the
492    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
493    /// `keyProject`.
494    ///
495    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
496    pub update_mask: std::option::Option<wkt::FieldMask>,
497
498    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
499}
500
501impl UpdateAutokeyConfigRequest {
502    pub fn new() -> Self {
503        std::default::Default::default()
504    }
505
506    /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
507    ///
508    /// # Example
509    /// ```ignore,no_run
510    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
511    /// use google_cloud_kms_v1::model::AutokeyConfig;
512    /// let x = UpdateAutokeyConfigRequest::new().set_autokey_config(AutokeyConfig::default()/* use setters */);
513    /// ```
514    pub fn set_autokey_config<T>(mut self, v: T) -> Self
515    where
516        T: std::convert::Into<crate::model::AutokeyConfig>,
517    {
518        self.autokey_config = std::option::Option::Some(v.into());
519        self
520    }
521
522    /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
523    ///
524    /// # Example
525    /// ```ignore,no_run
526    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
527    /// use google_cloud_kms_v1::model::AutokeyConfig;
528    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(Some(AutokeyConfig::default()/* use setters */));
529    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(None::<AutokeyConfig>);
530    /// ```
531    pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
532    where
533        T: std::convert::Into<crate::model::AutokeyConfig>,
534    {
535        self.autokey_config = v.map(|x| x.into());
536        self
537    }
538
539    /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
540    ///
541    /// # Example
542    /// ```ignore,no_run
543    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
544    /// use wkt::FieldMask;
545    /// let x = UpdateAutokeyConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
546    /// ```
547    pub fn set_update_mask<T>(mut self, v: T) -> Self
548    where
549        T: std::convert::Into<wkt::FieldMask>,
550    {
551        self.update_mask = std::option::Option::Some(v.into());
552        self
553    }
554
555    /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
556    ///
557    /// # Example
558    /// ```ignore,no_run
559    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
560    /// use wkt::FieldMask;
561    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
562    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
563    /// ```
564    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
565    where
566        T: std::convert::Into<wkt::FieldMask>,
567    {
568        self.update_mask = v.map(|x| x.into());
569        self
570    }
571}
572
573impl wkt::message::Message for UpdateAutokeyConfigRequest {
574    fn typename() -> &'static str {
575        "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
576    }
577}
578
579/// Request message for
580/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
581///
582/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
583#[derive(Clone, Default, PartialEq)]
584#[non_exhaustive]
585pub struct GetAutokeyConfigRequest {
586    /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
587    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
588    /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
589    ///
590    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
591    pub name: std::string::String,
592
593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
594}
595
596impl GetAutokeyConfigRequest {
597    pub fn new() -> Self {
598        std::default::Default::default()
599    }
600
601    /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
602    ///
603    /// # Example
604    /// ```ignore,no_run
605    /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
606    /// let x = GetAutokeyConfigRequest::new().set_name("example");
607    /// ```
608    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
609        self.name = v.into();
610        self
611    }
612}
613
614impl wkt::message::Message for GetAutokeyConfigRequest {
615    fn typename() -> &'static str {
616        "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
617    }
618}
619
620/// Cloud KMS Autokey configuration for a folder.
621#[derive(Clone, Default, PartialEq)]
622#[non_exhaustive]
623pub struct AutokeyConfig {
624    /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
625    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
626    /// `projects/{PROJECT_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    /// Optional. KeyProjectResolutionMode for the AutokeyConfig.
658    /// Valid values are `DEDICATED_KEY_PROJECT`, `RESOURCE_PROJECT`, or
659    /// `DISABLED`.
660    pub key_project_resolution_mode: crate::model::autokey_config::KeyProjectResolutionMode,
661
662    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
663}
664
665impl AutokeyConfig {
666    pub fn new() -> Self {
667        std::default::Default::default()
668    }
669
670    /// Sets the value of [name][crate::model::AutokeyConfig::name].
671    ///
672    /// # Example
673    /// ```ignore,no_run
674    /// # use google_cloud_kms_v1::model::AutokeyConfig;
675    /// let x = AutokeyConfig::new().set_name("example");
676    /// ```
677    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
678        self.name = v.into();
679        self
680    }
681
682    /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
683    ///
684    /// # Example
685    /// ```ignore,no_run
686    /// # use google_cloud_kms_v1::model::AutokeyConfig;
687    /// let x = AutokeyConfig::new().set_key_project("example");
688    /// ```
689    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
690        self.key_project = v.into();
691        self
692    }
693
694    /// Sets the value of [state][crate::model::AutokeyConfig::state].
695    ///
696    /// # Example
697    /// ```ignore,no_run
698    /// # use google_cloud_kms_v1::model::AutokeyConfig;
699    /// use google_cloud_kms_v1::model::autokey_config::State;
700    /// let x0 = AutokeyConfig::new().set_state(State::Active);
701    /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
702    /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
703    /// ```
704    pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
705        mut self,
706        v: T,
707    ) -> Self {
708        self.state = v.into();
709        self
710    }
711
712    /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
713    ///
714    /// # Example
715    /// ```ignore,no_run
716    /// # use google_cloud_kms_v1::model::AutokeyConfig;
717    /// let x = AutokeyConfig::new().set_etag("example");
718    /// ```
719    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
720        self.etag = v.into();
721        self
722    }
723
724    /// Sets the value of [key_project_resolution_mode][crate::model::AutokeyConfig::key_project_resolution_mode].
725    ///
726    /// # Example
727    /// ```ignore,no_run
728    /// # use google_cloud_kms_v1::model::AutokeyConfig;
729    /// use google_cloud_kms_v1::model::autokey_config::KeyProjectResolutionMode;
730    /// let x0 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::DedicatedKeyProject);
731    /// let x1 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::ResourceProject);
732    /// let x2 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::Disabled);
733    /// ```
734    pub fn set_key_project_resolution_mode<
735        T: std::convert::Into<crate::model::autokey_config::KeyProjectResolutionMode>,
736    >(
737        mut self,
738        v: T,
739    ) -> Self {
740        self.key_project_resolution_mode = v.into();
741        self
742    }
743}
744
745impl wkt::message::Message for AutokeyConfig {
746    fn typename() -> &'static str {
747        "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
748    }
749}
750
751/// Defines additional types related to [AutokeyConfig].
752pub mod autokey_config {
753    #[allow(unused_imports)]
754    use super::*;
755
756    /// The states AutokeyConfig can be in.
757    ///
758    /// # Working with unknown values
759    ///
760    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
761    /// additional enum variants at any time. Adding new variants is not considered
762    /// a breaking change. Applications should write their code in anticipation of:
763    ///
764    /// - New values appearing in future releases of the client library, **and**
765    /// - New values received dynamically, without application changes.
766    ///
767    /// Please consult the [Working with enums] section in the user guide for some
768    /// guidelines.
769    ///
770    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
771    #[derive(Clone, Debug, PartialEq)]
772    #[non_exhaustive]
773    pub enum State {
774        /// The state of the AutokeyConfig is unspecified.
775        Unspecified,
776        /// The AutokeyConfig is currently active.
777        Active,
778        /// A previously configured key project has been deleted and the current
779        /// AutokeyConfig is unusable.
780        KeyProjectDeleted,
781        /// The AutokeyConfig is not yet initialized or has been reset to its default
782        /// uninitialized state.
783        Uninitialized,
784        /// The service account lacks the necessary permissions in the key project to
785        /// configure Autokey.
786        KeyProjectPermissionDenied,
787        /// If set, the enum was initialized with an unknown value.
788        ///
789        /// Applications can examine the value using [State::value] or
790        /// [State::name].
791        UnknownValue(state::UnknownValue),
792    }
793
794    #[doc(hidden)]
795    pub mod state {
796        #[allow(unused_imports)]
797        use super::*;
798        #[derive(Clone, Debug, PartialEq)]
799        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
800    }
801
802    impl State {
803        /// Gets the enum value.
804        ///
805        /// Returns `None` if the enum contains an unknown value deserialized from
806        /// the string representation of enums.
807        pub fn value(&self) -> std::option::Option<i32> {
808            match self {
809                Self::Unspecified => std::option::Option::Some(0),
810                Self::Active => std::option::Option::Some(1),
811                Self::KeyProjectDeleted => std::option::Option::Some(2),
812                Self::Uninitialized => std::option::Option::Some(3),
813                Self::KeyProjectPermissionDenied => std::option::Option::Some(4),
814                Self::UnknownValue(u) => u.0.value(),
815            }
816        }
817
818        /// Gets the enum value as a string.
819        ///
820        /// Returns `None` if the enum contains an unknown value deserialized from
821        /// the integer representation of enums.
822        pub fn name(&self) -> std::option::Option<&str> {
823            match self {
824                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
825                Self::Active => std::option::Option::Some("ACTIVE"),
826                Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
827                Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
828                Self::KeyProjectPermissionDenied => {
829                    std::option::Option::Some("KEY_PROJECT_PERMISSION_DENIED")
830                }
831                Self::UnknownValue(u) => u.0.name(),
832            }
833        }
834    }
835
836    impl std::default::Default for State {
837        fn default() -> Self {
838            use std::convert::From;
839            Self::from(0)
840        }
841    }
842
843    impl std::fmt::Display for State {
844        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
845            wkt::internal::display_enum(f, self.name(), self.value())
846        }
847    }
848
849    impl std::convert::From<i32> for State {
850        fn from(value: i32) -> Self {
851            match value {
852                0 => Self::Unspecified,
853                1 => Self::Active,
854                2 => Self::KeyProjectDeleted,
855                3 => Self::Uninitialized,
856                4 => Self::KeyProjectPermissionDenied,
857                _ => Self::UnknownValue(state::UnknownValue(
858                    wkt::internal::UnknownEnumValue::Integer(value),
859                )),
860            }
861        }
862    }
863
864    impl std::convert::From<&str> for State {
865        fn from(value: &str) -> Self {
866            use std::string::ToString;
867            match value {
868                "STATE_UNSPECIFIED" => Self::Unspecified,
869                "ACTIVE" => Self::Active,
870                "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
871                "UNINITIALIZED" => Self::Uninitialized,
872                "KEY_PROJECT_PERMISSION_DENIED" => Self::KeyProjectPermissionDenied,
873                _ => Self::UnknownValue(state::UnknownValue(
874                    wkt::internal::UnknownEnumValue::String(value.to_string()),
875                )),
876            }
877        }
878    }
879
880    impl serde::ser::Serialize for State {
881        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
882        where
883            S: serde::Serializer,
884        {
885            match self {
886                Self::Unspecified => serializer.serialize_i32(0),
887                Self::Active => serializer.serialize_i32(1),
888                Self::KeyProjectDeleted => serializer.serialize_i32(2),
889                Self::Uninitialized => serializer.serialize_i32(3),
890                Self::KeyProjectPermissionDenied => serializer.serialize_i32(4),
891                Self::UnknownValue(u) => u.0.serialize(serializer),
892            }
893        }
894    }
895
896    impl<'de> serde::de::Deserialize<'de> for State {
897        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
898        where
899            D: serde::Deserializer<'de>,
900        {
901            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
902                ".google.cloud.kms.v1.AutokeyConfig.State",
903            ))
904        }
905    }
906
907    /// Defines the resolution mode enum for the key project.
908    /// The
909    /// [KeyProjectResolutionMode][google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]
910    /// determines the mechanism by which
911    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] identifies a
912    /// [key_project][google.cloud.kms.v1.AutokeyConfig.key_project] at its
913    /// specific configuration node. This parameter also determines if Autokey can
914    /// be used within this project or folder.
915    ///
916    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
917    /// [google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]: crate::model::autokey_config::KeyProjectResolutionMode
918    /// [google.cloud.kms.v1.AutokeyConfig.key_project]: crate::model::AutokeyConfig::key_project
919    ///
920    /// # Working with unknown values
921    ///
922    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
923    /// additional enum variants at any time. Adding new variants is not considered
924    /// a breaking change. Applications should write their code in anticipation of:
925    ///
926    /// - New values appearing in future releases of the client library, **and**
927    /// - New values received dynamically, without application changes.
928    ///
929    /// Please consult the [Working with enums] section in the user guide for some
930    /// guidelines.
931    ///
932    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
933    #[derive(Clone, Debug, PartialEq)]
934    #[non_exhaustive]
935    pub enum KeyProjectResolutionMode {
936        /// Default value. KeyProjectResolutionMode when not specified will act as
937        /// `DEDICATED_KEY_PROJECT`.
938        Unspecified,
939        /// Keys are created in a dedicated project specified by `key_project`.
940        DedicatedKeyProject,
941        /// Keys are created in the same project as the resource requesting the key.
942        /// The `key_project` must not be set when this mode is used.
943        ResourceProject,
944        /// Disables the AutokeyConfig. When this mode is set, any AutokeyConfig
945        /// from higher levels in the resource hierarchy are ignored for this
946        /// resource and its descendants. This setting can be overridden
947        /// by a more specific configuration at a lower level. For example,
948        /// if Autokey is disabled on a folder, it can be re-enabled on a sub-folder
949        /// or project within that folder by setting a different mode (e.g.,
950        /// DEDICATED_KEY_PROJECT or RESOURCE_PROJECT).
951        Disabled,
952        /// If set, the enum was initialized with an unknown value.
953        ///
954        /// Applications can examine the value using [KeyProjectResolutionMode::value] or
955        /// [KeyProjectResolutionMode::name].
956        UnknownValue(key_project_resolution_mode::UnknownValue),
957    }
958
959    #[doc(hidden)]
960    pub mod key_project_resolution_mode {
961        #[allow(unused_imports)]
962        use super::*;
963        #[derive(Clone, Debug, PartialEq)]
964        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
965    }
966
967    impl KeyProjectResolutionMode {
968        /// Gets the enum value.
969        ///
970        /// Returns `None` if the enum contains an unknown value deserialized from
971        /// the string representation of enums.
972        pub fn value(&self) -> std::option::Option<i32> {
973            match self {
974                Self::Unspecified => std::option::Option::Some(0),
975                Self::DedicatedKeyProject => std::option::Option::Some(1),
976                Self::ResourceProject => std::option::Option::Some(2),
977                Self::Disabled => std::option::Option::Some(3),
978                Self::UnknownValue(u) => u.0.value(),
979            }
980        }
981
982        /// Gets the enum value as a string.
983        ///
984        /// Returns `None` if the enum contains an unknown value deserialized from
985        /// the integer representation of enums.
986        pub fn name(&self) -> std::option::Option<&str> {
987            match self {
988                Self::Unspecified => {
989                    std::option::Option::Some("KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED")
990                }
991                Self::DedicatedKeyProject => std::option::Option::Some("DEDICATED_KEY_PROJECT"),
992                Self::ResourceProject => std::option::Option::Some("RESOURCE_PROJECT"),
993                Self::Disabled => std::option::Option::Some("DISABLED"),
994                Self::UnknownValue(u) => u.0.name(),
995            }
996        }
997    }
998
999    impl std::default::Default for KeyProjectResolutionMode {
1000        fn default() -> Self {
1001            use std::convert::From;
1002            Self::from(0)
1003        }
1004    }
1005
1006    impl std::fmt::Display for KeyProjectResolutionMode {
1007        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1008            wkt::internal::display_enum(f, self.name(), self.value())
1009        }
1010    }
1011
1012    impl std::convert::From<i32> for KeyProjectResolutionMode {
1013        fn from(value: i32) -> Self {
1014            match value {
1015                0 => Self::Unspecified,
1016                1 => Self::DedicatedKeyProject,
1017                2 => Self::ResourceProject,
1018                3 => Self::Disabled,
1019                _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1020                    wkt::internal::UnknownEnumValue::Integer(value),
1021                )),
1022            }
1023        }
1024    }
1025
1026    impl std::convert::From<&str> for KeyProjectResolutionMode {
1027        fn from(value: &str) -> Self {
1028            use std::string::ToString;
1029            match value {
1030                "KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED" => Self::Unspecified,
1031                "DEDICATED_KEY_PROJECT" => Self::DedicatedKeyProject,
1032                "RESOURCE_PROJECT" => Self::ResourceProject,
1033                "DISABLED" => Self::Disabled,
1034                _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1035                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1036                )),
1037            }
1038        }
1039    }
1040
1041    impl serde::ser::Serialize for KeyProjectResolutionMode {
1042        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1043        where
1044            S: serde::Serializer,
1045        {
1046            match self {
1047                Self::Unspecified => serializer.serialize_i32(0),
1048                Self::DedicatedKeyProject => serializer.serialize_i32(1),
1049                Self::ResourceProject => serializer.serialize_i32(2),
1050                Self::Disabled => serializer.serialize_i32(3),
1051                Self::UnknownValue(u) => u.0.serialize(serializer),
1052            }
1053        }
1054    }
1055
1056    impl<'de> serde::de::Deserialize<'de> for KeyProjectResolutionMode {
1057        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1058        where
1059            D: serde::Deserializer<'de>,
1060        {
1061            deserializer.deserialize_any(
1062                wkt::internal::EnumVisitor::<KeyProjectResolutionMode>::new(
1063                    ".google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode",
1064                ),
1065            )
1066        }
1067    }
1068}
1069
1070/// Request message for
1071/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1072///
1073/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1074#[derive(Clone, Default, PartialEq)]
1075#[non_exhaustive]
1076pub struct ShowEffectiveAutokeyConfigRequest {
1077    /// Required. Name of the resource project to the show effective Cloud KMS
1078    /// Autokey configuration for. This may be helpful for interrogating the effect
1079    /// of nested folder configurations on a given resource project.
1080    pub parent: std::string::String,
1081
1082    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1083}
1084
1085impl ShowEffectiveAutokeyConfigRequest {
1086    pub fn new() -> Self {
1087        std::default::Default::default()
1088    }
1089
1090    /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
1091    ///
1092    /// # Example
1093    /// ```ignore,no_run
1094    /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
1095    /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
1096    /// ```
1097    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1098        self.parent = v.into();
1099        self
1100    }
1101}
1102
1103impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
1104    fn typename() -> &'static str {
1105        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
1106    }
1107}
1108
1109/// Response message for
1110/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1111///
1112/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1113#[derive(Clone, Default, PartialEq)]
1114#[non_exhaustive]
1115pub struct ShowEffectiveAutokeyConfigResponse {
1116    /// Name of the key project configured in the resource project's folder
1117    /// ancestry.
1118    pub key_project: std::string::String,
1119
1120    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1121}
1122
1123impl ShowEffectiveAutokeyConfigResponse {
1124    pub fn new() -> Self {
1125        std::default::Default::default()
1126    }
1127
1128    /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
1129    ///
1130    /// # Example
1131    /// ```ignore,no_run
1132    /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
1133    /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
1134    /// ```
1135    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1136        self.key_project = v.into();
1137        self
1138    }
1139}
1140
1141impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
1142    fn typename() -> &'static str {
1143        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
1144    }
1145}
1146
1147/// Request message for
1148/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1149///
1150/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1151#[derive(Clone, Default, PartialEq)]
1152#[non_exhaustive]
1153pub struct ListEkmConnectionsRequest {
1154    /// Required. The resource name of the location associated with the
1155    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
1156    /// `projects/*/locations/*`.
1157    ///
1158    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1159    pub parent: std::string::String,
1160
1161    /// Optional. Optional limit on the number of
1162    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
1163    /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
1164    /// subsequently be obtained by including the
1165    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
1166    /// in a subsequent request. If unspecified, the server will pick an
1167    /// appropriate default.
1168    ///
1169    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1170    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1171    pub page_size: i32,
1172
1173    /// Optional. Optional pagination token, returned earlier via
1174    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
1175    ///
1176    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1177    pub page_token: std::string::String,
1178
1179    /// Optional. Only include resources that match the filter in the response. For
1180    /// more information, see
1181    /// [Sorting and filtering list
1182    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1183    pub filter: std::string::String,
1184
1185    /// Optional. Specify how the results should be sorted. If not specified, the
1186    /// results will be sorted in the default order.  For more information, see
1187    /// [Sorting and filtering list
1188    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1189    pub order_by: std::string::String,
1190
1191    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1192}
1193
1194impl ListEkmConnectionsRequest {
1195    pub fn new() -> Self {
1196        std::default::Default::default()
1197    }
1198
1199    /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1200    ///
1201    /// # Example
1202    /// ```ignore,no_run
1203    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1204    /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1205    /// ```
1206    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1207        self.parent = v.into();
1208        self
1209    }
1210
1211    /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1212    ///
1213    /// # Example
1214    /// ```ignore,no_run
1215    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1216    /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1217    /// ```
1218    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1219        self.page_size = v.into();
1220        self
1221    }
1222
1223    /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1224    ///
1225    /// # Example
1226    /// ```ignore,no_run
1227    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1228    /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1229    /// ```
1230    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1231        self.page_token = v.into();
1232        self
1233    }
1234
1235    /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1236    ///
1237    /// # Example
1238    /// ```ignore,no_run
1239    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1240    /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1241    /// ```
1242    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1243        self.filter = v.into();
1244        self
1245    }
1246
1247    /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1248    ///
1249    /// # Example
1250    /// ```ignore,no_run
1251    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1252    /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1253    /// ```
1254    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255        self.order_by = v.into();
1256        self
1257    }
1258}
1259
1260impl wkt::message::Message for ListEkmConnectionsRequest {
1261    fn typename() -> &'static str {
1262        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1263    }
1264}
1265
1266/// Response message for
1267/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1268///
1269/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1270#[derive(Clone, Default, PartialEq)]
1271#[non_exhaustive]
1272pub struct ListEkmConnectionsResponse {
1273    /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1274    ///
1275    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1276    pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1277
1278    /// A token to retrieve next page of results. Pass this value in
1279    /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1280    /// to retrieve the next page of results.
1281    ///
1282    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1283    pub next_page_token: std::string::String,
1284
1285    /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1286    /// that matched the query.
1287    ///
1288    /// This field is not populated if
1289    /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1290    /// is applied.
1291    ///
1292    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1293    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1294    pub total_size: i32,
1295
1296    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1297}
1298
1299impl ListEkmConnectionsResponse {
1300    pub fn new() -> Self {
1301        std::default::Default::default()
1302    }
1303
1304    /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1305    ///
1306    /// # Example
1307    /// ```ignore,no_run
1308    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1309    /// use google_cloud_kms_v1::model::EkmConnection;
1310    /// let x = ListEkmConnectionsResponse::new()
1311    ///     .set_ekm_connections([
1312    ///         EkmConnection::default()/* use setters */,
1313    ///         EkmConnection::default()/* use (different) setters */,
1314    ///     ]);
1315    /// ```
1316    pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1317    where
1318        T: std::iter::IntoIterator<Item = V>,
1319        V: std::convert::Into<crate::model::EkmConnection>,
1320    {
1321        use std::iter::Iterator;
1322        self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1323        self
1324    }
1325
1326    /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1327    ///
1328    /// # Example
1329    /// ```ignore,no_run
1330    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1331    /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1332    /// ```
1333    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1334        self.next_page_token = v.into();
1335        self
1336    }
1337
1338    /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1339    ///
1340    /// # Example
1341    /// ```ignore,no_run
1342    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1343    /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1344    /// ```
1345    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1346        self.total_size = v.into();
1347        self
1348    }
1349}
1350
1351impl wkt::message::Message for ListEkmConnectionsResponse {
1352    fn typename() -> &'static str {
1353        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1354    }
1355}
1356
1357#[doc(hidden)]
1358impl google_cloud_gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1359    type PageItem = crate::model::EkmConnection;
1360
1361    fn items(self) -> std::vec::Vec<Self::PageItem> {
1362        self.ekm_connections
1363    }
1364
1365    fn next_page_token(&self) -> std::string::String {
1366        use std::clone::Clone;
1367        self.next_page_token.clone()
1368    }
1369}
1370
1371/// Request message for
1372/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1373///
1374/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1375#[derive(Clone, Default, PartialEq)]
1376#[non_exhaustive]
1377pub struct GetEkmConnectionRequest {
1378    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1379    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1380    ///
1381    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1382    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1383    pub name: std::string::String,
1384
1385    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1386}
1387
1388impl GetEkmConnectionRequest {
1389    pub fn new() -> Self {
1390        std::default::Default::default()
1391    }
1392
1393    /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1394    ///
1395    /// # Example
1396    /// ```ignore,no_run
1397    /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1398    /// let x = GetEkmConnectionRequest::new().set_name("example");
1399    /// ```
1400    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1401        self.name = v.into();
1402        self
1403    }
1404}
1405
1406impl wkt::message::Message for GetEkmConnectionRequest {
1407    fn typename() -> &'static str {
1408        "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1409    }
1410}
1411
1412/// Request message for
1413/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1414///
1415/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1416#[derive(Clone, Default, PartialEq)]
1417#[non_exhaustive]
1418pub struct CreateEkmConnectionRequest {
1419    /// Required. The resource name of the location associated with the
1420    /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1421    /// `projects/*/locations/*`.
1422    ///
1423    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1424    pub parent: std::string::String,
1425
1426    /// Required. It must be unique within a location and match the regular
1427    /// expression `[a-zA-Z0-9_-]{1,63}`.
1428    pub ekm_connection_id: std::string::String,
1429
1430    /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1431    /// initial field values.
1432    ///
1433    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1434    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1435
1436    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1437}
1438
1439impl CreateEkmConnectionRequest {
1440    pub fn new() -> Self {
1441        std::default::Default::default()
1442    }
1443
1444    /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1445    ///
1446    /// # Example
1447    /// ```ignore,no_run
1448    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1449    /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1450    /// ```
1451    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1452        self.parent = v.into();
1453        self
1454    }
1455
1456    /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1457    ///
1458    /// # Example
1459    /// ```ignore,no_run
1460    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1461    /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1462    /// ```
1463    pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1464        mut self,
1465        v: T,
1466    ) -> Self {
1467        self.ekm_connection_id = v.into();
1468        self
1469    }
1470
1471    /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1472    ///
1473    /// # Example
1474    /// ```ignore,no_run
1475    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1476    /// use google_cloud_kms_v1::model::EkmConnection;
1477    /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1478    /// ```
1479    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1480    where
1481        T: std::convert::Into<crate::model::EkmConnection>,
1482    {
1483        self.ekm_connection = std::option::Option::Some(v.into());
1484        self
1485    }
1486
1487    /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1488    ///
1489    /// # Example
1490    /// ```ignore,no_run
1491    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1492    /// use google_cloud_kms_v1::model::EkmConnection;
1493    /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1494    /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1495    /// ```
1496    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1497    where
1498        T: std::convert::Into<crate::model::EkmConnection>,
1499    {
1500        self.ekm_connection = v.map(|x| x.into());
1501        self
1502    }
1503}
1504
1505impl wkt::message::Message for CreateEkmConnectionRequest {
1506    fn typename() -> &'static str {
1507        "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1508    }
1509}
1510
1511/// Request message for
1512/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1513///
1514/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1515#[derive(Clone, Default, PartialEq)]
1516#[non_exhaustive]
1517pub struct UpdateEkmConnectionRequest {
1518    /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1519    /// values.
1520    ///
1521    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1522    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1523
1524    /// Required. List of fields to be updated in this request.
1525    pub update_mask: std::option::Option<wkt::FieldMask>,
1526
1527    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1528}
1529
1530impl UpdateEkmConnectionRequest {
1531    pub fn new() -> Self {
1532        std::default::Default::default()
1533    }
1534
1535    /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1536    ///
1537    /// # Example
1538    /// ```ignore,no_run
1539    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1540    /// use google_cloud_kms_v1::model::EkmConnection;
1541    /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1542    /// ```
1543    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1544    where
1545        T: std::convert::Into<crate::model::EkmConnection>,
1546    {
1547        self.ekm_connection = std::option::Option::Some(v.into());
1548        self
1549    }
1550
1551    /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1552    ///
1553    /// # Example
1554    /// ```ignore,no_run
1555    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1556    /// use google_cloud_kms_v1::model::EkmConnection;
1557    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1558    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1559    /// ```
1560    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1561    where
1562        T: std::convert::Into<crate::model::EkmConnection>,
1563    {
1564        self.ekm_connection = v.map(|x| x.into());
1565        self
1566    }
1567
1568    /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1569    ///
1570    /// # Example
1571    /// ```ignore,no_run
1572    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1573    /// use wkt::FieldMask;
1574    /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1575    /// ```
1576    pub fn set_update_mask<T>(mut self, v: T) -> Self
1577    where
1578        T: std::convert::Into<wkt::FieldMask>,
1579    {
1580        self.update_mask = std::option::Option::Some(v.into());
1581        self
1582    }
1583
1584    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1585    ///
1586    /// # Example
1587    /// ```ignore,no_run
1588    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1589    /// use wkt::FieldMask;
1590    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1591    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1592    /// ```
1593    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1594    where
1595        T: std::convert::Into<wkt::FieldMask>,
1596    {
1597        self.update_mask = v.map(|x| x.into());
1598        self
1599    }
1600}
1601
1602impl wkt::message::Message for UpdateEkmConnectionRequest {
1603    fn typename() -> &'static str {
1604        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1605    }
1606}
1607
1608/// Request message for
1609/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1610///
1611/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1612#[derive(Clone, Default, PartialEq)]
1613#[non_exhaustive]
1614pub struct GetEkmConfigRequest {
1615    /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1616    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1617    ///
1618    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1619    /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1620    pub name: std::string::String,
1621
1622    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1623}
1624
1625impl GetEkmConfigRequest {
1626    pub fn new() -> Self {
1627        std::default::Default::default()
1628    }
1629
1630    /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1631    ///
1632    /// # Example
1633    /// ```ignore,no_run
1634    /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1635    /// let x = GetEkmConfigRequest::new().set_name("example");
1636    /// ```
1637    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1638        self.name = v.into();
1639        self
1640    }
1641}
1642
1643impl wkt::message::Message for GetEkmConfigRequest {
1644    fn typename() -> &'static str {
1645        "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1646    }
1647}
1648
1649/// Request message for
1650/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1651///
1652/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1653#[derive(Clone, Default, PartialEq)]
1654#[non_exhaustive]
1655pub struct UpdateEkmConfigRequest {
1656    /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1657    ///
1658    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1659    pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1660
1661    /// Required. List of fields to be updated in this request.
1662    pub update_mask: std::option::Option<wkt::FieldMask>,
1663
1664    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1665}
1666
1667impl UpdateEkmConfigRequest {
1668    pub fn new() -> Self {
1669        std::default::Default::default()
1670    }
1671
1672    /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1673    ///
1674    /// # Example
1675    /// ```ignore,no_run
1676    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1677    /// use google_cloud_kms_v1::model::EkmConfig;
1678    /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1679    /// ```
1680    pub fn set_ekm_config<T>(mut self, v: T) -> Self
1681    where
1682        T: std::convert::Into<crate::model::EkmConfig>,
1683    {
1684        self.ekm_config = std::option::Option::Some(v.into());
1685        self
1686    }
1687
1688    /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1689    ///
1690    /// # Example
1691    /// ```ignore,no_run
1692    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1693    /// use google_cloud_kms_v1::model::EkmConfig;
1694    /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1695    /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1696    /// ```
1697    pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1698    where
1699        T: std::convert::Into<crate::model::EkmConfig>,
1700    {
1701        self.ekm_config = v.map(|x| x.into());
1702        self
1703    }
1704
1705    /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1706    ///
1707    /// # Example
1708    /// ```ignore,no_run
1709    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1710    /// use wkt::FieldMask;
1711    /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1712    /// ```
1713    pub fn set_update_mask<T>(mut self, v: T) -> Self
1714    where
1715        T: std::convert::Into<wkt::FieldMask>,
1716    {
1717        self.update_mask = std::option::Option::Some(v.into());
1718        self
1719    }
1720
1721    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1722    ///
1723    /// # Example
1724    /// ```ignore,no_run
1725    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1726    /// use wkt::FieldMask;
1727    /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1728    /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1729    /// ```
1730    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1731    where
1732        T: std::convert::Into<wkt::FieldMask>,
1733    {
1734        self.update_mask = v.map(|x| x.into());
1735        self
1736    }
1737}
1738
1739impl wkt::message::Message for UpdateEkmConfigRequest {
1740    fn typename() -> &'static str {
1741        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1742    }
1743}
1744
1745/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1746/// certificate used to authenticate HTTPS connections to EKM replicas.
1747///
1748/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1749#[derive(Clone, Default, PartialEq)]
1750#[non_exhaustive]
1751pub struct Certificate {
1752    /// Required. The raw certificate bytes in DER format.
1753    pub raw_der: ::bytes::Bytes,
1754
1755    /// Output only. True if the certificate was parsed successfully.
1756    pub parsed: bool,
1757
1758    /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1759    /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1760    ///
1761    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1762    pub issuer: std::string::String,
1763
1764    /// Output only. The subject distinguished name in RFC 2253 format. Only
1765    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1766    ///
1767    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1768    pub subject: std::string::String,
1769
1770    /// Output only. The subject Alternative DNS names. Only present if
1771    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1772    ///
1773    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1774    pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1775
1776    /// Output only. The certificate is not valid before this time. Only present if
1777    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1778    ///
1779    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1780    pub not_before_time: std::option::Option<wkt::Timestamp>,
1781
1782    /// Output only. The certificate is not valid after this time. Only present if
1783    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1784    ///
1785    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1786    pub not_after_time: std::option::Option<wkt::Timestamp>,
1787
1788    /// Output only. The certificate serial number as a hex string. Only present if
1789    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1790    ///
1791    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1792    pub serial_number: std::string::String,
1793
1794    /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1795    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1796    ///
1797    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1798    pub sha256_fingerprint: std::string::String,
1799
1800    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1801}
1802
1803impl Certificate {
1804    pub fn new() -> Self {
1805        std::default::Default::default()
1806    }
1807
1808    /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1809    ///
1810    /// # Example
1811    /// ```ignore,no_run
1812    /// # use google_cloud_kms_v1::model::Certificate;
1813    /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1814    /// ```
1815    pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1816        self.raw_der = v.into();
1817        self
1818    }
1819
1820    /// Sets the value of [parsed][crate::model::Certificate::parsed].
1821    ///
1822    /// # Example
1823    /// ```ignore,no_run
1824    /// # use google_cloud_kms_v1::model::Certificate;
1825    /// let x = Certificate::new().set_parsed(true);
1826    /// ```
1827    pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1828        self.parsed = v.into();
1829        self
1830    }
1831
1832    /// Sets the value of [issuer][crate::model::Certificate::issuer].
1833    ///
1834    /// # Example
1835    /// ```ignore,no_run
1836    /// # use google_cloud_kms_v1::model::Certificate;
1837    /// let x = Certificate::new().set_issuer("example");
1838    /// ```
1839    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1840        self.issuer = v.into();
1841        self
1842    }
1843
1844    /// Sets the value of [subject][crate::model::Certificate::subject].
1845    ///
1846    /// # Example
1847    /// ```ignore,no_run
1848    /// # use google_cloud_kms_v1::model::Certificate;
1849    /// let x = Certificate::new().set_subject("example");
1850    /// ```
1851    pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1852        self.subject = v.into();
1853        self
1854    }
1855
1856    /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1857    ///
1858    /// # Example
1859    /// ```ignore,no_run
1860    /// # use google_cloud_kms_v1::model::Certificate;
1861    /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1862    /// ```
1863    pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1864    where
1865        T: std::iter::IntoIterator<Item = V>,
1866        V: std::convert::Into<std::string::String>,
1867    {
1868        use std::iter::Iterator;
1869        self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1870        self
1871    }
1872
1873    /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1874    ///
1875    /// # Example
1876    /// ```ignore,no_run
1877    /// # use google_cloud_kms_v1::model::Certificate;
1878    /// use wkt::Timestamp;
1879    /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1880    /// ```
1881    pub fn set_not_before_time<T>(mut self, v: T) -> Self
1882    where
1883        T: std::convert::Into<wkt::Timestamp>,
1884    {
1885        self.not_before_time = std::option::Option::Some(v.into());
1886        self
1887    }
1888
1889    /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1890    ///
1891    /// # Example
1892    /// ```ignore,no_run
1893    /// # use google_cloud_kms_v1::model::Certificate;
1894    /// use wkt::Timestamp;
1895    /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1896    /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1897    /// ```
1898    pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1899    where
1900        T: std::convert::Into<wkt::Timestamp>,
1901    {
1902        self.not_before_time = v.map(|x| x.into());
1903        self
1904    }
1905
1906    /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1907    ///
1908    /// # Example
1909    /// ```ignore,no_run
1910    /// # use google_cloud_kms_v1::model::Certificate;
1911    /// use wkt::Timestamp;
1912    /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1913    /// ```
1914    pub fn set_not_after_time<T>(mut self, v: T) -> Self
1915    where
1916        T: std::convert::Into<wkt::Timestamp>,
1917    {
1918        self.not_after_time = std::option::Option::Some(v.into());
1919        self
1920    }
1921
1922    /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1923    ///
1924    /// # Example
1925    /// ```ignore,no_run
1926    /// # use google_cloud_kms_v1::model::Certificate;
1927    /// use wkt::Timestamp;
1928    /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1929    /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1930    /// ```
1931    pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1932    where
1933        T: std::convert::Into<wkt::Timestamp>,
1934    {
1935        self.not_after_time = v.map(|x| x.into());
1936        self
1937    }
1938
1939    /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1940    ///
1941    /// # Example
1942    /// ```ignore,no_run
1943    /// # use google_cloud_kms_v1::model::Certificate;
1944    /// let x = Certificate::new().set_serial_number("example");
1945    /// ```
1946    pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1947        self.serial_number = v.into();
1948        self
1949    }
1950
1951    /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1952    ///
1953    /// # Example
1954    /// ```ignore,no_run
1955    /// # use google_cloud_kms_v1::model::Certificate;
1956    /// let x = Certificate::new().set_sha256_fingerprint("example");
1957    /// ```
1958    pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1959        mut self,
1960        v: T,
1961    ) -> Self {
1962        self.sha256_fingerprint = v.into();
1963        self
1964    }
1965}
1966
1967impl wkt::message::Message for Certificate {
1968    fn typename() -> &'static str {
1969        "type.googleapis.com/google.cloud.kms.v1.Certificate"
1970    }
1971}
1972
1973/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
1974/// individual EKM connection. It can be used for creating
1975/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
1976/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
1977/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
1978/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
1979/// performing cryptographic operations using keys created within the
1980/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1981///
1982/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1983/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1984/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1985/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
1986/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
1987#[derive(Clone, Default, PartialEq)]
1988#[non_exhaustive]
1989pub struct EkmConnection {
1990    /// Output only. The resource name for the
1991    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
1992    /// `projects/*/locations/*/ekmConnections/*`.
1993    ///
1994    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1995    pub name: std::string::String,
1996
1997    /// Output only. The time at which the
1998    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
1999    ///
2000    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2001    pub create_time: std::option::Option<wkt::Timestamp>,
2002
2003    /// Optional. A list of
2004    /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
2005    /// the EKM can be reached. There should be one ServiceResolver per EKM
2006    /// replica. Currently, only a single
2007    /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
2008    /// supported.
2009    ///
2010    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2011    pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
2012
2013    /// Optional. Etag of the currently stored
2014    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2015    ///
2016    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2017    pub etag: std::string::String,
2018
2019    /// Optional. Describes who can perform control plane operations on the EKM. If
2020    /// unset, this defaults to
2021    /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
2022    ///
2023    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
2024    pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
2025
2026    /// Optional. Identifies the EKM Crypto Space that this
2027    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
2028    /// field is required if
2029    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
2030    /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
2031    ///
2032    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2033    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2034    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
2035    pub crypto_space_path: std::string::String,
2036
2037    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2038}
2039
2040impl EkmConnection {
2041    pub fn new() -> Self {
2042        std::default::Default::default()
2043    }
2044
2045    /// Sets the value of [name][crate::model::EkmConnection::name].
2046    ///
2047    /// # Example
2048    /// ```ignore,no_run
2049    /// # use google_cloud_kms_v1::model::EkmConnection;
2050    /// let x = EkmConnection::new().set_name("example");
2051    /// ```
2052    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2053        self.name = v.into();
2054        self
2055    }
2056
2057    /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
2058    ///
2059    /// # Example
2060    /// ```ignore,no_run
2061    /// # use google_cloud_kms_v1::model::EkmConnection;
2062    /// use wkt::Timestamp;
2063    /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
2064    /// ```
2065    pub fn set_create_time<T>(mut self, v: T) -> Self
2066    where
2067        T: std::convert::Into<wkt::Timestamp>,
2068    {
2069        self.create_time = std::option::Option::Some(v.into());
2070        self
2071    }
2072
2073    /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
2074    ///
2075    /// # Example
2076    /// ```ignore,no_run
2077    /// # use google_cloud_kms_v1::model::EkmConnection;
2078    /// use wkt::Timestamp;
2079    /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2080    /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
2081    /// ```
2082    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2083    where
2084        T: std::convert::Into<wkt::Timestamp>,
2085    {
2086        self.create_time = v.map(|x| x.into());
2087        self
2088    }
2089
2090    /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
2091    ///
2092    /// # Example
2093    /// ```ignore,no_run
2094    /// # use google_cloud_kms_v1::model::EkmConnection;
2095    /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2096    /// let x = EkmConnection::new()
2097    ///     .set_service_resolvers([
2098    ///         ServiceResolver::default()/* use setters */,
2099    ///         ServiceResolver::default()/* use (different) setters */,
2100    ///     ]);
2101    /// ```
2102    pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
2103    where
2104        T: std::iter::IntoIterator<Item = V>,
2105        V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
2106    {
2107        use std::iter::Iterator;
2108        self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
2109        self
2110    }
2111
2112    /// Sets the value of [etag][crate::model::EkmConnection::etag].
2113    ///
2114    /// # Example
2115    /// ```ignore,no_run
2116    /// # use google_cloud_kms_v1::model::EkmConnection;
2117    /// let x = EkmConnection::new().set_etag("example");
2118    /// ```
2119    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2120        self.etag = v.into();
2121        self
2122    }
2123
2124    /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
2125    ///
2126    /// # Example
2127    /// ```ignore,no_run
2128    /// # use google_cloud_kms_v1::model::EkmConnection;
2129    /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
2130    /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
2131    /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
2132    /// ```
2133    pub fn set_key_management_mode<
2134        T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
2135    >(
2136        mut self,
2137        v: T,
2138    ) -> Self {
2139        self.key_management_mode = v.into();
2140        self
2141    }
2142
2143    /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
2144    ///
2145    /// # Example
2146    /// ```ignore,no_run
2147    /// # use google_cloud_kms_v1::model::EkmConnection;
2148    /// let x = EkmConnection::new().set_crypto_space_path("example");
2149    /// ```
2150    pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
2151        mut self,
2152        v: T,
2153    ) -> Self {
2154        self.crypto_space_path = v.into();
2155        self
2156    }
2157}
2158
2159impl wkt::message::Message for EkmConnection {
2160    fn typename() -> &'static str {
2161        "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
2162    }
2163}
2164
2165/// Defines additional types related to [EkmConnection].
2166pub mod ekm_connection {
2167    #[allow(unused_imports)]
2168    use super::*;
2169
2170    /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
2171    /// represents an EKM replica that can be reached within an
2172    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2173    ///
2174    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2175    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2176    #[derive(Clone, Default, PartialEq)]
2177    #[non_exhaustive]
2178    pub struct ServiceResolver {
2179        /// Required. The resource name of the Service Directory service pointing to
2180        /// an EKM replica, in the format
2181        /// `projects/*/locations/*/namespaces/*/services/*`.
2182        pub service_directory_service: std::string::String,
2183
2184        /// Optional. The filter applied to the endpoints of the resolved service. If
2185        /// no filter is specified, all endpoints will be considered. An endpoint
2186        /// will be chosen arbitrarily from the filtered list for each request.
2187        ///
2188        /// For endpoint filter syntax and examples, see
2189        /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
2190        pub endpoint_filter: std::string::String,
2191
2192        /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
2193        pub hostname: std::string::String,
2194
2195        /// Required. A list of leaf server certificates used to authenticate HTTPS
2196        /// connections to the EKM replica. Currently, a maximum of 10
2197        /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2198        ///
2199        /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2200        pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2201
2202        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2203    }
2204
2205    impl ServiceResolver {
2206        pub fn new() -> Self {
2207            std::default::Default::default()
2208        }
2209
2210        /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2211        ///
2212        /// # Example
2213        /// ```ignore,no_run
2214        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2215        /// let x = ServiceResolver::new().set_service_directory_service("example");
2216        /// ```
2217        pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2218            mut self,
2219            v: T,
2220        ) -> Self {
2221            self.service_directory_service = v.into();
2222            self
2223        }
2224
2225        /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2226        ///
2227        /// # Example
2228        /// ```ignore,no_run
2229        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2230        /// let x = ServiceResolver::new().set_endpoint_filter("example");
2231        /// ```
2232        pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2233            mut self,
2234            v: T,
2235        ) -> Self {
2236            self.endpoint_filter = v.into();
2237            self
2238        }
2239
2240        /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2241        ///
2242        /// # Example
2243        /// ```ignore,no_run
2244        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2245        /// let x = ServiceResolver::new().set_hostname("example");
2246        /// ```
2247        pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2248            self.hostname = v.into();
2249            self
2250        }
2251
2252        /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2253        ///
2254        /// # Example
2255        /// ```ignore,no_run
2256        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2257        /// use google_cloud_kms_v1::model::Certificate;
2258        /// let x = ServiceResolver::new()
2259        ///     .set_server_certificates([
2260        ///         Certificate::default()/* use setters */,
2261        ///         Certificate::default()/* use (different) setters */,
2262        ///     ]);
2263        /// ```
2264        pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2265        where
2266            T: std::iter::IntoIterator<Item = V>,
2267            V: std::convert::Into<crate::model::Certificate>,
2268        {
2269            use std::iter::Iterator;
2270            self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2271            self
2272        }
2273    }
2274
2275    impl wkt::message::Message for ServiceResolver {
2276        fn typename() -> &'static str {
2277            "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2278        }
2279    }
2280
2281    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2282    /// describes who can perform control plane cryptographic operations using this
2283    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2284    ///
2285    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2286    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2287    ///
2288    /// # Working with unknown values
2289    ///
2290    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2291    /// additional enum variants at any time. Adding new variants is not considered
2292    /// a breaking change. Applications should write their code in anticipation of:
2293    ///
2294    /// - New values appearing in future releases of the client library, **and**
2295    /// - New values received dynamically, without application changes.
2296    ///
2297    /// Please consult the [Working with enums] section in the user guide for some
2298    /// guidelines.
2299    ///
2300    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2301    #[derive(Clone, Debug, PartialEq)]
2302    #[non_exhaustive]
2303    pub enum KeyManagementMode {
2304        /// Not specified.
2305        Unspecified,
2306        /// EKM-side key management operations on
2307        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2308        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2309        /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2310        ///
2311        /// * When creating a
2312        ///   [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2313        ///   this
2314        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2315        ///   supply the key path of pre-existing external key material that will be
2316        ///   linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2317        /// * Destruction of external key material cannot be requested via the
2318        ///   Cloud KMS API and must be performed directly in the EKM.
2319        /// * Automatic rotation of key material is not supported.
2320        ///
2321        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2322        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2323        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2324        Manual,
2325        /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2326        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2327        /// management operations initiated from Cloud KMS. This means that:
2328        ///
2329        /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2330        ///   associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2331        ///   is
2332        ///   created, the EKM automatically generates new key material and a new
2333        ///   key path. The caller cannot supply the key path of pre-existing
2334        ///   external key material.
2335        /// * Destruction of external key material associated with this
2336        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2337        ///   calling
2338        ///   [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2339        /// * Automatic rotation of key material is supported.
2340        ///
2341        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2342        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2343        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2344        /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2345        CloudKms,
2346        /// If set, the enum was initialized with an unknown value.
2347        ///
2348        /// Applications can examine the value using [KeyManagementMode::value] or
2349        /// [KeyManagementMode::name].
2350        UnknownValue(key_management_mode::UnknownValue),
2351    }
2352
2353    #[doc(hidden)]
2354    pub mod key_management_mode {
2355        #[allow(unused_imports)]
2356        use super::*;
2357        #[derive(Clone, Debug, PartialEq)]
2358        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2359    }
2360
2361    impl KeyManagementMode {
2362        /// Gets the enum value.
2363        ///
2364        /// Returns `None` if the enum contains an unknown value deserialized from
2365        /// the string representation of enums.
2366        pub fn value(&self) -> std::option::Option<i32> {
2367            match self {
2368                Self::Unspecified => std::option::Option::Some(0),
2369                Self::Manual => std::option::Option::Some(1),
2370                Self::CloudKms => std::option::Option::Some(2),
2371                Self::UnknownValue(u) => u.0.value(),
2372            }
2373        }
2374
2375        /// Gets the enum value as a string.
2376        ///
2377        /// Returns `None` if the enum contains an unknown value deserialized from
2378        /// the integer representation of enums.
2379        pub fn name(&self) -> std::option::Option<&str> {
2380            match self {
2381                Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2382                Self::Manual => std::option::Option::Some("MANUAL"),
2383                Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2384                Self::UnknownValue(u) => u.0.name(),
2385            }
2386        }
2387    }
2388
2389    impl std::default::Default for KeyManagementMode {
2390        fn default() -> Self {
2391            use std::convert::From;
2392            Self::from(0)
2393        }
2394    }
2395
2396    impl std::fmt::Display for KeyManagementMode {
2397        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2398            wkt::internal::display_enum(f, self.name(), self.value())
2399        }
2400    }
2401
2402    impl std::convert::From<i32> for KeyManagementMode {
2403        fn from(value: i32) -> Self {
2404            match value {
2405                0 => Self::Unspecified,
2406                1 => Self::Manual,
2407                2 => Self::CloudKms,
2408                _ => Self::UnknownValue(key_management_mode::UnknownValue(
2409                    wkt::internal::UnknownEnumValue::Integer(value),
2410                )),
2411            }
2412        }
2413    }
2414
2415    impl std::convert::From<&str> for KeyManagementMode {
2416        fn from(value: &str) -> Self {
2417            use std::string::ToString;
2418            match value {
2419                "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2420                "MANUAL" => Self::Manual,
2421                "CLOUD_KMS" => Self::CloudKms,
2422                _ => Self::UnknownValue(key_management_mode::UnknownValue(
2423                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2424                )),
2425            }
2426        }
2427    }
2428
2429    impl serde::ser::Serialize for KeyManagementMode {
2430        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2431        where
2432            S: serde::Serializer,
2433        {
2434            match self {
2435                Self::Unspecified => serializer.serialize_i32(0),
2436                Self::Manual => serializer.serialize_i32(1),
2437                Self::CloudKms => serializer.serialize_i32(2),
2438                Self::UnknownValue(u) => u.0.serialize(serializer),
2439            }
2440        }
2441    }
2442
2443    impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2444        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2445        where
2446            D: serde::Deserializer<'de>,
2447        {
2448            deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2449                ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2450            ))
2451        }
2452    }
2453}
2454
2455/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2456/// represents configuration parameters that apply to all
2457/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2458/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2459/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2460/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2461/// project and location.
2462///
2463/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2464/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2465/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2466/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2467/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2468#[derive(Clone, Default, PartialEq)]
2469#[non_exhaustive]
2470pub struct EkmConfig {
2471    /// Output only. The resource name for the
2472    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2473    /// `projects/*/locations/*/ekmConfig`.
2474    ///
2475    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2476    pub name: std::string::String,
2477
2478    /// Optional. Resource name of the default
2479    /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2480    /// the empty string removes the default.
2481    ///
2482    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2483    pub default_ekm_connection: std::string::String,
2484
2485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2486}
2487
2488impl EkmConfig {
2489    pub fn new() -> Self {
2490        std::default::Default::default()
2491    }
2492
2493    /// Sets the value of [name][crate::model::EkmConfig::name].
2494    ///
2495    /// # Example
2496    /// ```ignore,no_run
2497    /// # use google_cloud_kms_v1::model::EkmConfig;
2498    /// let x = EkmConfig::new().set_name("example");
2499    /// ```
2500    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2501        self.name = v.into();
2502        self
2503    }
2504
2505    /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2506    ///
2507    /// # Example
2508    /// ```ignore,no_run
2509    /// # use google_cloud_kms_v1::model::EkmConfig;
2510    /// let x = EkmConfig::new().set_default_ekm_connection("example");
2511    /// ```
2512    pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2513        mut self,
2514        v: T,
2515    ) -> Self {
2516        self.default_ekm_connection = v.into();
2517        self
2518    }
2519}
2520
2521impl wkt::message::Message for EkmConfig {
2522    fn typename() -> &'static str {
2523        "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2524    }
2525}
2526
2527/// Request message for
2528/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2529///
2530/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2531#[derive(Clone, Default, PartialEq)]
2532#[non_exhaustive]
2533pub struct VerifyConnectivityRequest {
2534    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2535    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2536    ///
2537    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2538    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2539    pub name: std::string::String,
2540
2541    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2542}
2543
2544impl VerifyConnectivityRequest {
2545    pub fn new() -> Self {
2546        std::default::Default::default()
2547    }
2548
2549    /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2550    ///
2551    /// # Example
2552    /// ```ignore,no_run
2553    /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2554    /// let x = VerifyConnectivityRequest::new().set_name("example");
2555    /// ```
2556    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2557        self.name = v.into();
2558        self
2559    }
2560}
2561
2562impl wkt::message::Message for VerifyConnectivityRequest {
2563    fn typename() -> &'static str {
2564        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2565    }
2566}
2567
2568/// Response message for
2569/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2570///
2571/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2572#[derive(Clone, Default, PartialEq)]
2573#[non_exhaustive]
2574pub struct VerifyConnectivityResponse {
2575    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2576}
2577
2578impl VerifyConnectivityResponse {
2579    pub fn new() -> Self {
2580        std::default::Default::default()
2581    }
2582}
2583
2584impl wkt::message::Message for VerifyConnectivityResponse {
2585    fn typename() -> &'static str {
2586        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2587    }
2588}
2589
2590/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2591/// represents a single-tenant HSM instance. It can be used for creating
2592/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2593/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2594/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2595/// well as performing cryptographic operations using keys created within the
2596/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2597///
2598/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2599/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2600/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2601#[derive(Clone, Default, PartialEq)]
2602#[non_exhaustive]
2603pub struct SingleTenantHsmInstance {
2604    /// Identifier. The resource name for this
2605    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2606    /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2607    ///
2608    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2609    pub name: std::string::String,
2610
2611    /// Output only. The time at which the
2612    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2613    /// created.
2614    ///
2615    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2616    pub create_time: std::option::Option<wkt::Timestamp>,
2617
2618    /// Output only. The state of the
2619    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2620    ///
2621    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2622    pub state: crate::model::single_tenant_hsm_instance::State,
2623
2624    /// Required. The quorum auth configuration for the
2625    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2626    ///
2627    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2628    pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2629
2630    /// Output only. The time at which the
2631    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2632    /// deleted.
2633    ///
2634    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2635    pub delete_time: std::option::Option<wkt::Timestamp>,
2636
2637    /// Output only. The system-defined duration that an instance can remain
2638    /// unrefreshed until it is automatically disabled. This will have a value of
2639    /// 120 days.
2640    pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2641
2642    /// Output only. The time at which the instance will be automatically disabled
2643    /// if not refreshed. This field is updated upon creation and after each
2644    /// successful refresh operation and enable. A
2645    /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2646    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2647    /// before this time otherwise the
2648    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2649    /// become disabled.
2650    ///
2651    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2652    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2653    pub disable_time: std::option::Option<wkt::Timestamp>,
2654
2655    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2656}
2657
2658impl SingleTenantHsmInstance {
2659    pub fn new() -> Self {
2660        std::default::Default::default()
2661    }
2662
2663    /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2664    ///
2665    /// # Example
2666    /// ```ignore,no_run
2667    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2668    /// let x = SingleTenantHsmInstance::new().set_name("example");
2669    /// ```
2670    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2671        self.name = v.into();
2672        self
2673    }
2674
2675    /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2676    ///
2677    /// # Example
2678    /// ```ignore,no_run
2679    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2680    /// use wkt::Timestamp;
2681    /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2682    /// ```
2683    pub fn set_create_time<T>(mut self, v: T) -> Self
2684    where
2685        T: std::convert::Into<wkt::Timestamp>,
2686    {
2687        self.create_time = std::option::Option::Some(v.into());
2688        self
2689    }
2690
2691    /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2692    ///
2693    /// # Example
2694    /// ```ignore,no_run
2695    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2696    /// use wkt::Timestamp;
2697    /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2698    /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2699    /// ```
2700    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2701    where
2702        T: std::convert::Into<wkt::Timestamp>,
2703    {
2704        self.create_time = v.map(|x| x.into());
2705        self
2706    }
2707
2708    /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2709    ///
2710    /// # Example
2711    /// ```ignore,no_run
2712    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2713    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2714    /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2715    /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2716    /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2717    /// ```
2718    pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2719        mut self,
2720        v: T,
2721    ) -> Self {
2722        self.state = v.into();
2723        self
2724    }
2725
2726    /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2727    ///
2728    /// # Example
2729    /// ```ignore,no_run
2730    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2731    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2732    /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2733    /// ```
2734    pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2735    where
2736        T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2737    {
2738        self.quorum_auth = std::option::Option::Some(v.into());
2739        self
2740    }
2741
2742    /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2743    ///
2744    /// # Example
2745    /// ```ignore,no_run
2746    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2747    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2748    /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2749    /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2750    /// ```
2751    pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2752    where
2753        T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2754    {
2755        self.quorum_auth = v.map(|x| x.into());
2756        self
2757    }
2758
2759    /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2760    ///
2761    /// # Example
2762    /// ```ignore,no_run
2763    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2764    /// use wkt::Timestamp;
2765    /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2766    /// ```
2767    pub fn set_delete_time<T>(mut self, v: T) -> Self
2768    where
2769        T: std::convert::Into<wkt::Timestamp>,
2770    {
2771        self.delete_time = std::option::Option::Some(v.into());
2772        self
2773    }
2774
2775    /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2776    ///
2777    /// # Example
2778    /// ```ignore,no_run
2779    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2780    /// use wkt::Timestamp;
2781    /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2782    /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2783    /// ```
2784    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2785    where
2786        T: std::convert::Into<wkt::Timestamp>,
2787    {
2788        self.delete_time = v.map(|x| x.into());
2789        self
2790    }
2791
2792    /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2793    ///
2794    /// # Example
2795    /// ```ignore,no_run
2796    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2797    /// use wkt::Duration;
2798    /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2799    /// ```
2800    pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2801    where
2802        T: std::convert::Into<wkt::Duration>,
2803    {
2804        self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2805        self
2806    }
2807
2808    /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2809    ///
2810    /// # Example
2811    /// ```ignore,no_run
2812    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2813    /// use wkt::Duration;
2814    /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2815    /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2816    /// ```
2817    pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2818        mut self,
2819        v: std::option::Option<T>,
2820    ) -> Self
2821    where
2822        T: std::convert::Into<wkt::Duration>,
2823    {
2824        self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2825        self
2826    }
2827
2828    /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2829    ///
2830    /// # Example
2831    /// ```ignore,no_run
2832    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2833    /// use wkt::Timestamp;
2834    /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2835    /// ```
2836    pub fn set_disable_time<T>(mut self, v: T) -> Self
2837    where
2838        T: std::convert::Into<wkt::Timestamp>,
2839    {
2840        self.disable_time = std::option::Option::Some(v.into());
2841        self
2842    }
2843
2844    /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2845    ///
2846    /// # Example
2847    /// ```ignore,no_run
2848    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2849    /// use wkt::Timestamp;
2850    /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2851    /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2852    /// ```
2853    pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2854    where
2855        T: std::convert::Into<wkt::Timestamp>,
2856    {
2857        self.disable_time = v.map(|x| x.into());
2858        self
2859    }
2860}
2861
2862impl wkt::message::Message for SingleTenantHsmInstance {
2863    fn typename() -> &'static str {
2864        "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2865    }
2866}
2867
2868/// Defines additional types related to [SingleTenantHsmInstance].
2869pub mod single_tenant_hsm_instance {
2870    #[allow(unused_imports)]
2871    use super::*;
2872
2873    /// Configuration for M of N quorum auth.
2874    #[derive(Clone, Default, PartialEq)]
2875    #[non_exhaustive]
2876    pub struct QuorumAuth {
2877        /// Required. The total number of approvers. This is the N value used
2878        /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2879        /// or equal to 16.
2880        pub total_approver_count: i32,
2881
2882        /// Output only. The required numbers of approvers. The M value used for M of
2883        /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2884        /// to
2885        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2886        ///
2887        ///
2888        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2889        pub required_approver_count: i32,
2890
2891        /// Output only. The public keys associated with the 2FA keys for M of N
2892        /// quorum auth.
2893        pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2894
2895        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2896    }
2897
2898    impl QuorumAuth {
2899        pub fn new() -> Self {
2900            std::default::Default::default()
2901        }
2902
2903        /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2904        ///
2905        /// # Example
2906        /// ```ignore,no_run
2907        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2908        /// let x = QuorumAuth::new().set_total_approver_count(42);
2909        /// ```
2910        pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2911            self.total_approver_count = v.into();
2912            self
2913        }
2914
2915        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2916        ///
2917        /// # Example
2918        /// ```ignore,no_run
2919        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2920        /// let x = QuorumAuth::new().set_required_approver_count(42);
2921        /// ```
2922        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2923            self.required_approver_count = v.into();
2924            self
2925        }
2926
2927        /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
2928        ///
2929        /// # Example
2930        /// ```ignore,no_run
2931        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2932        /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
2933        /// ```
2934        pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
2935        where
2936            T: std::iter::IntoIterator<Item = V>,
2937            V: std::convert::Into<std::string::String>,
2938        {
2939            use std::iter::Iterator;
2940            self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
2941            self
2942        }
2943    }
2944
2945    impl wkt::message::Message for QuorumAuth {
2946        fn typename() -> &'static str {
2947            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
2948        }
2949    }
2950
2951    /// The set of states of a
2952    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2953    ///
2954    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2955    ///
2956    /// # Working with unknown values
2957    ///
2958    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2959    /// additional enum variants at any time. Adding new variants is not considered
2960    /// a breaking change. Applications should write their code in anticipation of:
2961    ///
2962    /// - New values appearing in future releases of the client library, **and**
2963    /// - New values received dynamically, without application changes.
2964    ///
2965    /// Please consult the [Working with enums] section in the user guide for some
2966    /// guidelines.
2967    ///
2968    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2969    #[derive(Clone, Debug, PartialEq)]
2970    #[non_exhaustive]
2971    pub enum State {
2972        /// Not specified.
2973        Unspecified,
2974        /// The
2975        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2976        /// being created.
2977        ///
2978        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2979        Creating,
2980        /// The
2981        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2982        /// waiting for 2FA keys to be registered. This can be done by calling
2983        /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
2984        /// with the [RegisterTwoFactorAuthKeys][] operation.
2985        ///
2986        /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
2987        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2988        PendingTwoFactorAuthRegistration,
2989        /// The
2990        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2991        /// ready to use. A
2992        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2993        /// must be in the
2994        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
2995        /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
2996        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
2997        /// be usable.
2998        ///
2999        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3000        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3001        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
3002        Active,
3003        /// The
3004        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3005        /// being disabled.
3006        ///
3007        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3008        Disabling,
3009        /// The
3010        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3011        /// disabled.
3012        ///
3013        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3014        Disabled,
3015        /// The
3016        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3017        /// being deleted. Requests to the instance will be rejected in this state.
3018        ///
3019        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3020        Deleting,
3021        /// The
3022        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3023        /// has been deleted.
3024        ///
3025        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3026        Deleted,
3027        /// The
3028        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3029        /// has failed and can not be recovered or used.
3030        ///
3031        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3032        Failed,
3033        /// If set, the enum was initialized with an unknown value.
3034        ///
3035        /// Applications can examine the value using [State::value] or
3036        /// [State::name].
3037        UnknownValue(state::UnknownValue),
3038    }
3039
3040    #[doc(hidden)]
3041    pub mod state {
3042        #[allow(unused_imports)]
3043        use super::*;
3044        #[derive(Clone, Debug, PartialEq)]
3045        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3046    }
3047
3048    impl State {
3049        /// Gets the enum value.
3050        ///
3051        /// Returns `None` if the enum contains an unknown value deserialized from
3052        /// the string representation of enums.
3053        pub fn value(&self) -> std::option::Option<i32> {
3054            match self {
3055                Self::Unspecified => std::option::Option::Some(0),
3056                Self::Creating => std::option::Option::Some(1),
3057                Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
3058                Self::Active => std::option::Option::Some(3),
3059                Self::Disabling => std::option::Option::Some(4),
3060                Self::Disabled => std::option::Option::Some(5),
3061                Self::Deleting => std::option::Option::Some(6),
3062                Self::Deleted => std::option::Option::Some(7),
3063                Self::Failed => std::option::Option::Some(8),
3064                Self::UnknownValue(u) => u.0.value(),
3065            }
3066        }
3067
3068        /// Gets the enum value as a string.
3069        ///
3070        /// Returns `None` if the enum contains an unknown value deserialized from
3071        /// the integer representation of enums.
3072        pub fn name(&self) -> std::option::Option<&str> {
3073            match self {
3074                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3075                Self::Creating => std::option::Option::Some("CREATING"),
3076                Self::PendingTwoFactorAuthRegistration => {
3077                    std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
3078                }
3079                Self::Active => std::option::Option::Some("ACTIVE"),
3080                Self::Disabling => std::option::Option::Some("DISABLING"),
3081                Self::Disabled => std::option::Option::Some("DISABLED"),
3082                Self::Deleting => std::option::Option::Some("DELETING"),
3083                Self::Deleted => std::option::Option::Some("DELETED"),
3084                Self::Failed => std::option::Option::Some("FAILED"),
3085                Self::UnknownValue(u) => u.0.name(),
3086            }
3087        }
3088    }
3089
3090    impl std::default::Default for State {
3091        fn default() -> Self {
3092            use std::convert::From;
3093            Self::from(0)
3094        }
3095    }
3096
3097    impl std::fmt::Display for State {
3098        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3099            wkt::internal::display_enum(f, self.name(), self.value())
3100        }
3101    }
3102
3103    impl std::convert::From<i32> for State {
3104        fn from(value: i32) -> Self {
3105            match value {
3106                0 => Self::Unspecified,
3107                1 => Self::Creating,
3108                2 => Self::PendingTwoFactorAuthRegistration,
3109                3 => Self::Active,
3110                4 => Self::Disabling,
3111                5 => Self::Disabled,
3112                6 => Self::Deleting,
3113                7 => Self::Deleted,
3114                8 => Self::Failed,
3115                _ => Self::UnknownValue(state::UnknownValue(
3116                    wkt::internal::UnknownEnumValue::Integer(value),
3117                )),
3118            }
3119        }
3120    }
3121
3122    impl std::convert::From<&str> for State {
3123        fn from(value: &str) -> Self {
3124            use std::string::ToString;
3125            match value {
3126                "STATE_UNSPECIFIED" => Self::Unspecified,
3127                "CREATING" => Self::Creating,
3128                "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
3129                "ACTIVE" => Self::Active,
3130                "DISABLING" => Self::Disabling,
3131                "DISABLED" => Self::Disabled,
3132                "DELETING" => Self::Deleting,
3133                "DELETED" => Self::Deleted,
3134                "FAILED" => Self::Failed,
3135                _ => Self::UnknownValue(state::UnknownValue(
3136                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3137                )),
3138            }
3139        }
3140    }
3141
3142    impl serde::ser::Serialize for State {
3143        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3144        where
3145            S: serde::Serializer,
3146        {
3147            match self {
3148                Self::Unspecified => serializer.serialize_i32(0),
3149                Self::Creating => serializer.serialize_i32(1),
3150                Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
3151                Self::Active => serializer.serialize_i32(3),
3152                Self::Disabling => serializer.serialize_i32(4),
3153                Self::Disabled => serializer.serialize_i32(5),
3154                Self::Deleting => serializer.serialize_i32(6),
3155                Self::Deleted => serializer.serialize_i32(7),
3156                Self::Failed => serializer.serialize_i32(8),
3157                Self::UnknownValue(u) => u.0.serialize(serializer),
3158            }
3159        }
3160    }
3161
3162    impl<'de> serde::de::Deserialize<'de> for State {
3163        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3164        where
3165            D: serde::Deserializer<'de>,
3166        {
3167            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3168                ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
3169            ))
3170        }
3171    }
3172}
3173
3174/// A
3175/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3176/// represents a proposal to perform an operation on a
3177/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3178///
3179/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3180/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3181#[derive(Clone, Default, PartialEq)]
3182#[non_exhaustive]
3183pub struct SingleTenantHsmInstanceProposal {
3184    /// Identifier. The resource name for this
3185    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
3186    /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
3187    ///
3188    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3189    pub name: std::string::String,
3190
3191    /// Output only. The time at which the
3192    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3193    /// was created.
3194    ///
3195    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3196    pub create_time: std::option::Option<wkt::Timestamp>,
3197
3198    /// Output only. The state of the
3199    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3200    ///
3201    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3202    pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3203
3204    /// Output only. The root cause of the most recent failure. Only present if
3205    /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3206    /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3207    ///
3208    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3209    pub failure_reason: std::string::String,
3210
3211    /// Output only. The time at which the
3212    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3213    /// was deleted.
3214    ///
3215    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3216    pub delete_time: std::option::Option<wkt::Timestamp>,
3217
3218    /// Output only. The time at which the soft-deleted
3219    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3220    /// will be permanently purged. This field is only populated
3221    /// when the state is DELETED and will be set a time after expiration of the
3222    /// proposal, i.e. >= expire_time or (create_time + ttl).
3223    ///
3224    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3225    pub purge_time: std::option::Option<wkt::Timestamp>,
3226
3227    /// The approval parameters for the
3228    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3229    /// The type of parameters is determined by the operation being proposed.
3230    ///
3231    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3232    pub approval_parameters:
3233        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3234
3235    /// The expiration of the
3236    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3237    /// If not set, the
3238    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3239    /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3240    /// time is 5 minutes.
3241    ///
3242    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3243    pub expiration:
3244        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3245
3246    /// The operation to perform on the
3247    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3248    ///
3249    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3250    pub operation:
3251        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3252
3253    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3254}
3255
3256impl SingleTenantHsmInstanceProposal {
3257    pub fn new() -> Self {
3258        std::default::Default::default()
3259    }
3260
3261    /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3262    ///
3263    /// # Example
3264    /// ```ignore,no_run
3265    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3266    /// let x = SingleTenantHsmInstanceProposal::new().set_name("example");
3267    /// ```
3268    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3269        self.name = v.into();
3270        self
3271    }
3272
3273    /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3274    ///
3275    /// # Example
3276    /// ```ignore,no_run
3277    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3278    /// use wkt::Timestamp;
3279    /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3280    /// ```
3281    pub fn set_create_time<T>(mut self, v: T) -> Self
3282    where
3283        T: std::convert::Into<wkt::Timestamp>,
3284    {
3285        self.create_time = std::option::Option::Some(v.into());
3286        self
3287    }
3288
3289    /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3290    ///
3291    /// # Example
3292    /// ```ignore,no_run
3293    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3294    /// use wkt::Timestamp;
3295    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3296    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3297    /// ```
3298    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3299    where
3300        T: std::convert::Into<wkt::Timestamp>,
3301    {
3302        self.create_time = v.map(|x| x.into());
3303        self
3304    }
3305
3306    /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3307    ///
3308    /// # Example
3309    /// ```ignore,no_run
3310    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3311    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3312    /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3313    /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3314    /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3315    /// ```
3316    pub fn set_state<
3317        T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3318    >(
3319        mut self,
3320        v: T,
3321    ) -> Self {
3322        self.state = v.into();
3323        self
3324    }
3325
3326    /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3327    ///
3328    /// # Example
3329    /// ```ignore,no_run
3330    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3331    /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3332    /// ```
3333    pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3334        self.failure_reason = v.into();
3335        self
3336    }
3337
3338    /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3339    ///
3340    /// # Example
3341    /// ```ignore,no_run
3342    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3343    /// use wkt::Timestamp;
3344    /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3345    /// ```
3346    pub fn set_delete_time<T>(mut self, v: T) -> Self
3347    where
3348        T: std::convert::Into<wkt::Timestamp>,
3349    {
3350        self.delete_time = std::option::Option::Some(v.into());
3351        self
3352    }
3353
3354    /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3355    ///
3356    /// # Example
3357    /// ```ignore,no_run
3358    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3359    /// use wkt::Timestamp;
3360    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3361    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3362    /// ```
3363    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3364    where
3365        T: std::convert::Into<wkt::Timestamp>,
3366    {
3367        self.delete_time = v.map(|x| x.into());
3368        self
3369    }
3370
3371    /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3372    ///
3373    /// # Example
3374    /// ```ignore,no_run
3375    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3376    /// use wkt::Timestamp;
3377    /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3378    /// ```
3379    pub fn set_purge_time<T>(mut self, v: T) -> Self
3380    where
3381        T: std::convert::Into<wkt::Timestamp>,
3382    {
3383        self.purge_time = std::option::Option::Some(v.into());
3384        self
3385    }
3386
3387    /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3388    ///
3389    /// # Example
3390    /// ```ignore,no_run
3391    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3392    /// use wkt::Timestamp;
3393    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3394    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3395    /// ```
3396    pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3397    where
3398        T: std::convert::Into<wkt::Timestamp>,
3399    {
3400        self.purge_time = v.map(|x| x.into());
3401        self
3402    }
3403
3404    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3405    ///
3406    /// Note that all the setters affecting `approval_parameters` are mutually
3407    /// exclusive.
3408    ///
3409    /// # Example
3410    /// ```ignore,no_run
3411    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3412    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3413    /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3414    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3415    /// ```
3416    pub fn set_approval_parameters<
3417        T: std::convert::Into<
3418                std::option::Option<
3419                    crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3420                >,
3421            >,
3422    >(
3423        mut self,
3424        v: T,
3425    ) -> Self {
3426        self.approval_parameters = v.into();
3427        self
3428    }
3429
3430    /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3431    /// if it holds a `QuorumParameters`, `None` if the field is not set or
3432    /// holds a different branch.
3433    pub fn quorum_parameters(
3434        &self,
3435    ) -> std::option::Option<
3436        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3437    > {
3438        #[allow(unreachable_patterns)]
3439        self.approval_parameters.as_ref().and_then(|v| match v {
3440            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3441            _ => std::option::Option::None,
3442        })
3443    }
3444
3445    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3446    /// to hold a `QuorumParameters`.
3447    ///
3448    /// Note that all the setters affecting `approval_parameters` are
3449    /// mutually exclusive.
3450    ///
3451    /// # Example
3452    /// ```ignore,no_run
3453    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3454    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3455    /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3456    /// assert!(x.quorum_parameters().is_some());
3457    /// assert!(x.required_action_quorum_parameters().is_none());
3458    /// ```
3459    pub fn set_quorum_parameters<
3460        T: std::convert::Into<
3461                std::boxed::Box<
3462                    crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3463                >,
3464            >,
3465    >(
3466        mut self,
3467        v: T,
3468    ) -> Self {
3469        self.approval_parameters = std::option::Option::Some(
3470            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3471                v.into(),
3472            ),
3473        );
3474        self
3475    }
3476
3477    /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3478    /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3479    /// holds a different branch.
3480    pub fn required_action_quorum_parameters(
3481        &self,
3482    ) -> std::option::Option<
3483        &std::boxed::Box<
3484            crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3485        >,
3486    > {
3487        #[allow(unreachable_patterns)]
3488        self.approval_parameters.as_ref().and_then(|v| match v {
3489            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3490            _ => std::option::Option::None,
3491        })
3492    }
3493
3494    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3495    /// to hold a `RequiredActionQuorumParameters`.
3496    ///
3497    /// Note that all the setters affecting `approval_parameters` are
3498    /// mutually exclusive.
3499    ///
3500    /// # Example
3501    /// ```ignore,no_run
3502    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3503    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3504    /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3505    /// assert!(x.required_action_quorum_parameters().is_some());
3506    /// assert!(x.quorum_parameters().is_none());
3507    /// ```
3508    pub fn set_required_action_quorum_parameters<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters>>>(mut self, v: T) -> Self{
3509        self.approval_parameters = std::option::Option::Some(
3510            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3511                v.into()
3512            )
3513        );
3514        self
3515    }
3516
3517    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3518    ///
3519    /// Note that all the setters affecting `expiration` are mutually
3520    /// exclusive.
3521    ///
3522    /// # Example
3523    /// ```ignore,no_run
3524    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3525    /// use wkt::Timestamp;
3526    /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3527    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3528    /// ```
3529    pub fn set_expiration<
3530        T: std::convert::Into<
3531                std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3532            >,
3533    >(
3534        mut self,
3535        v: T,
3536    ) -> Self {
3537        self.expiration = v.into();
3538        self
3539    }
3540
3541    /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3542    /// if it holds a `ExpireTime`, `None` if the field is not set or
3543    /// holds a different branch.
3544    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3545        #[allow(unreachable_patterns)]
3546        self.expiration.as_ref().and_then(|v| match v {
3547            crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3548                std::option::Option::Some(v)
3549            }
3550            _ => std::option::Option::None,
3551        })
3552    }
3553
3554    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3555    /// to hold a `ExpireTime`.
3556    ///
3557    /// Note that all the setters affecting `expiration` are
3558    /// mutually exclusive.
3559    ///
3560    /// # Example
3561    /// ```ignore,no_run
3562    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3563    /// use wkt::Timestamp;
3564    /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3565    /// assert!(x.expire_time().is_some());
3566    /// assert!(x.ttl().is_none());
3567    /// ```
3568    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3569        mut self,
3570        v: T,
3571    ) -> Self {
3572        self.expiration = std::option::Option::Some(
3573            crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3574        );
3575        self
3576    }
3577
3578    /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3579    /// if it holds a `Ttl`, `None` if the field is not set or
3580    /// holds a different branch.
3581    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3582        #[allow(unreachable_patterns)]
3583        self.expiration.as_ref().and_then(|v| match v {
3584            crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3585                std::option::Option::Some(v)
3586            }
3587            _ => std::option::Option::None,
3588        })
3589    }
3590
3591    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3592    /// to hold a `Ttl`.
3593    ///
3594    /// Note that all the setters affecting `expiration` are
3595    /// mutually exclusive.
3596    ///
3597    /// # Example
3598    /// ```ignore,no_run
3599    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3600    /// use wkt::Duration;
3601    /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3602    /// assert!(x.ttl().is_some());
3603    /// assert!(x.expire_time().is_none());
3604    /// ```
3605    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3606        self.expiration = std::option::Option::Some(
3607            crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3608        );
3609        self
3610    }
3611
3612    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3613    ///
3614    /// Note that all the setters affecting `operation` are mutually
3615    /// exclusive.
3616    ///
3617    /// # Example
3618    /// ```ignore,no_run
3619    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3620    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3621    /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3622    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3623    /// ```
3624    pub fn set_operation<
3625        T: std::convert::Into<
3626                std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3627            >,
3628    >(
3629        mut self,
3630        v: T,
3631    ) -> Self {
3632        self.operation = v.into();
3633        self
3634    }
3635
3636    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3637    /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3638    /// holds a different branch.
3639    pub fn register_two_factor_auth_keys(
3640        &self,
3641    ) -> std::option::Option<
3642        &std::boxed::Box<
3643            crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3644        >,
3645    > {
3646        #[allow(unreachable_patterns)]
3647        self.operation.as_ref().and_then(|v| match v {
3648            crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3649            _ => std::option::Option::None,
3650        })
3651    }
3652
3653    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3654    /// to hold a `RegisterTwoFactorAuthKeys`.
3655    ///
3656    /// Note that all the setters affecting `operation` are
3657    /// mutually exclusive.
3658    ///
3659    /// # Example
3660    /// ```ignore,no_run
3661    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3662    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3663    /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3664    /// assert!(x.register_two_factor_auth_keys().is_some());
3665    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3666    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3667    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3668    /// assert!(x.add_quorum_member().is_none());
3669    /// assert!(x.remove_quorum_member().is_none());
3670    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3671    /// ```
3672    pub fn set_register_two_factor_auth_keys<
3673        T: std::convert::Into<
3674                std::boxed::Box<
3675                    crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3676                >,
3677            >,
3678    >(
3679        mut self,
3680        v: T,
3681    ) -> Self {
3682        self.operation = std::option::Option::Some(
3683            crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3684                v.into(),
3685            ),
3686        );
3687        self
3688    }
3689
3690    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3691    /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3692    /// holds a different branch.
3693    pub fn disable_single_tenant_hsm_instance(
3694        &self,
3695    ) -> std::option::Option<
3696        &std::boxed::Box<
3697            crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3698        >,
3699    > {
3700        #[allow(unreachable_patterns)]
3701        self.operation.as_ref().and_then(|v| match v {
3702            crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3703            _ => std::option::Option::None,
3704        })
3705    }
3706
3707    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3708    /// to hold a `DisableSingleTenantHsmInstance`.
3709    ///
3710    /// Note that all the setters affecting `operation` are
3711    /// mutually exclusive.
3712    ///
3713    /// # Example
3714    /// ```ignore,no_run
3715    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3716    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3717    /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3718    /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3719    /// assert!(x.register_two_factor_auth_keys().is_none());
3720    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3721    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3722    /// assert!(x.add_quorum_member().is_none());
3723    /// assert!(x.remove_quorum_member().is_none());
3724    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3725    /// ```
3726    pub fn set_disable_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3727        self.operation = std::option::Option::Some(
3728            crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3729                v.into()
3730            )
3731        );
3732        self
3733    }
3734
3735    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3736    /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3737    /// holds a different branch.
3738    pub fn enable_single_tenant_hsm_instance(
3739        &self,
3740    ) -> std::option::Option<
3741        &std::boxed::Box<
3742            crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3743        >,
3744    > {
3745        #[allow(unreachable_patterns)]
3746        self.operation.as_ref().and_then(|v| match v {
3747            crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3748            _ => std::option::Option::None,
3749        })
3750    }
3751
3752    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3753    /// to hold a `EnableSingleTenantHsmInstance`.
3754    ///
3755    /// Note that all the setters affecting `operation` are
3756    /// mutually exclusive.
3757    ///
3758    /// # Example
3759    /// ```ignore,no_run
3760    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3761    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3762    /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3763    /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3764    /// assert!(x.register_two_factor_auth_keys().is_none());
3765    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3766    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3767    /// assert!(x.add_quorum_member().is_none());
3768    /// assert!(x.remove_quorum_member().is_none());
3769    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3770    /// ```
3771    pub fn set_enable_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3772        self.operation = std::option::Option::Some(
3773            crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3774                v.into()
3775            )
3776        );
3777        self
3778    }
3779
3780    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3781    /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3782    /// holds a different branch.
3783    pub fn delete_single_tenant_hsm_instance(
3784        &self,
3785    ) -> std::option::Option<
3786        &std::boxed::Box<
3787            crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3788        >,
3789    > {
3790        #[allow(unreachable_patterns)]
3791        self.operation.as_ref().and_then(|v| match v {
3792            crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3793            _ => std::option::Option::None,
3794        })
3795    }
3796
3797    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3798    /// to hold a `DeleteSingleTenantHsmInstance`.
3799    ///
3800    /// Note that all the setters affecting `operation` are
3801    /// mutually exclusive.
3802    ///
3803    /// # Example
3804    /// ```ignore,no_run
3805    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3806    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3807    /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3808    /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3809    /// assert!(x.register_two_factor_auth_keys().is_none());
3810    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3811    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3812    /// assert!(x.add_quorum_member().is_none());
3813    /// assert!(x.remove_quorum_member().is_none());
3814    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3815    /// ```
3816    pub fn set_delete_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3817        self.operation = std::option::Option::Some(
3818            crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3819                v.into()
3820            )
3821        );
3822        self
3823    }
3824
3825    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3826    /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3827    /// holds a different branch.
3828    pub fn add_quorum_member(
3829        &self,
3830    ) -> std::option::Option<
3831        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3832    > {
3833        #[allow(unreachable_patterns)]
3834        self.operation.as_ref().and_then(|v| match v {
3835            crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3836                std::option::Option::Some(v)
3837            }
3838            _ => std::option::Option::None,
3839        })
3840    }
3841
3842    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3843    /// to hold a `AddQuorumMember`.
3844    ///
3845    /// Note that all the setters affecting `operation` are
3846    /// mutually exclusive.
3847    ///
3848    /// # Example
3849    /// ```ignore,no_run
3850    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3851    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3852    /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3853    /// assert!(x.add_quorum_member().is_some());
3854    /// assert!(x.register_two_factor_auth_keys().is_none());
3855    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3856    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3857    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3858    /// assert!(x.remove_quorum_member().is_none());
3859    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3860    /// ```
3861    pub fn set_add_quorum_member<
3862        T: std::convert::Into<
3863                std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3864            >,
3865    >(
3866        mut self,
3867        v: T,
3868    ) -> Self {
3869        self.operation = std::option::Option::Some(
3870            crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3871        );
3872        self
3873    }
3874
3875    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3876    /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3877    /// holds a different branch.
3878    pub fn remove_quorum_member(
3879        &self,
3880    ) -> std::option::Option<
3881        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3882    > {
3883        #[allow(unreachable_patterns)]
3884        self.operation.as_ref().and_then(|v| match v {
3885            crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3886                std::option::Option::Some(v)
3887            }
3888            _ => std::option::Option::None,
3889        })
3890    }
3891
3892    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3893    /// to hold a `RemoveQuorumMember`.
3894    ///
3895    /// Note that all the setters affecting `operation` are
3896    /// mutually exclusive.
3897    ///
3898    /// # Example
3899    /// ```ignore,no_run
3900    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3901    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
3902    /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3903    /// assert!(x.remove_quorum_member().is_some());
3904    /// assert!(x.register_two_factor_auth_keys().is_none());
3905    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3906    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3907    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3908    /// assert!(x.add_quorum_member().is_none());
3909    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3910    /// ```
3911    pub fn set_remove_quorum_member<
3912        T: std::convert::Into<
3913                std::boxed::Box<
3914                    crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
3915                >,
3916            >,
3917    >(
3918        mut self,
3919        v: T,
3920    ) -> Self {
3921        self.operation = std::option::Option::Some(
3922            crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
3923                v.into(),
3924            ),
3925        );
3926        self
3927    }
3928
3929    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3930    /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
3931    /// holds a different branch.
3932    pub fn refresh_single_tenant_hsm_instance(
3933        &self,
3934    ) -> std::option::Option<
3935        &std::boxed::Box<
3936            crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
3937        >,
3938    > {
3939        #[allow(unreachable_patterns)]
3940        self.operation.as_ref().and_then(|v| match v {
3941            crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3942            _ => std::option::Option::None,
3943        })
3944    }
3945
3946    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3947    /// to hold a `RefreshSingleTenantHsmInstance`.
3948    ///
3949    /// Note that all the setters affecting `operation` are
3950    /// mutually exclusive.
3951    ///
3952    /// # Example
3953    /// ```ignore,no_run
3954    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3955    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
3956    /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
3957    /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
3958    /// assert!(x.register_two_factor_auth_keys().is_none());
3959    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3960    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3961    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3962    /// assert!(x.add_quorum_member().is_none());
3963    /// assert!(x.remove_quorum_member().is_none());
3964    /// ```
3965    pub fn set_refresh_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3966        self.operation = std::option::Option::Some(
3967            crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
3968                v.into()
3969            )
3970        );
3971        self
3972    }
3973}
3974
3975impl wkt::message::Message for SingleTenantHsmInstanceProposal {
3976    fn typename() -> &'static str {
3977        "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
3978    }
3979}
3980
3981/// Defines additional types related to [SingleTenantHsmInstanceProposal].
3982pub mod single_tenant_hsm_instance_proposal {
3983    #[allow(unused_imports)]
3984    use super::*;
3985
3986    /// Parameters of quorum approval for the
3987    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3988    ///
3989    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3990    #[derive(Clone, Default, PartialEq)]
3991    #[non_exhaustive]
3992    pub struct QuorumParameters {
3993        /// Output only. The required numbers of approvers. This is the M value used
3994        /// for M of N quorum auth. It is less than the number of public keys.
3995        pub required_approver_count: i32,
3996
3997        /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
3998        /// of N of these challenges are required to be signed to approve the
3999        /// operation.
4000        pub challenges: std::vec::Vec<crate::model::Challenge>,
4001
4002        /// Output only. The public keys associated with the 2FA keys that have
4003        /// already approved the
4004        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4005        /// by signing the challenge.
4006        ///
4007        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4008        pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4009
4010        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4011    }
4012
4013    impl QuorumParameters {
4014        pub fn new() -> Self {
4015            std::default::Default::default()
4016        }
4017
4018        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
4019        ///
4020        /// # Example
4021        /// ```ignore,no_run
4022        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4023        /// let x = QuorumParameters::new().set_required_approver_count(42);
4024        /// ```
4025        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4026            self.required_approver_count = v.into();
4027            self
4028        }
4029
4030        /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
4031        ///
4032        /// # Example
4033        /// ```ignore,no_run
4034        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4035        /// use google_cloud_kms_v1::model::Challenge;
4036        /// let x = QuorumParameters::new()
4037        ///     .set_challenges([
4038        ///         Challenge::default()/* use setters */,
4039        ///         Challenge::default()/* use (different) setters */,
4040        ///     ]);
4041        /// ```
4042        pub fn set_challenges<T, V>(mut self, v: T) -> Self
4043        where
4044            T: std::iter::IntoIterator<Item = V>,
4045            V: std::convert::Into<crate::model::Challenge>,
4046        {
4047            use std::iter::Iterator;
4048            self.challenges = v.into_iter().map(|i| i.into()).collect();
4049            self
4050        }
4051
4052        /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
4053        ///
4054        /// # Example
4055        /// ```ignore,no_run
4056        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4057        /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4058        /// ```
4059        pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4060        where
4061            T: std::iter::IntoIterator<Item = V>,
4062            V: std::convert::Into<std::string::String>,
4063        {
4064            use std::iter::Iterator;
4065            self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4066            self
4067        }
4068    }
4069
4070    impl wkt::message::Message for QuorumParameters {
4071        fn typename() -> &'static str {
4072            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
4073        }
4074    }
4075
4076    /// Parameters for an approval that has both required challenges and a
4077    /// quorum.
4078    #[derive(Clone, Default, PartialEq)]
4079    #[non_exhaustive]
4080    pub struct RequiredActionQuorumParameters {
4081        /// Output only. A list of specific challenges that must be signed.
4082        /// For some operations, this will contain a single challenge.
4083        pub required_challenges: std::vec::Vec<crate::model::Challenge>,
4084
4085        /// Output only. The required number of quorum approvers. This is the M value
4086        /// used for M of N quorum auth. It is less than the number of public keys.
4087        pub required_approver_count: i32,
4088
4089        /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4090        /// of N of these challenges are required to be signed to approve the
4091        /// operation.
4092        pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
4093
4094        /// Output only. The public keys associated with the 2FA keys that have
4095        /// already approved the
4096        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4097        /// by signing the challenge.
4098        ///
4099        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4100        pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4101
4102        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4103    }
4104
4105    impl RequiredActionQuorumParameters {
4106        pub fn new() -> Self {
4107            std::default::Default::default()
4108        }
4109
4110        /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
4111        ///
4112        /// # Example
4113        /// ```ignore,no_run
4114        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4115        /// use google_cloud_kms_v1::model::Challenge;
4116        /// let x = RequiredActionQuorumParameters::new()
4117        ///     .set_required_challenges([
4118        ///         Challenge::default()/* use setters */,
4119        ///         Challenge::default()/* use (different) setters */,
4120        ///     ]);
4121        /// ```
4122        pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
4123        where
4124            T: std::iter::IntoIterator<Item = V>,
4125            V: std::convert::Into<crate::model::Challenge>,
4126        {
4127            use std::iter::Iterator;
4128            self.required_challenges = v.into_iter().map(|i| i.into()).collect();
4129            self
4130        }
4131
4132        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
4133        ///
4134        /// # Example
4135        /// ```ignore,no_run
4136        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4137        /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
4138        /// ```
4139        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4140            self.required_approver_count = v.into();
4141            self
4142        }
4143
4144        /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
4145        ///
4146        /// # Example
4147        /// ```ignore,no_run
4148        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4149        /// use google_cloud_kms_v1::model::Challenge;
4150        /// let x = RequiredActionQuorumParameters::new()
4151        ///     .set_quorum_challenges([
4152        ///         Challenge::default()/* use setters */,
4153        ///         Challenge::default()/* use (different) setters */,
4154        ///     ]);
4155        /// ```
4156        pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
4157        where
4158            T: std::iter::IntoIterator<Item = V>,
4159            V: std::convert::Into<crate::model::Challenge>,
4160        {
4161            use std::iter::Iterator;
4162            self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
4163            self
4164        }
4165
4166        /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
4167        ///
4168        /// # Example
4169        /// ```ignore,no_run
4170        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4171        /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4172        /// ```
4173        pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4174        where
4175            T: std::iter::IntoIterator<Item = V>,
4176            V: std::convert::Into<std::string::String>,
4177        {
4178            use std::iter::Iterator;
4179            self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4180            self
4181        }
4182    }
4183
4184    impl wkt::message::Message for RequiredActionQuorumParameters {
4185        fn typename() -> &'static str {
4186            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
4187        }
4188    }
4189
4190    /// Register 2FA keys for the
4191    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4192    /// This operation requires all Challenges to be signed by 2FA keys. The
4193    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4194    /// be in the
4195    /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4196    /// state to perform this operation.
4197    ///
4198    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4199    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4200    #[derive(Clone, Default, PartialEq)]
4201    #[non_exhaustive]
4202    pub struct RegisterTwoFactorAuthKeys {
4203        /// Required. The required numbers of approvers to set for the
4204        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4205        /// This is the M value used for M of N quorum auth. Must be greater than or
4206        /// equal to 2 and less than or equal to
4207        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4208        ///
4209        ///
4210        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4211        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4212        pub required_approver_count: i32,
4213
4214        /// Required. The public keys associated with the 2FA keys for M of N quorum
4215        /// auth. Public keys must be associated with RSA 2048 keys.
4216        pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4217
4218        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4219    }
4220
4221    impl RegisterTwoFactorAuthKeys {
4222        pub fn new() -> Self {
4223            std::default::Default::default()
4224        }
4225
4226        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4227        ///
4228        /// # Example
4229        /// ```ignore,no_run
4230        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4231        /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4232        /// ```
4233        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4234            self.required_approver_count = v.into();
4235            self
4236        }
4237
4238        /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4239        ///
4240        /// # Example
4241        /// ```ignore,no_run
4242        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4243        /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4244        /// ```
4245        pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4246        where
4247            T: std::iter::IntoIterator<Item = V>,
4248            V: std::convert::Into<std::string::String>,
4249        {
4250            use std::iter::Iterator;
4251            self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4252            self
4253        }
4254    }
4255
4256    impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4257        fn typename() -> &'static str {
4258            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4259        }
4260    }
4261
4262    /// Disable the
4263    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4264    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4265    /// be in the
4266    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4267    /// perform this operation.
4268    ///
4269    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4270    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4271    #[derive(Clone, Default, PartialEq)]
4272    #[non_exhaustive]
4273    pub struct DisableSingleTenantHsmInstance {
4274        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4275    }
4276
4277    impl DisableSingleTenantHsmInstance {
4278        pub fn new() -> Self {
4279            std::default::Default::default()
4280        }
4281    }
4282
4283    impl wkt::message::Message for DisableSingleTenantHsmInstance {
4284        fn typename() -> &'static str {
4285            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4286        }
4287    }
4288
4289    /// Enable the
4290    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4291    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4292    /// be in the
4293    /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4294    /// state to perform this operation.
4295    ///
4296    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4297    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4298    #[derive(Clone, Default, PartialEq)]
4299    #[non_exhaustive]
4300    pub struct EnableSingleTenantHsmInstance {
4301        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4302    }
4303
4304    impl EnableSingleTenantHsmInstance {
4305        pub fn new() -> Self {
4306            std::default::Default::default()
4307        }
4308    }
4309
4310    impl wkt::message::Message for EnableSingleTenantHsmInstance {
4311        fn typename() -> &'static str {
4312            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4313        }
4314    }
4315
4316    /// Delete the
4317    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4318    /// Deleting a
4319    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4320    /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4321    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4322    /// unusable. The
4323    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4324    /// not be in the
4325    /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4326    /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4327    /// to perform this operation.
4328    ///
4329    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4330    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4331    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4332    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4333    #[derive(Clone, Default, PartialEq)]
4334    #[non_exhaustive]
4335    pub struct DeleteSingleTenantHsmInstance {
4336        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4337    }
4338
4339    impl DeleteSingleTenantHsmInstance {
4340        pub fn new() -> Self {
4341            std::default::Default::default()
4342        }
4343    }
4344
4345    impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4346        fn typename() -> &'static str {
4347            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4348        }
4349    }
4350
4351    /// Add a quorum member to the
4352    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4353    /// This will increase the
4354    /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4355    /// by 1. The
4356    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4357    /// be in the
4358    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4359    /// perform this operation.
4360    ///
4361    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4362    /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4363    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4364    #[derive(Clone, Default, PartialEq)]
4365    #[non_exhaustive]
4366    pub struct AddQuorumMember {
4367        /// Required. The public key associated with the 2FA key for the new quorum
4368        /// member to add. Public keys must be associated with RSA 2048 keys.
4369        pub two_factor_public_key_pem: std::string::String,
4370
4371        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4372    }
4373
4374    impl AddQuorumMember {
4375        pub fn new() -> Self {
4376            std::default::Default::default()
4377        }
4378
4379        /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4380        ///
4381        /// # Example
4382        /// ```ignore,no_run
4383        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4384        /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4385        /// ```
4386        pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4387            mut self,
4388            v: T,
4389        ) -> Self {
4390            self.two_factor_public_key_pem = v.into();
4391            self
4392        }
4393    }
4394
4395    impl wkt::message::Message for AddQuorumMember {
4396        fn typename() -> &'static str {
4397            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4398        }
4399    }
4400
4401    /// Remove a quorum member from the
4402    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4403    /// This will reduce
4404    /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4405    /// by 1. The
4406    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4407    /// be in the
4408    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4409    /// perform this operation.
4410    ///
4411    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4412    /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4413    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4414    #[derive(Clone, Default, PartialEq)]
4415    #[non_exhaustive]
4416    pub struct RemoveQuorumMember {
4417        /// Required. The public key associated with the 2FA key for the quorum
4418        /// member to remove. Public keys must be associated with RSA 2048 keys.
4419        pub two_factor_public_key_pem: std::string::String,
4420
4421        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4422    }
4423
4424    impl RemoveQuorumMember {
4425        pub fn new() -> Self {
4426            std::default::Default::default()
4427        }
4428
4429        /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4430        ///
4431        /// # Example
4432        /// ```ignore,no_run
4433        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4434        /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4435        /// ```
4436        pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4437            mut self,
4438            v: T,
4439        ) -> Self {
4440            self.two_factor_public_key_pem = v.into();
4441            self
4442        }
4443    }
4444
4445    impl wkt::message::Message for RemoveQuorumMember {
4446        fn typename() -> &'static str {
4447            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4448        }
4449    }
4450
4451    /// Refreshes the
4452    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4453    /// This operation must be performed periodically to keep the
4454    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4455    /// active. This operation must be performed before
4456    /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4457    /// has passed. The
4458    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4459    /// be in the
4460    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4461    /// perform this operation.
4462    ///
4463    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4464    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4465    /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4466    #[derive(Clone, Default, PartialEq)]
4467    #[non_exhaustive]
4468    pub struct RefreshSingleTenantHsmInstance {
4469        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4470    }
4471
4472    impl RefreshSingleTenantHsmInstance {
4473        pub fn new() -> Self {
4474            std::default::Default::default()
4475        }
4476    }
4477
4478    impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4479        fn typename() -> &'static str {
4480            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4481        }
4482    }
4483
4484    /// The set of states of a
4485    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4486    ///
4487    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4488    ///
4489    /// # Working with unknown values
4490    ///
4491    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4492    /// additional enum variants at any time. Adding new variants is not considered
4493    /// a breaking change. Applications should write their code in anticipation of:
4494    ///
4495    /// - New values appearing in future releases of the client library, **and**
4496    /// - New values received dynamically, without application changes.
4497    ///
4498    /// Please consult the [Working with enums] section in the user guide for some
4499    /// guidelines.
4500    ///
4501    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4502    #[derive(Clone, Debug, PartialEq)]
4503    #[non_exhaustive]
4504    pub enum State {
4505        /// Not specified.
4506        Unspecified,
4507        /// The
4508        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4509        /// is being created.
4510        ///
4511        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4512        Creating,
4513        /// The
4514        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4515        /// is pending approval.
4516        ///
4517        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4518        Pending,
4519        /// The
4520        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4521        /// has been approved.
4522        ///
4523        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4524        Approved,
4525        /// The
4526        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4527        /// is being executed.
4528        ///
4529        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4530        Running,
4531        /// The
4532        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4533        /// has been executed successfully.
4534        ///
4535        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4536        Succeeded,
4537        /// The
4538        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4539        /// has failed.
4540        ///
4541        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4542        Failed,
4543        /// The
4544        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4545        /// has been deleted and will be purged after the purge_time.
4546        ///
4547        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4548        Deleted,
4549        /// If set, the enum was initialized with an unknown value.
4550        ///
4551        /// Applications can examine the value using [State::value] or
4552        /// [State::name].
4553        UnknownValue(state::UnknownValue),
4554    }
4555
4556    #[doc(hidden)]
4557    pub mod state {
4558        #[allow(unused_imports)]
4559        use super::*;
4560        #[derive(Clone, Debug, PartialEq)]
4561        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4562    }
4563
4564    impl State {
4565        /// Gets the enum value.
4566        ///
4567        /// Returns `None` if the enum contains an unknown value deserialized from
4568        /// the string representation of enums.
4569        pub fn value(&self) -> std::option::Option<i32> {
4570            match self {
4571                Self::Unspecified => std::option::Option::Some(0),
4572                Self::Creating => std::option::Option::Some(1),
4573                Self::Pending => std::option::Option::Some(2),
4574                Self::Approved => std::option::Option::Some(3),
4575                Self::Running => std::option::Option::Some(4),
4576                Self::Succeeded => std::option::Option::Some(5),
4577                Self::Failed => std::option::Option::Some(6),
4578                Self::Deleted => std::option::Option::Some(7),
4579                Self::UnknownValue(u) => u.0.value(),
4580            }
4581        }
4582
4583        /// Gets the enum value as a string.
4584        ///
4585        /// Returns `None` if the enum contains an unknown value deserialized from
4586        /// the integer representation of enums.
4587        pub fn name(&self) -> std::option::Option<&str> {
4588            match self {
4589                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4590                Self::Creating => std::option::Option::Some("CREATING"),
4591                Self::Pending => std::option::Option::Some("PENDING"),
4592                Self::Approved => std::option::Option::Some("APPROVED"),
4593                Self::Running => std::option::Option::Some("RUNNING"),
4594                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4595                Self::Failed => std::option::Option::Some("FAILED"),
4596                Self::Deleted => std::option::Option::Some("DELETED"),
4597                Self::UnknownValue(u) => u.0.name(),
4598            }
4599        }
4600    }
4601
4602    impl std::default::Default for State {
4603        fn default() -> Self {
4604            use std::convert::From;
4605            Self::from(0)
4606        }
4607    }
4608
4609    impl std::fmt::Display for State {
4610        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4611            wkt::internal::display_enum(f, self.name(), self.value())
4612        }
4613    }
4614
4615    impl std::convert::From<i32> for State {
4616        fn from(value: i32) -> Self {
4617            match value {
4618                0 => Self::Unspecified,
4619                1 => Self::Creating,
4620                2 => Self::Pending,
4621                3 => Self::Approved,
4622                4 => Self::Running,
4623                5 => Self::Succeeded,
4624                6 => Self::Failed,
4625                7 => Self::Deleted,
4626                _ => Self::UnknownValue(state::UnknownValue(
4627                    wkt::internal::UnknownEnumValue::Integer(value),
4628                )),
4629            }
4630        }
4631    }
4632
4633    impl std::convert::From<&str> for State {
4634        fn from(value: &str) -> Self {
4635            use std::string::ToString;
4636            match value {
4637                "STATE_UNSPECIFIED" => Self::Unspecified,
4638                "CREATING" => Self::Creating,
4639                "PENDING" => Self::Pending,
4640                "APPROVED" => Self::Approved,
4641                "RUNNING" => Self::Running,
4642                "SUCCEEDED" => Self::Succeeded,
4643                "FAILED" => Self::Failed,
4644                "DELETED" => Self::Deleted,
4645                _ => Self::UnknownValue(state::UnknownValue(
4646                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4647                )),
4648            }
4649        }
4650    }
4651
4652    impl serde::ser::Serialize for State {
4653        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4654        where
4655            S: serde::Serializer,
4656        {
4657            match self {
4658                Self::Unspecified => serializer.serialize_i32(0),
4659                Self::Creating => serializer.serialize_i32(1),
4660                Self::Pending => serializer.serialize_i32(2),
4661                Self::Approved => serializer.serialize_i32(3),
4662                Self::Running => serializer.serialize_i32(4),
4663                Self::Succeeded => serializer.serialize_i32(5),
4664                Self::Failed => serializer.serialize_i32(6),
4665                Self::Deleted => serializer.serialize_i32(7),
4666                Self::UnknownValue(u) => u.0.serialize(serializer),
4667            }
4668        }
4669    }
4670
4671    impl<'de> serde::de::Deserialize<'de> for State {
4672        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4673        where
4674            D: serde::Deserializer<'de>,
4675        {
4676            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4677                ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4678            ))
4679        }
4680    }
4681
4682    /// The approval parameters for the
4683    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4684    /// The type of parameters is determined by the operation being proposed.
4685    ///
4686    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4687    #[derive(Clone, Debug, PartialEq)]
4688    #[non_exhaustive]
4689    pub enum ApprovalParameters {
4690        /// Output only. The quorum approval parameters for the
4691        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4692        ///
4693        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4694        QuorumParameters(
4695            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4696        ),
4697        /// Output only. Parameters for an approval of a
4698        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4699        /// that has both required challenges and a quorum.
4700        ///
4701        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4702        RequiredActionQuorumParameters(
4703            std::boxed::Box<
4704                crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4705            >,
4706        ),
4707    }
4708
4709    /// The expiration of the
4710    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4711    /// If not set, the
4712    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4713    /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4714    /// time is 5 minutes.
4715    ///
4716    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4717    #[derive(Clone, Debug, PartialEq)]
4718    #[non_exhaustive]
4719    pub enum Expiration {
4720        /// The time at which the
4721        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4722        /// will expire if not approved and executed.
4723        ///
4724        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4725        ExpireTime(std::boxed::Box<wkt::Timestamp>),
4726        /// Input only. The TTL for the
4727        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4728        /// Proposals will expire after this duration.
4729        ///
4730        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4731        Ttl(std::boxed::Box<wkt::Duration>),
4732    }
4733
4734    /// The operation to perform on the
4735    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4736    ///
4737    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4738    #[derive(Clone, Debug, PartialEq)]
4739    #[non_exhaustive]
4740    pub enum Operation {
4741        /// Register 2FA keys for the
4742        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4743        /// This operation requires all N Challenges to be signed by 2FA keys. The
4744        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4745        /// must be in the
4746        /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4747        /// state to perform this operation.
4748        ///
4749        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4750        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4751        RegisterTwoFactorAuthKeys(
4752            std::boxed::Box<
4753                crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4754            >,
4755        ),
4756        /// Disable the
4757        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4758        /// The
4759        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4760        /// must be in the
4761        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4762        /// to perform this operation.
4763        ///
4764        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4765        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4766        DisableSingleTenantHsmInstance(
4767            std::boxed::Box<
4768                crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4769            >,
4770        ),
4771        /// Enable the
4772        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4773        /// The
4774        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4775        /// must be in the
4776        /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4777        /// state to perform this operation.
4778        ///
4779        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4780        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4781        EnableSingleTenantHsmInstance(
4782            std::boxed::Box<
4783                crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4784            >,
4785        ),
4786        /// Delete the
4787        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4788        /// Deleting a
4789        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4790        /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4791        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4792        /// unusable. The
4793        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4794        /// must be in the
4795        /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
4796        /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4797        /// state to perform this operation.
4798        ///
4799        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4800        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4801        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4802        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4803        DeleteSingleTenantHsmInstance(
4804            std::boxed::Box<
4805                crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
4806            >,
4807        ),
4808        /// Add a quorum member to the
4809        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4810        /// This will increase the
4811        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4812        /// by 1. The
4813        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4814        /// must be in the
4815        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4816        /// to perform this operation.
4817        ///
4818        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4819        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4820        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4821        AddQuorumMember(
4822            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
4823        ),
4824        /// Remove a quorum member from the
4825        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4826        /// This will reduce
4827        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4828        /// by 1. The
4829        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4830        /// must be in the
4831        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4832        /// to perform this operation.
4833        ///
4834        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4835        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4836        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4837        RemoveQuorumMember(
4838            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
4839        ),
4840        /// Refreshes the
4841        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4842        /// This operation must be performed periodically to keep the
4843        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4844        /// active. This operation must be performed before
4845        /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4846        /// has passed. The
4847        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4848        /// must be in the
4849        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4850        /// to perform this operation.
4851        ///
4852        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4853        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4854        /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4855        RefreshSingleTenantHsmInstance(
4856            std::boxed::Box<
4857                crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4858            >,
4859        ),
4860    }
4861}
4862
4863/// A challenge to be signed by a 2FA key.
4864#[derive(Clone, Default, PartialEq)]
4865#[non_exhaustive]
4866pub struct Challenge {
4867    /// Output only. The challenge to be signed by the 2FA key indicated by the
4868    /// public key.
4869    pub challenge: ::bytes::Bytes,
4870
4871    /// Output only. The public key associated with the 2FA key that should sign
4872    /// the challenge.
4873    pub public_key_pem: std::string::String,
4874
4875    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4876}
4877
4878impl Challenge {
4879    pub fn new() -> Self {
4880        std::default::Default::default()
4881    }
4882
4883    /// Sets the value of [challenge][crate::model::Challenge::challenge].
4884    ///
4885    /// # Example
4886    /// ```ignore,no_run
4887    /// # use google_cloud_kms_v1::model::Challenge;
4888    /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
4889    /// ```
4890    pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4891        self.challenge = v.into();
4892        self
4893    }
4894
4895    /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
4896    ///
4897    /// # Example
4898    /// ```ignore,no_run
4899    /// # use google_cloud_kms_v1::model::Challenge;
4900    /// let x = Challenge::new().set_public_key_pem("example");
4901    /// ```
4902    pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4903        self.public_key_pem = v.into();
4904        self
4905    }
4906}
4907
4908impl wkt::message::Message for Challenge {
4909    fn typename() -> &'static str {
4910        "type.googleapis.com/google.cloud.kms.v1.Challenge"
4911    }
4912}
4913
4914/// A reply to a challenge signed by a 2FA key.
4915#[derive(Clone, Default, PartialEq)]
4916#[non_exhaustive]
4917pub struct ChallengeReply {
4918    /// Required. The signed challenge associated with the 2FA key.
4919    /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
4920    pub signed_challenge: ::bytes::Bytes,
4921
4922    /// Required. The public key associated with the 2FA key.
4923    pub public_key_pem: std::string::String,
4924
4925    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4926}
4927
4928impl ChallengeReply {
4929    pub fn new() -> Self {
4930        std::default::Default::default()
4931    }
4932
4933    /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
4934    ///
4935    /// # Example
4936    /// ```ignore,no_run
4937    /// # use google_cloud_kms_v1::model::ChallengeReply;
4938    /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
4939    /// ```
4940    pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4941        self.signed_challenge = v.into();
4942        self
4943    }
4944
4945    /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
4946    ///
4947    /// # Example
4948    /// ```ignore,no_run
4949    /// # use google_cloud_kms_v1::model::ChallengeReply;
4950    /// let x = ChallengeReply::new().set_public_key_pem("example");
4951    /// ```
4952    pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4953        self.public_key_pem = v.into();
4954        self
4955    }
4956}
4957
4958impl wkt::message::Message for ChallengeReply {
4959    fn typename() -> &'static str {
4960        "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
4961    }
4962}
4963
4964/// Request message for
4965/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
4966///
4967/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4968#[derive(Clone, Default, PartialEq)]
4969#[non_exhaustive]
4970pub struct ListSingleTenantHsmInstancesRequest {
4971    /// Required. The resource name of the location associated with the
4972    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4973    /// list, in the format `projects/*/locations/*`.
4974    ///
4975    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4976    pub parent: std::string::String,
4977
4978    /// Optional. Optional limit on the number of
4979    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4980    /// include in the response. Further
4981    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
4982    /// subsequently be
4983    /// obtained by including the
4984    /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
4985    /// in a subsequent request. If unspecified, the server will pick an
4986    /// appropriate default.
4987    ///
4988    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4989    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4990    pub page_size: i32,
4991
4992    /// Optional. Optional pagination token, returned earlier via
4993    /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
4994    ///
4995    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4996    pub page_token: std::string::String,
4997
4998    /// Optional. Only include resources that match the filter in the response. For
4999    /// more information, see
5000    /// [Sorting and filtering list
5001    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5002    pub filter: std::string::String,
5003
5004    /// Optional. Specify how the results should be sorted. If not specified, the
5005    /// results will be sorted in the default order.  For more information, see
5006    /// [Sorting and filtering list
5007    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5008    pub order_by: std::string::String,
5009
5010    /// Optional. If set to true,
5011    /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
5012    /// will also return
5013    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
5014    /// DELETED state.
5015    ///
5016    /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5017    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5018    pub show_deleted: bool,
5019
5020    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5021}
5022
5023impl ListSingleTenantHsmInstancesRequest {
5024    pub fn new() -> Self {
5025        std::default::Default::default()
5026    }
5027
5028    /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
5029    ///
5030    /// # Example
5031    /// ```ignore,no_run
5032    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5033    /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
5034    /// ```
5035    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5036        self.parent = v.into();
5037        self
5038    }
5039
5040    /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
5041    ///
5042    /// # Example
5043    /// ```ignore,no_run
5044    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5045    /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
5046    /// ```
5047    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5048        self.page_size = v.into();
5049        self
5050    }
5051
5052    /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
5053    ///
5054    /// # Example
5055    /// ```ignore,no_run
5056    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5057    /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
5058    /// ```
5059    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5060        self.page_token = v.into();
5061        self
5062    }
5063
5064    /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
5065    ///
5066    /// # Example
5067    /// ```ignore,no_run
5068    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5069    /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
5070    /// ```
5071    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5072        self.filter = v.into();
5073        self
5074    }
5075
5076    /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
5077    ///
5078    /// # Example
5079    /// ```ignore,no_run
5080    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5081    /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
5082    /// ```
5083    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5084        self.order_by = v.into();
5085        self
5086    }
5087
5088    /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
5089    ///
5090    /// # Example
5091    /// ```ignore,no_run
5092    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5093    /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
5094    /// ```
5095    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5096        self.show_deleted = v.into();
5097        self
5098    }
5099}
5100
5101impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
5102    fn typename() -> &'static str {
5103        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
5104    }
5105}
5106
5107/// Response message for
5108/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5109///
5110/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5111#[derive(Clone, Default, PartialEq)]
5112#[non_exhaustive]
5113pub struct ListSingleTenantHsmInstancesResponse {
5114    /// The list of
5115    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
5116    ///
5117    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5118    pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
5119
5120    /// A token to retrieve next page of results. Pass this value in
5121    /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
5122    /// to retrieve the next page of results.
5123    ///
5124    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
5125    pub next_page_token: std::string::String,
5126
5127    /// The total number of
5128    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
5129    /// that matched the query.
5130    ///
5131    /// This field is not populated if
5132    /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
5133    /// is applied.
5134    ///
5135    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
5136    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5137    pub total_size: i32,
5138
5139    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5140}
5141
5142impl ListSingleTenantHsmInstancesResponse {
5143    pub fn new() -> Self {
5144        std::default::Default::default()
5145    }
5146
5147    /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
5148    ///
5149    /// # Example
5150    /// ```ignore,no_run
5151    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5152    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5153    /// let x = ListSingleTenantHsmInstancesResponse::new()
5154    ///     .set_single_tenant_hsm_instances([
5155    ///         SingleTenantHsmInstance::default()/* use setters */,
5156    ///         SingleTenantHsmInstance::default()/* use (different) setters */,
5157    ///     ]);
5158    /// ```
5159    pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
5160    where
5161        T: std::iter::IntoIterator<Item = V>,
5162        V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5163    {
5164        use std::iter::Iterator;
5165        self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
5166        self
5167    }
5168
5169    /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
5170    ///
5171    /// # Example
5172    /// ```ignore,no_run
5173    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5174    /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
5175    /// ```
5176    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5177        self.next_page_token = v.into();
5178        self
5179    }
5180
5181    /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
5182    ///
5183    /// # Example
5184    /// ```ignore,no_run
5185    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5186    /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
5187    /// ```
5188    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5189        self.total_size = v.into();
5190        self
5191    }
5192}
5193
5194impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
5195    fn typename() -> &'static str {
5196        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
5197    }
5198}
5199
5200#[doc(hidden)]
5201impl google_cloud_gax::paginator::internal::PageableResponse
5202    for ListSingleTenantHsmInstancesResponse
5203{
5204    type PageItem = crate::model::SingleTenantHsmInstance;
5205
5206    fn items(self) -> std::vec::Vec<Self::PageItem> {
5207        self.single_tenant_hsm_instances
5208    }
5209
5210    fn next_page_token(&self) -> std::string::String {
5211        use std::clone::Clone;
5212        self.next_page_token.clone()
5213    }
5214}
5215
5216/// Request message for
5217/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5218///
5219/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5220#[derive(Clone, Default, PartialEq)]
5221#[non_exhaustive]
5222pub struct GetSingleTenantHsmInstanceRequest {
5223    /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5224    /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5225    /// to get.
5226    ///
5227    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5228    /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5229    pub name: std::string::String,
5230
5231    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5232}
5233
5234impl GetSingleTenantHsmInstanceRequest {
5235    pub fn new() -> Self {
5236        std::default::Default::default()
5237    }
5238
5239    /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5240    ///
5241    /// # Example
5242    /// ```ignore,no_run
5243    /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5244    /// let x = GetSingleTenantHsmInstanceRequest::new().set_name("example");
5245    /// ```
5246    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5247        self.name = v.into();
5248        self
5249    }
5250}
5251
5252impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5253    fn typename() -> &'static str {
5254        "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5255    }
5256}
5257
5258/// Request message for
5259/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5260///
5261/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5262#[derive(Clone, Default, PartialEq)]
5263#[non_exhaustive]
5264pub struct CreateSingleTenantHsmInstanceRequest {
5265    /// Required. The resource name of the location associated with the
5266    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5267    /// the format `projects/*/locations/*`.
5268    ///
5269    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5270    pub parent: std::string::String,
5271
5272    /// Optional. It must be unique within a location and match the regular
5273    /// expression `[a-zA-Z0-9_-]{1,63}`.
5274    pub single_tenant_hsm_instance_id: std::string::String,
5275
5276    /// Required. An
5277    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5278    /// initial field values.
5279    ///
5280    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5281    pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5282
5283    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5284}
5285
5286impl CreateSingleTenantHsmInstanceRequest {
5287    pub fn new() -> Self {
5288        std::default::Default::default()
5289    }
5290
5291    /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5292    ///
5293    /// # Example
5294    /// ```ignore,no_run
5295    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5296    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5297    /// ```
5298    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5299        self.parent = v.into();
5300        self
5301    }
5302
5303    /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5304    ///
5305    /// # Example
5306    /// ```ignore,no_run
5307    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5308    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5309    /// ```
5310    pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5311        mut self,
5312        v: T,
5313    ) -> Self {
5314        self.single_tenant_hsm_instance_id = v.into();
5315        self
5316    }
5317
5318    /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5319    ///
5320    /// # Example
5321    /// ```ignore,no_run
5322    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5323    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5324    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5325    /// ```
5326    pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5327    where
5328        T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5329    {
5330        self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5331        self
5332    }
5333
5334    /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5335    ///
5336    /// # Example
5337    /// ```ignore,no_run
5338    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5339    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5340    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5341    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5342    /// ```
5343    pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5344    where
5345        T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5346    {
5347        self.single_tenant_hsm_instance = v.map(|x| x.into());
5348        self
5349    }
5350}
5351
5352impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5353    fn typename() -> &'static str {
5354        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5355    }
5356}
5357
5358/// Metadata message for
5359/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5360/// long-running operation response.
5361///
5362/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5363#[derive(Clone, Default, PartialEq)]
5364#[non_exhaustive]
5365pub struct CreateSingleTenantHsmInstanceMetadata {
5366    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5367}
5368
5369impl CreateSingleTenantHsmInstanceMetadata {
5370    pub fn new() -> Self {
5371        std::default::Default::default()
5372    }
5373}
5374
5375impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5376    fn typename() -> &'static str {
5377        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5378    }
5379}
5380
5381/// Request message for
5382/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5383///
5384/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5385#[derive(Clone, Default, PartialEq)]
5386#[non_exhaustive]
5387pub struct CreateSingleTenantHsmInstanceProposalRequest {
5388    /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5389    /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5390    /// associated with the
5391    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5392    ///
5393    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5394    /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5395    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5396    pub parent: std::string::String,
5397
5398    /// Optional. It must be unique within a location and match the regular
5399    /// expression `[a-zA-Z0-9_-]{1,63}`.
5400    pub single_tenant_hsm_instance_proposal_id: std::string::String,
5401
5402    /// Required. The
5403    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5404    /// to create.
5405    ///
5406    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5407    pub single_tenant_hsm_instance_proposal:
5408        std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5409
5410    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5411}
5412
5413impl CreateSingleTenantHsmInstanceProposalRequest {
5414    pub fn new() -> Self {
5415        std::default::Default::default()
5416    }
5417
5418    /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5419    ///
5420    /// # Example
5421    /// ```ignore,no_run
5422    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5423    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent("example");
5424    /// ```
5425    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5426        self.parent = v.into();
5427        self
5428    }
5429
5430    /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5431    ///
5432    /// # Example
5433    /// ```ignore,no_run
5434    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5435    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5436    /// ```
5437    pub fn set_single_tenant_hsm_instance_proposal_id<
5438        T: std::convert::Into<std::string::String>,
5439    >(
5440        mut self,
5441        v: T,
5442    ) -> Self {
5443        self.single_tenant_hsm_instance_proposal_id = v.into();
5444        self
5445    }
5446
5447    /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5448    ///
5449    /// # Example
5450    /// ```ignore,no_run
5451    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5452    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5453    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5454    /// ```
5455    pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5456    where
5457        T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5458    {
5459        self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5460        self
5461    }
5462
5463    /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5464    ///
5465    /// # Example
5466    /// ```ignore,no_run
5467    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5468    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5469    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5470    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5471    /// ```
5472    pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5473        mut self,
5474        v: std::option::Option<T>,
5475    ) -> Self
5476    where
5477        T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5478    {
5479        self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5480        self
5481    }
5482}
5483
5484impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5485    fn typename() -> &'static str {
5486        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5487    }
5488}
5489
5490/// Metadata message for
5491/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5492/// long-running operation response.
5493///
5494/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5495#[derive(Clone, Default, PartialEq)]
5496#[non_exhaustive]
5497pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5498    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5499}
5500
5501impl CreateSingleTenantHsmInstanceProposalMetadata {
5502    pub fn new() -> Self {
5503        std::default::Default::default()
5504    }
5505}
5506
5507impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5508    fn typename() -> &'static str {
5509        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5510    }
5511}
5512
5513/// Request message for
5514/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5515///
5516/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5517#[derive(Clone, Default, PartialEq)]
5518#[non_exhaustive]
5519pub struct GetSingleTenantHsmInstanceProposalRequest {
5520    /// Required. The
5521    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5522    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5523    /// to get.
5524    ///
5525    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5526    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5527    pub name: std::string::String,
5528
5529    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5530}
5531
5532impl GetSingleTenantHsmInstanceProposalRequest {
5533    pub fn new() -> Self {
5534        std::default::Default::default()
5535    }
5536
5537    /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5538    ///
5539    /// # Example
5540    /// ```ignore,no_run
5541    /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5542    /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5543    /// ```
5544    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5545        self.name = v.into();
5546        self
5547    }
5548}
5549
5550impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5551    fn typename() -> &'static str {
5552        "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5553    }
5554}
5555
5556/// Request message for
5557/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5558///
5559/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5560#[derive(Clone, Default, PartialEq)]
5561#[non_exhaustive]
5562pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5563    /// Required. The
5564    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5565    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5566    /// to approve.
5567    ///
5568    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5569    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5570    pub name: std::string::String,
5571
5572    /// The approval payload. The type of approval payload must correspond to the
5573    /// type of approval_parameters in the proposal.
5574    pub approval_payload: std::option::Option<
5575        crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5576    >,
5577
5578    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5579}
5580
5581impl ApproveSingleTenantHsmInstanceProposalRequest {
5582    pub fn new() -> Self {
5583        std::default::Default::default()
5584    }
5585
5586    /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5587    ///
5588    /// # Example
5589    /// ```ignore,no_run
5590    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5591    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5592    /// ```
5593    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5594        self.name = v.into();
5595        self
5596    }
5597
5598    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5599    ///
5600    /// Note that all the setters affecting `approval_payload` are mutually
5601    /// exclusive.
5602    ///
5603    /// # Example
5604    /// ```ignore,no_run
5605    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5606    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5607    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5608    ///     google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5609    /// ```
5610    pub fn set_approval_payload<T: std::convert::Into<std::option::Option<crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload>>>(mut self, v: T) -> Self
5611    {
5612        self.approval_payload = v.into();
5613        self
5614    }
5615
5616    /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5617    /// if it holds a `QuorumReply`, `None` if the field is not set or
5618    /// holds a different branch.
5619    pub fn quorum_reply(
5620        &self,
5621    ) -> std::option::Option<
5622        &std::boxed::Box<
5623            crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5624        >,
5625    > {
5626        #[allow(unreachable_patterns)]
5627        self.approval_payload.as_ref().and_then(|v| match v {
5628            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5629            _ => std::option::Option::None,
5630        })
5631    }
5632
5633    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5634    /// to hold a `QuorumReply`.
5635    ///
5636    /// Note that all the setters affecting `approval_payload` are
5637    /// mutually exclusive.
5638    ///
5639    /// # Example
5640    /// ```ignore,no_run
5641    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5642    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5643    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5644    /// assert!(x.quorum_reply().is_some());
5645    /// assert!(x.required_action_quorum_reply().is_none());
5646    /// ```
5647    pub fn set_quorum_reply<
5648        T: std::convert::Into<
5649                std::boxed::Box<
5650                    crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5651                >,
5652            >,
5653    >(
5654        mut self,
5655        v: T,
5656    ) -> Self {
5657        self.approval_payload = std::option::Option::Some(
5658            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5659                v.into()
5660            )
5661        );
5662        self
5663    }
5664
5665    /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5666    /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5667    /// holds a different branch.
5668    pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5669        #[allow(unreachable_patterns)]
5670        self.approval_payload.as_ref().and_then(|v| match v {
5671            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5672            _ => std::option::Option::None,
5673        })
5674    }
5675
5676    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5677    /// to hold a `RequiredActionQuorumReply`.
5678    ///
5679    /// Note that all the setters affecting `approval_payload` are
5680    /// mutually exclusive.
5681    ///
5682    /// # Example
5683    /// ```ignore,no_run
5684    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5685    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5686    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5687    /// assert!(x.required_action_quorum_reply().is_some());
5688    /// assert!(x.quorum_reply().is_none());
5689    /// ```
5690    pub fn set_required_action_quorum_reply<T: std::convert::Into<std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>>(mut self, v: T) -> Self{
5691        self.approval_payload = std::option::Option::Some(
5692            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5693                v.into()
5694            )
5695        );
5696        self
5697    }
5698}
5699
5700impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5701    fn typename() -> &'static str {
5702        "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5703    }
5704}
5705
5706/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5707pub mod approve_single_tenant_hsm_instance_proposal_request {
5708    #[allow(unused_imports)]
5709    use super::*;
5710
5711    /// The reply to
5712    /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5713    /// for approving the proposal.
5714    ///
5715    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5716    #[derive(Clone, Default, PartialEq)]
5717    #[non_exhaustive]
5718    pub struct QuorumReply {
5719        /// Required. The challenge replies to approve the proposal. Challenge
5720        /// replies can be sent across multiple requests. The proposal will be
5721        /// approved when
5722        /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5723        /// challenge replies are provided.
5724        ///
5725        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5726        pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5727
5728        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5729    }
5730
5731    impl QuorumReply {
5732        pub fn new() -> Self {
5733            std::default::Default::default()
5734        }
5735
5736        /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5737        ///
5738        /// # Example
5739        /// ```ignore,no_run
5740        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5741        /// use google_cloud_kms_v1::model::ChallengeReply;
5742        /// let x = QuorumReply::new()
5743        ///     .set_challenge_replies([
5744        ///         ChallengeReply::default()/* use setters */,
5745        ///         ChallengeReply::default()/* use (different) setters */,
5746        ///     ]);
5747        /// ```
5748        pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5749        where
5750            T: std::iter::IntoIterator<Item = V>,
5751            V: std::convert::Into<crate::model::ChallengeReply>,
5752        {
5753            use std::iter::Iterator;
5754            self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5755            self
5756        }
5757    }
5758
5759    impl wkt::message::Message for QuorumReply {
5760        fn typename() -> &'static str {
5761            "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
5762        }
5763    }
5764
5765    /// The reply to
5766    /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5767    /// for approving the proposal.
5768    ///
5769    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5770    #[derive(Clone, Default, PartialEq)]
5771    #[non_exhaustive]
5772    pub struct RequiredActionQuorumReply {
5773        /// Required. All required challenges must be signed for the proposal to be
5774        /// approved. These can be sent across multiple requests.
5775        pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5776
5777        /// Required. Quorum members' signed challenge replies. These can be provided
5778        /// across multiple requests. The proposal will be approved when
5779        /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
5780        /// quorum_challenge_replies are provided and when all
5781        /// required_challenge_replies are provided.
5782        ///
5783        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
5784        pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5785
5786        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5787    }
5788
5789    impl RequiredActionQuorumReply {
5790        pub fn new() -> Self {
5791            std::default::Default::default()
5792        }
5793
5794        /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
5795        ///
5796        /// # Example
5797        /// ```ignore,no_run
5798        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5799        /// use google_cloud_kms_v1::model::ChallengeReply;
5800        /// let x = RequiredActionQuorumReply::new()
5801        ///     .set_required_challenge_replies([
5802        ///         ChallengeReply::default()/* use setters */,
5803        ///         ChallengeReply::default()/* use (different) setters */,
5804        ///     ]);
5805        /// ```
5806        pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
5807        where
5808            T: std::iter::IntoIterator<Item = V>,
5809            V: std::convert::Into<crate::model::ChallengeReply>,
5810        {
5811            use std::iter::Iterator;
5812            self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5813            self
5814        }
5815
5816        /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
5817        ///
5818        /// # Example
5819        /// ```ignore,no_run
5820        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5821        /// use google_cloud_kms_v1::model::ChallengeReply;
5822        /// let x = RequiredActionQuorumReply::new()
5823        ///     .set_quorum_challenge_replies([
5824        ///         ChallengeReply::default()/* use setters */,
5825        ///         ChallengeReply::default()/* use (different) setters */,
5826        ///     ]);
5827        /// ```
5828        pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
5829        where
5830            T: std::iter::IntoIterator<Item = V>,
5831            V: std::convert::Into<crate::model::ChallengeReply>,
5832        {
5833            use std::iter::Iterator;
5834            self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5835            self
5836        }
5837    }
5838
5839    impl wkt::message::Message for RequiredActionQuorumReply {
5840        fn typename() -> &'static str {
5841            "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
5842        }
5843    }
5844
5845    /// The approval payload. The type of approval payload must correspond to the
5846    /// type of approval_parameters in the proposal.
5847    #[derive(Clone, Debug, PartialEq)]
5848    #[non_exhaustive]
5849    pub enum ApprovalPayload {
5850        /// Required. The reply to
5851        /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5852        /// for approving the proposal.
5853        ///
5854        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5855        QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
5856        /// Required. The reply to
5857        /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5858        /// for approving the proposal.
5859        ///
5860        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5861        RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
5862    }
5863}
5864
5865/// Response message for
5866/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5867///
5868/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5869#[derive(Clone, Default, PartialEq)]
5870#[non_exhaustive]
5871pub struct ApproveSingleTenantHsmInstanceProposalResponse {
5872    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5873}
5874
5875impl ApproveSingleTenantHsmInstanceProposalResponse {
5876    pub fn new() -> Self {
5877        std::default::Default::default()
5878    }
5879}
5880
5881impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
5882    fn typename() -> &'static str {
5883        "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
5884    }
5885}
5886
5887/// Request message for
5888/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5889///
5890/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5891#[derive(Clone, Default, PartialEq)]
5892#[non_exhaustive]
5893pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
5894    /// Required. The
5895    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5896    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5897    /// to execute.
5898    ///
5899    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5900    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5901    pub name: std::string::String,
5902
5903    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5904}
5905
5906impl ExecuteSingleTenantHsmInstanceProposalRequest {
5907    pub fn new() -> Self {
5908        std::default::Default::default()
5909    }
5910
5911    /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
5912    ///
5913    /// # Example
5914    /// ```ignore,no_run
5915    /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
5916    /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5917    /// ```
5918    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5919        self.name = v.into();
5920        self
5921    }
5922}
5923
5924impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
5925    fn typename() -> &'static str {
5926        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
5927    }
5928}
5929
5930/// Response message for
5931/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5932///
5933/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5934#[derive(Clone, Default, PartialEq)]
5935#[non_exhaustive]
5936pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
5937    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5938}
5939
5940impl ExecuteSingleTenantHsmInstanceProposalResponse {
5941    pub fn new() -> Self {
5942        std::default::Default::default()
5943    }
5944}
5945
5946impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
5947    fn typename() -> &'static str {
5948        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
5949    }
5950}
5951
5952/// Metadata message for
5953/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
5954/// long-running operation response.
5955///
5956/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5957#[derive(Clone, Default, PartialEq)]
5958#[non_exhaustive]
5959pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
5960    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5961}
5962
5963impl ExecuteSingleTenantHsmInstanceProposalMetadata {
5964    pub fn new() -> Self {
5965        std::default::Default::default()
5966    }
5967}
5968
5969impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
5970    fn typename() -> &'static str {
5971        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
5972    }
5973}
5974
5975/// Request message for
5976/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
5977///
5978/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5979#[derive(Clone, Default, PartialEq)]
5980#[non_exhaustive]
5981pub struct ListSingleTenantHsmInstanceProposalsRequest {
5982    /// Required. The resource name of the single tenant HSM instance associated
5983    /// with the
5984    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5985    /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
5986    ///
5987    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5988    pub parent: std::string::String,
5989
5990    /// Optional. Optional limit on the number of
5991    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5992    /// to include in the response. Further
5993    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5994    /// can subsequently be obtained by including the
5995    /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
5996    /// in a subsequent request. If unspecified, the server will pick an
5997    /// appropriate default.
5998    ///
5999    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6000    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6001    pub page_size: i32,
6002
6003    /// Optional. Optional pagination token, returned earlier via
6004    /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
6005    ///
6006    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6007    pub page_token: std::string::String,
6008
6009    /// Optional. Only include resources that match the filter in the response. For
6010    /// more information, see
6011    /// [Sorting and filtering list
6012    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6013    pub filter: std::string::String,
6014
6015    /// Optional. Specify how the results should be sorted. If not specified, the
6016    /// results will be sorted in the default order.  For more information, see
6017    /// [Sorting and filtering list
6018    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6019    pub order_by: std::string::String,
6020
6021    /// Optional. If set to true,
6022    /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
6023    /// will also return
6024    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6025    /// in DELETED state.
6026    ///
6027    /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6028    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6029    pub show_deleted: bool,
6030
6031    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6032}
6033
6034impl ListSingleTenantHsmInstanceProposalsRequest {
6035    pub fn new() -> Self {
6036        std::default::Default::default()
6037    }
6038
6039    /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
6040    ///
6041    /// # Example
6042    /// ```ignore,no_run
6043    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6044    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent("example");
6045    /// ```
6046    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6047        self.parent = v.into();
6048        self
6049    }
6050
6051    /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
6052    ///
6053    /// # Example
6054    /// ```ignore,no_run
6055    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6056    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
6057    /// ```
6058    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6059        self.page_size = v.into();
6060        self
6061    }
6062
6063    /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
6064    ///
6065    /// # Example
6066    /// ```ignore,no_run
6067    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6068    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
6069    /// ```
6070    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6071        self.page_token = v.into();
6072        self
6073    }
6074
6075    /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
6076    ///
6077    /// # Example
6078    /// ```ignore,no_run
6079    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6080    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
6081    /// ```
6082    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6083        self.filter = v.into();
6084        self
6085    }
6086
6087    /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
6088    ///
6089    /// # Example
6090    /// ```ignore,no_run
6091    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6092    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
6093    /// ```
6094    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6095        self.order_by = v.into();
6096        self
6097    }
6098
6099    /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
6100    ///
6101    /// # Example
6102    /// ```ignore,no_run
6103    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6104    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
6105    /// ```
6106    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6107        self.show_deleted = v.into();
6108        self
6109    }
6110}
6111
6112impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
6113    fn typename() -> &'static str {
6114        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
6115    }
6116}
6117
6118/// Response message for
6119/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6120///
6121/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6122#[derive(Clone, Default, PartialEq)]
6123#[non_exhaustive]
6124pub struct ListSingleTenantHsmInstanceProposalsResponse {
6125    /// The list of
6126    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
6127    ///
6128    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6129    pub single_tenant_hsm_instance_proposals:
6130        std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
6131
6132    /// A token to retrieve next page of results. Pass this value in
6133    /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
6134    /// to retrieve the next page of results.
6135    ///
6136    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
6137    pub next_page_token: std::string::String,
6138
6139    /// The total number of
6140    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6141    /// that matched the query.
6142    ///
6143    /// This field is not populated if
6144    /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
6145    /// is applied.
6146    ///
6147    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
6148    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6149    pub total_size: i32,
6150
6151    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6152}
6153
6154impl ListSingleTenantHsmInstanceProposalsResponse {
6155    pub fn new() -> Self {
6156        std::default::Default::default()
6157    }
6158
6159    /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
6160    ///
6161    /// # Example
6162    /// ```ignore,no_run
6163    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6164    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
6165    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
6166    ///     .set_single_tenant_hsm_instance_proposals([
6167    ///         SingleTenantHsmInstanceProposal::default()/* use setters */,
6168    ///         SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
6169    ///     ]);
6170    /// ```
6171    pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
6172    where
6173        T: std::iter::IntoIterator<Item = V>,
6174        V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
6175    {
6176        use std::iter::Iterator;
6177        self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
6178        self
6179    }
6180
6181    /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
6182    ///
6183    /// # Example
6184    /// ```ignore,no_run
6185    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6186    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
6187    /// ```
6188    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6189        self.next_page_token = v.into();
6190        self
6191    }
6192
6193    /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
6194    ///
6195    /// # Example
6196    /// ```ignore,no_run
6197    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6198    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6199    /// ```
6200    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6201        self.total_size = v.into();
6202        self
6203    }
6204}
6205
6206impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6207    fn typename() -> &'static str {
6208        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6209    }
6210}
6211
6212#[doc(hidden)]
6213impl google_cloud_gax::paginator::internal::PageableResponse
6214    for ListSingleTenantHsmInstanceProposalsResponse
6215{
6216    type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6217
6218    fn items(self) -> std::vec::Vec<Self::PageItem> {
6219        self.single_tenant_hsm_instance_proposals
6220    }
6221
6222    fn next_page_token(&self) -> std::string::String {
6223        use std::clone::Clone;
6224        self.next_page_token.clone()
6225    }
6226}
6227
6228/// Request message for
6229/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6230///
6231/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6232#[derive(Clone, Default, PartialEq)]
6233#[non_exhaustive]
6234pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6235    /// Required. The
6236    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6237    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6238    /// to delete.
6239    ///
6240    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6241    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6242    pub name: std::string::String,
6243
6244    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6245}
6246
6247impl DeleteSingleTenantHsmInstanceProposalRequest {
6248    pub fn new() -> Self {
6249        std::default::Default::default()
6250    }
6251
6252    /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6253    ///
6254    /// # Example
6255    /// ```ignore,no_run
6256    /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6257    /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
6258    /// ```
6259    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6260        self.name = v.into();
6261        self
6262    }
6263}
6264
6265impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6266    fn typename() -> &'static str {
6267        "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6268    }
6269}
6270
6271/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6272/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6273///
6274/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6275/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6276#[derive(Clone, Default, PartialEq)]
6277#[non_exhaustive]
6278pub struct KeyRing {
6279    /// Output only. The resource name for the
6280    /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6281    /// `projects/*/locations/*/keyRings/*`.
6282    ///
6283    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6284    pub name: std::string::String,
6285
6286    /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6287    /// was created.
6288    ///
6289    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6290    pub create_time: std::option::Option<wkt::Timestamp>,
6291
6292    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6293}
6294
6295impl KeyRing {
6296    pub fn new() -> Self {
6297        std::default::Default::default()
6298    }
6299
6300    /// Sets the value of [name][crate::model::KeyRing::name].
6301    ///
6302    /// # Example
6303    /// ```ignore,no_run
6304    /// # use google_cloud_kms_v1::model::KeyRing;
6305    /// let x = KeyRing::new().set_name("example");
6306    /// ```
6307    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6308        self.name = v.into();
6309        self
6310    }
6311
6312    /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6313    ///
6314    /// # Example
6315    /// ```ignore,no_run
6316    /// # use google_cloud_kms_v1::model::KeyRing;
6317    /// use wkt::Timestamp;
6318    /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6319    /// ```
6320    pub fn set_create_time<T>(mut self, v: T) -> Self
6321    where
6322        T: std::convert::Into<wkt::Timestamp>,
6323    {
6324        self.create_time = std::option::Option::Some(v.into());
6325        self
6326    }
6327
6328    /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6329    ///
6330    /// # Example
6331    /// ```ignore,no_run
6332    /// # use google_cloud_kms_v1::model::KeyRing;
6333    /// use wkt::Timestamp;
6334    /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6335    /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6336    /// ```
6337    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6338    where
6339        T: std::convert::Into<wkt::Timestamp>,
6340    {
6341        self.create_time = v.map(|x| x.into());
6342        self
6343    }
6344}
6345
6346impl wkt::message::Message for KeyRing {
6347    fn typename() -> &'static str {
6348        "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6349    }
6350}
6351
6352/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6353/// can be used for cryptographic operations.
6354///
6355/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6356/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6357/// key material used in cryptographic operations.
6358///
6359/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6360/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6361#[derive(Clone, Default, PartialEq)]
6362#[non_exhaustive]
6363pub struct CryptoKey {
6364    /// Output only. The resource name for this
6365    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6366    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6367    ///
6368    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6369    pub name: std::string::String,
6370
6371    /// Output only. A copy of the "primary"
6372    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6373    /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6374    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6375    /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6376    ///
6377    /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6378    /// updated via
6379    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6380    ///
6381    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6382    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6383    /// may have a primary. For other keys, this field will be omitted.
6384    ///
6385    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6386    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6387    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6388    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6389    /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6390    /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6391    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6392    pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6393
6394    /// Immutable. The immutable purpose of this
6395    /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6396    ///
6397    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6398    pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6399
6400    /// Output only. The time at which this
6401    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6402    ///
6403    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6404    pub create_time: std::option::Option<wkt::Timestamp>,
6405
6406    /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6407    /// the Key Management Service will automatically:
6408    ///
6409    /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6410    /// 1. Mark the new version as primary.
6411    ///
6412    /// Key rotations performed manually via
6413    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6414    /// and
6415    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6416    /// do not affect
6417    /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6418    ///
6419    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6420    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6421    /// support automatic rotation. For other keys, this field must be omitted.
6422    ///
6423    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6424    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6425    /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6426    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6427    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6428    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6429    pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6430
6431    /// A template describing settings for new
6432    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6433    /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6434    /// instances created by either
6435    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6436    /// or auto-rotation are controlled by this template.
6437    ///
6438    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6439    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6440    pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6441
6442    /// Labels with user-defined metadata. For more information, see
6443    /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6444    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6445
6446    /// Immutable. Whether this key may contain imported versions only.
6447    pub import_only: bool,
6448
6449    /// Immutable. The period of time that versions of this key spend in the
6450    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6451    /// state before transitioning to
6452    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6453    /// If not specified at creation time, the default duration is 30 days.
6454    ///
6455    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6456    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6457    pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6458
6459    /// Immutable. The resource name of the backend environment where the key
6460    /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6461    /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6462    /// where all related cryptographic operations are performed. Only applicable
6463    /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6464    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6465    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6466    /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6467    /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6468    /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6469    /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6470    /// with the resource name in the format
6471    /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6472    /// Note, this list is non-exhaustive and may apply to additional
6473    /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6474    ///
6475    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6476    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6477    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6478    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6479    /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6480    pub crypto_key_backend: std::string::String,
6481
6482    /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6483    /// If this field is present and this key is enrolled in Key Access
6484    /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6485    /// decrypt, and sign operations, and the operation will fail if rejected by
6486    /// the policy. The policy is defined by specifying zero or more allowed
6487    /// justification codes.
6488    /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6489    /// By default, this field is absent, and all justification codes are allowed.
6490    pub key_access_justifications_policy:
6491        std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6492
6493    /// Controls the rate of automatic rotation.
6494    pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6495
6496    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6497}
6498
6499impl CryptoKey {
6500    pub fn new() -> Self {
6501        std::default::Default::default()
6502    }
6503
6504    /// Sets the value of [name][crate::model::CryptoKey::name].
6505    ///
6506    /// # Example
6507    /// ```ignore,no_run
6508    /// # use google_cloud_kms_v1::model::CryptoKey;
6509    /// let x = CryptoKey::new().set_name("example");
6510    /// ```
6511    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6512        self.name = v.into();
6513        self
6514    }
6515
6516    /// Sets the value of [primary][crate::model::CryptoKey::primary].
6517    ///
6518    /// # Example
6519    /// ```ignore,no_run
6520    /// # use google_cloud_kms_v1::model::CryptoKey;
6521    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6522    /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6523    /// ```
6524    pub fn set_primary<T>(mut self, v: T) -> Self
6525    where
6526        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6527    {
6528        self.primary = std::option::Option::Some(v.into());
6529        self
6530    }
6531
6532    /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6533    ///
6534    /// # Example
6535    /// ```ignore,no_run
6536    /// # use google_cloud_kms_v1::model::CryptoKey;
6537    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6538    /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6539    /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6540    /// ```
6541    pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6542    where
6543        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6544    {
6545        self.primary = v.map(|x| x.into());
6546        self
6547    }
6548
6549    /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6550    ///
6551    /// # Example
6552    /// ```ignore,no_run
6553    /// # use google_cloud_kms_v1::model::CryptoKey;
6554    /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6555    /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6556    /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6557    /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6558    /// ```
6559    pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6560        mut self,
6561        v: T,
6562    ) -> Self {
6563        self.purpose = v.into();
6564        self
6565    }
6566
6567    /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6568    ///
6569    /// # Example
6570    /// ```ignore,no_run
6571    /// # use google_cloud_kms_v1::model::CryptoKey;
6572    /// use wkt::Timestamp;
6573    /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6574    /// ```
6575    pub fn set_create_time<T>(mut self, v: T) -> Self
6576    where
6577        T: std::convert::Into<wkt::Timestamp>,
6578    {
6579        self.create_time = std::option::Option::Some(v.into());
6580        self
6581    }
6582
6583    /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6584    ///
6585    /// # Example
6586    /// ```ignore,no_run
6587    /// # use google_cloud_kms_v1::model::CryptoKey;
6588    /// use wkt::Timestamp;
6589    /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6590    /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6591    /// ```
6592    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6593    where
6594        T: std::convert::Into<wkt::Timestamp>,
6595    {
6596        self.create_time = v.map(|x| x.into());
6597        self
6598    }
6599
6600    /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6601    ///
6602    /// # Example
6603    /// ```ignore,no_run
6604    /// # use google_cloud_kms_v1::model::CryptoKey;
6605    /// use wkt::Timestamp;
6606    /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6607    /// ```
6608    pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6609    where
6610        T: std::convert::Into<wkt::Timestamp>,
6611    {
6612        self.next_rotation_time = std::option::Option::Some(v.into());
6613        self
6614    }
6615
6616    /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6617    ///
6618    /// # Example
6619    /// ```ignore,no_run
6620    /// # use google_cloud_kms_v1::model::CryptoKey;
6621    /// use wkt::Timestamp;
6622    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6623    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6624    /// ```
6625    pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6626    where
6627        T: std::convert::Into<wkt::Timestamp>,
6628    {
6629        self.next_rotation_time = v.map(|x| x.into());
6630        self
6631    }
6632
6633    /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6634    ///
6635    /// # Example
6636    /// ```ignore,no_run
6637    /// # use google_cloud_kms_v1::model::CryptoKey;
6638    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6639    /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6640    /// ```
6641    pub fn set_version_template<T>(mut self, v: T) -> Self
6642    where
6643        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6644    {
6645        self.version_template = std::option::Option::Some(v.into());
6646        self
6647    }
6648
6649    /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6650    ///
6651    /// # Example
6652    /// ```ignore,no_run
6653    /// # use google_cloud_kms_v1::model::CryptoKey;
6654    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6655    /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6656    /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6657    /// ```
6658    pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6659    where
6660        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6661    {
6662        self.version_template = v.map(|x| x.into());
6663        self
6664    }
6665
6666    /// Sets the value of [labels][crate::model::CryptoKey::labels].
6667    ///
6668    /// # Example
6669    /// ```ignore,no_run
6670    /// # use google_cloud_kms_v1::model::CryptoKey;
6671    /// let x = CryptoKey::new().set_labels([
6672    ///     ("key0", "abc"),
6673    ///     ("key1", "xyz"),
6674    /// ]);
6675    /// ```
6676    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6677    where
6678        T: std::iter::IntoIterator<Item = (K, V)>,
6679        K: std::convert::Into<std::string::String>,
6680        V: std::convert::Into<std::string::String>,
6681    {
6682        use std::iter::Iterator;
6683        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6684        self
6685    }
6686
6687    /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6688    ///
6689    /// # Example
6690    /// ```ignore,no_run
6691    /// # use google_cloud_kms_v1::model::CryptoKey;
6692    /// let x = CryptoKey::new().set_import_only(true);
6693    /// ```
6694    pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6695        self.import_only = v.into();
6696        self
6697    }
6698
6699    /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6700    ///
6701    /// # Example
6702    /// ```ignore,no_run
6703    /// # use google_cloud_kms_v1::model::CryptoKey;
6704    /// use wkt::Duration;
6705    /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6706    /// ```
6707    pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6708    where
6709        T: std::convert::Into<wkt::Duration>,
6710    {
6711        self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6712        self
6713    }
6714
6715    /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6716    ///
6717    /// # Example
6718    /// ```ignore,no_run
6719    /// # use google_cloud_kms_v1::model::CryptoKey;
6720    /// use wkt::Duration;
6721    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6722    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6723    /// ```
6724    pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
6725    where
6726        T: std::convert::Into<wkt::Duration>,
6727    {
6728        self.destroy_scheduled_duration = v.map(|x| x.into());
6729        self
6730    }
6731
6732    /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
6733    ///
6734    /// # Example
6735    /// ```ignore,no_run
6736    /// # use google_cloud_kms_v1::model::CryptoKey;
6737    /// let x = CryptoKey::new().set_crypto_key_backend("example");
6738    /// ```
6739    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
6740        mut self,
6741        v: T,
6742    ) -> Self {
6743        self.crypto_key_backend = v.into();
6744        self
6745    }
6746
6747    /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6748    ///
6749    /// # Example
6750    /// ```ignore,no_run
6751    /// # use google_cloud_kms_v1::model::CryptoKey;
6752    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6753    /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
6754    /// ```
6755    pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
6756    where
6757        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6758    {
6759        self.key_access_justifications_policy = std::option::Option::Some(v.into());
6760        self
6761    }
6762
6763    /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6764    ///
6765    /// # Example
6766    /// ```ignore,no_run
6767    /// # use google_cloud_kms_v1::model::CryptoKey;
6768    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6769    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
6770    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
6771    /// ```
6772    pub fn set_or_clear_key_access_justifications_policy<T>(
6773        mut self,
6774        v: std::option::Option<T>,
6775    ) -> Self
6776    where
6777        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6778    {
6779        self.key_access_justifications_policy = v.map(|x| x.into());
6780        self
6781    }
6782
6783    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
6784    ///
6785    /// Note that all the setters affecting `rotation_schedule` are mutually
6786    /// exclusive.
6787    ///
6788    /// # Example
6789    /// ```ignore,no_run
6790    /// # use google_cloud_kms_v1::model::CryptoKey;
6791    /// use wkt::Duration;
6792    /// let x = CryptoKey::new().set_rotation_schedule(Some(
6793    ///     google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
6794    /// ```
6795    pub fn set_rotation_schedule<
6796        T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
6797    >(
6798        mut self,
6799        v: T,
6800    ) -> Self {
6801        self.rotation_schedule = v.into();
6802        self
6803    }
6804
6805    /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6806    /// if it holds a `RotationPeriod`, `None` if the field is not set or
6807    /// holds a different branch.
6808    pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6809        #[allow(unreachable_patterns)]
6810        self.rotation_schedule.as_ref().and_then(|v| match v {
6811            crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
6812                std::option::Option::Some(v)
6813            }
6814            _ => std::option::Option::None,
6815        })
6816    }
6817
6818    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6819    /// to hold a `RotationPeriod`.
6820    ///
6821    /// Note that all the setters affecting `rotation_schedule` are
6822    /// mutually exclusive.
6823    ///
6824    /// # Example
6825    /// ```ignore,no_run
6826    /// # use google_cloud_kms_v1::model::CryptoKey;
6827    /// use wkt::Duration;
6828    /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
6829    /// assert!(x.rotation_period().is_some());
6830    /// ```
6831    pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
6832        mut self,
6833        v: T,
6834    ) -> Self {
6835        self.rotation_schedule = std::option::Option::Some(
6836            crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
6837        );
6838        self
6839    }
6840}
6841
6842impl wkt::message::Message for CryptoKey {
6843    fn typename() -> &'static str {
6844        "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
6845    }
6846}
6847
6848/// Defines additional types related to [CryptoKey].
6849pub mod crypto_key {
6850    #[allow(unused_imports)]
6851    use super::*;
6852
6853    /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
6854    /// describes the cryptographic capabilities of a
6855    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
6856    /// for the operations allowed by its purpose. For more information, see [Key
6857    /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
6858    ///
6859    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6860    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
6861    ///
6862    /// # Working with unknown values
6863    ///
6864    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6865    /// additional enum variants at any time. Adding new variants is not considered
6866    /// a breaking change. Applications should write their code in anticipation of:
6867    ///
6868    /// - New values appearing in future releases of the client library, **and**
6869    /// - New values received dynamically, without application changes.
6870    ///
6871    /// Please consult the [Working with enums] section in the user guide for some
6872    /// guidelines.
6873    ///
6874    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6875    #[derive(Clone, Debug, PartialEq)]
6876    #[non_exhaustive]
6877    pub enum CryptoKeyPurpose {
6878        /// Not specified.
6879        Unspecified,
6880        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6881        /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
6882        /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
6883        ///
6884        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6885        /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
6886        /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6887        EncryptDecrypt,
6888        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6889        /// with
6890        /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
6891        /// and
6892        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6893        ///
6894        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6895        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
6896        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6897        AsymmetricSign,
6898        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6899        /// with
6900        /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
6901        /// and
6902        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6903        ///
6904        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6905        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
6906        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6907        AsymmetricDecrypt,
6908        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6909        /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
6910        /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
6911        /// This purpose is meant to be used for interoperable symmetric
6912        /// encryption and does not support automatic CryptoKey rotation.
6913        ///
6914        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6915        /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
6916        /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
6917        RawEncryptDecrypt,
6918        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6919        /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
6920        ///
6921        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6922        /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
6923        Mac,
6924        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6925        /// with
6926        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
6927        /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
6928        ///
6929        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6930        /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
6931        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6932        KeyEncapsulation,
6933        /// If set, the enum was initialized with an unknown value.
6934        ///
6935        /// Applications can examine the value using [CryptoKeyPurpose::value] or
6936        /// [CryptoKeyPurpose::name].
6937        UnknownValue(crypto_key_purpose::UnknownValue),
6938    }
6939
6940    #[doc(hidden)]
6941    pub mod crypto_key_purpose {
6942        #[allow(unused_imports)]
6943        use super::*;
6944        #[derive(Clone, Debug, PartialEq)]
6945        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6946    }
6947
6948    impl CryptoKeyPurpose {
6949        /// Gets the enum value.
6950        ///
6951        /// Returns `None` if the enum contains an unknown value deserialized from
6952        /// the string representation of enums.
6953        pub fn value(&self) -> std::option::Option<i32> {
6954            match self {
6955                Self::Unspecified => std::option::Option::Some(0),
6956                Self::EncryptDecrypt => std::option::Option::Some(1),
6957                Self::AsymmetricSign => std::option::Option::Some(5),
6958                Self::AsymmetricDecrypt => std::option::Option::Some(6),
6959                Self::RawEncryptDecrypt => std::option::Option::Some(7),
6960                Self::Mac => std::option::Option::Some(9),
6961                Self::KeyEncapsulation => std::option::Option::Some(10),
6962                Self::UnknownValue(u) => u.0.value(),
6963            }
6964        }
6965
6966        /// Gets the enum value as a string.
6967        ///
6968        /// Returns `None` if the enum contains an unknown value deserialized from
6969        /// the integer representation of enums.
6970        pub fn name(&self) -> std::option::Option<&str> {
6971            match self {
6972                Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
6973                Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
6974                Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
6975                Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
6976                Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
6977                Self::Mac => std::option::Option::Some("MAC"),
6978                Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
6979                Self::UnknownValue(u) => u.0.name(),
6980            }
6981        }
6982    }
6983
6984    impl std::default::Default for CryptoKeyPurpose {
6985        fn default() -> Self {
6986            use std::convert::From;
6987            Self::from(0)
6988        }
6989    }
6990
6991    impl std::fmt::Display for CryptoKeyPurpose {
6992        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6993            wkt::internal::display_enum(f, self.name(), self.value())
6994        }
6995    }
6996
6997    impl std::convert::From<i32> for CryptoKeyPurpose {
6998        fn from(value: i32) -> Self {
6999            match value {
7000                0 => Self::Unspecified,
7001                1 => Self::EncryptDecrypt,
7002                5 => Self::AsymmetricSign,
7003                6 => Self::AsymmetricDecrypt,
7004                7 => Self::RawEncryptDecrypt,
7005                9 => Self::Mac,
7006                10 => Self::KeyEncapsulation,
7007                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7008                    wkt::internal::UnknownEnumValue::Integer(value),
7009                )),
7010            }
7011        }
7012    }
7013
7014    impl std::convert::From<&str> for CryptoKeyPurpose {
7015        fn from(value: &str) -> Self {
7016            use std::string::ToString;
7017            match value {
7018                "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
7019                "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
7020                "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
7021                "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
7022                "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
7023                "MAC" => Self::Mac,
7024                "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
7025                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7026                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7027                )),
7028            }
7029        }
7030    }
7031
7032    impl serde::ser::Serialize for CryptoKeyPurpose {
7033        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7034        where
7035            S: serde::Serializer,
7036        {
7037            match self {
7038                Self::Unspecified => serializer.serialize_i32(0),
7039                Self::EncryptDecrypt => serializer.serialize_i32(1),
7040                Self::AsymmetricSign => serializer.serialize_i32(5),
7041                Self::AsymmetricDecrypt => serializer.serialize_i32(6),
7042                Self::RawEncryptDecrypt => serializer.serialize_i32(7),
7043                Self::Mac => serializer.serialize_i32(9),
7044                Self::KeyEncapsulation => serializer.serialize_i32(10),
7045                Self::UnknownValue(u) => u.0.serialize(serializer),
7046            }
7047        }
7048    }
7049
7050    impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
7051        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7052        where
7053            D: serde::Deserializer<'de>,
7054        {
7055            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
7056                ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
7057            ))
7058        }
7059    }
7060
7061    /// Controls the rate of automatic rotation.
7062    #[derive(Clone, Debug, PartialEq)]
7063    #[non_exhaustive]
7064    pub enum RotationSchedule {
7065        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7066        /// will be advanced by this period when the service automatically rotates a
7067        /// key. Must be at least 24 hours and at most 876,000 hours.
7068        ///
7069        /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
7070        /// set,
7071        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7072        /// must also be set.
7073        ///
7074        /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
7075        /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
7076        /// support automatic rotation. For other keys, this field must be omitted.
7077        ///
7078        /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7079        /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
7080        /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7081        /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
7082        RotationPeriod(std::boxed::Box<wkt::Duration>),
7083    }
7084}
7085
7086/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
7087/// specifies the properties to use when creating a new
7088/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
7089/// with
7090/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
7091/// or automatically as a result of auto-rotation.
7092///
7093/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7094/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
7095/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7096#[derive(Clone, Default, PartialEq)]
7097#[non_exhaustive]
7098pub struct CryptoKeyVersionTemplate {
7099    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
7100    /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7101    /// template. Immutable. Defaults to
7102    /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
7103    ///
7104    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7105    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7106    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7107    pub protection_level: crate::model::ProtectionLevel,
7108
7109    /// Required.
7110    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7111    /// to use when creating a
7112    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7113    /// template.
7114    ///
7115    /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
7116    /// this field is omitted and
7117    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
7118    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7119    ///
7120    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7121    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7122    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7123    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7124    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7125
7126    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7127}
7128
7129impl CryptoKeyVersionTemplate {
7130    pub fn new() -> Self {
7131        std::default::Default::default()
7132    }
7133
7134    /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
7135    ///
7136    /// # Example
7137    /// ```ignore,no_run
7138    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7139    /// use google_cloud_kms_v1::model::ProtectionLevel;
7140    /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
7141    /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
7142    /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
7143    /// ```
7144    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7145        mut self,
7146        v: T,
7147    ) -> Self {
7148        self.protection_level = v.into();
7149        self
7150    }
7151
7152    /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
7153    ///
7154    /// # Example
7155    /// ```ignore,no_run
7156    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7157    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7158    /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7159    /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7160    /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7161    /// ```
7162    pub fn set_algorithm<
7163        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7164    >(
7165        mut self,
7166        v: T,
7167    ) -> Self {
7168        self.algorithm = v.into();
7169        self
7170    }
7171}
7172
7173impl wkt::message::Message for CryptoKeyVersionTemplate {
7174    fn typename() -> &'static str {
7175        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
7176    }
7177}
7178
7179/// Contains an HSM-generated attestation about a key operation. For more
7180/// information, see [Verifying attestations]
7181/// (<https://cloud.google.com/kms/docs/attest-key>).
7182#[derive(Clone, Default, PartialEq)]
7183#[non_exhaustive]
7184pub struct KeyOperationAttestation {
7185    /// Output only. The format of the attestation data.
7186    pub format: crate::model::key_operation_attestation::AttestationFormat,
7187
7188    /// Output only. The attestation data provided by the HSM when the key
7189    /// operation was performed.
7190    pub content: ::bytes::Bytes,
7191
7192    /// Output only. The certificate chains needed to validate the attestation
7193    pub cert_chains:
7194        std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
7195
7196    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7197}
7198
7199impl KeyOperationAttestation {
7200    pub fn new() -> Self {
7201        std::default::Default::default()
7202    }
7203
7204    /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7205    ///
7206    /// # Example
7207    /// ```ignore,no_run
7208    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7209    /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7210    /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7211    /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7212    /// ```
7213    pub fn set_format<
7214        T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7215    >(
7216        mut self,
7217        v: T,
7218    ) -> Self {
7219        self.format = v.into();
7220        self
7221    }
7222
7223    /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7224    ///
7225    /// # Example
7226    /// ```ignore,no_run
7227    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7228    /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7229    /// ```
7230    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7231        self.content = v.into();
7232        self
7233    }
7234
7235    /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7236    ///
7237    /// # Example
7238    /// ```ignore,no_run
7239    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7240    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7241    /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7242    /// ```
7243    pub fn set_cert_chains<T>(mut self, v: T) -> Self
7244    where
7245        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7246    {
7247        self.cert_chains = std::option::Option::Some(v.into());
7248        self
7249    }
7250
7251    /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7252    ///
7253    /// # Example
7254    /// ```ignore,no_run
7255    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7256    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7257    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7258    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7259    /// ```
7260    pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7261    where
7262        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7263    {
7264        self.cert_chains = v.map(|x| x.into());
7265        self
7266    }
7267}
7268
7269impl wkt::message::Message for KeyOperationAttestation {
7270    fn typename() -> &'static str {
7271        "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7272    }
7273}
7274
7275/// Defines additional types related to [KeyOperationAttestation].
7276pub mod key_operation_attestation {
7277    #[allow(unused_imports)]
7278    use super::*;
7279
7280    /// Certificate chains needed to verify the attestation.
7281    /// Certificates in chains are PEM-encoded and are ordered based on
7282    /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7283    #[derive(Clone, Default, PartialEq)]
7284    #[non_exhaustive]
7285    pub struct CertificateChains {
7286        /// Cavium certificate chain corresponding to the attestation.
7287        pub cavium_certs: std::vec::Vec<std::string::String>,
7288
7289        /// Google card certificate chain corresponding to the attestation.
7290        pub google_card_certs: std::vec::Vec<std::string::String>,
7291
7292        /// Google partition certificate chain corresponding to the attestation.
7293        pub google_partition_certs: std::vec::Vec<std::string::String>,
7294
7295        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7296    }
7297
7298    impl CertificateChains {
7299        pub fn new() -> Self {
7300            std::default::Default::default()
7301        }
7302
7303        /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7304        ///
7305        /// # Example
7306        /// ```ignore,no_run
7307        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7308        /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7309        /// ```
7310        pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7311        where
7312            T: std::iter::IntoIterator<Item = V>,
7313            V: std::convert::Into<std::string::String>,
7314        {
7315            use std::iter::Iterator;
7316            self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7317            self
7318        }
7319
7320        /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7321        ///
7322        /// # Example
7323        /// ```ignore,no_run
7324        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7325        /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7326        /// ```
7327        pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7328        where
7329            T: std::iter::IntoIterator<Item = V>,
7330            V: std::convert::Into<std::string::String>,
7331        {
7332            use std::iter::Iterator;
7333            self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7334            self
7335        }
7336
7337        /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7338        ///
7339        /// # Example
7340        /// ```ignore,no_run
7341        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7342        /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7343        /// ```
7344        pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7345        where
7346            T: std::iter::IntoIterator<Item = V>,
7347            V: std::convert::Into<std::string::String>,
7348        {
7349            use std::iter::Iterator;
7350            self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7351            self
7352        }
7353    }
7354
7355    impl wkt::message::Message for CertificateChains {
7356        fn typename() -> &'static str {
7357            "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7358        }
7359    }
7360
7361    /// Attestation formats provided by the HSM.
7362    ///
7363    /// # Working with unknown values
7364    ///
7365    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7366    /// additional enum variants at any time. Adding new variants is not considered
7367    /// a breaking change. Applications should write their code in anticipation of:
7368    ///
7369    /// - New values appearing in future releases of the client library, **and**
7370    /// - New values received dynamically, without application changes.
7371    ///
7372    /// Please consult the [Working with enums] section in the user guide for some
7373    /// guidelines.
7374    ///
7375    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7376    #[derive(Clone, Debug, PartialEq)]
7377    #[non_exhaustive]
7378    pub enum AttestationFormat {
7379        /// Not specified.
7380        Unspecified,
7381        /// Cavium HSM attestation compressed with gzip. Note that this format is
7382        /// defined by Cavium and subject to change at any time.
7383        ///
7384        /// See
7385        /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7386        CaviumV1Compressed,
7387        /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7388        /// introduced in Cavium's version 3.2-08.
7389        CaviumV2Compressed,
7390        /// If set, the enum was initialized with an unknown value.
7391        ///
7392        /// Applications can examine the value using [AttestationFormat::value] or
7393        /// [AttestationFormat::name].
7394        UnknownValue(attestation_format::UnknownValue),
7395    }
7396
7397    #[doc(hidden)]
7398    pub mod attestation_format {
7399        #[allow(unused_imports)]
7400        use super::*;
7401        #[derive(Clone, Debug, PartialEq)]
7402        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7403    }
7404
7405    impl AttestationFormat {
7406        /// Gets the enum value.
7407        ///
7408        /// Returns `None` if the enum contains an unknown value deserialized from
7409        /// the string representation of enums.
7410        pub fn value(&self) -> std::option::Option<i32> {
7411            match self {
7412                Self::Unspecified => std::option::Option::Some(0),
7413                Self::CaviumV1Compressed => std::option::Option::Some(3),
7414                Self::CaviumV2Compressed => std::option::Option::Some(4),
7415                Self::UnknownValue(u) => u.0.value(),
7416            }
7417        }
7418
7419        /// Gets the enum value as a string.
7420        ///
7421        /// Returns `None` if the enum contains an unknown value deserialized from
7422        /// the integer representation of enums.
7423        pub fn name(&self) -> std::option::Option<&str> {
7424            match self {
7425                Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7426                Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7427                Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7428                Self::UnknownValue(u) => u.0.name(),
7429            }
7430        }
7431    }
7432
7433    impl std::default::Default for AttestationFormat {
7434        fn default() -> Self {
7435            use std::convert::From;
7436            Self::from(0)
7437        }
7438    }
7439
7440    impl std::fmt::Display for AttestationFormat {
7441        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7442            wkt::internal::display_enum(f, self.name(), self.value())
7443        }
7444    }
7445
7446    impl std::convert::From<i32> for AttestationFormat {
7447        fn from(value: i32) -> Self {
7448            match value {
7449                0 => Self::Unspecified,
7450                3 => Self::CaviumV1Compressed,
7451                4 => Self::CaviumV2Compressed,
7452                _ => Self::UnknownValue(attestation_format::UnknownValue(
7453                    wkt::internal::UnknownEnumValue::Integer(value),
7454                )),
7455            }
7456        }
7457    }
7458
7459    impl std::convert::From<&str> for AttestationFormat {
7460        fn from(value: &str) -> Self {
7461            use std::string::ToString;
7462            match value {
7463                "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7464                "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7465                "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7466                _ => Self::UnknownValue(attestation_format::UnknownValue(
7467                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7468                )),
7469            }
7470        }
7471    }
7472
7473    impl serde::ser::Serialize for AttestationFormat {
7474        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7475        where
7476            S: serde::Serializer,
7477        {
7478            match self {
7479                Self::Unspecified => serializer.serialize_i32(0),
7480                Self::CaviumV1Compressed => serializer.serialize_i32(3),
7481                Self::CaviumV2Compressed => serializer.serialize_i32(4),
7482                Self::UnknownValue(u) => u.0.serialize(serializer),
7483            }
7484        }
7485    }
7486
7487    impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7488        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7489        where
7490            D: serde::Deserializer<'de>,
7491        {
7492            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7493                ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7494            ))
7495        }
7496    }
7497}
7498
7499/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7500/// individual cryptographic key, and the associated key material.
7501///
7502/// An
7503/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7504/// version can be used for cryptographic operations.
7505///
7506/// For security reasons, the raw cryptographic key material represented by a
7507/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7508/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7509/// authorized user or application invokes Cloud KMS.
7510///
7511/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7512/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7513#[derive(Clone, Default, PartialEq)]
7514#[non_exhaustive]
7515pub struct CryptoKeyVersion {
7516    /// Output only. The resource name for this
7517    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7518    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7519    ///
7520    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7521    pub name: std::string::String,
7522
7523    /// The current state of the
7524    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7525    ///
7526    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7527    pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7528
7529    /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7530    /// describing how crypto operations are performed with this
7531    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7532    ///
7533    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7534    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7535    pub protection_level: crate::model::ProtectionLevel,
7536
7537    /// Output only. The
7538    /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7539    /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7540    /// supports.
7541    ///
7542    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7543    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7544    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7545
7546    /// Output only. Statement that was generated and signed by the HSM at key
7547    /// creation time. Use this statement to verify attributes of the key as stored
7548    /// on the HSM, independently of Google. Only provided for key versions with
7549    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7550    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7551    ///
7552    /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7553    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7554    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7555
7556    /// Output only. The time at which this
7557    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7558    ///
7559    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7560    pub create_time: std::option::Option<wkt::Timestamp>,
7561
7562    /// Output only. The time this
7563    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7564    /// generated.
7565    ///
7566    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7567    pub generate_time: std::option::Option<wkt::Timestamp>,
7568
7569    /// Output only. The time this
7570    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7571    /// scheduled for destruction. Only present if
7572    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7573    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7574    ///
7575    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7576    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7577    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7578    pub destroy_time: std::option::Option<wkt::Timestamp>,
7579
7580    /// Output only. The time this CryptoKeyVersion's key material was
7581    /// destroyed. Only present if
7582    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7583    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7584    ///
7585    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7586    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7587    pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7588
7589    /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7590    /// used in the most recent import of this
7591    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7592    /// the underlying key material was imported.
7593    ///
7594    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7595    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7596    pub import_job: std::string::String,
7597
7598    /// Output only. The time at which this
7599    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7600    /// most recently imported.
7601    ///
7602    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7603    pub import_time: std::option::Option<wkt::Timestamp>,
7604
7605    /// Output only. The root cause of the most recent import failure. Only present
7606    /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7607    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7608    ///
7609    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7610    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7611    pub import_failure_reason: std::string::String,
7612
7613    /// Output only. The root cause of the most recent generation failure. Only
7614    /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7615    /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7616    ///
7617    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7618    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7619    pub generation_failure_reason: std::string::String,
7620
7621    /// Output only. The root cause of the most recent external destruction
7622    /// failure. Only present if
7623    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7624    /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7625    ///
7626    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7627    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7628    pub external_destruction_failure_reason: std::string::String,
7629
7630    /// ExternalProtectionLevelOptions stores a group of additional fields for
7631    /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7632    /// are specific to the
7633    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7634    /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7635    /// protection levels.
7636    ///
7637    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7638    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7639    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7640    pub external_protection_level_options:
7641        std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7642
7643    /// Output only. Whether or not this key version is eligible for reimport, by
7644    /// being specified as a target in
7645    /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7646    ///
7647    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7648    pub reimport_eligible: bool,
7649
7650    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7651}
7652
7653impl CryptoKeyVersion {
7654    pub fn new() -> Self {
7655        std::default::Default::default()
7656    }
7657
7658    /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7659    ///
7660    /// # Example
7661    /// ```ignore,no_run
7662    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7663    /// let x = CryptoKeyVersion::new().set_name("example");
7664    /// ```
7665    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7666        self.name = v.into();
7667        self
7668    }
7669
7670    /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7671    ///
7672    /// # Example
7673    /// ```ignore,no_run
7674    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7675    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7676    /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7677    /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7678    /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7679    /// ```
7680    pub fn set_state<
7681        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
7682    >(
7683        mut self,
7684        v: T,
7685    ) -> Self {
7686        self.state = v.into();
7687        self
7688    }
7689
7690    /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
7691    ///
7692    /// # Example
7693    /// ```ignore,no_run
7694    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7695    /// use google_cloud_kms_v1::model::ProtectionLevel;
7696    /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
7697    /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
7698    /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
7699    /// ```
7700    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7701        mut self,
7702        v: T,
7703    ) -> Self {
7704        self.protection_level = v.into();
7705        self
7706    }
7707
7708    /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
7709    ///
7710    /// # Example
7711    /// ```ignore,no_run
7712    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7713    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7714    /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7715    /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7716    /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7717    /// ```
7718    pub fn set_algorithm<
7719        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7720    >(
7721        mut self,
7722        v: T,
7723    ) -> Self {
7724        self.algorithm = v.into();
7725        self
7726    }
7727
7728    /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7729    ///
7730    /// # Example
7731    /// ```ignore,no_run
7732    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7733    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7734    /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
7735    /// ```
7736    pub fn set_attestation<T>(mut self, v: T) -> Self
7737    where
7738        T: std::convert::Into<crate::model::KeyOperationAttestation>,
7739    {
7740        self.attestation = std::option::Option::Some(v.into());
7741        self
7742    }
7743
7744    /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7745    ///
7746    /// # Example
7747    /// ```ignore,no_run
7748    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7749    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7750    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
7751    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
7752    /// ```
7753    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
7754    where
7755        T: std::convert::Into<crate::model::KeyOperationAttestation>,
7756    {
7757        self.attestation = v.map(|x| x.into());
7758        self
7759    }
7760
7761    /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7762    ///
7763    /// # Example
7764    /// ```ignore,no_run
7765    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7766    /// use wkt::Timestamp;
7767    /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
7768    /// ```
7769    pub fn set_create_time<T>(mut self, v: T) -> Self
7770    where
7771        T: std::convert::Into<wkt::Timestamp>,
7772    {
7773        self.create_time = std::option::Option::Some(v.into());
7774        self
7775    }
7776
7777    /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7778    ///
7779    /// # Example
7780    /// ```ignore,no_run
7781    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7782    /// use wkt::Timestamp;
7783    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7784    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
7785    /// ```
7786    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7787    where
7788        T: std::convert::Into<wkt::Timestamp>,
7789    {
7790        self.create_time = v.map(|x| x.into());
7791        self
7792    }
7793
7794    /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7795    ///
7796    /// # Example
7797    /// ```ignore,no_run
7798    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7799    /// use wkt::Timestamp;
7800    /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
7801    /// ```
7802    pub fn set_generate_time<T>(mut self, v: T) -> Self
7803    where
7804        T: std::convert::Into<wkt::Timestamp>,
7805    {
7806        self.generate_time = std::option::Option::Some(v.into());
7807        self
7808    }
7809
7810    /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7811    ///
7812    /// # Example
7813    /// ```ignore,no_run
7814    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7815    /// use wkt::Timestamp;
7816    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
7817    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
7818    /// ```
7819    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
7820    where
7821        T: std::convert::Into<wkt::Timestamp>,
7822    {
7823        self.generate_time = v.map(|x| x.into());
7824        self
7825    }
7826
7827    /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7828    ///
7829    /// # Example
7830    /// ```ignore,no_run
7831    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7832    /// use wkt::Timestamp;
7833    /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
7834    /// ```
7835    pub fn set_destroy_time<T>(mut self, v: T) -> Self
7836    where
7837        T: std::convert::Into<wkt::Timestamp>,
7838    {
7839        self.destroy_time = std::option::Option::Some(v.into());
7840        self
7841    }
7842
7843    /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7844    ///
7845    /// # Example
7846    /// ```ignore,no_run
7847    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7848    /// use wkt::Timestamp;
7849    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
7850    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
7851    /// ```
7852    pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
7853    where
7854        T: std::convert::Into<wkt::Timestamp>,
7855    {
7856        self.destroy_time = v.map(|x| x.into());
7857        self
7858    }
7859
7860    /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7861    ///
7862    /// # Example
7863    /// ```ignore,no_run
7864    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7865    /// use wkt::Timestamp;
7866    /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
7867    /// ```
7868    pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
7869    where
7870        T: std::convert::Into<wkt::Timestamp>,
7871    {
7872        self.destroy_event_time = std::option::Option::Some(v.into());
7873        self
7874    }
7875
7876    /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7877    ///
7878    /// # Example
7879    /// ```ignore,no_run
7880    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7881    /// use wkt::Timestamp;
7882    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
7883    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
7884    /// ```
7885    pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
7886    where
7887        T: std::convert::Into<wkt::Timestamp>,
7888    {
7889        self.destroy_event_time = v.map(|x| x.into());
7890        self
7891    }
7892
7893    /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
7894    ///
7895    /// # Example
7896    /// ```ignore,no_run
7897    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7898    /// let x = CryptoKeyVersion::new().set_import_job("example");
7899    /// ```
7900    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7901        self.import_job = v.into();
7902        self
7903    }
7904
7905    /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7906    ///
7907    /// # Example
7908    /// ```ignore,no_run
7909    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7910    /// use wkt::Timestamp;
7911    /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
7912    /// ```
7913    pub fn set_import_time<T>(mut self, v: T) -> Self
7914    where
7915        T: std::convert::Into<wkt::Timestamp>,
7916    {
7917        self.import_time = std::option::Option::Some(v.into());
7918        self
7919    }
7920
7921    /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7922    ///
7923    /// # Example
7924    /// ```ignore,no_run
7925    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7926    /// use wkt::Timestamp;
7927    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
7928    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
7929    /// ```
7930    pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
7931    where
7932        T: std::convert::Into<wkt::Timestamp>,
7933    {
7934        self.import_time = v.map(|x| x.into());
7935        self
7936    }
7937
7938    /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
7939    ///
7940    /// # Example
7941    /// ```ignore,no_run
7942    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7943    /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
7944    /// ```
7945    pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
7946        mut self,
7947        v: T,
7948    ) -> Self {
7949        self.import_failure_reason = v.into();
7950        self
7951    }
7952
7953    /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
7954    ///
7955    /// # Example
7956    /// ```ignore,no_run
7957    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7958    /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
7959    /// ```
7960    pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
7961        mut self,
7962        v: T,
7963    ) -> Self {
7964        self.generation_failure_reason = v.into();
7965        self
7966    }
7967
7968    /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
7969    ///
7970    /// # Example
7971    /// ```ignore,no_run
7972    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7973    /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
7974    /// ```
7975    pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
7976        mut self,
7977        v: T,
7978    ) -> Self {
7979        self.external_destruction_failure_reason = v.into();
7980        self
7981    }
7982
7983    /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
7984    ///
7985    /// # Example
7986    /// ```ignore,no_run
7987    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7988    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
7989    /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
7990    /// ```
7991    pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
7992    where
7993        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
7994    {
7995        self.external_protection_level_options = std::option::Option::Some(v.into());
7996        self
7997    }
7998
7999    /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8000    ///
8001    /// # Example
8002    /// ```ignore,no_run
8003    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8004    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8005    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
8006    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
8007    /// ```
8008    pub fn set_or_clear_external_protection_level_options<T>(
8009        mut self,
8010        v: std::option::Option<T>,
8011    ) -> Self
8012    where
8013        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8014    {
8015        self.external_protection_level_options = v.map(|x| x.into());
8016        self
8017    }
8018
8019    /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
8020    ///
8021    /// # Example
8022    /// ```ignore,no_run
8023    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8024    /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
8025    /// ```
8026    pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8027        self.reimport_eligible = v.into();
8028        self
8029    }
8030}
8031
8032impl wkt::message::Message for CryptoKeyVersion {
8033    fn typename() -> &'static str {
8034        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
8035    }
8036}
8037
8038/// Defines additional types related to [CryptoKeyVersion].
8039pub mod crypto_key_version {
8040    #[allow(unused_imports)]
8041    use super::*;
8042
8043    /// The algorithm of the
8044    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
8045    /// parameters must be used for each cryptographic operation.
8046    ///
8047    /// The
8048    /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
8049    /// algorithm is usable with
8050    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8051    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
8052    ///
8053    /// Algorithms beginning with `RSA_SIGN_` are usable with
8054    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8055    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8056    ///
8057    /// The fields in the name after `RSA_SIGN_` correspond to the following
8058    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8059    ///
8060    /// For PSS, the salt length used is equal to the length of digest
8061    /// algorithm. For example,
8062    /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
8063    /// will use PSS with a salt length of 256 bits or 32 bytes.
8064    ///
8065    /// Algorithms beginning with `RSA_DECRYPT_` are usable with
8066    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8067    /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
8068    ///
8069    /// The fields in the name after `RSA_DECRYPT_` correspond to the following
8070    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8071    ///
8072    /// Algorithms beginning with `EC_SIGN_` are usable with
8073    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8074    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8075    ///
8076    /// The fields in the name after `EC_SIGN_` correspond to the following
8077    /// parameters: elliptic curve, digest algorithm.
8078    ///
8079    /// Algorithms beginning with `HMAC_` are usable with
8080    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8081    /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
8082    ///
8083    /// The suffix following `HMAC_` corresponds to the hash algorithm being used
8084    /// (eg. SHA256).
8085    ///
8086    /// Algorithms beginning with `PQ_` are post-quantum.
8087    ///
8088    /// For more information, see [Key purposes and algorithms]
8089    /// (<https://cloud.google.com/kms/docs/algorithms>).
8090    ///
8091    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
8092    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
8093    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
8094    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
8095    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
8096    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8097    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
8098    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
8099    ///
8100    /// # Working with unknown values
8101    ///
8102    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8103    /// additional enum variants at any time. Adding new variants is not considered
8104    /// a breaking change. Applications should write their code in anticipation of:
8105    ///
8106    /// - New values appearing in future releases of the client library, **and**
8107    /// - New values received dynamically, without application changes.
8108    ///
8109    /// Please consult the [Working with enums] section in the user guide for some
8110    /// guidelines.
8111    ///
8112    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8113    #[derive(Clone, Debug, PartialEq)]
8114    #[non_exhaustive]
8115    pub enum CryptoKeyVersionAlgorithm {
8116        /// Not specified.
8117        Unspecified,
8118        /// Creates symmetric encryption keys.
8119        GoogleSymmetricEncryption,
8120        /// AES-GCM (Galois Counter Mode) using 128-bit keys.
8121        Aes128Gcm,
8122        /// AES-GCM (Galois Counter Mode) using 256-bit keys.
8123        Aes256Gcm,
8124        /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
8125        Aes128Cbc,
8126        /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
8127        Aes256Cbc,
8128        /// AES-CTR (Counter Mode) using 128-bit keys.
8129        Aes128Ctr,
8130        /// AES-CTR (Counter Mode) using 256-bit keys.
8131        Aes256Ctr,
8132        /// RSASSA-PSS 2048 bit key with a SHA256 digest.
8133        RsaSignPss2048Sha256,
8134        /// RSASSA-PSS 3072 bit key with a SHA256 digest.
8135        RsaSignPss3072Sha256,
8136        /// RSASSA-PSS 4096 bit key with a SHA256 digest.
8137        RsaSignPss4096Sha256,
8138        /// RSASSA-PSS 4096 bit key with a SHA512 digest.
8139        RsaSignPss4096Sha512,
8140        /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
8141        RsaSignPkcs12048Sha256,
8142        /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
8143        RsaSignPkcs13072Sha256,
8144        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
8145        RsaSignPkcs14096Sha256,
8146        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
8147        RsaSignPkcs14096Sha512,
8148        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
8149        RsaSignRawPkcs12048,
8150        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
8151        RsaSignRawPkcs13072,
8152        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
8153        RsaSignRawPkcs14096,
8154        /// RSAES-OAEP 2048 bit key with a SHA256 digest.
8155        RsaDecryptOaep2048Sha256,
8156        /// RSAES-OAEP 3072 bit key with a SHA256 digest.
8157        RsaDecryptOaep3072Sha256,
8158        /// RSAES-OAEP 4096 bit key with a SHA256 digest.
8159        RsaDecryptOaep4096Sha256,
8160        /// RSAES-OAEP 4096 bit key with a SHA512 digest.
8161        RsaDecryptOaep4096Sha512,
8162        /// RSAES-OAEP 2048 bit key with a SHA1 digest.
8163        RsaDecryptOaep2048Sha1,
8164        /// RSAES-OAEP 3072 bit key with a SHA1 digest.
8165        RsaDecryptOaep3072Sha1,
8166        /// RSAES-OAEP 4096 bit key with a SHA1 digest.
8167        RsaDecryptOaep4096Sha1,
8168        /// ECDSA on the NIST P-256 curve with a SHA256 digest.
8169        /// Other hash functions can also be used:
8170        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8171        EcSignP256Sha256,
8172        /// ECDSA on the NIST P-384 curve with a SHA384 digest.
8173        /// Other hash functions can also be used:
8174        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8175        EcSignP384Sha384,
8176        /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
8177        /// HSM protection level.
8178        /// Other hash functions can also be used:
8179        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8180        EcSignSecp256K1Sha256,
8181        /// EdDSA on the Curve25519 in pure mode (taking data as input).
8182        EcSignEd25519,
8183        /// HMAC-SHA256 signing with a 256 bit key.
8184        HmacSha256,
8185        /// HMAC-SHA1 signing with a 160 bit key.
8186        HmacSha1,
8187        /// HMAC-SHA384 signing with a 384 bit key.
8188        HmacSha384,
8189        /// HMAC-SHA512 signing with a 512 bit key.
8190        HmacSha512,
8191        /// HMAC-SHA224 signing with a 224 bit key.
8192        HmacSha224,
8193        /// Algorithm representing symmetric encryption by an external key manager.
8194        ExternalSymmetricEncryption,
8195        /// ML-KEM-768 (FIPS 203)
8196        MlKem768,
8197        /// ML-KEM-1024 (FIPS 203)
8198        MlKem1024,
8199        /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
8200        /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8201        KemXwing,
8202        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8203        /// security level 1. Randomized version.
8204        PqSignMlDsa44,
8205        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8206        /// security level 3. Randomized version.
8207        PqSignMlDsa65,
8208        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8209        /// security level 5. Randomized version.
8210        PqSignMlDsa87,
8211        /// The post-quantum stateless hash-based digital signature algorithm, at
8212        /// security level 1. Randomized version.
8213        PqSignSlhDsaSha2128S,
8214        /// The post-quantum stateless hash-based digital signature algorithm, at
8215        /// security level 1. Randomized pre-hash version supporting SHA256 digests.
8216        PqSignHashSlhDsaSha2128SSha256,
8217        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8218        /// security level 1. Randomized version supporting externally-computed
8219        /// message representatives.
8220        PqSignMlDsa44ExternalMu,
8221        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8222        /// security level 3. Randomized version supporting externally-computed
8223        /// message representatives.
8224        PqSignMlDsa65ExternalMu,
8225        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8226        /// security level 5. Randomized version supporting externally-computed
8227        /// message representatives.
8228        PqSignMlDsa87ExternalMu,
8229        /// If set, the enum was initialized with an unknown value.
8230        ///
8231        /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8232        /// [CryptoKeyVersionAlgorithm::name].
8233        UnknownValue(crypto_key_version_algorithm::UnknownValue),
8234    }
8235
8236    #[doc(hidden)]
8237    pub mod crypto_key_version_algorithm {
8238        #[allow(unused_imports)]
8239        use super::*;
8240        #[derive(Clone, Debug, PartialEq)]
8241        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8242    }
8243
8244    impl CryptoKeyVersionAlgorithm {
8245        /// Gets the enum value.
8246        ///
8247        /// Returns `None` if the enum contains an unknown value deserialized from
8248        /// the string representation of enums.
8249        pub fn value(&self) -> std::option::Option<i32> {
8250            match self {
8251                Self::Unspecified => std::option::Option::Some(0),
8252                Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8253                Self::Aes128Gcm => std::option::Option::Some(41),
8254                Self::Aes256Gcm => std::option::Option::Some(19),
8255                Self::Aes128Cbc => std::option::Option::Some(42),
8256                Self::Aes256Cbc => std::option::Option::Some(43),
8257                Self::Aes128Ctr => std::option::Option::Some(44),
8258                Self::Aes256Ctr => std::option::Option::Some(45),
8259                Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8260                Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8261                Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8262                Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8263                Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8264                Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8265                Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8266                Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8267                Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8268                Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8269                Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8270                Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8271                Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8272                Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8273                Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8274                Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8275                Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8276                Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8277                Self::EcSignP256Sha256 => std::option::Option::Some(12),
8278                Self::EcSignP384Sha384 => std::option::Option::Some(13),
8279                Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8280                Self::EcSignEd25519 => std::option::Option::Some(40),
8281                Self::HmacSha256 => std::option::Option::Some(32),
8282                Self::HmacSha1 => std::option::Option::Some(33),
8283                Self::HmacSha384 => std::option::Option::Some(34),
8284                Self::HmacSha512 => std::option::Option::Some(35),
8285                Self::HmacSha224 => std::option::Option::Some(36),
8286                Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8287                Self::MlKem768 => std::option::Option::Some(47),
8288                Self::MlKem1024 => std::option::Option::Some(48),
8289                Self::KemXwing => std::option::Option::Some(63),
8290                Self::PqSignMlDsa44 => std::option::Option::Some(68),
8291                Self::PqSignMlDsa65 => std::option::Option::Some(56),
8292                Self::PqSignMlDsa87 => std::option::Option::Some(69),
8293                Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8294                Self::PqSignHashSlhDsaSha2128SSha256 => std::option::Option::Some(60),
8295                Self::PqSignMlDsa44ExternalMu => std::option::Option::Some(70),
8296                Self::PqSignMlDsa65ExternalMu => std::option::Option::Some(67),
8297                Self::PqSignMlDsa87ExternalMu => std::option::Option::Some(71),
8298                Self::UnknownValue(u) => u.0.value(),
8299            }
8300        }
8301
8302        /// Gets the enum value as a string.
8303        ///
8304        /// Returns `None` if the enum contains an unknown value deserialized from
8305        /// the integer representation of enums.
8306        pub fn name(&self) -> std::option::Option<&str> {
8307            match self {
8308                Self::Unspecified => {
8309                    std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8310                }
8311                Self::GoogleSymmetricEncryption => {
8312                    std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8313                }
8314                Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8315                Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8316                Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8317                Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8318                Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8319                Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8320                Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8321                Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8322                Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8323                Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8324                Self::RsaSignPkcs12048Sha256 => {
8325                    std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8326                }
8327                Self::RsaSignPkcs13072Sha256 => {
8328                    std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8329                }
8330                Self::RsaSignPkcs14096Sha256 => {
8331                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8332                }
8333                Self::RsaSignPkcs14096Sha512 => {
8334                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8335                }
8336                Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8337                Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8338                Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8339                Self::RsaDecryptOaep2048Sha256 => {
8340                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8341                }
8342                Self::RsaDecryptOaep3072Sha256 => {
8343                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8344                }
8345                Self::RsaDecryptOaep4096Sha256 => {
8346                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8347                }
8348                Self::RsaDecryptOaep4096Sha512 => {
8349                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8350                }
8351                Self::RsaDecryptOaep2048Sha1 => {
8352                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8353                }
8354                Self::RsaDecryptOaep3072Sha1 => {
8355                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8356                }
8357                Self::RsaDecryptOaep4096Sha1 => {
8358                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8359                }
8360                Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8361                Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8362                Self::EcSignSecp256K1Sha256 => {
8363                    std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8364                }
8365                Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8366                Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8367                Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8368                Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8369                Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8370                Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8371                Self::ExternalSymmetricEncryption => {
8372                    std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8373                }
8374                Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8375                Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8376                Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8377                Self::PqSignMlDsa44 => std::option::Option::Some("PQ_SIGN_ML_DSA_44"),
8378                Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8379                Self::PqSignMlDsa87 => std::option::Option::Some("PQ_SIGN_ML_DSA_87"),
8380                Self::PqSignSlhDsaSha2128S => {
8381                    std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8382                }
8383                Self::PqSignHashSlhDsaSha2128SSha256 => {
8384                    std::option::Option::Some("PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256")
8385                }
8386                Self::PqSignMlDsa44ExternalMu => {
8387                    std::option::Option::Some("PQ_SIGN_ML_DSA_44_EXTERNAL_MU")
8388                }
8389                Self::PqSignMlDsa65ExternalMu => {
8390                    std::option::Option::Some("PQ_SIGN_ML_DSA_65_EXTERNAL_MU")
8391                }
8392                Self::PqSignMlDsa87ExternalMu => {
8393                    std::option::Option::Some("PQ_SIGN_ML_DSA_87_EXTERNAL_MU")
8394                }
8395                Self::UnknownValue(u) => u.0.name(),
8396            }
8397        }
8398    }
8399
8400    impl std::default::Default for CryptoKeyVersionAlgorithm {
8401        fn default() -> Self {
8402            use std::convert::From;
8403            Self::from(0)
8404        }
8405    }
8406
8407    impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8408        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8409            wkt::internal::display_enum(f, self.name(), self.value())
8410        }
8411    }
8412
8413    impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8414        fn from(value: i32) -> Self {
8415            match value {
8416                0 => Self::Unspecified,
8417                1 => Self::GoogleSymmetricEncryption,
8418                2 => Self::RsaSignPss2048Sha256,
8419                3 => Self::RsaSignPss3072Sha256,
8420                4 => Self::RsaSignPss4096Sha256,
8421                5 => Self::RsaSignPkcs12048Sha256,
8422                6 => Self::RsaSignPkcs13072Sha256,
8423                7 => Self::RsaSignPkcs14096Sha256,
8424                8 => Self::RsaDecryptOaep2048Sha256,
8425                9 => Self::RsaDecryptOaep3072Sha256,
8426                10 => Self::RsaDecryptOaep4096Sha256,
8427                12 => Self::EcSignP256Sha256,
8428                13 => Self::EcSignP384Sha384,
8429                15 => Self::RsaSignPss4096Sha512,
8430                16 => Self::RsaSignPkcs14096Sha512,
8431                17 => Self::RsaDecryptOaep4096Sha512,
8432                18 => Self::ExternalSymmetricEncryption,
8433                19 => Self::Aes256Gcm,
8434                28 => Self::RsaSignRawPkcs12048,
8435                29 => Self::RsaSignRawPkcs13072,
8436                30 => Self::RsaSignRawPkcs14096,
8437                31 => Self::EcSignSecp256K1Sha256,
8438                32 => Self::HmacSha256,
8439                33 => Self::HmacSha1,
8440                34 => Self::HmacSha384,
8441                35 => Self::HmacSha512,
8442                36 => Self::HmacSha224,
8443                37 => Self::RsaDecryptOaep2048Sha1,
8444                38 => Self::RsaDecryptOaep3072Sha1,
8445                39 => Self::RsaDecryptOaep4096Sha1,
8446                40 => Self::EcSignEd25519,
8447                41 => Self::Aes128Gcm,
8448                42 => Self::Aes128Cbc,
8449                43 => Self::Aes256Cbc,
8450                44 => Self::Aes128Ctr,
8451                45 => Self::Aes256Ctr,
8452                47 => Self::MlKem768,
8453                48 => Self::MlKem1024,
8454                56 => Self::PqSignMlDsa65,
8455                57 => Self::PqSignSlhDsaSha2128S,
8456                60 => Self::PqSignHashSlhDsaSha2128SSha256,
8457                63 => Self::KemXwing,
8458                67 => Self::PqSignMlDsa65ExternalMu,
8459                68 => Self::PqSignMlDsa44,
8460                69 => Self::PqSignMlDsa87,
8461                70 => Self::PqSignMlDsa44ExternalMu,
8462                71 => Self::PqSignMlDsa87ExternalMu,
8463                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8464                    wkt::internal::UnknownEnumValue::Integer(value),
8465                )),
8466            }
8467        }
8468    }
8469
8470    impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8471        fn from(value: &str) -> Self {
8472            use std::string::ToString;
8473            match value {
8474                "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8475                "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8476                "AES_128_GCM" => Self::Aes128Gcm,
8477                "AES_256_GCM" => Self::Aes256Gcm,
8478                "AES_128_CBC" => Self::Aes128Cbc,
8479                "AES_256_CBC" => Self::Aes256Cbc,
8480                "AES_128_CTR" => Self::Aes128Ctr,
8481                "AES_256_CTR" => Self::Aes256Ctr,
8482                "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8483                "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8484                "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8485                "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8486                "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8487                "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8488                "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8489                "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8490                "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8491                "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8492                "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8493                "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8494                "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8495                "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8496                "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8497                "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8498                "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8499                "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8500                "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8501                "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8502                "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8503                "EC_SIGN_ED25519" => Self::EcSignEd25519,
8504                "HMAC_SHA256" => Self::HmacSha256,
8505                "HMAC_SHA1" => Self::HmacSha1,
8506                "HMAC_SHA384" => Self::HmacSha384,
8507                "HMAC_SHA512" => Self::HmacSha512,
8508                "HMAC_SHA224" => Self::HmacSha224,
8509                "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8510                "ML_KEM_768" => Self::MlKem768,
8511                "ML_KEM_1024" => Self::MlKem1024,
8512                "KEM_XWING" => Self::KemXwing,
8513                "PQ_SIGN_ML_DSA_44" => Self::PqSignMlDsa44,
8514                "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8515                "PQ_SIGN_ML_DSA_87" => Self::PqSignMlDsa87,
8516                "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8517                "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256" => Self::PqSignHashSlhDsaSha2128SSha256,
8518                "PQ_SIGN_ML_DSA_44_EXTERNAL_MU" => Self::PqSignMlDsa44ExternalMu,
8519                "PQ_SIGN_ML_DSA_65_EXTERNAL_MU" => Self::PqSignMlDsa65ExternalMu,
8520                "PQ_SIGN_ML_DSA_87_EXTERNAL_MU" => Self::PqSignMlDsa87ExternalMu,
8521                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8522                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8523                )),
8524            }
8525        }
8526    }
8527
8528    impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8529        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8530        where
8531            S: serde::Serializer,
8532        {
8533            match self {
8534                Self::Unspecified => serializer.serialize_i32(0),
8535                Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8536                Self::Aes128Gcm => serializer.serialize_i32(41),
8537                Self::Aes256Gcm => serializer.serialize_i32(19),
8538                Self::Aes128Cbc => serializer.serialize_i32(42),
8539                Self::Aes256Cbc => serializer.serialize_i32(43),
8540                Self::Aes128Ctr => serializer.serialize_i32(44),
8541                Self::Aes256Ctr => serializer.serialize_i32(45),
8542                Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8543                Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8544                Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8545                Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8546                Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8547                Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8548                Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8549                Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8550                Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8551                Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8552                Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8553                Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8554                Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8555                Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8556                Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8557                Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8558                Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8559                Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8560                Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8561                Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8562                Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8563                Self::EcSignEd25519 => serializer.serialize_i32(40),
8564                Self::HmacSha256 => serializer.serialize_i32(32),
8565                Self::HmacSha1 => serializer.serialize_i32(33),
8566                Self::HmacSha384 => serializer.serialize_i32(34),
8567                Self::HmacSha512 => serializer.serialize_i32(35),
8568                Self::HmacSha224 => serializer.serialize_i32(36),
8569                Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8570                Self::MlKem768 => serializer.serialize_i32(47),
8571                Self::MlKem1024 => serializer.serialize_i32(48),
8572                Self::KemXwing => serializer.serialize_i32(63),
8573                Self::PqSignMlDsa44 => serializer.serialize_i32(68),
8574                Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8575                Self::PqSignMlDsa87 => serializer.serialize_i32(69),
8576                Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8577                Self::PqSignHashSlhDsaSha2128SSha256 => serializer.serialize_i32(60),
8578                Self::PqSignMlDsa44ExternalMu => serializer.serialize_i32(70),
8579                Self::PqSignMlDsa65ExternalMu => serializer.serialize_i32(67),
8580                Self::PqSignMlDsa87ExternalMu => serializer.serialize_i32(71),
8581                Self::UnknownValue(u) => u.0.serialize(serializer),
8582            }
8583        }
8584    }
8585
8586    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8587        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8588        where
8589            D: serde::Deserializer<'de>,
8590        {
8591            deserializer.deserialize_any(
8592                wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8593                    ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8594                ),
8595            )
8596        }
8597    }
8598
8599    /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8600    /// indicating if it can be used.
8601    ///
8602    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8603    ///
8604    /// # Working with unknown values
8605    ///
8606    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8607    /// additional enum variants at any time. Adding new variants is not considered
8608    /// a breaking change. Applications should write their code in anticipation of:
8609    ///
8610    /// - New values appearing in future releases of the client library, **and**
8611    /// - New values received dynamically, without application changes.
8612    ///
8613    /// Please consult the [Working with enums] section in the user guide for some
8614    /// guidelines.
8615    ///
8616    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8617    #[derive(Clone, Debug, PartialEq)]
8618    #[non_exhaustive]
8619    pub enum CryptoKeyVersionState {
8620        /// Not specified.
8621        Unspecified,
8622        /// This version is still being generated. It may not be used, enabled,
8623        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8624        /// version
8625        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8626        /// as soon as the version is ready.
8627        ///
8628        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8629        PendingGeneration,
8630        /// This version may be used for cryptographic operations.
8631        Enabled,
8632        /// This version may not be used, but the key material is still available,
8633        /// and the version can be placed back into the
8634        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8635        /// state.
8636        ///
8637        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8638        Disabled,
8639        /// The key material of this version is destroyed and no longer stored.
8640        /// This version may only become
8641        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8642        /// again if this version is
8643        /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8644        /// and the original key material is reimported with a call to
8645        /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8646        ///
8647        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8648        /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
8649        /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8650        Destroyed,
8651        /// This version is scheduled for destruction, and will be destroyed soon.
8652        /// Call
8653        /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
8654        /// to put it back into the
8655        /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
8656        /// state.
8657        ///
8658        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
8659        /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8660        DestroyScheduled,
8661        /// This version is still being imported. It may not be used, enabled,
8662        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8663        /// version
8664        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8665        /// as soon as the version is ready.
8666        ///
8667        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8668        PendingImport,
8669        /// This version was not imported successfully. It may not be used, enabled,
8670        /// disabled, or destroyed. The submitted key material has been discarded.
8671        /// Additional details can be found in
8672        /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
8673        ///
8674        /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
8675        ImportFailed,
8676        /// This version was not generated successfully. It may not be used, enabled,
8677        /// disabled, or destroyed. Additional details can be found in
8678        /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
8679        ///
8680        /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
8681        GenerationFailed,
8682        /// This version was destroyed, and it may not be used or enabled again.
8683        /// Cloud KMS is waiting for the corresponding key material residing in an
8684        /// external key manager to be destroyed.
8685        PendingExternalDestruction,
8686        /// This version was destroyed, and it may not be used or enabled again.
8687        /// However, Cloud KMS could not confirm that the corresponding key material
8688        /// residing in an external key manager was destroyed. Additional details can
8689        /// be found in
8690        /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
8691        ///
8692        /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
8693        ExternalDestructionFailed,
8694        /// If set, the enum was initialized with an unknown value.
8695        ///
8696        /// Applications can examine the value using [CryptoKeyVersionState::value] or
8697        /// [CryptoKeyVersionState::name].
8698        UnknownValue(crypto_key_version_state::UnknownValue),
8699    }
8700
8701    #[doc(hidden)]
8702    pub mod crypto_key_version_state {
8703        #[allow(unused_imports)]
8704        use super::*;
8705        #[derive(Clone, Debug, PartialEq)]
8706        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8707    }
8708
8709    impl CryptoKeyVersionState {
8710        /// Gets the enum value.
8711        ///
8712        /// Returns `None` if the enum contains an unknown value deserialized from
8713        /// the string representation of enums.
8714        pub fn value(&self) -> std::option::Option<i32> {
8715            match self {
8716                Self::Unspecified => std::option::Option::Some(0),
8717                Self::PendingGeneration => std::option::Option::Some(5),
8718                Self::Enabled => std::option::Option::Some(1),
8719                Self::Disabled => std::option::Option::Some(2),
8720                Self::Destroyed => std::option::Option::Some(3),
8721                Self::DestroyScheduled => std::option::Option::Some(4),
8722                Self::PendingImport => std::option::Option::Some(6),
8723                Self::ImportFailed => std::option::Option::Some(7),
8724                Self::GenerationFailed => std::option::Option::Some(8),
8725                Self::PendingExternalDestruction => std::option::Option::Some(9),
8726                Self::ExternalDestructionFailed => std::option::Option::Some(10),
8727                Self::UnknownValue(u) => u.0.value(),
8728            }
8729        }
8730
8731        /// Gets the enum value as a string.
8732        ///
8733        /// Returns `None` if the enum contains an unknown value deserialized from
8734        /// the integer representation of enums.
8735        pub fn name(&self) -> std::option::Option<&str> {
8736            match self {
8737                Self::Unspecified => {
8738                    std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
8739                }
8740                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
8741                Self::Enabled => std::option::Option::Some("ENABLED"),
8742                Self::Disabled => std::option::Option::Some("DISABLED"),
8743                Self::Destroyed => std::option::Option::Some("DESTROYED"),
8744                Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
8745                Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
8746                Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
8747                Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
8748                Self::PendingExternalDestruction => {
8749                    std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
8750                }
8751                Self::ExternalDestructionFailed => {
8752                    std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
8753                }
8754                Self::UnknownValue(u) => u.0.name(),
8755            }
8756        }
8757    }
8758
8759    impl std::default::Default for CryptoKeyVersionState {
8760        fn default() -> Self {
8761            use std::convert::From;
8762            Self::from(0)
8763        }
8764    }
8765
8766    impl std::fmt::Display for CryptoKeyVersionState {
8767        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8768            wkt::internal::display_enum(f, self.name(), self.value())
8769        }
8770    }
8771
8772    impl std::convert::From<i32> for CryptoKeyVersionState {
8773        fn from(value: i32) -> Self {
8774            match value {
8775                0 => Self::Unspecified,
8776                1 => Self::Enabled,
8777                2 => Self::Disabled,
8778                3 => Self::Destroyed,
8779                4 => Self::DestroyScheduled,
8780                5 => Self::PendingGeneration,
8781                6 => Self::PendingImport,
8782                7 => Self::ImportFailed,
8783                8 => Self::GenerationFailed,
8784                9 => Self::PendingExternalDestruction,
8785                10 => Self::ExternalDestructionFailed,
8786                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8787                    wkt::internal::UnknownEnumValue::Integer(value),
8788                )),
8789            }
8790        }
8791    }
8792
8793    impl std::convert::From<&str> for CryptoKeyVersionState {
8794        fn from(value: &str) -> Self {
8795            use std::string::ToString;
8796            match value {
8797                "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
8798                "PENDING_GENERATION" => Self::PendingGeneration,
8799                "ENABLED" => Self::Enabled,
8800                "DISABLED" => Self::Disabled,
8801                "DESTROYED" => Self::Destroyed,
8802                "DESTROY_SCHEDULED" => Self::DestroyScheduled,
8803                "PENDING_IMPORT" => Self::PendingImport,
8804                "IMPORT_FAILED" => Self::ImportFailed,
8805                "GENERATION_FAILED" => Self::GenerationFailed,
8806                "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
8807                "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
8808                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8809                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8810                )),
8811            }
8812        }
8813    }
8814
8815    impl serde::ser::Serialize for CryptoKeyVersionState {
8816        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8817        where
8818            S: serde::Serializer,
8819        {
8820            match self {
8821                Self::Unspecified => serializer.serialize_i32(0),
8822                Self::PendingGeneration => serializer.serialize_i32(5),
8823                Self::Enabled => serializer.serialize_i32(1),
8824                Self::Disabled => serializer.serialize_i32(2),
8825                Self::Destroyed => serializer.serialize_i32(3),
8826                Self::DestroyScheduled => serializer.serialize_i32(4),
8827                Self::PendingImport => serializer.serialize_i32(6),
8828                Self::ImportFailed => serializer.serialize_i32(7),
8829                Self::GenerationFailed => serializer.serialize_i32(8),
8830                Self::PendingExternalDestruction => serializer.serialize_i32(9),
8831                Self::ExternalDestructionFailed => serializer.serialize_i32(10),
8832                Self::UnknownValue(u) => u.0.serialize(serializer),
8833            }
8834        }
8835    }
8836
8837    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
8838        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8839        where
8840            D: serde::Deserializer<'de>,
8841        {
8842            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
8843                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
8844            ))
8845        }
8846    }
8847
8848    /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
8849    /// Controls the level of detail returned for
8850    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
8851    /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
8852    /// and
8853    /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
8854    ///
8855    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8856    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
8857    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
8858    ///
8859    /// # Working with unknown values
8860    ///
8861    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8862    /// additional enum variants at any time. Adding new variants is not considered
8863    /// a breaking change. Applications should write their code in anticipation of:
8864    ///
8865    /// - New values appearing in future releases of the client library, **and**
8866    /// - New values received dynamically, without application changes.
8867    ///
8868    /// Please consult the [Working with enums] section in the user guide for some
8869    /// guidelines.
8870    ///
8871    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8872    #[derive(Clone, Debug, PartialEq)]
8873    #[non_exhaustive]
8874    pub enum CryptoKeyVersionView {
8875        /// Default view for each
8876        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
8877        /// include the
8878        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
8879        ///
8880        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8881        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8882        Unspecified,
8883        /// Provides all fields in each
8884        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
8885        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
8886        ///
8887        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8888        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8889        Full,
8890        /// If set, the enum was initialized with an unknown value.
8891        ///
8892        /// Applications can examine the value using [CryptoKeyVersionView::value] or
8893        /// [CryptoKeyVersionView::name].
8894        UnknownValue(crypto_key_version_view::UnknownValue),
8895    }
8896
8897    #[doc(hidden)]
8898    pub mod crypto_key_version_view {
8899        #[allow(unused_imports)]
8900        use super::*;
8901        #[derive(Clone, Debug, PartialEq)]
8902        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8903    }
8904
8905    impl CryptoKeyVersionView {
8906        /// Gets the enum value.
8907        ///
8908        /// Returns `None` if the enum contains an unknown value deserialized from
8909        /// the string representation of enums.
8910        pub fn value(&self) -> std::option::Option<i32> {
8911            match self {
8912                Self::Unspecified => std::option::Option::Some(0),
8913                Self::Full => std::option::Option::Some(1),
8914                Self::UnknownValue(u) => u.0.value(),
8915            }
8916        }
8917
8918        /// Gets the enum value as a string.
8919        ///
8920        /// Returns `None` if the enum contains an unknown value deserialized from
8921        /// the integer representation of enums.
8922        pub fn name(&self) -> std::option::Option<&str> {
8923            match self {
8924                Self::Unspecified => {
8925                    std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
8926                }
8927                Self::Full => std::option::Option::Some("FULL"),
8928                Self::UnknownValue(u) => u.0.name(),
8929            }
8930        }
8931    }
8932
8933    impl std::default::Default for CryptoKeyVersionView {
8934        fn default() -> Self {
8935            use std::convert::From;
8936            Self::from(0)
8937        }
8938    }
8939
8940    impl std::fmt::Display for CryptoKeyVersionView {
8941        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8942            wkt::internal::display_enum(f, self.name(), self.value())
8943        }
8944    }
8945
8946    impl std::convert::From<i32> for CryptoKeyVersionView {
8947        fn from(value: i32) -> Self {
8948            match value {
8949                0 => Self::Unspecified,
8950                1 => Self::Full,
8951                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8952                    wkt::internal::UnknownEnumValue::Integer(value),
8953                )),
8954            }
8955        }
8956    }
8957
8958    impl std::convert::From<&str> for CryptoKeyVersionView {
8959        fn from(value: &str) -> Self {
8960            use std::string::ToString;
8961            match value {
8962                "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
8963                "FULL" => Self::Full,
8964                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8965                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8966                )),
8967            }
8968        }
8969    }
8970
8971    impl serde::ser::Serialize for CryptoKeyVersionView {
8972        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8973        where
8974            S: serde::Serializer,
8975        {
8976            match self {
8977                Self::Unspecified => serializer.serialize_i32(0),
8978                Self::Full => serializer.serialize_i32(1),
8979                Self::UnknownValue(u) => u.0.serialize(serializer),
8980            }
8981        }
8982    }
8983
8984    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
8985        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8986        where
8987            D: serde::Deserializer<'de>,
8988        {
8989            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
8990                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
8991            ))
8992        }
8993    }
8994}
8995
8996/// Data with integrity verification field.
8997#[derive(Clone, Default, PartialEq)]
8998#[non_exhaustive]
8999pub struct ChecksummedData {
9000    /// Raw Data.
9001    pub data: ::bytes::Bytes,
9002
9003    /// Integrity verification field. A CRC32C
9004    /// checksum of the returned
9005    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
9006    /// integrity check of
9007    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
9008    /// performed by computing the CRC32C checksum of
9009    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
9010    /// comparing your results to this field. Discard the response in case of
9011    /// non-matching checksum values, and perform a limited number of retries. A
9012    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9013    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9014    /// across different languages. However, it is a non-negative integer, which
9015    /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
9016    /// languages that support this type.
9017    ///
9018    /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
9019    pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
9020
9021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9022}
9023
9024impl ChecksummedData {
9025    pub fn new() -> Self {
9026        std::default::Default::default()
9027    }
9028
9029    /// Sets the value of [data][crate::model::ChecksummedData::data].
9030    ///
9031    /// # Example
9032    /// ```ignore,no_run
9033    /// # use google_cloud_kms_v1::model::ChecksummedData;
9034    /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
9035    /// ```
9036    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9037        self.data = v.into();
9038        self
9039    }
9040
9041    /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9042    ///
9043    /// # Example
9044    /// ```ignore,no_run
9045    /// # use google_cloud_kms_v1::model::ChecksummedData;
9046    /// use wkt::Int64Value;
9047    /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
9048    /// ```
9049    pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
9050    where
9051        T: std::convert::Into<wkt::Int64Value>,
9052    {
9053        self.crc32c_checksum = std::option::Option::Some(v.into());
9054        self
9055    }
9056
9057    /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9058    ///
9059    /// # Example
9060    /// ```ignore,no_run
9061    /// # use google_cloud_kms_v1::model::ChecksummedData;
9062    /// use wkt::Int64Value;
9063    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
9064    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
9065    /// ```
9066    pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
9067    where
9068        T: std::convert::Into<wkt::Int64Value>,
9069    {
9070        self.crc32c_checksum = v.map(|x| x.into());
9071        self
9072    }
9073}
9074
9075impl wkt::message::Message for ChecksummedData {
9076    fn typename() -> &'static str {
9077        "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
9078    }
9079}
9080
9081/// The public keys for a given
9082/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
9083/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
9084///
9085/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9086/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
9087#[derive(Clone, Default, PartialEq)]
9088#[non_exhaustive]
9089pub struct PublicKey {
9090    /// The public key, encoded in PEM format. For more information, see the
9091    /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
9092    /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9093    /// [Textual Encoding of Subject Public Key Info]
9094    /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9095    pub pem: std::string::String,
9096
9097    /// The
9098    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
9099    /// associated with this key.
9100    ///
9101    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
9102    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
9103
9104    /// Integrity verification field. A CRC32C checksum of the returned
9105    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
9106    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
9107    /// computing the CRC32C checksum of
9108    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
9109    /// results to this field. Discard the response in case of non-matching
9110    /// checksum values, and perform a limited number of retries. A persistent
9111    /// mismatch may indicate an issue in your computation of the CRC32C checksum.
9112    /// Note: This field is defined as int64 for reasons of compatibility across
9113    /// different languages. However, it is a non-negative integer, which will
9114    /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
9115    /// languages that support this type.
9116    ///
9117    /// NOTE: This field is in Beta.
9118    ///
9119    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9120    pub pem_crc32c: std::option::Option<wkt::Int64Value>,
9121
9122    /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
9123    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9124    /// Provided here for verification.
9125    ///
9126    /// NOTE: This field is in Beta.
9127    ///
9128    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9129    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
9130    pub name: std::string::String,
9131
9132    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9133    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9134    ///
9135    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9136    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9137    pub protection_level: crate::model::ProtectionLevel,
9138
9139    /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
9140    /// customer through the
9141    /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9142    /// field.
9143    ///
9144    /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9145    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9146    pub public_key_format: crate::model::public_key::PublicKeyFormat,
9147
9148    /// This field contains the public key (with integrity verification), formatted
9149    /// according to the
9150    /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
9151    ///
9152    /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
9153    pub public_key: std::option::Option<crate::model::ChecksummedData>,
9154
9155    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9156}
9157
9158impl PublicKey {
9159    pub fn new() -> Self {
9160        std::default::Default::default()
9161    }
9162
9163    /// Sets the value of [pem][crate::model::PublicKey::pem].
9164    ///
9165    /// # Example
9166    /// ```ignore,no_run
9167    /// # use google_cloud_kms_v1::model::PublicKey;
9168    /// let x = PublicKey::new().set_pem("example");
9169    /// ```
9170    pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9171        self.pem = v.into();
9172        self
9173    }
9174
9175    /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
9176    ///
9177    /// # Example
9178    /// ```ignore,no_run
9179    /// # use google_cloud_kms_v1::model::PublicKey;
9180    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
9181    /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
9182    /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
9183    /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
9184    /// ```
9185    pub fn set_algorithm<
9186        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
9187    >(
9188        mut self,
9189        v: T,
9190    ) -> Self {
9191        self.algorithm = v.into();
9192        self
9193    }
9194
9195    /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9196    ///
9197    /// # Example
9198    /// ```ignore,no_run
9199    /// # use google_cloud_kms_v1::model::PublicKey;
9200    /// use wkt::Int64Value;
9201    /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
9202    /// ```
9203    pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
9204    where
9205        T: std::convert::Into<wkt::Int64Value>,
9206    {
9207        self.pem_crc32c = std::option::Option::Some(v.into());
9208        self
9209    }
9210
9211    /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9212    ///
9213    /// # Example
9214    /// ```ignore,no_run
9215    /// # use google_cloud_kms_v1::model::PublicKey;
9216    /// use wkt::Int64Value;
9217    /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
9218    /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
9219    /// ```
9220    pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9221    where
9222        T: std::convert::Into<wkt::Int64Value>,
9223    {
9224        self.pem_crc32c = v.map(|x| x.into());
9225        self
9226    }
9227
9228    /// Sets the value of [name][crate::model::PublicKey::name].
9229    ///
9230    /// # Example
9231    /// ```ignore,no_run
9232    /// # use google_cloud_kms_v1::model::PublicKey;
9233    /// let x = PublicKey::new().set_name("example");
9234    /// ```
9235    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9236        self.name = v.into();
9237        self
9238    }
9239
9240    /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
9241    ///
9242    /// # Example
9243    /// ```ignore,no_run
9244    /// # use google_cloud_kms_v1::model::PublicKey;
9245    /// use google_cloud_kms_v1::model::ProtectionLevel;
9246    /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
9247    /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
9248    /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
9249    /// ```
9250    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9251        mut self,
9252        v: T,
9253    ) -> Self {
9254        self.protection_level = v.into();
9255        self
9256    }
9257
9258    /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
9259    ///
9260    /// # Example
9261    /// ```ignore,no_run
9262    /// # use google_cloud_kms_v1::model::PublicKey;
9263    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9264    /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9265    /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9266    /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9267    /// ```
9268    pub fn set_public_key_format<
9269        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9270    >(
9271        mut self,
9272        v: T,
9273    ) -> Self {
9274        self.public_key_format = v.into();
9275        self
9276    }
9277
9278    /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9279    ///
9280    /// # Example
9281    /// ```ignore,no_run
9282    /// # use google_cloud_kms_v1::model::PublicKey;
9283    /// use google_cloud_kms_v1::model::ChecksummedData;
9284    /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9285    /// ```
9286    pub fn set_public_key<T>(mut self, v: T) -> Self
9287    where
9288        T: std::convert::Into<crate::model::ChecksummedData>,
9289    {
9290        self.public_key = std::option::Option::Some(v.into());
9291        self
9292    }
9293
9294    /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9295    ///
9296    /// # Example
9297    /// ```ignore,no_run
9298    /// # use google_cloud_kms_v1::model::PublicKey;
9299    /// use google_cloud_kms_v1::model::ChecksummedData;
9300    /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9301    /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9302    /// ```
9303    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9304    where
9305        T: std::convert::Into<crate::model::ChecksummedData>,
9306    {
9307        self.public_key = v.map(|x| x.into());
9308        self
9309    }
9310}
9311
9312impl wkt::message::Message for PublicKey {
9313    fn typename() -> &'static str {
9314        "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9315    }
9316}
9317
9318/// Defines additional types related to [PublicKey].
9319pub mod public_key {
9320    #[allow(unused_imports)]
9321    use super::*;
9322
9323    /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9324    ///
9325    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9326    ///
9327    /// # Working with unknown values
9328    ///
9329    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9330    /// additional enum variants at any time. Adding new variants is not considered
9331    /// a breaking change. Applications should write their code in anticipation of:
9332    ///
9333    /// - New values appearing in future releases of the client library, **and**
9334    /// - New values received dynamically, without application changes.
9335    ///
9336    /// Please consult the [Working with enums] section in the user guide for some
9337    /// guidelines.
9338    ///
9339    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9340    #[derive(Clone, Debug, PartialEq)]
9341    #[non_exhaustive]
9342    pub enum PublicKeyFormat {
9343        /// If the
9344        /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9345        /// field is not specified:
9346        ///
9347        /// - For PQC algorithms, an error will be returned.
9348        /// - For non-PQC algorithms, the default format is PEM, and the field
9349        ///   [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9350        ///
9351        /// Otherwise, the public key will be exported through the
9352        /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9353        /// requested format.
9354        ///
9355        /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9356        /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9357        /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9358        Unspecified,
9359        /// The returned public key will be encoded in PEM format.
9360        /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9361        /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9362        /// and [Textual Encoding of Subject Public Key Info]
9363        /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9364        Pem,
9365        /// The returned public key will be encoded in DER format (the
9366        /// PrivateKeyInfo structure from RFC 5208).
9367        Der,
9368        /// This is supported only for PQC algorithms.
9369        /// The key material is returned in the format defined by NIST PQC
9370        /// standards (FIPS 203, FIPS 204, and FIPS 205).
9371        NistPqc,
9372        /// The returned public key is in raw bytes format defined in its standard
9373        /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9374        XwingRawBytes,
9375        /// If set, the enum was initialized with an unknown value.
9376        ///
9377        /// Applications can examine the value using [PublicKeyFormat::value] or
9378        /// [PublicKeyFormat::name].
9379        UnknownValue(public_key_format::UnknownValue),
9380    }
9381
9382    #[doc(hidden)]
9383    pub mod public_key_format {
9384        #[allow(unused_imports)]
9385        use super::*;
9386        #[derive(Clone, Debug, PartialEq)]
9387        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9388    }
9389
9390    impl PublicKeyFormat {
9391        /// Gets the enum value.
9392        ///
9393        /// Returns `None` if the enum contains an unknown value deserialized from
9394        /// the string representation of enums.
9395        pub fn value(&self) -> std::option::Option<i32> {
9396            match self {
9397                Self::Unspecified => std::option::Option::Some(0),
9398                Self::Pem => std::option::Option::Some(1),
9399                Self::Der => std::option::Option::Some(2),
9400                Self::NistPqc => std::option::Option::Some(3),
9401                Self::XwingRawBytes => std::option::Option::Some(4),
9402                Self::UnknownValue(u) => u.0.value(),
9403            }
9404        }
9405
9406        /// Gets the enum value as a string.
9407        ///
9408        /// Returns `None` if the enum contains an unknown value deserialized from
9409        /// the integer representation of enums.
9410        pub fn name(&self) -> std::option::Option<&str> {
9411            match self {
9412                Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9413                Self::Pem => std::option::Option::Some("PEM"),
9414                Self::Der => std::option::Option::Some("DER"),
9415                Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9416                Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9417                Self::UnknownValue(u) => u.0.name(),
9418            }
9419        }
9420    }
9421
9422    impl std::default::Default for PublicKeyFormat {
9423        fn default() -> Self {
9424            use std::convert::From;
9425            Self::from(0)
9426        }
9427    }
9428
9429    impl std::fmt::Display for PublicKeyFormat {
9430        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9431            wkt::internal::display_enum(f, self.name(), self.value())
9432        }
9433    }
9434
9435    impl std::convert::From<i32> for PublicKeyFormat {
9436        fn from(value: i32) -> Self {
9437            match value {
9438                0 => Self::Unspecified,
9439                1 => Self::Pem,
9440                2 => Self::Der,
9441                3 => Self::NistPqc,
9442                4 => Self::XwingRawBytes,
9443                _ => Self::UnknownValue(public_key_format::UnknownValue(
9444                    wkt::internal::UnknownEnumValue::Integer(value),
9445                )),
9446            }
9447        }
9448    }
9449
9450    impl std::convert::From<&str> for PublicKeyFormat {
9451        fn from(value: &str) -> Self {
9452            use std::string::ToString;
9453            match value {
9454                "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9455                "PEM" => Self::Pem,
9456                "DER" => Self::Der,
9457                "NIST_PQC" => Self::NistPqc,
9458                "XWING_RAW_BYTES" => Self::XwingRawBytes,
9459                _ => Self::UnknownValue(public_key_format::UnknownValue(
9460                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9461                )),
9462            }
9463        }
9464    }
9465
9466    impl serde::ser::Serialize for PublicKeyFormat {
9467        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9468        where
9469            S: serde::Serializer,
9470        {
9471            match self {
9472                Self::Unspecified => serializer.serialize_i32(0),
9473                Self::Pem => serializer.serialize_i32(1),
9474                Self::Der => serializer.serialize_i32(2),
9475                Self::NistPqc => serializer.serialize_i32(3),
9476                Self::XwingRawBytes => serializer.serialize_i32(4),
9477                Self::UnknownValue(u) => u.0.serialize(serializer),
9478            }
9479        }
9480    }
9481
9482    impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9483        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9484        where
9485            D: serde::Deserializer<'de>,
9486        {
9487            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9488                ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9489            ))
9490        }
9491    }
9492}
9493
9494/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9495/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9496/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9497/// key material, generated outside of Cloud KMS.
9498///
9499/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9500/// generate a "wrapping key", which is a public/private key pair. You use the
9501/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9502/// protect it during the import process. The nature of the wrapping key depends
9503/// on the choice of
9504/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9505/// wrapping key generation is complete, the
9506/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9507/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9508/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9509/// fetched public key can then be used to wrap your pre-existing key material.
9510///
9511/// Once the key material is wrapped, it can be imported into a new
9512/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9513/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9514/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9515/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9516/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9517/// uses the private key portion of the wrapping key to unwrap the key material.
9518/// Only Cloud KMS has access to the private key.
9519///
9520/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9521/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9522/// any key material that was wrapped with the
9523/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9524///
9525/// For more information, see
9526/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9527///
9528/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9529/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9530/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9531/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9532/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9533/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9534/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9535/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9536#[derive(Clone, Default, PartialEq)]
9537#[non_exhaustive]
9538pub struct ImportJob {
9539    /// Output only. The resource name for this
9540    /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9541    /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9542    ///
9543    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9544    pub name: std::string::String,
9545
9546    /// Required. Immutable. The wrapping method to be used for incoming key
9547    /// material.
9548    pub import_method: crate::model::import_job::ImportMethod,
9549
9550    /// Required. Immutable. The protection level of the
9551    /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9552    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9553    /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9554    /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9555    /// into.
9556    ///
9557    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9558    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9559    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9560    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9561    pub protection_level: crate::model::ProtectionLevel,
9562
9563    /// Output only. The time at which this
9564    /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9565    ///
9566    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9567    pub create_time: std::option::Option<wkt::Timestamp>,
9568
9569    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9570    /// material was generated.
9571    ///
9572    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9573    pub generate_time: std::option::Option<wkt::Timestamp>,
9574
9575    /// Output only. The time at which this
9576    /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9577    /// can no longer be used to import key material.
9578    ///
9579    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9580    pub expire_time: std::option::Option<wkt::Timestamp>,
9581
9582    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9583    /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9584    /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9585    ///
9586    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9587    /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9588    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9589    pub expire_event_time: std::option::Option<wkt::Timestamp>,
9590
9591    /// Output only. The current state of the
9592    /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9593    ///
9594    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9595    pub state: crate::model::import_job::ImportJobState,
9596
9597    /// Output only. The public key with which to wrap key material prior to
9598    /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9599    /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9600    ///
9601    /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9602    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9603    pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9604
9605    /// Output only. Statement that was generated and signed by the key creator
9606    /// (for example, an HSM) at key creation time. Use this statement to verify
9607    /// attributes of the key as stored on the HSM, independently of Google.
9608    /// Only present if the chosen
9609    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9610    /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9611    ///
9612    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9613    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9614    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9615
9616    /// Immutable. The resource name of the backend environment where the key
9617    /// material for the wrapping key resides and where all related cryptographic
9618    /// operations are performed. Currently, this field is only populated for keys
9619    /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9620    /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9621    /// in the future. Supported resources:
9622    ///
9623    /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9624    ///
9625    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9626    pub crypto_key_backend: std::string::String,
9627
9628    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9629}
9630
9631impl ImportJob {
9632    pub fn new() -> Self {
9633        std::default::Default::default()
9634    }
9635
9636    /// Sets the value of [name][crate::model::ImportJob::name].
9637    ///
9638    /// # Example
9639    /// ```ignore,no_run
9640    /// # use google_cloud_kms_v1::model::ImportJob;
9641    /// let x = ImportJob::new().set_name("example");
9642    /// ```
9643    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9644        self.name = v.into();
9645        self
9646    }
9647
9648    /// Sets the value of [import_method][crate::model::ImportJob::import_method].
9649    ///
9650    /// # Example
9651    /// ```ignore,no_run
9652    /// # use google_cloud_kms_v1::model::ImportJob;
9653    /// use google_cloud_kms_v1::model::import_job::ImportMethod;
9654    /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
9655    /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
9656    /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
9657    /// ```
9658    pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
9659        mut self,
9660        v: T,
9661    ) -> Self {
9662        self.import_method = v.into();
9663        self
9664    }
9665
9666    /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
9667    ///
9668    /// # Example
9669    /// ```ignore,no_run
9670    /// # use google_cloud_kms_v1::model::ImportJob;
9671    /// use google_cloud_kms_v1::model::ProtectionLevel;
9672    /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
9673    /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
9674    /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
9675    /// ```
9676    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9677        mut self,
9678        v: T,
9679    ) -> Self {
9680        self.protection_level = v.into();
9681        self
9682    }
9683
9684    /// Sets the value of [create_time][crate::model::ImportJob::create_time].
9685    ///
9686    /// # Example
9687    /// ```ignore,no_run
9688    /// # use google_cloud_kms_v1::model::ImportJob;
9689    /// use wkt::Timestamp;
9690    /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
9691    /// ```
9692    pub fn set_create_time<T>(mut self, v: T) -> Self
9693    where
9694        T: std::convert::Into<wkt::Timestamp>,
9695    {
9696        self.create_time = std::option::Option::Some(v.into());
9697        self
9698    }
9699
9700    /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
9701    ///
9702    /// # Example
9703    /// ```ignore,no_run
9704    /// # use google_cloud_kms_v1::model::ImportJob;
9705    /// use wkt::Timestamp;
9706    /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9707    /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
9708    /// ```
9709    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9710    where
9711        T: std::convert::Into<wkt::Timestamp>,
9712    {
9713        self.create_time = v.map(|x| x.into());
9714        self
9715    }
9716
9717    /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
9718    ///
9719    /// # Example
9720    /// ```ignore,no_run
9721    /// # use google_cloud_kms_v1::model::ImportJob;
9722    /// use wkt::Timestamp;
9723    /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
9724    /// ```
9725    pub fn set_generate_time<T>(mut self, v: T) -> Self
9726    where
9727        T: std::convert::Into<wkt::Timestamp>,
9728    {
9729        self.generate_time = std::option::Option::Some(v.into());
9730        self
9731    }
9732
9733    /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
9734    ///
9735    /// # Example
9736    /// ```ignore,no_run
9737    /// # use google_cloud_kms_v1::model::ImportJob;
9738    /// use wkt::Timestamp;
9739    /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
9740    /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
9741    /// ```
9742    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
9743    where
9744        T: std::convert::Into<wkt::Timestamp>,
9745    {
9746        self.generate_time = v.map(|x| x.into());
9747        self
9748    }
9749
9750    /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
9751    ///
9752    /// # Example
9753    /// ```ignore,no_run
9754    /// # use google_cloud_kms_v1::model::ImportJob;
9755    /// use wkt::Timestamp;
9756    /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
9757    /// ```
9758    pub fn set_expire_time<T>(mut self, v: T) -> Self
9759    where
9760        T: std::convert::Into<wkt::Timestamp>,
9761    {
9762        self.expire_time = std::option::Option::Some(v.into());
9763        self
9764    }
9765
9766    /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
9767    ///
9768    /// # Example
9769    /// ```ignore,no_run
9770    /// # use google_cloud_kms_v1::model::ImportJob;
9771    /// use wkt::Timestamp;
9772    /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9773    /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
9774    /// ```
9775    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9776    where
9777        T: std::convert::Into<wkt::Timestamp>,
9778    {
9779        self.expire_time = v.map(|x| x.into());
9780        self
9781    }
9782
9783    /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9784    ///
9785    /// # Example
9786    /// ```ignore,no_run
9787    /// # use google_cloud_kms_v1::model::ImportJob;
9788    /// use wkt::Timestamp;
9789    /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
9790    /// ```
9791    pub fn set_expire_event_time<T>(mut self, v: T) -> Self
9792    where
9793        T: std::convert::Into<wkt::Timestamp>,
9794    {
9795        self.expire_event_time = std::option::Option::Some(v.into());
9796        self
9797    }
9798
9799    /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9800    ///
9801    /// # Example
9802    /// ```ignore,no_run
9803    /// # use google_cloud_kms_v1::model::ImportJob;
9804    /// use wkt::Timestamp;
9805    /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
9806    /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
9807    /// ```
9808    pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
9809    where
9810        T: std::convert::Into<wkt::Timestamp>,
9811    {
9812        self.expire_event_time = v.map(|x| x.into());
9813        self
9814    }
9815
9816    /// Sets the value of [state][crate::model::ImportJob::state].
9817    ///
9818    /// # Example
9819    /// ```ignore,no_run
9820    /// # use google_cloud_kms_v1::model::ImportJob;
9821    /// use google_cloud_kms_v1::model::import_job::ImportJobState;
9822    /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
9823    /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
9824    /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
9825    /// ```
9826    pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
9827        mut self,
9828        v: T,
9829    ) -> Self {
9830        self.state = v.into();
9831        self
9832    }
9833
9834    /// Sets the value of [public_key][crate::model::ImportJob::public_key].
9835    ///
9836    /// # Example
9837    /// ```ignore,no_run
9838    /// # use google_cloud_kms_v1::model::ImportJob;
9839    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9840    /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
9841    /// ```
9842    pub fn set_public_key<T>(mut self, v: T) -> Self
9843    where
9844        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9845    {
9846        self.public_key = std::option::Option::Some(v.into());
9847        self
9848    }
9849
9850    /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
9851    ///
9852    /// # Example
9853    /// ```ignore,no_run
9854    /// # use google_cloud_kms_v1::model::ImportJob;
9855    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9856    /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
9857    /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
9858    /// ```
9859    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9860    where
9861        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9862    {
9863        self.public_key = v.map(|x| x.into());
9864        self
9865    }
9866
9867    /// Sets the value of [attestation][crate::model::ImportJob::attestation].
9868    ///
9869    /// # Example
9870    /// ```ignore,no_run
9871    /// # use google_cloud_kms_v1::model::ImportJob;
9872    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9873    /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
9874    /// ```
9875    pub fn set_attestation<T>(mut self, v: T) -> Self
9876    where
9877        T: std::convert::Into<crate::model::KeyOperationAttestation>,
9878    {
9879        self.attestation = std::option::Option::Some(v.into());
9880        self
9881    }
9882
9883    /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
9884    ///
9885    /// # Example
9886    /// ```ignore,no_run
9887    /// # use google_cloud_kms_v1::model::ImportJob;
9888    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9889    /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
9890    /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
9891    /// ```
9892    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
9893    where
9894        T: std::convert::Into<crate::model::KeyOperationAttestation>,
9895    {
9896        self.attestation = v.map(|x| x.into());
9897        self
9898    }
9899
9900    /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
9901    ///
9902    /// # Example
9903    /// ```ignore,no_run
9904    /// # use google_cloud_kms_v1::model::ImportJob;
9905    /// let x = ImportJob::new().set_crypto_key_backend("example");
9906    /// ```
9907    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
9908        mut self,
9909        v: T,
9910    ) -> Self {
9911        self.crypto_key_backend = v.into();
9912        self
9913    }
9914}
9915
9916impl wkt::message::Message for ImportJob {
9917    fn typename() -> &'static str {
9918        "type.googleapis.com/google.cloud.kms.v1.ImportJob"
9919    }
9920}
9921
9922/// Defines additional types related to [ImportJob].
9923pub mod import_job {
9924    #[allow(unused_imports)]
9925    use super::*;
9926
9927    /// The public key component of the wrapping key. For details of the type of
9928    /// key this public key corresponds to, see the
9929    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
9930    ///
9931    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9932    #[derive(Clone, Default, PartialEq)]
9933    #[non_exhaustive]
9934    pub struct WrappingPublicKey {
9935        /// The public key, encoded in PEM format. For more information, see the [RFC
9936        /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
9937        /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9938        /// [Textual Encoding of Subject Public Key Info]
9939        /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9940        pub pem: std::string::String,
9941
9942        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9943    }
9944
9945    impl WrappingPublicKey {
9946        pub fn new() -> Self {
9947            std::default::Default::default()
9948        }
9949
9950        /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
9951        ///
9952        /// # Example
9953        /// ```ignore,no_run
9954        /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9955        /// let x = WrappingPublicKey::new().set_pem("example");
9956        /// ```
9957        pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9958            self.pem = v.into();
9959            self
9960        }
9961    }
9962
9963    impl wkt::message::Message for WrappingPublicKey {
9964        fn typename() -> &'static str {
9965            "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
9966        }
9967    }
9968
9969    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
9970    /// key wrapping method chosen for this
9971    /// [ImportJob][google.cloud.kms.v1.ImportJob].
9972    ///
9973    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9974    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9975    ///
9976    /// # Working with unknown values
9977    ///
9978    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9979    /// additional enum variants at any time. Adding new variants is not considered
9980    /// a breaking change. Applications should write their code in anticipation of:
9981    ///
9982    /// - New values appearing in future releases of the client library, **and**
9983    /// - New values received dynamically, without application changes.
9984    ///
9985    /// Please consult the [Working with enums] section in the user guide for some
9986    /// guidelines.
9987    ///
9988    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9989    #[derive(Clone, Debug, PartialEq)]
9990    #[non_exhaustive]
9991    pub enum ImportMethod {
9992        /// Not specified.
9993        Unspecified,
9994        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9995        /// scheme defined in the PKCS #11 standard. In summary, this involves
9996        /// wrapping the raw key with an ephemeral AES key, and wrapping the
9997        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
9998        /// [RSA AES key wrap
9999        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10000        RsaOaep3072Sha1Aes256,
10001        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10002        /// scheme defined in the PKCS #11 standard. In summary, this involves
10003        /// wrapping the raw key with an ephemeral AES key, and wrapping the
10004        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10005        /// [RSA AES key wrap
10006        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10007        RsaOaep4096Sha1Aes256,
10008        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10009        /// scheme defined in the PKCS #11 standard. In summary, this involves
10010        /// wrapping the raw key with an ephemeral AES key, and wrapping the
10011        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10012        /// [RSA AES key wrap
10013        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10014        RsaOaep3072Sha256Aes256,
10015        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10016        /// scheme defined in the PKCS #11 standard. In summary, this involves
10017        /// wrapping the raw key with an ephemeral AES key, and wrapping the
10018        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10019        /// [RSA AES key wrap
10020        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10021        RsaOaep4096Sha256Aes256,
10022        /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
10023        /// key material to be imported is wrapped directly with the RSA key. Due
10024        /// to technical limitations of RSA wrapping, this method cannot be used to
10025        /// wrap RSA keys for import.
10026        RsaOaep3072Sha256,
10027        /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
10028        /// key material to be imported is wrapped directly with the RSA key. Due
10029        /// to technical limitations of RSA wrapping, this method cannot be used to
10030        /// wrap RSA keys for import.
10031        RsaOaep4096Sha256,
10032        /// If set, the enum was initialized with an unknown value.
10033        ///
10034        /// Applications can examine the value using [ImportMethod::value] or
10035        /// [ImportMethod::name].
10036        UnknownValue(import_method::UnknownValue),
10037    }
10038
10039    #[doc(hidden)]
10040    pub mod import_method {
10041        #[allow(unused_imports)]
10042        use super::*;
10043        #[derive(Clone, Debug, PartialEq)]
10044        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10045    }
10046
10047    impl ImportMethod {
10048        /// Gets the enum value.
10049        ///
10050        /// Returns `None` if the enum contains an unknown value deserialized from
10051        /// the string representation of enums.
10052        pub fn value(&self) -> std::option::Option<i32> {
10053            match self {
10054                Self::Unspecified => std::option::Option::Some(0),
10055                Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
10056                Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
10057                Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
10058                Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
10059                Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
10060                Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
10061                Self::UnknownValue(u) => u.0.value(),
10062            }
10063        }
10064
10065        /// Gets the enum value as a string.
10066        ///
10067        /// Returns `None` if the enum contains an unknown value deserialized from
10068        /// the integer representation of enums.
10069        pub fn name(&self) -> std::option::Option<&str> {
10070            match self {
10071                Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
10072                Self::RsaOaep3072Sha1Aes256 => {
10073                    std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
10074                }
10075                Self::RsaOaep4096Sha1Aes256 => {
10076                    std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
10077                }
10078                Self::RsaOaep3072Sha256Aes256 => {
10079                    std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
10080                }
10081                Self::RsaOaep4096Sha256Aes256 => {
10082                    std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
10083                }
10084                Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
10085                Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
10086                Self::UnknownValue(u) => u.0.name(),
10087            }
10088        }
10089    }
10090
10091    impl std::default::Default for ImportMethod {
10092        fn default() -> Self {
10093            use std::convert::From;
10094            Self::from(0)
10095        }
10096    }
10097
10098    impl std::fmt::Display for ImportMethod {
10099        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10100            wkt::internal::display_enum(f, self.name(), self.value())
10101        }
10102    }
10103
10104    impl std::convert::From<i32> for ImportMethod {
10105        fn from(value: i32) -> Self {
10106            match value {
10107                0 => Self::Unspecified,
10108                1 => Self::RsaOaep3072Sha1Aes256,
10109                2 => Self::RsaOaep4096Sha1Aes256,
10110                3 => Self::RsaOaep3072Sha256Aes256,
10111                4 => Self::RsaOaep4096Sha256Aes256,
10112                5 => Self::RsaOaep3072Sha256,
10113                6 => Self::RsaOaep4096Sha256,
10114                _ => Self::UnknownValue(import_method::UnknownValue(
10115                    wkt::internal::UnknownEnumValue::Integer(value),
10116                )),
10117            }
10118        }
10119    }
10120
10121    impl std::convert::From<&str> for ImportMethod {
10122        fn from(value: &str) -> Self {
10123            use std::string::ToString;
10124            match value {
10125                "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
10126                "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
10127                "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
10128                "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
10129                "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
10130                "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
10131                "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
10132                _ => Self::UnknownValue(import_method::UnknownValue(
10133                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10134                )),
10135            }
10136        }
10137    }
10138
10139    impl serde::ser::Serialize for ImportMethod {
10140        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10141        where
10142            S: serde::Serializer,
10143        {
10144            match self {
10145                Self::Unspecified => serializer.serialize_i32(0),
10146                Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
10147                Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
10148                Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
10149                Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
10150                Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
10151                Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
10152                Self::UnknownValue(u) => u.0.serialize(serializer),
10153            }
10154        }
10155    }
10156
10157    impl<'de> serde::de::Deserialize<'de> for ImportMethod {
10158        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10159        where
10160            D: serde::Deserializer<'de>,
10161        {
10162            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
10163                ".google.cloud.kms.v1.ImportJob.ImportMethod",
10164            ))
10165        }
10166    }
10167
10168    /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
10169    /// it can be used.
10170    ///
10171    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10172    ///
10173    /// # Working with unknown values
10174    ///
10175    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10176    /// additional enum variants at any time. Adding new variants is not considered
10177    /// a breaking change. Applications should write their code in anticipation of:
10178    ///
10179    /// - New values appearing in future releases of the client library, **and**
10180    /// - New values received dynamically, without application changes.
10181    ///
10182    /// Please consult the [Working with enums] section in the user guide for some
10183    /// guidelines.
10184    ///
10185    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10186    #[derive(Clone, Debug, PartialEq)]
10187    #[non_exhaustive]
10188    pub enum ImportJobState {
10189        /// Not specified.
10190        Unspecified,
10191        /// The wrapping key for this job is still being generated. It may not be
10192        /// used. Cloud KMS will automatically mark this job as
10193        /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
10194        /// the wrapping key is generated.
10195        ///
10196        /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
10197        PendingGeneration,
10198        /// This job may be used in
10199        /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
10200        /// and
10201        /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
10202        /// requests.
10203        ///
10204        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
10205        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
10206        Active,
10207        /// This job can no longer be used and may not leave this state once entered.
10208        Expired,
10209        /// If set, the enum was initialized with an unknown value.
10210        ///
10211        /// Applications can examine the value using [ImportJobState::value] or
10212        /// [ImportJobState::name].
10213        UnknownValue(import_job_state::UnknownValue),
10214    }
10215
10216    #[doc(hidden)]
10217    pub mod import_job_state {
10218        #[allow(unused_imports)]
10219        use super::*;
10220        #[derive(Clone, Debug, PartialEq)]
10221        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10222    }
10223
10224    impl ImportJobState {
10225        /// Gets the enum value.
10226        ///
10227        /// Returns `None` if the enum contains an unknown value deserialized from
10228        /// the string representation of enums.
10229        pub fn value(&self) -> std::option::Option<i32> {
10230            match self {
10231                Self::Unspecified => std::option::Option::Some(0),
10232                Self::PendingGeneration => std::option::Option::Some(1),
10233                Self::Active => std::option::Option::Some(2),
10234                Self::Expired => std::option::Option::Some(3),
10235                Self::UnknownValue(u) => u.0.value(),
10236            }
10237        }
10238
10239        /// Gets the enum value as a string.
10240        ///
10241        /// Returns `None` if the enum contains an unknown value deserialized from
10242        /// the integer representation of enums.
10243        pub fn name(&self) -> std::option::Option<&str> {
10244            match self {
10245                Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
10246                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
10247                Self::Active => std::option::Option::Some("ACTIVE"),
10248                Self::Expired => std::option::Option::Some("EXPIRED"),
10249                Self::UnknownValue(u) => u.0.name(),
10250            }
10251        }
10252    }
10253
10254    impl std::default::Default for ImportJobState {
10255        fn default() -> Self {
10256            use std::convert::From;
10257            Self::from(0)
10258        }
10259    }
10260
10261    impl std::fmt::Display for ImportJobState {
10262        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10263            wkt::internal::display_enum(f, self.name(), self.value())
10264        }
10265    }
10266
10267    impl std::convert::From<i32> for ImportJobState {
10268        fn from(value: i32) -> Self {
10269            match value {
10270                0 => Self::Unspecified,
10271                1 => Self::PendingGeneration,
10272                2 => Self::Active,
10273                3 => Self::Expired,
10274                _ => Self::UnknownValue(import_job_state::UnknownValue(
10275                    wkt::internal::UnknownEnumValue::Integer(value),
10276                )),
10277            }
10278        }
10279    }
10280
10281    impl std::convert::From<&str> for ImportJobState {
10282        fn from(value: &str) -> Self {
10283            use std::string::ToString;
10284            match value {
10285                "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10286                "PENDING_GENERATION" => Self::PendingGeneration,
10287                "ACTIVE" => Self::Active,
10288                "EXPIRED" => Self::Expired,
10289                _ => Self::UnknownValue(import_job_state::UnknownValue(
10290                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10291                )),
10292            }
10293        }
10294    }
10295
10296    impl serde::ser::Serialize for ImportJobState {
10297        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10298        where
10299            S: serde::Serializer,
10300        {
10301            match self {
10302                Self::Unspecified => serializer.serialize_i32(0),
10303                Self::PendingGeneration => serializer.serialize_i32(1),
10304                Self::Active => serializer.serialize_i32(2),
10305                Self::Expired => serializer.serialize_i32(3),
10306                Self::UnknownValue(u) => u.0.serialize(serializer),
10307            }
10308        }
10309    }
10310
10311    impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10312        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10313        where
10314            D: serde::Deserializer<'de>,
10315        {
10316            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10317                ".google.cloud.kms.v1.ImportJob.ImportJobState",
10318            ))
10319        }
10320    }
10321}
10322
10323/// ExternalProtectionLevelOptions stores a group of additional fields for
10324/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10325/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10326/// protection level and
10327/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10328/// levels.
10329///
10330/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10331/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10332/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10333#[derive(Clone, Default, PartialEq)]
10334#[non_exhaustive]
10335pub struct ExternalProtectionLevelOptions {
10336    /// The URI for an external resource that this
10337    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10338    ///
10339    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10340    pub external_key_uri: std::string::String,
10341
10342    /// The path to the external key material on the EKM when using
10343    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10344    /// this field instead of external_key_uri when using an
10345    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10346    ///
10347    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10348    pub ekm_connection_key_path: std::string::String,
10349
10350    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10351}
10352
10353impl ExternalProtectionLevelOptions {
10354    pub fn new() -> Self {
10355        std::default::Default::default()
10356    }
10357
10358    /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10359    ///
10360    /// # Example
10361    /// ```ignore,no_run
10362    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10363    /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10364    /// ```
10365    pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10366        mut self,
10367        v: T,
10368    ) -> Self {
10369        self.external_key_uri = v.into();
10370        self
10371    }
10372
10373    /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10374    ///
10375    /// # Example
10376    /// ```ignore,no_run
10377    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10378    /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10379    /// ```
10380    pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10381        mut self,
10382        v: T,
10383    ) -> Self {
10384        self.ekm_connection_key_path = v.into();
10385        self
10386    }
10387}
10388
10389impl wkt::message::Message for ExternalProtectionLevelOptions {
10390    fn typename() -> &'static str {
10391        "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10392    }
10393}
10394
10395/// A
10396/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10397/// specifies zero or more allowed
10398/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10399/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey].
10400///
10401/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10402/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10403/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10404#[derive(Clone, Default, PartialEq)]
10405#[non_exhaustive]
10406pub struct KeyAccessJustificationsPolicy {
10407    /// The list of allowed reasons for access to a
10408    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Zero allowed access reasons
10409    /// means all encrypt, decrypt, and sign operations for the
10410    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with this policy will
10411    /// fail.
10412    ///
10413    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10414    pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10415
10416    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10417}
10418
10419impl KeyAccessJustificationsPolicy {
10420    pub fn new() -> Self {
10421        std::default::Default::default()
10422    }
10423
10424    /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10425    ///
10426    /// # Example
10427    /// ```ignore,no_run
10428    /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10429    /// use google_cloud_kms_v1::model::AccessReason;
10430    /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10431    ///     AccessReason::CustomerInitiatedSupport,
10432    ///     AccessReason::GoogleInitiatedService,
10433    ///     AccessReason::ThirdPartyDataRequest,
10434    /// ]);
10435    /// ```
10436    pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10437    where
10438        T: std::iter::IntoIterator<Item = V>,
10439        V: std::convert::Into<crate::model::AccessReason>,
10440    {
10441        use std::iter::Iterator;
10442        self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10443        self
10444    }
10445}
10446
10447impl wkt::message::Message for KeyAccessJustificationsPolicy {
10448    fn typename() -> &'static str {
10449        "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10450    }
10451}
10452
10453/// A RetiredResource resource represents the record of a deleted
10454/// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Its purpose is to provide
10455/// visibility into retained user data and to prevent reuse of these names for
10456/// new [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10457///
10458/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10459#[derive(Clone, Default, PartialEq)]
10460#[non_exhaustive]
10461pub struct RetiredResource {
10462    /// Output only. Identifier. The resource name for this
10463    /// [RetiredResource][google.cloud.kms.v1.RetiredResource] in the format
10464    /// `projects/*/locations/*/retiredResources/*`.
10465    ///
10466    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10467    pub name: std::string::String,
10468
10469    /// Output only. The full resource name of the original
10470    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] that was deleted in the format
10471    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10472    ///
10473    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10474    pub original_resource: std::string::String,
10475
10476    /// Output only. The resource type of the original deleted resource.
10477    pub resource_type: std::string::String,
10478
10479    /// Output only. The time at which the original resource was deleted and this
10480    /// RetiredResource record was created.
10481    pub delete_time: std::option::Option<wkt::Timestamp>,
10482
10483    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10484}
10485
10486impl RetiredResource {
10487    pub fn new() -> Self {
10488        std::default::Default::default()
10489    }
10490
10491    /// Sets the value of [name][crate::model::RetiredResource::name].
10492    ///
10493    /// # Example
10494    /// ```ignore,no_run
10495    /// # use google_cloud_kms_v1::model::RetiredResource;
10496    /// let x = RetiredResource::new().set_name("example");
10497    /// ```
10498    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10499        self.name = v.into();
10500        self
10501    }
10502
10503    /// Sets the value of [original_resource][crate::model::RetiredResource::original_resource].
10504    ///
10505    /// # Example
10506    /// ```ignore,no_run
10507    /// # use google_cloud_kms_v1::model::RetiredResource;
10508    /// let x = RetiredResource::new().set_original_resource("example");
10509    /// ```
10510    pub fn set_original_resource<T: std::convert::Into<std::string::String>>(
10511        mut self,
10512        v: T,
10513    ) -> Self {
10514        self.original_resource = v.into();
10515        self
10516    }
10517
10518    /// Sets the value of [resource_type][crate::model::RetiredResource::resource_type].
10519    ///
10520    /// # Example
10521    /// ```ignore,no_run
10522    /// # use google_cloud_kms_v1::model::RetiredResource;
10523    /// let x = RetiredResource::new().set_resource_type("example");
10524    /// ```
10525    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10526        self.resource_type = v.into();
10527        self
10528    }
10529
10530    /// Sets the value of [delete_time][crate::model::RetiredResource::delete_time].
10531    ///
10532    /// # Example
10533    /// ```ignore,no_run
10534    /// # use google_cloud_kms_v1::model::RetiredResource;
10535    /// use wkt::Timestamp;
10536    /// let x = RetiredResource::new().set_delete_time(Timestamp::default()/* use setters */);
10537    /// ```
10538    pub fn set_delete_time<T>(mut self, v: T) -> Self
10539    where
10540        T: std::convert::Into<wkt::Timestamp>,
10541    {
10542        self.delete_time = std::option::Option::Some(v.into());
10543        self
10544    }
10545
10546    /// Sets or clears the value of [delete_time][crate::model::RetiredResource::delete_time].
10547    ///
10548    /// # Example
10549    /// ```ignore,no_run
10550    /// # use google_cloud_kms_v1::model::RetiredResource;
10551    /// use wkt::Timestamp;
10552    /// let x = RetiredResource::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
10553    /// let x = RetiredResource::new().set_or_clear_delete_time(None::<Timestamp>);
10554    /// ```
10555    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
10556    where
10557        T: std::convert::Into<wkt::Timestamp>,
10558    {
10559        self.delete_time = v.map(|x| x.into());
10560        self
10561    }
10562}
10563
10564impl wkt::message::Message for RetiredResource {
10565    fn typename() -> &'static str {
10566        "type.googleapis.com/google.cloud.kms.v1.RetiredResource"
10567    }
10568}
10569
10570/// Request message for
10571/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10572///
10573/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10574#[derive(Clone, Default, PartialEq)]
10575#[non_exhaustive]
10576pub struct ListKeyRingsRequest {
10577    /// Required. The resource name of the location associated with the
10578    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
10579    /// `projects/*/locations/*`.
10580    ///
10581    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10582    pub parent: std::string::String,
10583
10584    /// Optional. Optional limit on the number of
10585    /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
10586    /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
10587    /// including the
10588    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
10589    /// in a subsequent request.  If unspecified, the server will pick an
10590    /// appropriate default.
10591    ///
10592    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10593    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10594    pub page_size: i32,
10595
10596    /// Optional. Optional pagination token, returned earlier via
10597    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
10598    ///
10599    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10600    pub page_token: std::string::String,
10601
10602    /// Optional. Only include resources that match the filter in the response. For
10603    /// more information, see
10604    /// [Sorting and filtering list
10605    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10606    pub filter: std::string::String,
10607
10608    /// Optional. Specify how the results should be sorted. If not specified, the
10609    /// results will be sorted in the default order.  For more information, see
10610    /// [Sorting and filtering list
10611    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10612    pub order_by: std::string::String,
10613
10614    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10615}
10616
10617impl ListKeyRingsRequest {
10618    pub fn new() -> Self {
10619        std::default::Default::default()
10620    }
10621
10622    /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
10623    ///
10624    /// # Example
10625    /// ```ignore,no_run
10626    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10627    /// let x = ListKeyRingsRequest::new().set_parent("example");
10628    /// ```
10629    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10630        self.parent = v.into();
10631        self
10632    }
10633
10634    /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
10635    ///
10636    /// # Example
10637    /// ```ignore,no_run
10638    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10639    /// let x = ListKeyRingsRequest::new().set_page_size(42);
10640    /// ```
10641    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10642        self.page_size = v.into();
10643        self
10644    }
10645
10646    /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
10647    ///
10648    /// # Example
10649    /// ```ignore,no_run
10650    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10651    /// let x = ListKeyRingsRequest::new().set_page_token("example");
10652    /// ```
10653    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10654        self.page_token = v.into();
10655        self
10656    }
10657
10658    /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
10659    ///
10660    /// # Example
10661    /// ```ignore,no_run
10662    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10663    /// let x = ListKeyRingsRequest::new().set_filter("example");
10664    /// ```
10665    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10666        self.filter = v.into();
10667        self
10668    }
10669
10670    /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
10671    ///
10672    /// # Example
10673    /// ```ignore,no_run
10674    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10675    /// let x = ListKeyRingsRequest::new().set_order_by("example");
10676    /// ```
10677    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10678        self.order_by = v.into();
10679        self
10680    }
10681}
10682
10683impl wkt::message::Message for ListKeyRingsRequest {
10684    fn typename() -> &'static str {
10685        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
10686    }
10687}
10688
10689/// Request message for
10690/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10691///
10692/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10693#[derive(Clone, Default, PartialEq)]
10694#[non_exhaustive]
10695pub struct ListCryptoKeysRequest {
10696    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10697    /// to list, in the format `projects/*/locations/*/keyRings/*`.
10698    ///
10699    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10700    pub parent: std::string::String,
10701
10702    /// Optional. Optional limit on the number of
10703    /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
10704    /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
10705    /// obtained by including the
10706    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
10707    /// in a subsequent request.  If unspecified, the server will pick an
10708    /// appropriate default.
10709    ///
10710    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10711    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10712    pub page_size: i32,
10713
10714    /// Optional. Optional pagination token, returned earlier via
10715    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
10716    ///
10717    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10718    pub page_token: std::string::String,
10719
10720    /// The fields of the primary version to include in the response.
10721    pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
10722
10723    /// Optional. Only include resources that match the filter in the response. For
10724    /// more information, see
10725    /// [Sorting and filtering list
10726    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10727    pub filter: std::string::String,
10728
10729    /// Optional. Specify how the results should be sorted. If not specified, the
10730    /// results will be sorted in the default order. For more information, see
10731    /// [Sorting and filtering list
10732    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10733    pub order_by: std::string::String,
10734
10735    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10736}
10737
10738impl ListCryptoKeysRequest {
10739    pub fn new() -> Self {
10740        std::default::Default::default()
10741    }
10742
10743    /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
10744    ///
10745    /// # Example
10746    /// ```ignore,no_run
10747    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10748    /// let x = ListCryptoKeysRequest::new().set_parent("example");
10749    /// ```
10750    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10751        self.parent = v.into();
10752        self
10753    }
10754
10755    /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
10756    ///
10757    /// # Example
10758    /// ```ignore,no_run
10759    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10760    /// let x = ListCryptoKeysRequest::new().set_page_size(42);
10761    /// ```
10762    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10763        self.page_size = v.into();
10764        self
10765    }
10766
10767    /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
10768    ///
10769    /// # Example
10770    /// ```ignore,no_run
10771    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10772    /// let x = ListCryptoKeysRequest::new().set_page_token("example");
10773    /// ```
10774    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10775        self.page_token = v.into();
10776        self
10777    }
10778
10779    /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
10780    ///
10781    /// # Example
10782    /// ```ignore,no_run
10783    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10784    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10785    /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
10786    /// ```
10787    pub fn set_version_view<
10788        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10789    >(
10790        mut self,
10791        v: T,
10792    ) -> Self {
10793        self.version_view = v.into();
10794        self
10795    }
10796
10797    /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
10798    ///
10799    /// # Example
10800    /// ```ignore,no_run
10801    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10802    /// let x = ListCryptoKeysRequest::new().set_filter("example");
10803    /// ```
10804    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10805        self.filter = v.into();
10806        self
10807    }
10808
10809    /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
10810    ///
10811    /// # Example
10812    /// ```ignore,no_run
10813    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10814    /// let x = ListCryptoKeysRequest::new().set_order_by("example");
10815    /// ```
10816    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10817        self.order_by = v.into();
10818        self
10819    }
10820}
10821
10822impl wkt::message::Message for ListCryptoKeysRequest {
10823    fn typename() -> &'static str {
10824        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
10825    }
10826}
10827
10828/// Request message for
10829/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
10830///
10831/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
10832#[derive(Clone, Default, PartialEq)]
10833#[non_exhaustive]
10834pub struct ListCryptoKeyVersionsRequest {
10835    /// Required. The resource name of the
10836    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
10837    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10838    ///
10839    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10840    pub parent: std::string::String,
10841
10842    /// Optional. Optional limit on the number of
10843    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
10844    /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
10845    /// can subsequently be obtained by including the
10846    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
10847    /// in a subsequent request. If unspecified, the server will pick an
10848    /// appropriate default.
10849    ///
10850    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10851    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10852    pub page_size: i32,
10853
10854    /// Optional. Optional pagination token, returned earlier via
10855    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
10856    ///
10857    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10858    pub page_token: std::string::String,
10859
10860    /// The fields to include in the response.
10861    pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
10862
10863    /// Optional. Only include resources that match the filter in the response. For
10864    /// more information, see
10865    /// [Sorting and filtering list
10866    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10867    pub filter: std::string::String,
10868
10869    /// Optional. Specify how the results should be sorted. If not specified, the
10870    /// results will be sorted in the default order. For more information, see
10871    /// [Sorting and filtering list
10872    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10873    pub order_by: std::string::String,
10874
10875    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10876}
10877
10878impl ListCryptoKeyVersionsRequest {
10879    pub fn new() -> Self {
10880        std::default::Default::default()
10881    }
10882
10883    /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
10884    ///
10885    /// # Example
10886    /// ```ignore,no_run
10887    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10888    /// let x = ListCryptoKeyVersionsRequest::new().set_parent("example");
10889    /// ```
10890    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10891        self.parent = v.into();
10892        self
10893    }
10894
10895    /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
10896    ///
10897    /// # Example
10898    /// ```ignore,no_run
10899    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10900    /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
10901    /// ```
10902    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10903        self.page_size = v.into();
10904        self
10905    }
10906
10907    /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
10908    ///
10909    /// # Example
10910    /// ```ignore,no_run
10911    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10912    /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
10913    /// ```
10914    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10915        self.page_token = v.into();
10916        self
10917    }
10918
10919    /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
10920    ///
10921    /// # Example
10922    /// ```ignore,no_run
10923    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10924    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10925    /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
10926    /// ```
10927    pub fn set_view<
10928        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10929    >(
10930        mut self,
10931        v: T,
10932    ) -> Self {
10933        self.view = v.into();
10934        self
10935    }
10936
10937    /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
10938    ///
10939    /// # Example
10940    /// ```ignore,no_run
10941    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10942    /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
10943    /// ```
10944    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10945        self.filter = v.into();
10946        self
10947    }
10948
10949    /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
10950    ///
10951    /// # Example
10952    /// ```ignore,no_run
10953    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10954    /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
10955    /// ```
10956    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10957        self.order_by = v.into();
10958        self
10959    }
10960}
10961
10962impl wkt::message::Message for ListCryptoKeyVersionsRequest {
10963    fn typename() -> &'static str {
10964        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
10965    }
10966}
10967
10968/// Request message for
10969/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
10970///
10971/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
10972#[derive(Clone, Default, PartialEq)]
10973#[non_exhaustive]
10974pub struct ListImportJobsRequest {
10975    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10976    /// to list, in the format `projects/*/locations/*/keyRings/*`.
10977    ///
10978    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10979    pub parent: std::string::String,
10980
10981    /// Optional. Optional limit on the number of
10982    /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
10983    /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
10984    /// obtained by including the
10985    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
10986    /// in a subsequent request. If unspecified, the server will pick an
10987    /// appropriate default.
10988    ///
10989    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10990    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10991    pub page_size: i32,
10992
10993    /// Optional. Optional pagination token, returned earlier via
10994    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
10995    ///
10996    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10997    pub page_token: std::string::String,
10998
10999    /// Optional. Only include resources that match the filter in the response. For
11000    /// more information, see
11001    /// [Sorting and filtering list
11002    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11003    pub filter: std::string::String,
11004
11005    /// Optional. Specify how the results should be sorted. If not specified, the
11006    /// results will be sorted in the default order. For more information, see
11007    /// [Sorting and filtering list
11008    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11009    pub order_by: std::string::String,
11010
11011    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11012}
11013
11014impl ListImportJobsRequest {
11015    pub fn new() -> Self {
11016        std::default::Default::default()
11017    }
11018
11019    /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
11020    ///
11021    /// # Example
11022    /// ```ignore,no_run
11023    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11024    /// let x = ListImportJobsRequest::new().set_parent("example");
11025    /// ```
11026    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11027        self.parent = v.into();
11028        self
11029    }
11030
11031    /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
11032    ///
11033    /// # Example
11034    /// ```ignore,no_run
11035    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11036    /// let x = ListImportJobsRequest::new().set_page_size(42);
11037    /// ```
11038    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11039        self.page_size = v.into();
11040        self
11041    }
11042
11043    /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
11044    ///
11045    /// # Example
11046    /// ```ignore,no_run
11047    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11048    /// let x = ListImportJobsRequest::new().set_page_token("example");
11049    /// ```
11050    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11051        self.page_token = v.into();
11052        self
11053    }
11054
11055    /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
11056    ///
11057    /// # Example
11058    /// ```ignore,no_run
11059    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11060    /// let x = ListImportJobsRequest::new().set_filter("example");
11061    /// ```
11062    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11063        self.filter = v.into();
11064        self
11065    }
11066
11067    /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
11068    ///
11069    /// # Example
11070    /// ```ignore,no_run
11071    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11072    /// let x = ListImportJobsRequest::new().set_order_by("example");
11073    /// ```
11074    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11075        self.order_by = v.into();
11076        self
11077    }
11078}
11079
11080impl wkt::message::Message for ListImportJobsRequest {
11081    fn typename() -> &'static str {
11082        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
11083    }
11084}
11085
11086/// Request message for
11087/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11088///
11089/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11090#[derive(Clone, Default, PartialEq)]
11091#[non_exhaustive]
11092pub struct ListRetiredResourcesRequest {
11093    /// Required. The project-specific location holding the
11094    /// [RetiredResources][google.cloud.kms.v1.RetiredResource], in the format
11095    /// `projects/*/locations/*`.
11096    ///
11097    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11098    pub parent: std::string::String,
11099
11100    /// Optional. Optional limit on the number of
11101    /// [RetiredResources][google.cloud.kms.v1.RetiredResource] to be included in
11102    /// the response. Further
11103    /// [RetiredResources][google.cloud.kms.v1.RetiredResource] can subsequently be
11104    /// obtained by including the
11105    /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]
11106    /// in a subsequent request. If unspecified, the server will pick an
11107    /// appropriate default.
11108    ///
11109    /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11110    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11111    pub page_size: i32,
11112
11113    /// Optional. Optional pagination token, returned earlier via
11114    /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token].
11115    ///
11116    /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11117    pub page_token: std::string::String,
11118
11119    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11120}
11121
11122impl ListRetiredResourcesRequest {
11123    pub fn new() -> Self {
11124        std::default::Default::default()
11125    }
11126
11127    /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
11128    ///
11129    /// # Example
11130    /// ```ignore,no_run
11131    /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11132    /// let x = ListRetiredResourcesRequest::new().set_parent("example");
11133    /// ```
11134    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11135        self.parent = v.into();
11136        self
11137    }
11138
11139    /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
11140    ///
11141    /// # Example
11142    /// ```ignore,no_run
11143    /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11144    /// let x = ListRetiredResourcesRequest::new().set_page_size(42);
11145    /// ```
11146    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11147        self.page_size = v.into();
11148        self
11149    }
11150
11151    /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
11152    ///
11153    /// # Example
11154    /// ```ignore,no_run
11155    /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11156    /// let x = ListRetiredResourcesRequest::new().set_page_token("example");
11157    /// ```
11158    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11159        self.page_token = v.into();
11160        self
11161    }
11162}
11163
11164impl wkt::message::Message for ListRetiredResourcesRequest {
11165    fn typename() -> &'static str {
11166        "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesRequest"
11167    }
11168}
11169
11170/// Response message for
11171/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
11172///
11173/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
11174#[derive(Clone, Default, PartialEq)]
11175#[non_exhaustive]
11176pub struct ListKeyRingsResponse {
11177    /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
11178    ///
11179    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11180    pub key_rings: std::vec::Vec<crate::model::KeyRing>,
11181
11182    /// A token to retrieve next page of results. Pass this value in
11183    /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
11184    /// to retrieve the next page of results.
11185    ///
11186    /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
11187    pub next_page_token: std::string::String,
11188
11189    /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
11190    /// the query.
11191    ///
11192    /// This field is not populated if
11193    /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
11194    /// is applied.
11195    ///
11196    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11197    /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
11198    pub total_size: i32,
11199
11200    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11201}
11202
11203impl ListKeyRingsResponse {
11204    pub fn new() -> Self {
11205        std::default::Default::default()
11206    }
11207
11208    /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
11209    ///
11210    /// # Example
11211    /// ```ignore,no_run
11212    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11213    /// use google_cloud_kms_v1::model::KeyRing;
11214    /// let x = ListKeyRingsResponse::new()
11215    ///     .set_key_rings([
11216    ///         KeyRing::default()/* use setters */,
11217    ///         KeyRing::default()/* use (different) setters */,
11218    ///     ]);
11219    /// ```
11220    pub fn set_key_rings<T, V>(mut self, v: T) -> Self
11221    where
11222        T: std::iter::IntoIterator<Item = V>,
11223        V: std::convert::Into<crate::model::KeyRing>,
11224    {
11225        use std::iter::Iterator;
11226        self.key_rings = v.into_iter().map(|i| i.into()).collect();
11227        self
11228    }
11229
11230    /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
11231    ///
11232    /// # Example
11233    /// ```ignore,no_run
11234    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11235    /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
11236    /// ```
11237    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11238        self.next_page_token = v.into();
11239        self
11240    }
11241
11242    /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
11243    ///
11244    /// # Example
11245    /// ```ignore,no_run
11246    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11247    /// let x = ListKeyRingsResponse::new().set_total_size(42);
11248    /// ```
11249    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11250        self.total_size = v.into();
11251        self
11252    }
11253}
11254
11255impl wkt::message::Message for ListKeyRingsResponse {
11256    fn typename() -> &'static str {
11257        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
11258    }
11259}
11260
11261#[doc(hidden)]
11262impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
11263    type PageItem = crate::model::KeyRing;
11264
11265    fn items(self) -> std::vec::Vec<Self::PageItem> {
11266        self.key_rings
11267    }
11268
11269    fn next_page_token(&self) -> std::string::String {
11270        use std::clone::Clone;
11271        self.next_page_token.clone()
11272    }
11273}
11274
11275/// Response message for
11276/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11277///
11278/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11279#[derive(Clone, Default, PartialEq)]
11280#[non_exhaustive]
11281pub struct ListCryptoKeysResponse {
11282    /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11283    ///
11284    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11285    pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
11286
11287    /// A token to retrieve next page of results. Pass this value in
11288    /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
11289    /// to retrieve the next page of results.
11290    ///
11291    /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
11292    pub next_page_token: std::string::String,
11293
11294    /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
11295    /// matched the query.
11296    ///
11297    /// This field is not populated if
11298    /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
11299    /// is applied.
11300    ///
11301    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11302    /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
11303    pub total_size: i32,
11304
11305    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11306}
11307
11308impl ListCryptoKeysResponse {
11309    pub fn new() -> Self {
11310        std::default::Default::default()
11311    }
11312
11313    /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
11314    ///
11315    /// # Example
11316    /// ```ignore,no_run
11317    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11318    /// use google_cloud_kms_v1::model::CryptoKey;
11319    /// let x = ListCryptoKeysResponse::new()
11320    ///     .set_crypto_keys([
11321    ///         CryptoKey::default()/* use setters */,
11322    ///         CryptoKey::default()/* use (different) setters */,
11323    ///     ]);
11324    /// ```
11325    pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
11326    where
11327        T: std::iter::IntoIterator<Item = V>,
11328        V: std::convert::Into<crate::model::CryptoKey>,
11329    {
11330        use std::iter::Iterator;
11331        self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
11332        self
11333    }
11334
11335    /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
11336    ///
11337    /// # Example
11338    /// ```ignore,no_run
11339    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11340    /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
11341    /// ```
11342    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11343        self.next_page_token = v.into();
11344        self
11345    }
11346
11347    /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
11348    ///
11349    /// # Example
11350    /// ```ignore,no_run
11351    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11352    /// let x = ListCryptoKeysResponse::new().set_total_size(42);
11353    /// ```
11354    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11355        self.total_size = v.into();
11356        self
11357    }
11358}
11359
11360impl wkt::message::Message for ListCryptoKeysResponse {
11361    fn typename() -> &'static str {
11362        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
11363    }
11364}
11365
11366#[doc(hidden)]
11367impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
11368    type PageItem = crate::model::CryptoKey;
11369
11370    fn items(self) -> std::vec::Vec<Self::PageItem> {
11371        self.crypto_keys
11372    }
11373
11374    fn next_page_token(&self) -> std::string::String {
11375        use std::clone::Clone;
11376        self.next_page_token.clone()
11377    }
11378}
11379
11380/// Response message for
11381/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11382///
11383/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11384#[derive(Clone, Default, PartialEq)]
11385#[non_exhaustive]
11386pub struct ListCryptoKeyVersionsResponse {
11387    /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11388    ///
11389    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11390    pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
11391
11392    /// A token to retrieve next page of results. Pass this value in
11393    /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
11394    /// to retrieve the next page of results.
11395    ///
11396    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
11397    pub next_page_token: std::string::String,
11398
11399    /// The total number of
11400    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
11401    /// query.
11402    ///
11403    /// This field is not populated if
11404    /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
11405    /// is applied.
11406    ///
11407    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11408    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
11409    pub total_size: i32,
11410
11411    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11412}
11413
11414impl ListCryptoKeyVersionsResponse {
11415    pub fn new() -> Self {
11416        std::default::Default::default()
11417    }
11418
11419    /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
11420    ///
11421    /// # Example
11422    /// ```ignore,no_run
11423    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11424    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11425    /// let x = ListCryptoKeyVersionsResponse::new()
11426    ///     .set_crypto_key_versions([
11427    ///         CryptoKeyVersion::default()/* use setters */,
11428    ///         CryptoKeyVersion::default()/* use (different) setters */,
11429    ///     ]);
11430    /// ```
11431    pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
11432    where
11433        T: std::iter::IntoIterator<Item = V>,
11434        V: std::convert::Into<crate::model::CryptoKeyVersion>,
11435    {
11436        use std::iter::Iterator;
11437        self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
11438        self
11439    }
11440
11441    /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
11442    ///
11443    /// # Example
11444    /// ```ignore,no_run
11445    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11446    /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
11447    /// ```
11448    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11449        self.next_page_token = v.into();
11450        self
11451    }
11452
11453    /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
11454    ///
11455    /// # Example
11456    /// ```ignore,no_run
11457    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11458    /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
11459    /// ```
11460    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11461        self.total_size = v.into();
11462        self
11463    }
11464}
11465
11466impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11467    fn typename() -> &'static str {
11468        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11469    }
11470}
11471
11472#[doc(hidden)]
11473impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11474    type PageItem = crate::model::CryptoKeyVersion;
11475
11476    fn items(self) -> std::vec::Vec<Self::PageItem> {
11477        self.crypto_key_versions
11478    }
11479
11480    fn next_page_token(&self) -> std::string::String {
11481        use std::clone::Clone;
11482        self.next_page_token.clone()
11483    }
11484}
11485
11486/// Response message for
11487/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11488///
11489/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11490#[derive(Clone, Default, PartialEq)]
11491#[non_exhaustive]
11492pub struct ListImportJobsResponse {
11493    /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11494    ///
11495    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11496    pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
11497
11498    /// A token to retrieve next page of results. Pass this value in
11499    /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
11500    /// to retrieve the next page of results.
11501    ///
11502    /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
11503    pub next_page_token: std::string::String,
11504
11505    /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
11506    /// matched the query.
11507    ///
11508    /// This field is not populated if
11509    /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
11510    /// is applied.
11511    ///
11512    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11513    /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
11514    pub total_size: i32,
11515
11516    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11517}
11518
11519impl ListImportJobsResponse {
11520    pub fn new() -> Self {
11521        std::default::Default::default()
11522    }
11523
11524    /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
11525    ///
11526    /// # Example
11527    /// ```ignore,no_run
11528    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11529    /// use google_cloud_kms_v1::model::ImportJob;
11530    /// let x = ListImportJobsResponse::new()
11531    ///     .set_import_jobs([
11532    ///         ImportJob::default()/* use setters */,
11533    ///         ImportJob::default()/* use (different) setters */,
11534    ///     ]);
11535    /// ```
11536    pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
11537    where
11538        T: std::iter::IntoIterator<Item = V>,
11539        V: std::convert::Into<crate::model::ImportJob>,
11540    {
11541        use std::iter::Iterator;
11542        self.import_jobs = v.into_iter().map(|i| i.into()).collect();
11543        self
11544    }
11545
11546    /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
11547    ///
11548    /// # Example
11549    /// ```ignore,no_run
11550    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11551    /// let x = ListImportJobsResponse::new().set_next_page_token("example");
11552    /// ```
11553    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11554        self.next_page_token = v.into();
11555        self
11556    }
11557
11558    /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
11559    ///
11560    /// # Example
11561    /// ```ignore,no_run
11562    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11563    /// let x = ListImportJobsResponse::new().set_total_size(42);
11564    /// ```
11565    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11566        self.total_size = v.into();
11567        self
11568    }
11569}
11570
11571impl wkt::message::Message for ListImportJobsResponse {
11572    fn typename() -> &'static str {
11573        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
11574    }
11575}
11576
11577#[doc(hidden)]
11578impl google_cloud_gax::paginator::internal::PageableResponse for ListImportJobsResponse {
11579    type PageItem = crate::model::ImportJob;
11580
11581    fn items(self) -> std::vec::Vec<Self::PageItem> {
11582        self.import_jobs
11583    }
11584
11585    fn next_page_token(&self) -> std::string::String {
11586        use std::clone::Clone;
11587        self.next_page_token.clone()
11588    }
11589}
11590
11591/// Response message for
11592/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11593///
11594/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11595#[derive(Clone, Default, PartialEq)]
11596#[non_exhaustive]
11597pub struct ListRetiredResourcesResponse {
11598    /// The list of [RetiredResources][google.cloud.kms.v1.RetiredResource].
11599    ///
11600    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11601    pub retired_resources: std::vec::Vec<crate::model::RetiredResource>,
11602
11603    /// A token to retrieve the next page of results. Pass this value in
11604    /// [ListRetiredResourcesRequest.page_token][google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]
11605    /// to retrieve the next page of results.
11606    ///
11607    /// [google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]: crate::model::ListRetiredResourcesRequest::page_token
11608    pub next_page_token: std::string::String,
11609
11610    /// The total number of [RetiredResources][google.cloud.kms.v1.RetiredResource]
11611    /// that matched the query.
11612    ///
11613    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11614    pub total_size: i64,
11615
11616    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11617}
11618
11619impl ListRetiredResourcesResponse {
11620    pub fn new() -> Self {
11621        std::default::Default::default()
11622    }
11623
11624    /// Sets the value of [retired_resources][crate::model::ListRetiredResourcesResponse::retired_resources].
11625    ///
11626    /// # Example
11627    /// ```ignore,no_run
11628    /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11629    /// use google_cloud_kms_v1::model::RetiredResource;
11630    /// let x = ListRetiredResourcesResponse::new()
11631    ///     .set_retired_resources([
11632    ///         RetiredResource::default()/* use setters */,
11633    ///         RetiredResource::default()/* use (different) setters */,
11634    ///     ]);
11635    /// ```
11636    pub fn set_retired_resources<T, V>(mut self, v: T) -> Self
11637    where
11638        T: std::iter::IntoIterator<Item = V>,
11639        V: std::convert::Into<crate::model::RetiredResource>,
11640    {
11641        use std::iter::Iterator;
11642        self.retired_resources = v.into_iter().map(|i| i.into()).collect();
11643        self
11644    }
11645
11646    /// Sets the value of [next_page_token][crate::model::ListRetiredResourcesResponse::next_page_token].
11647    ///
11648    /// # Example
11649    /// ```ignore,no_run
11650    /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11651    /// let x = ListRetiredResourcesResponse::new().set_next_page_token("example");
11652    /// ```
11653    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11654        self.next_page_token = v.into();
11655        self
11656    }
11657
11658    /// Sets the value of [total_size][crate::model::ListRetiredResourcesResponse::total_size].
11659    ///
11660    /// # Example
11661    /// ```ignore,no_run
11662    /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11663    /// let x = ListRetiredResourcesResponse::new().set_total_size(42);
11664    /// ```
11665    pub fn set_total_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11666        self.total_size = v.into();
11667        self
11668    }
11669}
11670
11671impl wkt::message::Message for ListRetiredResourcesResponse {
11672    fn typename() -> &'static str {
11673        "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesResponse"
11674    }
11675}
11676
11677#[doc(hidden)]
11678impl google_cloud_gax::paginator::internal::PageableResponse for ListRetiredResourcesResponse {
11679    type PageItem = crate::model::RetiredResource;
11680
11681    fn items(self) -> std::vec::Vec<Self::PageItem> {
11682        self.retired_resources
11683    }
11684
11685    fn next_page_token(&self) -> std::string::String {
11686        use std::clone::Clone;
11687        self.next_page_token.clone()
11688    }
11689}
11690
11691/// Request message for
11692/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
11693///
11694/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
11695#[derive(Clone, Default, PartialEq)]
11696#[non_exhaustive]
11697pub struct GetKeyRingRequest {
11698    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
11699    /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
11700    ///
11701    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11702    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11703    pub name: std::string::String,
11704
11705    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11706}
11707
11708impl GetKeyRingRequest {
11709    pub fn new() -> Self {
11710        std::default::Default::default()
11711    }
11712
11713    /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
11714    ///
11715    /// # Example
11716    /// ```ignore,no_run
11717    /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
11718    /// let x = GetKeyRingRequest::new().set_name("example");
11719    /// ```
11720    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11721        self.name = v.into();
11722        self
11723    }
11724}
11725
11726impl wkt::message::Message for GetKeyRingRequest {
11727    fn typename() -> &'static str {
11728        "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
11729    }
11730}
11731
11732/// Request message for
11733/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
11734///
11735/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
11736#[derive(Clone, Default, PartialEq)]
11737#[non_exhaustive]
11738pub struct GetCryptoKeyRequest {
11739    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11740    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
11741    ///
11742    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11743    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11744    pub name: std::string::String,
11745
11746    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11747}
11748
11749impl GetCryptoKeyRequest {
11750    pub fn new() -> Self {
11751        std::default::Default::default()
11752    }
11753
11754    /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
11755    ///
11756    /// # Example
11757    /// ```ignore,no_run
11758    /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
11759    /// let x = GetCryptoKeyRequest::new().set_name("example");
11760    /// ```
11761    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11762        self.name = v.into();
11763        self
11764    }
11765}
11766
11767impl wkt::message::Message for GetCryptoKeyRequest {
11768    fn typename() -> &'static str {
11769        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
11770    }
11771}
11772
11773/// Request message for
11774/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
11775///
11776/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
11777#[derive(Clone, Default, PartialEq)]
11778#[non_exhaustive]
11779pub struct GetCryptoKeyVersionRequest {
11780    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11781    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
11782    ///
11783    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11784    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11785    pub name: std::string::String,
11786
11787    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11788}
11789
11790impl GetCryptoKeyVersionRequest {
11791    pub fn new() -> Self {
11792        std::default::Default::default()
11793    }
11794
11795    /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
11796    ///
11797    /// # Example
11798    /// ```ignore,no_run
11799    /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
11800    /// let x = GetCryptoKeyVersionRequest::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
11808impl wkt::message::Message for GetCryptoKeyVersionRequest {
11809    fn typename() -> &'static str {
11810        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
11811    }
11812}
11813
11814/// Request message for
11815/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
11816///
11817/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
11818#[derive(Clone, Default, PartialEq)]
11819#[non_exhaustive]
11820pub struct GetPublicKeyRequest {
11821    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11822    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
11823    ///
11824    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11825    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11826    pub name: std::string::String,
11827
11828    /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
11829    /// by the user. This field is required for PQC algorithms. If specified, the
11830    /// public key will be exported through the
11831    /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
11832    /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
11833    /// field will be populated for non-PQC algorithms, and an error will be
11834    /// returned for PQC algorithms.
11835    ///
11836    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
11837    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
11838    /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
11839    pub public_key_format: crate::model::public_key::PublicKeyFormat,
11840
11841    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11842}
11843
11844impl GetPublicKeyRequest {
11845    pub fn new() -> Self {
11846        std::default::Default::default()
11847    }
11848
11849    /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
11850    ///
11851    /// # Example
11852    /// ```ignore,no_run
11853    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11854    /// let x = GetPublicKeyRequest::new().set_name("example");
11855    /// ```
11856    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11857        self.name = v.into();
11858        self
11859    }
11860
11861    /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
11862    ///
11863    /// # Example
11864    /// ```ignore,no_run
11865    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11866    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
11867    /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
11868    /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
11869    /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
11870    /// ```
11871    pub fn set_public_key_format<
11872        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
11873    >(
11874        mut self,
11875        v: T,
11876    ) -> Self {
11877        self.public_key_format = v.into();
11878        self
11879    }
11880}
11881
11882impl wkt::message::Message for GetPublicKeyRequest {
11883    fn typename() -> &'static str {
11884        "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
11885    }
11886}
11887
11888/// Request message for
11889/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
11890///
11891/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
11892#[derive(Clone, Default, PartialEq)]
11893#[non_exhaustive]
11894pub struct GetImportJobRequest {
11895    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
11896    /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
11897    ///
11898    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11899    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
11900    pub name: std::string::String,
11901
11902    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11903}
11904
11905impl GetImportJobRequest {
11906    pub fn new() -> Self {
11907        std::default::Default::default()
11908    }
11909
11910    /// Sets the value of [name][crate::model::GetImportJobRequest::name].
11911    ///
11912    /// # Example
11913    /// ```ignore,no_run
11914    /// # use google_cloud_kms_v1::model::GetImportJobRequest;
11915    /// let x = GetImportJobRequest::new().set_name("example");
11916    /// ```
11917    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11918        self.name = v.into();
11919        self
11920    }
11921}
11922
11923impl wkt::message::Message for GetImportJobRequest {
11924    fn typename() -> &'static str {
11925        "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
11926    }
11927}
11928
11929/// Request message for
11930/// [KeyManagementService.GetRetiredResource][google.cloud.kms.v1.KeyManagementService.GetRetiredResource].
11931///
11932/// [google.cloud.kms.v1.KeyManagementService.GetRetiredResource]: crate::client::KeyManagementService::get_retired_resource
11933#[derive(Clone, Default, PartialEq)]
11934#[non_exhaustive]
11935pub struct GetRetiredResourceRequest {
11936    /// Required. The [name][google.cloud.kms.v1.RetiredResource.name] of the
11937    /// [RetiredResource][google.cloud.kms.v1.RetiredResource] to get.
11938    ///
11939    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11940    /// [google.cloud.kms.v1.RetiredResource.name]: crate::model::RetiredResource::name
11941    pub name: std::string::String,
11942
11943    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11944}
11945
11946impl GetRetiredResourceRequest {
11947    pub fn new() -> Self {
11948        std::default::Default::default()
11949    }
11950
11951    /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
11952    ///
11953    /// # Example
11954    /// ```ignore,no_run
11955    /// # use google_cloud_kms_v1::model::GetRetiredResourceRequest;
11956    /// let x = GetRetiredResourceRequest::new().set_name("example");
11957    /// ```
11958    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11959        self.name = v.into();
11960        self
11961    }
11962}
11963
11964impl wkt::message::Message for GetRetiredResourceRequest {
11965    fn typename() -> &'static str {
11966        "type.googleapis.com/google.cloud.kms.v1.GetRetiredResourceRequest"
11967    }
11968}
11969
11970/// Request message for
11971/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
11972///
11973/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
11974#[derive(Clone, Default, PartialEq)]
11975#[non_exhaustive]
11976pub struct CreateKeyRingRequest {
11977    /// Required. The resource name of the location associated with the
11978    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
11979    /// `projects/*/locations/*`.
11980    ///
11981    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11982    pub parent: std::string::String,
11983
11984    /// Required. It must be unique within a location and match the regular
11985    /// expression `[a-zA-Z0-9_-]{1,63}`
11986    pub key_ring_id: std::string::String,
11987
11988    /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
11989    /// values.
11990    ///
11991    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11992    pub key_ring: std::option::Option<crate::model::KeyRing>,
11993
11994    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11995}
11996
11997impl CreateKeyRingRequest {
11998    pub fn new() -> Self {
11999        std::default::Default::default()
12000    }
12001
12002    /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
12003    ///
12004    /// # Example
12005    /// ```ignore,no_run
12006    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12007    /// let x = CreateKeyRingRequest::new().set_parent("example");
12008    /// ```
12009    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12010        self.parent = v.into();
12011        self
12012    }
12013
12014    /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
12015    ///
12016    /// # Example
12017    /// ```ignore,no_run
12018    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12019    /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
12020    /// ```
12021    pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12022        self.key_ring_id = v.into();
12023        self
12024    }
12025
12026    /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12027    ///
12028    /// # Example
12029    /// ```ignore,no_run
12030    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12031    /// use google_cloud_kms_v1::model::KeyRing;
12032    /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
12033    /// ```
12034    pub fn set_key_ring<T>(mut self, v: T) -> Self
12035    where
12036        T: std::convert::Into<crate::model::KeyRing>,
12037    {
12038        self.key_ring = std::option::Option::Some(v.into());
12039        self
12040    }
12041
12042    /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12043    ///
12044    /// # Example
12045    /// ```ignore,no_run
12046    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12047    /// use google_cloud_kms_v1::model::KeyRing;
12048    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
12049    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
12050    /// ```
12051    pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
12052    where
12053        T: std::convert::Into<crate::model::KeyRing>,
12054    {
12055        self.key_ring = v.map(|x| x.into());
12056        self
12057    }
12058}
12059
12060impl wkt::message::Message for CreateKeyRingRequest {
12061    fn typename() -> &'static str {
12062        "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
12063    }
12064}
12065
12066/// Request message for
12067/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
12068///
12069/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
12070#[derive(Clone, Default, PartialEq)]
12071#[non_exhaustive]
12072pub struct CreateCryptoKeyRequest {
12073    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
12074    /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
12075    ///
12076    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12077    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12078    pub parent: std::string::String,
12079
12080    /// Required. It must be unique within a KeyRing and match the regular
12081    /// expression `[a-zA-Z0-9_-]{1,63}`
12082    pub crypto_key_id: std::string::String,
12083
12084    /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
12085    /// values.
12086    ///
12087    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12088    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12089
12090    /// If set to true, the request will create a
12091    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
12092    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
12093    /// manually call
12094    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
12095    /// or
12096    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
12097    /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
12098    ///
12099    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12100    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12101    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12102    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12103    pub skip_initial_version_creation: bool,
12104
12105    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12106}
12107
12108impl CreateCryptoKeyRequest {
12109    pub fn new() -> Self {
12110        std::default::Default::default()
12111    }
12112
12113    /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
12114    ///
12115    /// # Example
12116    /// ```ignore,no_run
12117    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12118    /// let x = CreateCryptoKeyRequest::new().set_parent("example");
12119    /// ```
12120    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12121        self.parent = v.into();
12122        self
12123    }
12124
12125    /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
12126    ///
12127    /// # Example
12128    /// ```ignore,no_run
12129    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12130    /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
12131    /// ```
12132    pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12133        self.crypto_key_id = v.into();
12134        self
12135    }
12136
12137    /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12138    ///
12139    /// # Example
12140    /// ```ignore,no_run
12141    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12142    /// use google_cloud_kms_v1::model::CryptoKey;
12143    /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12144    /// ```
12145    pub fn set_crypto_key<T>(mut self, v: T) -> Self
12146    where
12147        T: std::convert::Into<crate::model::CryptoKey>,
12148    {
12149        self.crypto_key = std::option::Option::Some(v.into());
12150        self
12151    }
12152
12153    /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12154    ///
12155    /// # Example
12156    /// ```ignore,no_run
12157    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12158    /// use google_cloud_kms_v1::model::CryptoKey;
12159    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12160    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12161    /// ```
12162    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12163    where
12164        T: std::convert::Into<crate::model::CryptoKey>,
12165    {
12166        self.crypto_key = v.map(|x| x.into());
12167        self
12168    }
12169
12170    /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
12171    ///
12172    /// # Example
12173    /// ```ignore,no_run
12174    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12175    /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
12176    /// ```
12177    pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12178        self.skip_initial_version_creation = v.into();
12179        self
12180    }
12181}
12182
12183impl wkt::message::Message for CreateCryptoKeyRequest {
12184    fn typename() -> &'static str {
12185        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
12186    }
12187}
12188
12189/// Request message for
12190/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
12191///
12192/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12193#[derive(Clone, Default, PartialEq)]
12194#[non_exhaustive]
12195pub struct CreateCryptoKeyVersionRequest {
12196    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12197    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
12198    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
12199    ///
12200    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12201    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12202    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12203    pub parent: std::string::String,
12204
12205    /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12206    /// initial field values.
12207    ///
12208    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12209    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12210
12211    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12212}
12213
12214impl CreateCryptoKeyVersionRequest {
12215    pub fn new() -> Self {
12216        std::default::Default::default()
12217    }
12218
12219    /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
12220    ///
12221    /// # Example
12222    /// ```ignore,no_run
12223    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12224    /// let x = CreateCryptoKeyVersionRequest::new().set_parent("example");
12225    /// ```
12226    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12227        self.parent = v.into();
12228        self
12229    }
12230
12231    /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12232    ///
12233    /// # Example
12234    /// ```ignore,no_run
12235    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12236    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12237    /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12238    /// ```
12239    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12240    where
12241        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12242    {
12243        self.crypto_key_version = std::option::Option::Some(v.into());
12244        self
12245    }
12246
12247    /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12248    ///
12249    /// # Example
12250    /// ```ignore,no_run
12251    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12252    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12253    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12254    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12255    /// ```
12256    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12257    where
12258        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12259    {
12260        self.crypto_key_version = v.map(|x| x.into());
12261        self
12262    }
12263}
12264
12265impl wkt::message::Message for CreateCryptoKeyVersionRequest {
12266    fn typename() -> &'static str {
12267        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
12268    }
12269}
12270
12271/// Request message for
12272/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey].
12273///
12274/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
12275#[derive(Clone, Default, PartialEq)]
12276#[non_exhaustive]
12277pub struct DeleteCryptoKeyRequest {
12278    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12279    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to delete.
12280    ///
12281    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12282    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12283    pub name: std::string::String,
12284
12285    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12286}
12287
12288impl DeleteCryptoKeyRequest {
12289    pub fn new() -> Self {
12290        std::default::Default::default()
12291    }
12292
12293    /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
12294    ///
12295    /// # Example
12296    /// ```ignore,no_run
12297    /// # use google_cloud_kms_v1::model::DeleteCryptoKeyRequest;
12298    /// let x = DeleteCryptoKeyRequest::new().set_name("example");
12299    /// ```
12300    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12301        self.name = v.into();
12302        self
12303    }
12304}
12305
12306impl wkt::message::Message for DeleteCryptoKeyRequest {
12307    fn typename() -> &'static str {
12308        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyRequest"
12309    }
12310}
12311
12312/// Request message for
12313/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion].
12314///
12315/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
12316#[derive(Clone, Default, PartialEq)]
12317#[non_exhaustive]
12318pub struct DeleteCryptoKeyVersionRequest {
12319    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12320    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to delete.
12321    ///
12322    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12323    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12324    pub name: std::string::String,
12325
12326    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12327}
12328
12329impl DeleteCryptoKeyVersionRequest {
12330    pub fn new() -> Self {
12331        std::default::Default::default()
12332    }
12333
12334    /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
12335    ///
12336    /// # Example
12337    /// ```ignore,no_run
12338    /// # use google_cloud_kms_v1::model::DeleteCryptoKeyVersionRequest;
12339    /// let x = DeleteCryptoKeyVersionRequest::new().set_name("example");
12340    /// ```
12341    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12342        self.name = v.into();
12343        self
12344    }
12345}
12346
12347impl wkt::message::Message for DeleteCryptoKeyVersionRequest {
12348    fn typename() -> &'static str {
12349        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionRequest"
12350    }
12351}
12352
12353/// Request message for
12354/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
12355///
12356/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12357#[derive(Clone, Default, PartialEq)]
12358#[non_exhaustive]
12359pub struct ImportCryptoKeyVersionRequest {
12360    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12361    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
12362    ///
12363    /// The create permission is only required on this key when creating a new
12364    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
12365    ///
12366    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12367    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12368    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12369    pub parent: std::string::String,
12370
12371    /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
12372    /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
12373    /// target for an import operation. If this field is not present, a new
12374    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
12375    /// supplied key material is created.
12376    ///
12377    /// If this field is present, the supplied key material is imported into
12378    /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
12379    /// import into an existing
12380    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
12381    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
12382    /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
12383    /// have been previously created via
12384    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
12385    /// and be in
12386    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
12387    /// or
12388    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
12389    /// state. The key material and algorithm must match the previous
12390    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
12391    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
12392    /// key material.
12393    ///
12394    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12395    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
12396    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
12397    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12398    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
12399    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12400    pub crypto_key_version: std::string::String,
12401
12402    /// Required. The
12403    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
12404    /// of the key being imported. This does not need to match the
12405    /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
12406    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
12407    ///
12408    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12409    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
12410    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
12411    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
12412
12413    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12414    /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
12415    /// material.
12416    ///
12417    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12418    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12419    pub import_job: std::string::String,
12420
12421    /// Optional. The wrapped key material to import.
12422    ///
12423    /// Before wrapping, key material must be formatted. If importing symmetric key
12424    /// material, the expected key material format is plain bytes. If importing
12425    /// asymmetric key material, the expected key material format is PKCS#8-encoded
12426    /// DER (the PrivateKeyInfo structure from RFC 5208).
12427    ///
12428    /// When wrapping with import methods
12429    /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
12430    /// or
12431    /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
12432    /// or
12433    /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
12434    /// or
12435    /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
12436    ///
12437    /// this field must contain the concatenation of:
12438    ///
12439    /// This format is the same as the format produced by PKCS#11 mechanism
12440    /// CKM_RSA_AES_KEY_WRAP.
12441    ///
12442    /// When wrapping with import methods
12443    /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
12444    /// or
12445    /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
12446    ///
12447    /// this field must contain the formatted key to be imported, wrapped with the
12448    /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
12449    /// with SHA-256, MGF1 with SHA-256, and an empty label.
12450    ///
12451    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
12452    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
12453    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
12454    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
12455    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
12456    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
12457    /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
12458    pub wrapped_key: ::bytes::Bytes,
12459
12460    /// This field is legacy. Use the field
12461    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12462    /// instead.
12463    ///
12464    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12465    pub wrapped_key_material:
12466        std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
12467
12468    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12469}
12470
12471impl ImportCryptoKeyVersionRequest {
12472    pub fn new() -> Self {
12473        std::default::Default::default()
12474    }
12475
12476    /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
12477    ///
12478    /// # Example
12479    /// ```ignore,no_run
12480    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12481    /// let x = ImportCryptoKeyVersionRequest::new().set_parent("example");
12482    /// ```
12483    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12484        self.parent = v.into();
12485        self
12486    }
12487
12488    /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
12489    ///
12490    /// # Example
12491    /// ```ignore,no_run
12492    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12493    /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version("example");
12494    /// ```
12495    pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
12496        mut self,
12497        v: T,
12498    ) -> Self {
12499        self.crypto_key_version = v.into();
12500        self
12501    }
12502
12503    /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
12504    ///
12505    /// # Example
12506    /// ```ignore,no_run
12507    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12508    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
12509    /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
12510    /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
12511    /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
12512    /// ```
12513    pub fn set_algorithm<
12514        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
12515    >(
12516        mut self,
12517        v: T,
12518    ) -> Self {
12519        self.algorithm = v.into();
12520        self
12521    }
12522
12523    /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
12524    ///
12525    /// # Example
12526    /// ```ignore,no_run
12527    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12528    /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
12529    /// ```
12530    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12531        self.import_job = v.into();
12532        self
12533    }
12534
12535    /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
12536    ///
12537    /// # Example
12538    /// ```ignore,no_run
12539    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12540    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
12541    /// ```
12542    pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12543        self.wrapped_key = v.into();
12544        self
12545    }
12546
12547    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
12548    ///
12549    /// Note that all the setters affecting `wrapped_key_material` are mutually
12550    /// exclusive.
12551    ///
12552    /// # Example
12553    /// ```ignore,no_run
12554    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12555    /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
12556    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
12557    /// ```
12558    pub fn set_wrapped_key_material<
12559        T: std::convert::Into<
12560                std::option::Option<
12561                    crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
12562                >,
12563            >,
12564    >(
12565        mut self,
12566        v: T,
12567    ) -> Self {
12568        self.wrapped_key_material = v.into();
12569        self
12570    }
12571
12572    /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12573    /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
12574    /// holds a different branch.
12575    pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
12576        #[allow(unreachable_patterns)]
12577        self.wrapped_key_material.as_ref().and_then(|v| match v {
12578            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
12579            _ => std::option::Option::None,
12580        })
12581    }
12582
12583    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12584    /// to hold a `RsaAesWrappedKey`.
12585    ///
12586    /// Note that all the setters affecting `wrapped_key_material` are
12587    /// mutually exclusive.
12588    ///
12589    /// # Example
12590    /// ```ignore,no_run
12591    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12592    /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
12593    /// assert!(x.rsa_aes_wrapped_key().is_some());
12594    /// ```
12595    pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12596        self.wrapped_key_material = std::option::Option::Some(
12597            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
12598                v.into(),
12599            ),
12600        );
12601        self
12602    }
12603}
12604
12605impl wkt::message::Message for ImportCryptoKeyVersionRequest {
12606    fn typename() -> &'static str {
12607        "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
12608    }
12609}
12610
12611/// Defines additional types related to [ImportCryptoKeyVersionRequest].
12612pub mod import_crypto_key_version_request {
12613    #[allow(unused_imports)]
12614    use super::*;
12615
12616    /// This field is legacy. Use the field
12617    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12618    /// instead.
12619    ///
12620    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12621    #[derive(Clone, Debug, PartialEq)]
12622    #[non_exhaustive]
12623    pub enum WrappedKeyMaterial {
12624        /// Optional. This field has the same meaning as
12625        /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
12626        /// Prefer to use that field in new work. Either that field or this field
12627        /// (but not both) must be specified.
12628        ///
12629        /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12630        RsaAesWrappedKey(::bytes::Bytes),
12631    }
12632}
12633
12634/// Request message for
12635/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
12636///
12637/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
12638#[derive(Clone, Default, PartialEq)]
12639#[non_exhaustive]
12640pub struct CreateImportJobRequest {
12641    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
12642    /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
12643    /// [ImportJobs][google.cloud.kms.v1.ImportJob].
12644    ///
12645    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12646    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12647    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12648    pub parent: std::string::String,
12649
12650    /// Required. It must be unique within a KeyRing and match the regular
12651    /// expression `[a-zA-Z0-9_-]{1,63}`
12652    pub import_job_id: std::string::String,
12653
12654    /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
12655    /// values.
12656    ///
12657    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12658    pub import_job: std::option::Option<crate::model::ImportJob>,
12659
12660    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12661}
12662
12663impl CreateImportJobRequest {
12664    pub fn new() -> Self {
12665        std::default::Default::default()
12666    }
12667
12668    /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
12669    ///
12670    /// # Example
12671    /// ```ignore,no_run
12672    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12673    /// let x = CreateImportJobRequest::new().set_parent("example");
12674    /// ```
12675    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12676        self.parent = v.into();
12677        self
12678    }
12679
12680    /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
12681    ///
12682    /// # Example
12683    /// ```ignore,no_run
12684    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12685    /// let x = CreateImportJobRequest::new().set_import_job_id("example");
12686    /// ```
12687    pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12688        self.import_job_id = v.into();
12689        self
12690    }
12691
12692    /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12693    ///
12694    /// # Example
12695    /// ```ignore,no_run
12696    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12697    /// use google_cloud_kms_v1::model::ImportJob;
12698    /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
12699    /// ```
12700    pub fn set_import_job<T>(mut self, v: T) -> Self
12701    where
12702        T: std::convert::Into<crate::model::ImportJob>,
12703    {
12704        self.import_job = std::option::Option::Some(v.into());
12705        self
12706    }
12707
12708    /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12709    ///
12710    /// # Example
12711    /// ```ignore,no_run
12712    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12713    /// use google_cloud_kms_v1::model::ImportJob;
12714    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
12715    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
12716    /// ```
12717    pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
12718    where
12719        T: std::convert::Into<crate::model::ImportJob>,
12720    {
12721        self.import_job = v.map(|x| x.into());
12722        self
12723    }
12724}
12725
12726impl wkt::message::Message for CreateImportJobRequest {
12727    fn typename() -> &'static str {
12728        "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
12729    }
12730}
12731
12732/// Request message for
12733/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
12734///
12735/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
12736#[derive(Clone, Default, PartialEq)]
12737#[non_exhaustive]
12738pub struct UpdateCryptoKeyRequest {
12739    /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
12740    ///
12741    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12742    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12743
12744    /// Required. List of fields to be updated in this request.
12745    pub update_mask: std::option::Option<wkt::FieldMask>,
12746
12747    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12748}
12749
12750impl UpdateCryptoKeyRequest {
12751    pub fn new() -> Self {
12752        std::default::Default::default()
12753    }
12754
12755    /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12756    ///
12757    /// # Example
12758    /// ```ignore,no_run
12759    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12760    /// use google_cloud_kms_v1::model::CryptoKey;
12761    /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12762    /// ```
12763    pub fn set_crypto_key<T>(mut self, v: T) -> Self
12764    where
12765        T: std::convert::Into<crate::model::CryptoKey>,
12766    {
12767        self.crypto_key = std::option::Option::Some(v.into());
12768        self
12769    }
12770
12771    /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12772    ///
12773    /// # Example
12774    /// ```ignore,no_run
12775    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12776    /// use google_cloud_kms_v1::model::CryptoKey;
12777    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12778    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12779    /// ```
12780    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12781    where
12782        T: std::convert::Into<crate::model::CryptoKey>,
12783    {
12784        self.crypto_key = v.map(|x| x.into());
12785        self
12786    }
12787
12788    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12789    ///
12790    /// # Example
12791    /// ```ignore,no_run
12792    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12793    /// use wkt::FieldMask;
12794    /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12795    /// ```
12796    pub fn set_update_mask<T>(mut self, v: T) -> Self
12797    where
12798        T: std::convert::Into<wkt::FieldMask>,
12799    {
12800        self.update_mask = std::option::Option::Some(v.into());
12801        self
12802    }
12803
12804    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12805    ///
12806    /// # Example
12807    /// ```ignore,no_run
12808    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12809    /// use wkt::FieldMask;
12810    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12811    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12812    /// ```
12813    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12814    where
12815        T: std::convert::Into<wkt::FieldMask>,
12816    {
12817        self.update_mask = v.map(|x| x.into());
12818        self
12819    }
12820}
12821
12822impl wkt::message::Message for UpdateCryptoKeyRequest {
12823    fn typename() -> &'static str {
12824        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
12825    }
12826}
12827
12828/// Request message for
12829/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
12830///
12831/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
12832#[derive(Clone, Default, PartialEq)]
12833#[non_exhaustive]
12834pub struct UpdateCryptoKeyVersionRequest {
12835    /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12836    /// updated values.
12837    ///
12838    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12839    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12840
12841    /// Required. List of fields to be updated in this request.
12842    pub update_mask: std::option::Option<wkt::FieldMask>,
12843
12844    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12845}
12846
12847impl UpdateCryptoKeyVersionRequest {
12848    pub fn new() -> Self {
12849        std::default::Default::default()
12850    }
12851
12852    /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12853    ///
12854    /// # Example
12855    /// ```ignore,no_run
12856    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12857    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12858    /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12859    /// ```
12860    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12861    where
12862        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12863    {
12864        self.crypto_key_version = std::option::Option::Some(v.into());
12865        self
12866    }
12867
12868    /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12869    ///
12870    /// # Example
12871    /// ```ignore,no_run
12872    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12873    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12874    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12875    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12876    /// ```
12877    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12878    where
12879        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12880    {
12881        self.crypto_key_version = v.map(|x| x.into());
12882        self
12883    }
12884
12885    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12886    ///
12887    /// # Example
12888    /// ```ignore,no_run
12889    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12890    /// use wkt::FieldMask;
12891    /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12892    /// ```
12893    pub fn set_update_mask<T>(mut self, v: T) -> Self
12894    where
12895        T: std::convert::Into<wkt::FieldMask>,
12896    {
12897        self.update_mask = std::option::Option::Some(v.into());
12898        self
12899    }
12900
12901    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12902    ///
12903    /// # Example
12904    /// ```ignore,no_run
12905    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12906    /// use wkt::FieldMask;
12907    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12908    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12909    /// ```
12910    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12911    where
12912        T: std::convert::Into<wkt::FieldMask>,
12913    {
12914        self.update_mask = v.map(|x| x.into());
12915        self
12916    }
12917}
12918
12919impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
12920    fn typename() -> &'static str {
12921        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
12922    }
12923}
12924
12925/// Request message for
12926/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
12927///
12928/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
12929#[derive(Clone, Default, PartialEq)]
12930#[non_exhaustive]
12931pub struct UpdateCryptoKeyPrimaryVersionRequest {
12932    /// Required. The resource name of the
12933    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
12934    ///
12935    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12936    pub name: std::string::String,
12937
12938    /// Required. The id of the child
12939    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
12940    ///
12941    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12942    pub crypto_key_version_id: std::string::String,
12943
12944    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12945}
12946
12947impl UpdateCryptoKeyPrimaryVersionRequest {
12948    pub fn new() -> Self {
12949        std::default::Default::default()
12950    }
12951
12952    /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
12953    ///
12954    /// # Example
12955    /// ```ignore,no_run
12956    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12957    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name("example");
12958    /// ```
12959    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12960        self.name = v.into();
12961        self
12962    }
12963
12964    /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
12965    ///
12966    /// # Example
12967    /// ```ignore,no_run
12968    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12969    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
12970    /// ```
12971    pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
12972        mut self,
12973        v: T,
12974    ) -> Self {
12975        self.crypto_key_version_id = v.into();
12976        self
12977    }
12978}
12979
12980impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
12981    fn typename() -> &'static str {
12982        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
12983    }
12984}
12985
12986/// Request message for
12987/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
12988///
12989/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
12990#[derive(Clone, Default, PartialEq)]
12991#[non_exhaustive]
12992pub struct DestroyCryptoKeyVersionRequest {
12993    /// Required. The resource name of the
12994    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
12995    ///
12996    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12997    pub name: std::string::String,
12998
12999    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13000}
13001
13002impl DestroyCryptoKeyVersionRequest {
13003    pub fn new() -> Self {
13004        std::default::Default::default()
13005    }
13006
13007    /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
13008    ///
13009    /// # Example
13010    /// ```ignore,no_run
13011    /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
13012    /// let x = DestroyCryptoKeyVersionRequest::new().set_name("example");
13013    /// ```
13014    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13015        self.name = v.into();
13016        self
13017    }
13018}
13019
13020impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
13021    fn typename() -> &'static str {
13022        "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
13023    }
13024}
13025
13026/// Request message for
13027/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
13028///
13029/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
13030#[derive(Clone, Default, PartialEq)]
13031#[non_exhaustive]
13032pub struct RestoreCryptoKeyVersionRequest {
13033    /// Required. The resource name of the
13034    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
13035    ///
13036    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13037    pub name: std::string::String,
13038
13039    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13040}
13041
13042impl RestoreCryptoKeyVersionRequest {
13043    pub fn new() -> Self {
13044        std::default::Default::default()
13045    }
13046
13047    /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
13048    ///
13049    /// # Example
13050    /// ```ignore,no_run
13051    /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
13052    /// let x = RestoreCryptoKeyVersionRequest::new().set_name("example");
13053    /// ```
13054    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13055        self.name = v.into();
13056        self
13057    }
13058}
13059
13060impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
13061    fn typename() -> &'static str {
13062        "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
13063    }
13064}
13065
13066/// Request message for
13067/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
13068///
13069/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
13070#[derive(Clone, Default, PartialEq)]
13071#[non_exhaustive]
13072pub struct EncryptRequest {
13073    /// Required. The resource name of the
13074    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
13075    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13076    /// encryption.
13077    ///
13078    /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
13079    /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
13080    ///
13081    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13082    /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
13083    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13084    pub name: std::string::String,
13085
13086    /// Required. The data to encrypt. Must be no larger than 64KiB.
13087    ///
13088    /// The maximum size depends on the key version's
13089    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13090    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13091    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13092    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
13093    /// plaintext must be no larger than 64KiB. For
13094    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13095    /// the plaintext and additional_authenticated_data fields must be no larger
13096    /// than 8KiB.
13097    ///
13098    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13099    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13100    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13101    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13102    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13103    pub plaintext: ::bytes::Bytes,
13104
13105    /// Optional. Optional data that, if specified, must also be provided during
13106    /// decryption through
13107    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13108    ///
13109    /// The maximum size depends on the key version's
13110    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13111    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13112    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13113    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
13114    /// AAD must be no larger than 64KiB. For
13115    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13116    /// the plaintext and additional_authenticated_data fields must be no larger
13117    /// than 8KiB.
13118    ///
13119    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13120    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13121    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13122    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13123    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13124    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13125    pub additional_authenticated_data: ::bytes::Bytes,
13126
13127    /// Optional. An optional CRC32C checksum of the
13128    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
13129    /// If specified,
13130    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13131    /// verify the integrity of the received
13132    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
13133    /// using this checksum.
13134    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13135    /// report an error if the checksum verification fails. If you receive a
13136    /// checksum error, your client should verify that
13137    /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
13138    /// is equal to
13139    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
13140    /// and if so, perform a limited number of retries. A persistent mismatch may
13141    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13142    /// field is defined as int64 for reasons of compatibility across different
13143    /// languages. However, it is a non-negative integer, which will never exceed
13144    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13145    /// this type.
13146    ///
13147    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
13148    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
13149    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13150    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13151
13152    /// Optional. An optional CRC32C checksum of the
13153    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13154    /// If specified,
13155    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13156    /// verify the integrity of the received
13157    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
13158    /// using this checksum.
13159    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13160    /// report an error if the checksum verification fails. If you receive a
13161    /// checksum error, your client should verify that
13162    /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
13163    /// is equal to
13164    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
13165    /// and if so, perform a limited number of retries. A persistent mismatch may
13166    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13167    /// field is defined as int64 for reasons of compatibility across different
13168    /// languages. However, it is a non-negative integer, which will never exceed
13169    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13170    /// this type.
13171    ///
13172    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13173    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
13174    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13175    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13176
13177    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13178}
13179
13180impl EncryptRequest {
13181    pub fn new() -> Self {
13182        std::default::Default::default()
13183    }
13184
13185    /// Sets the value of [name][crate::model::EncryptRequest::name].
13186    ///
13187    /// # Example
13188    /// ```ignore,no_run
13189    /// # use google_cloud_kms_v1::model::EncryptRequest;
13190    /// let x = EncryptRequest::new().set_name("example");
13191    /// ```
13192    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13193        self.name = v.into();
13194        self
13195    }
13196
13197    /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
13198    ///
13199    /// # Example
13200    /// ```ignore,no_run
13201    /// # use google_cloud_kms_v1::model::EncryptRequest;
13202    /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13203    /// ```
13204    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13205        self.plaintext = v.into();
13206        self
13207    }
13208
13209    /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
13210    ///
13211    /// # Example
13212    /// ```ignore,no_run
13213    /// # use google_cloud_kms_v1::model::EncryptRequest;
13214    /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13215    /// ```
13216    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13217        mut self,
13218        v: T,
13219    ) -> Self {
13220        self.additional_authenticated_data = v.into();
13221        self
13222    }
13223
13224    /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13225    ///
13226    /// # Example
13227    /// ```ignore,no_run
13228    /// # use google_cloud_kms_v1::model::EncryptRequest;
13229    /// use wkt::Int64Value;
13230    /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13231    /// ```
13232    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13233    where
13234        T: std::convert::Into<wkt::Int64Value>,
13235    {
13236        self.plaintext_crc32c = std::option::Option::Some(v.into());
13237        self
13238    }
13239
13240    /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13241    ///
13242    /// # Example
13243    /// ```ignore,no_run
13244    /// # use google_cloud_kms_v1::model::EncryptRequest;
13245    /// use wkt::Int64Value;
13246    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13247    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13248    /// ```
13249    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13250    where
13251        T: std::convert::Into<wkt::Int64Value>,
13252    {
13253        self.plaintext_crc32c = v.map(|x| x.into());
13254        self
13255    }
13256
13257    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13258    ///
13259    /// # Example
13260    /// ```ignore,no_run
13261    /// # use google_cloud_kms_v1::model::EncryptRequest;
13262    /// use wkt::Int64Value;
13263    /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13264    /// ```
13265    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13266    where
13267        T: std::convert::Into<wkt::Int64Value>,
13268    {
13269        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13270        self
13271    }
13272
13273    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13274    ///
13275    /// # Example
13276    /// ```ignore,no_run
13277    /// # use google_cloud_kms_v1::model::EncryptRequest;
13278    /// use wkt::Int64Value;
13279    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13280    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13281    /// ```
13282    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13283        mut self,
13284        v: std::option::Option<T>,
13285    ) -> Self
13286    where
13287        T: std::convert::Into<wkt::Int64Value>,
13288    {
13289        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13290        self
13291    }
13292}
13293
13294impl wkt::message::Message for EncryptRequest {
13295    fn typename() -> &'static str {
13296        "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
13297    }
13298}
13299
13300/// Request message for
13301/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
13302///
13303/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
13304#[derive(Clone, Default, PartialEq)]
13305#[non_exhaustive]
13306pub struct DecryptRequest {
13307    /// Required. The resource name of the
13308    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
13309    /// server will choose the appropriate version.
13310    ///
13311    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13312    pub name: std::string::String,
13313
13314    /// Required. The encrypted data originally returned in
13315    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
13316    ///
13317    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
13318    pub ciphertext: ::bytes::Bytes,
13319
13320    /// Optional. Optional data that must match the data originally supplied in
13321    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13322    ///
13323    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13324    pub additional_authenticated_data: ::bytes::Bytes,
13325
13326    /// Optional. An optional CRC32C checksum of the
13327    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
13328    /// If specified,
13329    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13330    /// verify the integrity of the received
13331    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
13332    /// using this checksum.
13333    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13334    /// report an error if the checksum verification fails. If you receive a
13335    /// checksum error, your client should verify that
13336    /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
13337    /// is equal to
13338    /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
13339    /// and if so, perform a limited number of retries. A persistent mismatch may
13340    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13341    /// field is defined as int64 for reasons of compatibility across different
13342    /// languages. However, it is a non-negative integer, which will never exceed
13343    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13344    /// this type.
13345    ///
13346    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
13347    /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
13348    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13349    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13350
13351    /// Optional. An optional CRC32C checksum of the
13352    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13353    /// If specified,
13354    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13355    /// verify the integrity of the received
13356    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
13357    /// using this checksum.
13358    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13359    /// report an error if the checksum verification fails. If you receive a
13360    /// checksum error, your client should verify that
13361    /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
13362    /// is equal to
13363    /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
13364    /// and if so, perform a limited number of retries. A persistent mismatch may
13365    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13366    /// field is defined as int64 for reasons of compatibility across different
13367    /// languages. However, it is a non-negative integer, which will never exceed
13368    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13369    /// this type.
13370    ///
13371    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13372    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
13373    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13374    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13375
13376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13377}
13378
13379impl DecryptRequest {
13380    pub fn new() -> Self {
13381        std::default::Default::default()
13382    }
13383
13384    /// Sets the value of [name][crate::model::DecryptRequest::name].
13385    ///
13386    /// # Example
13387    /// ```ignore,no_run
13388    /// # use google_cloud_kms_v1::model::DecryptRequest;
13389    /// let x = DecryptRequest::new().set_name("example");
13390    /// ```
13391    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13392        self.name = v.into();
13393        self
13394    }
13395
13396    /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
13397    ///
13398    /// # Example
13399    /// ```ignore,no_run
13400    /// # use google_cloud_kms_v1::model::DecryptRequest;
13401    /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13402    /// ```
13403    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13404        self.ciphertext = v.into();
13405        self
13406    }
13407
13408    /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
13409    ///
13410    /// # Example
13411    /// ```ignore,no_run
13412    /// # use google_cloud_kms_v1::model::DecryptRequest;
13413    /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13414    /// ```
13415    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13416        mut self,
13417        v: T,
13418    ) -> Self {
13419        self.additional_authenticated_data = v.into();
13420        self
13421    }
13422
13423    /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13424    ///
13425    /// # Example
13426    /// ```ignore,no_run
13427    /// # use google_cloud_kms_v1::model::DecryptRequest;
13428    /// use wkt::Int64Value;
13429    /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13430    /// ```
13431    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13432    where
13433        T: std::convert::Into<wkt::Int64Value>,
13434    {
13435        self.ciphertext_crc32c = std::option::Option::Some(v.into());
13436        self
13437    }
13438
13439    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13440    ///
13441    /// # Example
13442    /// ```ignore,no_run
13443    /// # use google_cloud_kms_v1::model::DecryptRequest;
13444    /// use wkt::Int64Value;
13445    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13446    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13447    /// ```
13448    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13449    where
13450        T: std::convert::Into<wkt::Int64Value>,
13451    {
13452        self.ciphertext_crc32c = v.map(|x| x.into());
13453        self
13454    }
13455
13456    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13457    ///
13458    /// # Example
13459    /// ```ignore,no_run
13460    /// # use google_cloud_kms_v1::model::DecryptRequest;
13461    /// use wkt::Int64Value;
13462    /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13463    /// ```
13464    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13465    where
13466        T: std::convert::Into<wkt::Int64Value>,
13467    {
13468        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13469        self
13470    }
13471
13472    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13473    ///
13474    /// # Example
13475    /// ```ignore,no_run
13476    /// # use google_cloud_kms_v1::model::DecryptRequest;
13477    /// use wkt::Int64Value;
13478    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13479    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13480    /// ```
13481    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13482        mut self,
13483        v: std::option::Option<T>,
13484    ) -> Self
13485    where
13486        T: std::convert::Into<wkt::Int64Value>,
13487    {
13488        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13489        self
13490    }
13491}
13492
13493impl wkt::message::Message for DecryptRequest {
13494    fn typename() -> &'static str {
13495        "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
13496    }
13497}
13498
13499/// Request message for
13500/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
13501///
13502/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
13503#[derive(Clone, Default, PartialEq)]
13504#[non_exhaustive]
13505pub struct RawEncryptRequest {
13506    /// Required. The resource name of the
13507    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13508    /// encryption.
13509    ///
13510    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13511    pub name: std::string::String,
13512
13513    /// Required. The data to encrypt. Must be no larger than 64KiB.
13514    ///
13515    /// The maximum size depends on the key version's
13516    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13517    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13518    /// plaintext must be no larger than 64KiB. For
13519    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13520    /// the plaintext and additional_authenticated_data fields must be no larger
13521    /// than 8KiB.
13522    ///
13523    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13524    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13525    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13526    pub plaintext: ::bytes::Bytes,
13527
13528    /// Optional. Optional data that, if specified, must also be provided during
13529    /// decryption through
13530    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13531    ///
13532    /// This field may only be used in conjunction with an
13533    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
13534    /// additional authenticated data (for example, AES-GCM).
13535    ///
13536    /// The maximum size depends on the key version's
13537    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13538    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13539    /// plaintext must be no larger than 64KiB. For
13540    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13541    /// the plaintext and additional_authenticated_data fields must be no larger
13542    /// than 8KiB.
13543    ///
13544    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13545    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13546    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13547    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13548    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13549    pub additional_authenticated_data: ::bytes::Bytes,
13550
13551    /// Optional. An optional CRC32C checksum of the
13552    /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
13553    /// If specified,
13554    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13555    /// verify the integrity of the received plaintext using this checksum.
13556    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13557    /// report an error if the checksum verification fails. If you receive a
13558    /// checksum error, your client should verify that CRC32C(plaintext) is equal
13559    /// to plaintext_crc32c, and if so, perform a limited number of retries. A
13560    /// persistent mismatch may indicate an issue in your computation of the CRC32C
13561    /// checksum. Note: This field is defined as int64 for reasons of compatibility
13562    /// across different languages. However, it is a non-negative integer, which
13563    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13564    /// languages that support this type.
13565    ///
13566    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13567    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
13568    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13569
13570    /// Optional. An optional CRC32C checksum of the
13571    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13572    /// If specified,
13573    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13574    /// verify the integrity of the received additional_authenticated_data using
13575    /// this checksum.
13576    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13577    /// report an error if the checksum verification fails. If you receive a
13578    /// checksum error, your client should verify that
13579    /// CRC32C(additional_authenticated_data) is equal to
13580    /// additional_authenticated_data_crc32c, and if so, perform
13581    /// a limited number of retries. A persistent mismatch may indicate an issue in
13582    /// your computation of the CRC32C checksum.
13583    /// Note: This field is defined as int64 for reasons of compatibility across
13584    /// different languages. However, it is a non-negative integer, which will
13585    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13586    /// that support this type.
13587    ///
13588    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13589    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13590    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13591
13592    /// Optional. A customer-supplied initialization vector that will be used for
13593    /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
13594    /// generated. It will be returned in
13595    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13596    ///
13597    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13598    pub initialization_vector: ::bytes::Bytes,
13599
13600    /// Optional. An optional CRC32C checksum of the
13601    /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
13602    /// If specified,
13603    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13604    /// verify the integrity of the received initialization_vector using this
13605    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13606    /// will report an error if the checksum verification fails. If you receive a
13607    /// checksum error, your client should verify that
13608    /// CRC32C(initialization_vector) is equal to
13609    /// initialization_vector_crc32c, and if so, perform
13610    /// a limited number of retries. A persistent mismatch may indicate an issue in
13611    /// your computation of the CRC32C checksum.
13612    /// Note: This field is defined as int64 for reasons of compatibility across
13613    /// different languages. However, it is a non-negative integer, which will
13614    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13615    /// that support this type.
13616    ///
13617    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13618    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
13619    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13620
13621    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13622}
13623
13624impl RawEncryptRequest {
13625    pub fn new() -> Self {
13626        std::default::Default::default()
13627    }
13628
13629    /// Sets the value of [name][crate::model::RawEncryptRequest::name].
13630    ///
13631    /// # Example
13632    /// ```ignore,no_run
13633    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13634    /// let x = RawEncryptRequest::new().set_name("example");
13635    /// ```
13636    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13637        self.name = v.into();
13638        self
13639    }
13640
13641    /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
13642    ///
13643    /// # Example
13644    /// ```ignore,no_run
13645    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13646    /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13647    /// ```
13648    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13649        self.plaintext = v.into();
13650        self
13651    }
13652
13653    /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
13654    ///
13655    /// # Example
13656    /// ```ignore,no_run
13657    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13658    /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13659    /// ```
13660    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13661        mut self,
13662        v: T,
13663    ) -> Self {
13664        self.additional_authenticated_data = v.into();
13665        self
13666    }
13667
13668    /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13669    ///
13670    /// # Example
13671    /// ```ignore,no_run
13672    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13673    /// use wkt::Int64Value;
13674    /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13675    /// ```
13676    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13677    where
13678        T: std::convert::Into<wkt::Int64Value>,
13679    {
13680        self.plaintext_crc32c = std::option::Option::Some(v.into());
13681        self
13682    }
13683
13684    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13685    ///
13686    /// # Example
13687    /// ```ignore,no_run
13688    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13689    /// use wkt::Int64Value;
13690    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13691    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13692    /// ```
13693    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13694    where
13695        T: std::convert::Into<wkt::Int64Value>,
13696    {
13697        self.plaintext_crc32c = v.map(|x| x.into());
13698        self
13699    }
13700
13701    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13702    ///
13703    /// # Example
13704    /// ```ignore,no_run
13705    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13706    /// use wkt::Int64Value;
13707    /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13708    /// ```
13709    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13710    where
13711        T: std::convert::Into<wkt::Int64Value>,
13712    {
13713        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13714        self
13715    }
13716
13717    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13718    ///
13719    /// # Example
13720    /// ```ignore,no_run
13721    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13722    /// use wkt::Int64Value;
13723    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13724    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13725    /// ```
13726    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13727        mut self,
13728        v: std::option::Option<T>,
13729    ) -> Self
13730    where
13731        T: std::convert::Into<wkt::Int64Value>,
13732    {
13733        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13734        self
13735    }
13736
13737    /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
13738    ///
13739    /// # Example
13740    /// ```ignore,no_run
13741    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13742    /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13743    /// ```
13744    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13745        mut self,
13746        v: T,
13747    ) -> Self {
13748        self.initialization_vector = v.into();
13749        self
13750    }
13751
13752    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13753    ///
13754    /// # Example
13755    /// ```ignore,no_run
13756    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13757    /// use wkt::Int64Value;
13758    /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
13759    /// ```
13760    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
13761    where
13762        T: std::convert::Into<wkt::Int64Value>,
13763    {
13764        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
13765        self
13766    }
13767
13768    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13769    ///
13770    /// # Example
13771    /// ```ignore,no_run
13772    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13773    /// use wkt::Int64Value;
13774    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
13775    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
13776    /// ```
13777    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13778    where
13779        T: std::convert::Into<wkt::Int64Value>,
13780    {
13781        self.initialization_vector_crc32c = v.map(|x| x.into());
13782        self
13783    }
13784}
13785
13786impl wkt::message::Message for RawEncryptRequest {
13787    fn typename() -> &'static str {
13788        "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
13789    }
13790}
13791
13792/// Request message for
13793/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
13794///
13795/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
13796#[derive(Clone, Default, PartialEq)]
13797#[non_exhaustive]
13798pub struct RawDecryptRequest {
13799    /// Required. The resource name of the
13800    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13801    /// decryption.
13802    ///
13803    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13804    pub name: std::string::String,
13805
13806    /// Required. The encrypted data originally returned in
13807    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
13808    ///
13809    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
13810    pub ciphertext: ::bytes::Bytes,
13811
13812    /// Optional. Optional data that must match the data originally supplied in
13813    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13814    ///
13815    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13816    pub additional_authenticated_data: ::bytes::Bytes,
13817
13818    /// Required. The initialization vector (IV) used during encryption, which must
13819    /// match the data originally provided in
13820    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13821    ///
13822    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13823    pub initialization_vector: ::bytes::Bytes,
13824
13825    /// The length of the authentication tag that is appended to the end of
13826    /// the ciphertext. If unspecified (0), the default value for the key's
13827    /// algorithm will be used (for AES-GCM, the default value is 16).
13828    pub tag_length: i32,
13829
13830    /// Optional. An optional CRC32C checksum of the
13831    /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
13832    /// If specified,
13833    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13834    /// verify the integrity of the received ciphertext using this checksum.
13835    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13836    /// report an error if the checksum verification fails. If you receive a
13837    /// checksum error, your client should verify that CRC32C(ciphertext) is equal
13838    /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
13839    /// persistent mismatch may indicate an issue in your computation of the CRC32C
13840    /// checksum. Note: This field is defined as int64 for reasons of compatibility
13841    /// across different languages. However, it is a non-negative integer, which
13842    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13843    /// languages that support this type.
13844    ///
13845    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13846    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
13847    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13848
13849    /// Optional. An optional CRC32C checksum of the
13850    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13851    /// If specified,
13852    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13853    /// verify the integrity of the received additional_authenticated_data using
13854    /// this checksum.
13855    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13856    /// report an error if the checksum verification fails. If you receive a
13857    /// checksum error, your client should verify that
13858    /// CRC32C(additional_authenticated_data) is equal to
13859    /// additional_authenticated_data_crc32c, and if so, perform
13860    /// a limited number of retries. A persistent mismatch may indicate an issue in
13861    /// your computation of the CRC32C checksum.
13862    /// Note: This field is defined as int64 for reasons of compatibility across
13863    /// different languages. However, it is a non-negative integer, which will
13864    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13865    /// that support this type.
13866    ///
13867    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13868    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13869    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13870
13871    /// Optional. An optional CRC32C checksum of the
13872    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
13873    /// If specified,
13874    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13875    /// verify the integrity of the received initialization_vector using this
13876    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13877    /// will report an error if the checksum verification fails. If you receive a
13878    /// checksum error, your client should verify that
13879    /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
13880    /// if so, perform a limited number of retries. A persistent mismatch may
13881    /// indicate an issue in your computation of the CRC32C checksum.
13882    /// Note: This field is defined as int64 for reasons of compatibility across
13883    /// different languages. However, it is a non-negative integer, which will
13884    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13885    /// that support this type.
13886    ///
13887    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13888    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
13889    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13890
13891    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13892}
13893
13894impl RawDecryptRequest {
13895    pub fn new() -> Self {
13896        std::default::Default::default()
13897    }
13898
13899    /// Sets the value of [name][crate::model::RawDecryptRequest::name].
13900    ///
13901    /// # Example
13902    /// ```ignore,no_run
13903    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13904    /// let x = RawDecryptRequest::new().set_name("example");
13905    /// ```
13906    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13907        self.name = v.into();
13908        self
13909    }
13910
13911    /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
13912    ///
13913    /// # Example
13914    /// ```ignore,no_run
13915    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13916    /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13917    /// ```
13918    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13919        self.ciphertext = v.into();
13920        self
13921    }
13922
13923    /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
13924    ///
13925    /// # Example
13926    /// ```ignore,no_run
13927    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13928    /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13929    /// ```
13930    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13931        mut self,
13932        v: T,
13933    ) -> Self {
13934        self.additional_authenticated_data = v.into();
13935        self
13936    }
13937
13938    /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
13939    ///
13940    /// # Example
13941    /// ```ignore,no_run
13942    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13943    /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13944    /// ```
13945    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13946        mut self,
13947        v: T,
13948    ) -> Self {
13949        self.initialization_vector = v.into();
13950        self
13951    }
13952
13953    /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
13954    ///
13955    /// # Example
13956    /// ```ignore,no_run
13957    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13958    /// let x = RawDecryptRequest::new().set_tag_length(42);
13959    /// ```
13960    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13961        self.tag_length = v.into();
13962        self
13963    }
13964
13965    /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13966    ///
13967    /// # Example
13968    /// ```ignore,no_run
13969    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13970    /// use wkt::Int64Value;
13971    /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13972    /// ```
13973    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13974    where
13975        T: std::convert::Into<wkt::Int64Value>,
13976    {
13977        self.ciphertext_crc32c = std::option::Option::Some(v.into());
13978        self
13979    }
13980
13981    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13982    ///
13983    /// # Example
13984    /// ```ignore,no_run
13985    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13986    /// use wkt::Int64Value;
13987    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13988    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13989    /// ```
13990    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13991    where
13992        T: std::convert::Into<wkt::Int64Value>,
13993    {
13994        self.ciphertext_crc32c = v.map(|x| x.into());
13995        self
13996    }
13997
13998    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
13999    ///
14000    /// # Example
14001    /// ```ignore,no_run
14002    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14003    /// use wkt::Int64Value;
14004    /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14005    /// ```
14006    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14007    where
14008        T: std::convert::Into<wkt::Int64Value>,
14009    {
14010        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14011        self
14012    }
14013
14014    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14015    ///
14016    /// # Example
14017    /// ```ignore,no_run
14018    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14019    /// use wkt::Int64Value;
14020    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14021    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14022    /// ```
14023    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14024        mut self,
14025        v: std::option::Option<T>,
14026    ) -> Self
14027    where
14028        T: std::convert::Into<wkt::Int64Value>,
14029    {
14030        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14031        self
14032    }
14033
14034    /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14035    ///
14036    /// # Example
14037    /// ```ignore,no_run
14038    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14039    /// use wkt::Int64Value;
14040    /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14041    /// ```
14042    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14043    where
14044        T: std::convert::Into<wkt::Int64Value>,
14045    {
14046        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14047        self
14048    }
14049
14050    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14051    ///
14052    /// # Example
14053    /// ```ignore,no_run
14054    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14055    /// use wkt::Int64Value;
14056    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14057    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14058    /// ```
14059    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14060    where
14061        T: std::convert::Into<wkt::Int64Value>,
14062    {
14063        self.initialization_vector_crc32c = v.map(|x| x.into());
14064        self
14065    }
14066}
14067
14068impl wkt::message::Message for RawDecryptRequest {
14069    fn typename() -> &'static str {
14070        "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
14071    }
14072}
14073
14074/// Request message for
14075/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
14076///
14077/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
14078#[derive(Clone, Default, PartialEq)]
14079#[non_exhaustive]
14080pub struct AsymmetricSignRequest {
14081    /// Required. The resource name of the
14082    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14083    /// signing.
14084    ///
14085    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14086    pub name: std::string::String,
14087
14088    /// Optional. The digest of the data to sign. The digest must be produced with
14089    /// the same digest algorithm as specified by the key version's
14090    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
14091    ///
14092    /// This field may not be supplied if
14093    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14094    /// is supplied.
14095    ///
14096    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14097    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
14098    pub digest: std::option::Option<crate::model::Digest>,
14099
14100    /// Optional. An optional CRC32C checksum of the
14101    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
14102    /// If specified,
14103    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14104    /// verify the integrity of the received
14105    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14106    /// using this checksum.
14107    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14108    /// report an error if the checksum verification fails. If you receive a
14109    /// checksum error, your client should verify that
14110    /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
14111    /// is equal to
14112    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
14113    /// and if so, perform a limited number of retries. A persistent mismatch may
14114    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14115    /// field is defined as int64 for reasons of compatibility across different
14116    /// languages. However, it is a non-negative integer, which will never exceed
14117    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14118    /// this type.
14119    ///
14120    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14121    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
14122    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14123    pub digest_crc32c: std::option::Option<wkt::Int64Value>,
14124
14125    /// Optional. The data to sign.
14126    /// It can't be supplied if
14127    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14128    /// is supplied.
14129    ///
14130    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14131    pub data: ::bytes::Bytes,
14132
14133    /// Optional. An optional CRC32C checksum of the
14134    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
14135    /// If specified,
14136    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14137    /// verify the integrity of the received
14138    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14139    /// using this checksum.
14140    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14141    /// report an error if the checksum verification fails. If you receive a
14142    /// checksum error, your client should verify that
14143    /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
14144    /// is equal to
14145    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
14146    /// and if so, perform a limited number of retries. A persistent mismatch may
14147    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14148    /// field is defined as int64 for reasons of compatibility across different
14149    /// languages. However, it is a non-negative integer, which will never exceed
14150    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14151    /// this type.
14152    ///
14153    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14154    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
14155    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14156    pub data_crc32c: std::option::Option<wkt::Int64Value>,
14157
14158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14159}
14160
14161impl AsymmetricSignRequest {
14162    pub fn new() -> Self {
14163        std::default::Default::default()
14164    }
14165
14166    /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
14167    ///
14168    /// # Example
14169    /// ```ignore,no_run
14170    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14171    /// let x = AsymmetricSignRequest::new().set_name("example");
14172    /// ```
14173    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14174        self.name = v.into();
14175        self
14176    }
14177
14178    /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
14179    ///
14180    /// # Example
14181    /// ```ignore,no_run
14182    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14183    /// use google_cloud_kms_v1::model::Digest;
14184    /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
14185    /// ```
14186    pub fn set_digest<T>(mut self, v: T) -> Self
14187    where
14188        T: std::convert::Into<crate::model::Digest>,
14189    {
14190        self.digest = std::option::Option::Some(v.into());
14191        self
14192    }
14193
14194    /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
14195    ///
14196    /// # Example
14197    /// ```ignore,no_run
14198    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14199    /// use google_cloud_kms_v1::model::Digest;
14200    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
14201    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
14202    /// ```
14203    pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
14204    where
14205        T: std::convert::Into<crate::model::Digest>,
14206    {
14207        self.digest = v.map(|x| x.into());
14208        self
14209    }
14210
14211    /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14212    ///
14213    /// # Example
14214    /// ```ignore,no_run
14215    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14216    /// use wkt::Int64Value;
14217    /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
14218    /// ```
14219    pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
14220    where
14221        T: std::convert::Into<wkt::Int64Value>,
14222    {
14223        self.digest_crc32c = std::option::Option::Some(v.into());
14224        self
14225    }
14226
14227    /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14228    ///
14229    /// # Example
14230    /// ```ignore,no_run
14231    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14232    /// use wkt::Int64Value;
14233    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
14234    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
14235    /// ```
14236    pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14237    where
14238        T: std::convert::Into<wkt::Int64Value>,
14239    {
14240        self.digest_crc32c = v.map(|x| x.into());
14241        self
14242    }
14243
14244    /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
14245    ///
14246    /// # Example
14247    /// ```ignore,no_run
14248    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14249    /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14250    /// ```
14251    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14252        self.data = v.into();
14253        self
14254    }
14255
14256    /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14257    ///
14258    /// # Example
14259    /// ```ignore,no_run
14260    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14261    /// use wkt::Int64Value;
14262    /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14263    /// ```
14264    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14265    where
14266        T: std::convert::Into<wkt::Int64Value>,
14267    {
14268        self.data_crc32c = std::option::Option::Some(v.into());
14269        self
14270    }
14271
14272    /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14273    ///
14274    /// # Example
14275    /// ```ignore,no_run
14276    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14277    /// use wkt::Int64Value;
14278    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14279    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14280    /// ```
14281    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14282    where
14283        T: std::convert::Into<wkt::Int64Value>,
14284    {
14285        self.data_crc32c = v.map(|x| x.into());
14286        self
14287    }
14288}
14289
14290impl wkt::message::Message for AsymmetricSignRequest {
14291    fn typename() -> &'static str {
14292        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
14293    }
14294}
14295
14296/// Request message for
14297/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
14298///
14299/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
14300#[derive(Clone, Default, PartialEq)]
14301#[non_exhaustive]
14302pub struct AsymmetricDecryptRequest {
14303    /// Required. The resource name of the
14304    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14305    /// decryption.
14306    ///
14307    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14308    pub name: std::string::String,
14309
14310    /// Required. The data encrypted with the named
14311    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
14312    /// OAEP.
14313    ///
14314    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14315    pub ciphertext: ::bytes::Bytes,
14316
14317    /// Optional. An optional CRC32C checksum of the
14318    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
14319    /// If specified,
14320    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14321    /// verify the integrity of the received
14322    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
14323    /// using this checksum.
14324    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14325    /// report an error if the checksum verification fails. If you receive a
14326    /// checksum error, your client should verify that
14327    /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
14328    /// is equal to
14329    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
14330    /// and if so, perform a limited number of retries. A persistent mismatch may
14331    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14332    /// field is defined as int64 for reasons of compatibility across different
14333    /// languages. However, it is a non-negative integer, which will never exceed
14334    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14335    /// this type.
14336    ///
14337    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
14338    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
14339    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14340    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14341
14342    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14343}
14344
14345impl AsymmetricDecryptRequest {
14346    pub fn new() -> Self {
14347        std::default::Default::default()
14348    }
14349
14350    /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
14351    ///
14352    /// # Example
14353    /// ```ignore,no_run
14354    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14355    /// let x = AsymmetricDecryptRequest::new().set_name("example");
14356    /// ```
14357    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14358        self.name = v.into();
14359        self
14360    }
14361
14362    /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
14363    ///
14364    /// # Example
14365    /// ```ignore,no_run
14366    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14367    /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14368    /// ```
14369    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14370        self.ciphertext = v.into();
14371        self
14372    }
14373
14374    /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14375    ///
14376    /// # Example
14377    /// ```ignore,no_run
14378    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14379    /// use wkt::Int64Value;
14380    /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14381    /// ```
14382    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14383    where
14384        T: std::convert::Into<wkt::Int64Value>,
14385    {
14386        self.ciphertext_crc32c = std::option::Option::Some(v.into());
14387        self
14388    }
14389
14390    /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14391    ///
14392    /// # Example
14393    /// ```ignore,no_run
14394    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14395    /// use wkt::Int64Value;
14396    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14397    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14398    /// ```
14399    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14400    where
14401        T: std::convert::Into<wkt::Int64Value>,
14402    {
14403        self.ciphertext_crc32c = v.map(|x| x.into());
14404        self
14405    }
14406}
14407
14408impl wkt::message::Message for AsymmetricDecryptRequest {
14409    fn typename() -> &'static str {
14410        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
14411    }
14412}
14413
14414/// Request message for
14415/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
14416///
14417/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
14418#[derive(Clone, Default, PartialEq)]
14419#[non_exhaustive]
14420pub struct MacSignRequest {
14421    /// Required. The resource name of the
14422    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14423    /// signing.
14424    ///
14425    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14426    pub name: std::string::String,
14427
14428    /// Required. The data to sign. The MAC tag is computed over this data field
14429    /// based on the specific algorithm.
14430    pub data: ::bytes::Bytes,
14431
14432    /// Optional. An optional CRC32C checksum of the
14433    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
14434    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14435    /// will verify the integrity of the received
14436    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
14437    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14438    /// will report an error if the checksum verification fails. If you receive a
14439    /// checksum error, your client should verify that
14440    /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
14441    /// equal to
14442    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
14443    /// and if so, perform a limited number of retries. A persistent mismatch may
14444    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14445    /// field is defined as int64 for reasons of compatibility across different
14446    /// languages. However, it is a non-negative integer, which will never exceed
14447    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14448    /// this type.
14449    ///
14450    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14451    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14452    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
14453    pub data_crc32c: std::option::Option<wkt::Int64Value>,
14454
14455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14456}
14457
14458impl MacSignRequest {
14459    pub fn new() -> Self {
14460        std::default::Default::default()
14461    }
14462
14463    /// Sets the value of [name][crate::model::MacSignRequest::name].
14464    ///
14465    /// # Example
14466    /// ```ignore,no_run
14467    /// # use google_cloud_kms_v1::model::MacSignRequest;
14468    /// let x = MacSignRequest::new().set_name("example");
14469    /// ```
14470    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14471        self.name = v.into();
14472        self
14473    }
14474
14475    /// Sets the value of [data][crate::model::MacSignRequest::data].
14476    ///
14477    /// # Example
14478    /// ```ignore,no_run
14479    /// # use google_cloud_kms_v1::model::MacSignRequest;
14480    /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14481    /// ```
14482    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14483        self.data = v.into();
14484        self
14485    }
14486
14487    /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14488    ///
14489    /// # Example
14490    /// ```ignore,no_run
14491    /// # use google_cloud_kms_v1::model::MacSignRequest;
14492    /// use wkt::Int64Value;
14493    /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14494    /// ```
14495    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14496    where
14497        T: std::convert::Into<wkt::Int64Value>,
14498    {
14499        self.data_crc32c = std::option::Option::Some(v.into());
14500        self
14501    }
14502
14503    /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14504    ///
14505    /// # Example
14506    /// ```ignore,no_run
14507    /// # use google_cloud_kms_v1::model::MacSignRequest;
14508    /// use wkt::Int64Value;
14509    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14510    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14511    /// ```
14512    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14513    where
14514        T: std::convert::Into<wkt::Int64Value>,
14515    {
14516        self.data_crc32c = v.map(|x| x.into());
14517        self
14518    }
14519}
14520
14521impl wkt::message::Message for MacSignRequest {
14522    fn typename() -> &'static str {
14523        "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
14524    }
14525}
14526
14527/// Request message for
14528/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
14529///
14530/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
14531#[derive(Clone, Default, PartialEq)]
14532#[non_exhaustive]
14533pub struct MacVerifyRequest {
14534    /// Required. The resource name of the
14535    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14536    /// verification.
14537    ///
14538    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14539    pub name: std::string::String,
14540
14541    /// Required. The data used previously as a
14542    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
14543    /// the MAC tag.
14544    ///
14545    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14546    pub data: ::bytes::Bytes,
14547
14548    /// Optional. An optional CRC32C checksum of the
14549    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
14550    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14551    /// will verify the integrity of the received
14552    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
14553    /// this checksum.
14554    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14555    /// report an error if the checksum verification fails. If you receive a
14556    /// checksum error, your client should verify that
14557    /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
14558    /// is equal to
14559    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
14560    /// and if so, perform a limited number of retries. A persistent mismatch may
14561    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14562    /// field is defined as int64 for reasons of compatibility across different
14563    /// languages. However, it is a non-negative integer, which will never exceed
14564    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14565    /// this type.
14566    ///
14567    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14568    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
14569    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
14570    pub data_crc32c: std::option::Option<wkt::Int64Value>,
14571
14572    /// Required. The signature to verify.
14573    pub mac: ::bytes::Bytes,
14574
14575    /// Optional. An optional CRC32C checksum of the
14576    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
14577    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14578    /// will verify the integrity of the received
14579    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
14580    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14581    /// will report an error if the checksum verification fails. If you receive a
14582    /// checksum error, your client should verify that
14583    /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
14584    /// equal to
14585    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
14586    /// and if so, perform a limited number of retries. A persistent mismatch may
14587    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14588    /// field is defined as int64 for reasons of compatibility across different
14589    /// languages. However, it is a non-negative integer, which will never exceed
14590    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14591    /// this type.
14592    ///
14593    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14594    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
14595    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
14596    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
14597
14598    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14599}
14600
14601impl MacVerifyRequest {
14602    pub fn new() -> Self {
14603        std::default::Default::default()
14604    }
14605
14606    /// Sets the value of [name][crate::model::MacVerifyRequest::name].
14607    ///
14608    /// # Example
14609    /// ```ignore,no_run
14610    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14611    /// let x = MacVerifyRequest::new().set_name("example");
14612    /// ```
14613    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14614        self.name = v.into();
14615        self
14616    }
14617
14618    /// Sets the value of [data][crate::model::MacVerifyRequest::data].
14619    ///
14620    /// # Example
14621    /// ```ignore,no_run
14622    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14623    /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14624    /// ```
14625    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14626        self.data = v.into();
14627        self
14628    }
14629
14630    /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14631    ///
14632    /// # Example
14633    /// ```ignore,no_run
14634    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14635    /// use wkt::Int64Value;
14636    /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14637    /// ```
14638    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14639    where
14640        T: std::convert::Into<wkt::Int64Value>,
14641    {
14642        self.data_crc32c = std::option::Option::Some(v.into());
14643        self
14644    }
14645
14646    /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14647    ///
14648    /// # Example
14649    /// ```ignore,no_run
14650    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14651    /// use wkt::Int64Value;
14652    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14653    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14654    /// ```
14655    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14656    where
14657        T: std::convert::Into<wkt::Int64Value>,
14658    {
14659        self.data_crc32c = v.map(|x| x.into());
14660        self
14661    }
14662
14663    /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
14664    ///
14665    /// # Example
14666    /// ```ignore,no_run
14667    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14668    /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
14669    /// ```
14670    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14671        self.mac = v.into();
14672        self
14673    }
14674
14675    /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14676    ///
14677    /// # Example
14678    /// ```ignore,no_run
14679    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14680    /// use wkt::Int64Value;
14681    /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
14682    /// ```
14683    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
14684    where
14685        T: std::convert::Into<wkt::Int64Value>,
14686    {
14687        self.mac_crc32c = std::option::Option::Some(v.into());
14688        self
14689    }
14690
14691    /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14692    ///
14693    /// # Example
14694    /// ```ignore,no_run
14695    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14696    /// use wkt::Int64Value;
14697    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
14698    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
14699    /// ```
14700    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14701    where
14702        T: std::convert::Into<wkt::Int64Value>,
14703    {
14704        self.mac_crc32c = v.map(|x| x.into());
14705        self
14706    }
14707}
14708
14709impl wkt::message::Message for MacVerifyRequest {
14710    fn typename() -> &'static str {
14711        "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
14712    }
14713}
14714
14715/// Request message for
14716/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
14717///
14718/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
14719#[derive(Clone, Default, PartialEq)]
14720#[non_exhaustive]
14721pub struct DecapsulateRequest {
14722    /// Required. The resource name of the
14723    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14724    /// decapsulation.
14725    ///
14726    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14727    pub name: std::string::String,
14728
14729    /// Required. The ciphertext produced from encapsulation with the
14730    /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
14731    /// key(s).
14732    ///
14733    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14734    pub ciphertext: ::bytes::Bytes,
14735
14736    /// Optional. A CRC32C checksum of the
14737    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
14738    /// If specified,
14739    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14740    /// verify the integrity of the received
14741    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
14742    /// using this checksum.
14743    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14744    /// report an error if the checksum verification fails. If you receive a
14745    /// checksum error, your client should verify that
14746    /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
14747    /// is equal to
14748    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
14749    /// and if so, perform a limited number of retries. A persistent mismatch may
14750    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14751    /// field is defined as int64 for reasons of compatibility across different
14752    /// languages. However, it is a non-negative integer, which will never exceed
14753    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14754    /// this type.
14755    ///
14756    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
14757    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
14758    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14759    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14760
14761    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14762}
14763
14764impl DecapsulateRequest {
14765    pub fn new() -> Self {
14766        std::default::Default::default()
14767    }
14768
14769    /// Sets the value of [name][crate::model::DecapsulateRequest::name].
14770    ///
14771    /// # Example
14772    /// ```ignore,no_run
14773    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14774    /// let x = DecapsulateRequest::new().set_name("example");
14775    /// ```
14776    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14777        self.name = v.into();
14778        self
14779    }
14780
14781    /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
14782    ///
14783    /// # Example
14784    /// ```ignore,no_run
14785    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14786    /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14787    /// ```
14788    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14789        self.ciphertext = v.into();
14790        self
14791    }
14792
14793    /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14794    ///
14795    /// # Example
14796    /// ```ignore,no_run
14797    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14798    /// use wkt::Int64Value;
14799    /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14800    /// ```
14801    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14802    where
14803        T: std::convert::Into<wkt::Int64Value>,
14804    {
14805        self.ciphertext_crc32c = std::option::Option::Some(v.into());
14806        self
14807    }
14808
14809    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14810    ///
14811    /// # Example
14812    /// ```ignore,no_run
14813    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14814    /// use wkt::Int64Value;
14815    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14816    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14817    /// ```
14818    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14819    where
14820        T: std::convert::Into<wkt::Int64Value>,
14821    {
14822        self.ciphertext_crc32c = v.map(|x| x.into());
14823        self
14824    }
14825}
14826
14827impl wkt::message::Message for DecapsulateRequest {
14828    fn typename() -> &'static str {
14829        "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
14830    }
14831}
14832
14833/// Request message for
14834/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
14835///
14836/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
14837#[derive(Clone, Default, PartialEq)]
14838#[non_exhaustive]
14839pub struct GenerateRandomBytesRequest {
14840    /// The project-specific location in which to generate random bytes.
14841    /// For example, "projects/my-project/locations/us-central1".
14842    pub location: std::string::String,
14843
14844    /// The length in bytes of the amount of randomness to retrieve.  Minimum 8
14845    /// bytes, maximum 1024 bytes.
14846    pub length_bytes: i32,
14847
14848    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
14849    /// generating the random data. Currently, only
14850    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
14851    /// supported.
14852    ///
14853    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14854    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14855    pub protection_level: crate::model::ProtectionLevel,
14856
14857    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14858}
14859
14860impl GenerateRandomBytesRequest {
14861    pub fn new() -> Self {
14862        std::default::Default::default()
14863    }
14864
14865    /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
14866    ///
14867    /// # Example
14868    /// ```ignore,no_run
14869    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14870    /// let x = GenerateRandomBytesRequest::new().set_location("example");
14871    /// ```
14872    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14873        self.location = v.into();
14874        self
14875    }
14876
14877    /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
14878    ///
14879    /// # Example
14880    /// ```ignore,no_run
14881    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14882    /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
14883    /// ```
14884    pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14885        self.length_bytes = v.into();
14886        self
14887    }
14888
14889    /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
14890    ///
14891    /// # Example
14892    /// ```ignore,no_run
14893    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14894    /// use google_cloud_kms_v1::model::ProtectionLevel;
14895    /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
14896    /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
14897    /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
14898    /// ```
14899    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14900        mut self,
14901        v: T,
14902    ) -> Self {
14903        self.protection_level = v.into();
14904        self
14905    }
14906}
14907
14908impl wkt::message::Message for GenerateRandomBytesRequest {
14909    fn typename() -> &'static str {
14910        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
14911    }
14912}
14913
14914/// Response message for
14915/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
14916///
14917/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
14918#[derive(Clone, Default, PartialEq)]
14919#[non_exhaustive]
14920pub struct EncryptResponse {
14921    /// The resource name of the
14922    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14923    /// encryption. Check this field to verify that the intended resource was used
14924    /// for encryption.
14925    ///
14926    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14927    pub name: std::string::String,
14928
14929    /// The encrypted data.
14930    pub ciphertext: ::bytes::Bytes,
14931
14932    /// Integrity verification field. A CRC32C checksum of the returned
14933    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
14934    /// An integrity check of
14935    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14936    /// can be performed by computing the CRC32C checksum of
14937    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14938    /// and comparing your results to this field. Discard the response in case of
14939    /// non-matching checksum values, and perform a limited number of retries. A
14940    /// persistent mismatch may indicate an issue in your computation of the CRC32C
14941    /// checksum. Note: This field is defined as int64 for reasons of compatibility
14942    /// across different languages. However, it is a non-negative integer, which
14943    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14944    /// languages that support this type.
14945    ///
14946    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
14947    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14948
14949    /// Integrity verification field. A flag indicating whether
14950    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14951    /// was received by
14952    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14953    /// for the integrity verification of the
14954    /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
14955    /// this field indicates either that
14956    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14957    /// was left unset or that it was not delivered to
14958    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14959    /// set
14960    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14961    /// but this field is still false, discard the response and perform a limited
14962    /// number of retries.
14963    ///
14964    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
14965    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
14966    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14967    pub verified_plaintext_crc32c: bool,
14968
14969    /// Integrity verification field. A flag indicating whether
14970    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14971    /// was received by
14972    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14973    /// for the integrity verification of the
14974    /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
14975    /// false value of this field indicates either that
14976    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14977    /// was left unset or that it was not delivered to
14978    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14979    /// set
14980    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14981    /// but this field is still false, discard the response and perform a limited
14982    /// number of retries.
14983    ///
14984    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
14985    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
14986    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14987    pub verified_additional_authenticated_data_crc32c: bool,
14988
14989    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14990    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14991    /// encryption.
14992    ///
14993    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14994    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14995    pub protection_level: crate::model::ProtectionLevel,
14996
14997    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14998}
14999
15000impl EncryptResponse {
15001    pub fn new() -> Self {
15002        std::default::Default::default()
15003    }
15004
15005    /// Sets the value of [name][crate::model::EncryptResponse::name].
15006    ///
15007    /// # Example
15008    /// ```ignore,no_run
15009    /// # use google_cloud_kms_v1::model::EncryptResponse;
15010    /// let x = EncryptResponse::new().set_name("example");
15011    /// ```
15012    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15013        self.name = v.into();
15014        self
15015    }
15016
15017    /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
15018    ///
15019    /// # Example
15020    /// ```ignore,no_run
15021    /// # use google_cloud_kms_v1::model::EncryptResponse;
15022    /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15023    /// ```
15024    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15025        self.ciphertext = v.into();
15026        self
15027    }
15028
15029    /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15030    ///
15031    /// # Example
15032    /// ```ignore,no_run
15033    /// # use google_cloud_kms_v1::model::EncryptResponse;
15034    /// use wkt::Int64Value;
15035    /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15036    /// ```
15037    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15038    where
15039        T: std::convert::Into<wkt::Int64Value>,
15040    {
15041        self.ciphertext_crc32c = std::option::Option::Some(v.into());
15042        self
15043    }
15044
15045    /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15046    ///
15047    /// # Example
15048    /// ```ignore,no_run
15049    /// # use google_cloud_kms_v1::model::EncryptResponse;
15050    /// use wkt::Int64Value;
15051    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15052    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15053    /// ```
15054    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15055    where
15056        T: std::convert::Into<wkt::Int64Value>,
15057    {
15058        self.ciphertext_crc32c = v.map(|x| x.into());
15059        self
15060    }
15061
15062    /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
15063    ///
15064    /// # Example
15065    /// ```ignore,no_run
15066    /// # use google_cloud_kms_v1::model::EncryptResponse;
15067    /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
15068    /// ```
15069    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15070        self.verified_plaintext_crc32c = v.into();
15071        self
15072    }
15073
15074    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
15075    ///
15076    /// # Example
15077    /// ```ignore,no_run
15078    /// # use google_cloud_kms_v1::model::EncryptResponse;
15079    /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15080    /// ```
15081    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15082        mut self,
15083        v: T,
15084    ) -> Self {
15085        self.verified_additional_authenticated_data_crc32c = v.into();
15086        self
15087    }
15088
15089    /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
15090    ///
15091    /// # Example
15092    /// ```ignore,no_run
15093    /// # use google_cloud_kms_v1::model::EncryptResponse;
15094    /// use google_cloud_kms_v1::model::ProtectionLevel;
15095    /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15096    /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15097    /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
15098    /// ```
15099    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15100        mut self,
15101        v: T,
15102    ) -> Self {
15103        self.protection_level = v.into();
15104        self
15105    }
15106}
15107
15108impl wkt::message::Message for EncryptResponse {
15109    fn typename() -> &'static str {
15110        "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
15111    }
15112}
15113
15114/// Response message for
15115/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
15116///
15117/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
15118#[derive(Clone, Default, PartialEq)]
15119#[non_exhaustive]
15120pub struct DecryptResponse {
15121    /// The decrypted data originally supplied in
15122    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
15123    ///
15124    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15125    pub plaintext: ::bytes::Bytes,
15126
15127    /// Integrity verification field. A CRC32C checksum of the returned
15128    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
15129    /// An integrity check of
15130    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15131    /// can be performed by computing the CRC32C checksum of
15132    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15133    /// and comparing your results to this field. Discard the response in case of
15134    /// non-matching checksum values, and perform a limited number of retries. A
15135    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15136    /// checksum. Note: receiving this response message indicates that
15137    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15138    /// successfully decrypt the
15139    /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
15140    /// field is defined as int64 for reasons of compatibility across different
15141    /// languages. However, it is a non-negative integer, which will never exceed
15142    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15143    /// this type.
15144    ///
15145    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
15146    /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
15147    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15148    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15149
15150    /// Whether the Decryption was performed using the primary key version.
15151    pub used_primary: bool,
15152
15153    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15154    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15155    /// decryption.
15156    ///
15157    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15158    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15159    pub protection_level: crate::model::ProtectionLevel,
15160
15161    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15162}
15163
15164impl DecryptResponse {
15165    pub fn new() -> Self {
15166        std::default::Default::default()
15167    }
15168
15169    /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
15170    ///
15171    /// # Example
15172    /// ```ignore,no_run
15173    /// # use google_cloud_kms_v1::model::DecryptResponse;
15174    /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15175    /// ```
15176    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15177        self.plaintext = v.into();
15178        self
15179    }
15180
15181    /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15182    ///
15183    /// # Example
15184    /// ```ignore,no_run
15185    /// # use google_cloud_kms_v1::model::DecryptResponse;
15186    /// use wkt::Int64Value;
15187    /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15188    /// ```
15189    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15190    where
15191        T: std::convert::Into<wkt::Int64Value>,
15192    {
15193        self.plaintext_crc32c = std::option::Option::Some(v.into());
15194        self
15195    }
15196
15197    /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15198    ///
15199    /// # Example
15200    /// ```ignore,no_run
15201    /// # use google_cloud_kms_v1::model::DecryptResponse;
15202    /// use wkt::Int64Value;
15203    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15204    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15205    /// ```
15206    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15207    where
15208        T: std::convert::Into<wkt::Int64Value>,
15209    {
15210        self.plaintext_crc32c = v.map(|x| x.into());
15211        self
15212    }
15213
15214    /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
15215    ///
15216    /// # Example
15217    /// ```ignore,no_run
15218    /// # use google_cloud_kms_v1::model::DecryptResponse;
15219    /// let x = DecryptResponse::new().set_used_primary(true);
15220    /// ```
15221    pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15222        self.used_primary = v.into();
15223        self
15224    }
15225
15226    /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
15227    ///
15228    /// # Example
15229    /// ```ignore,no_run
15230    /// # use google_cloud_kms_v1::model::DecryptResponse;
15231    /// use google_cloud_kms_v1::model::ProtectionLevel;
15232    /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15233    /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15234    /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
15235    /// ```
15236    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15237        mut self,
15238        v: T,
15239    ) -> Self {
15240        self.protection_level = v.into();
15241        self
15242    }
15243}
15244
15245impl wkt::message::Message for DecryptResponse {
15246    fn typename() -> &'static str {
15247        "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
15248    }
15249}
15250
15251/// Response message for
15252/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
15253///
15254/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
15255#[derive(Clone, Default, PartialEq)]
15256#[non_exhaustive]
15257pub struct RawEncryptResponse {
15258    /// The encrypted data. In the case of AES-GCM, the authentication tag
15259    /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
15260    /// bytes at the end of this field.
15261    ///
15262    /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
15263    pub ciphertext: ::bytes::Bytes,
15264
15265    /// The initialization vector (IV) generated by the service during
15266    /// encryption. This value must be stored and provided in
15267    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
15268    /// at decryption time.
15269    ///
15270    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
15271    pub initialization_vector: ::bytes::Bytes,
15272
15273    /// The length of the authentication tag that is appended to
15274    /// the end of the ciphertext.
15275    pub tag_length: i32,
15276
15277    /// Integrity verification field. A CRC32C checksum of the returned
15278    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
15279    /// An integrity check of ciphertext can be performed by computing the CRC32C
15280    /// checksum of ciphertext and comparing your results to this field. Discard
15281    /// the response in case of non-matching checksum values, and perform a limited
15282    /// number of retries. A persistent mismatch may indicate an issue in your
15283    /// computation of the CRC32C checksum. Note: This field is defined as int64
15284    /// for reasons of compatibility across different languages. However, it is a
15285    /// non-negative integer, which will never exceed 2^32-1, and can be safely
15286    /// downconverted to uint32 in languages that support this type.
15287    ///
15288    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
15289    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15290
15291    /// Integrity verification field. A CRC32C checksum of the returned
15292    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
15293    /// An integrity check of initialization_vector can be performed by computing
15294    /// the CRC32C checksum of initialization_vector and comparing your results to
15295    /// this field. Discard the response in case of non-matching checksum values,
15296    /// and perform a limited number of retries. A persistent mismatch may indicate
15297    /// an issue in your computation of the CRC32C checksum. Note: This field is
15298    /// defined as int64 for reasons of compatibility across different languages.
15299    /// However, it is a non-negative integer, which will never exceed 2^32-1, and
15300    /// can be safely downconverted to uint32 in languages that support this type.
15301    ///
15302    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
15303    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
15304
15305    /// Integrity verification field. A flag indicating whether
15306    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15307    /// was received by
15308    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15309    /// for the integrity verification of the plaintext. A false value of this
15310    /// field indicates either that
15311    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15312    /// was left unset or that it was not delivered to
15313    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15314    /// set
15315    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15316    /// but this field is still false, discard the response and perform a limited
15317    /// number of retries.
15318    ///
15319    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15320    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
15321    pub verified_plaintext_crc32c: bool,
15322
15323    /// Integrity verification field. A flag indicating whether
15324    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15325    /// was received by
15326    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15327    /// for the integrity verification of additional_authenticated_data. A false
15328    /// value of this field indicates either that //
15329    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15330    /// was left unset or that it was not delivered to
15331    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15332    /// set
15333    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15334    /// but this field is still false, discard the response and perform a limited
15335    /// number of retries.
15336    ///
15337    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15338    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
15339    pub verified_additional_authenticated_data_crc32c: bool,
15340
15341    /// Integrity verification field. A flag indicating whether
15342    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15343    /// was received by
15344    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15345    /// for the integrity verification of initialization_vector. A false value of
15346    /// this field indicates either that
15347    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15348    /// was left unset or that it was not delivered to
15349    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15350    /// set
15351    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15352    /// but this field is still false, discard the response and perform a limited
15353    /// number of retries.
15354    ///
15355    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15356    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
15357    pub verified_initialization_vector_crc32c: bool,
15358
15359    /// The resource name of the
15360    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15361    /// encryption. Check this field to verify that the intended resource was used
15362    /// for encryption.
15363    ///
15364    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15365    pub name: std::string::String,
15366
15367    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15368    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15369    /// encryption.
15370    ///
15371    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15372    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15373    pub protection_level: crate::model::ProtectionLevel,
15374
15375    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15376}
15377
15378impl RawEncryptResponse {
15379    pub fn new() -> Self {
15380        std::default::Default::default()
15381    }
15382
15383    /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
15384    ///
15385    /// # Example
15386    /// ```ignore,no_run
15387    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15388    /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15389    /// ```
15390    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15391        self.ciphertext = v.into();
15392        self
15393    }
15394
15395    /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
15396    ///
15397    /// # Example
15398    /// ```ignore,no_run
15399    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15400    /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
15401    /// ```
15402    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
15403        mut self,
15404        v: T,
15405    ) -> Self {
15406        self.initialization_vector = v.into();
15407        self
15408    }
15409
15410    /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
15411    ///
15412    /// # Example
15413    /// ```ignore,no_run
15414    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15415    /// let x = RawEncryptResponse::new().set_tag_length(42);
15416    /// ```
15417    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15418        self.tag_length = v.into();
15419        self
15420    }
15421
15422    /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15423    ///
15424    /// # Example
15425    /// ```ignore,no_run
15426    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15427    /// use wkt::Int64Value;
15428    /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15429    /// ```
15430    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15431    where
15432        T: std::convert::Into<wkt::Int64Value>,
15433    {
15434        self.ciphertext_crc32c = std::option::Option::Some(v.into());
15435        self
15436    }
15437
15438    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15439    ///
15440    /// # Example
15441    /// ```ignore,no_run
15442    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15443    /// use wkt::Int64Value;
15444    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15445    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15446    /// ```
15447    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15448    where
15449        T: std::convert::Into<wkt::Int64Value>,
15450    {
15451        self.ciphertext_crc32c = v.map(|x| x.into());
15452        self
15453    }
15454
15455    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15456    ///
15457    /// # Example
15458    /// ```ignore,no_run
15459    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15460    /// use wkt::Int64Value;
15461    /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
15462    /// ```
15463    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
15464    where
15465        T: std::convert::Into<wkt::Int64Value>,
15466    {
15467        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
15468        self
15469    }
15470
15471    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15472    ///
15473    /// # Example
15474    /// ```ignore,no_run
15475    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15476    /// use wkt::Int64Value;
15477    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
15478    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
15479    /// ```
15480    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15481    where
15482        T: std::convert::Into<wkt::Int64Value>,
15483    {
15484        self.initialization_vector_crc32c = v.map(|x| x.into());
15485        self
15486    }
15487
15488    /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
15489    ///
15490    /// # Example
15491    /// ```ignore,no_run
15492    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15493    /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
15494    /// ```
15495    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15496        self.verified_plaintext_crc32c = v.into();
15497        self
15498    }
15499
15500    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
15501    ///
15502    /// # Example
15503    /// ```ignore,no_run
15504    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15505    /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15506    /// ```
15507    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15508        mut self,
15509        v: T,
15510    ) -> Self {
15511        self.verified_additional_authenticated_data_crc32c = v.into();
15512        self
15513    }
15514
15515    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
15516    ///
15517    /// # Example
15518    /// ```ignore,no_run
15519    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15520    /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
15521    /// ```
15522    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15523        mut self,
15524        v: T,
15525    ) -> Self {
15526        self.verified_initialization_vector_crc32c = v.into();
15527        self
15528    }
15529
15530    /// Sets the value of [name][crate::model::RawEncryptResponse::name].
15531    ///
15532    /// # Example
15533    /// ```ignore,no_run
15534    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15535    /// let x = RawEncryptResponse::new().set_name("example");
15536    /// ```
15537    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15538        self.name = v.into();
15539        self
15540    }
15541
15542    /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
15543    ///
15544    /// # Example
15545    /// ```ignore,no_run
15546    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15547    /// use google_cloud_kms_v1::model::ProtectionLevel;
15548    /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15549    /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15550    /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
15551    /// ```
15552    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15553        mut self,
15554        v: T,
15555    ) -> Self {
15556        self.protection_level = v.into();
15557        self
15558    }
15559}
15560
15561impl wkt::message::Message for RawEncryptResponse {
15562    fn typename() -> &'static str {
15563        "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
15564    }
15565}
15566
15567/// Response message for
15568/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
15569///
15570/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
15571#[derive(Clone, Default, PartialEq)]
15572#[non_exhaustive]
15573pub struct RawDecryptResponse {
15574    /// The decrypted data.
15575    pub plaintext: ::bytes::Bytes,
15576
15577    /// Integrity verification field. A CRC32C checksum of the returned
15578    /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
15579    /// An integrity check of plaintext can be performed by computing the CRC32C
15580    /// checksum of plaintext and comparing your results to this field. Discard the
15581    /// response in case of non-matching checksum values, and perform a limited
15582    /// number of retries. A persistent mismatch may indicate an issue in your
15583    /// computation of the CRC32C checksum. Note: receiving this response message
15584    /// indicates that
15585    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15586    /// successfully decrypt the
15587    /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
15588    /// Note: This field is defined as int64 for reasons of compatibility across
15589    /// different languages. However, it is a non-negative integer, which will
15590    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
15591    /// that support this type.
15592    ///
15593    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15594    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
15595    /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
15596    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15597
15598    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15599    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15600    /// decryption.
15601    ///
15602    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15603    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15604    pub protection_level: crate::model::ProtectionLevel,
15605
15606    /// Integrity verification field. A flag indicating whether
15607    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15608    /// was received by
15609    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15610    /// for the integrity verification of the ciphertext. A false value of this
15611    /// field indicates either that
15612    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15613    /// was left unset or that it was not delivered to
15614    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15615    /// set
15616    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15617    /// but this field is still false, discard the response and perform a limited
15618    /// number of retries.
15619    ///
15620    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15621    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
15622    pub verified_ciphertext_crc32c: bool,
15623
15624    /// Integrity verification field. A flag indicating whether
15625    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15626    /// was received by
15627    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15628    /// for the integrity verification of additional_authenticated_data. A false
15629    /// value of this field indicates either that //
15630    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15631    /// was left unset or that it was not delivered to
15632    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15633    /// set
15634    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15635    /// but this field is still false, discard the response and perform a limited
15636    /// number of retries.
15637    ///
15638    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15639    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
15640    pub verified_additional_authenticated_data_crc32c: bool,
15641
15642    /// Integrity verification field. A flag indicating whether
15643    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15644    /// was received by
15645    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15646    /// for the integrity verification of initialization_vector. A false value of
15647    /// this field indicates either that
15648    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15649    /// was left unset or that it was not delivered to
15650    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15651    /// set
15652    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15653    /// but this field is still false, discard the response and perform a limited
15654    /// number of retries.
15655    ///
15656    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15657    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
15658    pub verified_initialization_vector_crc32c: bool,
15659
15660    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15661}
15662
15663impl RawDecryptResponse {
15664    pub fn new() -> Self {
15665        std::default::Default::default()
15666    }
15667
15668    /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
15669    ///
15670    /// # Example
15671    /// ```ignore,no_run
15672    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15673    /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15674    /// ```
15675    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15676        self.plaintext = v.into();
15677        self
15678    }
15679
15680    /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15681    ///
15682    /// # Example
15683    /// ```ignore,no_run
15684    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15685    /// use wkt::Int64Value;
15686    /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15687    /// ```
15688    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15689    where
15690        T: std::convert::Into<wkt::Int64Value>,
15691    {
15692        self.plaintext_crc32c = std::option::Option::Some(v.into());
15693        self
15694    }
15695
15696    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15697    ///
15698    /// # Example
15699    /// ```ignore,no_run
15700    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15701    /// use wkt::Int64Value;
15702    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15703    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15704    /// ```
15705    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15706    where
15707        T: std::convert::Into<wkt::Int64Value>,
15708    {
15709        self.plaintext_crc32c = v.map(|x| x.into());
15710        self
15711    }
15712
15713    /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
15714    ///
15715    /// # Example
15716    /// ```ignore,no_run
15717    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15718    /// use google_cloud_kms_v1::model::ProtectionLevel;
15719    /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15720    /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15721    /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
15722    /// ```
15723    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15724        mut self,
15725        v: T,
15726    ) -> Self {
15727        self.protection_level = v.into();
15728        self
15729    }
15730
15731    /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
15732    ///
15733    /// # Example
15734    /// ```ignore,no_run
15735    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15736    /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
15737    /// ```
15738    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15739        self.verified_ciphertext_crc32c = v.into();
15740        self
15741    }
15742
15743    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
15744    ///
15745    /// # Example
15746    /// ```ignore,no_run
15747    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15748    /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15749    /// ```
15750    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15751        mut self,
15752        v: T,
15753    ) -> Self {
15754        self.verified_additional_authenticated_data_crc32c = v.into();
15755        self
15756    }
15757
15758    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
15759    ///
15760    /// # Example
15761    /// ```ignore,no_run
15762    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15763    /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
15764    /// ```
15765    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15766        mut self,
15767        v: T,
15768    ) -> Self {
15769        self.verified_initialization_vector_crc32c = v.into();
15770        self
15771    }
15772}
15773
15774impl wkt::message::Message for RawDecryptResponse {
15775    fn typename() -> &'static str {
15776        "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
15777    }
15778}
15779
15780/// Response message for
15781/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
15782///
15783/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
15784#[derive(Clone, Default, PartialEq)]
15785#[non_exhaustive]
15786pub struct AsymmetricSignResponse {
15787    /// The created signature.
15788    pub signature: ::bytes::Bytes,
15789
15790    /// Integrity verification field. A CRC32C checksum of the returned
15791    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
15792    /// An integrity check of
15793    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15794    /// can be performed by computing the CRC32C checksum of
15795    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15796    /// and comparing your results to this field. Discard the response in case of
15797    /// non-matching checksum values, and perform a limited number of retries. A
15798    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15799    /// checksum. Note: This field is defined as int64 for reasons of compatibility
15800    /// across different languages. However, it is a non-negative integer, which
15801    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15802    /// languages that support this type.
15803    ///
15804    /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
15805    pub signature_crc32c: std::option::Option<wkt::Int64Value>,
15806
15807    /// Integrity verification field. A flag indicating whether
15808    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15809    /// was received by
15810    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15811    /// for the integrity verification of the
15812    /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
15813    /// of this field indicates either that
15814    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15815    /// was left unset or that it was not delivered to
15816    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15817    /// set
15818    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15819    /// but this field is still false, discard the response and perform a limited
15820    /// number of retries.
15821    ///
15822    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
15823    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
15824    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15825    pub verified_digest_crc32c: bool,
15826
15827    /// The resource name of the
15828    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15829    /// Check this field to verify that the intended resource was used for signing.
15830    ///
15831    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15832    pub name: std::string::String,
15833
15834    /// Integrity verification field. A flag indicating whether
15835    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15836    /// was received by
15837    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15838    /// for the integrity verification of the
15839    /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
15840    /// this field indicates either that
15841    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15842    /// was left unset or that it was not delivered to
15843    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15844    /// set
15845    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15846    /// but this field is still false, discard the response and perform a limited
15847    /// number of retries.
15848    ///
15849    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
15850    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
15851    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15852    pub verified_data_crc32c: bool,
15853
15854    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15855    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15856    ///
15857    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15858    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15859    pub protection_level: crate::model::ProtectionLevel,
15860
15861    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15862}
15863
15864impl AsymmetricSignResponse {
15865    pub fn new() -> Self {
15866        std::default::Default::default()
15867    }
15868
15869    /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
15870    ///
15871    /// # Example
15872    /// ```ignore,no_run
15873    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15874    /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
15875    /// ```
15876    pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15877        self.signature = v.into();
15878        self
15879    }
15880
15881    /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15882    ///
15883    /// # Example
15884    /// ```ignore,no_run
15885    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15886    /// use wkt::Int64Value;
15887    /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
15888    /// ```
15889    pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
15890    where
15891        T: std::convert::Into<wkt::Int64Value>,
15892    {
15893        self.signature_crc32c = std::option::Option::Some(v.into());
15894        self
15895    }
15896
15897    /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15898    ///
15899    /// # Example
15900    /// ```ignore,no_run
15901    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15902    /// use wkt::Int64Value;
15903    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
15904    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
15905    /// ```
15906    pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15907    where
15908        T: std::convert::Into<wkt::Int64Value>,
15909    {
15910        self.signature_crc32c = v.map(|x| x.into());
15911        self
15912    }
15913
15914    /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
15915    ///
15916    /// # Example
15917    /// ```ignore,no_run
15918    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15919    /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
15920    /// ```
15921    pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15922        self.verified_digest_crc32c = v.into();
15923        self
15924    }
15925
15926    /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
15927    ///
15928    /// # Example
15929    /// ```ignore,no_run
15930    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15931    /// let x = AsymmetricSignResponse::new().set_name("example");
15932    /// ```
15933    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15934        self.name = v.into();
15935        self
15936    }
15937
15938    /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
15939    ///
15940    /// # Example
15941    /// ```ignore,no_run
15942    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15943    /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
15944    /// ```
15945    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15946        self.verified_data_crc32c = v.into();
15947        self
15948    }
15949
15950    /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
15951    ///
15952    /// # Example
15953    /// ```ignore,no_run
15954    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15955    /// use google_cloud_kms_v1::model::ProtectionLevel;
15956    /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
15957    /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
15958    /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
15959    /// ```
15960    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15961        mut self,
15962        v: T,
15963    ) -> Self {
15964        self.protection_level = v.into();
15965        self
15966    }
15967}
15968
15969impl wkt::message::Message for AsymmetricSignResponse {
15970    fn typename() -> &'static str {
15971        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
15972    }
15973}
15974
15975/// Response message for
15976/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
15977///
15978/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
15979#[derive(Clone, Default, PartialEq)]
15980#[non_exhaustive]
15981pub struct AsymmetricDecryptResponse {
15982    /// The decrypted data originally encrypted with the matching public key.
15983    pub plaintext: ::bytes::Bytes,
15984
15985    /// Integrity verification field. A CRC32C checksum of the returned
15986    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
15987    /// An integrity check of
15988    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15989    /// can be performed by computing the CRC32C checksum of
15990    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15991    /// and comparing your results to this field. Discard the response in case of
15992    /// non-matching checksum values, and perform a limited number of retries. A
15993    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15994    /// checksum. Note: This field is defined as int64 for reasons of compatibility
15995    /// across different languages. However, it is a non-negative integer, which
15996    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15997    /// languages that support this type.
15998    ///
15999    /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
16000    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16001
16002    /// Integrity verification field. A flag indicating whether
16003    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16004    /// was received by
16005    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16006    /// for the integrity verification of the
16007    /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
16008    /// false value of this field indicates either that
16009    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16010    /// was left unset or that it was not delivered to
16011    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16012    /// set
16013    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16014    /// but this field is still false, discard the response and perform a limited
16015    /// number of retries.
16016    ///
16017    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
16018    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
16019    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16020    pub verified_ciphertext_crc32c: bool,
16021
16022    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16023    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16024    /// decryption.
16025    ///
16026    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16027    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16028    pub protection_level: crate::model::ProtectionLevel,
16029
16030    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16031}
16032
16033impl AsymmetricDecryptResponse {
16034    pub fn new() -> Self {
16035        std::default::Default::default()
16036    }
16037
16038    /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
16039    ///
16040    /// # Example
16041    /// ```ignore,no_run
16042    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16043    /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16044    /// ```
16045    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16046        self.plaintext = v.into();
16047        self
16048    }
16049
16050    /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16051    ///
16052    /// # Example
16053    /// ```ignore,no_run
16054    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16055    /// use wkt::Int64Value;
16056    /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16057    /// ```
16058    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16059    where
16060        T: std::convert::Into<wkt::Int64Value>,
16061    {
16062        self.plaintext_crc32c = std::option::Option::Some(v.into());
16063        self
16064    }
16065
16066    /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16067    ///
16068    /// # Example
16069    /// ```ignore,no_run
16070    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16071    /// use wkt::Int64Value;
16072    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16073    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16074    /// ```
16075    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16076    where
16077        T: std::convert::Into<wkt::Int64Value>,
16078    {
16079        self.plaintext_crc32c = v.map(|x| x.into());
16080        self
16081    }
16082
16083    /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
16084    ///
16085    /// # Example
16086    /// ```ignore,no_run
16087    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16088    /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16089    /// ```
16090    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16091        self.verified_ciphertext_crc32c = v.into();
16092        self
16093    }
16094
16095    /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
16096    ///
16097    /// # Example
16098    /// ```ignore,no_run
16099    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16100    /// use google_cloud_kms_v1::model::ProtectionLevel;
16101    /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16102    /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16103    /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16104    /// ```
16105    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16106        mut self,
16107        v: T,
16108    ) -> Self {
16109        self.protection_level = v.into();
16110        self
16111    }
16112}
16113
16114impl wkt::message::Message for AsymmetricDecryptResponse {
16115    fn typename() -> &'static str {
16116        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
16117    }
16118}
16119
16120/// Response message for
16121/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
16122///
16123/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
16124#[derive(Clone, Default, PartialEq)]
16125#[non_exhaustive]
16126pub struct MacSignResponse {
16127    /// The resource name of the
16128    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16129    /// Check this field to verify that the intended resource was used for signing.
16130    ///
16131    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16132    pub name: std::string::String,
16133
16134    /// The created signature.
16135    pub mac: ::bytes::Bytes,
16136
16137    /// Integrity verification field. A CRC32C checksum of the returned
16138    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
16139    /// integrity check of
16140    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
16141    /// performed by computing the CRC32C checksum of
16142    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
16143    /// comparing your results to this field. Discard the response in case of
16144    /// non-matching checksum values, and perform a limited number of retries. A
16145    /// persistent mismatch may indicate an issue in your computation of the CRC32C
16146    /// checksum. Note: This field is defined as int64 for reasons of compatibility
16147    /// across different languages. However, it is a non-negative integer, which
16148    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16149    /// languages that support this type.
16150    ///
16151    /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
16152    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
16153
16154    /// Integrity verification field. A flag indicating whether
16155    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16156    /// was received by
16157    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16158    /// for the integrity verification of the
16159    /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
16160    /// field indicates either that
16161    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16162    /// was left unset or that it was not delivered to
16163    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16164    /// set
16165    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16166    /// but this field is still false, discard the response and perform a limited
16167    /// number of retries.
16168    ///
16169    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16170    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
16171    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
16172    pub verified_data_crc32c: bool,
16173
16174    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16175    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16176    ///
16177    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16178    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16179    pub protection_level: crate::model::ProtectionLevel,
16180
16181    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16182}
16183
16184impl MacSignResponse {
16185    pub fn new() -> Self {
16186        std::default::Default::default()
16187    }
16188
16189    /// Sets the value of [name][crate::model::MacSignResponse::name].
16190    ///
16191    /// # Example
16192    /// ```ignore,no_run
16193    /// # use google_cloud_kms_v1::model::MacSignResponse;
16194    /// let x = MacSignResponse::new().set_name("example");
16195    /// ```
16196    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16197        self.name = v.into();
16198        self
16199    }
16200
16201    /// Sets the value of [mac][crate::model::MacSignResponse::mac].
16202    ///
16203    /// # Example
16204    /// ```ignore,no_run
16205    /// # use google_cloud_kms_v1::model::MacSignResponse;
16206    /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
16207    /// ```
16208    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16209        self.mac = v.into();
16210        self
16211    }
16212
16213    /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16214    ///
16215    /// # Example
16216    /// ```ignore,no_run
16217    /// # use google_cloud_kms_v1::model::MacSignResponse;
16218    /// use wkt::Int64Value;
16219    /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
16220    /// ```
16221    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
16222    where
16223        T: std::convert::Into<wkt::Int64Value>,
16224    {
16225        self.mac_crc32c = std::option::Option::Some(v.into());
16226        self
16227    }
16228
16229    /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16230    ///
16231    /// # Example
16232    /// ```ignore,no_run
16233    /// # use google_cloud_kms_v1::model::MacSignResponse;
16234    /// use wkt::Int64Value;
16235    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
16236    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
16237    /// ```
16238    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16239    where
16240        T: std::convert::Into<wkt::Int64Value>,
16241    {
16242        self.mac_crc32c = v.map(|x| x.into());
16243        self
16244    }
16245
16246    /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
16247    ///
16248    /// # Example
16249    /// ```ignore,no_run
16250    /// # use google_cloud_kms_v1::model::MacSignResponse;
16251    /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
16252    /// ```
16253    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16254        self.verified_data_crc32c = v.into();
16255        self
16256    }
16257
16258    /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
16259    ///
16260    /// # Example
16261    /// ```ignore,no_run
16262    /// # use google_cloud_kms_v1::model::MacSignResponse;
16263    /// use google_cloud_kms_v1::model::ProtectionLevel;
16264    /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
16265    /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16266    /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
16267    /// ```
16268    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16269        mut self,
16270        v: T,
16271    ) -> Self {
16272        self.protection_level = v.into();
16273        self
16274    }
16275}
16276
16277impl wkt::message::Message for MacSignResponse {
16278    fn typename() -> &'static str {
16279        "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
16280    }
16281}
16282
16283/// Response message for
16284/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
16285///
16286/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
16287#[derive(Clone, Default, PartialEq)]
16288#[non_exhaustive]
16289pub struct MacVerifyResponse {
16290    /// The resource name of the
16291    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16292    /// verification. Check this field to verify that the intended resource was
16293    /// used for verification.
16294    ///
16295    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16296    pub name: std::string::String,
16297
16298    /// This field indicates whether or not the verification operation for
16299    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
16300    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
16301    /// successful.
16302    ///
16303    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16304    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16305    pub success: bool,
16306
16307    /// Integrity verification field. A flag indicating whether
16308    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16309    /// was received by
16310    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16311    /// for the integrity verification of the
16312    /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
16313    /// field indicates either that
16314    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16315    /// was left unset or that it was not delivered to
16316    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16317    /// set
16318    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16319    /// but this field is still false, discard the response and perform a limited
16320    /// number of retries.
16321    ///
16322    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16323    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16324    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
16325    pub verified_data_crc32c: bool,
16326
16327    /// Integrity verification field. A flag indicating whether
16328    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16329    /// was received by
16330    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16331    /// for the integrity verification of the
16332    /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
16333    /// field indicates either that
16334    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16335    /// was left unset or that it was not delivered to
16336    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16337    /// set
16338    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16339    /// but this field is still false, discard the response and perform a limited
16340    /// number of retries.
16341    ///
16342    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16343    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16344    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
16345    pub verified_mac_crc32c: bool,
16346
16347    /// Integrity verification field. This value is used for the integrity
16348    /// verification of [MacVerifyResponse.success]. If the value of this field
16349    /// contradicts the value of [MacVerifyResponse.success], discard the response
16350    /// and perform a limited number of retries.
16351    pub verified_success_integrity: bool,
16352
16353    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16354    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16355    /// verification.
16356    ///
16357    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16358    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16359    pub protection_level: crate::model::ProtectionLevel,
16360
16361    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16362}
16363
16364impl MacVerifyResponse {
16365    pub fn new() -> Self {
16366        std::default::Default::default()
16367    }
16368
16369    /// Sets the value of [name][crate::model::MacVerifyResponse::name].
16370    ///
16371    /// # Example
16372    /// ```ignore,no_run
16373    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16374    /// let x = MacVerifyResponse::new().set_name("example");
16375    /// ```
16376    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16377        self.name = v.into();
16378        self
16379    }
16380
16381    /// Sets the value of [success][crate::model::MacVerifyResponse::success].
16382    ///
16383    /// # Example
16384    /// ```ignore,no_run
16385    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16386    /// let x = MacVerifyResponse::new().set_success(true);
16387    /// ```
16388    pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16389        self.success = v.into();
16390        self
16391    }
16392
16393    /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
16394    ///
16395    /// # Example
16396    /// ```ignore,no_run
16397    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16398    /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
16399    /// ```
16400    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16401        self.verified_data_crc32c = v.into();
16402        self
16403    }
16404
16405    /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
16406    ///
16407    /// # Example
16408    /// ```ignore,no_run
16409    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16410    /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
16411    /// ```
16412    pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16413        self.verified_mac_crc32c = v.into();
16414        self
16415    }
16416
16417    /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
16418    ///
16419    /// # Example
16420    /// ```ignore,no_run
16421    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16422    /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
16423    /// ```
16424    pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16425        self.verified_success_integrity = v.into();
16426        self
16427    }
16428
16429    /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
16430    ///
16431    /// # Example
16432    /// ```ignore,no_run
16433    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16434    /// use google_cloud_kms_v1::model::ProtectionLevel;
16435    /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
16436    /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
16437    /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
16438    /// ```
16439    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16440        mut self,
16441        v: T,
16442    ) -> Self {
16443        self.protection_level = v.into();
16444        self
16445    }
16446}
16447
16448impl wkt::message::Message for MacVerifyResponse {
16449    fn typename() -> &'static str {
16450        "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
16451    }
16452}
16453
16454/// Response message for
16455/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
16456///
16457/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
16458#[derive(Clone, Default, PartialEq)]
16459#[non_exhaustive]
16460pub struct DecapsulateResponse {
16461    /// The resource name of the
16462    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16463    /// decapsulation. Check this field to verify that the intended resource was
16464    /// used for decapsulation.
16465    ///
16466    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16467    pub name: std::string::String,
16468
16469    /// The decapsulated shared_secret originally encapsulated with the matching
16470    /// public key.
16471    pub shared_secret: ::bytes::Bytes,
16472
16473    /// Integrity verification field. A CRC32C checksum of the returned
16474    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
16475    /// An integrity check of
16476    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16477    /// can be performed by computing the CRC32C checksum of
16478    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16479    /// and comparing your results to this field. Discard the response in case of
16480    /// non-matching checksum values, and perform a limited number of retries. A
16481    /// persistent mismatch may indicate an issue in your computation of the CRC32C
16482    /// checksum. Note: receiving this response message indicates that
16483    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16484    /// successfully decrypt the
16485    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
16486    /// field is defined as int64 for reasons of compatibility across different
16487    /// languages. However, it is a non-negative integer, which will never exceed
16488    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
16489    /// this type.
16490    ///
16491    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16492    /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
16493    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16494    pub shared_secret_crc32c: std::option::Option<i64>,
16495
16496    /// Integrity verification field. A flag indicating whether
16497    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16498    /// was received by
16499    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16500    /// for the integrity verification of the
16501    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
16502    /// value of this field indicates either that
16503    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16504    /// was left unset or that it was not delivered to
16505    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16506    /// set
16507    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16508    /// but this field is still false, discard the response and perform a limited
16509    /// number of retries.
16510    ///
16511    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16512    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
16513    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16514    pub verified_ciphertext_crc32c: bool,
16515
16516    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16517    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16518    /// decapsulation.
16519    ///
16520    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16521    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16522    pub protection_level: crate::model::ProtectionLevel,
16523
16524    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16525}
16526
16527impl DecapsulateResponse {
16528    pub fn new() -> Self {
16529        std::default::Default::default()
16530    }
16531
16532    /// Sets the value of [name][crate::model::DecapsulateResponse::name].
16533    ///
16534    /// # Example
16535    /// ```ignore,no_run
16536    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16537    /// let x = DecapsulateResponse::new().set_name("example");
16538    /// ```
16539    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16540        self.name = v.into();
16541        self
16542    }
16543
16544    /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
16545    ///
16546    /// # Example
16547    /// ```ignore,no_run
16548    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16549    /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
16550    /// ```
16551    pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16552        self.shared_secret = v.into();
16553        self
16554    }
16555
16556    /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16557    ///
16558    /// # Example
16559    /// ```ignore,no_run
16560    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16561    /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
16562    /// ```
16563    pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
16564    where
16565        T: std::convert::Into<i64>,
16566    {
16567        self.shared_secret_crc32c = std::option::Option::Some(v.into());
16568        self
16569    }
16570
16571    /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16572    ///
16573    /// # Example
16574    /// ```ignore,no_run
16575    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16576    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
16577    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
16578    /// ```
16579    pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16580    where
16581        T: std::convert::Into<i64>,
16582    {
16583        self.shared_secret_crc32c = v.map(|x| x.into());
16584        self
16585    }
16586
16587    /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
16588    ///
16589    /// # Example
16590    /// ```ignore,no_run
16591    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16592    /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
16593    /// ```
16594    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16595        self.verified_ciphertext_crc32c = v.into();
16596        self
16597    }
16598
16599    /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
16600    ///
16601    /// # Example
16602    /// ```ignore,no_run
16603    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16604    /// use google_cloud_kms_v1::model::ProtectionLevel;
16605    /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
16606    /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
16607    /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
16608    /// ```
16609    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16610        mut self,
16611        v: T,
16612    ) -> Self {
16613        self.protection_level = v.into();
16614        self
16615    }
16616}
16617
16618impl wkt::message::Message for DecapsulateResponse {
16619    fn typename() -> &'static str {
16620        "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
16621    }
16622}
16623
16624/// Response message for
16625/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
16626///
16627/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
16628#[derive(Clone, Default, PartialEq)]
16629#[non_exhaustive]
16630pub struct GenerateRandomBytesResponse {
16631    /// The generated data.
16632    pub data: ::bytes::Bytes,
16633
16634    /// Integrity verification field. A CRC32C checksum of the returned
16635    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
16636    /// An integrity check of
16637    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16638    /// can be performed by computing the CRC32C checksum of
16639    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16640    /// and comparing your results to this field. Discard the response in case of
16641    /// non-matching checksum values, and perform a limited number of retries. A
16642    /// persistent mismatch may indicate an issue in your computation of the CRC32C
16643    /// checksum. Note: This field is defined as int64 for reasons of compatibility
16644    /// across different languages. However, it is a non-negative integer, which
16645    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16646    /// languages that support this type.
16647    ///
16648    /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
16649    pub data_crc32c: std::option::Option<wkt::Int64Value>,
16650
16651    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16652}
16653
16654impl GenerateRandomBytesResponse {
16655    pub fn new() -> Self {
16656        std::default::Default::default()
16657    }
16658
16659    /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
16660    ///
16661    /// # Example
16662    /// ```ignore,no_run
16663    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16664    /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
16665    /// ```
16666    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16667        self.data = v.into();
16668        self
16669    }
16670
16671    /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16672    ///
16673    /// # Example
16674    /// ```ignore,no_run
16675    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16676    /// use wkt::Int64Value;
16677    /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
16678    /// ```
16679    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
16680    where
16681        T: std::convert::Into<wkt::Int64Value>,
16682    {
16683        self.data_crc32c = std::option::Option::Some(v.into());
16684        self
16685    }
16686
16687    /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16688    ///
16689    /// # Example
16690    /// ```ignore,no_run
16691    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16692    /// use wkt::Int64Value;
16693    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
16694    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
16695    /// ```
16696    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16697    where
16698        T: std::convert::Into<wkt::Int64Value>,
16699    {
16700        self.data_crc32c = v.map(|x| x.into());
16701        self
16702    }
16703}
16704
16705impl wkt::message::Message for GenerateRandomBytesResponse {
16706    fn typename() -> &'static str {
16707        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
16708    }
16709}
16710
16711/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
16712///
16713/// [google.cloud.kms.v1.Digest]: crate::model::Digest
16714#[derive(Clone, Default, PartialEq)]
16715#[non_exhaustive]
16716pub struct Digest {
16717    /// Required. The message digest.
16718    pub digest: std::option::Option<crate::model::digest::Digest>,
16719
16720    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16721}
16722
16723impl Digest {
16724    pub fn new() -> Self {
16725        std::default::Default::default()
16726    }
16727
16728    /// Sets the value of [digest][crate::model::Digest::digest].
16729    ///
16730    /// Note that all the setters affecting `digest` are mutually
16731    /// exclusive.
16732    ///
16733    /// # Example
16734    /// ```ignore,no_run
16735    /// # use google_cloud_kms_v1::model::Digest;
16736    /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
16737    /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
16738    /// ```
16739    pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
16740        mut self,
16741        v: T,
16742    ) -> Self {
16743        self.digest = v.into();
16744        self
16745    }
16746
16747    /// The value of [digest][crate::model::Digest::digest]
16748    /// if it holds a `Sha256`, `None` if the field is not set or
16749    /// holds a different branch.
16750    pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
16751        #[allow(unreachable_patterns)]
16752        self.digest.as_ref().and_then(|v| match v {
16753            crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
16754            _ => std::option::Option::None,
16755        })
16756    }
16757
16758    /// Sets the value of [digest][crate::model::Digest::digest]
16759    /// to hold a `Sha256`.
16760    ///
16761    /// Note that all the setters affecting `digest` are
16762    /// mutually exclusive.
16763    ///
16764    /// # Example
16765    /// ```ignore,no_run
16766    /// # use google_cloud_kms_v1::model::Digest;
16767    /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
16768    /// assert!(x.sha256().is_some());
16769    /// assert!(x.sha384().is_none());
16770    /// assert!(x.sha512().is_none());
16771    /// ```
16772    pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16773        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
16774        self
16775    }
16776
16777    /// The value of [digest][crate::model::Digest::digest]
16778    /// if it holds a `Sha384`, `None` if the field is not set or
16779    /// holds a different branch.
16780    pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
16781        #[allow(unreachable_patterns)]
16782        self.digest.as_ref().and_then(|v| match v {
16783            crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
16784            _ => std::option::Option::None,
16785        })
16786    }
16787
16788    /// Sets the value of [digest][crate::model::Digest::digest]
16789    /// to hold a `Sha384`.
16790    ///
16791    /// Note that all the setters affecting `digest` are
16792    /// mutually exclusive.
16793    ///
16794    /// # Example
16795    /// ```ignore,no_run
16796    /// # use google_cloud_kms_v1::model::Digest;
16797    /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
16798    /// assert!(x.sha384().is_some());
16799    /// assert!(x.sha256().is_none());
16800    /// assert!(x.sha512().is_none());
16801    /// ```
16802    pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16803        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
16804        self
16805    }
16806
16807    /// The value of [digest][crate::model::Digest::digest]
16808    /// if it holds a `Sha512`, `None` if the field is not set or
16809    /// holds a different branch.
16810    pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
16811        #[allow(unreachable_patterns)]
16812        self.digest.as_ref().and_then(|v| match v {
16813            crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
16814            _ => std::option::Option::None,
16815        })
16816    }
16817
16818    /// Sets the value of [digest][crate::model::Digest::digest]
16819    /// to hold a `Sha512`.
16820    ///
16821    /// Note that all the setters affecting `digest` are
16822    /// mutually exclusive.
16823    ///
16824    /// # Example
16825    /// ```ignore,no_run
16826    /// # use google_cloud_kms_v1::model::Digest;
16827    /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
16828    /// assert!(x.sha512().is_some());
16829    /// assert!(x.sha256().is_none());
16830    /// assert!(x.sha384().is_none());
16831    /// ```
16832    pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16833        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
16834        self
16835    }
16836}
16837
16838impl wkt::message::Message for Digest {
16839    fn typename() -> &'static str {
16840        "type.googleapis.com/google.cloud.kms.v1.Digest"
16841    }
16842}
16843
16844/// Defines additional types related to [Digest].
16845pub mod digest {
16846    #[allow(unused_imports)]
16847    use super::*;
16848
16849    /// Required. The message digest.
16850    #[derive(Clone, Debug, PartialEq)]
16851    #[non_exhaustive]
16852    pub enum Digest {
16853        /// A message digest produced with the SHA-256 algorithm.
16854        Sha256(::bytes::Bytes),
16855        /// A message digest produced with the SHA-384 algorithm.
16856        Sha384(::bytes::Bytes),
16857        /// A message digest produced with the SHA-512 algorithm.
16858        Sha512(::bytes::Bytes),
16859    }
16860}
16861
16862/// Cloud KMS metadata for the given
16863/// [google.cloud.location.Location][google.cloud.location.Location].
16864///
16865/// [google.cloud.location.Location]: google_cloud_location::model::Location
16866#[derive(Clone, Default, PartialEq)]
16867#[non_exhaustive]
16868pub struct LocationMetadata {
16869    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16870    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16871    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
16872    /// location.
16873    ///
16874    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16875    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16876    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
16877    pub hsm_available: bool,
16878
16879    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16880    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16881    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
16882    /// this location.
16883    ///
16884    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16885    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16886    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
16887    pub ekm_available: bool,
16888
16889    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16890    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16891    /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
16892    /// can be created in this location.
16893    ///
16894    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16895    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16896    /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
16897    pub hsm_single_tenant_available: bool,
16898
16899    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16900}
16901
16902impl LocationMetadata {
16903    pub fn new() -> Self {
16904        std::default::Default::default()
16905    }
16906
16907    /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
16908    ///
16909    /// # Example
16910    /// ```ignore,no_run
16911    /// # use google_cloud_kms_v1::model::LocationMetadata;
16912    /// let x = LocationMetadata::new().set_hsm_available(true);
16913    /// ```
16914    pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16915        self.hsm_available = v.into();
16916        self
16917    }
16918
16919    /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
16920    ///
16921    /// # Example
16922    /// ```ignore,no_run
16923    /// # use google_cloud_kms_v1::model::LocationMetadata;
16924    /// let x = LocationMetadata::new().set_ekm_available(true);
16925    /// ```
16926    pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16927        self.ekm_available = v.into();
16928        self
16929    }
16930
16931    /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
16932    ///
16933    /// # Example
16934    /// ```ignore,no_run
16935    /// # use google_cloud_kms_v1::model::LocationMetadata;
16936    /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
16937    /// ```
16938    pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16939        self.hsm_single_tenant_available = v.into();
16940        self
16941    }
16942}
16943
16944impl wkt::message::Message for LocationMetadata {
16945    fn typename() -> &'static str {
16946        "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
16947    }
16948}
16949
16950/// Represents the metadata of the
16951/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]
16952/// long-running operation.
16953///
16954/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
16955#[derive(Clone, Default, PartialEq)]
16956#[non_exhaustive]
16957pub struct DeleteCryptoKeyMetadata {
16958    /// Output only. The resource name of the
16959    /// [RetiredResource][google.cloud.kms.v1.RetiredResource] created as a result
16960    /// of this operation, in the format
16961    /// `projects/*/locations/*/retiredResources/*`.
16962    ///
16963    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
16964    pub retired_resource: std::string::String,
16965
16966    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16967}
16968
16969impl DeleteCryptoKeyMetadata {
16970    pub fn new() -> Self {
16971        std::default::Default::default()
16972    }
16973
16974    /// Sets the value of [retired_resource][crate::model::DeleteCryptoKeyMetadata::retired_resource].
16975    ///
16976    /// # Example
16977    /// ```ignore,no_run
16978    /// # use google_cloud_kms_v1::model::DeleteCryptoKeyMetadata;
16979    /// let x = DeleteCryptoKeyMetadata::new().set_retired_resource("example");
16980    /// ```
16981    pub fn set_retired_resource<T: std::convert::Into<std::string::String>>(
16982        mut self,
16983        v: T,
16984    ) -> Self {
16985        self.retired_resource = v.into();
16986        self
16987    }
16988}
16989
16990impl wkt::message::Message for DeleteCryptoKeyMetadata {
16991    fn typename() -> &'static str {
16992        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyMetadata"
16993    }
16994}
16995
16996/// Represents the metadata of the
16997/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]
16998/// long-running operation.
16999///
17000/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
17001#[derive(Clone, Default, PartialEq)]
17002#[non_exhaustive]
17003pub struct DeleteCryptoKeyVersionMetadata {
17004    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17005}
17006
17007impl DeleteCryptoKeyVersionMetadata {
17008    pub fn new() -> Self {
17009        std::default::Default::default()
17010    }
17011}
17012
17013impl wkt::message::Message for DeleteCryptoKeyVersionMetadata {
17014    fn typename() -> &'static str {
17015        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionMetadata"
17016    }
17017}
17018
17019/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
17020/// cryptographic operations are performed. For more information, see [Protection
17021/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
17022///
17023/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17024///
17025/// # Working with unknown values
17026///
17027/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17028/// additional enum variants at any time. Adding new variants is not considered
17029/// a breaking change. Applications should write their code in anticipation of:
17030///
17031/// - New values appearing in future releases of the client library, **and**
17032/// - New values received dynamically, without application changes.
17033///
17034/// Please consult the [Working with enums] section in the user guide for some
17035/// guidelines.
17036///
17037/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17038#[derive(Clone, Debug, PartialEq)]
17039#[non_exhaustive]
17040pub enum ProtectionLevel {
17041    /// Not specified.
17042    Unspecified,
17043    /// Crypto operations are performed in software.
17044    Software,
17045    /// Crypto operations are performed in a Hardware Security Module.
17046    Hsm,
17047    /// Crypto operations are performed by an external key manager.
17048    External,
17049    /// Crypto operations are performed in an EKM-over-VPC backend.
17050    ExternalVpc,
17051    /// Crypto operations are performed in a single-tenant HSM.
17052    HsmSingleTenant,
17053    /// If set, the enum was initialized with an unknown value.
17054    ///
17055    /// Applications can examine the value using [ProtectionLevel::value] or
17056    /// [ProtectionLevel::name].
17057    UnknownValue(protection_level::UnknownValue),
17058}
17059
17060#[doc(hidden)]
17061pub mod protection_level {
17062    #[allow(unused_imports)]
17063    use super::*;
17064    #[derive(Clone, Debug, PartialEq)]
17065    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17066}
17067
17068impl ProtectionLevel {
17069    /// Gets the enum value.
17070    ///
17071    /// Returns `None` if the enum contains an unknown value deserialized from
17072    /// the string representation of enums.
17073    pub fn value(&self) -> std::option::Option<i32> {
17074        match self {
17075            Self::Unspecified => std::option::Option::Some(0),
17076            Self::Software => std::option::Option::Some(1),
17077            Self::Hsm => std::option::Option::Some(2),
17078            Self::External => std::option::Option::Some(3),
17079            Self::ExternalVpc => std::option::Option::Some(4),
17080            Self::HsmSingleTenant => std::option::Option::Some(5),
17081            Self::UnknownValue(u) => u.0.value(),
17082        }
17083    }
17084
17085    /// Gets the enum value as a string.
17086    ///
17087    /// Returns `None` if the enum contains an unknown value deserialized from
17088    /// the integer representation of enums.
17089    pub fn name(&self) -> std::option::Option<&str> {
17090        match self {
17091            Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
17092            Self::Software => std::option::Option::Some("SOFTWARE"),
17093            Self::Hsm => std::option::Option::Some("HSM"),
17094            Self::External => std::option::Option::Some("EXTERNAL"),
17095            Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
17096            Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
17097            Self::UnknownValue(u) => u.0.name(),
17098        }
17099    }
17100}
17101
17102impl std::default::Default for ProtectionLevel {
17103    fn default() -> Self {
17104        use std::convert::From;
17105        Self::from(0)
17106    }
17107}
17108
17109impl std::fmt::Display for ProtectionLevel {
17110    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17111        wkt::internal::display_enum(f, self.name(), self.value())
17112    }
17113}
17114
17115impl std::convert::From<i32> for ProtectionLevel {
17116    fn from(value: i32) -> Self {
17117        match value {
17118            0 => Self::Unspecified,
17119            1 => Self::Software,
17120            2 => Self::Hsm,
17121            3 => Self::External,
17122            4 => Self::ExternalVpc,
17123            5 => Self::HsmSingleTenant,
17124            _ => Self::UnknownValue(protection_level::UnknownValue(
17125                wkt::internal::UnknownEnumValue::Integer(value),
17126            )),
17127        }
17128    }
17129}
17130
17131impl std::convert::From<&str> for ProtectionLevel {
17132    fn from(value: &str) -> Self {
17133        use std::string::ToString;
17134        match value {
17135            "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
17136            "SOFTWARE" => Self::Software,
17137            "HSM" => Self::Hsm,
17138            "EXTERNAL" => Self::External,
17139            "EXTERNAL_VPC" => Self::ExternalVpc,
17140            "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
17141            _ => Self::UnknownValue(protection_level::UnknownValue(
17142                wkt::internal::UnknownEnumValue::String(value.to_string()),
17143            )),
17144        }
17145    }
17146}
17147
17148impl serde::ser::Serialize for ProtectionLevel {
17149    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17150    where
17151        S: serde::Serializer,
17152    {
17153        match self {
17154            Self::Unspecified => serializer.serialize_i32(0),
17155            Self::Software => serializer.serialize_i32(1),
17156            Self::Hsm => serializer.serialize_i32(2),
17157            Self::External => serializer.serialize_i32(3),
17158            Self::ExternalVpc => serializer.serialize_i32(4),
17159            Self::HsmSingleTenant => serializer.serialize_i32(5),
17160            Self::UnknownValue(u) => u.0.serialize(serializer),
17161        }
17162    }
17163}
17164
17165impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
17166    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17167    where
17168        D: serde::Deserializer<'de>,
17169    {
17170        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
17171            ".google.cloud.kms.v1.ProtectionLevel",
17172        ))
17173    }
17174}
17175
17176/// Describes the reason for a data access. Please refer to
17177/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
17178/// for the detailed semantic meaning of justification reason codes.
17179///
17180/// # Working with unknown values
17181///
17182/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17183/// additional enum variants at any time. Adding new variants is not considered
17184/// a breaking change. Applications should write their code in anticipation of:
17185///
17186/// - New values appearing in future releases of the client library, **and**
17187/// - New values received dynamically, without application changes.
17188///
17189/// Please consult the [Working with enums] section in the user guide for some
17190/// guidelines.
17191///
17192/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17193#[derive(Clone, Debug, PartialEq)]
17194#[non_exhaustive]
17195pub enum AccessReason {
17196    /// Unspecified access reason.
17197    ReasonUnspecified,
17198    /// Customer-initiated support.
17199    CustomerInitiatedSupport,
17200    /// Google-initiated access for system management and troubleshooting.
17201    GoogleInitiatedService,
17202    /// Google-initiated access in response to a legal request or legal process.
17203    ThirdPartyDataRequest,
17204    /// Google-initiated access for security, fraud, abuse, or compliance purposes.
17205    GoogleInitiatedReview,
17206    /// Customer uses their account to perform any access to their own data which
17207    /// their IAM policy authorizes.
17208    CustomerInitiatedAccess,
17209    /// Google systems access customer data to help optimize the structure of the
17210    /// data or quality for future uses by the customer.
17211    GoogleInitiatedSystemOperation,
17212    /// No reason is expected for this key request.
17213    ReasonNotExpected,
17214    /// Deprecated: This code is no longer generated by
17215    /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17216    /// available in both Key Access Justifications and Access Transparency logs
17217    /// provide customer-visible signals of emergency access in more precise
17218    /// contexts.
17219    ///
17220    /// Customer uses their account to perform any access to their own data which
17221    /// their IAM policy authorizes, and one of the following is true:
17222    ///
17223    /// * A Google administrator has reset the root-access account associated with
17224    ///   the user's organization within the past 7 days.
17225    /// * A Google-initiated emergency access operation has interacted with a
17226    ///   resource in the same project or folder as the currently accessed resource
17227    ///   within the past 7 days.
17228    #[deprecated]
17229    ModifiedCustomerInitiatedAccess,
17230    /// Deprecated: This code is no longer generated by
17231    /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17232    /// available in both Key Access Justifications and Access Transparency logs
17233    /// provide customer-visible signals of emergency access in more precise
17234    /// contexts.
17235    ///
17236    /// Google systems access customer data to help optimize the structure of the
17237    /// data or quality for future uses by the customer, and one of the following
17238    /// is true:
17239    ///
17240    /// * A Google administrator has reset the root-access account associated with
17241    ///   the user's organization within the past 7 days.
17242    /// * A Google-initiated emergency access operation has interacted with a
17243    ///   resource in the same project or folder as the currently accessed resource
17244    ///   within the past 7 days.
17245    #[deprecated]
17246    ModifiedGoogleInitiatedSystemOperation,
17247    /// Google-initiated access to maintain system reliability.
17248    GoogleResponseToProductionAlert,
17249    /// One of the following operations is being executed while simultaneously
17250    /// encountering an internal technical issue which prevented a more precise
17251    /// justification code from being generated:
17252    ///
17253    /// * Your account has been used to perform any access to your own data which
17254    ///   your IAM policy authorizes.
17255    /// * An automated Google system operates on encrypted customer data which your
17256    ///   IAM policy authorizes.
17257    /// * Customer-initiated Google support access.
17258    /// * Google-initiated support access to protect system reliability.
17259    CustomerAuthorizedWorkflowServicing,
17260    /// If set, the enum was initialized with an unknown value.
17261    ///
17262    /// Applications can examine the value using [AccessReason::value] or
17263    /// [AccessReason::name].
17264    UnknownValue(access_reason::UnknownValue),
17265}
17266
17267#[doc(hidden)]
17268pub mod access_reason {
17269    #[allow(unused_imports)]
17270    use super::*;
17271    #[derive(Clone, Debug, PartialEq)]
17272    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17273}
17274
17275impl AccessReason {
17276    /// Gets the enum value.
17277    ///
17278    /// Returns `None` if the enum contains an unknown value deserialized from
17279    /// the string representation of enums.
17280    pub fn value(&self) -> std::option::Option<i32> {
17281        match self {
17282            Self::ReasonUnspecified => std::option::Option::Some(0),
17283            Self::CustomerInitiatedSupport => std::option::Option::Some(1),
17284            Self::GoogleInitiatedService => std::option::Option::Some(2),
17285            Self::ThirdPartyDataRequest => std::option::Option::Some(3),
17286            Self::GoogleInitiatedReview => std::option::Option::Some(4),
17287            Self::CustomerInitiatedAccess => std::option::Option::Some(5),
17288            Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
17289            Self::ReasonNotExpected => std::option::Option::Some(7),
17290            Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
17291            Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
17292            Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
17293            Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
17294            Self::UnknownValue(u) => u.0.value(),
17295        }
17296    }
17297
17298    /// Gets the enum value as a string.
17299    ///
17300    /// Returns `None` if the enum contains an unknown value deserialized from
17301    /// the integer representation of enums.
17302    pub fn name(&self) -> std::option::Option<&str> {
17303        match self {
17304            Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
17305            Self::CustomerInitiatedSupport => {
17306                std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
17307            }
17308            Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
17309            Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
17310            Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
17311            Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
17312            Self::GoogleInitiatedSystemOperation => {
17313                std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
17314            }
17315            Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
17316            Self::ModifiedCustomerInitiatedAccess => {
17317                std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
17318            }
17319            Self::ModifiedGoogleInitiatedSystemOperation => {
17320                std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
17321            }
17322            Self::GoogleResponseToProductionAlert => {
17323                std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
17324            }
17325            Self::CustomerAuthorizedWorkflowServicing => {
17326                std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
17327            }
17328            Self::UnknownValue(u) => u.0.name(),
17329        }
17330    }
17331}
17332
17333impl std::default::Default for AccessReason {
17334    fn default() -> Self {
17335        use std::convert::From;
17336        Self::from(0)
17337    }
17338}
17339
17340impl std::fmt::Display for AccessReason {
17341    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17342        wkt::internal::display_enum(f, self.name(), self.value())
17343    }
17344}
17345
17346impl std::convert::From<i32> for AccessReason {
17347    fn from(value: i32) -> Self {
17348        match value {
17349            0 => Self::ReasonUnspecified,
17350            1 => Self::CustomerInitiatedSupport,
17351            2 => Self::GoogleInitiatedService,
17352            3 => Self::ThirdPartyDataRequest,
17353            4 => Self::GoogleInitiatedReview,
17354            5 => Self::CustomerInitiatedAccess,
17355            6 => Self::GoogleInitiatedSystemOperation,
17356            7 => Self::ReasonNotExpected,
17357            8 => Self::ModifiedCustomerInitiatedAccess,
17358            9 => Self::ModifiedGoogleInitiatedSystemOperation,
17359            10 => Self::GoogleResponseToProductionAlert,
17360            11 => Self::CustomerAuthorizedWorkflowServicing,
17361            _ => Self::UnknownValue(access_reason::UnknownValue(
17362                wkt::internal::UnknownEnumValue::Integer(value),
17363            )),
17364        }
17365    }
17366}
17367
17368impl std::convert::From<&str> for AccessReason {
17369    fn from(value: &str) -> Self {
17370        use std::string::ToString;
17371        match value {
17372            "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
17373            "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
17374            "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
17375            "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
17376            "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
17377            "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
17378            "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
17379            "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
17380            "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
17381            "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
17382                Self::ModifiedGoogleInitiatedSystemOperation
17383            }
17384            "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
17385            "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
17386            _ => Self::UnknownValue(access_reason::UnknownValue(
17387                wkt::internal::UnknownEnumValue::String(value.to_string()),
17388            )),
17389        }
17390    }
17391}
17392
17393impl serde::ser::Serialize for AccessReason {
17394    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17395    where
17396        S: serde::Serializer,
17397    {
17398        match self {
17399            Self::ReasonUnspecified => serializer.serialize_i32(0),
17400            Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
17401            Self::GoogleInitiatedService => serializer.serialize_i32(2),
17402            Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
17403            Self::GoogleInitiatedReview => serializer.serialize_i32(4),
17404            Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
17405            Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
17406            Self::ReasonNotExpected => serializer.serialize_i32(7),
17407            Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
17408            Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
17409            Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
17410            Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
17411            Self::UnknownValue(u) => u.0.serialize(serializer),
17412        }
17413    }
17414}
17415
17416impl<'de> serde::de::Deserialize<'de> for AccessReason {
17417    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17418    where
17419        D: serde::Deserializer<'de>,
17420    {
17421        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
17422            ".google.cloud.kms.v1.AccessReason",
17423        ))
17424    }
17425}